Skip to content

Commit

Permalink
do nothing if failed to cancel open orders
Browse files Browse the repository at this point in the history
  • Loading branch information
narumiruna committed May 3, 2024
1 parent bf732ed commit b35cfbe
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/strategy/atrpin/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit b35cfbe

Please sign in to comment.