mirror of
https://github.com/Mihirkansara/nexus-quant-terminal.git
synced 2026-08-23 07:38:08 +00:00
Full-stack forex options analytics terminal with Bloomberg-inspired UI. Backend (FastAPI + Python): - Garman-Kohlhagen options pricing engine with full Greeks - Goldman Sachs gs-quant AI signals (RSI, MACD, Bollinger, Hurst, OU) - Monte Carlo GBM simulation and volatility surface generation - CFTC COT institutional positioning + Forex Factory economic calendar - Live data proxy: OpenSky aircraft + USGS earthquakes (CORS-safe) - Multi-leg strategy library (straddle, iron condor, butterfly, spreads) Frontend (React 18 + Vite): - NEXUS animated orbital logo (3-ring SVG) + canvas favicon animation - Bloomberg terminal design: JetBrains Mono, color-mix() tokens - 11 dashboard tabs: Greeks, Chart, AI Signals, 3D Surfaces, Breakeven, Scenarios, Monte Carlo, Institutional, Calendar, Live Map, Live Feeds - Live World Map (react-leaflet): aircraft, earthquakes, weather radar - Live Feeds: CoinGecko crypto top-12 + Windy.com global webcams - Economic calendar with filters + institutional flow (CFTC COT) - Animated landing page + session-based routing - Fully responsive dark-only terminal design system Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
94 lines
3.0 KiB
Python
94 lines
3.0 KiB
Python
from fastapi import APIRouter
|
|
|
|
router = APIRouter(prefix="/strategies", tags=["strategies"])
|
|
|
|
# Pre-built strategy templates — all expressed relative to ATM spot (K=100 placeholder)
|
|
STRATEGIES = [
|
|
{
|
|
"name": "Long Call",
|
|
"description": "Bullish. Unlimited upside, limited downside to premium paid.",
|
|
"legs": [{"type": "call", "K_offset": 0, "qty": 1}],
|
|
},
|
|
{
|
|
"name": "Long Put",
|
|
"description": "Bearish. Profit if spot falls below strike.",
|
|
"legs": [{"type": "put", "K_offset": 0, "qty": 1}],
|
|
},
|
|
{
|
|
"name": "Covered Call",
|
|
"description": "Long stock + short OTM call. Income strategy.",
|
|
"legs": [{"type": "call", "K_offset": 5, "qty": -1}],
|
|
},
|
|
{
|
|
"name": "Protective Put",
|
|
"description": "Long stock + long put. Portfolio insurance.",
|
|
"legs": [{"type": "put", "K_offset": -5, "qty": 1}],
|
|
},
|
|
{
|
|
"name": "Straddle",
|
|
"description": "Long call + put at same strike. Profits from large moves either way.",
|
|
"legs": [
|
|
{"type": "call", "K_offset": 0, "qty": 1},
|
|
{"type": "put", "K_offset": 0, "qty": 1},
|
|
],
|
|
},
|
|
{
|
|
"name": "Strangle",
|
|
"description": "OTM call + OTM put. Cheaper than straddle, needs bigger move.",
|
|
"legs": [
|
|
{"type": "call", "K_offset": 5, "qty": 1},
|
|
{"type": "put", "K_offset": -5, "qty": 1},
|
|
],
|
|
},
|
|
{
|
|
"name": "Bull Call Spread",
|
|
"description": "Long ATM call + short OTM call. Capped upside, lower cost.",
|
|
"legs": [
|
|
{"type": "call", "K_offset": 0, "qty": 1},
|
|
{"type": "call", "K_offset": 10, "qty": -1},
|
|
],
|
|
},
|
|
{
|
|
"name": "Bear Put Spread",
|
|
"description": "Long ATM put + short OTM put. Profits from moderate decline.",
|
|
"legs": [
|
|
{"type": "put", "K_offset": 0, "qty": 1},
|
|
{"type": "put", "K_offset": -10, "qty": -1},
|
|
],
|
|
},
|
|
{
|
|
"name": "Iron Condor",
|
|
"description": "4-leg strategy. Profit from low volatility, defined risk.",
|
|
"legs": [
|
|
{"type": "put", "K_offset": -15, "qty": 1},
|
|
{"type": "put", "K_offset": -5, "qty": -1},
|
|
{"type": "call", "K_offset": 5, "qty": -1},
|
|
{"type": "call", "K_offset": 15, "qty": 1},
|
|
],
|
|
},
|
|
{
|
|
"name": "Butterfly",
|
|
"description": "3-strike spread. Max profit when spot pins at middle strike.",
|
|
"legs": [
|
|
{"type": "call", "K_offset": -10, "qty": 1},
|
|
{"type": "call", "K_offset": 0, "qty": -2},
|
|
{"type": "call", "K_offset": 10, "qty": 1},
|
|
],
|
|
},
|
|
]
|
|
|
|
|
|
@router.get("")
|
|
def list_strategies():
|
|
"""Return all available strategy templates."""
|
|
return STRATEGIES
|
|
|
|
|
|
@router.get("/{name}")
|
|
def get_strategy(name: str):
|
|
"""Return a specific strategy by name (case-insensitive)."""
|
|
for s in STRATEGIES:
|
|
if s["name"].lower() == name.lower():
|
|
return s
|
|
return {"error": f"Strategy '{name}' not found."}
|