mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
service: handle error
This commit is contained in:
parent
9a1d2cba31
commit
f661db56bd
|
@ -25,16 +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)
|
||||
// TODO: bbgo import cycle error
|
||||
//markets, err := bbgo.LoadExchangeMarketsWithCache(ctx, exchange)
|
||||
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
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user