Skip to main content
Glama
vikalp
by biranjan01

Vikalp

Open-source options lab for Indian markets — with an AI agent built in.

option chains · greeks · strategy payoff · max pain · position analyzer · MCP server

CI License: MIT Python MCP

Vikalp (विकल्प, "option") is a free, open-source alternative to Sensibull / Opstra for NSE & BSE options — usable from the terminal, from Python, or directly inside your AI coding agent (Claude Code, OpenCode, Cursor, Gemini CLI, any MCP client).

You:  "Analyze my CANBK 121 CE position — should I hold above VWAP?"
AI:   (calls vikalp MCP tools → chain, OI, greeks, payoff)
      "Hold while spot > 121.70, exit below 121.00. Breakeven 123.78 needs +1.6%..."

Why

Every serious options tool in India — Sensibull, Opstra, Quantsapp, AlgoTest — is a paid walled garden. Meanwhile AI agents can't touch market data at all. Vikalp fixes both:

  • 100% open source (MIT) — no subscription, no walled garden, your data stays yours

  • Bring your own broker — works with Kite Connect, Upstox, Fyers, Dhan, or free NSE snapshots

  • MCP-native — one config line gives your agent option chains, greeks and payoff math

Related MCP server: MyFinancial Market Data MCP

Quickstart

pip install git+https://github.com/biranjan01/vikalp
# PyPI package (pip install vikalp) ships with the v0.2 release

Use from your AI agent (MCP)

{
  "mcpServers": {
    "vikalp": { "command": "vikalp-mcp" }
  }
}

Works in Claude Code, OpenCode, Cursor, Gemini CLI — any client that speaks MCP.

Use from Python

from vikalp.analytics.greeks import black_scholes, implied_vol
from vikalp.analytics.strategy import Strategy

# Single-leg fair value + greeks
price, g = black_scholes(spot=121.77, strike=121, t_days=8, iv=0.26, right="C")

# Multi-leg payoff: bull call spread
s = Strategy([
    {"strike": 121, "right": "C", "qty": 1, "premium": 2.78},
    {"strike": 125, "right": "C", "qty": -1, "premium": 0.90},
])
print(s.summary(spot=121.77))

MCP tools

Tool

What it does

option_chain

Live NSE option chain (LTP, OI, IV, volume) for any F&O underlying

greeks

Solve implied volatility from a market price, then full greeks + probabilities

strategy_payoff

Multi-leg payoff: breakevens, max loss/profit, risk-neutral P(profit)

max_pain

Max-pain strike + call/put walls for an expiry

analyze_position

Score an open option position: breakeven, VWAP filter, hold/exit levels

Roadmap

  • Core analytics engine (BS greeks, IV solver, payoff engine, max pain)

  • MCP server with 5 tools

  • Live data connectors: NSE snapshot, Upstox, Kite (bring-your-own key)

  • Position analyzer with intraday OI build-up classification

  • Web dashboard (chains, strategy builder, payoff charts)

  • Option-strategy backtester (event studies: expiry → expiry)

  • Hindi + English docs

Data & compliance

  • Market data is fetched live in your session from your own broker API keys or public NSE endpoints — Vikalp redistributes no exchange data.

  • NSE/BSE data is subject to exchange terms; use broker APIs for anything beyond personal use.

Disclaimer

Vikalp is an analysis tool, not investment advice. Options trading involves substantial risk of loss. Model outputs (greeks, probabilities) are estimates. Consult a registered advisor before trading.

License

MIT

Available Tools

5 tools
analyze_positionA

Score an open long option position: breakeven, current P&L, hold/exit framing.

Args: symbol: underlying symbol (for reporting) right: 'C' or 'P' strike: strike held entry: entry premium per share spot: current underlying price t_days: calendar days to expiry qty_shares: total shares (qty * lot_size), e.g. 6750 for 1 CANBK lot vwap: today's VWAP if known — adds the hold-above/exit-below filter iv: annualized IV; if omitted, estimated 0.28 (India F&O typical) — pass a real one when known

Inputs: spot (required), entry (required), right (required), strike (required), +5 more.

greeksA

Black-Scholes greeks for one option.

Args: spot: underlying spot price strike: option strike t_days: calendar days to expiry iv: annualized implied volatility as a decimal (0.26 = 26%) right: 'C' for call, 'P' for put market_price: if given, IV is re-solved from this price instead of using iv

Inputs: iv (required), spot (required), strike (required), t_days (required), +2 more.

max_painB

Max pain, PCR and CE/PE walls for an underlying's live option chain.

Fetches the public NSE snapshot in-session (may be rate-limited; retry once after a pause if it fails).

Inputs: symbol (required).

option_chainB

Live NSE option chain (LTP/OI/IV) around ATM for one underlying.

Args: symbol: NSE symbol, e.g. 'NIFTY', 'BANKNIFTY', 'CANBK', 'ULTRACEMCO' expiry: filter, e.g. '27-Oct-2026' (defaults to nearest expiry) atm_band: how many strikes either side of the money to return

Inputs: symbol (required), expiry, atm_band.

strategy_payoffA

Payoff analysis for a multi-leg option strategy at expiry.

Args: legs: list of {strike, right ('C'/'P'), qty (+ long / - short), premium, lot_size?} spot: current underlying price t_days: calendar days to expiry iv: annualized IV for probability estimate (decimal) lot_size: shares per contract (e.g. 6750 for CANBK), or use per-leg lot_size

Inputs: legs (required), spot (required), iv, t_days, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 5 tools

    Disambiguation4/5

    Each tool targets a distinct analytical task: live chain data, max-pain metrics, single-option greeks, multi-leg payoff, and position scoring. However, `greeks` and `analyze_position` both accept similar option inputs and could be confused, and `max_pain` also fetches the chain, creating minor overlap.

    Naming Consistency4/5

    All names use snake_case and are descriptive, but the convention is mostly noun phrases (option_chain, strategy_payoff, max_pain, greeks) with one verb_noun outlier (analyze_position), so it is not fully uniform.

    Tool Count5/5

    Five tools is well within the ideal 3–15 range and each covers a distinct facet of options analytics, so no tool feels redundant.

    Completeness4/5

    Core options analytics are covered: live chain, greeks, payoff, max pain, and position scoring. Minor gaps exist (e.g., listing expiries, multi-leg position analysis, or volatility surface), but agents can likely work around them.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      C
      quality
      D
      maintenance
      Enables AI assistants to access National Stock Exchange of India (NSE) data, including live quotes, market status, indices, option chains, corporate actions, and historical data, through natural language.
      24
      1
      -
    • A
      license
      A
      quality
      C
      maintenance
      Gives AI assistants live Indian market data without any API keys, spanning NSE quotes and indices, option chains with Greeks, max pain and OI analytics, company financials, shareholding and corporate actions, plus mutual fund NAVs and trailing returns. It also ships research, market-brief and options-positioning prompts so users can compare stocks, trace sector leadership or size up an expiry through natural language.
      2
      13
      MIT
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants to search, screen, and analyze 8,200+ NSE and BSE listed securities through 55 tools covering live quotes, financials, technical indicators, FII/DII flows, option chains, filings, IPOs, bulk deals, and portfolio P&L.
      -