How user-account-hub/ki-portfolio-studie works
This repository is a Claude-assisted paper-trading case study, not a live-money trading product. Its main workflow loads portfolio and market context, requests and validates a proposed decision, applies server-side sizing and risk checks before paper execution, then reconstructs performance and writes a report. The README also documents on-demand stress testing and monthly deep reflection. Connections follow the README and supplied source excerpts/index; unsampled implementation details are not inferred beyond those references.
Main entry points: pipeline.py Run pipeline · execution.py Execution orchestrator · db.py SQLite access · data_fetch.py Market data
Components 25
Run orchestration
- Run pipeline
src/pipeline.py - Configuration
src/config.py
Decision context
- Market data
src/data_fetch.py - Fundamentals
src/fundamentals.py - Event calendar
src/event_calendar.py - News feeds
src/news_feed.py - Market phase
src/market_phase.py - Prompt builder
src/prompt_builder.py
Order governance
- Decision parser
src/order_schema.py - Position sizing
src/position_sizing.py - Risk guardrails
src/risk_guardrails.py
Portfolio trading
- Execution orchestrator
src/execution.py - Portfolio database
db/portfolio.db - SQLite access
src/db.py - Boundary tracking
src/boundary_conditions.py - Correlation review
src/correlation.py
Review and reporting
- Data quality
src/data_quality.py - Deep reflection
src/deep_reflection_prompt.py - Historical stress test
src/stress_test.py - Performance metrics
src/metrics.py - Markdown reporting
src/reporting.py
Other components
- Scheduled run
- Claude API
- Alpaca paper API
- Market data provider
Connections 28
- Scheduled run → Run pipeline: triggers
README.md - Run pipeline → Configuration: loads settings
src/pipeline.py - Run pipeline → Market data: fetches prices
src/pipeline.py - Market data → Market data provider: retrieves data
src/data_fetch.py - Run pipeline → Fundamentals: loads context
src/pipeline.py - Run pipeline → Event calendar: loads events
src/pipeline.py - Run pipeline → News feeds: loads news
src/pipeline.py - Run pipeline → Market phase: classifies market
src/pipeline.py - Run pipeline → Prompt builder: builds prompt
src/pipeline.py - Prompt builder → Claude API: provides context
README.md - Run pipeline → Claude API: requests decision
src/pipeline.py - Claude API → Run pipeline: returns response
README.md - Run pipeline → Decision parser: parses response
src/pipeline.py - Run pipeline → Execution orchestrator: submits orders
src/pipeline.py - Execution orchestrator → Position sizing: scales orders
src/execution.py - Execution orchestrator → Risk guardrails: checks orders
src/execution.py - Execution orchestrator → Alpaca paper API: places paper orders
README.md - Execution orchestrator → SQLite access: updates records
src/execution.py - SQLite access → Portfolio database: reads and writes
src/db.py - Execution orchestrator → Correlation review: checks correlation
src/execution.py - Execution orchestrator → Market phase: compares phases
src/execution.py - Run pipeline → Boundary tracking: tracks conditions
src/pipeline.py - Run pipeline → Data quality: checks data
src/pipeline.py - Run pipeline → Deep reflection: runs reflection
src/pipeline.py - Run pipeline → Historical stress test: runs stress test
README.md - Run pipeline → Performance metrics: calculates metrics
src/pipeline.py - Performance metrics → SQLite access: reads portfolio history
src/metrics.py - Run pipeline → Markdown reporting: writes report
src/pipeline.py