# oolallal/pocket-hedge-v1 architecture

> Architecture diagram of the GitHub repository oolallal/pocket-hedge-v1, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/oolallal/pocket-hedge-v1
- Repository: https://github.com/oolallal/pocket-hedge-v1

## Overview

Pocket Hedge v1 is a browser-based portfolio risk analyzer. Users provide equity symbols and weights, then the app obtains benchmark and equity price data, prepares aligned log returns, calculates portfolio risk metrics, and displays the results as JSON. The README documents local benchmark caching and the supported metrics, but no source excerpts were available; the graph therefore shows only documented relationships and does not infer implementation details within the HTML file.

Main entry points: [`pocket-hedge-v1.html`](https://github.com/oolallal/pocket-hedge-v1/blob/main/pocket-hedge-v1.html) (Benchmark loading)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Portfolio inputs"]
  node_portfolio["Symbols and weights"]
end

subgraph group_data["Market data"]
  node_benchmark["Benchmark loading"]
  node_cache[("Benchmark cache")]
  node_stooq["Stooq CSV"]
  node_prices["Equity price loading"]
end

subgraph group_analysis["Risk analysis"]
  node_returns["Aligned log returns"]
  node_metrics["Risk metrics"]
  node_results["JSON results"]
end

node_user(("Portfolio user"))

node_user -->|"enters portfolio"| node_portfolio
node_portfolio -->|"starts analysis"| node_benchmark
node_benchmark -->|"uses cache"| node_cache
node_benchmark -->|"loads benchmark"| node_stooq
node_portfolio -->|"requests symbols"| node_prices
node_prices -->|"fetches prices"| node_stooq
node_benchmark -->|"provides benchmark data"| node_returns
node_prices -->|"provides prices"| node_returns
node_returns -->|"feeds calculations"| node_metrics
node_metrics -->|"displays metrics"| node_results

click node_portfolio "https://github.com/oolallal/pocket-hedge-v1/blob/main/pocket-hedge-v1.html"
click node_benchmark "https://github.com/oolallal/pocket-hedge-v1/blob/main/pocket-hedge-v1.html"
click node_prices "https://github.com/oolallal/pocket-hedge-v1/blob/main/pocket-hedge-v1.html"
click node_returns "https://github.com/oolallal/pocket-hedge-v1/blob/main/pocket-hedge-v1.html"
click node_metrics "https://github.com/oolallal/pocket-hedge-v1/blob/main/pocket-hedge-v1.html"
click node_results "https://github.com/oolallal/pocket-hedge-v1/blob/main/pocket-hedge-v1.html"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_portfolio,node_user toneBlue
class node_benchmark,node_cache,node_stooq,node_prices toneAmber
class node_returns,node_metrics,node_results toneMint
```

## Components

### Portfolio inputs

- [Symbols and weights](https://github.com/oolallal/pocket-hedge-v1/blob/main/pocket-hedge-v1.html): `pocket-hedge-v1.html`

### Market data

- [Benchmark loading](https://github.com/oolallal/pocket-hedge-v1/blob/main/pocket-hedge-v1.html): `pocket-hedge-v1.html`
- **Benchmark cache**
- **Stooq CSV**
- [Equity price loading](https://github.com/oolallal/pocket-hedge-v1/blob/main/pocket-hedge-v1.html): `pocket-hedge-v1.html`

### Risk analysis

- [Aligned log returns](https://github.com/oolallal/pocket-hedge-v1/blob/main/pocket-hedge-v1.html): `pocket-hedge-v1.html`
- [Risk metrics](https://github.com/oolallal/pocket-hedge-v1/blob/main/pocket-hedge-v1.html): `pocket-hedge-v1.html`
- [JSON results](https://github.com/oolallal/pocket-hedge-v1/blob/main/pocket-hedge-v1.html): `pocket-hedge-v1.html`

### Other components

- **Portfolio user**

## Connections

- Portfolio user → Symbols and weights: enters portfolio (evidence: `README.md`)
- Symbols and weights → Benchmark loading: starts analysis (evidence: `README.md`)
- Benchmark loading → Benchmark cache: uses cache (evidence: `README.md`)
- Benchmark loading → Stooq CSV: loads benchmark (evidence: `README.md`)
- Symbols and weights → Equity price loading: requests symbols (evidence: `README.md`)
- Equity price loading → Stooq CSV: fetches prices (evidence: `README.md`)
- Benchmark loading → Aligned log returns: provides benchmark data (evidence: `README.md`)
- Equity price loading → Aligned log returns: provides prices (evidence: `README.md`)
- Aligned log returns → Risk metrics: feeds calculations (evidence: `README.md`)
- Risk metrics → JSON results: displays metrics (evidence: `README.md`)
