using pbzip2 for parallelity and make the frontend compatible with old TDA and new Schwab symbol names for options (different separator)

This commit is contained in:
2024-05-31 09:17:53 -05:00
parent 723f976d50
commit ba4df998fb
3 changed files with 37 additions and 1 deletions

2
.gitignore vendored
View File

@@ -110,3 +110,5 @@ dist
server/quoteDBs/consolidated.sqlite3 server/quoteDBs/consolidated.sqlite3
server/quoteDBs/processedDBs server/quoteDBs/processedDBs
server/quoteDBs/*.7z server/quoteDBs/*.7z
server/quoteDBs/lastRun.stamp

View File

@@ -81,7 +81,7 @@ let createOrderFrame=()=>{
} }
let splitOptionDetails=(input)=>{ let splitOptionDetails=(input)=>{
let symbolRest=input.split("_"); let symbolRest=input.split(/ +|_/);
let symbol=symbolRest[0]; let symbol=symbolRest[0];
let putCall=(symbolRest[1].indexOf("P")>-1)?"P":"C"; let putCall=(symbolRest[1].indexOf("P")>-1)?"P":"C";

View File

@@ -0,0 +1,34 @@
#!/bin/bash
while /bin/true; do
(set -e
find /home/schwab/OptionRecorderSchwab/data/ -type f -cnewer lastRun.stamp | grep -v -e '\..TM\.' | sort | while read singleFile; do
echo Processing ${singleFile} | tee | systemd-cat -t "`basename $0`" -p info
symbol=$(pbzip2 -dc "${singleFile}" | jq -r '.symbol' | tr -d '$')
timeStamp=$(basename "${singleFile}" | cut -c 1-19 | tr '_' ":")
insertSQL=$(cat <<EOF
insert into OptionQuotes (
TimeStamp,
Symbol,
Data
) select
datetime('${timeStamp}','utc'),
'${symbol}',
'$(pbzip2 -dc "${singleFile}")'
where not exists (select 1
from OptionQuotes
where TimeStamp=datetime('${timeStamp}','utc')
and Symbol='${symbol}'
);
EOF
)
echo $insertSQL | sqlite3 consolidated.sqlite3
touch -r "${singleFile}" lastRun.stamp
done) 2>&1 | systemd-cat -t "`basename $0`" -p debug
set +e
echo filling symbols table | tee | systemd-cat -t "`basename $0`" -p info
sqlite3 consolidated.sqlite3 'insert INTO Symbols select DISTINCT Symbol from OptionQuotes where OptionQuotes.Symbol not in (select Symbol from Symbols);'
inotifywait -e create -r /home/schwab/OptionRecorderSchwab/data/ | tee | systemd-cat -t "`basename $0`" -p info
sleep 200 # wait 200 seconds - this should be enough time for all files to finish writing...
done