Compare commits

...

2 Commits

Author SHA1 Message Date
3b16b56d27 fix python 2024-03-25 22:11:49 +01:00
08689a36eb jobs var 2024-03-25 21:24:23 +01:00

View File

@ -1,5 +1,4 @@
function f_ccxt { function f_ccxt {
if [ -s /dabo/.${STOCK_EXCHANGE}-secrets ] if [ -s /dabo/.${STOCK_EXCHANGE}-secrets ]
then then
. /dabo/.${STOCK_EXCHANGE}-secrets . /dabo/.${STOCK_EXCHANGE}-secrets
@ -8,18 +7,16 @@ function f_ccxt {
return 1 return 1
fi fi
local g_ccxt_jobs
mapfile -t g_ccxt_jobs < <(jobs -r)
# Initialize ccxt in python # Initialize ccxt in python
if [ -z "$g_python_running" ] || [ -z "$f_ccxt_initialized" ] if ! [[ ${g_python_jobs[*]} =~ python-pipeexec.py ]] || [ -z "$f_ccxt_initialized" ]
then then
g_python 'import os' || return 1 g_python 'import os' || return 1
g_python 'import sys' || return 1 g_python 'import sys' || return 1
g_python 'sys.path.append("/ccxt/python")' || return 1 g_python 'sys.path.append("/ccxt/python")' || return 1
g_python 'import ccxt' || return 1 g_python 'import ccxt' || return 1
g_python "exchange = ccxt.${STOCK_EXCHANGE}({'apiKey': '${API_KEY}','secret': '${API_SECRET}','options': {'defaultType': 'swap',},})" || return 1 g_python "exchange = ccxt.${STOCK_EXCHANGE}({'apiKey': '${API_KEY}','secret': '${API_SECRET}','options': {'defaultType': 'swap',},})" || return 1
f_ccxt_initialized=true f_ccxt_initialized=true
fi fi
@ -28,5 +25,4 @@ function f_ccxt {
g_python "$@" || return 1 g_python "$@" || return 1
unset f_ccxt_result unset f_ccxt_result
f_ccxt_result=${g_python_result[*]} f_ccxt_result=${g_python_result[*]}
} }