From ad6f641c8c3f94c7b8419f842dcaa66e67a7f93d Mon Sep 17 00:00:00 2001 From: olli Date: Wed, 7 Feb 2024 11:54:25 +0100 Subject: [PATCH] fix: dont run exchnage specific functions if STOCK_EXCHANGE is NONE --- dabo/dabo-bot.sh | 54 ++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/dabo/dabo-bot.sh b/dabo/dabo-bot.sh index 7f1e1a8..29e4083 100755 --- a/dabo/dabo-bot.sh +++ b/dabo/dabo-bot.sh @@ -98,38 +98,34 @@ do ## watch some manual defined assets watch_assets - - ## if STOCK_EXCHANGE is present - if [ "${STOCK_EXCHANGE}" != "NONE" ] + # stock data + if [ "${STOCK_EXCHANGE}" = "BINANCE" ] then - - # stock data - if [ "${STOCK_EXCHANGE}" = "BINANCE" ] - then - # command for current token infos (function for setting var QUANTITY_LOT_CUT - TOKEN_INFO_CMD="binance_get_token_info" - # command for buying/selling a token - TRADE_CMD='binance-api-call POST /api/v3/order "&symbol=TOKEN"eOrderQty=QUANTITY&side=ACTION&type=MARKET"' - elif [ "${STOCK_EXCHANGE}" = "BITPANDA" ] - then - TOKEN_INFO_CMD="bitpanda_get_token_info" - TRADE_CMD='bitpanda-api-call POST public/v1/account/orders "--header \"Content-Type: application/json\" --data \"{\\\"instrument_code\\\":\\\"TOKEN\\\",\\\"side\\\":\\\"ACTION\\\",\\\"type\\\":\\\"MARKET\\\",\\\"amount\\\":\\\"QUANTITY\\\"}\""' - fi - - # Get current assets - get_assets || continue - - # Sell something? - check_for_sell - - # Get current balances - [ ${FULL_LOOP} = 1 ] && get_balances || continue - - # Buy something? - [ ${FULL_LOOP} = 1 ] && check_for_buy - + # command for current token infos (function for setting var QUANTITY_LOT_CUT + TOKEN_INFO_CMD="binance_get_token_info" + # command for buying/selling a token + TRADE_CMD='binance-api-call POST /api/v3/order "&symbol=TOKEN"eOrderQty=QUANTITY&side=ACTION&type=MARKET"' + elif [ "${STOCK_EXCHANGE}" = "BITPANDA" ] + then + TOKEN_INFO_CMD="bitpanda_get_token_info" + TRADE_CMD='bitpanda-api-call POST public/v1/account/orders "--header \"Content-Type: application/json\" --data \"{\\\"instrument_code\\\":\\\"TOKEN\\\",\\\"side\\\":\\\"ACTION\\\",\\\"type\\\":\\\"MARKET\\\",\\\"amount\\\":\\\"QUANTITY\\\"}\""' + else + ## stop here if STOCK_EXCHANGE not present + continue fi + # Get current assets + get_assets || continue + + # Sell something? + check_for_sell + + # Get current balances + [ ${FULL_LOOP} = 1 ] && get_balances || continue + + # Buy something? + [ ${FULL_LOOP} = 1 ] && check_for_buy + ## Update webpage if jobs | egrep -q "Running.+webpage" && [ ${FULL_LOOP} = 1 ] then