How gitiann/topological-portfolio-analysis works
Toporisk computes per-asset topological risk from price returns, then uses those risks to construct a long-only minimum-risk portfolio. The main workflow runs through the CLI; the README also describes plotting landscapes and comparing topological risk with volatility. Portfolio performance evaluation is explicitly outside the project’s scope. Relationships follow the sampled CLI and risk implementations and README documentation; no unsampled source behavior is assumed.
Main entry points: cli.py Build CLI · risk.py Asset risk and matrix · topology.py H0 persistence · viz.py Portfolio and landscape plots
Components 11
Market data
- Price and returns
src/toporisk/data.py
Topology analysis
- Windows and embedding
src/toporisk/embedding.py - H0 persistence
src/toporisk/topology.py - Persistence landscapes
src/toporisk/landscape.py
Risk calculation
- Asset risk and matrix
src/toporisk/risk.py
Portfolio construction
- Risk optimizer
src/toporisk/portfolio.py
Results and plots
- Build CLI
src/toporisk/cli.py - Portfolio and landscape plots
src/toporisk/viz.py
Other components
- Analyst
- Weights and charts
- Gudhi library
Connections 11
- Analyst → Build CLI: runs build
README.md - Build CLI → Price and returns: loads prices and returns
src/toporisk/cli.py - Build CLI → Asset risk and matrix: computes asset risks
src/toporisk/cli.py - Build CLI → Risk optimizer: optimizes weights
src/toporisk/cli.py - Build CLI → Portfolio and landscape plots: plots weights
src/toporisk/cli.py - Build CLI → Weights and charts: prints or saves
src/toporisk/cli.py - Asset risk and matrix → Windows and embedding: windows and embeds
src/toporisk/risk.py - Asset risk and matrix → H0 persistence: computes H0 diagrams
src/toporisk/risk.py - Asset risk and matrix → Persistence landscapes: builds and norms landscapes
src/toporisk/risk.py - H0 persistence → Gudhi library: builds Rips filtration
src/toporisk/topology.py - Portfolio and landscape plots → Weights and charts: renders charts
README.md