mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
fix: binance futures sync issue
This commit is contained in:
parent
3af08abef2
commit
c81af9ce91
|
@ -20,7 +20,7 @@ func init() {
|
|||
}
|
||||
|
||||
var SyncCmd = &cobra.Command{
|
||||
Use: "sync --session=[exchange_name] --symbol=[pair_name] [--since=yyyy/mm/dd]",
|
||||
Use: "sync [--session=[exchange_name]] [--symbol=[pair_name]] [[--since=yyyy/mm/dd]]",
|
||||
Short: "sync trades and orders history",
|
||||
SilenceUsage: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -1347,6 +1347,9 @@ func (e *Exchange) QueryTrades(ctx context.Context, symbol string, options *type
|
|||
req.FromID(int64(options.LastTradeID))
|
||||
}
|
||||
|
||||
// The parameter fromId cannot be sent with startTime or endTime.
|
||||
// Mentioned in binance futures docs
|
||||
if options.LastTradeID <= 0 {
|
||||
if options.StartTime != nil && options.EndTime != nil {
|
||||
if options.EndTime.Sub(*options.StartTime) < 24*time.Hour {
|
||||
req.StartTime(options.StartTime.UnixMilli())
|
||||
|
@ -1354,11 +1357,10 @@ func (e *Exchange) QueryTrades(ctx context.Context, symbol string, options *type
|
|||
} else {
|
||||
req.StartTime(options.StartTime.UnixMilli())
|
||||
}
|
||||
} else if options.StartTime != nil {
|
||||
req.StartTime(options.StartTime.UnixMilli())
|
||||
} else if options.EndTime != nil {
|
||||
req.EndTime(options.EndTime.UnixMilli())
|
||||
}
|
||||
}
|
||||
|
||||
remoteTrades, err = req.Do(ctx)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue
Block a user