pp & fibonacci time fix

This commit is contained in:
olli 2023-12-14 15:03:56 +01:00
parent 98c8dabf1a
commit 530230cbb5

View File

@ -8,10 +8,21 @@ function get_range {
local f_hist_file="$1" local f_hist_file="$1"
# Get last days (past day is the usual range for calculationg Levels / Pivot Point) - Should be Tiomezone where most traders on exchange are in # Get last days (past day is the usual range for calculationg Levels / Pivot Point) - Should be Tiomezone where most traders on exchange are in
# TODO:Add support for timezone
local f_latest_date=$(tail -n1 ${f_hist_file} | cut -d, -f1) local f_latest_date=$(tail -n1 ${f_hist_file} | cut -d, -f1)
local f_range_day=$(date "+%F " --date="${f_latest_date} yesterday") local f_range_yesterday=$(date "+%F" --date="${f_latest_date} 2-days-ago")
local f_range_data=$(grep "^${f_range_day}" ${f_hist_file} | cut -d , -f2 | grep "^[0-9]") local f_range_day=$(date "+%F" --date="${f_latest_date} 3-days-ago")
# winter time
if date +%Z | grep -q "CET"
then
local f_range_data=$(egrep "^${f_range_day} [0-2][1-9]:|^${f_range_day} 10:|^${f_range_day} 20:|^${f_range_yesterday} 00:" ${f_hist_file} | cut -d, -f2 | grep "^[0-9]")
# summer time
elif date +%Z | grep -q "CEST"
then
local f_range_data=$(egrep "^${f_range_day} [0-2][2-9]:|^${f_range_day} 1[0-1]:|^${f_range_day} 2[0-1]:|^${f_range_today} 0[0-1]:" ${f_hist_file} | cut -d, -f2 | grep "^[0-9]")
# TODO: other - timezones!?
else
local f_range_data=$(grep "^${f_range_day} " ${f_hist_file} | cut -d, -f2 | grep "^[0-9]")
fi
# Check for new range # Check for new range
local f_last_range_day=$(tail -n2 ${f_hist_file} | head -n1 | cut -d, -f24) local f_last_range_day=$(tail -n2 ${f_hist_file} | head -n1 | cut -d, -f24)