Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7dec83b190 | |||
| 2b2056171e | |||
| 913d971663 | |||
| 0f6d7874de | |||
| 769d8116d5 | |||
| a7ad7f45f5 | |||
| 0e6190f999 | |||
| 180e3f89cf | |||
| 80bbf47755 | |||
| e295aa8dff | |||
| 60d2327b7e | |||
| a0b41cad8e | |||
| b62981a338 | |||
| 553748fdcd | |||
| 5956d9d200 | |||
| 88308ea13e | |||
| 74783ab064 | |||
| c1a4e7b292 | |||
| f9ac5503eb | |||
| 5cc53f8cd8 | |||
| fce17db6ec | |||
| ed43a900a2 | |||
| 9de86bf3e3 |
+1
-1
@@ -1 +1 @@
|
||||
0.6.9
|
||||
0.8.6
|
||||
|
||||
@@ -31,20 +31,34 @@ fi
|
||||
|
||||
End=$(date -d "${Start} + 1 day" "+%Y-%m-%d")
|
||||
|
||||
# Exclude today
|
||||
if [ "${End}" == $(date '+%Y-%m-%d') ] ; then
|
||||
End=$(date -d 'yesterday' ''+%Y-%m-%d'')
|
||||
fi
|
||||
|
||||
if [ "${NumJobs}" == "" ] ; then
|
||||
NumJobs=30
|
||||
fi
|
||||
|
||||
echo "Start=${Start} End=${End} NumJobs=${NumJobs}"
|
||||
|
||||
# export PyScript=/home/cvtt/prod/cvttpy/exchanges/alpaca/hist_mkt_data.py
|
||||
|
||||
export PYTHONPATH=/home/cvtt/prod
|
||||
export Python=/home/cvtt/.pyenv/python3.10-venv/bin/python3
|
||||
export PyScript=/home/cvtt/prod/cvttpy/exchanges/alpaca/hist_mkt_data.py
|
||||
|
||||
export OutputDir=/home/cvtt/host_drive/alpaca_md # Local
|
||||
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 OutputDir=/home/cvtt/host_drive/alpaca_md # Local
|
||||
export LogDir=/home/cvtt/prod/logs/alpaca_md
|
||||
|
||||
# ----- T E M P
|
||||
# export PYTHONPATH=/home/oleg/develop/cvtt2
|
||||
# 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}
|
||||
|
||||
run_proc() {
|
||||
@@ -55,20 +69,21 @@ run_proc() {
|
||||
|
||||
Cmd="${Python} ${PyScript}"
|
||||
Cmd="${Cmd} --config=${Config}"
|
||||
Cmd="${Cmd} --output_dir=${OutputDir}"
|
||||
Cmd="${Cmd} --output_dir=${OutputDir}/${Start:0:4}"
|
||||
Cmd="${Cmd} --instruments=ALPACA:${Inst}"
|
||||
Cmd="${Cmd} --start=${Start}"
|
||||
if [ "${End}" != "" ]; then
|
||||
Cmd="${Cmd} --end=${End}"
|
||||
fi
|
||||
Cmd="${Cmd} --log_file=${LogDir}/${Start}.${Inst}.log"
|
||||
Cmd="${Cmd} --log_file=${LogDir}/${Inst}.log"
|
||||
Cmd="${Cmd} --log_level=WARNING"
|
||||
echo ${Cmd}
|
||||
eval ${Cmd}
|
||||
}
|
||||
|
||||
export -f run_proc
|
||||
|
||||
if [ -n $InstListFile ]; then
|
||||
if [ "$InstListFile" == "" ]; then
|
||||
|
||||
key=$(jq -r '.["ALPACA_SANDBOX"] | .api_key' ~/.creds)
|
||||
secret=$(jq -r '.["ALPACA_SANDBOX"] | .secret_key' ~/.creds)
|
||||
|
||||
@@ -4,14 +4,14 @@ Python=/home/cvtt/.pyenv/python3.10-venv/bin/python3.10
|
||||
RootDir=/home/cvtt/prod
|
||||
export PYTHONPATH=${RootDir}
|
||||
|
||||
host=$(hostname)
|
||||
host=${1}
|
||||
if [ "${host}" == "cvttdata" ]
|
||||
then
|
||||
ArchiveRootDir=/home/cvtt/prod/archive/md_archive
|
||||
ArchiveRootDir=/home/cvtt/prod/archive/md_archive/cvttdata
|
||||
CredKey=TSDB_MD_CVTTDATA_RO
|
||||
elif [ "${host}" == "cloud21.cryptovaltrading.com" ]
|
||||
elif [ "${host}" == "cloud21" ]
|
||||
then
|
||||
ArchiveRootDir=/opt/store/cvtt/archive/md_archive
|
||||
ArchiveRootDir=/home/cvtt/prod/archive/md_archive/cloud21
|
||||
CredKey=TSDB_MD_CLD21_RO
|
||||
else
|
||||
echo "Unknown host ${host}. ${0} Aborted."
|
||||
@@ -21,7 +21,7 @@ fi
|
||||
mkdir -p ${ArchiveRootDir}
|
||||
|
||||
yesterday=$(date -d "yesterday" +%Y%m%d)
|
||||
Schemas=${1}
|
||||
Schemas=${2}
|
||||
if [ "${Schemas}" == "" ]
|
||||
then
|
||||
Schemas="coinbase,bnbspot,bnbfut"
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# ---------------- Settings
|
||||
declare -A git_repo_arr
|
||||
|
||||
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[research]=git@cloud21.cvtt.vpn:/opt/store/git/research.git
|
||||
|
||||
default_project=cvttpy
|
||||
default_branch=master
|
||||
@@ -63,6 +64,13 @@ else
|
||||
fi
|
||||
|
||||
tmp_dir=$(mktemp -d)
|
||||
function cleanup {
|
||||
cd ${HOME}
|
||||
rm -rf ${tmp_dir}
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
|
||||
prj_dir="${tmp_dir}/${prj}"
|
||||
|
||||
cmd_arr=()
|
||||
@@ -149,7 +157,4 @@ do
|
||||
pwd && echo ${cmd} && eval ${cmd}
|
||||
done
|
||||
|
||||
cd ${HOME}
|
||||
rm -rf ${tmp_dir}
|
||||
|
||||
echo $0 Done
|
||||
echo "$0 Done ${project} ${release_version}"
|
||||
|
||||
Executable
+57
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
date=${1}
|
||||
if [ "${date}" == "" ] ; then
|
||||
date="yesterday"
|
||||
fi
|
||||
|
||||
SourceHost=cryptoval3.cvtt.vpn
|
||||
SourceUser=cvtt
|
||||
SourceRootDir=/localdisk/cvtt/archive/md_archive
|
||||
SourceFile=$(date -d ${date} "+%Y%m%d.mktdata.db")
|
||||
SourceFileZip="${SourceFile}.gz"
|
||||
SourceFilePath=$(date -d ${date} "+${SourceRootDir}/%Y/%m/${SourceFileZip}")
|
||||
|
||||
TargetDir="/opt/jupyter_gpu/data/crypto_md"
|
||||
TargetFile=$(date -d ${date} "+%Y%m%d.mktdata.ohlcv.db")
|
||||
TargetFilePath="${TargetDir}/${TargetFile}"
|
||||
|
||||
echo ${SourceFile}
|
||||
tmp_dir=$(mktemp -d)
|
||||
|
||||
function cleanup {
|
||||
cd ${HOME}
|
||||
rm -rf ${tmp_dir}
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
function download_file {
|
||||
|
||||
Cmd="rsync"
|
||||
Cmd="${Cmd} -ahv"
|
||||
if tty -s; then
|
||||
Cmd="${Cmd} --progress=info2"
|
||||
fi
|
||||
Cmd="${Cmd} ${SourceUser}@${SourceHost}:${SourceFilePath} ${tmp_dir}/"
|
||||
echo ${Cmd}
|
||||
eval ${Cmd}
|
||||
ls -lh ${tmp_dir}
|
||||
Cmd="gunzip ${tmp_dir}/${SourceFileZip}"
|
||||
echo ${Cmd} && eval ${Cmd}
|
||||
ls -lh ${tmp_dir}
|
||||
|
||||
rm -f ${TargetFilePath}
|
||||
touch ${TargetFilePath}
|
||||
|
||||
for table in bnbfut_ohlcv_1min bnbspot_ohlcv_1min coinbase_ohlcv_1min
|
||||
do
|
||||
Cmd="sqlite3 ${tmp_dir}/${SourceFile} \".dump ${table}\" | sqlite3 ${TargetFilePath}"
|
||||
echo ${Cmd}
|
||||
eval ${Cmd}
|
||||
done
|
||||
chmod 600 ${TargetFilePath}
|
||||
ls -lh ${TargetFilePath}
|
||||
|
||||
|
||||
}
|
||||
download_file
|
||||
@@ -15,7 +15,6 @@ Sender=${RootDir}/ops/utils/send_mmost.sh
|
||||
|
||||
Hosts=
|
||||
Hosts="${Hosts} cloud11.cvtt.vpn"
|
||||
Hosts="${Hosts} cloud14.cvtt.vpn"
|
||||
Hosts="${Hosts} cloud15.cvtt.vpn"
|
||||
Hosts="${Hosts} cloud16.cvtt.vpn"
|
||||
Hosts="${Hosts} cloud17.cvtt.vpn"
|
||||
@@ -23,26 +22,38 @@ Hosts="${Hosts} cloud21.cvtt.vpn"
|
||||
Hosts="${Hosts} cloud22.cryptovaltrading.com"
|
||||
|
||||
Hosts="${Hosts} cvttdata.cvtt.vpn"
|
||||
Hosts="${Hosts} cryptoval1.cvtt.vpn"
|
||||
Hosts="${Hosts} cryptoval2.cvtt.vpn"
|
||||
Hosts="${Hosts} cryptoval3.cvtt.vpn"
|
||||
|
||||
Hosts="${Hosts} homestore.cvtt.vpn"
|
||||
Hosts="${Hosts} nsbackup.cvtt.vpn"
|
||||
Hosts="${Hosts} nsbackup.sheynin.home"
|
||||
Hosts="${Hosts} dtvmhost.cvtt.vpn"
|
||||
Hosts="${Hosts} ops-server.cvtt.vpn"
|
||||
|
||||
Hosts="${Hosts} cvtt-prod-01.cvtt.vpn"
|
||||
Hosts="${Hosts} cvtt-prod-02.cvtt.vpn"
|
||||
Hosts="${Hosts} cvtt-prod-03.cvtt.vpn"
|
||||
|
||||
Metrics=()
|
||||
TempFiles=
|
||||
|
||||
function cleanup {
|
||||
echo Cleaing up temporary files: ${TempFiles}
|
||||
if [ "" != "${TempFiles}" ]; then
|
||||
rm -f ${TempFiles}
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
function space_alert() {
|
||||
ALERT_USAGE=75%
|
||||
for ln in "${Measurements[@]}"
|
||||
for metric in "${Metrics[@]}"
|
||||
do
|
||||
IFS=$' '; args=($ln); unset IFS
|
||||
IFS=$' '; args=($metric); unset IFS
|
||||
host=${args[0]}
|
||||
fs=${args[1]}
|
||||
space_used=${args[2]}
|
||||
|
||||
if [ ${space_used%?} -ge ${ALERT_USAGE%?} ]; then
|
||||
echo ":red_circle: Filesystem **${host}:${fs}** is using **${space_used}** :red_circle:"
|
||||
fi
|
||||
@@ -53,6 +64,7 @@ function storage_check() {
|
||||
|
||||
result_lines=()
|
||||
|
||||
declare -a SingleMeas
|
||||
for host in ${Hosts}
|
||||
do
|
||||
if [[ "${host}" == *"cryptovaltrading.com" ]]; then
|
||||
@@ -71,7 +83,12 @@ function storage_check() {
|
||||
do
|
||||
IFS=$' '; args=($ln); unset IFS
|
||||
res="${args[5]}| **${host}** | ***${args[6]}*** | *${args[5]}* |"
|
||||
|
||||
result_lines+=("$res")
|
||||
|
||||
fs=${args[6]}
|
||||
used=${args[5]}
|
||||
Metrics+=("$host $fs $used")
|
||||
done
|
||||
unset IFS
|
||||
done
|
||||
@@ -82,7 +99,11 @@ function storage_check() {
|
||||
}
|
||||
|
||||
tmpfile=$(mktemp)
|
||||
TempFiles="${TempFiles} ${tmpfile}"
|
||||
|
||||
tmpfile2=$(mktemp)
|
||||
TempFiles="${TempFiles} ${tmpfile2}"
|
||||
|
||||
storage_check > ${tmpfile2}
|
||||
|
||||
echo "## :card_file_box: STORAGE HEALTH CHECK" >> ${tmpfile}
|
||||
@@ -91,17 +112,15 @@ echo "| host | filesystem | usage |" >> ${tmpfile}
|
||||
echo "| --- | --- | --- |" >> ${tmpfile}
|
||||
cat ${tmpfile2} | sort -h -r | awk -F'%' '{printf "%s%%%s\n",$2,$3}' >> ${tmpfile}
|
||||
cat ${tmpfile} | ${Sender} ${StatusChannel}
|
||||
rm ${tmpfile} ${tmpfile2}
|
||||
|
||||
Measurements=()
|
||||
tmpfile=$(mktemp)
|
||||
TempFiles="${TempFiles} ${tmpfile}"
|
||||
|
||||
space_alert > ${tmpfile}
|
||||
cat ${tmpfile}
|
||||
if [ -s ${tmpfile} ]
|
||||
then
|
||||
(echo "### :card_file_box: STORAGE ALERTS" && cat ${tmpfile}) | ${Sender} ${AlertChannel}
|
||||
else
|
||||
echo File ${tmpfile} is empty
|
||||
echo "No Storage Alerts"
|
||||
fi
|
||||
rm ${tmpfile}
|
||||
|
||||
|
||||
+13
-11
@@ -1,5 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
# ----- Settings
|
||||
LocalSoftwareDir=${HOME}/software/cvtt2
|
||||
|
||||
ProdDir=${HOME}/prod
|
||||
|
||||
ReleaseHosts=("cloud21.cvtt.vpn")
|
||||
ReleasePorts=("22")
|
||||
ReleaseUsers=("cvttdist")
|
||||
ReleaseDir=("/home/cvttdist/software/cvtt2")
|
||||
# ----- Settings
|
||||
|
||||
function usage() {
|
||||
echo "Usage: ${0} <project> <version>"
|
||||
exit 1
|
||||
@@ -18,17 +30,6 @@ then
|
||||
Version=latest
|
||||
fi
|
||||
|
||||
# ----- Settings
|
||||
LocalSoftwareDir=${HOME}/software/cvtt2
|
||||
|
||||
ProdDir=${HOME}/prod
|
||||
|
||||
ReleaseHosts=("cloud21.cvtt.vpn")
|
||||
ReleasePorts=("22")
|
||||
ReleaseUsers=("cvttdist")
|
||||
ReleaseDir=("/home/cvttdist/software/cvtt2")
|
||||
# ----- Settings
|
||||
|
||||
function rsync_load_version() {
|
||||
for idx in "${!ReleaseHosts[@]}"
|
||||
do
|
||||
@@ -68,6 +69,7 @@ function rsync_load_version() {
|
||||
}
|
||||
|
||||
mkdir -p ${LocalSoftwareDir}
|
||||
mkdir -p ${ProdDir}
|
||||
|
||||
# exists and not empty
|
||||
rsync_load_version
|
||||
|
||||
@@ -26,7 +26,7 @@ Oldest=$(date -d "${DateCriteria}" '+%Y-%m-%d')
|
||||
|
||||
echo "Looking for log files older than ${DateCriteria} in ${LogDir}"
|
||||
|
||||
LogArchiveDir=/home/cvtt/prod/archive/logs
|
||||
LogArchiveDir=${HOME}/prod/archive/logs
|
||||
mkdir -p ${LogArchiveDir}
|
||||
|
||||
echo "find ${LogDir}/ '(' -name '*.log' -o -name '*.log.*' ')' -type f -not -newermt ${Oldest})"
|
||||
|
||||
Reference in New Issue
Block a user