Skip to content

feat(options-gps): market line shopping — multi-exchange divergence comparison#37

Closed
MkDev11 wants to merge 3 commits intoentrius:mainfrom
MkDev11:feature/issue-32-market-line-shopping
Closed

feat(options-gps): market line shopping — multi-exchange divergence comparison#37
MkDev11 wants to merge 3 commits intoentrius:mainfrom
MkDev11:feature/issue-32-market-line-shopping

Conversation

@MkDev11
Copy link
Contributor

@MkDev11 MkDev11 commented Mar 11, 2026

Summary

Adds Market Line Shopping to Options GPS — compares Synth's theoretical option prices against multiple exchanges (Aevo, Deribit, OKX) to identify market divergence, like a sports bettor "shopping for lines" to find an edge. Exchange divergence is visualized on the Market Context screen (Screen 1b) and used to refine the Confidence metric that drives Screens 1 and 2.

What's included:

  • exchanges.py — Pluggable ExchangeProvider abstraction with three mock providers (Aevo, Deribit, OKX), each with a distinct pricing personality. Computes per-exchange divergence metrics: avg/max absolute divergence, signed call/put divergence vs Synth fair value. Reads AEVO_API_KEY, DERIBIT_CLIENT_ID, DERIBIT_CLIENT_SECRET from env so real adapters can be plugged in later; defaults to mock-only mode.
  • Confidence metric integration — adjust_confidence_for_divergence() in pipeline.py nudges confidence based on market consensus: strong agreement (+0.05), moderate (no change), weak (−0.03), disagreement (−0.07). Contextual overlay, not a hard guardrail.
  • CLI visualization — "MARKET LINE SHOPPING" block on Screen 1b showing consensus classification and per-exchange divergence summary (e.g., Aevo: avg |Δ| 2.8pp, max 7.2pp; calls +3.1pp, puts -2.2pp vs Synth).
  • Decision logmarket_lines JSON section with consensus, avg/max divergence, and per-exchange breakdown.
  • 24 new tests covering divergence computation, mock provider behavior, consensus classification, confidence adjustment boundaries, edge cases (zero prices, empty data, failing providers), and end-to-end integration.

Related Issues

Closes #32

Type of Change

  • Bug fix
  • Improvement to existing tool
  • Documentation
  • Other (describe below)

Testing

  • Tested against Synth API
  • Manually tested
  • Tests added/updated

Test command: python -m pytest tools/options-gps/tests/ -v
Result: 104 passed (80 existing + 24 new) in 0.14s

Manual verification: Ran python tools/options-gps/main.py --symbol BTC --view bullish --risk medium --no-prompt --screen 1 — confirmed MARKET LINE SHOPPING block renders on Screen 1b with per-exchange divergence, consensus label, and adjusted confidence in decision log.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Changes are documented (if applicable)

Files Changed

File Change
tools/options-gps/exchanges.py New — Exchange abstraction, mock providers, divergence computation
tools/options-gps/pipeline.py Added adjust_confidence_for_divergence()
tools/options-gps/main.py Wired exchange divergence into pipeline, Screen 1b display, decision log
tools/options-gps/tests/test_exchanges.py New — 24 tests for exchange divergence + confidence adjustment
tools/options-gps/README.md Added Market Line Shopping documentation section

Demo Video

11.03.2026_12.15.40_REC.mp4

…omparison

Closes entrius#32

Adds multi-exchange price comparison to Options GPS, comparing Synth's
theoretical option prices against Aevo, Deribit, and OKX to identify
market divergence — like shopping for lines in sports betting.

- New exchanges.py: pluggable ExchangeProvider abstraction with three
  mock providers (Aevo, Deribit, OKX), each with distinct pricing
  personality. Computes per-exchange divergence metrics (avg/max absolute
  divergence, signed call/put divergence vs Synth fair value).
- Confidence metric integration: adjust_confidence_for_divergence() in
  pipeline.py nudges confidence based on market consensus — strong
  agreement (+0.05), disagreement (-0.07). Contextual overlay, not a
  hard guardrail.
- Screen 1b (Market Context): MARKET LINE SHOPPING block shows consensus
  classification and per-exchange divergence summary.
- Decision log: market_lines section with consensus, avg/max divergence,
  and per-exchange breakdown in JSON output.
- 24 new tests covering divergence computation, mock providers, consensus
  classification, confidence adjustment, edge cases (zero prices, empty
  data, failing providers), and end-to-end integration.
- README updated with Market Line Shopping section documenting exchanges,
  metrics, env vars for future real adapters.
@ventura-oss
Copy link

  1. Live Execution Requirement: The tool must move past detecting environment variables to actual network execution. If API keys are present, the end output must be functional, real-time quotes from Aevo, Deribit, etc.

  2. High-Signal UI (Handoff for Execution): The data presentation must be actionable at a glance without manual calculation. The UI should explicitly "point to the winner" by highlighting the venue offering the best execution price for the chosen strategy. This is a critical requirement as this tool will transition into an automated execution layer next.

  3. Edge Detection (Alpha over Agreement): Alpha is found in disagreement, not consensus. Higher divergence from the market consensus should drive higher conviction/confidence in the trade. This should be modeled statistically (Standard Deviation/Z-score) to quantify how far Synth deviates from the market mean.

MkDev11 added 2 commits March 12, 2026 01:02
…st venue highlighting

- Live execution: LiveDeribitProvider and LiveAevoProvider fetch real-time
  option mark prices via public REST APIs when API keys are configured.
  Falls back to mock providers when credentials are absent or calls fail.
- Edge detection: alpha is in disagreement, not consensus. Z-score model
  measures how far Synth deviates from market mean per strike. Higher |z|
  = more alpha = higher confidence boost (+0.10 at z≥2σ).
- Best execution venue: after strategy selection, identifies which exchange
  offers the best price per leg (cheapest for BUY, richest for SELL).
  Displayed on Screen 2 with savings vs Synth and per-exchange comparison.
- 37 tests covering z-scores, best venues, live provider properties,
  edge-based confidence, partial failure mode, exchange_prices storage.
- 117 total tests pass (80 existing + 37 new).
@ventura-oss
Copy link

Closing this in favor of the implementation in PR #39. Thank you for the contribution!

@e35ventura e35ventura closed this Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Options GPS: Market Line Shopping (updated)

3 participants