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

View File

@ -7,8 +7,7 @@ function get_asset {
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}"
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)"
echo "${f_line}" >>${f_ASSET_HIST_FILE}
@ -33,7 +32,7 @@ function get_asset {
fi
[ ${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"
if find "${f_ASSET_HIST_FILE}" -mmin -${INTERVAL_MIN} | grep -q "${f_ASSET_HIST_FILE}"
then
@ -119,6 +118,5 @@ function get_asset {
# end with newline
echo "" >>${f_ASSET_HIST_FILE}
fi
}