xfunding: correct method names

This commit is contained in:
c9s 2023-03-23 13:02:22 +08:00
parent 20cd73e6ad
commit 80c30d15a0
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -362,14 +362,17 @@ func (s *Strategy) transferIn(ctx context.Context, ex *binance.Exchange, trade t
func (s *Strategy) triggerPositionAction(ctx context.Context) { func (s *Strategy) triggerPositionAction(ctx context.Context) {
switch s.positionAction { switch s.positionAction {
case PositionOpening: case PositionOpening:
s.syncSpotPosition(ctx) s.increaseSpotPosition(ctx)
s.syncFuturesPosition(ctx) s.syncFuturesPosition(ctx)
case PositionClosing: case PositionClosing:
s.syncFuturesPosition(ctx) s.reduceFuturesPosition(ctx)
s.syncSpotPosition(ctx) s.syncSpotPosition(ctx)
} }
} }
func (s *Strategy) reduceFuturesPosition(ctx context.Context) {}
// 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) _ = s.futuresOrderExecutor.GracefulCancel(ctx)
@ -380,10 +383,10 @@ func (s *Strategy) syncFuturesPosition(ctx context.Context) {
} }
switch s.positionAction { switch s.positionAction {
case PositionClosing: case PositionClosing:
return
case PositionOpening: case PositionOpening, PositionNoOp:
}
if s.positionType != types.PositionShort { if s.positionType != types.PositionShort {
return return
@ -443,10 +446,13 @@ func (s *Strategy) syncFuturesPosition(ctx context.Context) {
log.Infof("created orders: %+v", createdOrders) log.Infof("created orders: %+v", createdOrders)
} }
}
} }
func (s *Strategy) syncSpotPosition(ctx context.Context) { func (s *Strategy) syncSpotPosition(ctx context.Context) {
}
func (s *Strategy) increaseSpotPosition(ctx context.Context) {
ticker, err := s.spotSession.Exchange.QueryTicker(ctx, s.Symbol) ticker, err := s.spotSession.Exchange.QueryTicker(ctx, s.Symbol)
if err != nil { if err != nil {
log.WithError(err).Errorf("can not query ticker") log.WithError(err).Errorf("can not query ticker")