multiple orders in array

This commit is contained in:
olli 2024-09-24 16:43:38 +02:00
parent ee77fa4522
commit a45b4e5f51

View File

@ -90,36 +90,40 @@ function get_orders_array {
function get_order_line_vars { function get_order_line_vars {
local f_order_line=$1 local f_order_line=$1
g_array $f_order_line f_order_array , g_array $f_order_line f_order_array ,
f_order_symbol=${f_order_array[0]} f_order_symbol=${f_order_array[0]}
local f_asset=${f_order_symbol//:$CURRENCY/} local f_asset=${f_order_symbol//:$CURRENCY/}
f_asset=${f_asset//\//} f_asset=${f_asset//\//}
o[${f_asset}_type]=${f_order_array[1]} local f_order_type=${f_order_array[1]}
f_order_type=${f_order_array[1]} local f_order_side=${f_order_array[2]}
local f_type
o[${f_asset}_side]=${f_order_array[2]} if [[ $f_order_type = limit ]]
f_order_side=${f_order_array[2]} then
[[ $f_order_type = buy ]] && f_type="open_long"
o[${f_asset}_entry_price]=${f_order_array[3]} [[ $f_order_type = sell ]] && f_type="open_short"
f_order_entry_price=${f_order_array[3]} fi
if [[ $f_order_type = Stop ]]
o[${f_asset}_amount]=${f_order_array[4]} then
f_order_amount=${f_order_array[4]} [[ $f_order_type = buy ]] && f_type="sl_close_short"
[[ $f_order_type = sell ]] && f_type="sl_close_long"
o[${f_asset}_id]=${f_order_array[5]} fi
f_order_id=${f_order_array[5]} if [[ $f_order_type = MarketIfTouched ]]
then
o[${f_asset}_stoplossprice]=${f_order_array[6]} [[ $f_order_type = buy ]] && f_type="tp_close_short"
f_order_stoplossprice=${f_order_array[6]} [[ $f_order_type = sell ]] && f_type="tp_close_long"
fi
o[${f_asset}_takeprofitprice]=${f_order_array[7]}
f_order_takeprofitprice=${f_order_array[7]}
o[${f_asset}_stopprice]=${f_order_array[8]}
f_order_stopprice=${f_order_array[8]}
o[${f_asset}_${f_type}_type]=${f_order_array[1]}
o[${f_asset}_${f_type}_side]=${f_order_array[2]}
o[${f_asset}_${f_type}_entry_price]=${f_order_array[3]}
o[${f_asset}_${f_type}_amount]=${f_order_array[4]}
o[${f_asset}_${f_type}_id]=${f_order_array[5]}
o[${f_asset}_${f_type}_stoplossprice]=${f_order_array[6]}
o[${f_asset}_${f_type}_takeprofitprice]=${f_order_array[7]}
o[${f_asset}_${f_type}_stopprice]=${f_order_array[8]}
} }