fix
This commit is contained in:
parent
32935143da
commit
27d6bfd320
@ -17,6 +17,33 @@ is_container_running() {
|
||||
fi
|
||||
}
|
||||
|
||||
export CalendarURL=http://cloud23.cvtt.vpn:8000/api/v1/markets/hours?mic=XNYS
|
||||
|
||||
is_business_day() {
|
||||
dt=${1}
|
||||
|
||||
open_time=$(curl -s "${CalendarURL}&start=${dt}&end=${dt}" | jq '.[] | .open_time')
|
||||
if [ -n "${open_time}" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
|
||||
}
|
||||
export -f is_business_day
|
||||
|
||||
get_prev_business_day() {
|
||||
Start=${1}
|
||||
while true; do
|
||||
if is_business_day ${Start}; then
|
||||
break
|
||||
fi
|
||||
echo "${Start} is not business day in US" >&2
|
||||
Start=$(date -d "${Start} - 1 day" "+%Y-%m-%d")
|
||||
done
|
||||
echo ${Start}
|
||||
}
|
||||
export -f get_prev_business_day
|
||||
|
||||
if [ -z ${date_to_load} ] ; then
|
||||
echo "Yesterday data has priority. Running historical container will be stopped"
|
||||
@ -68,8 +95,12 @@ else
|
||||
mv ${LastDayFile} ${LastDayFile}.prev
|
||||
date_to_load=$(date -d "${last_date} - 1 day" "+%Y-%m-%d")
|
||||
fi
|
||||
fi
|
||||
if [ -n "${date_to_load}" ]; then
|
||||
date_to_load=$(get_prev_business_day ${date_to_load})
|
||||
echo "Historical Data for ${date_to_load}"
|
||||
fi
|
||||
exit
|
||||
|
||||
Cmd="docker run"
|
||||
Cmd="${Cmd} --pull=always"
|
||||
|
||||
@ -1 +1 @@
|
||||
1.1.4
|
||||
1.1.5
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user