diff --git a/darkstat/configs_export/routes_trades.go b/darkstat/configs_export/routes_trades.go index 5ca76c70..52772a00 100644 --- a/darkstat/configs_export/routes_trades.go +++ b/darkstat/configs_export/routes_trades.go @@ -33,7 +33,16 @@ func NewTradeRoute(g *GraphResults, buying_good *MarketGood, selling_good *Marke return route } - +func (t *TradeRoute) GetProffitVolume() float64 { + profit_v_t := GetProffitPerTime(t.Route.g, t.BuyingGood, t.SellingGood) + time_s := GetTimeS(t.Route.g, t.BuyingGood, t.SellingGood) + kilo_volume := KiloVolumesDeliverable(t.BuyingGood, t.SellingGood) + kilo_volume = math.Min(kilo_volume, 50) + if time_s == 0 || time_s > float64(trades.INF/2) { + return 0 + } + return profit_v_t * time_s * kilo_volume +} func (t *TradeRoute) GetProffitPerTime() float64 { return GetProffitPerTime(t.Route.g, t.BuyingGood, t.SellingGood) } @@ -99,7 +108,7 @@ func NewTradePathExporter( func (e *TradePathExporter) GetBaseTradePathsFiltered(TradeRoutes []*ComboTradeRoute) []*ComboTradeRoute { sort.Slice(TradeRoutes, func(i, j int) bool { - return TradeRoutes[i].Transport.GetProffitPerTime() > TradeRoutes[j].Transport.GetProffitPerTime() + return TradeRoutes[i].Transport.GetProffitVolume() > TradeRoutes[j].Transport.GetProffitVolume() }) return TradeRoutes } @@ -148,7 +157,7 @@ func (e *TradePathExporter) GetBaseTradePathsFrom(ctx context.Context, base *Bas return } kilo_volumes := KiloVolumesDeliverable(buying_good, selling_good_at_base) - if kilo_volumes < 5 { + if kilo_volumes <= 0.01 { return } TradeRoutes = append(TradeRoutes, trade_route) @@ -198,7 +207,7 @@ func (e *TradePathExporter) GetBaseTradePathsTo(ctx context.Context, base *Base) return } kilo_volumes := KiloVolumesDeliverable(buying_good, selling_good) - if kilo_volumes < 5 { + if kilo_volumes <= 0.01 { return } TradeRoutes = append(TradeRoutes, trade_route) @@ -298,6 +307,7 @@ func (e *TradePathExporter) GetBestTradeDeals(ctx context.Context, bases []*Base type BaseBestPathTimes struct { TransportProfitPerTime *float64 + TransportProfitVolume *float64 FrigateProfitPerTime *float64 FreighterProfitPerTime *float64 } @@ -336,14 +346,17 @@ func (e *TradePathExporter) GetBaseBestPathFrom(ctx context.Context, base *Base) } kilo_volumes := KiloVolumesDeliverable(buying_good, selling_good) - if kilo_volumes < 5 { + kilo_volumes = math.Min(kilo_volumes, 50) + if kilo_volumes <= 0.01 { return } if result.TransportProfitPerTime == nil { result.TransportProfitPerTime = ptr.Ptr(TransportProfitPerTime) + result.TransportProfitVolume = ptr.Ptr(TransportProfitPerTime * time_s * kilo_volumes) } else if TransportProfitPerTime > *result.TransportProfitPerTime { result.TransportProfitPerTime = ptr.Ptr(TransportProfitPerTime) + result.TransportProfitVolume = ptr.Ptr(TransportProfitPerTime * time_s * kilo_volumes) } if result.FrigateProfitPerTime == nil { @@ -401,14 +414,17 @@ func (e *TradePathExporter) GetBaseBestPathTo(ctx context.Context, base *Base) * } kilo_volumes := KiloVolumesDeliverable(buying_good, selling_good) - if kilo_volumes < 5 { + kilo_volumes = math.Min(kilo_volumes, 50) + if kilo_volumes <= 0.01 { return } if result.TransportProfitPerTime == nil { result.TransportProfitPerTime = ptr.Ptr(TransportProfitPerTime) + result.TransportProfitVolume = ptr.Ptr(TransportProfitPerTime * time_s * kilo_volumes) } else if TransportProfitPerTime > *result.TransportProfitPerTime { result.TransportProfitPerTime = ptr.Ptr(TransportProfitPerTime) + result.TransportProfitVolume = ptr.Ptr(TransportProfitPerTime * time_s * kilo_volumes) } if result.FrigateProfitPerTime == nil { diff --git a/darkstat/front/bases.templ b/darkstat/front/bases.templ index 44ed9488..f9f3b7e6 100644 --- a/darkstat/front/bases.templ +++ b/darkstat/front/bases.templ @@ -124,6 +124,9 @@ templ BasesTable( } if tab_mode == BaseTabTradesFrom || tab_mode == BaseTabTradesTo || tab_mode == BaseTabOres { + + @frmt.MultiLinestring([]string{"Best", "Transport", "profit", "volume"}) + @frmt.MultiLinestring([]string{"Best", "Transport", "profit/v", "¢/sec"}) @@ -288,6 +291,13 @@ templ BaseRow(base *configs_export.Base, tab_mode BaseMode, pinm tab.PinMod, sha } } if routes != nil { + + if routes.TransportProfitVolume != nil { + { fmt.Sprintf("%2.0f", *routes.TransportProfitVolume * 1000) } + } else { + 0 + } + @@ -667,6 +677,9 @@ templ BaseTradesShared(shared *types.SharedData, tab_mode BaseMode) { Commodity + + @frmt.MultiLinestring([]string{"Transport", "Profit", "volume"}) + @frmt.MultiLinestring([]string{"Transport", "Profit/v/t", "¢ents/sec"}) @@ -798,6 +811,7 @@ templ TradeRouteRow(trade_route *configs_export.ComboTradeRoute, shared *types.S { trade_route.Transport.SellingGood.Name + frmt.FormattedShipClassOfCommodity(trade_route.Transport.SellingGood.ShipClass) } } + { fmt.Sprintf("%.0f", trade_route.Transport.GetProffitVolume() * 1000) } { fmt.Sprintf("%.2f", trade_route.Transport.GetProffitPerTime() * 100) } if shared.ShowDisco { { fmt.Sprintf("%.2f", trade_route.Frigate.GetProffitPerTime() * 100) }