From 56fdf0a21f2e36c2b64c66476b47773a50f84b23 Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 15 Nov 2024 16:57:00 +0800 Subject: [PATCH] insert net_profit into the table i really don't know why I forgot this lol --- pkg/service/position.go | 3 +++ pkg/service/position_test.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/service/position.go b/pkg/service/position.go index d09b48bcf..7b379a73a 100644 --- a/pkg/service/position.go +++ b/pkg/service/position.go @@ -67,6 +67,7 @@ func (s *PositionService) Insert( base, quote, profit, + net_profit, trade_id, exchange, side, @@ -81,6 +82,7 @@ func (s *PositionService) Insert( :base, :quote, :profit, + :net_profit, :trade_id, :exchange, :side, @@ -96,6 +98,7 @@ func (s *PositionService) Insert( "base": position.Base, "quote": position.Quote, "profit": profit, + "net_profit": netProfit, "trade_id": trade.ID, "exchange": trade.Exchange, "side": trade.Side, diff --git a/pkg/service/position_test.go b/pkg/service/position_test.go index 7340f4811..d3cb76ef3 100644 --- a/pkg/service/position_test.go +++ b/pkg/service/position_test.go @@ -54,7 +54,7 @@ func TestPositionService(t *testing.T) { Exchange: types.ExchangeBinance, Side: types.SideTypeSell, Time: types.Time(time.Now()), - }, fixedpoint.NewFromFloat(10.9), fixedpoint.Zero) + }, fixedpoint.NewFromFloat(10.9), fixedpoint.NewFromFloat(8.1)) assert.NoError(t, err) })