# Portfolio Builder

> A hidden robo-advisor mode that produces a full allocation plan from seven inputs. Click the Scout logo in the TUI to unlock it.

Source: https://finnyai.tech/docs/portfolio-builder

> **How to find it**: Click the Scout logo to unlock the Portfolio Builder. It's intentionally off-the-main-flow, strategy generation is Scout's primary use case; this is the portfolio counterpart.

## The seven inputs

| Parameter | Options |
|-----------|---------|
| Funds | $1K – $250K |
| Currency | CAD, USD, EUR |
| Account | TFSA, RRSP, Non-registered, Other |
| Horizon | 1y – 10y+ |
| Risk | Conservative, Balanced, Growth, Aggressive |
| Universe | Stocks, ETFs, Crypto, Bonds |
| Geography | Global, North America, Canada-heavy |

## What it outputs

A markdown allocation plan with two layers: a top-level sleeve breakdown (equities / fixed income / crypto / cash), then concrete tickers with weight, dollar amount, sector, region, and a short per-pick rationale.

## TFSA-aware rules

- **US-listed equities**: Flagged for the 15% withholding tax on dividends inside a TFSA, the Canada–US tax treaty doesn't apply.
- **US-listed REITs**: Avoided in TFSAs, the full distribution is taxed as ordinary income at source.
- **No day-trading suggestions**: Frequent intraday turnover inside a TFSA risks CRA reclassification as business income, defeating the tax shelter.
- **Contribution room mention**: Recommendations call out the contribution-room concept so allocations stay within the user's available headroom.

## Portfolio backtest

After the plan is delivered, the agent offers to backtest it. The `finny_portfolio_backtest` tool:

- Accepts ticker + weight pairs (max 50 tickers, weights must sum to ~1.0).
- Fetches historical prices via yfinance.
- Auto-detects the listing currency per ticker (e.g. `VFV.TO` in CAD, `VOO` in USD).
- Auto-FX-converts mixed-currency portfolios into the target currency before computing returns.
- Simulates buy-and-hold or periodic rebalancing, `none`, `monthly`, `quarterly`, or `yearly`.
- Returns CAGR, Sharpe, max drawdown, annualized vol, and per-ticker contribution + PnL.
- Derives the annualization factor from the actual sampling frequency, 252 for equities, ~365 for crypto, blended for mixed.

### Example payload

```json
{
  "holdings": [
    {"ticker": "VFV.TO", "weight": 0.40},
    {"ticker": "XIC.TO", "weight": 0.20},
    {"ticker": "VEE.TO", "weight": 0.15},
    {"ticker": "BTC-USD", "weight": 0.10},
    {"ticker": "ZAG.TO", "weight": 0.15}
  ],
  "target_currency": "CAD",
  "start": "2020-01-01",
  "end": "2025-01-01",
  "rebalance": "quarterly"
}
```
