mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 16:55:15 +00:00
xfunding: correct method names
This commit is contained in:
parent
20cd73e6ad
commit
80c30d15a0
|
@ -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
|
||||||
|
@ -444,9 +447,12 @@ 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")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user