fixes tp/sl

This commit is contained in:
olli 2024-12-16 22:30:51 +01:00
parent b279735ae8
commit 9f72619f51

View File

@ -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