Files
quant-trader-service/README.md
T

73 lines
1.9 KiB
Markdown
Raw Normal View History

2026-06-23 22:09:06 +08:00
# quant-trader-service
2026-06-26 22:07:43 +08:00
Trader V4 P0 decision service.
2026-06-23 22:09:06 +08:00
## Scope
2026-06-26 22:07:43 +08:00
The service follows the V4 Trader documents under `/Users/zach/Desktop/app/trader`.
P0 only allows `REPLAY_SIM` and `SHADOW`; `PAPER`, `REAL`, real fills, and old
strategy-service contracts are rejected.
2026-06-23 22:09:06 +08:00
2026-06-26 22:07:43 +08:00
## Implemented Surface
2026-06-23 22:09:06 +08:00
2026-06-26 22:07:43 +08:00
- Spring Boot service under `com.quantai.trader`
- strict P0 runtime guard for run mode, execution mode, and trading switch
- JSON artifact loader for model bundle manifest, PM config manifest, and model output policy
- five-model output contract: Direction, Entry, Continue, Exit, Risk
- dynamic PM sizing with side-aware stop/target price calculation
- Risk Gate for hard blockers and forced close decisions
- JDBC persistence for run, cycle, model output, PM decision, risk decision, action, evidence, and outbox
- Flyway V1 schema for the V4 P0 tables
- health, replay-cycle, and feedback endpoints
- JaCoCo line coverage gate at 90%
2026-06-23 22:09:06 +08:00
2026-06-26 22:07:43 +08:00
## Local Database
2026-06-23 22:09:06 +08:00
2026-06-26 22:07:43 +08:00
Default configuration:
2026-06-23 22:09:06 +08:00
2026-06-26 22:07:43 +08:00
```text
jdbc:mysql://127.0.0.1:3306/quant_trader
username: quant_trader
password: quant_trader
```
2026-06-23 22:09:06 +08:00
2026-06-26 22:07:43 +08:00
Override with `TRADER_DB_URL`, `TRADER_DB_USERNAME`, and `TRADER_DB_PASSWORD`.
2026-06-23 22:09:06 +08:00
2026-06-26 22:07:43 +08:00
## Artifact Root
Default artifact root:
```text
/Users/zach/Desktop/quant-strategy-training-data/trader-v4/artifact_bundle
2026-06-23 22:09:06 +08:00
```
2026-06-26 22:07:43 +08:00
Required files:
2026-06-23 22:09:06 +08:00
2026-06-26 22:07:43 +08:00
```text
manifests/model_bundle_manifest.json
manifests/position_manager_manifest.json
model_output_policy.json
```
The loader requires the configured model/calibration/PM version triple to match
the manifests, all five model families to be present, and the model/PM manifests
to be `ACTIVE`.
## Commands
```bash
mvn clean test
TRADER_DB_USERNAME=quant_trader TRADER_DB_PASSWORD=quant_trader SERVER_PORT=18080 mvn spring-boot:run
```
2026-06-23 22:09:06 +08:00
## HTTP
```text
GET /api/trader/health
2026-06-26 22:07:43 +08:00
POST /api/trader/replay/cycles
2026-06-23 22:09:06 +08:00
POST /api/trader/feedback
```
2026-06-26 22:07:43 +08:00
`/api/trader/feedback` is disabled by default in P0 and still rejects
`PAPER_APP`, `REAL_APP`, and any real fill when explicitly enabled for tests.