> For the complete documentation index, see [llms.txt](https://bubblegum-reality.gitbook.io/bubblegum-reality-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bubblegum-reality.gitbook.io/bubblegum-reality-docs/architecture/portfolio.md).

# Portfolio & Concentration

`/portfolio` reads real balances on chain `4663` — no mocked positions.

## Read path

```
getPortfolio({ address })       src/lib/portfolio.functions.ts (Zod: 0x-address)
        ▼
loadPortfolio()                src/lib/portfolio.server.ts
        │ Multicall3 balanceOf across the canonical stock-token registry
        │ native ETH + USDG cash balance
        │ multiplier-adjusted reference prices
        ▼
summarizePortfolio()           src/lib/portfolio.ts (pure, tested)
```

Batched reads go through Multicall3 at `0xcA11bde05977b3631167028862bE2a173976CA11`, wired into the chain config, so the whole registry costs one RPC round trip instead of one call per token.

## Metrics

| Metric              | Meaning                                                      |
| ------------------- | ------------------------------------------------------------ |
| Total value         | Sum of priced holdings plus cash                             |
| Position weights    | Share of total value per holding                             |
| Top weight / top-3  | Simple concentration read                                    |
| HHI                 | Herfindahl-Hirschman Index over weights                      |
| Effective positions | `1 / HHI` — how diversified the book really is               |
| Risk band           | `diversified`, `moderate`, `concentrated`, `single-position` |

Halted or unpriced positions are **excluded from weights but still listed**, so a token that cannot be valued does not silently disappear from the book.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://bubblegum-reality.gitbook.io/bubblegum-reality-docs/architecture/portfolio.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
