move get_marketdata from get_assets and dont run get_assts if STOCK_EXCHANGE= is NONE
This commit is contained in:
parent
183622d8ad
commit
d9ce0ab7e2
@ -101,7 +101,13 @@ do
|
||||
watch_assets
|
||||
|
||||
# Get current assets
|
||||
get_assets || continue
|
||||
if ! [ STOCK_EXCHANGE -eq "NONE" ]
|
||||
then
|
||||
get_assets || continue
|
||||
fi
|
||||
|
||||
# Get current MarketData
|
||||
get_marketdata
|
||||
|
||||
##### Sell something? ####
|
||||
check_for_sell
|
||||
|
@ -16,6 +16,8 @@ function get_assets {
|
||||
bitpanda-api-call GET "public/v1/market-ticker" || return 1
|
||||
#cat ${g_tmp}/API_CMD_OUT | jq -r '.[] | select(.state=="ACTIVE") | .instrument_code + "," + .last_price' | sed 's/_//' | grep "${CURRENCY}," | egrep -v "${TRANSFER_CURRENCY},|,0[\.][0]*$" >${f_filename}_OUT.tmp
|
||||
cat ${g_tmp}/API_CMD_OUT | jq -r '.[] | .instrument_code + "," + .last_price' | sed 's/_//' | grep "${CURRENCY}," | egrep -v "${TRANSFER_CURRENCY},|,0[\.][0]*$" >${f_filename}_OUT.tmp
|
||||
else
|
||||
f_no_exchange=1
|
||||
fi
|
||||
cat ${g_tmp}/API_CMD_OUT >PRICETICKER
|
||||
|
||||
@ -43,14 +45,9 @@ function get_assets {
|
||||
echo ${f_ASSET} >>ASSETS.tmp
|
||||
done
|
||||
mv ASSETS.tmp ASSETS
|
||||
|
||||
|
||||
## write histfiles by having a look on marketcap
|
||||
#>ASSETS_HIGHEST.tmp
|
||||
# get alread invested assets
|
||||
#f_investedassets_regex=$(cat EXCHANGE_GET_BALANCES_CMD_OUT | cut -d, -f1 | perl -pe 's/^/\^/; s/\n/\|/' | perl -pe 's/\|$//')
|
||||
## write histfiles parallel
|
||||
local f_ASSET
|
||||
|
||||
local f_parallel_arg
|
||||
echo -n "parallel -j3 bash -c --" >/tmp/parallel
|
||||
for f_ASSET in $(cat ASSETS | egrep -v "${BLACKLIST}")
|
||||
@ -63,26 +60,5 @@ function get_assets {
|
||||
export csv_headline
|
||||
. /tmp/parallel
|
||||
|
||||
get_marketdata https://www.boerse.de/indizes/Dow-Jones/US2605661048 DOW-JONES-INDEX
|
||||
get_marketdata https://www.boerse.de/indizes/SundP-500/US78378X1072 SP500-INDEX
|
||||
get_marketdata https://www.boerse.de/indizes/Nasdaq-100/US6311011026 NASDAQ-INDEX
|
||||
get_marketdata https://www.investing.com/indices/msci-eafe MSCI-EAFE-INDEX
|
||||
get_marketdata https://www.investing.com/indices/10-year-treasury-yield 10-YEAR-TREASURY-YIELD-INDEX
|
||||
get_marketdata https://www.boerse.de/rohstoffe/WTI-Rohoelpreis/XD0015948363 OIL-INVERTED-INDEX
|
||||
get_marketdata https://www.boerse.de/rohstoffe/Goldpreis/XC0009655157 GOLD-INDEX
|
||||
#get_marketdata https://www.boerse.de/aktien/Nvidia-Aktie/US67066G1040 NVIDIA-INDEX
|
||||
#get_marketdata https://www.boerse.de/aktien/Tesla-Aktie/US88160R1014 TESLA-INDEX
|
||||
#get_marketdata https://www.boerse.de/aktien/Apple-Aktie/US0378331005 APPLE-INDEX
|
||||
get_marketdata https://www.boerse.de/realtime-kurse/MSCI-World/XC0009692739 MSCI-WORLD-INDEX
|
||||
get_marketdata https://www.boerse.de/indizes/DJ-AMER-OIL-und-GAS/XC0006886516 OIL-GAS-INVERTED-INDEX
|
||||
get_marketdata https://www.boerse.de/fonds/SPDR-SundP-Regional-Banking-ETF/US78464A6982 KRE-BANKING-INDEX
|
||||
#get_marketdata https://www.boerse.de/indizes/Dax/DE0008469008 DAX-INDEX
|
||||
get_marketdata https://www.investing.com/indices/usdollar DXY-INVERTED-INDEX
|
||||
get_marketdata https://www.investing.com/economic-calendar/unemployment-rate-300/ US-UNEMPLOYMENT-INDEX
|
||||
get_marketdata https://www.investing.com/economic-calendar/cpi-733 US-CONSUMER-PRICE-INDEX
|
||||
get_marketdata 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 -delete
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,27 @@
|
||||
function get_marketdata {
|
||||
get_marketdata_from_url https://www.boerse.de/indizes/Dow-Jones/US2605661048 DOW-JONES-INDEX
|
||||
get_marketdata_from_url https://www.boerse.de/indizes/SundP-500/US78378X1072 SP500-INDEX
|
||||
get_marketdata_from_url https://www.boerse.de/indizes/Nasdaq-100/US6311011026 NASDAQ-INDEX
|
||||
get_marketdata_from_url https://www.investing.com/indices/msci-eafe MSCI-EAFE-INDEX
|
||||
get_marketdata_from_url https://www.investing.com/indices/10-year-treasury-yield 10-YEAR-TREASURY-YIELD-INDEX
|
||||
get_marketdata_from_url https://www.boerse.de/rohstoffe/WTI-Rohoelpreis/XD0015948363 OIL-INVERTED-INDEX
|
||||
get_marketdata_from_url https://www.boerse.de/rohstoffe/Goldpreis/XC0009655157 GOLD-INDEX
|
||||
#get_marketdata https://www.boerse.de/aktien/Nvidia-Aktie/US67066G1040 NVIDIA-INDEX
|
||||
#get_marketdata https://www.boerse.de/aktien/Tesla-Aktie/US88160R1014 TESLA-INDEX
|
||||
#get_marketdata https://www.boerse.de/aktien/Apple-Aktie/US0378331005 APPLE-INDEX
|
||||
get_marketdata_from_url https://www.boerse.de/realtime-kurse/MSCI-World/XC0009692739 MSCI-WORLD-INDEX
|
||||
get_marketdata_from_url https://www.boerse.de/indizes/DJ-AMER-OIL-und-GAS/XC0006886516 OIL-GAS-INVERTED-INDEX
|
||||
get_marketdata_from_url https://www.boerse.de/fonds/SPDR-SundP-Regional-Banking-ETF/US78464A6982 KRE-BANKING-INDEX
|
||||
#get_marketdata https://www.boerse.de/indizes/Dax/DE0008469008 DAX-INDEX
|
||||
get_marketdata_from_url https://www.investing.com/indices/usdollar DXY-INVERTED-INDEX
|
||||
get_marketdata_from_url https://www.investing.com/economic-calendar/unemployment-rate-300/ US-UNEMPLOYMENT-INDEX
|
||||
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
|
||||
}
|
||||
|
||||
function get_marketdata_from_url {
|
||||
local f_url="$1"
|
||||
local f_name="$2"
|
||||
|
||||
|
@ -45,8 +45,8 @@ function watch_assets {
|
||||
f_price=""
|
||||
if [[ ${f_asset} =~ ^https ]]
|
||||
then
|
||||
# get asset price from get_marketdata
|
||||
get_marketdata ${f_asset}
|
||||
# get asset price from get_marketdata_from_url
|
||||
get_marketdata_from_url ${f_asset}
|
||||
f_price=${f_get_marketdata_price}
|
||||
readarray -d " " -t f_asset_array < <(echo -n "${f_asset}")
|
||||
f_asset=${f_asset_array[1]}
|
||||
|
Loading…
Reference in New Issue
Block a user