Compare commits

..

No commits in common. "d9ce0ab7e2e911575e3536461c47f96718632b46" and "e3670179ec3e02aa0a37fbb5c7b66fe231ad2270" have entirely different histories.

6 changed files with 33 additions and 39 deletions

View File

@ -12,8 +12,6 @@ rm -r /tmp/parallel-* /tmp/overall-result-* /tmp/g_analyze.sh-*
g_nice g_nice
export FULL_LOOP=1
function g_echo_note { function g_echo_note {
[ -z "$1" ] && return 0 [ -z "$1" ] && return 0

View File

@ -101,13 +101,7 @@ do
watch_assets watch_assets
# Get current assets # Get current assets
if ! [ STOCK_EXCHANGE -eq "NONE" ]
then
get_assets || continue get_assets || continue
fi
# Get current MarketData
get_marketdata
##### Sell something? #### ##### Sell something? ####
check_for_sell check_for_sell

View File

@ -16,8 +16,6 @@ function get_assets {
bitpanda-api-call GET "public/v1/market-ticker" || return 1 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 '.[] | 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 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 fi
cat ${g_tmp}/API_CMD_OUT >PRICETICKER cat ${g_tmp}/API_CMD_OUT >PRICETICKER
@ -46,8 +44,13 @@ function get_assets {
done done
mv ASSETS.tmp ASSETS mv ASSETS.tmp ASSETS
## write histfiles parallel
## 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/\|$//')
local f_ASSET local f_ASSET
local f_parallel_arg local f_parallel_arg
echo -n "parallel -j3 bash -c --" >/tmp/parallel echo -n "parallel -j3 bash -c --" >/tmp/parallel
for f_ASSET in $(cat ASSETS | egrep -v "${BLACKLIST}") for f_ASSET in $(cat ASSETS | egrep -v "${BLACKLIST}")
@ -60,5 +63,26 @@ function get_assets {
export csv_headline export csv_headline
. /tmp/parallel . /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
} }

View File

@ -1,27 +1,4 @@
function get_marketdata { 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_url="$1"
local f_name="$2" local f_name="$2"

View File

@ -41,10 +41,11 @@ function get_vars_from_csv {
get_var_from_line price 2 get_var_from_line price 2
# get newest price from raw file if this is a non-full loop # get newest price from raw file if this is a non-full loop
# TODO: Nicer pure-bash code
if [ ${FULL_LOOP} == 0 ] if [ ${FULL_LOOP} == 0 ]
then then
readarray -d "," -t f_last_line_raw_array < <(tail -n1 "${f_ASSET_HIST_FILE/.csv/-raw.csv}") f_ASSET_HIST_FILE_RAW=$(echo ${f_ASSET_HIST_FILE} | sed 's/.csv$/-raw.csv/')
f_price=${f_last_line_raw_array[1]} f_price=$(tail -n1 "${f_ASSET_HIST_FILE_RAW}" | cut -d, -f2)
fi fi
get_var_from_line price_change 3 get_var_from_line price_change 3

View File

@ -45,8 +45,8 @@ function watch_assets {
f_price="" f_price=""
if [[ ${f_asset} =~ ^https ]] if [[ ${f_asset} =~ ^https ]]
then then
# get asset price from get_marketdata_from_url # get asset price from get_marketdata
get_marketdata_from_url ${f_asset} get_marketdata ${f_asset}
f_price=${f_get_marketdata_price} f_price=${f_get_marketdata_price}
readarray -d " " -t f_asset_array < <(echo -n "${f_asset}") readarray -d " " -t f_asset_array < <(echo -n "${f_asset}")
f_asset=${f_asset_array[1]} f_asset=${f_asset_array[1]}