mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
check if limit is set
This commit is contained in:
parent
02512805f8
commit
bc3754d989
|
@ -267,10 +267,9 @@ func (s *TradeService) Load(ctx context.Context, id int64) (*types.Trade, error)
|
|||
return &trade, err
|
||||
}
|
||||
|
||||
return nil, errors.Wrapf(ErrTradeNotFound,"trade id:%d not found", id)
|
||||
return nil, errors.Wrapf(ErrTradeNotFound, "trade id:%d not found", id)
|
||||
}
|
||||
|
||||
|
||||
func (s *TradeService) MarkStrategyID(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,
|
||||
|
@ -348,7 +347,10 @@ func queryTradesSQL(options QueryTradesOptions) string {
|
|||
|
||||
sql += ` ORDER BY gid ` + ordering
|
||||
|
||||
sql += ` LIMIT ` + strconv.Itoa(options.Limit)
|
||||
if options.Limit > 0 {
|
||||
sql += ` LIMIT ` + strconv.Itoa(options.Limit)
|
||||
}
|
||||
|
||||
return sql
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user