close positions of symbol
This commit is contained in:
parent
f93d33a6a1
commit
f6c358d807
22
dabo/functions/position_close.sh
Normal file
22
dabo/functions/position_close.sh
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user