diff --git a/pkg/service/trade.go b/pkg/service/trade.go index 26601ac70..4286f93cd 100644 --- a/pkg/service/trade.go +++ b/pkg/service/trade.go @@ -341,7 +341,7 @@ func (s *TradeService) Load(ctx context.Context, id int64) (*types.Trade, error) return nil, errors.Wrapf(ErrTradeNotFound, "trade id:%d not found", id) } -func (s *TradeService) MarkStrategyID(ctx context.Context, id int64, strategyID string) error { +func (s *TradeService) Mark(ctx context.Context, id int64, strategyID string) error { result, err := s.DB.NamedExecContext(ctx, "UPDATE `trades` SET `strategy` = :strategy WHERE `id` = :id", map[string]interface{}{ "id": id, "strategy": strategyID, diff --git a/pkg/service/trade_test.go b/pkg/service/trade_test.go index 5e756cd51..8583ea4f0 100644 --- a/pkg/service/trade_test.go +++ b/pkg/service/trade_test.go @@ -36,7 +36,7 @@ func Test_tradeService(t *testing.T) { }) assert.NoError(t, err) - err = service.MarkStrategyID(ctx, 1, "grid") + err = service.Mark(ctx, 1, "grid") assert.NoError(t, err) tradeRecord, err := service.Load(ctx, 1) diff --git a/pkg/strategy/grid/strategy.go b/pkg/strategy/grid/strategy.go index 2624187d7..590661957 100644 --- a/pkg/strategy/grid/strategy.go +++ b/pkg/strategy/grid/strategy.go @@ -333,8 +333,8 @@ func (s *Strategy) tradeUpdateHandler(trade types.Trade) { log.Infof("received trade update of order %d: %+v", trade.OrderID, trade) if s.TradeService != nil { - if err := s.TradeService.MarkStrategyID(context.Background(), trade.ID, ID) ; err != nil { - log.WithError(err).Error("mark strategy ID error") + if err := s.TradeService.Mark(context.Background(), trade.ID, ID); err != nil { + log.WithError(err).Error("trade mark error") } }