Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8607db6506 | |||
| 465d4c746e | |||
| 70c7769fd6 |
+1
-1
@@ -1 +1 @@
|
|||||||
0.6.4
|
0.6.7
|
||||||
Executable
+28
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
CredsFile=${1}
|
||||||
|
CredKey=${2}
|
||||||
|
|
||||||
|
if [ "${CredsFile}" == "" ] ; then
|
||||||
|
CredsFile="${HOME}/.creds"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${CredKey}" == "" ] ; then
|
||||||
|
CredKey="ALPACA_SANDBOX"
|
||||||
|
fi
|
||||||
|
|
||||||
|
key=$(jq -r ".[\"${CredKey}\"] | .api_key" ${CredsFile})
|
||||||
|
secret=$(jq -r ".[\"${CredKey}\"] | .secret_key" ${CredsFile})
|
||||||
|
|
||||||
|
Cmd="curl -s --request GET --url 'https://paper-api.alpaca.markets/v2/assets?status=active'"
|
||||||
|
Cmd="${Cmd} --header 'APCA-API-KEY-ID: ${key}'"
|
||||||
|
Cmd="${Cmd} --header 'APCA-API-SECRET-KEY: ${secret}'"
|
||||||
|
Cmd="${Cmd} --header 'accept: application/json'"
|
||||||
|
|
||||||
|
eval ${Cmd}
|
||||||
|
|
||||||
|
# split string into array
|
||||||
|
Instruments=()
|
||||||
|
for Inst in $(eval ${Cmd})
|
||||||
|
do
|
||||||
|
Instruments+=("$Inst")
|
||||||
|
done
|
||||||
@@ -1,6 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
CalendarURL=http://cloud16.cvtt.vpn:8000/api/v1/markets/hours?mic=XNYS
|
Start=${1}
|
||||||
|
End=${2}
|
||||||
|
NumJobs=${3}
|
||||||
|
InstListFile=${4}
|
||||||
|
|
||||||
|
export CalendarURL=http://cloud16.cvtt.vpn:8000/api/v1/markets/hours?mic=XNYS
|
||||||
|
|
||||||
is_business_day() {
|
is_business_day() {
|
||||||
dt=${1}
|
dt=${1}
|
||||||
|
|
||||||
@@ -14,13 +20,9 @@ is_business_day() {
|
|||||||
}
|
}
|
||||||
export -f is_business_day
|
export -f is_business_day
|
||||||
|
|
||||||
Start=${1}
|
|
||||||
End=${2}
|
|
||||||
NumJobs=${3}
|
|
||||||
|
|
||||||
if [ "${Start}" == "" ] ; then
|
if [ "${Start}" == "" ] ; then
|
||||||
echo "Usage: ${0} <start_date> [<end_date>] [<num_jobs> (25)]]"
|
Start=$(date -d "yesterday" "+%Y-%m-%d")
|
||||||
exit
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! is_business_day ${Start}; then
|
if ! is_business_day ${Start}; then
|
||||||
@@ -38,13 +40,16 @@ fi
|
|||||||
|
|
||||||
echo "Start=${Start} End=${End} NumJobs=${NumJobs}"
|
echo "Start=${Start} End=${End} NumJobs=${NumJobs}"
|
||||||
|
|
||||||
|
export PYTHONPATH=/home/cvtt/prod
|
||||||
|
export Python=/home/cvtt/.pyenv/python3.10-venv/bin/python3
|
||||||
|
export PyScript=/home/cvtt/prod/cvttpy/exchanges/alpaca/hist_mkt_data.py
|
||||||
|
|
||||||
Python=/home/cvtt/.pyenv/python3.10-venv/bin/python3
|
# export OutputDir=/home/cvtt/alpaca_md
|
||||||
PyScript=/home/cvtt/prod/cvttpy/exchanges/alpaca/hist_mkt_data.py
|
export OutputDir=/home/cvtt/host_drive/alpaca_md
|
||||||
|
export Config=http://cloud16.cvtt.vpn:6789/apps/minimal_md
|
||||||
OutputDir=/home/cvtt/alpaca_md
|
export LogDir=/home/cvtt/prod/logs/alpaca_md
|
||||||
Config=http://cloud16.cvtt.vpn:6789/apps/minimal_md
|
|
||||||
|
|
||||||
|
mkdir -p ${LogDir}
|
||||||
|
|
||||||
run_proc() {
|
run_proc() {
|
||||||
Inst=${1}
|
Inst=${1}
|
||||||
@@ -52,7 +57,6 @@ run_proc() {
|
|||||||
End=${3}
|
End=${3}
|
||||||
echo "Running for $Inst"
|
echo "Running for $Inst"
|
||||||
|
|
||||||
|
|
||||||
Cmd="${Python} ${PyScript}"
|
Cmd="${Python} ${PyScript}"
|
||||||
Cmd="${Cmd} --config=${Config}"
|
Cmd="${Cmd} --config=${Config}"
|
||||||
Cmd="${Cmd} --output_dir=${OutputDir}"
|
Cmd="${Cmd} --output_dir=${OutputDir}"
|
||||||
@@ -61,24 +65,28 @@ run_proc() {
|
|||||||
if [ "${End}" != "" ]; then
|
if [ "${End}" != "" ]; then
|
||||||
Cmd="${Cmd} --end=${End}"
|
Cmd="${Cmd} --end=${End}"
|
||||||
fi
|
fi
|
||||||
Cmd="${Cmd} --log_file=./logs/${Start}.${Inst}.log"
|
Cmd="${Cmd} --log_file=${LogDir}/${Start}.${Inst}.log"
|
||||||
echo ${Cmd}
|
echo ${Cmd}
|
||||||
eval ${Cmd}
|
eval ${Cmd}
|
||||||
}
|
}
|
||||||
|
|
||||||
export PYTHONPATH=/home/cvtt/prod
|
|
||||||
export -f run_proc
|
export -f run_proc
|
||||||
|
|
||||||
key=$(jq -r '.["ALPACA_SANDBOX"] | .api_key' ~/.creds)
|
if [ -n $InstListFile ]; then
|
||||||
secret=$(jq -r '.["ALPACA_SANDBOX"] | .secret_key' ~/.creds)
|
|
||||||
|
|
||||||
Cmd="curl -s --request GET --url 'https://paper-api.alpaca.markets/v2/assets?status=active'"
|
key=$(jq -r '.["ALPACA_SANDBOX"] | .api_key' ~/.creds)
|
||||||
Cmd="${Cmd} --header 'APCA-API-KEY-ID: ${key}'"
|
secret=$(jq -r '.["ALPACA_SANDBOX"] | .secret_key' ~/.creds)
|
||||||
Cmd="${Cmd} --header 'APCA-API-SECRET-KEY: ${secret}'"
|
|
||||||
Cmd="${Cmd} --header 'accept: application/json'"
|
Cmd="curl -s --request GET --url 'https://paper-api.alpaca.markets/v2/assets?status=active'"
|
||||||
Cmd="${Cmd} | jq '.[] | select(.class == \"us_equity\" and .exchange != \"OTC\") | .symbol'"
|
Cmd="${Cmd} --header 'APCA-API-KEY-ID: ${key}'"
|
||||||
Cmd="${Cmd} | sed 's/\"//g'"
|
Cmd="${Cmd} --header 'APCA-API-SECRET-KEY: ${secret}'"
|
||||||
Cmd="${Cmd} | sed 's/^/STOCK-/'"
|
Cmd="${Cmd} --header 'accept: application/json'"
|
||||||
|
Cmd="${Cmd} | jq '.[] | select(.class == \"us_equity\" and .exchange != \"OTC\") | .symbol'"
|
||||||
|
Cmd="${Cmd} | sed 's/\"//g'"
|
||||||
|
Cmd="${Cmd} | sed 's/^/STOCK-/'"
|
||||||
|
else
|
||||||
|
Cmd="cat ${InstListFile}"
|
||||||
|
fi
|
||||||
|
|
||||||
# split string into array
|
# split string into array
|
||||||
Instruments=()
|
Instruments=()
|
||||||
|
|||||||
Reference in New Issue
Block a user