diff --git a/dabo/functions/get_orders.sh b/dabo/functions/get_orders.sh index 1fba19a..be0ed97 100644 --- a/dabo/functions/get_orders.sh +++ b/dabo/functions/get_orders.sh @@ -90,36 +90,40 @@ function get_orders_array { function get_order_line_vars { local f_order_line=$1 + g_array $f_order_line f_order_array , f_order_symbol=${f_order_array[0]} local f_asset=${f_order_symbol//:$CURRENCY/} f_asset=${f_asset//\//} - o[${f_asset}_type]=${f_order_array[1]} - f_order_type=${f_order_array[1]} - - o[${f_asset}_side]=${f_order_array[2]} - f_order_side=${f_order_array[2]} - - o[${f_asset}_entry_price]=${f_order_array[3]} - f_order_entry_price=${f_order_array[3]} - - o[${f_asset}_amount]=${f_order_array[4]} - f_order_amount=${f_order_array[4]} - - o[${f_asset}_id]=${f_order_array[5]} - f_order_id=${f_order_array[5]} - - o[${f_asset}_stoplossprice]=${f_order_array[6]} - f_order_stoplossprice=${f_order_array[6]} - - 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]} + local f_order_type=${f_order_array[1]} + local f_order_side=${f_order_array[2]} + local f_type + if [[ $f_order_type = limit ]] + then + [[ $f_order_type = buy ]] && f_type="open_long" + [[ $f_order_type = sell ]] && f_type="open_short" + fi + if [[ $f_order_type = Stop ]] + then + [[ $f_order_type = buy ]] && f_type="sl_close_short" + [[ $f_order_type = sell ]] && f_type="sl_close_long" + fi + if [[ $f_order_type = MarketIfTouched ]] + then + [[ $f_order_type = buy ]] && f_type="tp_close_short" + [[ $f_order_type = sell ]] && f_type="tp_close_long" + fi + 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]} }