From 3b16b56d2781e1a3232def2c3fa4674f7bb3f8f7 Mon Sep 17 00:00:00 2001 From: olli Date: Mon, 25 Mar 2024 22:11:49 +0100 Subject: [PATCH] fix python --- dabo/functions/ccxt.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/dabo/functions/ccxt.sh b/dabo/functions/ccxt.sh index 1b73102..becba2f 100644 --- a/dabo/functions/ccxt.sh +++ b/dabo/functions/ccxt.sh @@ -7,24 +7,20 @@ function f_ccxt { return 1 fi + local g_ccxt_jobs + mapfile -t g_ccxt_jobs < <(jobs -r) # 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 - set -x g_python 'import os' || return 1 - set +x g_python 'import sys' || return 1 - g_python 'sys.path.append("/ccxt/python")' || 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 - f_ccxt_initialized=true fi - + g_python_waitforoutput=1 g_python "$@" || return 1 unset f_ccxt_result