TradingAgents/tradingagents/portfolio
google-labs-jules[bot] 7ab7cd7591 perf: lazy load json parsing in PortfolioSnapshot
This commit optimizes `PortfolioSnapshot` instantiation when loaded from the DB or JSON dictionaries by removing the immediate `json.loads(holdings_snapshot)` parsing inside the `from_dict` constructor. Instead, it overrides `__getattribute__` to implement a lazy-loading pattern, where the `holdings_snapshot` string is only parsed into a Python dictionary the very first time the field is accessed.

    This optimization ensures that parsing large JSON payloads doesn't block the instantiation of snapshots, which is particularly beneficial in workflows that load a large historical series of snapshots but never access their `holdings_snapshot` field.

Co-authored-by: aguzererler <6199053+aguzererler@users.noreply.github.com>
2026-03-21 08:32:52 +00:00
..
migrations feat: implement Portfolio models, ReportStore, and tests; fix SQL constraint 2026-03-20 11:16:39 +00:00
__init__.py Merge branch 'main' into copilot/refactor-agent-workflows-and-risk-metrics 2026-03-21 02:30:18 +01:00
candidate_prioritizer.py Implement Portfolio Manager Phases 2-5: risk evaluation, candidate prioritization, holding reviewer agent, PM decision agent, trade executor, and portfolio graph orchestration 2026-03-20 14:44:22 +00:00
config.py feat: complete portfolio data foundation — psycopg2 client, repository, tests 2026-03-20 14:06:50 +01:00
exceptions.py feat: portfolio manager data foundation — docs, SQL migration, and module scaffolding 2026-03-20 10:40:48 +00:00
models.py perf: lazy load json parsing in PortfolioSnapshot 2026-03-21 08:32:52 +00:00
portfolio_states.py feat: Portfolio Manager Phases 2-5 — risk evaluation, candidate prioritization, LLM agents, trade executor 2026-03-20 14:38:48 +00:00
report_store.py feat: implement Portfolio models, ReportStore, and tests; fix SQL constraint 2026-03-20 11:16:39 +00:00
repository.py feat: complete portfolio data foundation — psycopg2 client, repository, tests 2026-03-20 14:06:50 +01:00
risk_evaluator.py Implement Portfolio Manager Phases 2-5: risk evaluation, candidate prioritization, holding reviewer agent, PM decision agent, trade executor, and portfolio graph orchestration 2026-03-20 14:44:22 +00:00
risk_metrics.py feat: add portfolio risk metrics module and LangChain agent tools 2026-03-20 14:42:43 +00:00
supabase_client.py feat: complete portfolio data foundation — psycopg2 client, repository, tests 2026-03-20 14:06:50 +01:00
trade_executor.py Implement Portfolio Manager Phases 2-5: risk evaluation, candidate prioritization, holding reviewer agent, PM decision agent, trade executor, and portfolio graph orchestration 2026-03-20 14:44:22 +00:00