Skip to content

Commit 98891bc

Browse files
committed
improve min_value handling
1 parent 276295a commit 98891bc

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

cmd/live.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -511,9 +511,11 @@ func init() { //nolint:gochecknoinits
511511
liveCmd.Flags().StringSliceVarP(&ownWallets, "wallets", "w", []string{}, "Own wallet addresses")
512512
_ = viper.BindPFlag("wallets", liveCmd.Flags().Lookup("wallets"))
513513

514-
// min value for sales to be shown
514+
// min value for sales to be shown (single item price)
515515
liveCmd.Flags().Float64("min-value", 0.0, "minimum value to show sales")
516516
_ = viper.BindPFlag("show.min_value", liveCmd.Flags().Lookup("min-value"))
517+
// multiplier for min_value applied to the total price of a tx
518+
viper.SetDefault("show.min_value_multiplier", 2.0)
517519

518520
// what to show
519521
liveCmd.Flags().Bool("show-mints", false, "Show mints")

internal/trapri/trapri.go

+14-4
Original file line numberDiff line numberDiff line change
@@ -485,12 +485,22 @@ func formatTokenTransaction(gb *gloomberg.Gloomberg, seawa *seawatcher.SeaWatche
485485

486486
//
487487
// min value
488+
// if the average price is below the min_value and the total price is below
489+
// the min_value * min_value_multiplier, don't show the tx in the stream
488490
if !isOwnCollection || (!ttx.IsListing() && !ttx.IsItemBid() && !ttx.IsCollectionOffer()) {
489-
totalValueBelowMinValue := ttx.GetPrice().Ether() < viper.GetFloat64("show.min_value")
490-
if ttx.GetPrice().Ether() > 0.0 && totalValueBelowMinValue {
491-
gbl.Log.Debugf("price is below min_value, not showing")
491+
if ttx.GetPrice().Ether() > 0.0 && averagePrice.Ether() > 0.0 {
492+
minValue := viper.GetFloat64("show.min_value")
492493

493-
ttx.DoNotPrint = true
494+
averageBelowMinValue := averagePrice.Ether() < minValue
495+
totalBelowMultiMinValue := ttx.GetPrice().Ether() < minValue*viper.GetFloat64("show.min_value_multiplier")
496+
497+
gbl.Log.Debugf("total: %f | avg: %f | averageBelowMinValue: %+v | totalBelowMultiMinValue: %+v", ttx.GetPrice().Ether(), averagePrice.Ether(), averageBelowMinValue, totalBelowMultiMinValue)
498+
499+
if averageBelowMinValue && totalBelowMultiMinValue {
500+
gbl.Log.Debugf("price is below min_value, not showing")
501+
502+
ttx.DoNotPrint = true
503+
}
494504
}
495505
}
496506

0 commit comments

Comments
 (0)