mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 08:45:16 +00:00
binance: fix futures symbol not found from syncSession
binance: fix query trades, closed orders futures symbol not found binance: fix futures symbol not found
This commit is contained in:
parent
0f0539fe70
commit
5404bfe7f8
|
@ -178,7 +178,6 @@ func (e *Exchange) QueryMarkets(ctx context.Context) (types.MarketMap, error) {
|
|||
|
||||
markets := types.MarketMap{}
|
||||
for _, symbol := range exchangeInfo.Symbols {
|
||||
log.Info(symbol)
|
||||
markets[symbol.Symbol] = toGlobalFuturesMarket(symbol)
|
||||
}
|
||||
|
||||
|
@ -494,12 +493,7 @@ func (e *Exchange) QueryAccount(ctx context.Context) (*types.Account, error) {
|
|||
return futuresAccount, nil
|
||||
}
|
||||
|
||||
account, err := e.QuerySpotAccount(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return account, nil
|
||||
return e.QuerySpotAccount(ctx)
|
||||
}
|
||||
|
||||
func (e *Exchange) QueryOpenOrders(ctx context.Context, symbol string) (orders []types.Order, err error) {
|
||||
|
@ -578,7 +572,6 @@ func (e *Exchange) QueryClosedOrders(ctx context.Context, symbol string, since,
|
|||
if err != nil {
|
||||
return orders, err
|
||||
}
|
||||
|
||||
return toGlobalFuturesOrders(binanceOrders)
|
||||
}
|
||||
|
||||
|
@ -1094,9 +1087,8 @@ func (e *Exchange) QueryTrades(ctx context.Context, symbol string, options *type
|
|||
return trades, nil
|
||||
} else if e.IsFutures {
|
||||
var remoteTrades []*futures.AccountTrade
|
||||
req := e.futuresClient.NewListAccountTradeService(). // IsIsolated(e.IsIsolatedFutures).
|
||||
req := e.futuresClient.NewListAccountTradeService(). //IsIsolated(e.IsIsolatedFutures).
|
||||
Symbol(symbol)
|
||||
|
||||
if options.Limit > 0 {
|
||||
req.Limit(int(options.Limit))
|
||||
} else {
|
||||
|
@ -1115,7 +1107,7 @@ func (e *Exchange) QueryTrades(ctx context.Context, symbol string, options *type
|
|||
for _, t := range remoteTrades {
|
||||
localTrade, err := toGlobalFuturesTrade(*t)
|
||||
if err != nil {
|
||||
log.WithError(err).Errorf("can not convert binance trade: %+v", t)
|
||||
log.WithError(err).Errorf("can not convert binance futures trade: %+v", t)
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
@ -25,17 +25,20 @@ type SyncService struct {
|
|||
func (s *SyncService) SyncSessionSymbols(ctx context.Context, exchange types.Exchange, startTime time.Time, symbols ...string) error {
|
||||
for _, symbol := range symbols {
|
||||
log.Infof("syncing %s %s trades...", exchange.Name(), symbol)
|
||||
if err := s.TradeService.Sync(ctx, exchange, symbol, startTime); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Infof("syncing %s %s orders...", exchange.Name(), symbol)
|
||||
if err := s.OrderService.Sync(ctx, exchange, symbol, startTime); err != nil {
|
||||
return err
|
||||
markets, err := exchange.QueryMarkets(ctx)
|
||||
if err != nil {
|
||||
if _, ok := markets[symbol]; ok {
|
||||
if err := s.TradeService.Sync(ctx, exchange, symbol, startTime); err != nil {
|
||||
return err
|
||||
}
|
||||
log.Infof("syncing %s %s orders...", exchange.Name(), symbol)
|
||||
if err := s.OrderService.Sync(ctx, exchange, symbol, startTime); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
log.Infof("syncing %s deposit records...", exchange.Name())
|
||||
if err := s.DepositService.Sync(ctx, exchange); err != nil {
|
||||
if err != ErrNotImplemented {
|
||||
|
|
Loading…
Reference in New Issue
Block a user