grid2: check price

This commit is contained in:
c9s 2022-12-04 18:21:43 +08:00
parent 9d62720111
commit bce004106c
2 changed files with 6 additions and 2 deletions

View File

@ -35,8 +35,8 @@ exchangeStrategies:
grid2:
symbol: BTCUSDT
upperPrice: 18_000.0
lowerPrice: 13_000.0
gridNumber: 100
lowerPrice: 15_000.0
gridNumber: 30
## compound is used for buying more inventory when the profit is made by the filled SELL order.
## when compound is disabled, fixed quantity is used for each grid order.

View File

@ -497,6 +497,10 @@ func (s *Strategy) newTriggerPriceHandler(ctx context.Context, session *bbgo.Exc
return
}
if s.grid != nil {
return
}
s.logger.Infof("the last price %f hits triggerPrice %f, opening grid", k.Close.Float64(), s.TriggerPrice.Float64())
if err := s.openGrid(ctx, session); err != nil {
s.logger.WithError(err).Errorf("failed to setup grid orders")