progress
This commit is contained in:
parent
c2508740f8
commit
d2e5515ec8
7
trading/risk_mgr/.creds
Normal file
7
trading/risk_mgr/.creds
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"__dummy__": null
|
||||||
|
, "ALPACA_SANDBOX": {
|
||||||
|
"api_key": "PKLZSLFZMFMN1R28K9HK"
|
||||||
|
, "secret_key": "SKbxwLWJNs4kpn618DgGaopN6x1xzKwLM4Z7aymA"
|
||||||
|
}
|
||||||
|
}
|
||||||
23
trading/risk_mgr/Dockerfile
Normal file
23
trading/risk_mgr/Dockerfile
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
FROM python:3.10-slim
|
||||||
|
|
||||||
|
ARG FROM_DIR=docker_dev/market_data/md_portal
|
||||||
|
|
||||||
|
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 ${FROM_DIR}/.creds /.creds
|
||||||
|
|
||||||
|
|
||||||
|
COPY ${FROM_DIR}/run_md_portal.sh /run_md_portal.sh
|
||||||
|
RUN chmod +x /run_md_portal.sh
|
||||||
|
|
||||||
|
RUN mkdir /logs
|
||||||
|
|
||||||
|
|
||||||
|
WORKDIR /
|
||||||
|
SHELL ["/bin/bash", "-c"]
|
||||||
|
ENV PYTHONPATH=/
|
||||||
|
ENTRYPOINT [ "/run_md_portal.sh" ]
|
||||||
|
|
||||||
7
trading/risk_mgr/requirements.txt
Normal file
7
trading/risk_mgr/requirements.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
aiohttp>=3.7.4.post0
|
||||||
|
nest-asyncio>=1.5.5
|
||||||
|
hjson>=3.1.0
|
||||||
|
sortedcontainers>=2.4.0
|
||||||
|
aioredis>=2.0.1
|
||||||
|
python-dateutil>=2.8.2
|
||||||
|
types-python-dateutil>=2.8.19.6
|
||||||
81
trading/risk_mgr/run_risk_mgr.sh
Executable file
81
trading/risk_mgr/run_risk_mgr.sh
Executable file
@ -0,0 +1,81 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# runs in container
|
||||||
|
|
||||||
|
# [program:risk_manager_alpaca]
|
||||||
|
# directory=/home/cvtt/prod
|
||||||
|
# command=/home/cvtt/.pyenv/python3.10-venv/bin/python3
|
||||||
|
# -u /home/cvtt/prod/cvttpy/apps/risk_manager_app.py
|
||||||
|
# --config=http://cloud16.cvtt.vpn:6789/apps/cvtt_eqt_alpaca
|
||||||
|
# --active_exchanges=ALPACA_SNDBX-MDPORTAL
|
||||||
|
# --book=ALPACA_BK02
|
||||||
|
# # --redis_settings=cvtt-prod-02
|
||||||
|
# --dynamic_instruments=ALPACA_SNDBX
|
||||||
|
# --admin_port=7223
|
||||||
|
# --log_level=INFO
|
||||||
|
# --log_file=/home/cvtt/prod/logs/%%T.RISK_MGR_APP.log
|
||||||
|
# # --debug_mode
|
||||||
|
# autostart=true
|
||||||
|
# autorestart=true
|
||||||
|
# startretries=1
|
||||||
|
# startsecs=3
|
||||||
|
# priority=2
|
||||||
|
|
||||||
|
|
||||||
|
# runs on host to start container
|
||||||
|
usage() {
|
||||||
|
echo -n "Usage: $0 -c <config_server (dflt: cloud23.cvtt.vpn:6789)>"
|
||||||
|
echo -n " -e <active_exchanges (ALPACA_SNDBX-MDPORTAL)>"
|
||||||
|
echo -n " -a <admin_port (7223)>"
|
||||||
|
echo -n " -b <book>"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ConfigServer=cloud16.cvtt.vpn
|
||||||
|
ConfigServer=cloud23.cvtt.vpn:6789
|
||||||
|
ActiveExchanges=ALPACA_SNDBX-MDPORTAL
|
||||||
|
PortalName=MD_PORTAL_ALPACA
|
||||||
|
AdminPort=7223
|
||||||
|
|
||||||
|
|
||||||
|
while getopts ":c:e:a:n:" opt; do
|
||||||
|
case ${opt} in
|
||||||
|
c )
|
||||||
|
ConfigServer=$OPTARG
|
||||||
|
;;
|
||||||
|
e )
|
||||||
|
ActiveExchanges=$OPTARG
|
||||||
|
;;
|
||||||
|
a )
|
||||||
|
AdminPort=$OPTARG
|
||||||
|
;;
|
||||||
|
n )
|
||||||
|
PortalName=$OPTARG
|
||||||
|
;;
|
||||||
|
\? )
|
||||||
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
: )
|
||||||
|
echo "Option -$OPTARG requires an argument." >&2
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
Cmd="python3.10"
|
||||||
|
Cmd="${Cmd} cvttpy/apps/md/md_portal.py"
|
||||||
|
Cmd="${Cmd} --config=http://${ConfigServer}/apps/cvtt_eqt_alpaca"
|
||||||
|
Cmd="${Cmd} --credentials_file=/.creds"
|
||||||
|
Cmd="${Cmd} --active_exchanges=${ActiveExchanges}"
|
||||||
|
Cmd="${Cmd} --admin_port=${AdminPort}"
|
||||||
|
Cmd="${Cmd} --log_file=/logs/%T.${PortalName}.log"
|
||||||
|
# Cmd="${Cmd} --compress_log"
|
||||||
|
echo ${Cmd}
|
||||||
|
eval ${Cmd}
|
||||||
|
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user