Compare commits

...

8 Commits

Author SHA1 Message Date
oleg b698b847a5 progress 2024-07-23 13:57:47 -04:00
oleg 65f55528ef fix version 2024-07-22 17:53:00 -04:00
oleg 13ff201999 progress 2024-07-22 17:49:34 -04:00
oleg 1bc2a367ec fix version 2024-07-22 13:18:14 -04:00
oleg 416fdaffed fix 2024-07-22 13:17:38 -04:00
oleg b08ffbb73b progress 2024-07-22 13:00:00 -04:00
oleg 85534b130a progress 2024-07-19 11:09:34 -04:00
oleg f391593857 progress 2024-07-19 11:04:30 -04:00
5 changed files with 119 additions and 12 deletions
+1 -1
View File
@@ -1 +1 @@
0.9.6 1.0.3
+42
View File
@@ -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
+41
View File
@@ -0,0 +1,41 @@
#!/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
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} ${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
+23
View File
@@ -0,0 +1,23 @@
#!/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} --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
+12 -11
View File
@@ -3,14 +3,14 @@
Src=${1} Src=${1}
Days=${2} Days=${2}
if [ "${Src}" == "" ] if [ -z "$Days" ] || [ -z "$Src" ]; then
then echo "Usage: $0 <source_dir> <num_days>"
echo "Usage: $0 <source_dir> [<num_days>]"
exit 1 exit 1
fi fi
if [ "${Days}" == "" ]
then # Add / if Src does not have it (symlinks)
Days=30 if [ "${Src: -1}" != "/" ]; then
Src="${Src}/"
fi fi
declare -A Settings=() declare -A Settings=()
@@ -21,13 +21,13 @@ src=${Settings[Src]}
prune_date=${Settings[PruneDate]} prune_date=${Settings[PruneDate]}
echo "Finding files older than ${prune_date}..." echo "Finding files older than ${prune_date} in ${Src} ..."
Cmd="find ${src} -type f ! -newermt \"${prune_date}\"" Cmd="find ${src} -type f ! -newermt \"${prune_date}\""
echo ${Cmd} echo ${Cmd}
files=($(eval ${Cmd})) files=($(eval ${Cmd}))
total_files= ${#files[*]} total_files=${#files[*]}
if [[ ${total} == 0 ]] if [[ ${total_files} == 0 ]]
then then
echo "No files found to be pruned. Bye..." echo "No files found to be pruned. Bye..."
exit 0 exit 0
@@ -38,11 +38,12 @@ duf ${src}
echo "The following files will be removed:" echo "The following files will be removed:"
echo "====================================" echo "===================================="
for f in $files ; do echo $f; done for f in $files ; do ls -l $f; done
echo "====================================" echo "===================================="
echo "Total files to be pruned: ${total_files}" echo "Total files to be pruned: ${total_files}"
Cmd="${Cmd} -delete" echo "Removing files..."
Cmd="${Cmd} -print -delete"
echo ${Cmd} echo ${Cmd}
eval ${Cmd} eval ${Cmd}