diff --git a/release_version.txt b/release_version.txt index e0ea44c..bf21f52 100644 --- a/release_version.txt +++ b/release_version.txt @@ -1 +1 @@ -0.6.5 \ No newline at end of file +0.6.6 \ No newline at end of file diff --git a/scripts/alpaca_hist_md/alpaca_assets.sh b/scripts/alpaca_hist_md/alpaca_assets.sh new file mode 100755 index 0000000..f51054e --- /dev/null +++ b/scripts/alpaca_hist_md/alpaca_assets.sh @@ -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 diff --git a/scripts/alpaca_hist_md/alpaca_md.sh b/scripts/alpaca_hist_md/alpaca_md.sh index 45fba16..65c6884 100755 --- a/scripts/alpaca_hist_md/alpaca_md.sh +++ b/scripts/alpaca_hist_md/alpaca_md.sh @@ -4,6 +4,8 @@ Start=${1} End=${2} NumJobs=${3} +InstListFile= ${4} + export CalendarURL=http://cloud16.cvtt.vpn:8000/api/v1/markets/hours?mic=XNYS is_business_day() { @@ -39,12 +41,12 @@ fi 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 -export OutputDir=/home/cvtt/alpaca_md +# export OutputDir=/home/cvtt/alpaca_md +export OutputDir=/home/cvtt/host_drive/alpaca_md export Config=http://cloud16.cvtt.vpn:6789/apps/minimal_md export LogDir=/home/cvtt/prod/logs/alpaca_md @@ -56,7 +58,6 @@ run_proc() { End=${3} echo "Running for $Inst" - Cmd="${Python} ${PyScript}" Cmd="${Cmd} --config=${Config}" Cmd="${Cmd} --output_dir=${OutputDir}" @@ -72,16 +73,21 @@ run_proc() { export -f run_proc -key=$(jq -r '.["ALPACA_SANDBOX"] | .api_key' ~/.creds) -secret=$(jq -r '.["ALPACA_SANDBOX"] | .secret_key' ~/.creds) +if [ -n $InstListFile ]; then -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'" -Cmd="${Cmd} | jq '.[] | select(.class == \"us_equity\" and .exchange != \"OTC\") | .symbol'" -Cmd="${Cmd} | sed 's/\"//g'" -Cmd="${Cmd} | sed 's/^/STOCK-/'" + key=$(jq -r '.["ALPACA_SANDBOX"] | .api_key' ~/.creds) + secret=$(jq -r '.["ALPACA_SANDBOX"] | .secret_key' ~/.creds) + + 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'" + 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 Instruments=()