progress
This commit is contained in:
parent
ffd0ba5469
commit
a5ecf4550c
7
microservices/.creds
Normal file
7
microservices/.creds
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"__dummy__": null
|
||||||
|
, "ALPACA_SANDBOX": {
|
||||||
|
"api_key": "PKLZSLFZMFMN1R28K9HK"
|
||||||
|
, "secret_key": "SKbxwLWJNs4kpn618DgGaopN6x1xzKwLM4Z7aymA"
|
||||||
|
}
|
||||||
|
}
|
||||||
60
microservices/docker-compose.yml
Normal file
60
microservices/docker-compose.yml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
version: "3.9"
|
||||||
|
|
||||||
|
services:
|
||||||
|
md_gateway:
|
||||||
|
image: md_gateway:latest
|
||||||
|
container_name: md_gateway
|
||||||
|
environment:
|
||||||
|
- REDIS_HOST=redis
|
||||||
|
volumes:
|
||||||
|
- ./config:/shared/config
|
||||||
|
- ./logs:/shared/logs
|
||||||
|
depends_on:
|
||||||
|
- redis
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:latest
|
||||||
|
container_name: redis
|
||||||
|
ports:
|
||||||
|
- "6379:6379"
|
||||||
|
volumes:
|
||||||
|
- redis_data:/data
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
redis_data:
|
||||||
|
# version: "3.9"
|
||||||
|
|
||||||
|
# services:
|
||||||
|
# redis:
|
||||||
|
# image: redis:latest
|
||||||
|
# container_name: redis
|
||||||
|
# ports:
|
||||||
|
# - "6379:6379"
|
||||||
|
# volumes:
|
||||||
|
# - redis_data:/data
|
||||||
|
|
||||||
|
# market_data_gateway:
|
||||||
|
# image: your_market_data_gateway_image:latest
|
||||||
|
# container_name: market_data_gateway
|
||||||
|
# environment:
|
||||||
|
# - REDIS_HOST=redis
|
||||||
|
# volumes:
|
||||||
|
# - ./config:/shared/config
|
||||||
|
# - ./logs:/shared/logs
|
||||||
|
# depends_on:
|
||||||
|
# - redis
|
||||||
|
|
||||||
|
# test_program:
|
||||||
|
# image: your_test_program_image:latest
|
||||||
|
# container_name: test_program
|
||||||
|
# environment:
|
||||||
|
# - REDIS_HOST=redis
|
||||||
|
# volumes:
|
||||||
|
# - ./config:/shared/config
|
||||||
|
# - ./logs:/shared/logs
|
||||||
|
# depends_on:
|
||||||
|
# - market_data_gateway
|
||||||
|
# - redis
|
||||||
|
|
||||||
|
# volumes:
|
||||||
|
# redis_data:
|
||||||
3
microservices/md_gateway/.dockerignore
Normal file
3
microservices/md_gateway/.dockerignore
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.git
|
||||||
|
**/__pycache__
|
||||||
|
.pipenv
|
||||||
25
microservices/md_gateway/Dockerfile
Normal file
25
microservices/md_gateway/Dockerfile
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
FROM python:3.12-slim
|
||||||
|
|
||||||
|
ARG ROOT_MCRSVC_DIR=docker_dev/microservices
|
||||||
|
ARG FROM_DIR=${ROOT_MCRSVC_DIR}/md_gateway
|
||||||
|
|
||||||
|
COPY ${ROOT_MCRSVC_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_MCRSVC_DIR}/.creds /.creds
|
||||||
|
|
||||||
|
|
||||||
|
COPY ${FROM_DIR}/run_mdgw.sh /run_mdgw.sh
|
||||||
|
RUN chmod +x /run_mdgw.sh
|
||||||
|
|
||||||
|
RUN mkdir /logs
|
||||||
|
RUN mkdir -p /config
|
||||||
|
|
||||||
|
|
||||||
|
WORKDIR /
|
||||||
|
SHELL ["/bin/bash", "-c"]
|
||||||
|
ENV PYTHONPATH=/
|
||||||
|
ENTRYPOINT [ "/run_mdgw.sh" ]
|
||||||
|
|
||||||
56
microservices/md_gateway/run_mdgw.sh
Executable file
56
microservices/md_gateway/run_mdgw.sh
Executable file
@ -0,0 +1,56 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# runs in container
|
||||||
|
|
||||||
|
# runs on host to start container
|
||||||
|
usage() {
|
||||||
|
echo -n "Usage: ${0}"
|
||||||
|
echo -n " [-c <config (dflt: http://cloud23.cvtt.vpn:6789/apps/cvtt_eqt_alpaca)>]"
|
||||||
|
echo -n " [-e <active_exchanges (ALPACA_SNBOX)>]"
|
||||||
|
echo -n " [-a <admin_port (7220)>]"
|
||||||
|
echo -n " [-n <portal_name (MD_PORTAL_ALPACA)>]"
|
||||||
|
echo -n " [-z (compress log)"]
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Config=/config/cvtt.cfg
|
||||||
|
ActiveExchanges=ALPACA_SNDBX
|
||||||
|
PortalName=MD_PORTAL_ALPACA_SNDBX
|
||||||
|
AdminPort=7220
|
||||||
|
COMPRESS_LOG=false
|
||||||
|
|
||||||
|
|
||||||
|
while getopts "c:e:a:n:z" opt; do
|
||||||
|
case ${opt} in
|
||||||
|
c ) Config=$OPTARG ;;
|
||||||
|
e ) ActiveExchanges=$OPTARG ;;
|
||||||
|
a ) AdminPort=$OPTARG ;;
|
||||||
|
z ) COMPRESS_LOG=true ;;
|
||||||
|
n ) PortalName=$OPTARG ;;
|
||||||
|
\? )
|
||||||
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
: )
|
||||||
|
echo "Option -$OPTARG requires an argument." >&2
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
Cmd="python3.12"
|
||||||
|
Cmd="${Cmd} cvttpy/apps/microservices/mkt_data_gateway/md_gateway.py"
|
||||||
|
Cmd="${Cmd} --config=${Config}"
|
||||||
|
Cmd="${Cmd} --credentials_file=/.creds"
|
||||||
|
Cmd="${Cmd} --active_exchanges=${ActiveExchanges}"
|
||||||
|
Cmd="${Cmd} --portal_name=${PortalName}"
|
||||||
|
Cmd="${Cmd} --admin_port=${AdminPort}"
|
||||||
|
Cmd="${Cmd} --log_file=/logs/%T.${PortalName}.log"
|
||||||
|
if ${COMPRESS_LOG}; then
|
||||||
|
Cmd="${Cmd} --compress_log"
|
||||||
|
fi
|
||||||
|
echo ${Cmd}
|
||||||
|
eval ${Cmd}
|
||||||
|
|
||||||
|
|
||||||
7
microservices/requirements.txt
Normal file
7
microservices/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
|
||||||
|
redis>=5.0.8
|
||||||
|
python-dateutil>=2.8.2
|
||||||
|
types-python-dateutil>=2.8.19.6
|
||||||
Loading…
x
Reference in New Issue
Block a user