Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 35466a1932 | |||
| 26afead109 | |||
| 32935143da |
@@ -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
|
||||||
|
|
||||||
|
|||||||
Executable
+12
@@ -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
@@ -1 +1 @@
|
|||||||
1.1.3
|
1.1.6
|
||||||
|
|||||||
Reference in New Issue
Block a user