Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cd4663d775 | |||
| b353572ea6 | |||
| fa6dd0fa95 | |||
| ce68165eef | |||
| 3932cbde37 | |||
| 9e90186432 | |||
| bbfd200ec4 | |||
| 489016782c | |||
| b698b847a5 | |||
| 65f55528ef | |||
| 13ff201999 | |||
| 1bc2a367ec | |||
| 416fdaffed | |||
| b08ffbb73b |
+1
-1
@@ -1 +1 @@
|
|||||||
0.9.8
|
1.1.2
|
||||||
|
|||||||
Executable
+42
@@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
pushd () {
|
||||||
|
command pushd "$@" > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
popd () {
|
||||||
|
command popd "$@" > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceRoot=/works/cvtt/md_archive/equity/alpaca_md.2
|
||||||
|
TargetRoot=/works/cvtt/md_archive/equity/alpaca_md.NEW
|
||||||
|
|
||||||
|
mkdir -p ${TargetDir}
|
||||||
|
|
||||||
|
unalias ls
|
||||||
|
cd ${SourceRoot}
|
||||||
|
|
||||||
|
for year in $(ls -d 2*)
|
||||||
|
do
|
||||||
|
echo $year
|
||||||
|
pushd $year
|
||||||
|
for letter in $(ls -d ?)
|
||||||
|
do
|
||||||
|
pushd ${letter}
|
||||||
|
|
||||||
|
echo "${year}/${letter}"
|
||||||
|
for symbol in $(ls -d ${letter}*)
|
||||||
|
do
|
||||||
|
pushd $symbol
|
||||||
|
|
||||||
|
echo "${year}/${letter}/${symbol}/* --> ${letter}/${symbol}/${year}/"
|
||||||
|
mkdir -p ${TargetRoot}/${letter}/${symbol}/${year}
|
||||||
|
mv ${SourceRoot}/${year}/${letter}/${symbol}/* ${TargetRoot}/${letter}/${symbol}/${year}/
|
||||||
|
|
||||||
|
popd
|
||||||
|
done
|
||||||
|
|
||||||
|
popd
|
||||||
|
done
|
||||||
|
popd
|
||||||
|
done
|
||||||
Executable
+94
@@ -0,0 +1,94 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
date_to_load=${1}
|
||||||
|
|
||||||
|
DockerRegistry=cloud21.cvtt.vpn:5500
|
||||||
|
DockerImage=${DockerRegistry}/alpaca_md_day #:latest
|
||||||
|
LastDayFile=/home/cvtt/prod/logs/last_alpaca_hist_day
|
||||||
|
ContainerName=alpaca_md_day
|
||||||
|
|
||||||
|
is_container_running() {
|
||||||
|
local container_name=$1
|
||||||
|
|
||||||
|
if [ "$(docker ps --filter "name=^/${container_name}$" --filter "status=running" -q)" ]; then
|
||||||
|
return 0 # true
|
||||||
|
else
|
||||||
|
return 1 # false
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if [ -z ${date_to_load} ] ; then
|
||||||
|
echo "Yesterday data has priority. Running historical container will be stopped"
|
||||||
|
Cmd="docker stop ${ContainerName}"
|
||||||
|
echo ${Cmd} && eval ${Cmd}
|
||||||
|
Cmd="docker kill ${ContainerName}"
|
||||||
|
echo ${Cmd} && eval ${Cmd}
|
||||||
|
Cmd="docker rm -f ${ContainerName}"
|
||||||
|
echo ${Cmd} && eval ${Cmd}
|
||||||
|
|
||||||
|
Cmd="docker ps"
|
||||||
|
echo ${Cmd} && eval ${Cmd}
|
||||||
|
|
||||||
|
if is_container_running "$ContainerName"; then
|
||||||
|
echo "Container ${ContainerName} is still running."
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Historical run ${date_to_load}"
|
||||||
|
if is_container_running "$ContainerName"; then
|
||||||
|
echo "Container ${ContainerName} is already running."
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
if [ "${date_to_load}" == "next" ] ; then
|
||||||
|
if [ ! -e ${LastDayFile} ]; then
|
||||||
|
echo "File ${LastDayFile} does not exist. Will try to use prev file."
|
||||||
|
if [ ! -e ${LastDayFile}.prev ]; then
|
||||||
|
echo "File ${LastDayFile}.prev does not exist. Aborted."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
mv ${LastDayFile}.prev ${LastDayFile}
|
||||||
|
fi
|
||||||
|
last_date=$(cat ${LastDayFile} | xargs)
|
||||||
|
if [ -z "${last_date}" ] ; then
|
||||||
|
echo "File ${LastDayFile} returned an empty last day. Will try to use prev file."
|
||||||
|
if [ ! -e ${LastDayFile}.prev ]; then
|
||||||
|
echo "File ${LastDayFile}.prev does not exist. Aborted."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
mv ${LastDayFile}.prev ${LastDayFile}
|
||||||
|
last_date=$(cat ${LastDayFile} | xargs)
|
||||||
|
if [ -z "${last_date}" ] ; then
|
||||||
|
echo "Unable to obtain last_date. Aborted"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
echo "No last date_to_load in ${LastDayFile}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
mv ${LastDayFile} ${LastDayFile}.prev
|
||||||
|
date_to_load=$(date -d "${last_date} - 1 day" "+%Y-%m-%d")
|
||||||
|
fi
|
||||||
|
echo "Historical Data for ${date_to_load}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
Cmd="docker run"
|
||||||
|
Cmd="${Cmd} --pull=always"
|
||||||
|
Cmd="${Cmd} --network=host"
|
||||||
|
Cmd="${Cmd} --name=${ContainerName}"
|
||||||
|
Cmd="${Cmd} --rm"
|
||||||
|
Cmd="${Cmd} ${DockerImage}"
|
||||||
|
Cmd="${Cmd} ${date_to_load}"
|
||||||
|
|
||||||
|
echo $Cmd
|
||||||
|
eval $Cmd
|
||||||
|
|
||||||
|
if [ "$?" != "0" ] ; then
|
||||||
|
exit 1 # if killed we do not save last day
|
||||||
|
fi
|
||||||
|
|
||||||
|
# truncate to avoid false positive
|
||||||
|
date_to_load=$(echo "${date_to_load}" | xargs)
|
||||||
|
if [ -n "${date_to_load}" ]; then
|
||||||
|
echo "Saving date_to_load to ${LastDayFile}"
|
||||||
|
echo ${date_to_load} > ${LastDayFile}
|
||||||
|
fi
|
||||||
+32
-11
@@ -7,25 +7,46 @@ git_repo_arr[cvttpy]=git@cloud21.cvtt.vpn:/opt/store/git/cvttpy.git
|
|||||||
git_repo_arr[ops]=git@cloud21.cvtt.vpn:/opt/store/git/ops.git
|
git_repo_arr[ops]=git@cloud21.cvtt.vpn:/opt/store/git/ops.git
|
||||||
git_repo_arr[research]=git@cloud21.cvtt.vpn:/opt/store/git/research.git
|
git_repo_arr[research]=git@cloud21.cvtt.vpn:/opt/store/git/research.git
|
||||||
|
|
||||||
default_project=cvttpy
|
|
||||||
default_branch=master
|
|
||||||
|
|
||||||
|
|
||||||
dist_root=/home/cvttdist/software/cvtt2
|
dist_root=/home/cvttdist/software/cvtt2
|
||||||
dist_user=cvttdist
|
dist_user=cvttdist
|
||||||
dist_host="cloud21.cvtt.vpn"
|
dist_host="cloud21.cvtt.vpn"
|
||||||
dist_ssh_port="22"
|
dist_ssh_port="22"
|
||||||
|
|
||||||
dist_locations="cloud21.cvtt.vpn:22 homestore.cvtt.vpn:22"
|
dist_locations="cloud21.cvtt.vpn:22 homestore.cvtt.vpn:22"
|
||||||
|
# ---------------- Settings
|
||||||
|
|
||||||
interactive=Y
|
# ---------------- cmdline
|
||||||
|
prj=
|
||||||
|
brnch=master
|
||||||
|
interactive=N
|
||||||
|
|
||||||
# cmdline
|
usage() {
|
||||||
prj=${1:-${default_project}}
|
echo "Usage: $0 -p <project> [-b <branch (master)> -i (interactive)"
|
||||||
brnch=${2:-${default_branch}}
|
exit 1
|
||||||
if [ "${3}" == "D" ]; then
|
}
|
||||||
interactive=N
|
|
||||||
fi
|
while getopts ":p:b:i" opt; do
|
||||||
|
case ${opt} in
|
||||||
|
p )
|
||||||
|
prj=$OPTARG
|
||||||
|
;;
|
||||||
|
b )
|
||||||
|
brnch=$OPTARG
|
||||||
|
;;
|
||||||
|
i )
|
||||||
|
interactive=Y
|
||||||
|
;;
|
||||||
|
\? )
|
||||||
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
: )
|
||||||
|
echo "Option -$OPTARG requires an argument." >&2
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
# ---------------- cmdline
|
||||||
|
|
||||||
function confirm {
|
function confirm {
|
||||||
if [ "${interactive}" == "Y" ]; then
|
if [ "${interactive}" == "Y" ]; then
|
||||||
|
|||||||
Executable
+24
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
host=${1}
|
||||||
|
date=${2}
|
||||||
|
|
||||||
|
DockerRegistry=cloud21.cvtt.vpn:5500
|
||||||
|
DockerImage=${DockerRegistry}/crypto_md_day
|
||||||
|
|
||||||
|
if [ -z ${date} ] ; then
|
||||||
|
date=$(date -d "yesterday" +%Y%m%d)
|
||||||
|
fi
|
||||||
|
|
||||||
|
Cmd="docker run"
|
||||||
|
Cmd="${Cmd} --pull=always"
|
||||||
|
Cmd="${Cmd} --network=host"
|
||||||
|
Cmd="${Cmd} --name=crypto_md_day.${host}.${date}"
|
||||||
|
Cmd="${Cmd} --rm"
|
||||||
|
Cmd="${Cmd} ${DockerImage}"
|
||||||
|
Cmd="${Cmd} -h ${host}"
|
||||||
|
Cmd="${Cmd} -d ${date}"
|
||||||
|
Cmd="${Cmd} -s coinbase,bnbspot,bnbfut"
|
||||||
|
|
||||||
|
echo $Cmd
|
||||||
|
eval $Cmd
|
||||||
Reference in New Issue
Block a user