fix python

This commit is contained in:
olli 2024-03-25 22:11:49 +01:00
parent 08689a36eb
commit 3b16b56d27

View File

@ -7,24 +7,20 @@ 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
set -x
g_python 'import os' || return 1 g_python 'import os' || return 1
set +x
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
g_python_waitforoutput=1 g_python_waitforoutput=1
g_python "$@" || return 1 g_python "$@" || return 1
unset f_ccxt_result unset f_ccxt_result