Skip to content

feat: implement options gps tool (fixes #2)#8

Open
R-Panic wants to merge 4 commits intoentrius:mainfrom
R-Panic:feature/issue-2-options-gps
Open

feat: implement options gps tool (fixes #2)#8
R-Panic wants to merge 4 commits intoentrius:mainfrom
R-Panic:feature/issue-2-options-gps

Conversation

@R-Panic
Copy link

@R-Panic R-Panic commented Feb 28, 2026

Summary

Implemented the Options GPS Tool to resolve Issue #2.

Features a full math engine parsing Synth distributions (get_prediction_percentiles) against the mocked Option Chain to yield robust recommendations depending on risk tolerance and directional bias.

Resolves #2

Testing

  • Automated pytest suite ensuring correct engine logic.
  • Included demo script main.py mimicking front-end selection logic.

@e35ventura
Copy link
Collaborator

please add Submission Requirements

Demo video — Screen recording showing the dashboard in action

1-page technical explanation. Should cover what the tool does, how it works, and how it uses Synth data

@R-Panic R-Panic force-pushed the feature/issue-2-options-gps branch 4 times, most recently from 3fe45d2 to 0ddda92 Compare February 28, 2026 23:48
@R-Panic R-Panic force-pushed the feature/issue-2-options-gps branch from 0ddda92 to 218b86e Compare February 28, 2026 23:51
@e35ventura
Copy link
Collaborator

  1. PoP should be dynamic, currently it is hard coded to 45% or 55%. this probably should be dynamic based on data
  2. add profit number as well, you show max loss but not profit. make it very clear the max loss and max profit possible.
  3. always explain a strategy (ie. bull call spread, say exactly which contracts are bought or sold and how to construct strategy)
  4. add ability to use 1h time frame too not just 24 hour
  5. account for invalid inputs

@R-Panic
Copy link
Author

R-Panic commented Mar 1, 2026

Here are the requested Submission Requirements for the Options GPS Tool:

1. Demo Video (CLI Interface)

Options GPS Terminal Demo


Options GPS: Technical Explanation

What the Tool Does

The Options GPS serves as a quantitative decision-engine that directly bridges the gap between explicit market views and complex derivatives trading. Designed as a backend router with a CLI interface, it removes the burden of manual option chain analysis.

A trader simply inputs their Target Asset (e.g., BTC, SPY), Directional Bias (Bullish, Bearish, Neutral), and Risk Tolerance (Low, Medium, High). The engine then queries the decentralized Synth forecasting models to mathematically construct and recommend the most optimal option strategies (e.g., Long Calls, Bear Put Spreads, or Iron Condors), explicitly ranking them by risk-adjusted asymmetry.

How It Works

The system architecture revolves around the OptionsGPSEngine (engine.py), a rules-based matrix that cross-references user risk profiles with real-time market data.

  1. The Input Phase: The tool captures the trader's constraints via a standard terminal interface (main.py), mimicking the flow of a potential front-end form.
  2. Strategy Routing: Once bias and risk are captured:
    • High-Risk Profiles are routed toward unhedged, asymmetric setups (e.g., Naked Long Calls/Puts or Short Strangles) designed to maximize leverage on tail events.
    • Low-Risk Profiles are routed toward defined-risk spreads (e.g., Bull Call Spreads or Iron Condors) to cap maximum drawdown.
  3. The Output Phase: The engine filters the strategies and returns the top 3 recommendations, complete with the specific strikes to trade, the exact Max Loss (premium cost/margin), the Probability of Profit (PoP), and a plain-English rationale for why the strategy fits the current Synth forecast.

How it Uses Synth Data

The engine relies on two simultaneous data streams provided by the Synth API (Subnet 50):

1. Price Probability Percentiles (get_prediction_percentiles)
Instead of relying on standard technical indicators, the engine fetches the 24-hour ensemble prediction percentiles for the chosen asset. It isolates the extreme tails (0.05 for downside and 0.95 for upside). These percentile prices dynamically form the boundary targets for the recommended option strikes. For example, a Bullish High-Risk play explicitly references the 95th percentile price target in its rationale as the expected payoff zone.

2. Theoretical Option Pricing (get_option_pricing)
To construct meaningful spreads and calculate Max Loss, the engine must know the cost of the contracts. It fetches the mocked Option Chain from Synth.
The get_closest_strike algorithm locates the At-The-Money (ATM) contract relative to the current_price provided by Synth. It then geometrically selects Out-of-The-Money (OTM) strikes up or down the chain to synthetically build the legs of the spreads (e.g., calculating the net debit of a Bear Put Spread by subtracting the cost of the OTM put from the ATM put).

This synthesis of probabilistic models and derivatives pricing allows the Options GPS to offer institutional-grade routing to retail traders.

@e35ventura
Copy link
Collaborator

PR #8 Deep Dive: Options GPS Tool

Overview

The "Options GPS" tool provides a strong proof-of-concept for translating Synth's probabilistic forecasts into trade strategies. However, testing with a live API key reveals that the implementation is brittle, lacks mathematical precision, and misses core usability requirements.


🔍 Deep Dive Findings

1. Mathematical Precision (PoP Calculation)

The current PoP (Probability of Profit) calculation in engine.py is a crude linear approximation (50.0 + (distance_pct * 1500)).

  • Risk: This does not reflect the actual probability distribution provided by Synth.
  • Improvement: The tool should use linear interpolation across the actual percentile dictionary (0.05 to 0.95) to find the precise probability of the price being above or below a strike at expiry.

2. Structural Incompleteness (Iron Condor)

The Iron Condor implementation is currently a "Short Strangle with a hidden wing."

  • The Bug: It calculates max_loss correctly but only displays the Short Strikes.
  • Impact: A user cannot execute this trade without knowing which Long Put/Call to buy. The logic is also missing an Iron Butterfly variant for users wanting to pin a specific price.

3. Resilience & Asset Support

  • The Crash: Entering XAU (Gold) causes a hard crash (400 Bad Request) because the tool assumes every asset supports every endpoint. It lacks a try/except wrapper for API calls.
  • Hidden Assets: SOL is fully functional but hidden from the user because the selection list in main.py is hardcoded.

4. Requirement Gaps

  • 1h Timeframe: Completely omitted despite being a requested feature.
  • Dynamic Exit Rules: "Screen 4" shows exit rules as static text. It should dynamically state the price level where the 5th percentile is hit based on current data.

🚀 Improvement Roadmap

Phase 1: Robustness & Core Fixes (Immediate)

  • [ ] Dynamic Asset Discovery: Replace hardcoded asset strings with SynthClient.SUPPORTED_ASSETS.
  • [ ] API Error Handling: Wrap client.get_option_pricing() in a try block. If an asset (like XAU) lacks options data, inform the user rather than crashing.
  • [ ] Python compatibility: Standardize type hints for Python 3.8+ compatibility.

Phase 2: Math & Strategy Logic

  • [ ] Accurate PoP Engine: Implement an interpolation method to map strikes against the Synth distribution percentiles.
  • [ ] 4-Leg Strategy Support: Update the schema for spreads to include long_strikes. Ensure the CLI prints the full structure (e.g., Buy 64k P / Sell 65k P).
  • [ ] 1h/24h Toggle: Add a Screen 1 prompt for "Time Horizon" and pass it to the engine.

Phase 3: UX & Performance

  • [ ] Clean Formatting: Use a consistent rounding policy (1 decimal) and a unified "Unlimited" string for infinite values.
  • [ ] Actionable Exit Levels: Calculate and display the specific price dollar amount for the "Exit Rule" (e.g., "Exit if price < $65,432.10").
  • [ ] Strategy Diversity: Add "Iron Butterfly" for Neutral/Low risk and "Straddle" for Neutral/High risk.

Final Verdict: Requesting Changes

The PR is a great start but requires a math and robustness overhaul before it can be trusted as a financial decision tool.

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: High-Level System Design

2 participants