diff --git a/dabo/functions/get_indicators.sh b/dabo/functions/get_indicators.sh index 710d826..2fed97c 100644 --- a/dabo/functions/get_indicators.sh +++ b/dabo/functions/get_indicators.sh @@ -36,8 +36,8 @@ function get_indicators_all { fi # do the job - printf '%(%Y-%m-%d %H:%M:%S)T' >"${f_histfile}.indicators-calculating" - get_indicators "${f_histfile}" ${f_last_intervals} && printf '%(%Y-%m-%d %H:%M:%S)T' >>"$f_histfile.indicators-calculated" + printf "$0 %(%Y-%m-%d %H:%M:%S)T" >"${f_histfile}.indicators-calculating" + get_indicators "${f_histfile}" ${f_last_intervals} && printf "$0 %(%Y-%m-%d %H:%M:%S)T\n" >>"$f_histfile.indicators-calculated" # add missing intervals for example from weekends from non-24h-assets like economic data - interval from filename #f_add_missing_ohlcv_intervals "${f_histfile}" rm -f "${f_histfile}.indicators-calculating" @@ -63,8 +63,8 @@ function get_indicators_all { fi # do the job - printf '%(%Y-%m-%d %H:%M:%S)T' >"${f_histfile}.indicators-calculating" - get_indicators "${f_histfile}" ${f_last_intervals} && printf '%(%Y-%m-%d %H:%M:%S)T' >>"$f_histfile.indicators-calculated" + printf "$0 %(%Y-%m-%d %H:%M:%S)T" >"${f_histfile}.indicators-calculating" + get_indicators "${f_histfile}" ${f_last_intervals} && printf "$0 %(%Y-%m-%d %H:%M:%S)T\n" >>"$f_histfile.indicators-calculated" rm -f "${f_histfile}.indicators-calculating" fi diff --git a/dabo/functions/get_marketdata.sh b/dabo/functions/get_marketdata.sh index c6abfe9..c420517 100644 --- a/dabo/functions/get_marketdata.sh +++ b/dabo/functions/get_marketdata.sh @@ -77,7 +77,7 @@ function get_marketdata { local f_other=$4 local f_timeframe=$5 [ -z "$f_timeframe" ] && f_timeframe=1d - local f_histfile="asset-histories/MARKETDATA_${f_name}.history.1d.csv" + local f_histfile="asset-histories/MARKETDATA_${f_name}.history.${f_timeframe}.csv" local f_dataline f_failed # download @@ -146,11 +146,11 @@ function get_marketdata { # calc indicators and if 1d then generate 1w histfile if [[ $f_interval = 1d ]] then - get_indicators "${f_histfile}" + get_indicators "${f_histfile}" 51 convert_ohlcv_1d_to_1w "${f_histfile}" "${f_histfile/.1d./.1w.}" - get_indicators "${f_histfile/.1d./.1w.}" + get_indicators "${f_histfile/.1d./.1w.}" 51 else - get_indicators "${f_histfile}" 999 + get_indicators "${f_histfile}" 51 fi } diff --git a/dabo/functions/get_ohlcv-candle.sh b/dabo/functions/get_ohlcv-candle.sh index 16da3f6..e2fa603 100644 --- a/dabo/functions/get_ohlcv-candle.sh +++ b/dabo/functions/get_ohlcv-candle.sh @@ -118,13 +118,10 @@ function get_ohlcv-candle { if [[ $f_asset =~ ^ECONOMY- ]] then # economy from yahoo finance - if [ "$f_timeframe" = "1h" ] || [ "$f_timeframe" = "15m" ] || [ "$f_timeframe" = "5m" ] + if ! get_marketdata_yahoo "$f_symbol" "$f_asset" $f_timeframe then - if ! get_marketdata_yahoo "$f_symbol" "$f_asset" $f_timeframe - then - g_echo_error "$f_get_marketdata_coinmarketcap_error" - return 1 - fi + g_echo_error "$f_get_marketdata_coinmarketcap_error" + return 1 fi f_histfile_extdata=$f_histfile_yahoo else @@ -512,6 +509,11 @@ function convert_ohlcv_1d_to_1w { IFS=',' read -r f_date f_open f_high f_low f_close f_volume f_other <<< "$f_line" IFS='-' read -r f_year f_month f_day <<< "$f_date" + [ -z "$f_high" ] && f_high=$f_open + [ -z "$f_low" ] && f_low=$f_open + [ -z "$f_close" ] && f_close=$f_open + [ -z "$f_volume" ] && f_volume=0 + # use week-number to sort day data in weeks f_week_number=$(date -d "$f_year-$f_month-$f_day" +%U) f_week_number=${f_week_number##0}