Compare commits
14 Commits
v1.8.5.fx1
...
v1.9.2.F3
| Author | SHA1 | Date | |
|---|---|---|---|
| 31aca36fe7 | |||
| 92538f0819 | |||
| 1cfac2b32d | |||
| 625670c69e | |||
| 11ab9dd2c2 | |||
| bbbdbb5473 | |||
| cade1cd055 | |||
| ed44757900 | |||
| 340283c0a9 | |||
| f4365d32e5 | |||
| 1fe5edcd74 | |||
| 8510226599 | |||
| 10105ad639 | |||
| 9b2bda6257 |
@@ -3,11 +3,11 @@
|
||||
# ---------------- 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
|
||||
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/cvtt2/ops.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[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_user=cvttdist
|
||||
|
||||
Executable
+33
@@ -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}
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/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+=" cloud21.cvtt.vpn:5500/crypto_exch_stats:latest"
|
||||
|
||||
echo ${Cmd}
|
||||
eval ${Cmd}
|
||||
# Cmd+=" cloud21.cvtt.vpn:5500/relative_liquidity:latest"
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
1.8.5.fx1,docker_image_builder
|
||||
1.9.2.F3,fix: prepare eqt simdata script
|
||||
|
||||
Executable
+284
@@ -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@homestore.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 ${*}
|
||||
Executable
+244
@@ -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@homestore.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="${Python}"
|
||||
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} --date=${yesterday}"
|
||||
Cmd="${Cmd} --schemas=${Schemas}"
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
# "users": ["oleg"],
|
||||
# "type": "cloud",
|
||||
# "ssh_port": 7822,
|
||||
# # "to_check": "No"
|
||||
# "to_check": "false"
|
||||
# "timeout_sec": 5
|
||||
# },
|
||||
|
||||
RootDir="${HOME}/prod"
|
||||
# RootDir=/home/oleg/develop/cvtt2 ###### D E B U G
|
||||
|
||||
AlertChannel=Alerts-CVTT
|
||||
Sender=${RootDir}/ops/utils/send_mmost.sh
|
||||
@@ -46,6 +46,8 @@ function host_alert() {
|
||||
User=oleg
|
||||
Hosts=()
|
||||
DEFAULT_SSH_PORT=22
|
||||
DEFAULT_TIMEOUT=5
|
||||
DEFAULT_TO_CHECK="true"
|
||||
Domains=("${Domains[@]}" "$(get_domains)")
|
||||
|
||||
for Domain in ${Domains[@]} ; do
|
||||
@@ -56,16 +58,21 @@ for Host in ${Hosts[@]} ; do
|
||||
host=$(echo $Host | cut -d'.' -f1)
|
||||
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"'')
|
||||
|
||||
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
|
||||
if ! nc -z -w5 "$Host" "$PortSSH"; then
|
||||
if ! nc -z -w ${Timeout} "$Host" "$PortSSH"; then
|
||||
echo "Host $Host is not available on port $PortSSH"
|
||||
host_alert "Host $Host is not available on port $PortSSH"
|
||||
fi
|
||||
|
||||
@@ -4,7 +4,7 @@ Start=${1}
|
||||
NumJobs=${2}
|
||||
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() {
|
||||
dt=${1}
|
||||
@@ -46,7 +46,7 @@ echo "Start=${Start} End=${End} NumJobs=${NumJobs}"
|
||||
|
||||
export PYTHONPATH=/home/cvtt/prod
|
||||
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 OutputDir=/home/cvtt/prod/archive/md_archive/equity/alpaca_md # Local
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
is_business_day() {
|
||||
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')
|
||||
if [ -n "${open_time}" ]; then
|
||||
return 0
|
||||
|
||||
@@ -4,7 +4,7 @@ export PYTHONPATH=/home/cvtt/prod
|
||||
|
||||
Cmd="/home/cvtt/.pyenv/python3.12-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} --config=http://cloud23.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"
|
||||
|
||||
Reference in New Issue
Block a user