From 9f510da78b38b5d685170e3fb03429e130e6d801 Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 23 Aug 2024 16:57:29 +0800 Subject: [PATCH] xmaker: use margin order to hedge positions --- pkg/strategy/xmaker/strategy.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/strategy/xmaker/strategy.go b/pkg/strategy/xmaker/strategy.go index c8c376a5e..f5412fd27 100644 --- a/pkg/strategy/xmaker/strategy.go +++ b/pkg/strategy/xmaker/strategy.go @@ -572,11 +572,12 @@ func (s *Strategy) Hedge(ctx context.Context, pos fixedpoint.Value) { bbgo.Notify("Submitting %s hedge order %s %v", s.Symbol, side.String(), quantity) orderExecutor := &bbgo.ExchangeOrderExecutor{Session: s.sourceSession} returnOrders, err := orderExecutor.SubmitOrders(ctx, types.SubmitOrder{ - Market: s.sourceMarket, - Symbol: s.Symbol, - Type: types.OrderTypeMarket, - Side: side, - Quantity: quantity, + Market: s.sourceMarket, + Symbol: s.Symbol, + Type: types.OrderTypeMarket, + Side: side, + Quantity: quantity, + MarginSideEffect: types.SideEffectTypeMarginBuy, }) if err != nil {