-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
202 lines (195 loc) · 6.11 KB
/
docker-compose.yml
File metadata and controls
202 lines (195 loc) · 6.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
x-logging: &default-logging
driver: "json-file"
options:
max-size: "50m"
max-file: "5"
x-quant-platform-env: &quant-platform-env
QP__STORAGE__POSTGRES_DSN: postgresql+psycopg://quant:${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set in .env}@postgres:5432/quant_platform
QP__STORAGE__REDIS_URL: redis://redis:6379/0
QP__STORAGE__EVENT_BUS_BACKEND: redis_streams
QP__STORAGE__OBJECT_STORE_ROOT: /app/data/parquet
# Operator console SPA location inside the image (baked by the Dockerfile;
# restated here so it is explicit at the compose layer). See ADR-013.
QP__API__CONSOLE_DIST_DIR: /app/ui/dist
QP__BROKER__HOST: ${QP__DOCKER_BROKER_HOST:-host.docker.internal}
QP__BROKER__PORT: ${QP__DOCKER_BROKER_PORT:-7497}
QP__BROKER__CLIENT_ID: ${QP__BROKER__CLIENT_ID:-985}
QP__BROKER__ACCOUNT_ID: ${QP__BROKER__ACCOUNT_ID:-}
QP__BROKER__PAPER_TRADING: ${QP__BROKER__PAPER_TRADING:-true}
QP__LIVE_IBKR__CONTRACTS_FILE: /app/infra/config/universe_300.json
# Optional secondary/tertiary EOD vendors — pass from host .env or override:
QP__DATA_INGEST__BAR_FETCH_FALLBACK: ${QP__DATA_INGEST__BAR_FETCH_FALLBACK:-none}
QP__DATA_INGEST__TIINGO_API_TOKEN: ${QP__DATA_INGEST__TIINGO_API_TOKEN:-}
QP__DATA_INGEST__POLYGON_API_KEY: ${QP__DATA_INGEST__POLYGON_API_KEY:-}
# Sharadar fundamentals (fundamentals-v1 family). Only read by the
# out-of-band ``scripts/pull_sharadar_sf1.py`` operator script today,
# but threaded through here so a future ingest container can use it
# without a compose edit.
QP__DATA_INGEST__NASDAQ_DATA_LINK_API_KEY: ${QP__DATA_INGEST__NASDAQ_DATA_LINK_API_KEY:-}
# LLM text-event features (off by default; QP__LLM__SHADOW_MODE_ENABLED
# or QP__LLM__LIVE_MODE_ENABLED gates actual extraction). Anthropic
# SDK reads ``ANTHROPIC_API_KEY`` directly from os.environ — pass
# through unprefixed.
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}
DEEPSEEK_API_KEY: ${DEEPSEEK_API_KEY:-}
# V2 account orchestrator (disabled by default; enable for multi-engine live):
QP__V2__ENABLED: ${QP__V2__ENABLED:-false}
QP__V2__ACCOUNT_ORCHESTRATOR_ENABLED: ${QP__V2__ACCOUNT_ORCHESTRATOR_ENABLED:-false}
services:
postgres:
image: postgres:16
environment:
POSTGRES_USER: quant
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set in .env}
POSTGRES_DB: quant_platform
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
logging: *default-logging
deploy:
resources:
limits:
memory: 2g
cpus: "2.0"
reservations:
memory: 256m
healthcheck:
# -d quant_platform: without an explicit DB, pg_isready defaults to a DB
# named after the user (here "quant"), which does not exist and floods the
# postgres log with FATAL lines every 10s. The check still returns success
# because the server responds, but the noise hides real issues.
test: ["CMD-SHELL", "pg_isready -U quant -d quant_platform"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7
ports:
- "6379:6379"
volumes:
- redis_data:/data
command: ["redis-server", "--appendonly", "yes"]
logging: *default-logging
deploy:
resources:
limits:
memory: 512m
cpus: "0.5"
reservations:
memory: 64m
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
quant-platform-api:
build:
context: .
args:
QP_GIT_COMMIT: ${QP_GIT_COMMIT:-unknown}
QP_BUILD_DATE: ${QP_BUILD_DATE:-unknown}
restart: unless-stopped
ports:
- "8000:8000"
env_file:
- path: .env
required: false
environment:
<<: *quant-platform-env
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- quant_data:/app/data
logging: *default-logging
deploy:
resources:
limits:
memory: 1g
cpus: "1.0"
reservations:
memory: 128m
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "if [ -n \"$${QP__API__OPERATOR_API_KEY}\" ]; then curl -sf -H \"X-API-Key: $${QP__API__OPERATOR_API_KEY}\" http://localhost:8000/health/ready; else curl -sf http://localhost:8000/health/ready; fi || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
command: ["python", "-m", "quant_platform", "serve-api", "--host", "0.0.0.0", "--port", "8000"]
quant-platform-maintain:
build: .
restart: unless-stopped
profiles: ["workers"]
env_file:
- path: .env
required: false
environment:
<<: *quant-platform-env
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- quant_data:/app/data
logging: *default-logging
deploy:
resources:
limits:
memory: 512m
cpus: "0.5"
reservations:
memory: 128m
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
command: ["python", "-m", "quant_platform", "maintain", "--interval", "900"]
quant-platform-paper-engine:
build: .
restart: unless-stopped
profiles: ["paper"]
env_file:
- path: .env
required: false
environment:
<<: *quant-platform-env
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- quant_data:/app/data
logging: *default-logging
deploy:
resources:
limits:
memory: 1g
cpus: "1.0"
reservations:
memory: 128m
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
command:
[
"python",
"-m",
"quant_platform",
"supervise",
"--mode",
"paper",
"--execution-backend",
"ib-paper",
"--contracts-file",
"/app/infra/config/universe_300.json",
"--interval",
"300",
]
volumes:
postgres_data:
redis_data:
quant_data: