Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/soker90/finper/llms.txt

Use this file to discover all available pages before exploring further.

The Stocks API records individual portfolio movements — buys, sells, and dividends. There is no persistent aggregate: the portfolio summary is computed at runtime from all movements every time GET /api/stocks/summary is called.
There is no PUT endpoint. To correct a movement, delete it and recreate it with the correct values.

Movement types

ValueMeaning
buyPurchased shares — increases position
sellSold shares — decreases position
dividendCash dividend received — does not change share count

GET /api/stocks/summary

Return an aggregated view of the portfolio, calculated at runtime from all recorded movements. Groups by ticker and computes totals.
curl http://localhost:3008/api/stocks/summary \
  -H 'token: <your-jwt>'
Response 200
[
  {
    "ticker": "AAPL",
    "sharesHeld": 15,
    "totalInvested": 2850.00,
    "dividendsReceived": 42.50,
    "platform": "Interactive Brokers"
  }
]
ticker
string
Stock ticker symbol (always uppercase).
sharesHeld
number
Net shares currently held (buys minus sells).
totalInvested
number
Total capital deployed in buy orders.
dividendsReceived
number
Total dividends received across all recorded dividend movements.

GET /api/stocks

List all individual stock movements for the authenticated user.
curl http://localhost:3008/api/stocks \
  -H 'token: <your-jwt>'
Response 200
[
  {
    "_id": "67a1d...",
    "ticker": "AAPL",
    "name": "Apple Inc.",
    "shares": 5,
    "price": 190.00,
    "type": "buy",
    "date": 1704067200000,
    "platform": "Interactive Brokers",
    "user": "alice"
  }
]

POST /api/stocks

Record a new stock movement.
ticker
string
required
Ticker symbol (automatically uppercased, e.g. "AAPL", "MSFT").
name
string
required
Full company name (e.g. "Apple Inc.").
shares
number
required
Number of shares involved. Must be positive.
price
number
required
Price per share at the time of the movement. Must be ≥ 0.
type
string
required
Movement type: buy, sell, or dividend.
date
number
required
Date of the movement as a Unix timestamp (ms).
platform
string
required
Broker or platform where the movement occurred (e.g. "Interactive Brokers", "Degiro").
curl -X POST http://localhost:3008/api/stocks \
  -H 'token: <your-jwt>' \
  -H 'Content-Type: application/json' \
  -d '{
    "ticker": "AAPL",
    "name": "Apple Inc.",
    "shares": 5,
    "price": 190.00,
    "type": "buy",
    "date": 1704067200000,
    "platform": "Interactive Brokers"
  }'
Response 201 — the created movement object.

DELETE /api/stocks/:id

Delete a stock movement. The portfolio summary recalculates automatically on the next GET /api/stocks/summary call.
id
string
required
Stock movement ID.
curl -X DELETE http://localhost:3008/api/stocks/67a1d... \
  -H 'token: <your-jwt>'
Response 204 — no content.

Build docs developers (and LLMs) love