From 9f72619f51952f1fcbba31ccd93b0f3fe334b648 Mon Sep 17 00:00:00 2001 From: olli Date: Mon, 16 Dec 2024 22:30:51 +0100 Subject: [PATCH] fixes tp/sl --- dabo/functions/order.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dabo/functions/order.sh b/dabo/functions/order.sh index a40cd09..4fbc982 100644 --- a/dabo/functions/order.sh +++ b/dabo/functions/order.sh @@ -30,7 +30,7 @@ function order { local f_stoploss=$5 local f_takeprofit=$6 local f_params="params={" - local f_type f_side_opposite + local f_type f_side_opposite f_pos_side f_side_opposide f_trigger_sl f_trigger_tp ### validity checks ### @@ -43,12 +43,16 @@ function order { f_side="buy" f_pos_side="Long" f_side_opposide="sell" + f_trigger_sl="down" + f_trigger_tp="up" fi if [ "$f_side" = "short" ] || [ "$f_side" = "sell" ] then f_side="sell" f_pos_side="Short" f_side_opposide="buy" + f_trigger_sl="up" + f_trigger_tp="down" fi [[ $f_side =~ ^buy$|^sell$ ]] || return 1 @@ -152,7 +156,7 @@ function order { then f_type="market" f_price=$f_stoploss - f_params="${f_params}'reduceOnly': True, 'triggerPrice': $f_stoploss, 'triggerDirection': 'down'" + f_params="${f_params}'reduceOnly': True, 'triggerPrice': $f_stoploss, 'triggerDirection': '$f_trigger_sl', " fi fi if [ -n "$f_takeprofit" ] @@ -179,7 +183,7 @@ function order { then f_type="limit" f_price=$f_takeprofit - f_params="${f_params}'reduceOnly': True, 'triggerPrice': $f_takeprofit, 'triggerDirection': 'up'" + f_params="${f_params}'reduceOnly': True, 'triggerPrice': $f_takeprofit, 'triggerDirection': '$f_trigger_tp', " fi fi