fix: lower intervals in raw files

This commit is contained in:
olli 2024-02-07 09:46:44 +01:00
parent 212cbd771b
commit e3670179ec
2 changed files with 110 additions and 112 deletions

View File

@ -103,8 +103,8 @@ do
# Get current assets # Get current assets
get_assets || continue get_assets || continue
# stop here if no full loop ##### Sell something? ####
[ ${FULL_LOOP} == 0 ] && continue check_for_sell
# Get current balances # Get current balances
get_balances || continue get_balances || continue
@ -115,8 +115,8 @@ do
f_market_performance=$(cat MARKET_PERFORMANCE_LATEST) f_market_performance=$(cat MARKET_PERFORMANCE_LATEST)
fi fi
##### Sell something? #### # stop here if no full loop
check_for_sell [ ${FULL_LOOP} == 0 ] && continue
##### Buy something? #### ##### Buy something? ####
check_for_buy check_for_buy

View File

@ -7,8 +7,7 @@ function get_asset {
local f_ASSET_HIST_FILE="asset-histories/${f_ASSET}.history-raw.csv" local f_ASSET_HIST_FILE="asset-histories/${f_ASSET}.history-raw.csv"
[ -f "${f_ASSET_HIST_FILE}" ] || echo "Date and Time,Price" >"${f_ASSET_HIST_FILE}" [ -f "${f_ASSET_HIST_FILE}" ] || echo "Date and Time,Price" >"${f_ASSET_HIST_FILE}"
if ! grep -q "^$(echo "${f_timestamp}" | cut -d: -f1,2)" "${f_ASSET_HIST_FILE}"
then
local f_line="${f_timestamp},$(egrep "^${f_ASSET}," EXCHANGE_GET_ASSETS_CMD_OUT | cut -d, -f2)" local f_line="${f_timestamp},$(egrep "^${f_ASSET}," EXCHANGE_GET_ASSETS_CMD_OUT | cut -d, -f2)"
echo "${f_line}" >>${f_ASSET_HIST_FILE} echo "${f_line}" >>${f_ASSET_HIST_FILE}
@ -33,7 +32,7 @@ function get_asset {
fi fi
[ ${FULL_LOOP} == 0 ] && return 0 [ ${FULL_LOOP} == 0 ] && return 0
grep -q "^$(echo "${f_timestamp}" | cut -d: -f1,2)" "${f_ASSET_HIST_FILE}" || return 0
f_ASSET_HIST_FILE="asset-histories/${f_ASSET}.history.csv" f_ASSET_HIST_FILE="asset-histories/${f_ASSET}.history.csv"
if find "${f_ASSET_HIST_FILE}" -mmin -${INTERVAL_MIN} | grep -q "${f_ASSET_HIST_FILE}" if find "${f_ASSET_HIST_FILE}" -mmin -${INTERVAL_MIN} | grep -q "${f_ASSET_HIST_FILE}"
then then
@ -119,6 +118,5 @@ function get_asset {
# end with newline # end with newline
echo "" >>${f_ASSET_HIST_FILE} echo "" >>${f_ASSET_HIST_FILE}
fi
} }