Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e0a0d6d9d6 | |||
| 20a375cd55 | |||
| 35466a1932 | |||
| 26afead109 | |||
| 32935143da | |||
| 4e2df290db | |||
| d0ee8fea09 | |||
| cd4663d775 | |||
| b353572ea6 | |||
| fa6dd0fa95 | |||
| ce68165eef | |||
| 3932cbde37 | |||
| 9e90186432 | |||
| bbfd200ec4 | |||
| 489016782c | |||
| b698b847a5 | |||
| 65f55528ef | |||
| 13ff201999 | |||
| 1bc2a367ec | |||
| 416fdaffed | |||
| b08ffbb73b | |||
| 85534b130a | |||
| f391593857 | |||
| 108ae35a06 | |||
| 2416a5a77e | |||
| 0b9feb8610 | |||
| 51e059a72b | |||
| 9a59b00998 | |||
| 78de26d154 | |||
| 8eb52d718f |
+12
-6
@@ -4,6 +4,9 @@ C R Y P T O M A R K E T D A T A
|
|||||||
============
|
============
|
||||||
Exchanges
|
Exchanges
|
||||||
============
|
============
|
||||||
|
| Coinbase
|
||||||
|
| Binance Spot
|
||||||
|
| Binance Futures
|
||||||
|
|
|
|
||||||
v
|
v
|
||||||
============
|
============
|
||||||
@@ -17,18 +20,21 @@ C R Y P T O M A R K E T D A T A
|
|||||||
================
|
================
|
||||||
| created by crontabs:
|
| created by crontabs:
|
||||||
| cvttdata:
|
| cvttdata:
|
||||||
| /home/cvtt/prod/utils/archive_yesterday_md.sh cloud21
|
| (1) /home/cvtt/prod/utils/archive_yesterday_md.sh cloud21
|
||||||
| /home/cvtt/prod/utils/archive_yesterday_md.sh cvttdata
|
| (2) /home/cvtt/prod/utils/archive_yesterday_md.sh cvttdata
|
||||||
| stored in:
|
| stored in:
|
||||||
| /home/cvtt/prod/archive/md_archive/crypto/cloud21
|
| cvttdata:/home/cvtt/prod/archive/md_archive/crypto/cloud21 (1)
|
||||||
| /home/cvtt/prod/archive/md_archive/crypto/cvttdata
|
| cvttdata:/home/cvtt/prod/archive/md_archive/crypto/cvttdata (2)
|
||||||
|
|
|
|
||||||
v
|
v
|
||||||
==========
|
==========
|
||||||
Storage
|
Storage
|
||||||
==========
|
==========
|
||||||
| created by crontabs:
|
| created by crontab cvttdata:
|
||||||
| cvttdata:
|
| /home/cvtt/prod/utils/sync_market_data.sh (ops/utls)
|
||||||
|
| stored in:
|
||||||
|
| homestore:/works/cvtt/md_archive/equity/alpaca_md
|
||||||
|
| cloud21:/opt/store/cvtt/md_archive/equity/alpaca_md
|
||||||
|
|
|
|
||||||
v
|
v
|
||||||
==========
|
==========
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
-------------------------------------
|
||||||
|
E Q U I T Y M A R K E T D A T A
|
||||||
|
-------------------------------------
|
||||||
|
=====================
|
||||||
|
Exchanges (Sources)
|
||||||
|
=====================
|
||||||
|
| Alpaca
|
||||||
|
|
|
||||||
|
|
|
||||||
|
| TBD ============
|
||||||
|
| TBD Databases
|
||||||
|
| TBD ============
|
||||||
|
| TBD | TimescaleDB: cloud21
|
||||||
|
| TBD | TimescaleDB: cvttdata
|
||||||
|
v TBD v
|
||||||
|
================
|
||||||
|
Daily Archive
|
||||||
|
================
|
||||||
|
| created by crontab on cvttdata:
|
||||||
|
| /home/cvtt/prod/run/alpaca_md.sh
|
||||||
|
| stored in:
|
||||||
|
| cvttdata:/home/cvtt/prod/archive/md_archive/equity/alpaca_md
|
||||||
|
|
|
||||||
|
v
|
||||||
|
==========
|
||||||
|
Storage
|
||||||
|
==========
|
||||||
|
| created by crontab cvttdata:
|
||||||
|
| /home/cvtt/prod/utils/sync_market_data.sh
|
||||||
|
| stored in:
|
||||||
|
| homestore:/works/cvtt/md_archive/equity/alpaca_md
|
||||||
|
| cloud21:/opt/store/cvtt/md_archive/equity/alpaca_md
|
||||||
|
____V_______
|
||||||
Executable
+124
@@ -0,0 +1,124 @@
|
|||||||
|
#!/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
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
if [ -n "${date_to_load}" ]; then
|
||||||
|
date_to_load=$(get_prev_business_day ${date_to_load})
|
||||||
|
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
|
||||||
Executable
+14
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
Cmd="docker run"
|
||||||
|
Cmd="${Cmd} -d"
|
||||||
|
Cmd="${Cmd} --rm"
|
||||||
|
Cmd="${Cmd} --pull=always"
|
||||||
|
Cmd="${Cmd} --name=cvtt_config_service"
|
||||||
|
Cmd="${Cmd} -p 6789:6789"
|
||||||
|
Cmd="${Cmd} -v /home/cvtt/prod/config_service/data:/app/data"
|
||||||
|
Cmd="${Cmd} -v /home/cvtt/prod/logs:/logs"
|
||||||
|
Cmd="${Cmd} cloud21.cvtt.vpn:5500/config_service:latest"
|
||||||
|
|
||||||
|
echo ${Cmd}
|
||||||
|
eval ${Cmd}
|
||||||
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
|
||||||
Executable
+27
@@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# runs on host to start container
|
||||||
|
usage() {
|
||||||
|
echo "Usage: $0 <job_name> (BNBFUT_CLD21, BNBSPOT_CLD21, BNBSPOT_CVTTDATA, COINBASE_CLD21)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
job=${1}
|
||||||
|
if [ "${job}" == "" ] ; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
Cmd="docker run"
|
||||||
|
Cmd="${Cmd} -d"
|
||||||
|
Cmd="${Cmd} --rm"
|
||||||
|
Cmd="${Cmd} --network=host"
|
||||||
|
Cmd="${Cmd} --pull=always"
|
||||||
|
Cmd="${Cmd} --name=md_recorder.${job}"
|
||||||
|
Cmd="${Cmd} -v /home/cvtt/prod/data:/app/data"
|
||||||
|
Cmd="${Cmd} -v /home/cvtt/prod/logs:/logs"
|
||||||
|
Cmd="${Cmd} cloud21.cvtt.vpn:5500/md_recorder:latest"
|
||||||
|
Cmd="${Cmd} ${1}"
|
||||||
|
|
||||||
|
echo ${Cmd}
|
||||||
|
eval ${Cmd}
|
||||||
Executable
+14
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
Cmd="docker run"
|
||||||
|
Cmd="${Cmd} -d"
|
||||||
|
#Cmd="${Cmd} --rm"
|
||||||
|
Cmd="${Cmd} --pull=always"
|
||||||
|
Cmd="${Cmd} --name=relative_liquidity_svc"
|
||||||
|
Cmd="${Cmd} -p 5678:5678"
|
||||||
|
Cmd="${Cmd} -v /home/cvtt/prod/data:/app/data"
|
||||||
|
Cmd="${Cmd} -v /home/cvtt/prod/logs:/logs"
|
||||||
|
Cmd="${Cmd} cloud21.cvtt.vpn:5500/relative_liquidity:latest"
|
||||||
|
|
||||||
|
echo ${Cmd}
|
||||||
|
eval ${Cmd}
|
||||||
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 @@
|
|||||||
0.8.8
|
1.1.8
|
||||||
|
|||||||
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
|
||||||
@@ -48,16 +48,9 @@ export PYTHONPATH=/home/cvtt/prod
|
|||||||
export Python=/home/cvtt/.pyenv/python3.10-venv/bin/python3
|
export Python=/home/cvtt/.pyenv/python3.10-venv/bin/python3
|
||||||
export Config=http://cloud16.cvtt.vpn:6789/apps/minimal_md
|
export Config=http://cloud16.cvtt.vpn:6789/apps/minimal_md
|
||||||
export PyScript=/home/cvtt/prod/cvttpy/exchanges/alpaca/hist_md/hist_md_bars.py
|
export PyScript=/home/cvtt/prod/cvttpy/exchanges/alpaca/hist_md/hist_md_bars.py
|
||||||
export OutputDir=/home/cvtt/prod/archive/equities/alpaca_md # Local
|
|
||||||
export LogDir=/home/cvtt/prod/logs/alpaca_md
|
|
||||||
|
|
||||||
# ----- T E M P
|
export OutputDir=/home/cvtt/prod/archive/md_archive/equity/alpaca_md # Local
|
||||||
# export PYTHONPATH=/home/oleg/develop/cvtt2
|
export LogDir=/home/cvtt/prod/logs/alpaca_md
|
||||||
# export Python=/home/oleg/.pyenv/python3.10-venv/bin/python3
|
|
||||||
# export Config=http://cloud16.cvtt.vpn:6789/apps/minimal_md
|
|
||||||
# export PyScript=/home/oleg/develop/cvtt2/cvttpy/exchanges/alpaca/hist_md/hist_md_bars.py
|
|
||||||
# export OutputDir=/home/oleg/develop/cvtt2/tmp # Local
|
|
||||||
# export LogDir=/home/oleg/develop/cvtt2/tmp
|
|
||||||
|
|
||||||
mkdir -p ${LogDir}
|
mkdir -p ${LogDir}
|
||||||
|
|
||||||
@@ -112,3 +105,10 @@ for ((ii=0; ii <${#Instruments[@]}; ii+=slice_size)); do
|
|||||||
|
|
||||||
parallel -j ${NumJobs} run_proc {} ${Start} ${End} ::: "${InstSlice[@]}"
|
parallel -j ${NumJobs} run_proc {} ${Start} ${End} ::: "${InstSlice[@]}"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo "Compressing"
|
||||||
|
for file in $(find ${OutputDir} -type f -name '*db' -print )
|
||||||
|
do
|
||||||
|
echo "Compressing ${file}"
|
||||||
|
gzip ${file}
|
||||||
|
done
|
||||||
|
|||||||
Executable
+18
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export PYTHONPATH=${HOME}/prod
|
||||||
|
|
||||||
|
Python=${HOME}/.pyenv/python3.10-venv/bin/python3
|
||||||
|
Script=${HOME}/prod/cvttpy/exchanges/alpaca/hist_md/rl_calc_loader.py
|
||||||
|
DbFile=${HOME}/prod/data/rel_liquidity.db
|
||||||
|
Config=http://cloud23.cvtt.vpn:6789/apps/minimal_md_eqt
|
||||||
|
|
||||||
|
Cmd="${Python}"
|
||||||
|
Cmd="${Cmd} ${Script}"
|
||||||
|
Cmd="${Cmd} --config=${Config}"
|
||||||
|
Cmd="${Cmd} --db_file=${DbFile}"
|
||||||
|
|
||||||
|
echo ${Cmd}
|
||||||
|
eval ${Cmd}
|
||||||
|
|
||||||
|
echo Done ${0} ${*}
|
||||||
+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=
|
||||||
# cmdline
|
brnch=master
|
||||||
prj=${1:-${default_project}}
|
|
||||||
brnch=${2:-${default_branch}}
|
|
||||||
if [ "${3}" == "D" ]; then
|
|
||||||
interactive=N
|
interactive=N
|
||||||
fi
|
|
||||||
|
usage() {
|
||||||
|
echo "Usage: $0 -p <project> [-b <branch (master)> -i (interactive)"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
|||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export PYTHONPATH=/home/cvtt/prod
|
||||||
|
|
||||||
|
Cmd="/home/cvtt/.pyenv/python3.10-venv/bin/python3"
|
||||||
|
Cmd="${Cmd} /home/cvtt/prod/cvttpy/apps/research/exchange_trading_stats.py"
|
||||||
|
Cmd="${Cmd} --config=http://cloud16.cvtt.vpn:6789/apps/tests/listen_market_data"
|
||||||
|
Cmd="${Cmd} --active_exchanges=OKX,GEMINI,BITSTAMP,COINBASE_AT,BNBSPOT,KRAKEN"
|
||||||
|
Cmd="${Cmd} --instruments=OKX:PAIR-BTC-USDT,GEMINI:PAIR-BTC-USD,BITSTAMP:PAIR-BTC-USD,COINBASE:PAIR-BTC-USD,BNBSPOT:PAIR-BTC-USDT,KRAKEN:PAIR-BTC-USD"
|
||||||
|
Cmd="${Cmd} --db_file=/home/cvtt/prod/data/exchange_trading_stats.db"
|
||||||
|
Cmd="${Cmd} --log_file=/home/cvtt/prod/logs/%%T.EXCHANGE_TRADING_STATS.log"
|
||||||
|
|
||||||
|
echo ${Cmd}
|
||||||
|
eval ${Cmd}
|
||||||
Executable
+33
@@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Collect all "A" files
|
||||||
|
letter=${1}
|
||||||
|
|
||||||
|
if [ "${letter}" == "" ]; then
|
||||||
|
echo "Usage $0 <letter>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# copy text data to local location
|
||||||
|
rsync -ahv /home/cvtt/host_drive/eqt_hist_md/txt/${letter} /home/cvtt/tmp/txt/
|
||||||
|
|
||||||
|
# create db files
|
||||||
|
PYTHONPATH=/home/cvtt/prod /home/cvtt/.pyenv/python3.10-venv/bin/python3 /home/cvtt/prod/cvttpy/trading/mkt_data/ad_hoc/eqt_md_to_db.py /home/cvtt/tmp/txt/${letter} /home/cvtt/tmp/db
|
||||||
|
|
||||||
|
if [ "$?" != "0" ] ; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Move all files to host drive
|
||||||
|
# a) create file list
|
||||||
|
(cd /home/cvtt/tmp/db/ && find . -name '*db' -print | grep "/${letter}/") > /home/cvtt/tmp/tran_db/${letter}_files
|
||||||
|
|
||||||
|
echo ${letter} is done
|
||||||
|
exit
|
||||||
|
|
||||||
|
|
||||||
|
# b) rsync files to host drive
|
||||||
|
rsync -ahv --remove-source-files --files-from=/home/cvtt/tmp/tran_db/${letter}_files /home/cvtt/tmp/db/ cvtt@my-vm-host:/localdisk/cvtt/eqt_hist_md/db/
|
||||||
|
|
||||||
|
# Clean directories
|
||||||
|
( cd /home/cvtt/tmp/db && (for d in $(find . -name $letter -type d -print); do echo $d ; done) | grep -v /$letter/$letter | xargs rm -rf) && rm -rf /home/cvtt/tmp/txt/${letter}
|
||||||
Executable
+58
@@ -0,0 +1,58 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
Src=${1}
|
||||||
|
Days=${2}
|
||||||
|
|
||||||
|
if [ -z "$Days" ] || [ -z "$Src" ]; then
|
||||||
|
echo "Usage: $0 <source_dir> <num_days>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Add / if Src does not have it (symlinks)
|
||||||
|
if [ "${Src: -1}" != "/" ]; then
|
||||||
|
Src="${Src}/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
declare -A Settings=()
|
||||||
|
Settings[Src]=${Src}
|
||||||
|
Settings[PruneDate]=$(date -d "${Days} days ago" '+%Y-%m-%d')
|
||||||
|
|
||||||
|
src=${Settings[Src]}
|
||||||
|
prune_date=${Settings[PruneDate]}
|
||||||
|
|
||||||
|
|
||||||
|
echo "Finding files older than ${prune_date} in ${Src} ..."
|
||||||
|
Cmd="find ${src} -type f ! -newermt \"${prune_date}\""
|
||||||
|
echo ${Cmd}
|
||||||
|
files=($(eval ${Cmd}))
|
||||||
|
total_files=${#files[*]}
|
||||||
|
|
||||||
|
if [[ ${total_files} == 0 ]]
|
||||||
|
then
|
||||||
|
echo "No files found to be pruned. Bye..."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo Before Pruning....
|
||||||
|
duf ${src}
|
||||||
|
|
||||||
|
echo "The following files will be removed:"
|
||||||
|
echo "===================================="
|
||||||
|
for f in $files ; do ls -l $f; done
|
||||||
|
echo "===================================="
|
||||||
|
echo "Total files to be pruned: ${total_files}"
|
||||||
|
|
||||||
|
echo "Removing files..."
|
||||||
|
Cmd="${Cmd} -print -delete"
|
||||||
|
echo ${Cmd}
|
||||||
|
eval ${Cmd}
|
||||||
|
|
||||||
|
echo "Removing empty directories..."
|
||||||
|
Cmd="find ${src} -type d -empty -print -delete"
|
||||||
|
echo ${Cmd}
|
||||||
|
eval ${Cmd}
|
||||||
|
|
||||||
|
echo After Pruning....
|
||||||
|
duf ${src}
|
||||||
|
|
||||||
|
echo $0 Done
|
||||||
Executable
+14
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
Source=/home/cvtt/prod/archive/md_archive/
|
||||||
|
Targets=
|
||||||
|
Targets="${Targets} oleg@homestore.cvtt.vpn:/works/cvtt/md_archive/"
|
||||||
|
Targets="${Targets} cvtt@cloud21.cvtt.vpn:/opt/store/cvtt/md_archive/"
|
||||||
|
|
||||||
|
|
||||||
|
for tgt in ${Targets}
|
||||||
|
do
|
||||||
|
Cmd="/usr/bin/rsync -ahv ${Source} ${tgt}"
|
||||||
|
echo $Cmd
|
||||||
|
eval $Cmd
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user