progress
This commit is contained in:
parent
ed207a3c67
commit
494241ec66
@ -2,29 +2,31 @@
|
|||||||
|
|
||||||
# runs in container
|
# runs in container
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# runs on host to start container
|
# runs on host to start container
|
||||||
usage() {
|
usage() {
|
||||||
echo -n "Usage: $0 -c <config_server (dflt: cloud23.cvtt.vpn:6789)>"
|
echo -n "Usage: ${0}"
|
||||||
echo -n " -e <active_exchanges (ALPACA_SNBOX)>"
|
echo -n " [-C <config (dflt: apps/cvtt_eqt_alpaca)>]"
|
||||||
echo -n " -a <admin_port (7220)>"
|
echo -n " [-c <config_server (dflt: cloud23.cvtt.vpn:6789)>]"
|
||||||
echo -n " -n <portal_name (MD_PORTAL_ALPACA)>"
|
echo -n " [-e <active_exchanges (ALPACA_SNBOX)>]"
|
||||||
|
echo -n " [-a <admin_port (7220)>]"
|
||||||
|
echo -n " [-n <portal_name (MD_PORTAL_ALPACA)>]"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ConfigServer=cloud16.cvtt.vpn
|
# ConfigServer=cloud16.cvtt.vpn
|
||||||
ConfigServer=cloud23.cvtt.vpn:6789
|
ConfigServer=cloud23.cvtt.vpn:6789
|
||||||
|
Config=apps/cvtt_eqt_alpaca
|
||||||
ActiveExchanges=ALPACA_SNDBX
|
ActiveExchanges=ALPACA_SNDBX
|
||||||
PortalName=MD_PORTAL_ALPACA_SNDBX
|
PortalName=MD_PORTAL_ALPACA_SNDBX
|
||||||
AdminPort=7220
|
AdminPort=7220
|
||||||
|
|
||||||
|
|
||||||
while getopts ":c:e:a:n:" opt; do
|
while getopts ":C:c:e:a:n:" opt; do
|
||||||
case ${opt} in
|
case ${opt} in
|
||||||
|
C )
|
||||||
|
Config=$OPTARG
|
||||||
|
;;
|
||||||
c )
|
c )
|
||||||
ConfigServer=$OPTARG
|
ConfigServer=$OPTARG
|
||||||
;;
|
;;
|
||||||
@ -51,7 +53,7 @@ done
|
|||||||
|
|
||||||
Cmd="python3.10"
|
Cmd="python3.10"
|
||||||
Cmd="${Cmd} cvttpy/apps/md/md_portal.py"
|
Cmd="${Cmd} cvttpy/apps/md/md_portal.py"
|
||||||
Cmd="${Cmd} --config=http://${ConfigServer}/apps/md_portal"
|
Cmd="${Cmd} --config=http://${ConfigServer}/${Config}"
|
||||||
Cmd="${Cmd} --credentials_file=/.creds"
|
Cmd="${Cmd} --credentials_file=/.creds"
|
||||||
Cmd="${Cmd} --active_exchanges=${ActiveExchanges}"
|
Cmd="${Cmd} --active_exchanges=${ActiveExchanges}"
|
||||||
Cmd="${Cmd} --portal_name=${PortalName}"
|
Cmd="${Cmd} --portal_name=${PortalName}"
|
||||||
|
|||||||
12
trading/trading_recorder/.creds
Normal file
12
trading/trading_recorder/.creds
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"__dummy__": null
|
||||||
|
, "ALPACA_SANDBOX": {
|
||||||
|
"api_key": "PKLZSLFZMFMN1R28K9HK"
|
||||||
|
, "secret_key": "SKbxwLWJNs4kpn618DgGaopN6x1xzKwLM4Z7aymA"
|
||||||
|
}
|
||||||
|
, "MATTERMOST": {
|
||||||
|
"url": "https://mattermost.cryptovaltrading.com"
|
||||||
|
, "team": "CVTT"
|
||||||
|
, "bearer": "5ysaaxjeijrwjbmhuzcuos9ano"
|
||||||
|
}
|
||||||
|
}
|
||||||
23
trading/trading_recorder/Dockerfile
Normal file
23
trading/trading_recorder/Dockerfile
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
FROM python:3.10-slim
|
||||||
|
|
||||||
|
ARG FROM_DIR=docker_dev/trading/trading_recorder
|
||||||
|
|
||||||
|
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_trading_recorder.sh /run_trading_recorder.sh
|
||||||
|
RUN chmod +x /run_trading_recorder.sh
|
||||||
|
|
||||||
|
RUN mkdir /logs
|
||||||
|
|
||||||
|
|
||||||
|
WORKDIR /
|
||||||
|
SHELL ["/bin/bash", "-c"]
|
||||||
|
ENV PYTHONPATH=/
|
||||||
|
ENTRYPOINT [ "/run_trading_recorder.sh" ]
|
||||||
|
|
||||||
15
trading/trading_recorder/requirements.txt
Normal file
15
trading/trading_recorder/requirements.txt
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
aiohttp>=3.7.4.post0
|
||||||
|
nest-asyncio>=1.5.5
|
||||||
|
hjson>=3.1.0
|
||||||
|
sortedcontainers>=2.4.0
|
||||||
|
pandas>=1.5.3
|
||||||
|
#
|
||||||
|
redis>=5.0.8
|
||||||
|
#
|
||||||
|
python-dateutil>=2.8.2
|
||||||
|
types-python-dateutil>=2.8.19.6
|
||||||
|
#
|
||||||
|
psycopg>=3.2.1
|
||||||
|
psycopg-binary>=3.2.1
|
||||||
|
psycopg2-binary>=2.9.6
|
||||||
|
|
||||||
84
trading/trading_recorder/run_trading_recorder.sh
Executable file
84
trading/trading_recorder/run_trading_recorder.sh
Executable file
@ -0,0 +1,84 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#[program:trading_rec_alpaca]
|
||||||
|
#directory=/home/cvtt/prod
|
||||||
|
#command=/home/cvtt/.pyenv/python3.10-venv/bin/python3
|
||||||
|
# -u /home/cvtt/prod/cvttpy/apps/trade_recorder.py
|
||||||
|
# --config=http://cloud16.cvtt.vpn:6789/apps/cvtt_eqt_alpaca
|
||||||
|
# --active_exchanges=ALPACA_SNDBX-MDPORTAL
|
||||||
|
# --book=ALPACA_BK02
|
||||||
|
# --dynamic_instruments=ALPACA_SNDBX
|
||||||
|
# --admin_port=7225
|
||||||
|
# --log_level=INFO
|
||||||
|
# --log_file=/home/cvtt/prod/logs/%%T.TRADING_REC_APP.log
|
||||||
|
# # --debug_mode
|
||||||
|
#autostart=true
|
||||||
|
#autorestart=true
|
||||||
|
#startretries=1
|
||||||
|
#startsecs=3
|
||||||
|
#priority=2
|
||||||
|
#user=cvtt
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# runs on host to start container
|
||||||
|
usage() {
|
||||||
|
echo -n "Usage: $0"
|
||||||
|
echo -n " -b <book>"
|
||||||
|
echo -n " [-C <config (dflt: apps/cvtt_eqt_alpaca)>]"
|
||||||
|
echo -n " [-c <config_server (dflt: cloud23.cvtt.vpn:6789)>]"
|
||||||
|
echo -n " [-e <active_exchanges (ALPACA_SNDBX-MDPORTAL)>]"
|
||||||
|
echo -n " [-a <admin_port (7223)>"]
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# ConfigServer=cloud16.cvtt.vpn
|
||||||
|
ConfigServer=cloud23.cvtt.vpn:6789
|
||||||
|
ActiveExchanges=ALPACA_SNDBX-MDPORTAL
|
||||||
|
AdminPort=7225
|
||||||
|
Book=""
|
||||||
|
Config=apps/cvtt_eqt_alpaca
|
||||||
|
|
||||||
|
while getopts ":C:b:c:e:a:" opt; do
|
||||||
|
case ${opt} in
|
||||||
|
c )
|
||||||
|
ConfigServer=$OPTARG
|
||||||
|
;;
|
||||||
|
e )
|
||||||
|
ActiveExchanges=$OPTARG
|
||||||
|
;;
|
||||||
|
a )
|
||||||
|
AdminPort=$OPTARG
|
||||||
|
;;
|
||||||
|
b )
|
||||||
|
Book=$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/trader_app.py"
|
||||||
|
Cmd="${Cmd} --config=http://${ConfigServer}/${Config}"
|
||||||
|
Cmd="${Cmd} --credentials_file=/.creds"
|
||||||
|
Cmd="${Cmd} --book=${Book}"
|
||||||
|
Cmd="${Cmd} --allow_dynamic_exch_inst"
|
||||||
|
Cmd="${Cmd} --active_exchanges=${ActiveExchanges}"
|
||||||
|
Cmd="${Cmd} --admin_port=${AdminPort}"
|
||||||
|
Cmd="${Cmd} --log_file=/logs/%T.TRADING_RECORDER.${Book}.log"
|
||||||
|
Cmd="${Cmd} --compress_log"
|
||||||
|
echo ${Cmd}
|
||||||
|
eval ${Cmd}
|
||||||
Loading…
x
Reference in New Issue
Block a user