stratify-mcp
Python client for Stratify — real 1-minute NIFTY options data, honest backtests (out-of-sample, walk-forward, deflated Sharpe, all reported alongside the number, not instead of it).
pip install stratify-mcp
Quickstart
from stratify_mcp import StratifyClient
# One-time: create an account and get a key. The key is shown once -- save it.
signup = StratifyClient.signup("you@example.com")
client = StratifyClient(api_key=signup["api_key"])
result = client.run_backtest({
"legs": [
{"side": "sell", "type": "CE", "strike": {"delta_near": 0.2}},
{"side": "sell", "type": "PE", "strike": {"delta_near": 0.2}},
],
# The reason for the trade, not just the trade.
"entry": {"cadence": "weekly", "dte": 3, "time": "09:30",
"when": {"vix": {"gte": 15}}},
# Managed while it is open: take profit, and roll the tested side if it doubles.
"rules": [
{"when": {"pnl_pct_of_credit": {"gte": 0.6}}, "then": "close"},
{"when": {"leg_mark_mult": {"gte": 2.0, "leg": 0}},
"then": {"roll": {"legs": [0], "to": {"delta_near": 0.2}}}, "max_times": 2},
],
"portfolio": {"stop_after_losses": 3, "resume_after_days": 30},
})
print(result.summary["total_pnl_rupees"], result.summary["max_drawdown_rupees"])
print(result.summary["ratios"]) # sharpe, profit_factor, calmar (only above 30 trades)
print(result.honesty) # out-of-sample split, walk-forward folds, deflated Sharpe
result.trades # pandas.DataFrame, one row per trade
result.equity_curve # pandas.DataFrame
print(result.report_url) # shareable page with the full chart and every trade
Already have a key? Skip signup():
client = StratifyClient(api_key="sk_live_...")
Why a Python client at all, when it's just JSON-RPC
There's no separate REST endpoint for run_backtest — every tool is reached through one
POST /mcp speaking MCP JSON-RPC 2.0. This package exists so you don't hand-roll that
envelope: client.run_backtest(...) is a real function call, errors come back as Python
exceptions you can except, and results come back as pandas.DataFrames instead of raw
JSON, because that's what you're actually going to do with a table of trades.
Errors
from stratify_mcp import AuthenticationError, QuotaExceededError, ToolRefusalError
try:
result = client.run_backtest(spec)
except AuthenticationError:
... # bad or revoked key
except QuotaExceededError as e:
... # e.limit, e.retry_after_seconds
except ToolRefusalError as e:
... # the server read your spec and refused it -- str(e) says why
Methods
| Method | Returns |
|---|---|
run_backtest(spec, lots=1, detail="standard") |
BacktestResult |
get_backtest(backtest_id, detail=None) |
BacktestResult |
describe_coverage() |
dict — symbols, date range, structures, gates, biases, cost model |
explain_methodology(topic=None) |
dict |
list_strategies(order="consistency", limit=None) |
dict — {"strategies": [...], "bar": {...}, ...}, this account's strategies that held up out-of-sample |
search(query) / fetch(id) |
dict |
StratifyClient.signup(email) (staticmethod) |
dict — includes api_key, shown once |
detail on run_backtest/get_backtest: "summary" (aggregates only, cheapest),
"standard" (default — equity curve, breakdowns, first 25 trades), "full" (every
stored trade).
BacktestResult
| Property | Type |
|---|---|
.summary |
dict |
.honesty |
dict |
.interpretation |
str |
.trades |
pandas.DataFrame |
.equity_curve |
pandas.DataFrame |
.qualified / .why_not_qualified |
bool / str | None |
.backtest_id / .report_url |
str |
.warnings |
list[str] |
.to_dict() |
the complete raw payload |
Development
pip install -e ".[dev]"
pytest
Tests run against a mocked transport and need no live server or API key.
License
MIT.
Metadata
Release files for stratify-mcp 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| stratify_mcp-0.1.1.tar.gz | 12.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| stratify_mcp-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.1 kB
Release files / stratify_mcp-0.1.1.tar.gz
| Download URL | stratify_mcp-0.1.1.tar.gz |
|---|---|
| Size | 12.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a6b5504360a6ea1858c2483f7c3a6ddd2e79d90da200d3796853aef0d437160
|
|
BLAKE2b-256 checksum How to use checksums |
b99c511f6cfa450a6a44168b937bcde6dc6f57492dbbeec773fab59a96e669d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.
Transparency logRelease files / stratify_mcp-0.1.1-py3-none-any.whl
| Download URL | stratify_mcp-0.1.1-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f1f02572e607692362504b457871cff10a96b06b148073c4baf2b3e94978c1af
|
|
BLAKE2b-256 checksum How to use checksums |
d747cee8182c8ae46518c8b3a84d0d615521285722bbd4a541eb530be5719ca0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.
Transparency log