musvcs progress

This commit is contained in:
Oleg Sheynin 2024-12-13 13:41:37 -05:00
parent a5ecf4550c
commit 3190cf5d4d
6 changed files with 94 additions and 17 deletions

View File

@ -9,6 +9,7 @@ services:
volumes: volumes:
- ./config:/shared/config - ./config:/shared/config
- ./logs:/shared/logs - ./logs:/shared/logs
- ./data:/data
depends_on: depends_on:
- redis - redis
@ -16,9 +17,9 @@ services:
image: redis:latest image: redis:latest
container_name: redis container_name: redis
ports: ports:
- "6379:6379" - "6379:6379"
volumes: volumes:
- redis_data:/data - redis_data:/data/redis
volumes: volumes:
redis_data: redis_data:

View File

@ -5,29 +5,23 @@
# runs on host to start container # runs on host to start container
usage() { usage() {
echo -n "Usage: ${0}" echo -n "Usage: ${0}"
echo -n " [-c <config (dflt: http://cloud23.cvtt.vpn:6789/apps/cvtt_eqt_alpaca)>]" echo -n " [-c <config (/config/cvtt.cfg)>]"
echo -n " [-e <active_exchanges (ALPACA_SNBOX)>]"
echo -n " [-a <admin_port (7220)>]" echo -n " [-a <admin_port (7220)>]"
echo -n " [-n <portal_name (MD_PORTAL_ALPACA)>]"
echo -n " [-z (compress log)"] echo -n " [-z (compress log)"]
echo echo
exit 1 exit 1
} }
Config=/config/cvtt.cfg Config=/config/cvtt.cfg
ActiveExchanges=ALPACA_SNDBX
PortalName=MD_PORTAL_ALPACA_SNDBX
AdminPort=7220 AdminPort=7220
COMPRESS_LOG=false COMPRESS_LOG=false
while getopts "c:e:a:n:z" opt; do while getopts "c:a:z" opt; do
case ${opt} in case ${opt} in
c ) Config=$OPTARG ;; c ) Config=$OPTARG ;;
e ) ActiveExchanges=$OPTARG ;;
a ) AdminPort=$OPTARG ;; a ) AdminPort=$OPTARG ;;
z ) COMPRESS_LOG=true ;; z ) COMPRESS_LOG=true ;;
n ) PortalName=$OPTARG ;;
\? ) \? )
echo "Invalid option: -$OPTARG" >&2 echo "Invalid option: -$OPTARG" >&2
usage usage
@ -43,11 +37,9 @@ Cmd="python3.12"
Cmd="${Cmd} cvttpy/apps/microservices/mkt_data_gateway/md_gateway.py" Cmd="${Cmd} cvttpy/apps/microservices/mkt_data_gateway/md_gateway.py"
Cmd="${Cmd} --config=${Config}" Cmd="${Cmd} --config=${Config}"
Cmd="${Cmd} --credentials_file=/.creds" Cmd="${Cmd} --credentials_file=/.creds"
Cmd="${Cmd} --active_exchanges=${ActiveExchanges}"
Cmd="${Cmd} --portal_name=${PortalName}"
Cmd="${Cmd} --admin_port=${AdminPort}" Cmd="${Cmd} --admin_port=${AdminPort}"
Cmd="${Cmd} --log_file=/logs/%T.${PortalName}.log" Cmd="${Cmd} --log_file=/logs/%T.md_gateway.log"
if ${COMPRESS_LOG}; then if ${COMPRESS_LOG} ; then
Cmd="${Cmd} --compress_log" Cmd="${Cmd} --compress_log"
fi fi
echo ${Cmd} echo ${Cmd}

View File

@ -0,0 +1,3 @@
.git
**/__pycache__
.pipenv

View File

@ -0,0 +1,26 @@
FROM python:3.12-slim
ARG ROOT_MUSVC_DIR=docker_dev/microservices
ARG FROM_DIR=${ROOT_MUSVC_DIR}/tester
COPY ${ROOT_MUSVC_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 ${ROOT_MUSVC_DIR}/.creds /.creds
COPY ${FROM_DIR}/run_tester.sh /run_tester.sh
RUN chmod +x /run_tester.sh
RUN mkdir /logs
RUN mkdir -p /config
RUN mkdir -p /data
WORKDIR /
SHELL ["/bin/bash", "-c"]
ENV PYTHONPATH=/
ENTRYPOINT [ "/run_tester.sh" ]

View File

@ -0,0 +1,55 @@
#!/bin/bash
# runs in container
# runs on host to start container
usage() {
echo -n "Usage: ${0}"
echo -n " [-c <config (/config/cvtt.cfg) >]"
echo -n " [-i <instruments (COINBASE:PAIR-BTC-USD,BNBFUT:PERP-BTC-USDT) >]"
echo -n " [-d <data types (TRADES) >]"
echo -n " [-a <admin_port (7221) >]"
echo -n " [-z (compress log (false))"]
echo
exit 1
}
Config=/config/cvtt.cfg
AdminPort=7221
COMPRESS_LOG=false
Instruments="COINBASE:PAIR-BTC-USD,BNBFUT:PERP-BTC-USDT"
DataTypes="TRADES"
while getopts "a:c:d:i:z" opt; do
case ${opt} in
c ) Config=$OPTARG ;;
a ) AdminPort=$OPTARG ;;
i ) Instruments=$OPTARG ;;
d ) DataTypes=$OPTARG ;;
z ) COMPRESS_LOG=true ;;
\? )
echo "Invalid option: -$OPTARG" >&2
usage
;;
: )
echo "Option -$OPTARG requires an argument." >&2
usage
;;
esac
done
Cmd="python3.12"
Cmd="${Cmd} cvttpy/apps/microservices/tester/musvc_tester.py"
Cmd="${Cmd} --config=${Config}"
Cmd="${Cmd} --credentials_file=/.creds"
Cmd="${Cmd} --admin_port=${AdminPort}"
Cmd="${Cmd} --data_types=${DataTypes}"
Cmd="${Cmd} --instruments=${Instruments}"
Cmd="${Cmd} --log_file=/logs/%T.tester.log"
if ${COMPRESS_LOG} ; then
Cmd="${Cmd} --compress_log"
fi
echo ${Cmd}
eval ${Cmd}

View File

@ -1 +1 @@
0.0.5,16->23 0.0.6,musvcs progress