From 2dfa27d9349a28f856b09acf86870162a729860b Mon Sep 17 00:00:00 2001 From: Fredrik <35973823+frin1@users.noreply.github.com> Date: Mon, 19 Sep 2022 21:39:13 +0200 Subject: [PATCH] Add auto-repay --- pkg/bbgo/exit_protective_stop_loss.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pkg/bbgo/exit_protective_stop_loss.go b/pkg/bbgo/exit_protective_stop_loss.go index fbba25768..125c91ec6 100644 --- a/pkg/bbgo/exit_protective_stop_loss.go +++ b/pkg/bbgo/exit_protective_stop_loss.go @@ -67,14 +67,15 @@ func (s *ProtectiveStopLoss) placeStopOrder(ctx context.Context, position *types } createdOrders, err := orderExecutor.SubmitOrders(ctx, types.SubmitOrder{ - Symbol: position.Symbol, - Side: types.SideTypeBuy, - Type: types.OrderTypeStopLimit, - Quantity: position.GetQuantity(), - Price: s.stopLossPrice.Mul(one.Add(fixedpoint.NewFromFloat(0.005))), // +0.5% from the trigger price, slippage protection - StopPrice: s.stopLossPrice, - Market: position.Market, - Tag: "protectiveStopLoss", + Symbol: position.Symbol, + Side: types.SideTypeBuy, + Type: types.OrderTypeStopLimit, + Quantity: position.GetQuantity(), + Price: s.stopLossPrice.Mul(one.Add(fixedpoint.NewFromFloat(0.005))), // +0.5% from the trigger price, slippage protection + StopPrice: s.stopLossPrice, + Market: position.Market, + Tag: "protectiveStopLoss", + MarginSideEffect: types.SideEffectTypeAutoRepay, }) if len(createdOrders) > 0 {