This commit is contained in:
olli 2024-12-16 16:40:29 +01:00
parent 0109799a4c
commit 21125e84e5
2 changed files with 7 additions and 4 deletions

View File

@ -145,8 +145,9 @@ function get_position_line_vars {
f_position_takeprofit_price=${f_position_array[7]} f_position_takeprofit_price=${f_position_array[7]}
fi fi
printf -v f_position_asset_amount %.2f ${f_position_array[8]} #printf -v f_position_asset_amount %.2f ${f_position_array[8]}
p[${f_asset}_asset_amount]=$f_position_asset_amount #p[${f_asset}_asset_amount]=$f_position_asset_amount
p[${f_asset}_asset_amount]=${f_position_array[8]}
# calc pnl percentage # calc pnl percentage
if [[ $f_position_side = long ]] if [[ $f_position_side = long ]]

View File

@ -147,7 +147,8 @@ function order {
# stoploss (change) for open position # stoploss (change) for open position
elif [[ $f_type = "stoploss" ]] elif [[ $f_type = "stoploss" ]]
then then
f_params="${f_params}'reduceOnly': True, 'triggerPrice': $f_stoploss, 'triggerDirection': 'down', 'type': 'market'" f_type="market"
f_params="${f_params}'reduceOnly': True, 'triggerPrice': $f_stoploss, 'triggerDirection': 'down', 'type': '$f_type'"
fi fi
fi fi
if [ -n "$f_takeprofit" ] if [ -n "$f_takeprofit" ]
@ -172,7 +173,8 @@ function order {
[[ $f_type =~ limit|market ]] && f_params="${f_params}'takeProfit': { 'triggerPrice': $f_takeprofit, 'type': 'limit', 'price': $f_takeprofit, }, " [[ $f_type =~ limit|market ]] && f_params="${f_params}'takeProfit': { 'triggerPrice': $f_takeprofit, 'type': 'limit', 'price': $f_takeprofit, }, "
if [[ $f_type = "takeprofit" ]] if [[ $f_type = "takeprofit" ]]
then then
f_params="${f_params}'reduceOnly': True, 'triggerPrice': $f_takeprofit, 'triggerDirection': 'up', 'type': 'limit'" f_type="limit"
f_params="${f_params}'reduceOnly': True, 'triggerPrice': $f_takeprofit, 'triggerDirection': 'up', 'type': '$f_type'"
fi fi
fi fi