mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
rename MarkStrategyID to just Mark
This commit is contained in:
parent
ebcef65b01
commit
8c08cfebb7
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user