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