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_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&quoteOrderQty=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&quoteOrderQty=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