fix: dont run exchnage specific functions if STOCK_EXCHANGE is NONE

This commit is contained in:
olli 2024-02-07 11:54:25 +01:00
parent ae99194986
commit ad6f641c8c

View File

@ -98,38 +98,34 @@ do
## watch some manual defined assets ## watch some manual defined assets
watch_assets watch_assets
# stock data
## if STOCK_EXCHANGE is present if [ "${STOCK_EXCHANGE}" = "BINANCE" ]
if [ "${STOCK_EXCHANGE}" != "NONE" ]
then then
# command for current token infos (function for setting var QUANTITY_LOT_CUT
# stock data TOKEN_INFO_CMD="binance_get_token_info"
if [ "${STOCK_EXCHANGE}" = "BINANCE" ] # command for buying/selling a token
then TRADE_CMD='binance-api-call POST /api/v3/order "&symbol=TOKEN&quoteOrderQty=QUANTITY&side=ACTION&type=MARKET"'
# command for current token infos (function for setting var QUANTITY_LOT_CUT elif [ "${STOCK_EXCHANGE}" = "BITPANDA" ]
TOKEN_INFO_CMD="binance_get_token_info" then
# command for buying/selling a token TOKEN_INFO_CMD="bitpanda_get_token_info"
TRADE_CMD='binance-api-call POST /api/v3/order "&symbol=TOKEN&quoteOrderQty=QUANTITY&side=ACTION&type=MARKET"' 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\\\"}\""'
elif [ "${STOCK_EXCHANGE}" = "BITPANDA" ] else
then ## stop here if STOCK_EXCHANGE not present
TOKEN_INFO_CMD="bitpanda_get_token_info" continue
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
fi 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 ## Update webpage
if jobs | egrep -q "Running.+webpage" && [ ${FULL_LOOP} = 1 ] if jobs | egrep -q "Running.+webpage" && [ ${FULL_LOOP} = 1 ]
then then