close positions of symbol

This commit is contained in:
olli 2024-06-14 22:44:13 +02:00
parent f93d33a6a1
commit f6c358d807

View File

@ -0,0 +1,22 @@
function position_close {
# Info for log
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
local f_symbol=$1
local f_position
get_symbols
get_positions
get_position_array
for f_position in "${f_get_positions_array[@]}"
do
get_position_line_vars "$f_position"
if [ "$f_symbol" = "$f_position_symbol" ]
then
f_side="sell"
[ "$f_position_side" = "short" ] && f_side="buy"
order $f_symbol crypto_amount:$f_position_contracts $f_side
fi
done
}