Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 31aca36fe7 | |||
| 92538f0819 | |||
| 1cfac2b32d |
+1
-1
@@ -1 +1 @@
|
||||
1.9.2,prepare_crypto_simdata
|
||||
1.9.2.F3,fix: prepare eqt simdata script
|
||||
|
||||
@@ -152,7 +152,7 @@ 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 tstmp,
|
||||
datetime(exchange_ts_ns / 1000000000, 'unixepoch') || '.' || printf('%06d', (exchange_ts_ns % 1000000000) / 1000) as tstamp,
|
||||
time as tstamp_ns,
|
||||
exchange_id,
|
||||
instrument_id,
|
||||
@@ -168,7 +168,7 @@ COMMIT;
|
||||
BEGIN;
|
||||
INSERT OR IGNORE INTO md_trades
|
||||
SELECT
|
||||
datetime(exchange_ts_ns / 1000000000, 'unixepoch') || '.' || printf('%06d', (exchange_ts_ns % 1000000000) / 1000) as tstmp,
|
||||
datetime(exchange_ts_ns / 1000000000, 'unixepoch') || '.' || printf('%06d', (exchange_ts_ns % 1000000000) / 1000) as tstamp,
|
||||
time as tstamp_ns,
|
||||
exchange_id,
|
||||
instrument_id,
|
||||
@@ -189,7 +189,7 @@ 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 tstmp,
|
||||
datetime(exchange_ts_ns / 1000000000, 'unixepoch') || '.' || printf('%06d', (exchange_ts_ns % 1000000000) / 1000) as tstamp,
|
||||
time as tstamp_ns,
|
||||
exchange_id,
|
||||
instrument_id,
|
||||
|
||||
@@ -163,13 +163,12 @@ EOF
|
||||
for sym in ${Symbols[@]}; do
|
||||
src_hbar_db=${OutputDir}/${Date}.${sym}.alpaca_1m_bars.db
|
||||
src_qat_db=${OutputDir}/${Date}.${sym}.alpaca_qat.db
|
||||
for srcdb in ${src_hbar_db} ${src_qat_db} ; do
|
||||
|
||||
echo "Loading md_trades from ${srcdb} ..."
|
||||
echo "Loading md_trades and md_quotes from ${src_qat_db} ..."
|
||||
sqlite3 ${ResultDbFile} <<EOF
|
||||
ATTACH '${srcdb}' AS source_db;
|
||||
ATTACH '${src_qat_db}' AS source_db;
|
||||
BEGIN;
|
||||
INSERT INTO md_trades SELECT
|
||||
INSERT OR IGNORE INTO md_trades SELECT
|
||||
tstamp,
|
||||
tstamp_ns,
|
||||
exchange_id,
|
||||
@@ -184,7 +183,7 @@ FROM source_db.md_trades;
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO md_quotes SELECT
|
||||
INSERT OR IGNORE INTO md_quotes SELECT
|
||||
tstamp,
|
||||
tstamp_ns,
|
||||
exchange_id,
|
||||
@@ -197,9 +196,13 @@ INSERT INTO md_quotes SELECT
|
||||
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 INTO md_1min_bars SELECT
|
||||
INSERT OR IGNORE INTO md_1min_bars SELECT
|
||||
tstamp,
|
||||
tstamp_ns,
|
||||
exchange_id,
|
||||
@@ -217,13 +220,10 @@ COMMIT;
|
||||
DETACH source_db;
|
||||
EOF
|
||||
|
||||
Cmd="rm ${srcdb}"
|
||||
Cmd="rm ${src_hbar_db} ${src_qat_db}"
|
||||
echo ${Cmd}
|
||||
eval ${Cmd}
|
||||
done
|
||||
done
|
||||
|
||||
exit
|
||||
|
||||
Cmd="gzip ${ResultDbFile}"
|
||||
echo ${Cmd}
|
||||
|
||||
Reference in New Issue
Block a user