python ccxt

This commit is contained in:
olli 2024-03-25 17:07:19 +01:00
parent 5e9e5d6c05
commit 55c6303f0f

23
dabo/functions/ccxt.sh Normal file
View File

@ -0,0 +1,23 @@
function f_ccxt {
if [ -s /dabo/.${STOCK_EXCHANGE}-secrets ]
then
. /dabo/.${STOCK_EXCHANGE}-secrets
else
g_echo_error "No secrets found (/dabo/.${STOCK_EXCHANGE}-secrets) found"
return 1
fi
g_python 'import os' || return 1
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
g_python_wantoutput=1
g_python 'print(exchange.fetch_balance ({"currency": "USDT"}))' || return 1
}