> ## 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 CLI

> Read portfolio state, ticks, trades, views, strategies, and cloud manager state for the authenticated user.

Portfolio commands expose user-owned portfolio memory to agents and operators.

All reads are scoped to the authenticated user. The CLI redacts secrets and omits large handoff notes unless you ask for them.

## Start here

```bash theme={null}
sf portfolio status --json
sf portfolio history --json --ticks 5 --trades 10
sf portfolio last --json --include handoff
```

Use `status` for current state, `history` for recent ticks and trades, and `last` for the latest full portfolio-manager run.

## Read current state

```bash theme={null}
sf portfolio status --json
sf portfolio config --json
```

`status` returns current portfolio state plus selected risk settings.

```json theme={null}
{
  "ok": true,
  "command": "portfolio.status",
  "data": {
    "state": {
      "kalshiBalanceCents": 100000,
      "kalshiPortfolioValueCents": 120000,
      "totalExposureCents": 30000,
      "openPositionCount": 4,
      "lastTickAt": "2026-04-30T00:00:00.000Z"
    },
    "config": {
      "enabled": true,
      "executionMode": "dry-run",
      "maxPositions": 20,
      "sfApiKey": "[redacted]"
    }
  },
  "meta": {
    "scope": "user",
    "fetchedAt": "2026-04-30T00:00:00.000Z"
  }
}
```

Update one config value:

```bash theme={null}
sf portfolio config maxPositions 20
sf portfolio config executionMode dry-run
```

## Read portfolio memory

```bash theme={null}
sf portfolio history --json --ticks 5 --trades 10
sf portfolio history --json --since 2026-04-01 --until 2026-04-30
sf portfolio history --json --ticker KXRATECUT-26DEC31
sf portfolio history --json --status open
sf portfolio history --json --cursor <cursor>
```

`history` returns two lists:

* `ticks`: portfolio-manager evaluation runs
* `trades`: user-scoped portfolio trade records

List mode omits full handoff notes by default. Include them only when an agent needs the full run memory:

```bash theme={null}
sf portfolio history --json --ticks 3 --trades 0 --include handoff
```

## Read one tick or trade

```bash theme={null}
sf portfolio last --json
sf portfolio last --json --include handoff
sf portfolio tick <id> --json
sf portfolio tick <id> --json --include handoff
sf portfolio trade <id> --json
```

Use `last` when an agent wants the latest portfolio-manager handoff. Use `tick <id>` or `trade <id>` when the agent already has an id from `history`.

## Views

Views are your current market convictions. They are not public theses; they are instructions and context for the portfolio manager.

```bash theme={null}
sf portfolio view list --json
sf portfolio view add "Rates cut view" "Fed cut odds look too high" --category macro --tickers KXRATECUT-26DEC31 --conviction 4
sf portfolio view remove <id>
```

Useful fields:

| Field         | Meaning                                                  |
| ------------- | -------------------------------------------------------- |
| `title`       | Short name for the view                                  |
| `viewText`    | Your reasoning or instruction                            |
| `category`    | Macro, crypto, policy, geopolitical, or another grouping |
| `tickers`     | Related market tickers                                   |
| `conviction`  | 1-5 signal strength                                      |
| `timeHorizon` | Optional date horizon                                    |

## Strategies

Strategies are persistent instructions for how the portfolio manager should behave.

```bash theme={null}
sf portfolio strategy list --json
sf portfolio strategy add "Rates discipline" "Keep exposure small around FOMC" --priority 2
sf portfolio strategy remove <id>
```

Use views for what you believe. Use strategies for how the manager should act.

## Run or trigger analysis

Run one local portfolio tick:

```bash theme={null}
sf portfolio watch --once --dry-run
```

Run continuously:

```bash theme={null}
sf portfolio watch --dry-run --interval 720
```

Trigger the cloud portfolio manager:

```bash theme={null}
sf portfolio trigger
```

`--dry-run` is the default for local watch. `--live` opts into actual order placement and requires trading credentials.

## Enable cloud manager

```bash theme={null}
sf portfolio enable
sf portfolio disable
sf portfolio revoke
```

`enable` uploads encrypted exchange credentials, configures a schedule, and stores portfolio-manager settings.

`disable` stops the cloud manager but keeps credentials.

`revoke` stops the manager and deletes cloud credentials.

## JSON output

Agents should pass `--json` whenever available.

The portfolio JSON envelope usually includes:

```json theme={null}
{
  "ok": true,
  "command": "portfolio.history",
  "data": {
    "ticks": [],
    "trades": []
  },
  "meta": {
    "scope": "user",
    "fetchedAt": "2026-04-30T00:00:00.000Z",
    "pageInfo": {
      "ticks": { "nextCursor": null, "hasMore": false },
      "trades": { "nextCursor": null, "hasMore": false }
    }
  }
}
```

Do not scrape human terminal output. Use `--json` and parse the envelope.

## Next

<CardGroup cols={2}>
  <Card title="Portfolio API" href="/api-reference/portfolio">
    REST endpoints behind portfolio state, ticks, trades, views, strategies, and trigger.
  </Card>

  <Card title="Portfolio Autopilot" href="/guides/portfolio-autopilot">
    How views, strategies, risk gates, ticks, and handoffs fit together.
  </Card>
</CardGroup>
