RavingDesk Paper Portfolio & Exposure
Turn paper fills and your own marks into positions, P&L, exposure and a price-shock check.
Try an example: Fictional long and short with a partial close, −10 % shock · Reversal from long to short in one fill · Missing mark: totals withheld
How it works
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.
- Fills are replayed in the order given. Adding to a position updates the weighted-average entry; reducing it realizes (exit − average entry) × quantity for longs and the reverse for shorts, minus the proportional entry fee and the exit fee.
- A fill larger than the open position closes it and opens the remainder in the other direction at the fill price.
- Cash = starting cash − buys + sells − fees (short sales add cash; negative cash is allowed, no margin checks). Equity = cash + quantity × mark of every open position.
- Exposure: long = sum of long market values, short = sum of absolute short market values, gross = long + short, net = long − short; concentration is the largest position’s share of gross. Ratios to equity are only shown when equity is positive.
- If any open position lacks a mark, equity, unrealized P&L, exposure and the shock are withheld instead of being calculated from partial data.
- The price shock multiplies every mark by (1 + shock %), floored at zero, and recalculates equity.
Paper-trading calculation for education and planning only. It is not investment, tax or legal advice, uses only the numbers you enter and never places an order.
Part of RavingDesk
-
RavingDesk Paper trading workspace
Practise trading on paper: orders, ledger, risk, exposure and journal. No real money.
Related tools
- RavingDesk Position Size & Risk Planner – Size a long or short paper trade from your risk budget, stop, target and round-trip fee.
- Percentage & Ratio Calculator – X% of Y, % change, reverse %, percentage points, ratios and aspect ratios, with formulas.
How to use the RavingDesk Paper Portfolio & Exposure tool
Replay paper fills into positions, cash and P&L, value them at your own marks, and check exposure and a uniform price shock.
What it is for
When you practise trading on paper, the hard part is not the idea but the bookkeeping: what is the average entry after adding to a position, how much did a partial close realize, and what is the account worth right now? This tool does that bookkeeping from a plain list of fills.
You enter starting cash, the fills in the order they happened (symbol, buy or sell, quantity, price, fee), one mark per open symbol, and a price shock in percent. You get cash, paper equity, realized and unrealized profit or loss, every open position, long/short/gross/net exposure, the largest position's share and the equity after the shock.
It is the ledger engine of the RavingDesk workspace. Marks are your own prices; nothing is fetched and nothing is traded.
Worked example
Starting cash 20,000. You buy 50 ALPHA at 40 (fee 2), sell short 20 BETA at 75 (fee 2), then buy another 50 ALPHA at 44 (fee 2). Your marks are ALPHA 43 and BETA 80, and you test a −20 % shock.
| Result | Value |
|---|---|
| Paper equity | 19,994.00 |
| Cash | 17,294.00 |
| Realized P&L | 0.00 |
| Unrealized P&L | −6.00 |
| Gross exposure | 5,900.00 |
| Net exposure | +2,700.00 |
| Equity after a −20 % shock | 19,454.00 (−540.00) |
ALPHA is now 100 units at a weighted average of 42; at 43 it shows +96.00 after its entry fees. BETA is short 20 from 75 and the price rose to 80, so it shows −102.00. Together the account is 6 below the starting cash.
Gross exposure is 4,300 long plus 1,600 short; net is the difference, 2,700. ALPHA holds 72.88 % of gross. In the shock every mark falls by 20 %: the long loses 860 and the short gains 320, so equity drops by 540.
How to read the result
- Paper equity = cash + quantity × mark of every open position. A short has a negative market value.
- Realized P&L comes only from closed quantities, with the proportional entry fee and the exit fee.
- Unrealized P&L is the open part at your marks, after the entry fees still attached to the position.
- Exposure shows how much is at stake, not risk or margin. Ratios to equity appear only when equity is positive.
- Equity after a shock moves every mark by the same percentage. It is a sensitivity check, not a forecast.
Tips and common mistakes
- Enter fills in the order they happened. They are replayed in list order, not by date.
- A sell larger than the open long closes it and opens a short with the rest; the reversal example turns 10 long into 15 short.
- Give every open symbol a mark. If one is missing — as in the Missing mark example — equity, unrealized P&L, exposure and the shock are withheld instead of being calculated from partial data.
- Symbols are compared in upper case, so two marks for
abcandABCare refused. - Negative cash is allowed and flagged: the fills would need borrowing that is not modeled.
FAQ
Which cost method does it use?
Weighted-average cost per symbol in one account currency.
Are dividends, borrow fees or taxes included?
No. Only the fills, fees and marks you enter are used.
Where do the marks come from?
From you. In the RavingDesk workspace each mark carries a source name and date so you can see where it came from.
Can a script or AI agent use it?
Yes, through POST /api/v1/tools/ravingdesk-paper-portfolio/calculate or the MCP server; the workspace shows a request body built from your desk.
Guide last updated:
For scripts and AI agents
- JSON API:
POST https://ravingdeskpaperportfolio.usefulweb.site/api/v1/calculate(same calculation as this page) - Interface description: OpenAPI 3.1 · AI guide: llms.txt
- MCP server (Streamable HTTP):
https://ravingdeskpaperportfolio.usefulweb.site/mcp· tool nameravingdesk_paper_portfolio
Example request
curl -s -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}'