This commit is contained in:
Oleg Sheynin 2024-08-22 18:30:09 -04:00
parent 8e6f3327e5
commit 6e08bf1cc1
3 changed files with 97 additions and 25 deletions

View File

@ -1,36 +1,24 @@
FROM python:3.10-slim FROM python:3.10-slim
WORKDIR /
COPY docker_dev/quant/requirements.txt /
RUN pip install --upgrade pip ARG FROM_DIR=docker_dev/trading/quant
RUN pip install -r /requirements.txt
RUN apt-get update && apt-get install -y \
apt-utils \
libpq-dev \
build-essential
COPY ${FROM_DIR}/requirements.txt /
RUN pip install --upgrade pip --root-user-action=ignore
RUN pip install -r /requirements.txt --root-user-action=ignore
COPY cvttpy /cvttpy COPY cvttpy /cvttpy
COPY docker_dev/quant/.creds /.creds COPY ${FROM_DIR}/.creds /.creds
COPY ${FROM_DIR}/run_quant.sh /run_quant.sh
RUN chmod +x /run_quant.sh
RUN mkdir /logs RUN mkdir /logs
WORKDIR /
SHELL ["/bin/bash", "-c"]
ENV PYTHONPATH=/ ENV PYTHONPATH=/
ENTRYPOINT [ "/run_quant.sh" ]
# default config
ENV CONFIG=http://cloud16.cvtt.vpn:6789/apps/cvtt
ENV BOOK_ID=CVTT_CLD17_BK01
CMD [ \
"python3.10", \
"cvttpy/apps/quant_app.py", \
"--config=http://cloud16.cvtt.vpn:6789/apps/cvtt", \
"--credentials_file=/.creds", \
"--active_exchanges=COINBASE_AT", \
"--instruments=COINBASE:PAIR-BTC-USD", \
"--book=CVTT_CLD17_BK01", \
"--admin_port=7221", \
"--log_file=/logs/%T.QUANT.log" \
]

84
trading/quant/run_quant.sh Executable file
View File

@ -0,0 +1,84 @@
#!/bin/bash
# runs in container
#command=/home/cvtt/.pyenv/python3.10-venv/bin/python3
# -u /home/cvtt/prod/cvttpy/apps/quant_app.py
# --config=http://cloud16.cvtt.vpn:6789/apps/cvtt_eqt_alpaca
# --active_exchanges=ALPACA_SNDBX-MDPORTAL
# --book=ALPACA_BK02
# --strategy=DAILY_STOCK_001
# --dynamic_instruments=ALPACA_SNDBX
# --admin_port=7224
# --log_level=INFO
# --log_file=/home/cvtt/prod/logs/%%T.QUANT_APP.log
# # --debug_mode
# runs on host to start container
usage() {
echo -n "Usage: $0"
echo -n " -b <book>"
echo -n " -S <strategy> (dflt: TRDALGO_001)"
echo -n " [-c <config_server (dflt: cloud23.cvtt.vpn:6789)>]"
echo -n " [-e <active_exchanges (ALPACA_SNDBX-MDPORTAL)>]"
echo -n " [-a <admin_port (7224)>"]
echo
exit 1
}
ConfigServer=cloud23.cvtt.vpn:6789
ActiveExchanges=ALPACA_SNDBX-MDPORTAL
AdminPort=7224
Strategy=DAILY_STOCK_001
Book=""
while getopts ":b:c:e:a:S:" opt; do
case ${opt} in
c )
ConfigServer=$OPTARG
;;
e )
ActiveExchanges=$OPTARG
;;
a )
AdminPort=$OPTARG
;;
b )
Book=$OPTARG
;;
S )
Strategy=$OPTARG
;;
\? )
echo "Invalid option: -$OPTARG" >&2
usage
;;
: )
echo "Option -$OPTARG requires an argument." >&2
usage
;;
esac
done
if [ "${Book}" == "" ]; then
echo "Book is missing"
usage
fi
Cmd="python3.10"
Cmd="${Cmd} cvttpy/apps/quant_app.py"
Cmd="${Cmd} --config=http://${ConfigServer}/apps/cvtt_eqt_alpaca"
Cmd="${Cmd} --credentials_file=/.creds"
Cmd="${Cmd} --book=${Book}"
Cmd="${Cmd} --strategy=${Strategy}"
Cmd="${Cmd} --allow_dynamic_exch_inst"
Cmd="${Cmd} --active_exchanges=${ActiveExchanges}"
Cmd="${Cmd} --admin_port=${AdminPort}"
Cmd="${Cmd} --log_file=/logs/%T.QUANT.${Book}.log"
Cmd="${Cmd} --compress_log"
echo ${Cmd}
eval ${Cmd}

View File

@ -40,7 +40,7 @@ Algo=TRDALGO_001
Book="" Book=""
while getopts ":b:c:e:a:" opt; do while getopts ":b:c:e:a:A:" opt; do
case ${opt} in case ${opt} in
c ) c )
ConfigServer=$OPTARG ConfigServer=$OPTARG