Compare commits
No commits in common. "0f62e2ffbd6c3402f07b75e8b1d2b5c1841f8f98" and "91763326e1e6c77957fa981fd880a7ff26a43349" have entirely different histories.
0f62e2ffbd
...
91763326e1
@ -114,9 +114,6 @@ do
|
|||||||
# Get current positions
|
# Get current positions
|
||||||
[ ${FULL_LOOP} = 1 ] && get_positions || continue
|
[ ${FULL_LOOP} = 1 ] && get_positions || continue
|
||||||
|
|
||||||
# Get current orders
|
|
||||||
[ ${FULL_LOOP} = 1 ] && get_orders || continue
|
|
||||||
|
|
||||||
## Run strategies
|
## Run strategies
|
||||||
[ ${FULL_LOOP} = 1 ] && run_strategies
|
[ ${FULL_LOOP} = 1 ] && run_strategies
|
||||||
|
|
||||||
|
@ -43,43 +43,23 @@ function get_orders {
|
|||||||
fi
|
fi
|
||||||
[ -z "$f_symbols" ] && return 1
|
[ -z "$f_symbols" ] && return 1
|
||||||
|
|
||||||
for f_symbol in ${f_symbols_array_trade[@]}
|
for f_symbol in "${f_symbols[@]}"
|
||||||
do
|
do
|
||||||
f_symbol_file=${f_symbol//:*}
|
f_symbol_file=${f_symbol//:*}
|
||||||
f_symbol_file=${f_symbol_file///}
|
f_symbol_file=${f_symbol_file///}
|
||||||
g_echo_note "Getting orders from $f_symbol to \"CCXT_ORDERS_$f_symbol_file\""
|
g_echo_note "Getting orders from $f_symbol to \"CCXT_OPEN_ORDERS_$f_symbol_file\""
|
||||||
if f_ccxt "print($STOCK_EXCHANGE.fetchOpenOrders(symbol='${f_symbol}'))"
|
if f_ccxt "print($STOCK_EXCHANGE.fetchOpenOrders(symbol='${f_symbol}'))"
|
||||||
then
|
then
|
||||||
echo $f_ccxt_result | tee "CCXT_ORDERS_${f_symbol_file}_RAW" | jq -r "
|
echo $f_ccxt_result | tee "CCXT_OPEN_ORDERS_${f_symbol_file}_RAW" | jq -r "
|
||||||
.[] |
|
.[] |
|
||||||
select(.status==\"open\") |
|
select(.status==\"open\") |
|
||||||
.symbol + \",\" + .type + \",\" + .side + \",\" + (.price|tostring) + \",\" + (.amount|tostring) + \",\" + .id + \",\" + (.stopLossPrice|tostring) + \",\" + (.takeProfitPrice|tostring)
|
.symbol + \",\" + .type + \",\" + .side + \",\" + (.price|tostring) + \",\" + (.stopPrice|tostring) + \",\" + (.amount
|
||||||
" >"CCXT_ORDERS_${f_symbol_file}"
|
|tostring)
|
||||||
|
" >"CCXT_OPEN_ORDERS_${f_symbol_file}"
|
||||||
else
|
else
|
||||||
rm -f "CCXT_ORDERS_${f_symbol_file}_RAW" "CCXT_ORDERS_${f_symbol_file}"
|
rm -f "CCXT_OPEN_ORDERS_${f_symbol_file}_RAW" "CCXT_OPEN_ORDERS_${f_symbol_file}"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
cat CCXT_ORDERS_*${CURRENCY} >CCXT_ORDERS
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_orders_array {
|
|
||||||
g_array CCXT_ORDERS f_get_ordes_rarray
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_orders_line_vars {
|
|
||||||
local f_order_line=$1
|
|
||||||
|
|
||||||
g_array $f_order_line f_order_array ,
|
|
||||||
f_order_symbol=${f_order_array[0]}
|
|
||||||
f_order_type=${f_order_array[1]}
|
|
||||||
f_order_side=${f_order_array[2]}
|
|
||||||
f_order_entry_price=${f_order_array[3]}
|
|
||||||
f_order_amount=${f_order_array[4]}
|
|
||||||
f_order_id=${f_order_array[5]}
|
|
||||||
f_order_stoplossprice=${f_order_array[6]}
|
|
||||||
f_order_takeprofitprice=${f_order_array[7]}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Copyright (c) 2022-2024 olli
|
|
||||||
#
|
|
||||||
# This file is part of dabo (crypto bot).
|
|
||||||
#
|
|
||||||
# dabo is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# dabo is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with dabo. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
function order_close {
|
|
||||||
# Info for log
|
|
||||||
g_echo_note "RUNNING FUNCTION ${FUNCNAME} $@"
|
|
||||||
|
|
||||||
local f_symbol=$1
|
|
||||||
local f_order
|
|
||||||
|
|
||||||
get_symbols_ticker
|
|
||||||
get_orders
|
|
||||||
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'))"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user