progress
This commit is contained in:
parent
fce17db6ec
commit
88308ea13e
55
scripts/crypto_hist_md/process_daily_md.sh
Executable file
55
scripts/crypto_hist_md/process_daily_md.sh
Executable file
@ -0,0 +1,55 @@
|
||||
#!/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=/tmp # URGENT change to /opt/jupyter_gpu/data
|
||||
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
|
||||
ls -lh ${TargetFilePath}
|
||||
|
||||
|
||||
}
|
||||
download_file
|
||||
Loading…
x
Reference in New Issue
Block a user