API & MCP
Everything a person can do on RavingDesk Paper Portfolio & Exposure, a program or AI agent can do with the same inputs and get the identical result.
HTTP API
POST https://ravingdeskpaperportfolio.usefulweb.site/api/v1/calculate– run RavingDesk Paper Portfolio & ExposureGET https://ravingdeskpaperportfolio.usefulweb.site/api/v1/tool– inputs, output schema, examples- OpenAPI 3.1: /openapi.json · /openapi.yaml
- Errors:
application/problem+json;422includes per-fielderrors.
RavingDesk Paper Portfolio & Exposure
Replays a list of paper fills (buys and sells, long and short) with weighted-average cost, then values the open positions at the marks you supply: cash, equity, realized and unrealized profit or loss, long/short/gross/net exposure, concentration and the equity after a uniform price shock. Totals are withheld when a position has no mark. It is the ledger engine of the RavingDesk paper-trading workspace.
| Field | Type | Default | Description |
|---|---|---|---|
startingCash (required) | number | 100000 | Starting cash |
trades | table | — | Paper fills (in the order they happened) |
marks | table | — | Marks (your own current prices). One price per open symbol. Without a mark, equity and exposure totals are not calculated. |
shockPercent | number | -10 | Uniform price shock. Applied to every mark at once (sensitivity check, not a forecast). |
Example request
Fictional long and short with a partial close, −10 % shock
curl -X POST https://ravingdeskpaperportfolio.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"startingCash":100000,"trades":[{"symbol":"EXAMPLE-A","side":"buy","quantity":100,"price":50,"fee":2},{"symbol":"EXAMPLE-A","side":"sell","quantity":40,"price":56,"fee":2},{"symbol":"EXAMPLE-B","side":"sell","quantity":30,"price":120,"fee":3}],"marks":[{"symbol":"EXAMPLE-A","price":54},{"symbol":"EXAMPLE-B","price":112}],"shockPercent":-10}'
Every result contains
inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.
MCP (Model Context Protocol)
- Streamable HTTP endpoint:
https://ravingdeskpaperportfolio.usefulweb.site/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
ravingdesk_paper_portfolio - Local stdio connector:
node src/mcp-stdio.ts --tool=ravingdesk-paper-portfolio
{
"mcpServers": {
"ravingdesk-paper-portfolio": { "type": "http", "url": "https://ravingdeskpaperportfolio.usefulweb.site/mcp" }
}
}