Add integration tests for execution persistence, metrics, and opportunity writing
CI / lint-test-build (push) Failing after 1m23s
CI / lint-test-build (push) Failing after 1m23s
- Implemented integration tests for the execution writer to ensure trade orders and PnL are persisted correctly. - Created integration tests for the metrics calculator to summarize execution data accurately. - Added integration tests for the opportunity writer to verify event persistence. - Established PostgreSQL schema validation tests to ensure all expected tables, columns, and constraints exist. - Removed outdated unit tests that relied on DuckDB and replaced them with tests using PgStore.
This commit is contained in:
@@ -6,7 +6,7 @@ Current stack:
|
||||
|
||||
- Python 3.12+
|
||||
- FastAPI + HTMX/Jinja2
|
||||
- DuckDB for dev/test/prod
|
||||
- PostgreSQL for all environments (via asyncpg)
|
||||
- Native Kraken WebSocket planned for market-data hot path
|
||||
- Gitea Actions + Gitea container registry
|
||||
|
||||
@@ -22,7 +22,7 @@ Bootstrap complete for foundation layer:
|
||||
- typed settings and env loading
|
||||
- structured logging
|
||||
- encrypted secret helpers
|
||||
- DuckDB connection + base schema
|
||||
- PostgreSQL connection + full schema migration
|
||||
- FastAPI app with health endpoint
|
||||
- Gitea Actions CI scaffold
|
||||
- Docker / docker-compose scaffold
|
||||
@@ -152,7 +152,11 @@ APP_HOST=0.0.0.0
|
||||
APP_PORT=9090
|
||||
LOG_LEVEL=INFO
|
||||
LOG_JSON=true
|
||||
DUCKDB_PATH=./data/arbitrade.duckdb
|
||||
PG_HOST=192.168.88.35
|
||||
PG_PORT=5432
|
||||
PG_DATABASE=arbitrade
|
||||
PG_USER=arbitrade
|
||||
PG_PASSWORD=arbitrade
|
||||
FERNET_KEY=
|
||||
KRAKEN_API_KEY=
|
||||
KRAKEN_API_SECRET=
|
||||
@@ -182,15 +186,19 @@ Health endpoints:
|
||||
|
||||
## Database
|
||||
|
||||
DuckDB used everywhere: local dev, tests, production.
|
||||
PostgreSQL used everywhere: local dev, tests, production.
|
||||
|
||||
Default database file:
|
||||
Default connection:
|
||||
|
||||
```text
|
||||
./data/arbitrade.duckdb
|
||||
PG_HOST=192.168.88.35
|
||||
PG_PORT=5432
|
||||
PG_DATABASE=arbitrade
|
||||
PG_USER=arbitrade
|
||||
PG_PASSWORD=arbitrade
|
||||
```
|
||||
|
||||
Schema bootstrap runs automatically on app startup.
|
||||
Schema bootstrap runs automatically on app startup via `PgStore.migrate()`.
|
||||
|
||||
Current tables:
|
||||
|
||||
@@ -220,7 +228,7 @@ DELETE FROM audit_events
|
||||
WHERE occurred_at < NOW() - INTERVAL 30 DAY;
|
||||
```
|
||||
|
||||
- Back up archive files and the main DuckDB file together.
|
||||
- Back up archive files and the PostgreSQL database together.
|
||||
- For production, run archive + backup as scheduled maintenance (cron/task scheduler).
|
||||
|
||||
## Quality Checks
|
||||
@@ -342,7 +350,7 @@ Add a persistent volume in Coolify:
|
||||
|
||||
- Mount Path: `/app/data`
|
||||
|
||||
This preserves DuckDB and other runtime artifacts across restarts/redeploys.
|
||||
This preserves PostgreSQL data and other runtime artifacts across restarts/redeploys.
|
||||
|
||||
### 5) Configure environment variables
|
||||
|
||||
@@ -351,7 +359,11 @@ Add runtime environment variables in Coolify (UI: Environment Variables):
|
||||
- `APP_ENV=prod`
|
||||
- `APP_HOST=0.0.0.0`
|
||||
- `APP_PORT=9090`
|
||||
- `DUCKDB_PATH=/app/data/arbitrade.duckdb`
|
||||
- `PG_HOST=postgres`
|
||||
`PG_PORT=5432`
|
||||
`PG_DATABASE=arbitrade`
|
||||
`PG_USER=arbitrade`
|
||||
`PG_PASSWORD=arbitrade`
|
||||
- `LOG_LEVEL=INFO`
|
||||
- `LOG_JSON=true`
|
||||
- `KRAKEN_API_KEY=...`
|
||||
|
||||
Reference in New Issue
Block a user