mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
xfunding: fix sync guard
This commit is contained in:
parent
80c30d15a0
commit
16608619ca
|
@ -374,11 +374,7 @@ func (s *Strategy) reduceFuturesPosition(ctx context.Context) {}
|
||||||
|
|
||||||
// syncFuturesPosition syncs the futures position with the given spot position
|
// syncFuturesPosition syncs the futures position with the given spot position
|
||||||
func (s *Strategy) syncFuturesPosition(ctx context.Context) {
|
func (s *Strategy) syncFuturesPosition(ctx context.Context) {
|
||||||
_ = s.futuresOrderExecutor.GracefulCancel(ctx)
|
if s.positionType != types.PositionShort {
|
||||||
|
|
||||||
ticker, err := s.futuresSession.Exchange.QueryTicker(ctx, s.Symbol)
|
|
||||||
if err != nil {
|
|
||||||
log.WithError(err).Errorf("can not query ticker")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,7 +384,11 @@ func (s *Strategy) syncFuturesPosition(ctx context.Context) {
|
||||||
case PositionOpening, PositionNoOp:
|
case PositionOpening, PositionNoOp:
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.positionType != types.PositionShort {
|
_ = s.futuresOrderExecutor.GracefulCancel(ctx)
|
||||||
|
|
||||||
|
ticker, err := s.futuresSession.Exchange.QueryTicker(ctx, s.Symbol)
|
||||||
|
if err != nil {
|
||||||
|
log.WithError(err).Errorf("can not query ticker")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user