functions: cancel order(s)

This commit is contained in:
olli 2024-12-12 16:23:15 +01:00
parent f66f1934a1
commit 0a6d7264cb

View File

@ -41,17 +41,55 @@ function order_cancel {
g_echo_note "No orders for $f_symbol/$f_asset found" g_echo_note "No orders for $f_symbol/$f_asset found"
return 0 return 0
fi fi
# for f_order in "${f_get_orders_array[@]}"
# do
# get_order_line_vars "$f_order"
# if [[ $f_symbol = $f_order_symbol ]]
# then
# f_ccxt "print(${STOCK_EXCHANGE}.cancelAllOrders('$f_symbol'))"
# get_orders "$f_symbol"
# get_orders_array
# fi
# done
} }
function order_cancel_all {
# Info for log
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
local f_order
get_symbols_ticker
get_orders_array
for f_order in "${f_get_orders_array[@]}"
do
get_order_line_vars "$f_order"
if [[ $f_symbol = $f_order_symbol ]]
then
f_ccxt "print(${STOCK_EXCHANGE}.cancelAllOrders('$f_symbol'))"
get_orders "$f_symbol"
get_orders_array
fi
done
}
function order_cancel_id {
# Info for log
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
local f_symbol=$1
local f_id=$2
local f_order
get_symbols_ticker
get_orders "$f_symbol"
get_orders_array
local f_asset=${f_symbol//:$CURRENCY/}
f_asset=${f_asset//\//}
if grep -q "$f_asset.*$f_id" values-orders
then
f_ccxt "print(${STOCK_EXCHANGE}.cancelOrder(id='${f_id}', symbol='${f_symbol}'))"
get_orders "$f_symbol"
get_orders_array
else
g_echo_note "No orders for $f_symbol/$f_asset with id $f_id found"
return 1
fi
}