service: handle error

This commit is contained in:
austin362667 2022-01-13 19:32:38 +08:00
parent 9a1d2cba31
commit f661db56bd

View File

@ -25,8 +25,13 @@ 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 {
return err
}
if _, ok := markets[symbol]; ok {
if err := s.TradeService.Sync(ctx, exchange, symbol, startTime); err != nil {
return err
@ -37,7 +42,6 @@ func (s *SyncService) SyncSessionSymbols(ctx context.Context, exchange types.Exc
}
}
}
}
log.Infof("syncing %s deposit records...", exchange.Name())
if err := s.DepositService.Sync(ctx, exchange); err != nil {