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

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.

Inputs of RavingDesk Paper Portfolio & Exposure
FieldTypeDefaultDescription
startingCash (required)number100000Starting cash
tradestable—Paper fills (in the order they happened)
markstable—Marks (your own current prices). One price per open symbol. Without a mark, equity and exposure totals are not calculated.
shockPercentnumber-10Uniform 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)

{
  "mcpServers": {
    "ravingdesk-paper-portfolio": { "type": "http", "url": "https://ravingdeskpaperportfolio.usefulweb.site/mcp" }
  }
}