do nothing if failed to cancel open orders

This commit is contained in:
narumi 2024-05-03 14:52:41 +08:00
parent bf732ed410
commit b35cfbeffd

View File

@ -75,6 +75,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
session.MarketDataStream.OnKLineClosed(types.KLineWith(s.Symbol, s.Interval, func(k types.KLine) {
if err := s.Strategy.OrderExecutor.GracefulCancel(ctx); err != nil {
log.WithError(err).Error("unable to cancel open orders...")
return
}
account, err := session.UpdateAccount(ctx)
@ -83,8 +84,14 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
return
}
baseBalance, _ := account.Balance(s.Market.BaseCurrency)
quoteBalance, _ := account.Balance(s.Market.QuoteCurrency)
baseBalance, ok := account.Balance(s.Market.BaseCurrency)
if !ok {
log.Errorf("%s balance not found", s.Market.BaseCurrency)
}
quoteBalance, ok := account.Balance(s.Market.QuoteCurrency)
if !ok {
log.Errorf("%s balance not found", s.Market.QuoteCurrency)
}
lastAtr := atr.Last(0)
log.Infof("atr: %f", lastAtr)