Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.simplefunctions.dev/llms.txt

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

Portfolio endpoints are authenticated and scoped to the current user. Use these endpoints when an application or agent needs the same data exposed by sf portfolio.

Start here

curl -H "Authorization: Bearer $SF_API_KEY" \
  "https://simplefunctions.dev/api/portfolio/state"

curl -H "Authorization: Bearer $SF_API_KEY" \
  "https://simplefunctions.dev/api/portfolio/ticks?limit=5&envelope=true"

curl -H "Authorization: Bearer $SF_API_KEY" \
  "https://simplefunctions.dev/api/portfolio/trades?status=open&limit=20&envelope=true"

State

GET /api/portfolio/state
PUT /api/portfolio/state
GET returns the current portfolio state row or null. Use state for current balances, portfolio value, exposure, realized PnL, unrealized PnL, drawdown, open-position count, and latest tick time.

Config

GET /api/portfolio/config
PUT /api/portfolio/config
Config stores risk gates, execution mode, schedule, and portfolio-manager preferences. Example update:
curl -X PUT "https://simplefunctions.dev/api/portfolio/config" \
  -H "Authorization: Bearer $SF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "enabled": true, "executionMode": "dry-run", "maxPositions": 20 }'

Ticks

GET /api/portfolio/ticks
GET /api/portfolio/ticks/{id}
POST /api/portfolio/ticks
List query parameters:
ParameterDescription
limitMaximum rows, default 20
sinceStart timestamp
untilEnd timestamp
cursorCursor from a prior response
envelope=trueReturn { data, pageInfo } instead of the raw list
Example:
curl -H "Authorization: Bearer $SF_API_KEY" \
  "https://simplefunctions.dev/api/portfolio/ticks?limit=20&since=2026-04-01T00:00:00.000Z&envelope=true"
Ticks are portfolio-manager evaluation records. They can include timing, action summaries, risk gates, trace ids, and handoff notes.

Trades

GET /api/portfolio/trades
GET /api/portfolio/trades/{id}
POST /api/portfolio/trades
List query parameters:
ParameterDescription
limitMaximum rows, default 50
statusopen or closed
sinceStart timestamp
untilEnd timestamp
cursorCursor from a prior response
tickerFilter by ticker
thesisIdFilter by thesis id
envelope=trueReturn { data, pageInfo } instead of the raw list
Example:
curl -H "Authorization: Bearer $SF_API_KEY" \
  "https://simplefunctions.dev/api/portfolio/trades?status=open&ticker=KXRATECUT-26DEC31&limit=20&envelope=true"
Trades include direction, quantity, opened/closed timestamps, entry/exit prices, PnL fields, and attribution fields when available.

Views

GET /api/portfolio/views
POST /api/portfolio/views
PUT /api/portfolio/views
DELETE /api/portfolio/views
Views are the user’s convictions and market notes. Create a view:
curl -X POST "https://simplefunctions.dev/api/portfolio/views" \
  -H "Authorization: Bearer $SF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Rates cut view",
    "viewText": "Fed cut odds look too high into the next meeting.",
    "category": "macro",
    "tickers": ["KXRATECUT-26DEC31"],
    "conviction": 4
  }'
Update or delete with an id in the request body.

Strategy

GET /api/portfolio/strategy
POST /api/portfolio/strategy
PUT /api/portfolio/strategy
DELETE /api/portfolio/strategy
Strategies are persistent instructions and constraints for the portfolio manager. Create a strategy:
curl -X POST "https://simplefunctions.dev/api/portfolio/strategy" \
  -H "Authorization: Bearer $SF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Rates discipline",
    "description": "Keep exposure small around FOMC.",
    "priority": 2
  }'
Update or delete with an id in the request body.

Secrets

POST /api/portfolio/secrets
DELETE /api/portfolio/secrets
Secrets are used by the cloud portfolio manager. The endpoint stores encrypted exchange credentials for the authenticated user.
curl -X POST "https://simplefunctions.dev/api/portfolio/secrets" \
  -H "Authorization: Bearer $SF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "kalshiKeyId": "key-id", "privateKeyPem": "-----BEGIN PRIVATE KEY-----..." }'
Use DELETE to remove cloud credentials.

Trigger

POST /api/portfolio/trigger
Runs a cloud portfolio tick for the authenticated user.
curl -X POST "https://simplefunctions.dev/api/portfolio/trigger" \
  -H "Authorization: Bearer $SF_API_KEY"

CLI equivalents

sf portfolio status --json
sf portfolio history --json --ticks 5 --trades 10
sf portfolio tick <id> --json
sf portfolio trade <id> --json
sf portfolio view list --json
sf portfolio strategy list --json
sf portfolio trigger