From 55c6303f0f616cf67d478a2f02e8dc2f989fe2b6 Mon Sep 17 00:00:00 2001 From: olli Date: Mon, 25 Mar 2024 17:07:19 +0100 Subject: [PATCH] python ccxt --- dabo/functions/ccxt.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 dabo/functions/ccxt.sh diff --git a/dabo/functions/ccxt.sh b/dabo/functions/ccxt.sh new file mode 100644 index 0000000..4e543d6 --- /dev/null +++ b/dabo/functions/ccxt.sh @@ -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 + +}