Skip to content

Commit d6dd602

Browse files
authored
Merge pull request #4 from freshtechbro/codex/search_provider&risk_config
Add search provider routing and tighten risk config behavior
2 parents edd21e2 + 5d5da27 commit d6dd602

366 files changed

Lines changed: 40016 additions & 15786 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ MARKET_CATALOG_PRESTART_MAX_AGE_MS=21600000
6161
GAMMA_API_BASE_URL=https://gamma-api.polymarket.com
6262
TRADING_ENABLED=true
6363
TRADING_MODE=shadow
64-
RISK_PROFILE=extra_high
64+
RISK_PROFILE=high
6565
# Optional override path to a specific risk profile JSON file
6666
RISK_PROFILE_PATH=
6767
# Optional override path to the active risk profile selection file
@@ -70,14 +70,20 @@ MAX_CONCURRENT_MARKETS=3
7070
MAX_CAPITAL_IN_FLIGHT=1000
7171

7272
# =============================================================================
73-
# EV web search (direct API)
73+
# EV web search + router providers
7474
# =============================================================================
7575
EXA_API_KEY=
7676
EXA_BASE_URL=https://api.exa.ai
7777
EXA_SEARCH_PATH=/search
7878
EXA_CONTENTS_PATH=/contents
7979
EXA_COOLDOWN_MS=300000
8080
EXA_COOLDOWN_FAILURE_THRESHOLD=1
81+
SERPER_API_KEY=
82+
SERPER_BASE_URL=https://google.serper.dev
83+
SERPER_SEARCH_PATH=/search
84+
SERPER_NEWS_PATH=/news
85+
# GDELT is keyless in the current runtime; override the base URL only if needed.
86+
GDELT_BASE_URL=https://api.gdeltproject.org/api/v2/doc/doc
8187
FIRECRAWL_API_KEY=
8288
FIRECRAWL_BASE_URL=https://api.firecrawl.dev
8389
FIRECRAWL_SEARCH_PATH=/v2/search

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ data/market-catalog.json
2727

2828
# Local artifacts
2929
tmp/
30+
.factory/
3031
data/*.bak-*
3132
services/ip-oracle/.venv/
3233
services/ip-oracle/.venv*/

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,14 @@ The runtime surfaces four strategy labels. Each has different risk shape, execut
4343
| --- | --- | --- | --- |
4444
| `near_zero` | Paired YES+NO arbitrage on one market | Symmetric two-leg execution, strict gate checks on spread/depth/staleness, strongest fill-discipline posture | `strategyMode=near_zero_risk`, `signalMode=near_zero|both`, `edgeRequired`, `minPairedFillRate`, `maxLegSkewMs` |
4545
| `ev` | Single-sided directional execution from calibrated probability/insight | One-leg intent (`side=yes|no`), confidence/edge thresholding, cooldown + per-market/portfolio EV notional caps | `signalMode=ev|both`, `evEdgeRequired`, `evConfidenceMin`, `evCooldownSeconds`, `evMaxPerMarketNotional`, `evMaxPortfolioNotional` |
46-
| `fw_projection` | Frank-Wolfe optimized projection for dependency-aware opportunity selection | Solver-driven lower-bound checks, only converged/feasible opportunities proceed, dependency graph quality affects candidate set | `fwDependency*`, `fwGapAbsTolerance`, `fwGapRelTolerance`, `fwMaxLoopRuntimeMs`, `fwMinEdgeThreshold` |
46+
| `fw_projection` | Frank-Wolfe optimized projection for dependency-aware opportunity selection | Solver-driven lower-bound checks; strict profiles require converged loops, while permissive profiles may accept approximate positive iterates | `fwDependency*`, `fwGapAbsTolerance`, `fwGapRelTolerance`, `fwRequireConverged`, `fwMaxLoopRuntimeMs`, `fwMinEdgeThreshold` |
4747
| `fw_basket` | Multi-market FW basket execution | Basket-level selection/ranking, market count bounds, configurable basket execution mode (`sequential_failfast` or `batch_best_effort`) | `fwBasketMinMarkets`, `fwBasketMaxMarkets`, `fwBasketExecutionMode`, `fwMaxPerMarketNotional`, `fwMaxPortfolioNotional` |
4848

4949
Operator notes:
5050
- Dashboard intent labels are normalized to `near_zero`, `ev`, `fw_projection`, and `fw_basket`.
5151
- `ev_single_side` is displayed as `ev`.
5252
- If explicit strategy metadata is missing, IDs can infer strategy (`:fw:`, `:fwb:`, `:yes:`, `:no:`).
53+
- Preset split: `near_zero`, `moderate`, and `high` keep FW convergence strict, while `extra_high` leaves `fwRequireConverged=false` for exploratory approximate-iterate operation.
5354

5455
## Minimum Requirements
5556

@@ -134,6 +135,7 @@ In `.env`:
134135

135136
```bash
136137
TRADING_MODE=paper
138+
RISK_PROFILE=high
137139
TRADING_ENABLED=true
138140
OPS_API_TOKEN=replace-with-secure-token
139141
# Optional dev-only localhost token prefill for /ops/* login
@@ -366,7 +368,7 @@ Set up OpenPolyTrader locally in safe paper mode.
366368
Requirements:
367369
1) Install backend and dashboard dependencies.
368370
2) Create .env and dashboard/.env from examples.
369-
3) Set TRADING_MODE=paper, TRADING_ENABLED=true.
371+
3) Set `TRADING_MODE=paper`, `TRADING_ENABLED=true`, and `RISK_PROFILE=high`.
370372
4) Set OPS_API_TOKEN and use runtime ops session login on /ops/*.
371373
5) Start with `npm run paper:up` (alias: `npm run dev:ops`).
372374
6) Verify:
@@ -409,7 +411,6 @@ curl -H "Authorization: Bearer $OPS_API_TOKEN" http://localhost:3000/health
409411

410412
- API reference: `docs/API.md`
411413
- Architecture (with end-to-end event flow diagrams): `docs/ARCHITECTURE.md`
412-
- Operator strategy report: `docs/Operations/operator-strategy-report.md`
413414
- Local setup spec and quickstart details: `docs/Development/setup.md`
414415
- Full command reference (start/help/stop/kill + diagnostics): `docs/Development/commands.md`
415416
- Environment variable descriptions and defaults: `docs/Operations/environment-reference.md`

0 commit comments

Comments
 (0)