fix: unlock lock to get latest price

This commit is contained in:
zenix 2022-07-25 20:34:21 +09:00
parent 2ceb24ad09
commit 4dd4c5823f

View File

@ -298,6 +298,7 @@ func (s *Strategy) InitTickerFunctions(ctx context.Context) {
// for trailing stoploss during the realtime
if s.NoTrailingStopLoss {
s.lock.Unlock()
return
}
atr = s.atr.Last()
@ -564,6 +565,11 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
if !kline.Closed {
return
}
if !s.IsBackTesting() {
balances := s.Session.GetAccount().Balances()
// Notify will parse args to strings and process separately
bbgo.Notify("balances: [Base] %s [Quote] %s kline: %s", balances[s.Market.BaseCurrency].String(), balances[s.Market.QuoteCurrency].String(), kline.String())
}
if kline.Interval == types.Interval1m {
if s.NoTrailingStopLoss || !s.IsBackTesting() {
return