Compare commits

..

27 Commits

Author SHA1 Message Date
oleg 5bf02ae67a release_version.txt -> VERSION 2025-01-27 16:41:22 -05:00
oleg 43c50befc4 docker to use CONFIG_SERVICE 2025-01-24 11:39:04 -05:00
oleg 48ecf7cca2 storage healthcheck - ignore known_hosts 2025-01-22 17:48:13 -05:00
oleg 5671ec5044 homestore ==> hs01 2025-01-13 21:54:30 -05:00
oleg a7e442b954 homestore ==> hs01 2025-01-13 20:04:52 -05:00
oleg 7e0c389536 minor - docker build script logging 2024-12-16 19:58:02 -05:00
oleg 058431a37c version only 2024-12-16 18:08:40 -05:00
oleg 9de3ed3ab9 creds to be taken from ~/.creds 2024-12-16 17:46:05 -05:00
oleg 31aca36fe7 fix: prepare eqt simdata script 2024-12-06 20:11:33 -05:00
oleg 92538f0819 fix: prepare eqt simdata script 2024-12-06 20:08:53 -05:00
oleg 1cfac2b32d fix: prepare eqt simdata script 2024-12-06 20:00:23 -05:00
oleg 625670c69e prepare sim for crypto (before added num_trades) - progress 2024-12-06 19:50:02 -05:00
oleg 11ab9dd2c2 prepare sim for crypto (before added num_trades) 2024-12-06 17:34:37 -05:00
oleg bbbdbb5473 16 -> 23 2024-12-04 16:42:35 -05:00
oleg cade1cd055 simdata prepare 2024-12-03 20:11:36 -05:00
oleg ed44757900 fix 2024-12-03 13:55:39 -05:00
oleg 340283c0a9 fix: syntax 2024-12-03 13:54:56 -05:00
oleg f4365d32e5 fix: no boolean for jq, it considers "false" as missing (null) 2024-12-03 13:41:32 -05:00
oleg 1fe5edcd74 build script fix 2024-12-03 12:37:48 -05:00
oleg 8510226599 host checking improving 2024-12-03 12:32:40 -05:00
oleg 10105ad639 prepare equity simulation data 2024-11-27 20:46:10 -05:00
oleg 9b2bda6257 crypto_exch_stats docker run 2024-11-06 10:46:41 -05:00
oleg 80a6ffeb18 docker_image_builder fix 2024-11-02 23:36:26 -04:00
oleg e7c02587c2 progress docker image builder 2024-11-02 21:22:23 -04:00
oleg cc2c07741a fix 2024-11-02 17:54:16 -04:00
oleg 36d6914c8c initial version of docker_image_builder.sh 2024-11-02 16:42:06 -04:00
oleg 86a58462bf initial (not working) version of docker_image_builder.sh 2024-11-02 13:23:51 -04:00
28 changed files with 880 additions and 146 deletions
+1
View File
@@ -0,0 +1 @@
1.9.8,release_version.txt -> VERSION
+9 -2
View File
@@ -1,6 +1,6 @@
#!/bin/env bash #!/bin/env bash
Registry=http://homestore.cvtt.vpn:5500 Registry=http://hs01.cvtt.vpn:5500
Catalog=${Registry}/v2/_catalog Catalog=${Registry}/v2/_catalog
@@ -11,5 +11,12 @@ jstr=$(curl -s -X GET ${Catalog})
echo "${jstr}" | jq -r '.repositories[]' | while read repo; do echo "${jstr}" | jq -r '.repositories[]' | while read repo; do
TagListURL="${Registry}/v2/${repo}/tags/list" TagListURL="${Registry}/v2/${repo}/tags/list"
# echo $repo # echo $repo
curl -s -X GET ${TagListURL} Cmd="curl -s -X GET ${TagListURL}"
echo ${Cmd}
eval ${Cmd}
# TagList=$(eval ${Cmd})
# # echo ${TagList}
# echo "${TagList}" | jq -r '.tags[]' | while read tag; do
# echo "${Registry}/${repo}:${tag}"
# done
done done
+9 -9
View File
@@ -3,20 +3,20 @@
# ---------------- Settings # ---------------- Settings
declare -A git_repo_arr declare -A git_repo_arr
git_repo_arr[cvttpy]=git@cloud21.cvtt.vpn:/opt/store/git/cvttpy.git git_repo_arr[cvttpy]=git@cloud21.cvtt.vpn:/opt/store/git/cvtt2/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/cvtt2/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/cvtt2/research.git
git_repo_arr[cvtt-rust]=git@cloud21.cvtt.vpn:/opt/store/git/cvtt2/cvtt-rust.git git_repo_arr[cvtt-rust]=git@cloud21.cvtt.vpn:/opt/store/git/cvtt2/cvtt-rust.git
git_repo_arr[docker_dev]=git@cloud21.cvtt.vpn:/opt/store/git/docker_dev.git git_repo_arr[docker_dev]=git@cloud21.cvtt.vpn:/opt/store/git/cvtt2/docker_dev.git
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"
# ---------------- Settings # ---------------- Settings
dist_locations="cloud21.cvtt.vpn:22 hs01.cvtt.vpn:22"
version_file="VERSION"
# ---------------- cmdline # ---------------- cmdline
prj= prj=
brnch=master brnch=master
@@ -145,8 +145,8 @@ if [ "${?}" != "0" ]; then
fi fi
release_version=$(cat release_version.txt | awk -F',' '{print $1}') release_version=$(cat ${version_file} | awk -F',' '{print $1}')
whats_new=$(cat release_version.txt | awk -F',' '{print $2}') whats_new=$(cat ${version_file} | awk -F',' '{print $2}')
echo "--------------------------------" echo "--------------------------------"
@@ -175,7 +175,7 @@ if [ "${project}" == "cvtt-rust" ]; then
release_dir=${prj_dir}/dist/${project} release_dir=${prj_dir}/dist/${project}
cmd_arr+=("mkdir -p ${release_dir}") cmd_arr+=("mkdir -p ${release_dir}")
cmd_arr+=("cp release_version.txt ${release_dir}") cmd_arr+=("cp ${version_file} ${release_dir}")
jq_cmd="jq '.packages[] | select(.targets[].kind[] == \"bin\") | .name'" jq_cmd="jq '.packages[] | select(.targets[].kind[] == \"bin\") | .name'"
apps=$(cargo metadata --no-deps --format-version 1 --manifest-path=${prj_dir}/Cargo.toml | eval $jq_cmd | uniq) apps=$(cargo metadata --no-deps --format-version 1 --manifest-path=${prj_dir}/Cargo.toml | eval $jq_cmd | uniq)
+177 -45
View File
@@ -24,8 +24,8 @@ ReleaseDir="/home/cvttdist/software/cvtt2"
DIMAGES_CONFIG=$(curl -s ${ConfigUrl} | ${HOME}/bin/hjson -j) DIMAGES_CONFIG=$(curl -s ${ConfigUrl} | ${HOME}/bin/hjson -j)
# RootDir=/home/oleg/prod
SetVersionScript=/home/oleg/prod/ops/scripts/set_version.sh SetVersionScript=${HOME}/prod/set_version.sh
# --------------- D E B U G # --------------- D E B U G
@@ -35,12 +35,13 @@ mkdir -p ${RootDir}
build_docker_image() { build_docker_image() {
title=${1} title=${1}
image_name=${2} image_name=${2}
docker_dev=${3} docker_dev_path=${3}
project=${4} project=${4}
test_script=${5}
echo "Building ${title}..." echo "Building ${title}..."
echo "ImageName=${image_name}" echo "ImageName=${image_name}"
echo "DockerDev=${docker_dev}" echo "DockerDevPath=${docker_dev_path}"
echo "BasedOnDist=${project}" echo "BasedOnDist=${project}"
# Get Latest DIST version # Get Latest DIST version
@@ -48,7 +49,7 @@ build_docker_image() {
image_version=$(get_latest_dist_version ${project}) image_version=$(get_latest_dist_version ${project})
if [ -z "${image_version}" ]; then if [ -z "${image_version}" ]; then
echo "No latest version found for ${project}" echo "No latest version found for ${project}"
exit 1 return
fi fi
echo "Latest version is ${image_version}" echo "Latest version is ${image_version}"
@@ -58,8 +59,139 @@ build_docker_image() {
fi fi
echo "Image $image_name:$image_version does not exist in the registry." echo "Image $image_name:$image_version does not exist in the registry."
echo "getting lastest version of ${project} on ${ReleaseUser}@${ReleaseHost}:${ReleaseDir}" echo "getting lastest version of ${project} on ${ReleaseUser}@${ReleaseHost}:${ReleaseDir}"
${SetVersionScript} ${project} ${image_version}
Cmd="${SetVersionScript} ${project} ${image_version}"
echo ${Cmd}
eval ${Cmd}
convert_symlink_to_dir ${project}
DockerDir=./docker_dev/${docker_dev_path}
echo "================================================================================"
echo "Building ${title}... on ${DockerDir}"
echo "================================================================================"
Cmd="docker build"
Cmd+=" -t ${image_name}"
Cmd+=" -t ${image_name}:latest"
Cmd+=" -t ${image_name}:${image_version}"
Cmd+=" -f ${DockerDir}/Dockerfile ${RootDir}"
echo ${Cmd}
eval ${Cmd} 1>&2 || exit 1
if [ ! -z "${test_script}" ]; then
if [ ! -f ${DockerDir}/${test_script} ]; then
echo "Test script ${test_script} is missing"
exit 1
fi
echo "Running test script ${test_script} for ${image_name}"
Cmd="docker cp ${DockerDir}/${test_script} ${image_name}:/"
echo ${Cmd}
eval ${Cmd} 1>&2 || exit 1
Cmd="docker exec ${image_name} chmod +x /${test_script}"
echo ${Cmd}
eval ${Cmd} 1>&2 || exit 1
Cmd="docker run"
Cmd+=" --rm"
Cmd+=" -d"
Cmd+=" --name test-container"
Cmd+=" ${image_name}"
Cmd+=" /bin/bash -c /${TestScript}"
echo ${Cmd}
eval ${Cmd} 1>&2 || exit 1
echo "Removing test script ${test_script} from ${image_name}"
Cmd="docker exec ${image_name} rm /${test_script}"
echo ${Cmd}
eval ${Cmd} 1>&2 || exit 1
fi
: <<'COMMENT'
-------------------------
Every single docker_dev project must have a test script
image_test.sh
that is copied to the image's root directory.
-------------------------
Cmd="docker run"
Cmd+=" --rm"
Cmd+=" -d"
Cmd+=" --name test-container"
Cmd+=" ${image_name}"
Cmd+=" /bin/bash -c /${TestScript}"
echo ${Cmd}
eval ${Cmd} 1>&2 || exit 1
# Get the exit status of the test script
docker wait test-container
# Check the exit status of the container
EXIT_STATUS=$?
# Analyze the exit status
if [ ${EXIT_STATUS} -ne 0 ]; then
echo "Tests Failed"
exit 1
fi
COMMENT
Cmd="docker tag"
Cmd+=" ${image_name}:latest"
Cmd+=" ${RegistryService}/${image_name}:latest"
echo ${Cmd}
eval ${Cmd} || exit
Cmd="docker tag"
Cmd+=" ${image_name}:${image_version}"
Cmd+=" ${RegistryService}/${image_name}:${image_version}"
echo ${Cmd}
eval ${Cmd} || exit
Cmd="docker push"
Cmd+=" ${RegistryService}/${image_name}:latest"
echo ${Cmd}
eval ${Cmd} || exit
Cmd="docker push"
Cmd+=" ${RegistryService}/${image_name}:${image_version}"
echo ${Cmd}
eval ${Cmd} || exit
echo "Removing the copy of ${project} from ${RootDir}"
Cmd="rm -rf ${RootDir}/${project}"
echo ${Cmd}
eval ${Cmd}
print_all_reg_images ${project}
}
convert_symlink_to_dir() {
project=${1}
if [ -L ${RootDir}/${project} ]; then
echo "Converting symlink ${RootDir}/${project} to directory"
Cmd="mv ${RootDir}/${project} ${RootDir}/${project}.symlink"
echo ${Cmd} && eval ${Cmd}
src_path=$(readlink -f ${RootDir}/${project}.symlink)
Cmd="cp -r ${src_path} ${RootDir}/${project}"
echo ${Cmd} && eval ${Cmd}
fi
if [ -d ${project} ]; then
echo "${RootDir}/${project} is a Directory"
fi
Cmd="rm ${RootDir}/${project}.symlink"
echo ${Cmd} && eval ${Cmd}
} }
image_exists() { image_exists() {
@@ -73,6 +205,26 @@ image_exists() {
fi fi
} }
print_all_reg_images() {
project=${1}
repositories=$(curl -s "${RegistryProtocol}://${RegistryService}/v2/_catalog" | jq -r '.repositories[]')
for repo in $repositories; do
# Fetch all tags for the repository
tags=$(curl -s "${RegistryProtocol}://${RegistryService}/v2/$repo/tags/list" | jq -r '.tags[]')
# List each tag
for tag in $tags; do
if [ "${project}" == "" ];then
echo "$repo:$tag"
else
echo "$repo:$tag" | grep ${project}
fi
done
done
}
get_latest_dist_version() { get_latest_dist_version() {
project=${1} project=${1}
@@ -83,54 +235,34 @@ get_latest_dist_version() {
echo RootDir=${RootDir} echo RootDir=${RootDir}
cd ${RootDir} cd ${RootDir}
echo "Getting latest version of docker_dev" echo "Getting latest version of docker_dev"
Cmd="${SetVersionScript} docker_dev latest" Cmd="${SetVersionScript} docker_dev latest"
echo ${Cmd} echo ${Cmd}
eval ${Cmd} eval ${Cmd}
echo "${DIMAGES_CONFIG}" | jq -c 'to_entries[]' | while IFS= read -r item; do convert_symlink_to_dir docker_dev
Jobs=()
while IFS= read -r item; do
Jobs+=("$item")
done < <(echo "${DIMAGES_CONFIG}" | jq -c 'to_entries[]')
for item in "${Jobs[@]}"; do
# Extract key (name) and values # Extract key (name) and values
title=$(echo "$item" | jq -r '.key') title=$(echo "$item" | jq -r '.key')
image_name=$(echo "$item" | jq -r '.value.image_name') image_name=$(echo "$item" | jq -r '.value.image_name')
docker_dev=$(echo "$item" | jq -r '.value.docker_dev') docker_dev_path=$(echo "$item" | jq -r '.value.docker_dev_path')
project=$(echo "$item" | jq -r '.value.based_on_dist') project=$(echo "$item" | jq -r '.value.based_on_project')
build_docker_image "$title" "$image_name" "$docker_dev" "$project" test_script=$(echo "$item" | jq -r '.value.test_script')
build_docker_image "$title" "$image_name" "$docker_dev_path" "$project" "${test_script}
done done
exit Cmd="rm -rf ${RootDir}/docker_dev"
echo ${Cmd}
eval ${Cmd}
echo "Done ${0} ${*}"
#=============================================================================== #===============================================================================
#=============================================================================== #===============================================================================
DockerDir=$(realpath $(dirname ${0})/${AppPath})
AppName=$(basename ${AppPath})
ImageName=${AppName}
ImageDir=${HOME}/docker_images
mkdir -p ${ImageDir}
Version=$(cat ${RootDir}/cvttpy/release_version.txt | awk -F, '{print $1}')
cd ${RootDir}
Cmd="docker build -t ${ImageName} -t ${ImageName}:latest -t ${ImageName}:${Version} -f ${DockerDir}/Dockerfile ."
echo ${Cmd}
eval ${Cmd} || exit
Cmd="docker tag ${ImageName}:latest ${RegistryService}/${ImageName}:latest"
echo ${Cmd}
eval ${Cmd} || exit
Cmd="docker tag ${ImageName}:${Version} ${RegistryService}/${ImageName}:${Version}"
echo ${Cmd}
eval ${Cmd} || exit
Cmd="docker push ${RegistryService}/${ImageName}:latest"
echo ${Cmd}
eval ${Cmd} || exit
Cmd="docker push ${RegistryService}/${ImageName}:${Version}"
echo ${Cmd}
eval ${Cmd} || exit
+33
View File
@@ -0,0 +1,33 @@
#!/bin/bash
usage() {
echo -n "Usage: ${0} <grep_filter>"
echo
exit 1
}
# --- Settings
RegistryService=cloud21.cvtt.vpn:5500
RegistryProtocol=http
print_all_reg_images() {
project=${1}
repositories=$(curl -s "${RegistryProtocol}://${RegistryService}/v2/_catalog" | jq -r '.repositories[]')
for repo in $repositories; do
# Fetch all tags for the repository
tags=$(curl -s "${RegistryProtocol}://${RegistryService}/v2/$repo/tags/list" | jq -r '.tags[]')
# List each tag
echo "REPO: $repo"
for tag in $tags; do
if [ "${project}" == "" ];then
echo "$repo:$tag"
else
echo "$repo:$tag" | grep ${project}
fi
done
done
}
print_all_reg_images ${1}
+11 -9
View File
@@ -11,15 +11,17 @@ if [ -z ${date} ] ; then
fi fi
Cmd="docker run" Cmd="docker run"
Cmd="${Cmd} --pull=always" Cmd+=" --pull=always"
Cmd="${Cmd} --network=host" Cmd+=" --network=host"
Cmd="${Cmd} --name=crypto_md_day.${host}.${date}" Cmd+=" --name=crypto_md_day.${host}.${date}"
Cmd="${Cmd} --rm" Cmd+=" --rm"
Cmd="${Cmd} ${DockerImage}" Cmd+=" --volume=${HOME}/.creds:/.creds"
Cmd="${Cmd} -h ${host}" Cmd+=" -e CONFIG_SERVICE=cloud23.cvtt.vpn:6789"
Cmd="${Cmd} -d ${date}" Cmd+=" ${DockerImage}"
# Cmd="${Cmd} -s coinbase,bnbspot,bnbfut" Cmd+=" -h ${host}"
Cmd="${Cmd} -s coinbase,bnbspot" Cmd+=" -d ${date}"
# Cmd+=" -s coinbase,bnbspot,bnbfut"
Cmd+=" -s coinbase,bnbspot"
echo $Cmd echo $Cmd
eval $Cmd eval $Cmd
+10 -8
View File
@@ -86,15 +86,17 @@ fi
echo "date_to_load=${date_to_load}" echo "date_to_load=${date_to_load}"
Cmd="docker run" Cmd="docker run"
Cmd="${Cmd} --pull=always" Cmd+=" --pull=always"
Cmd="${Cmd} --network=host" Cmd+=" --network=host"
Cmd="${Cmd} --name=${ContainerName}" Cmd+=" --name=${ContainerName}"
Cmd="${Cmd} --rm" Cmd+=" --rm"
Cmd="${Cmd} --volume=${LogDir}:/logs" Cmd+=" --volume=${LogDir}:/logs"
Cmd="${Cmd} ${DockerImage}" Cmd+=" --volume=${HOME}/.creds:/.creds"
Cmd="${Cmd} -d ${date_to_load}" Cmd+=" -e CONFIG_SERVICE=cloud23.cvtt.vpn:6789"
Cmd+=" ${DockerImage}"
Cmd+=" -d ${date_to_load}"
if [ -n "${NumSymbols}" ]; then if [ -n "${NumSymbols}" ]; then
Cmd="${Cmd} -N ${NumSymbols}" Cmd+=" -N ${NumSymbols}"
fi fi
echo $Cmd echo $Cmd
+10 -8
View File
@@ -91,14 +91,16 @@ fi
echo "date_to_load=${date_to_load}" echo "date_to_load=${date_to_load}"
Cmd="docker run" Cmd="docker run"
Cmd="${Cmd} --pull=always" Cmd+=" --pull=always"
Cmd="${Cmd} --network=host" Cmd+=" --network=host"
Cmd="${Cmd} --name=${ContainerName}" Cmd+=" --name=${ContainerName}"
Cmd="${Cmd} --rm" Cmd+=" --rm"
Cmd="${Cmd} --volume=${LogDir}:/logs" Cmd+=" --volume=${LogDir}:/logs"
Cmd="${Cmd} ${DockerImage}" Cmd+=" --volume=${HOME}/.creds:/.creds"
Cmd="${Cmd} -d ${date_to_load}" Cmd+=" -e CONFIG_SERVICE=cloud23.cvtt.vpn:6789"
Cmd="${Cmd} -S ${Symbols}" Cmd+=" ${DockerImage}"
Cmd+=" -d ${date_to_load}"
Cmd+=" -S ${Symbols}"
echo $Cmd echo $Cmd
eval $Cmd eval $Cmd
+11 -9
View File
@@ -44,15 +44,17 @@ fi
Cmd="docker run" Cmd="docker run"
Cmd="${Cmd} -d" Cmd+=" -d"
Cmd="${Cmd} --rm" Cmd+=" --rm"
Cmd="${Cmd} --network=host" Cmd+=" --network=host"
Cmd="${Cmd} --pull=always" Cmd+=" --pull=always"
Cmd="${Cmd} --name=${ContainerName}" Cmd+=" --name=${ContainerName}"
Cmd="${Cmd} -v /home/cvtt/prod/data:/app/data" Cmd+=" -v /home/cvtt/.creds:/.creds"
Cmd="${Cmd} -v /home/cvtt/prod/logs:/logs" Cmd+=" -v /home/cvtt/prod/data:/app/data"
Cmd="${Cmd} cloud21.cvtt.vpn:5500/md_recorder:latest" Cmd+=" -v /home/cvtt/prod/logs:/logs"
Cmd="${Cmd} ${job}" Cmd+=" -e CONFIG_SERVICE=cloud23.cvtt.vpn:6789"
Cmd+=" cloud21.cvtt.vpn:5500/md_recorder:latest"
Cmd+=" ${job}"
echo ${Cmd} echo ${Cmd}
eval ${Cmd} eval ${Cmd}
@@ -27,9 +27,6 @@ is_container_running() {
fi fi
} }
Instance=${1} Instance=${1}
if ! is_valid "${Instance}"; then if ! is_valid "${Instance}"; then
usage usage
@@ -48,14 +45,16 @@ if is_container_running "$ContainerName"; then
fi fi
Cmd="docker run" Cmd="docker run"
Cmd="${Cmd} -d" Cmd+=" -d"
Cmd="${Cmd} --rm" Cmd+=" --rm"
Cmd="${Cmd} --network=host" Cmd+=" --network=host"
Cmd="${Cmd} --pull=always" Cmd+=" --pull=always"
Cmd="${Cmd} --name=${ContainerName}" Cmd+=" --name=${ContainerName}"
Cmd="${Cmd} -v /home/cvtt/prod/logs:/logs" Cmd+=" -v /home/cvtt/.creds:/.creds"
Cmd="${Cmd} cloud21.cvtt.vpn:5500/md_recorder_monitor:latest" Cmd+=" -v /home/cvtt/prod/logs:/logs"
Cmd="${Cmd} ${Instance} ${AdminPort}" Cmd+=" -e CONFIG_SERVICE=cloud23.cvtt.vpn:6789"
Cmd+=" cloud21.cvtt.vpn:5500/md_recorder_monitor:latest"
Cmd+=" ${Instance} ${AdminPort}"
echo ${Cmd} echo ${Cmd}
eval ${Cmd} eval ${Cmd}
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
Cmd="docker run"
Cmd+=" -d"
Cmd+=" --rm"
Cmd+=" --pull=always"
Cmd+=" --network=host"
Cmd+=" --name=crypto_exch_stats"
Cmd+=" --volume=${HOME}/prod/data:/app/data"
Cmd+=" --volume=${HOME}/prod/logs:/logs"
Cmd+=" -e CONFIG_SERVICE=cloud23.cvtt.vpn:6789"
Cmd+=" cloud21.cvtt.vpn:5500/crypto_exch_stats:latest"
echo ${Cmd}
eval ${Cmd}
# Cmd+=" cloud21.cvtt.vpn:5500/relative_liquidity:latest"
-1
View File
@@ -1 +0,0 @@
1.8.3,changes to build scripts
+1 -1
View File
@@ -2,7 +2,7 @@
# by chatGPT # by chatGPT
# ========================================== # ==========================================
# homestore.cvtt.vpn SETTINGS # hs01.cvtt.vpn SETTINGS
# ========================================== # ==========================================
# Define source and destination base directories # Define source and destination base directories
+5 -5
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
usage() { usage() {
echo "Usage: $0 [-h <host (homestore*/cloud21)>] [-d <YYYYMMDD> (yesterday*)] [-s <source> (cvttdata/cloud21*)>]" echo "Usage: $0 [-h <host (hs01*/cloud21)>] [-d <YYYYMMDD> (yesterday*)] [-s <source> (cvttdata/cloud21*)>]"
exit 1 exit 1
} }
@@ -20,7 +20,7 @@ is_valid() {
} }
date="" date=""
host=homestore host=hs01
source=cloud21 source=cloud21
while getopts ":h:d:s:" opt; do while getopts ":h:d:s:" opt; do
@@ -51,7 +51,7 @@ fi
echo "$date $host $source" echo "$date $host $source"
valid_hosts=('homestore' 'cloud21') valid_hosts=('hs01' 'cloud21')
if ! is_valid "${host}" "${valid_hosts[@]}" ; then if ! is_valid "${host}" "${valid_hosts[@]}" ; then
echo "Host '${host}' is not valid" echo "Host '${host}' is not valid"
usage usage
@@ -67,8 +67,8 @@ if [ "${host}" == "cloud21" ] ; then
SourceHost=cloud21.cvtt.vpn SourceHost=cloud21.cvtt.vpn
SourceUser=cvtt SourceUser=cvtt
SourceRootDir="/opt/store/cvtt/md_archive/crypto/${source}" SourceRootDir="/opt/store/cvtt/md_archive/crypto/${source}"
elif [ "${host}" == "homestore" ]; then elif [ "${host}" == "hs01" ]; then
SourceHost=homestore.cvtt.vpn SourceHost=hs01.cvtt.vpn
SourceUser=cvtt SourceUser=cvtt
SourceRootDir=/works/cvtt/md_archive/crypto/${source} SourceRootDir=/works/cvtt/md_archive/crypto/${source}
else else
+5 -5
View File
@@ -2,7 +2,7 @@
usage() { usage() {
echo -n "Usage: $0" echo -n "Usage: $0"
echo -n " [-h <host (homestore*/cloud21)>]" echo -n " [-h <host (hs01*/cloud21)>]"
echo -n " [-d <YYYYMMDD> (yesterday*)]" echo -n " [-d <YYYYMMDD> (yesterday*)]"
echo -n " [-s <stocks comma separated>" echo -n " [-s <stocks comma separated>"
echo -n " [-t <target directory>" echo -n " [-t <target directory>"
@@ -19,7 +19,7 @@ fi
# ------------------ Settings # ------------------ Settings
md_date="" md_date=""
host=homestore host=hs01
stocks=COIN,GBTC,SQ stocks=COIN,GBTC,SQ
TargetDir="/opt/jupyter_gpu/data/eqty_md" TargetDir="/opt/jupyter_gpu/data/eqty_md"
@@ -81,7 +81,7 @@ fi
echo "$md_date $host $source" echo "$md_date $host $source"
valid_hosts=('homestore' 'cloud21') valid_hosts=('hs01' 'cloud21')
if ! is_valid "${host}" "${valid_hosts[@]}" ; then if ! is_valid "${host}" "${valid_hosts[@]}" ; then
echo "Host '${host}' is not valid" echo "Host '${host}' is not valid"
usage usage
@@ -108,8 +108,8 @@ if [ "${host}" == "cloud21" ] ; then
SourceHost=cloud21.cvtt.vpn SourceHost=cloud21.cvtt.vpn
SourceUser=cvtt SourceUser=cvtt
SourceRootDir="/opt/store/cvtt/md_archive/equity/alpaca_md" SourceRootDir="/opt/store/cvtt/md_archive/equity/alpaca_md"
elif [ "${host}" == "homestore" ]; then elif [ "${host}" == "hs01" ]; then
SourceHost=homestore.cvtt.vpn SourceHost=hs01.cvtt.vpn
SourceUser=cvtt SourceUser=cvtt
SourceRootDir="/works/cvtt/md_archive/equity/alpaca_md" SourceRootDir="/works/cvtt/md_archive/equity/alpaca_md"
else else
+284
View File
@@ -0,0 +1,284 @@
#!/bin/bash
# SQLite DDL for simulation
# =========================
# -- md_quotes
# -- md_1min_bars
usage() {
echo "Usage: $0 -d YYYMMDD Date> [-O <output dir (./) >]"
exit 1
}
# --------------------- Settings
SourceHost=cloud21.cvtt.vpn
SourceRootDir=/opt/store/cvtt/md_archive/crypto
DbSource=cloud21
# --------------------- Settings
while getopts ":d:O:" opt; do
case ${opt} in
d )
Date=$OPTARG
;;
O )
OutputDir=$OPTARG
;;
\? )
echo "Invalid option: -$OPTARG" >&2
usage
;;
: )
echo "Option -$OPTARG requires an argument." >&2
usage
;;
esac
done
if [ -z ${Date} ] ; then
echo "date is not specified"
usage
fi
if [ -z ${OutputDir} ] ; then
OutputDir=.
fi
mkdir -p ${OutputDir}
# --- Binance
Instruments=( PAIR-ADA-USDT )
Instruments+=( PAIR-BCH-USDT )
Instruments+=( PAIR-BTC-USDT )
Instruments+=( PAIR-DOT-USDT )
Instruments+=( PAIR-ETH-USDT )
Instruments+=( PAIR-LTC-USDT )
Instruments+=( PAIR-SOL-USDT )
Instruments+=( PAIR-USDC-USDT )
Instruments+=( PAIR-XRP-USDT )
# --- Coinbase
Instruments+=( PAIR-ADA-USD )
Instruments+=( PAIR-BCH-USD )
Instruments+=( PAIR-BTC-USD )
Instruments+=( PAIR-DOT-USD )
Instruments+=( PAIR-ETH-USD )
Instruments+=( PAIR-LTC-USD )
Instruments+=( PAIR-SOL-USD )
Instruments+=( PAIR-XRP-USD )
echo "Date=${Date} Instruments=${Instruments[@]} OutputDir=${OutputDir}"
echo Getting data from ${DataHost} ...
year=$(date -d ${Date} +"%Y")
month=$(date -d ${Date} +"%m")
SourceDir="${SourceRootDir}/${DbSource}/${year}/${month}"
SourceFile="${SourceDir}/${Date}.mktdata.db.gz"
Cmd="rsync -ahv"
Cmd+=" ${SourceHost}:${SourceFile}"
Cmd+=" $OutputDir/"
echo ${Cmd}
eval ${Cmd}
Cmd="(cd ${OutputDir} && gunzip *.db.gz)"
echo ${Cmd}
eval ${Cmd}
SourceDbFile="${OutputDir}/${Date}.mktdata.db"
ResultDbFile="${OutputDir}/${Date}.crypto_sim_md.db"
echo "Creating Result Database File ${ResultDbFile}"
echo "Creating table md_trades ..."
sqlite3 ${ResultDbFile} <<EOF
CREATE TABLE IF NOT EXISTS md_trades (
tstamp text,
tstamp_ns integer,
exchange_id text,
instrument_id text,
exch text,
px real,
qty real,
trade_id text,
condition text,
tape text
);
CREATE UNIQUE INDEX IF NOT EXISTS md_trades_uidx
ON md_trades(tstamp_ns, exchange_id, instrument_id);
EOF
echo "Creating table md_quotes ..."
sqlite3 ${ResultDbFile} <<EOF
CREATE TABLE IF NOT EXISTS md_quotes (
tstamp text,
tstamp_ns integer,
exchange_id text,
instrument_id text,
bid_exch text,
bid_px real,
bid_qty real,
ask_exch text,
ask_px real,
ask_qty real
);
CREATE UNIQUE INDEX IF NOT EXISTS md_quotes_uidx
ON md_quotes(tstamp_ns, exchange_id, instrument_id);
EOF
echo "Creating table md_1min_bars ..."
sqlite3 ${ResultDbFile} <<EOF
CREATE TABLE IF NOT EXISTS md_1min_bars (
tstamp text,
tstamp_ns integer,
exchange_id text,
instrument_id text,
open real,
high real,
low real,
close real,
volume real,
vwap real,
num_trades integer
);
CREATE UNIQUE INDEX IF NOT EXISTS md_1min_bars_uidx
ON md_1min_bars(tstamp, exchange_id, instrument_id);
EOF
echo "Loading md_trades ..."
sqlite3 ${ResultDbFile} <<EOF
ATTACH '${SourceDbFile}' AS source_db;
BEGIN;
INSERT OR IGNORE INTO md_trades SELECT
datetime(exchange_ts_ns / 1000000000, 'unixepoch') || '.' || printf('%06d', (exchange_ts_ns % 1000000000) / 1000) as tstamp,
time as tstamp_ns,
exchange_id,
instrument_id,
"" as exch,
price as px,
quantity as qty,
"" as trade_id,
taker_side as condition,
"" as tape
from source_db.bnbspot_md_trades;
COMMIT;
BEGIN;
INSERT OR IGNORE INTO md_trades
SELECT
datetime(exchange_ts_ns / 1000000000, 'unixepoch') || '.' || printf('%06d', (exchange_ts_ns % 1000000000) / 1000) as tstamp,
time as tstamp_ns,
exchange_id,
instrument_id,
"" as exch,
price as px,
quantity as qty,
"" as trade_id,
taker_side as condition,
"" as tape
from source_db.coinbase_md_trades;
COMMIT;
DETACH source_db;
EOF
echo "Loading md_quotes ..."
sqlite3 ${ResultDbFile} <<EOF
ATTACH '${SourceDbFile}' AS source_db;
BEGIN;
INSERT OR IGNORE INTO md_quotes SELECT
datetime(exchange_ts_ns / 1000000000, 'unixepoch') || '.' || printf('%06d', (exchange_ts_ns % 1000000000) / 1000) as tstamp,
time as tstamp_ns,
exchange_id,
instrument_id,
exchange_id as bid_exch,
bid_price as bid_px,
bid_quantity as bid_qty,
exchange_id as ask_exch,
ask_price as ask_px,
ask_quantity as ask_qty
from bnbspot_md_booktops;
COMMIT;
BEGIN;
INSERT OR IGNORE INTO md_quotes SELECT
datetime(exchange_ts_ns / 1000000000, 'unixepoch') || '.' || printf('%06d', (exchange_ts_ns % 1000000000) / 1000) as tstamp,
time as tstamp_ns,
exchange_id,
instrument_id,
exchange_id as bid_exch,
bid_price as bid_px,
bid_quantity as bid_qty,
exchange_id as ask_exch,
ask_price as ask_px,
ask_quantity as ask_qty
from coinbase_md_booktops;
COMMIT;
DETACH source_db;
EOF
### --- REPLACE 0 with num_trades ---
echo "Loading md_1min_bars ..."
sqlite3 ${ResultDbFile} <<EOF
ATTACH '${SourceDbFile}' AS source_db;
BEGIN;
INSERT OR IGNORE INTO md_1min_bars SELECT
datetime(tstamp / 1000000000, 'unixepoch') || '.' || printf('%06d', (tstamp % 1000000000) / 1000) as tsatmp,
tstamp as tstamp_ns,
exchange_id,
instrument_id,
open,
high,
low,
close,
volume,
vwap,
0 as num_trades
from bnbspot_ohlcv_1min;
COMMIT;
BEGIN;
INSERT OR IGNORE INTO md_1min_bars SELECT
datetime(tstamp / 1000000000, 'unixepoch') || '.' || printf('%06d', (tstamp % 1000000000) / 1000) as tstamp,
tstamp as tstamp_ns,
exchange_id,
instrument_id,
open,
high,
low,
close,
volume,
vwap,
0 as num_trades
from coinbase_ohlcv_1min;
COMMIT;
DETACH source_db;
EOF
Cmd="rm ${SourceDbFile}"
echo ${Cmd}
eval ${Cmd}
Cmd="gzip ${ResultDbFile}"
echo ${Cmd}
eval ${Cmd}
Cmd="rsync -ahvv ${ResultDbFile}.gz cvtt@hs01.cvtt.vpn:/works/cvtt/md_archive/crypto/sim/"
echo ${Cmd}
eval ${Cmd}
Cmd="rsync -ahvv ${ResultDbFile}.gz cvtt@cloud21.cvtt.vpn:/opt/store/cvtt/md_archive/crypto/sim/"
echo ${Cmd}
eval ${Cmd}
Cmd="rm ${ResultDbFile}.gz"
echo ${Cmd}
eval ${Cmd}
echo Done $0 ${*}
+244
View File
@@ -0,0 +1,244 @@
#!/bin/bash
usage() {
echo "Usage: $0 -S <symbols> -d <YYYYMMDD Date> [-O <output dir (./) >]"
exit 1
}
# --------------------- Settings
SourceHost=cloud21.cvtt.vpn
SourceRootDir=/opt/store/cvtt/md_archive/equity/alpaca_md
# --------------------- Settings
is_business_day() {
dt=${1}
date=$(date -d "${dt}" +"%Y-%m-%d")
CalendarURL=http://cloud23.cvtt.vpn:8000/api/v1/markets/hours?mic=XNYS
URL="${CalendarURL}&start=${date}&end=${date}"
open_time=$(curl -s "${URL}" | jq '.[] | .open_time')
if [ -n "${open_time}" ]; then
return 0
else
return 1
fi
}
export -f is_business_day
while getopts ":d:S:O:" opt; do
case ${opt} in
d )
Date=$OPTARG
;;
S )
SymList=$OPTARG
;;
O )
OutputDir=$OPTARG
;;
\? )
echo "Invalid option: -$OPTARG" >&2
usage
;;
: )
echo "Option -$OPTARG requires an argument." >&2
usage
;;
esac
done
if [ -z ${SymList} ] ; then
echo "symbols are not specified"
usage
fi
if [ -z ${Date} ] ; then
echo "date is not specified"
usage
fi
if [ -z ${OutputDir} ] ; then
OutputDir=.
fi
mkdir -p ${OutputDir}
if ! is_business_day ${Date}; then
echo "${Date} is not business day"
usage
fi
OLD_IFS=${IFS}
IFS=","
read -ra Symbols <<< "${SymList}"
IFS=${OLD_IFS}
echo "Date=${Date} Symbols=${Symbols[@]} OutputDir=${OutputDir}"
echo Getting data from ${DataHost} ...
year=$(date -d ${Date} +"%Y")
for sym in ${Symbols[@]}; do
inst_id="STOCK-${sym}"
capital=${sym:0:1}
SourceDir="${SourceRootDir}/${year}/${capital}/${sym}"
SourceHbarFile="${SourceDir}/${Date}.${sym}.alpaca_1m_bars.db.gz"
SourceQatFile="${SourceDir}/${Date}.${sym}.alpaca_qat.db.gz"
for src_file in ${SourceHbarFile} ${SourceQatFile}; do
Cmd="rsync -ahv"
Cmd+=" ${SourceHost}:${src_file}"
Cmd+=" $OutputDir/"
echo ${Cmd}
eval ${Cmd}
done
done
Cmd="(cd ${OutputDir} && gunzip *.db.gz)"
echo ${Cmd}
eval ${Cmd}
ResultDbFile="${OutputDir}/${Date}.alpaca_sim_md.db"
echo "Creating Result Database File ${ResultDbFile}"
echo "Creating Result Database File ${ResultDbFile}"
echo "Creating table md_trades ..."
sqlite3 ${ResultDbFile} <<EOF
CREATE TABLE IF NOT EXISTS md_trades (
tstamp text,
tstamp_ns integer,
exchange_id text,
instrument_id text,
exch text,
px real,
qty real,
trade_id text,
condition text,
tape text
);
CREATE UNIQUE INDEX IF NOT EXISTS md_trades_uidx
ON md_trades(tstamp_ns, exchange_id, instrument_id);
EOF
echo "Creating table md_quotes ..."
sqlite3 ${ResultDbFile} <<EOF
CREATE TABLE IF NOT EXISTS md_quotes (
tstamp text,
tstamp_ns integer,
exchange_id text,
instrument_id text,
bid_exch text,
bid_px real,
bid_qty real,
ask_exch text,
ask_px real,
ask_qty real
);
CREATE UNIQUE INDEX IF NOT EXISTS md_quotes_uidx
ON md_quotes(tstamp_ns, exchange_id, instrument_id);
EOF
echo "Creating table md_1min_bars ..."
sqlite3 ${ResultDbFile} <<EOF
CREATE TABLE IF NOT EXISTS md_1min_bars (
tstamp text,
tstamp_ns integer,
exchange_id text,
instrument_id text,
open real,
high real,
low real,
close real,
volume real,
vwap real,
num_trades integer
);
CREATE UNIQUE INDEX IF NOT EXISTS md_1min_bars_uidx
ON md_1min_bars(tstamp, exchange_id, instrument_id);
EOF
# set -f # not to expand *
for sym in ${Symbols[@]}; do
src_hbar_db=${OutputDir}/${Date}.${sym}.alpaca_1m_bars.db
src_qat_db=${OutputDir}/${Date}.${sym}.alpaca_qat.db
echo "Loading md_trades and md_quotes from ${src_qat_db} ..."
sqlite3 ${ResultDbFile} <<EOF
ATTACH '${src_qat_db}' AS source_db;
BEGIN;
INSERT OR IGNORE INTO md_trades SELECT
tstamp,
tstamp_ns,
exchange_id,
instrument_id,
exch,
px,
qty,
trade_id,
condition,
tape
FROM source_db.md_trades;
COMMIT;
BEGIN;
INSERT OR IGNORE INTO md_quotes SELECT
tstamp,
tstamp_ns,
exchange_id,
instrument_id,
bid_exch,
bid_px,
bid_qty,
ask_exch,
ask_px,
ask_qty
FROM source_db.md_quotes;
COMMIT;
EOF
echo "Loading md_1min_bars from ${src_hbar_db} ..."
sqlite3 ${ResultDbFile} <<EOF
ATTACH '${src_hbar_db}' AS source_db;
BEGIN;
INSERT OR IGNORE INTO md_1min_bars SELECT
tstamp,
tstamp_ns,
exchange_id,
instrument_id,
open,
high,
low,
close,
volume,
vwap,
num_trades
FROM source_db.md_1min_bars;
COMMIT;
DETACH source_db;
EOF
Cmd="rm ${src_hbar_db} ${src_qat_db}"
echo ${Cmd}
eval ${Cmd}
done
Cmd="gzip ${ResultDbFile}"
echo ${Cmd}
eval ${Cmd}
Cmd="rsync -ahvv ${ResultDbFile}.gz cvtt@hs01.cvtt.vpn:/works/cvtt/md_archive/equity/alpaca_md/sim/"
echo ${Cmd}
eval ${Cmd}
Cmd="rsync -ahvv ${ResultDbFile}.gz cvtt@cloud21.cvtt.vpn:/opt/store/cvtt/md_archive/equity/alpaca_md/sim/"
echo ${Cmd}
eval ${Cmd}
Cmd="rm ${ResultDbFile}.gz"
echo ${Cmd}
eval ${Cmd}
echo Done $0 ${*}
@@ -31,7 +31,7 @@ echo "Schemas=${Schemas}"
Cmd= Cmd=
Cmd="${Python}" Cmd="${Python}"
Cmd="${Cmd} ${RootDir}/cvttpy/research/utils/archive_ts_md.py" Cmd="${Cmd} ${RootDir}/cvttpy/research/utils/archive_ts_md.py"
Cmd="${Cmd} --config=http://cloud16.cvtt.vpn:6789/apps/md_recorder" Cmd="${Cmd} --config=http://cloud23.cvtt.vpn:6789/apps/md_recorder"
Cmd="${Cmd} --db_credentials_key=${CredKey}" Cmd="${Cmd} --db_credentials_key=${CredKey}"
Cmd="${Cmd} --date=${yesterday}" Cmd="${Cmd} --date=${yesterday}"
Cmd="${Cmd} --schemas=${Schemas}" Cmd="${Cmd} --schemas=${Schemas}"
+15 -8
View File
@@ -5,11 +5,11 @@
# "users": ["oleg"], # "users": ["oleg"],
# "type": "cloud", # "type": "cloud",
# "ssh_port": 7822, # "ssh_port": 7822,
# # "to_check": "No" # "to_check": "false"
# "timeout_sec": 5
# }, # },
RootDir="${HOME}/prod" RootDir="${HOME}/prod"
# RootDir=/home/oleg/develop/cvtt2 ###### D E B U G
AlertChannel=Alerts-CVTT AlertChannel=Alerts-CVTT
Sender=${RootDir}/ops/utils/send_mmost.sh Sender=${RootDir}/ops/utils/send_mmost.sh
@@ -46,6 +46,8 @@ function host_alert() {
User=oleg User=oleg
Hosts=() Hosts=()
DEFAULT_SSH_PORT=22 DEFAULT_SSH_PORT=22
DEFAULT_TIMEOUT=5
DEFAULT_TO_CHECK="true"
Domains=("${Domains[@]}" "$(get_domains)") Domains=("${Domains[@]}" "$(get_domains)")
for Domain in ${Domains[@]} ; do for Domain in ${Domains[@]} ; do
@@ -56,16 +58,21 @@ for Host in ${Hosts[@]} ; do
host=$(echo $Host | cut -d'.' -f1) host=$(echo $Host | cut -d'.' -f1)
Domain=$(echo $Host | cut -d'.' -f2-) Domain=$(echo $Host | cut -d'.' -f2-)
ToCheck=$(echo "$HOSTS_CONFIG" | jq -r --arg domain "$Domain" --arg host "$host" '.[$domain][$host].to_check // "Yes"')
if [ "${ToCheck^^}" == "NO" ]; then
continue
fi
PortSSH=$(echo "$HOSTS_CONFIG" | jq -r --arg domain "$Domain" --arg host "$host" '.[$domain][$host].ssh_port // '"$DEFAULT_SSH_PORT"'') PortSSH=$(echo "$HOSTS_CONFIG" | jq -r --arg domain "$Domain" --arg host "$host" '.[$domain][$host].ssh_port // '"$DEFAULT_SSH_PORT"'')
echo "Checking host: $Host on port $PortSSH" Timeout=$(echo "$HOSTS_CONFIG" | jq -r --arg domain "$Domain" --arg host "$host" '.[$domain][$host].timeout_sec // '"$DEFAULT_TIMEOUT"'')
ToCheck=$(echo "$HOSTS_CONFIG" | jq -r --arg domain "$Domain" --arg host "$host" '.[$domain][$host].to_check // '"$DEFAULT_TO_CHECK"'')
to_check="${ToCheck^^}"
if [ "${to_check}" == "TRUE" -o "${to_check}" == "YES" -o "${to_check}" == "Y" -o "${to_check}" == "T" ] ; then
echo "Checking host: $Host on port $PortSSH"
else
continue
fi
# Use nc to check if the specified port is open # Use nc to check if the specified port is open
if ! nc -z -w5 "$Host" "$PortSSH"; then if ! nc -z -w ${Timeout} "$Host" "$PortSSH"; then
echo "Host $Host is not available on port $PortSSH" echo "Host $Host is not available on port $PortSSH"
host_alert "Host $Host is not available on port $PortSSH" host_alert "Host $Host is not available on port $PortSSH"
fi fi
+16 -13
View File
@@ -19,13 +19,13 @@ get_user_hosts() {
local Domain=${2} local Domain=${2}
Cmd="curl -s http://cloud23.cvtt.vpn:6789/admin/cvtt_hosts" Cmd="curl -s http://cloud23.cvtt.vpn:6789/admin/cvtt_hosts"
Cmd="${Cmd} | ${HOME}/bin/hjson -j" Cmd+=" | ${HOME}/bin/hjson -j"
Cmd="${Cmd} | jq -r" Cmd+=" | jq -r"
Cmd="${Cmd} --arg domain \"${Domain}\"" Cmd+=" --arg domain \"${Domain}\""
Cmd="${Cmd} --arg usr \"${User}\"" Cmd+=" --arg usr \"${User}\""
Cmd="${Cmd} '.[\$domain] | to_entries[] | select(.value.users[] | contains(\$usr)) | .key'" Cmd+=" '.[\$domain] | to_entries[] | select(.value.users[] | contains(\$usr)) | .key'"
Cmd="${Cmd} | sed 's/\$/.${Domain}/'" Cmd+=" | sed 's/\$/.${Domain}/'"
eval ${Cmd} eval ${Cmd}
} }
@@ -66,13 +66,16 @@ function storage_check() {
else else
port=22 port=22
fi fi
Cmd="ssh -p ${port} $host" Cmd="ssh -p ${port}"
Cmd="${Cmd} eval \"df -hTl" Cmd+=" -o StrictHostKeyChecking=no"
Cmd="${Cmd} -x squashfs" Cmd+=" -o UserKnownHostsFile=/dev/null"
Cmd="${Cmd} -x tmpfs" Cmd+=" $host"
Cmd="${Cmd} -x vfat" Cmd+=" eval \"df -hTl"
Cmd="${Cmd} -x devtmpfs" Cmd+=" -x squashfs"
Cmd="${Cmd} | grep -v Filesystem\"" Cmd+=" -x tmpfs"
Cmd+=" -x vfat"
Cmd+=" -x devtmpfs"
Cmd+=" | grep -v Filesystem\""
IFS=$'\n' ; lines=$(eval ${Cmd}) IFS=$'\n' ; lines=$(eval ${Cmd})
for ln in $lines for ln in $lines
+2 -2
View File
@@ -4,7 +4,7 @@ Start=${1}
NumJobs=${2} NumJobs=${2}
InstListFile=${3} InstListFile=${3}
export CalendarURL=http://cloud16.cvtt.vpn:8000/api/v1/markets/hours?mic=XNYS export CalendarURL=http://cloud23.cvtt.vpn:8000/api/v1/markets/hours?mic=XNYS
is_business_day() { is_business_day() {
dt=${1} dt=${1}
@@ -46,7 +46,7 @@ echo "Start=${Start} End=${End} NumJobs=${NumJobs}"
export PYTHONPATH=/home/cvtt/prod export PYTHONPATH=/home/cvtt/prod
export Python=/home/cvtt/.pyenv/python3.12-venv/bin/python3 export Python=/home/cvtt/.pyenv/python3.12-venv/bin/python3
export Config=http://cloud16.cvtt.vpn:6789/apps/minimal_md export Config=http://cloud23.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/md_archive/equity/alpaca_md # Local export OutputDir=/home/cvtt/prod/archive/md_archive/equity/alpaca_md # Local
@@ -3,7 +3,7 @@
is_business_day() { is_business_day() {
dt=${1} dt=${1}
CalendarURL=http://cloud16.cvtt.vpn:8000/api/v1/markets/hours?mic=XNYS CalendarURL=http://cloud23.cvtt.vpn:8000/api/v1/markets/hours?mic=XNYS
open_time=$(curl -s "${CalendarURL}&start=${dt}&end=${dt}" | jq '.[] | .open_time') open_time=$(curl -s "${CalendarURL}&start=${dt}&end=${dt}" | jq '.[] | .open_time')
if [ -n "${open_time}" ]; then if [ -n "${open_time}" ]; then
return 0 return 0
@@ -25,8 +25,8 @@ run_checklist() {
declare -A Commands declare -A Commands
Commands=( Commands=(
["homestore:cloud21"]="ssh cvtt@homestore.cvtt.vpn ls -l /works/cvtt/md_archive/crypto/cloud21/${yr}/${mn} | tail -5" ["hs01:cloud21"]="ssh cvtt@hs01.cvtt.vpn ls -l /works/cvtt/md_archive/crypto/cloud21/${yr}/${mn} | tail -5"
["homestore:cvttdata"]="ssh cvtt@homestore.cvtt.vpn ls -l /works/cvtt/md_archive/crypto/cvttdata/${yr}/${mn} | tail -5" ["hs01:cvttdata"]="ssh cvtt@hs01.cvtt.vpn ls -l /works/cvtt/md_archive/crypto/cvttdata/${yr}/${mn} | tail -5"
["cloud21:cloud21"]="ssh cvtt@cloud21.cvtt.vpn ls -l /opt/store/cvtt/md_archive/crypto/cloud21/${yr}/${mn} | tail -5" ["cloud21:cloud21"]="ssh cvtt@cloud21.cvtt.vpn ls -l /opt/store/cvtt/md_archive/crypto/cloud21/${yr}/${mn} | tail -5"
["cloud21:cvttdata"]="ssh cvtt@cloud21.cvtt.vpn ls -l /opt/store/cvtt/md_archive/crypto/cvttdata/${yr}/${mn} | tail -5" ["cloud21:cvttdata"]="ssh cvtt@cloud21.cvtt.vpn ls -l /opt/store/cvtt/md_archive/crypto/cvttdata/${yr}/${mn} | tail -5"
["gpushnik"]="ssh oleg@gpushnik.cvtt.vpn 'ls -l /opt/jupyter_gpu/data/crypto_md | tail -10'" ["gpushnik"]="ssh oleg@gpushnik.cvtt.vpn 'ls -l /opt/jupyter_gpu/data/crypto_md | tail -10'"
@@ -24,11 +24,11 @@ run_checklist() {
yr=$(date -d 'yesterday' '+%Y') yr=$(date -d 'yesterday' '+%Y')
CheckSymbols="A/AAPL N/NVDA M/META" CheckSymbols="A/AAPL N/NVDA M/META"
declare -A Commands declare -A Commands
Commands["homestore"]="" Commands["hs01"]=""
for sym in ${CheckSymbols}; do for sym in ${CheckSymbols}; do
Commands["homestore"]+="ssh cvtt@homestore.cvtt.vpn ls -l /works/cvtt/md_archive/equity/alpaca_md/${yr}/${sym} | tail -3; " Commands["hs01"]+="ssh cvtt@hs01.cvtt.vpn ls -l /works/cvtt/md_archive/equity/alpaca_md/${yr}/${sym} | tail -3; "
done done
Commands["homestore"]+="echo" Commands["hs01"]+="echo"
Commands["cloud21"]="" Commands["cloud21"]=""
for sym in ${CheckSymbols}; do for sym in ${CheckSymbols}; do
@@ -4,7 +4,7 @@ export PYTHONPATH=/home/cvtt/prod
Cmd="/home/cvtt/.pyenv/python3.12-venv/bin/python3" Cmd="/home/cvtt/.pyenv/python3.12-venv/bin/python3"
Cmd="${Cmd} /home/cvtt/prod/cvttpy/apps/research/exchange_trading_stats.py" 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} --config=http://cloud23.cvtt.vpn:6789/apps/tests/listen_market_data"
Cmd="${Cmd} --active_exchanges=OKX,GEMINI,BITSTAMP,COINBASE_AT,BNBSPOT,KRAKEN" 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} --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} --db_file=/home/cvtt/prod/data/exchange_trading_stats.db"
+1 -1
View File
@@ -2,7 +2,7 @@
Source=/home/cvtt/prod/archive/md_archive/ Source=/home/cvtt/prod/archive/md_archive/
Targets= Targets=
Targets="${Targets} cvtt@homestore.cvtt.vpn:/works/cvtt/md_archive/" Targets="${Targets} cvtt@hs01.cvtt.vpn:/works/cvtt/md_archive/"
Targets="${Targets} cvtt@cloud21.cvtt.vpn:/opt/store/cvtt/md_archive/" Targets="${Targets} cvtt@cloud21.cvtt.vpn:/opt/store/cvtt/md_archive/"
+1 -1
View File
@@ -6,7 +6,7 @@ SUBDIRS += configs
FILES= FILES=
FILES += release_version.txt FILES += VERSION
all: install all: install