fix: dont run get_assts if STOCK_EXCHANGE is NONE
This commit is contained in:
parent
9d0e0b388c
commit
ae99194986
@ -81,6 +81,28 @@ do
|
||||
INTERVAL_MIN=$(echo "${INTERVAL}/60-1" | bc -l | sed -r 's/^(-?)\./\10./' | cut -d\. -f1)
|
||||
[ -z "${INTERVAL_MIN}" ] && INTERVAL_MIN=1
|
||||
|
||||
### get general market data
|
||||
# Get coingecko data
|
||||
get_coingecko_data
|
||||
|
||||
# Get current MarketData
|
||||
get_marketdata
|
||||
|
||||
# Check the situation on the market
|
||||
if ! market_performance
|
||||
then
|
||||
f_market_performance=$(cat MARKET_PERFORMANCE_LATEST)
|
||||
fi
|
||||
|
||||
|
||||
## watch some manual defined assets
|
||||
watch_assets
|
||||
|
||||
|
||||
## if STOCK_EXCHANGE is present
|
||||
if [ "${STOCK_EXCHANGE}" != "NONE" ]
|
||||
then
|
||||
|
||||
# stock data
|
||||
if [ "${STOCK_EXCHANGE}" = "BINANCE" ]
|
||||
then
|
||||
@ -94,41 +116,22 @@ do
|
||||
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 coingecko data
|
||||
get_coingecko_data
|
||||
|
||||
# watch some manual defined assets
|
||||
watch_assets
|
||||
|
||||
# Get current assets
|
||||
if [ "${STOCK_EXCHANGE}" != "NONE" ]
|
||||
then
|
||||
get_assets || continue
|
||||
fi
|
||||
|
||||
# Get current MarketData
|
||||
get_marketdata
|
||||
|
||||
##### Sell something? ####
|
||||
# Sell something?
|
||||
check_for_sell
|
||||
|
||||
# Get current balances
|
||||
get_balances || continue
|
||||
[ ${FULL_LOOP} = 1 ] && get_balances || continue
|
||||
|
||||
# Buy something?
|
||||
[ ${FULL_LOOP} = 1 ] && check_for_buy
|
||||
|
||||
# Check the situation on the market
|
||||
if ! market_performance
|
||||
then
|
||||
f_market_performance=$(cat MARKET_PERFORMANCE_LATEST)
|
||||
fi
|
||||
|
||||
# stop here if no full loop
|
||||
[ ${FULL_LOOP} == 0 ] && continue
|
||||
|
||||
##### Buy something? ####
|
||||
check_for_buy
|
||||
|
||||
##### Update webpage
|
||||
if jobs | egrep -q "Running.+webpage"
|
||||
## Update webpage
|
||||
if jobs | egrep -q "Running.+webpage" && [ ${FULL_LOOP} = 1 ]
|
||||
then
|
||||
g_echo_note "webpage already running"
|
||||
else
|
||||
|
@ -1,7 +1,7 @@
|
||||
function get_coingecko_data {
|
||||
# get data from coingecko
|
||||
local f_gecko_currencies="usd eur"
|
||||
if find COINGECKO_GET_ASSETS_CMD_OUT -mmin +5 | grep -q COINGECKO_GET_ASSETS_CMD_OUT
|
||||
if find COINGECKO_GET_ASSETS_CMD_OUT -mmin +5 2>/dev/null | grep -q COINGECKO_GET_ASSETS_CMD_OUT
|
||||
then
|
||||
for f_gecko_currency in ${f_gecko_currencies}
|
||||
do
|
||||
|
@ -18,7 +18,7 @@ function get_marketdata {
|
||||
get_marketdata_from_url https://www.investing.com/economic-calendar/cpi-733 US-CONSUMER-PRICE-INDEX
|
||||
get_marketdata_from_url https://www.investing.com/indices/fed-funds-composite-interest-rate-opinion US-FED-FEDERAL-FUNDS-RATE-INVERTED-INDEX
|
||||
# clear old stuff
|
||||
find asset-histories/*INDEX* -type f -mtime +6 -delet
|
||||
find asset-histories/*INDEX* -type f -mtime +6 -delete
|
||||
}
|
||||
|
||||
function get_marketdata_from_url {
|
||||
@ -26,7 +26,7 @@ function get_marketdata_from_url {
|
||||
local f_name="$2"
|
||||
|
||||
## get data for analysis
|
||||
if find asset-histories/${f_name}.history.csv -mmin -${INTERVAL_MIN} | grep -q "asset-histories/${f_name}.history.csv"
|
||||
if find asset-histories/${f_name}.history.csv -mmin -${INTERVAL_MIN} 2>/dev/null | grep -q "asset-histories/${f_name}.history.csv"
|
||||
then
|
||||
g_echo_note "asset-histories/${f_name}.history.csv already downloaded in the last ${INTERVAL_MIN} minutes"
|
||||
f_get_marketdata_price=$(cat MARKET_DATA_CMD_OUT-${f_name})
|
||||
|
Loading…
Reference in New Issue
Block a user