Diamond Options Engine
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Diamond Options Engine
Systematic Indian F&O options trading engine with mathematically-backed trade suggestions. Designed for natural language interaction through Claude Code.
Features
89 MCP tools for full options analysis and trading workflow
Black-Scholes pricing with Greeks (delta, gamma, theta, vega, rho, vanna, charm)
5 HV estimators (Close-to-Close, Parkinson, Garman-Klass, Yang-Zhang, Rogers-Satchell)
EWMA & GARCH(1,1) volatility forecasting
18+ strategies across directional, neutral, volatility, income, and hedge categories
Signal scanner scoring strategies 0-100 based on IV rank, VIX regime, trend, VRP
Position sizing with fixed-risk and Kelly criterion, VIX-adjusted
Portfolio Greeks aggregation with configurable risk limits
Monte Carlo simulation (10K GBM paths, VaR, CVaR, stress testing)
Historical backtesting with walk-forward entry and performance metrics
Live OI analysis via Kite Connect bridge
Cross-engine integration with Diamond Stock Engine for covered calls, protective puts, collars
Market event calendar (RBI, earnings, budget, FOMC, holidays)
Indian F&O cost model (STT, brokerage, GST, exchange fees, SEBI, stamp duty)
Related MCP server: MarketPing MCP server
Quick Start
# Install dependencies
uv sync --dev
# Run tests (550 tests, ~2.5s)
uv run pytest tests/ -x -q
# CLI commands
uv run options status # Portfolio status
uv run options chain NIFTY # Options chain
uv run options expiry # Upcoming expiries
uv run options universe # F&O stocks
uv run options costs 3250 # Cost calculatorRequirements
Python >= 3.9
uv package manager
Project Structure
src/diamond_options/
config.py -- Pydantic settings (singleton via get_config())
cli.py -- Typer CLI entry point
data/
market.py -- yfinance wrapper + file cache
options_chain.py -- OptionsChain dataclass, PCR, max pain, OI
universe.py -- ~75 F&O stocks + 4 indices, lot sizes
expiry.py -- Weekly/monthly expiry calendar (Tue-based)
ledger.py -- SQLite trade ledger (multi-leg support)
costs.py -- Indian F&O cost model (pure functions)
kite_bridge.py -- Kite MCP bridge: symbols, chains, OI analysis
position_sync.py -- Kite position sync & portfolio reconciliation
events.py -- Market event calendar (100+ events)
pricing/
black_scholes.py -- BS European pricing (call/put, dividend yield)
greeks.py -- All Greeks including Vanna, Charm
implied_volatility.py -- Newton-Raphson IV solver + bisection fallback
live_greeks.py -- Real IV/Greeks from market prices via Kite
iv_surface.py -- Smile/skew analysis, IV rank/percentile
payoff.py -- Multi-leg payoff, breakevens, Monte Carlo EV
volatility/
historical.py -- 5 HV estimators (CC, Parkinson, GK, YZ, RS)
forecast.py -- EWMA, GARCH(1,1), variance risk premium
vix.py -- India VIX regime detection + signals
strategy/
definitions.py -- 18+ strategy specs, leg builders, catalog
scanner.py -- Market condition scoring, signal quality (0-100)
sizing.py -- Fixed-risk & Kelly criterion position sizing
recommender.py -- Full recommendation pipeline
risk/
portfolio_greeks.py -- Aggregate Greeks, risk limits, exposure
adjustments.py -- Roll/widen/close/hedge advisor
monte_carlo.py -- GBM simulation, VaR, CVaR, stress testing
backtester.py -- Historical strategy backtesting engine
integration/
stock_bridge.py -- Read equity holdings from diamond_stock_engine
overlay.py -- Covered calls, protective puts, collars
hedge.py -- Portfolio-level hedging with NIFTY options
utils/
indian_markets.py -- NSE hours, holidays, trading day utilities
formatters.py -- INR, Greek, IV display formatting
mcp_server/
server.py -- FastMCP server with 89 tools
tests/ -- 550 tests, all mocked, ~2.5sClaude Code Integration
MCP Tools (89)
Category | Count | Examples |
Foundation | 13 |
|
Pricing | 5 |
|
Greeks | 4 |
|
IV & Volatility | 10 |
|
Historical Vol | 4 |
|
Forecasting | 2 |
|
Strategy | 7 |
|
Sizing | 3 |
|
Risk | 6 |
|
What-If | 3 |
|
Market Data | 4 |
|
Cross-Engine | 6 |
|
Live OI | 4 |
|
Position Sync | 2 |
|
Live Greeks | 2 |
|
Events | 4 |
|
Costs | 3 |
|
Portfolio | 2 |
|
Helpers | 4 |
|
Slash Commands (28)
/status /chain /expiry /costs /universe /morning /suggest /greeks /iv /risk /adjust /backtest /simulate /compare /payoff /vix /vol /whatif /size /price /scan /stress /condor /straddle /history /hedge /covered-call /collar
Auto-Triggering Skills (31)
Strategy lifecycle skills that activate automatically based on context: strategy-selector, greeks-interpreter, risk-monitor, iv-regime, position-sizer, adjustment-trigger, expiry-day-ops, trade-validator, vol-analyzer, spread-builder, theta-decay, vix-regime-adapter, cost-optimizer, profit-taker, loss-manager, event-aware, margin-calculator, and more.
Indian F&O Reference
Cost Model
Fee | Rate | Side |
STT | 0.0625% | Sell only |
Brokerage | Rs. 20 flat | Per order |
GST | 18% | On brokerage + exchange + SEBI |
Exchange fees | 0.0495% | Both |
SEBI | 0.001% | Both |
Stamp duty | 0.003% | Buy only |
Key Lot Sizes
Symbol | Lot Size |
NIFTY | 65 |
BANKNIFTY | 15 |
FINNIFTY | 65 |
RELIANCE | 250 |
TCS | 150 |
HDFCBANK | 550 |
INFY | 300 |
Expiry Rules
Weekly: Every Tuesday (NIFTY, BANKNIFTY, FINNIFTY)
Monthly: Last Tuesday of month (all F&O stocks)
Holiday: Moves to previous trading day
VIX Regimes
Regime | VIX Range | Bias |
Low | < 12 | Buy vol |
Normal | 12-18 | Neutral |
Elevated | 18-25 | Sell vol (wider strikes) |
High | 25-35 | Sell vol (reduce size) |
Crisis | > 35 | Hedge only |
Development
# Lint
uv run ruff check src/ tests/
# Format
uv run ruff format src/ tests/
# Type check
uv run pyright src/
# All tests
uv run pytest tests/ -x --tb=short -q
# Specific module
uv run pytest tests/test_costs.py
# Pre-commit hooks
pre-commit install
pre-commit run --all-filesMCP Server Setup
The MCP server runs in its own venv:
cd mcp_server
uv syncConfigure in .mcp.json (local, not committed):
{
"mcpServers": {
"options": {
"command": "mcp_server/.venv/bin/python",
"args": ["mcp_server/server.py"],
"env": {
"PYTHONPATH": "src"
}
}
}
}Configuration
Copy .env.example to .env and customize:
cp .env.example .envKey settings: initial capital, risk limits, cache TTLs, Kite Connect credentials.
See .env.example for all options.
License
MIT License. See LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Backtest options strategies in plain English on 1-min NSE, BSE, MCX and US SPX/SPY option-chain data
Production MCP server for US equity and options intelligence: real-time IV radar, Monte Carlo simulation, options pressure, strategy backtesting, AI prediction, pre-trade risk analysis, and automated stock research reports.
Hosted MCP server for Indian NSE/BSE stock research: 59 tools for quotes, financials and ratios, peers, shareholding and pledge, filings with extracted facts, screens, F&O and FII/DII context. Source and freshness on every answer; no buy/sell calls.
Hosted MCP server for Indian market quotes, option-chain Greeks and multi-broker telemetry.
Related MCP Servers
- AlicenseCqualityBmaintenanceMCP Server for Indian Options — Real-time option chains, Greeks, 34+ strategies, OI analysis, IV smile, Max Pain. Works with Claude Desktop. Replaces Sensibull.12733 npm23MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to research Indian stock markets by accessing NSE/BSE corporate filings with measured price reactions, fundamentals, a 108-metric screener, IPO pipeline, FPI flows, results calendar, and daily market briefings through MCP tools.2MIT
- FlicenseNot gradedqualityAmaintenanceIndian stock market MCP server exposing 55 tools covering all 8,200+ NSE and BSE listed stocks, letting users pull live quotes, quarterly financials, technical indicators, a 326-ratio screener, FII/DII flows, option chains and IV, corporate filings, IPOs, bulk deals and portfolio P&L through plain-English prompts. It can be added to Claude, ChatGPT, Cursor, VS Code, Codex or Gemini CLI either as a remote OAuth endpoint or as a local npx/uvx stdio bridge.-
- AlicenseNot gradedqualityAmaintenanceGives AI assistants live, structured data on every NSE and BSE listed company — quotes, financials, a 326-ratio screener, technical indicators, FII/DII flows, option chains and IV, corporate filings, IPOs, bulk deals and portfolio P&L across 8,200+ stocks. It can be connected to Claude, ChatGPT, Cursor, VS Code, Codex, Gemini CLI and other MCP clients either remotely via OAuth or locally through npx/uvx.MIT