# Portfolio Allocation Calculator

Paste holdings and calculate percentage allocation by asset class, holding, sector, or account with chart-ready values and concentration score.

## Run it

- **CLI:** `gizza tool portfolio-allocation "Name, Value, Asset, Sector, Account
AAPL, 6000, Stocks, Technology, Brokerage
BND, 3000, Bonds, Bonds, IRA
Cash, 1000, Cash, Cash, Savings"`
- **Web:** https://gizza.ai/tools/portfolio-allocation/
- **Agents:** machine-readable descriptor (parameters JSON Schema) at https://gizza.ai/tools/portfolio-allocation/tool.json

## Inputs

- `input` — Holdings _(field)_
- `group_by` — Group by _(field)_
- `sort` — Sort _(field)_
- `top_n` — Top N slices _(field)_
- `currency` — Currency prefix _(field)_

## Output

- Allocation table (text)

## Query parameters

Open the tool pre-filled and auto-run via URL:

- `input` — Holdings
- `group_by` — Group by
- `sort` — Sort
- `top_n` — Top N slices
- `currency` — Currency prefix

Example: `https://gizza.ai/tools/portfolio-allocation/?input=Name%2C%20Value%2C%20Asset%2C%20Sector%2C%20Account%0AAAPL%2C%206000%2C%20Stocks%2C%20Technology%2C%20Brokerage%0ABND%2C%203000%2C%20Bonds%2C%20Bonds%2C%20IRA%0ACash%2C%201000%2C%20Cash%2C%20Cash%2C%20Savings&group_by=asset&sort=value&top_n=0&currency=%24`

---

## What this tool does

Portfolio allocation is the percentage split of your holdings: how much sits in stocks, bonds, cash, one sector, one account, or one oversized position. Paste rows from a broker export or spreadsheet and this tool groups the values, calculates each slice's percent of the total, and returns a chart-ready table with proportional bars.

The conversion runs locally in WebAssembly. Nothing is uploaded, and the output is plain text you can paste into a report, spreadsheet, or charting tool.

## Input format

Use CSV or tab-separated rows. A header row is allowed and skipped automatically:

```text
Name, Value, Asset, Sector, Account
AAPL, 6000, Stocks, Technology, Brokerage
BND, 3000, Bonds, Bonds, IRA
Cash, 1000, Cash, Cash, Savings
```

Columns after value are optional. If you group by a missing field, the holding lands in `(unspecified)`.

Values can be plain numbers, currency amounts, accounting negatives, or a quick shares-at-price expression:

- `6000`
- `$1,234.50` (tab-separated rows work best when using thousands commas)
- `(500)` for a negative value
- `10 @ 150` or `10 x 150` for shares times price

## Options

| Option | Choices | What it does |
| --- | --- | --- |
| **Group by** | `asset` (default), `holding`, `sector`, `account` | Chooses the allocation dimension. |
| **Sort** | `value` (default), `label` | Sorts largest-first or alphabetically. Top-N is applied before label sorting. |
| **Top N slices** | `0` to `1000` | Use `0` to show everything, or keep the biggest N slices and fold the rest into `Other`. |
| **Currency prefix** | `$`, `€`, `£`, `USD`, blank | Prefix shown before values in the output table. |

## Example

With this input:

```text
Name, Value, Asset, Sector, Account
AAPL, 6000, Stocks, Technology, Brokerage
BND, 3000, Bonds, Bonds, IRA
Cash, 1000, Cash, Cash, Savings
```

Grouped by **asset**, the output starts:

```text
Allocation by asset class — $10,000.00 total across 3 holdings

Stocks  $6,000.00   60.00%  ██████████████··········  (1 holding)
Bonds   $3,000.00   30.00%  ███████·················  (1 holding)
Cash    $1,000.00   10.00%  ██······················  (1 holding)
```

## FAQ

<details>
<summary>Is this financial advice?</summary>

No. It only calculates percentages from numbers you provide. It does not recommend trades, target allocations, or investments.

</details>

<details>
<summary>Can I paste a brokerage CSV export?</summary>

Yes, if you reduce it to the columns this tool expects: name, value, and optional asset, sector, and account. A spreadsheet copy-paste with tabs works well, especially for values that contain comma thousands separators.

</details>

<details>
<summary>What does Top N do?</summary>

Top N keeps the largest slices and folds the rest into an `Other` row. That is useful for charting a portfolio with many small positions while keeping the chart readable.

</details>

<details>
<summary>What is the concentration score?</summary>

The HHI score squares each slice's percentage and sums the result. Higher numbers mean more concentration. The tool labels the score as well diversified, moderately concentrated, or highly concentrated.

</details>

<details>
<summary>What are the limits?</summary>

The tool accepts up to 5 MB of pasted text and 100,000 holdings. It does not fetch live prices, identify tickers, infer sectors automatically, or connect to brokerage accounts.

</details>

## Related tools

- [Adjacency Matrix Converter](https://gizza.ai/tools/adjacency-matrix-converter/): Convert a graph between edge list, adjacency matrix, and incidence matrix — directed or undirected, weighted or not. Free, private, runs in your browser.
- [Amazon Order Analyzer](https://gizza.ai/tools/amazon-order-analyzer/): Paste an Amazon order-history CSV export to summarize total spend by month, top items, and category breakdowns. Browser-only, private, with Markdown or JSON output.
- [Avro to JSON Converter](https://gizza.ai/tools/avro-to-json/): Decode Apache Avro Object Container Files (.avro / OCF) to JSON, NDJSON, or the embedded schema — no .avsc needed, free and private in your browser.
- [Reconcile bank statement and ledger CSVs](https://gizza.ai/tools/bank-statement-reconcile/): Match bank-statement CSV rows to ledger rows by date, signed amount, and fuzzy memo similarity, with unmatched and suggested matches.
- [Base64 ⇄ Base64url Converter](https://gizza.ai/tools/base64url-converter/): Convert standard Base64 to URL-safe Base64url and back in your browser — swaps +/ for -_, handles = padding, auto-detects direction. Free, private, no sign-up.
