mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
not emit WaitToOpenPosition when kline event
This commit is contained in:
parent
6cdd2f0d71
commit
f49924caa4
|
@ -74,7 +74,7 @@ func (s *Strategy) emitNextState(nextState State) {
|
|||
// TakeProfitReady -> the takeProfit order filled ->
|
||||
func (s *Strategy) runState(ctx context.Context) {
|
||||
s.logger.Info("[DCA] runState")
|
||||
stateTriggerTicker := time.NewTicker(3 * time.Minute)
|
||||
stateTriggerTicker := time.NewTicker(1 * time.Minute)
|
||||
defer stateTriggerTicker.Stop()
|
||||
|
||||
for {
|
||||
|
|
|
@ -263,8 +263,6 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.
|
|||
|
||||
session.MarketDataStream.OnKLine(func(kline types.KLine) {
|
||||
switch s.state {
|
||||
case WaitToOpenPosition:
|
||||
s.emitNextState(PositionOpening)
|
||||
case OpenPositionOrderFilled:
|
||||
if s.takeProfitPrice.IsZero() {
|
||||
s.logger.Warn("take profit price should not be 0 when there is at least one open-position order filled, please check it")
|
||||
|
|
Loading…
Reference in New Issue
Block a user