cmd/trades: avoid passing since and until at the same time

This commit is contained in:
c9s 2022-01-27 08:57:31 +08:00
parent 78c8cb1362
commit c3c2822c82

View File

@ -7,11 +7,12 @@ import (
"syscall"
"time"
"github.com/c9s/bbgo/pkg/util"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/c9s/bbgo/pkg/util"
"github.com/c9s/bbgo/pkg/bbgo"
"github.com/c9s/bbgo/pkg/cmd/cmdutil"
"github.com/c9s/bbgo/pkg/types"
@ -79,8 +80,8 @@ var tradesCmd = &cobra.Command{
return err
}
until := time.Now()
since := until.Add(-3 * 24 * time.Hour)
now := time.Now()
since := now.Add(-3 * 24 * time.Hour)
tradeHistoryService, ok := session.Exchange.(types.ExchangeTradeHistoryService)
if !ok {
@ -91,7 +92,6 @@ var tradesCmd = &cobra.Command{
trades, err := tradeHistoryService.QueryTrades(ctx, symbol, &types.TradeQueryOptions{
StartTime: &since,
EndTime: &until,
Limit: limit,
LastTradeID: 0,
})