mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 23:05:15 +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{}
|
markets := types.MarketMap{}
|
||||||
for _, symbol := range exchangeInfo.Symbols {
|
for _, symbol := range exchangeInfo.Symbols {
|
||||||
log.Info(symbol)
|
|
||||||
markets[symbol.Symbol] = toGlobalFuturesMarket(symbol)
|
markets[symbol.Symbol] = toGlobalFuturesMarket(symbol)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,12 +493,7 @@ func (e *Exchange) QueryAccount(ctx context.Context) (*types.Account, error) {
|
||||||
return futuresAccount, nil
|
return futuresAccount, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
account, err := e.QuerySpotAccount(ctx)
|
return e.QuerySpotAccount(ctx)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return account, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *Exchange) QueryOpenOrders(ctx context.Context, symbol string) (orders []types.Order, err error) {
|
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 {
|
if err != nil {
|
||||||
return orders, err
|
return orders, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return toGlobalFuturesOrders(binanceOrders)
|
return toGlobalFuturesOrders(binanceOrders)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1094,9 +1087,8 @@ func (e *Exchange) QueryTrades(ctx context.Context, symbol string, options *type
|
||||||
return trades, nil
|
return trades, nil
|
||||||
} else if e.IsFutures {
|
} else if e.IsFutures {
|
||||||
var remoteTrades []*futures.AccountTrade
|
var remoteTrades []*futures.AccountTrade
|
||||||
req := e.futuresClient.NewListAccountTradeService(). // IsIsolated(e.IsIsolatedFutures).
|
req := e.futuresClient.NewListAccountTradeService(). //IsIsolated(e.IsIsolatedFutures).
|
||||||
Symbol(symbol)
|
Symbol(symbol)
|
||||||
|
|
||||||
if options.Limit > 0 {
|
if options.Limit > 0 {
|
||||||
req.Limit(int(options.Limit))
|
req.Limit(int(options.Limit))
|
||||||
} else {
|
} else {
|
||||||
|
@ -1115,7 +1107,7 @@ func (e *Exchange) QueryTrades(ctx context.Context, symbol string, options *type
|
||||||
for _, t := range remoteTrades {
|
for _, t := range remoteTrades {
|
||||||
localTrade, err := toGlobalFuturesTrade(*t)
|
localTrade, err := toGlobalFuturesTrade(*t)
|
||||||
if err != nil {
|
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
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,17 +25,20 @@ type SyncService struct {
|
||||||
func (s *SyncService) SyncSessionSymbols(ctx context.Context, exchange types.Exchange, startTime time.Time, symbols ...string) error {
|
func (s *SyncService) SyncSessionSymbols(ctx context.Context, exchange types.Exchange, startTime time.Time, symbols ...string) error {
|
||||||
for _, symbol := range symbols {
|
for _, symbol := range symbols {
|
||||||
log.Infof("syncing %s %s trades...", exchange.Name(), symbol)
|
log.Infof("syncing %s %s trades...", exchange.Name(), symbol)
|
||||||
if err := s.TradeService.Sync(ctx, exchange, symbol, startTime); err != nil {
|
markets, err := exchange.QueryMarkets(ctx)
|
||||||
return err
|
if err != nil {
|
||||||
}
|
if _, ok := markets[symbol]; ok {
|
||||||
|
if err := s.TradeService.Sync(ctx, exchange, symbol, startTime); err != nil {
|
||||||
log.Infof("syncing %s %s orders...", exchange.Name(), symbol)
|
return err
|
||||||
if err := s.OrderService.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())
|
log.Infof("syncing %s deposit records...", exchange.Name())
|
||||||
if err := s.DepositService.Sync(ctx, exchange); err != nil {
|
if err := s.DepositService.Sync(ctx, exchange); err != nil {
|
||||||
if err != ErrNotImplemented {
|
if err != ErrNotImplemented {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user