xfunding: add PositionReady case

This commit is contained in:
c9s 2024-03-06 22:07:00 +08:00
parent 256e09a863
commit b77618f9d8
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -404,10 +404,12 @@ func (s *Strategy) CrossRun(
) )
} }
} }
default:
} }
switch s.State.PositionState { switch s.State.PositionState {
case PositionReady:
case PositionOpening: case PositionOpening:
// transfer all base assets from the spot account into the spot account // transfer all base assets from the spot account into the spot account
if err := s.transferIn(ctx, s.binanceSpot, s.spotMarket.BaseCurrency, fixedpoint.Zero); err != nil { if err := s.transferIn(ctx, s.binanceSpot, s.spotMarket.BaseCurrency, fixedpoint.Zero); err != nil {
@ -419,6 +421,7 @@ func (s *Strategy) CrossRun(
if err := s.transferOut(ctx, s.binanceSpot, s.spotMarket.BaseCurrency, fixedpoint.Zero); err != nil { if err := s.transferOut(ctx, s.binanceSpot, s.spotMarket.BaseCurrency, fixedpoint.Zero); err != nil {
log.WithError(err).Errorf("futures asset transfer out error") log.WithError(err).Errorf("futures asset transfer out error")
} }
} }
s.spotOrderExecutor = s.allocateOrderExecutor(ctx, s.spotSession, instanceID, s.SpotPosition) s.spotOrderExecutor = s.allocateOrderExecutor(ctx, s.spotSession, instanceID, s.SpotPosition)