diff --git a/release_version.txt b/release_version.txt index 6d7de6e..21e8796 100644 --- a/release_version.txt +++ b/release_version.txt @@ -1 +1 @@ -1.0.2 +1.0.3 diff --git a/scripts/ad-hoc/rearrange_alpaca_md.sh b/scripts/ad-hoc/rearrange_alpaca_md.sh new file mode 100755 index 0000000..7017136 --- /dev/null +++ b/scripts/ad-hoc/rearrange_alpaca_md.sh @@ -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 diff --git a/scripts/alpaca_hist_md/alpaca_md_day.sh b/scripts/alpaca_hist_md/alpaca_md_day.sh index 34289ae..79dce0c 100755 --- a/scripts/alpaca_hist_md/alpaca_md_day.sh +++ b/scripts/alpaca_hist_md/alpaca_md_day.sh @@ -1,19 +1,41 @@ #!/bin/bash +date_to_load=${1} DockerRegistry=cloud21.cvtt.vpn:5500 -DockerImage=${DockerRegistry}/alpaca_md_day +DockerImage=${DockerRegistry}/alpaca_md_day:latest +LastDayFile=/home/cvtt/prod/logs/last_alpaca_hist_day -# if [ -z ${date} ] ; then -# date=$(date -d "yesterday" +%Y%m%d) -# fi +if [ -z ${date_to_load} ] ; then + echo "Yesterday data. Historical container will be killed" + docker kill alpaca_md_day +else + if [ "${date_to_load}" == "next" ] ; then + last_date=$(cat ${LastDayFile}) + if [ -z ${last_date} ] ; then + echo "No last date_to_load in ${LastDayFile}" + exit 1 + fi + 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} --network=host" Cmd="${Cmd} --name=alpaca_md_day" Cmd="${Cmd} --rm" Cmd="${Cmd} ${DockerImage}" -# Cmd="${Cmd} 2024-07-17" +Cmd="${Cmd} ${date_to_load}" echo $Cmd eval $Cmd + +if [ "$?" != "0" ] ; then + exit 1 # if killed we do not save last day +fi + +if [ -n ${date_to_load}]; then + echo "Saving date_to_load to ${LastDayFile}" + echo ${date_to_load} > ${LastDayFile} +fi \ No newline at end of file