rename MarkStrategyID to just Mark

This commit is contained in:
c9s 2021-03-16 14:07:47 +08:00
parent ebcef65b01
commit 8c08cfebb7
3 changed files with 4 additions and 4 deletions

View File

@ -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,

View File

@ -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)

View File

@ -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")
}
}