mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
fix: unlock lock to get latest price
This commit is contained in:
parent
2ceb24ad09
commit
4dd4c5823f
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user