Compare commits

...

3 Commits

Author SHA1 Message Date
oleg 35466a1932 fix 2024-07-28 13:50:41 -04:00
oleg 26afead109 fix 2024-07-27 21:54:47 -04:00
oleg 32935143da progress 2024-07-27 18:31:37 -04:00
3 changed files with 43 additions and 1 deletions
+30
View File
@@ -17,6 +17,33 @@ is_container_running() {
fi 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 if [ -z ${date_to_load} ] ; then
echo "Yesterday data has priority. Running historical container will be stopped" echo "Yesterday data has priority. Running historical container will be stopped"
@@ -68,6 +95,9 @@ else
mv ${LastDayFile} ${LastDayFile}.prev mv ${LastDayFile} ${LastDayFile}.prev
date_to_load=$(date -d "${last_date} - 1 day" "+%Y-%m-%d") date_to_load=$(date -d "${last_date} - 1 day" "+%Y-%m-%d")
fi 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}" echo "Historical Data for ${date_to_load}"
fi fi
+12
View File
@@ -0,0 +1,12 @@
#!/bin/bash
#Cmd="docker pull apptasticsoftware/trading-calendar:latest"
#echo ${Cmd} && eval ${Cmd}
Cmd="docker run"
Cmd="${Cmd} -d"
Cmd="${Cmd} --rm"
Cmd="${Cmd} --pull=always"
Cmd="${Cmd} --name trading-calendar"
Cmd="${Cmd} -p 8000:80 apptasticsoftware/trading-calendar"
echo ${Cmd} && eval ${Cmd}
+1 -1
View File
@@ -1 +1 @@
1.1.3 1.1.6