{"repo": "arushsinghal/intelliquant", "files": {"README.md": {"fcb6276cecc29c7c042a3164c416ce5dca90b056": {"t": 1785747275.167712, "n": 12480, "h": "77d8b87430847030", "c": "### IntelliTrade: Multi-Agent Trading Floor (MCP-powered)\n\n[![Python](https://img.shields.io/badge/Python-3.12+-blue.svg)](https://www.python.org/)\n[![MCP](https://img.shields.io/badge/MCP-enabled-6f42c1.svg)](https://modelcontextprotocol.io/)\n[![SQLite](https://img.shields.io/badge/DB-SQLite-green.svg)](https://www.sqlite.org/)\n[![uv](https://img.shields.io/badge/Runner-uv-000.svg)](https://github.com/astral-sh/uv)\n\nIntelliTrade is a teaching and experimentation project that simulates a small trading floor of autonomous AI traders. Each trader is an agent that periodically researches markets, makes decisions, and executes trades against an on-disk account ledger. Agents access capabilities through Model Context Protocol (MCP) tools and services, including:\n\n- Accounts service for portfolio state and trade execution\n- Market data service (Polygon-based or a local fallback)\n- Push notifications for trade summaries\n- Research services (web fetch, search, and per-trader memory)\n\nUnder the hood, agents coordinate multiple MCP servers over stdio, log traces and events, and store durable state in SQLite.\n\n— If this helps you, please ⭐ the repo!\n\n### Table of Contents\n- Overview\n - Key Features\n - Why This Architecture\n - Project Structure\n - Deep Architecture Docs\n- Getting Started\n - Requirements\n - Environment Variables\n - Install\n - Quick Start Matrix\n - Initialize the Traders\n - Run the Trading Floor\n- Internals\n - How Pricing Works\n - Data Storage\n - Architecture Diagrams\n - Logs and Observability\n - Running Individual Servers (Optional)\n - Development Notes and Extension Points\n - Reliability and Failure Modes\n - Security and Privacy\n - Performance Considerations\n- Troubleshooting\n- License\n\n### Key Features\n- Multiple trader personas with distinct strategies\n- Researcher tool as a delegated agent for web research\n- MCP servers for accounts, market data, notifications, and research\n- SQLite-backed accounts, logs, and market cache\n- Polygon.io integration with realtime or EOD fallback\n- Periodic scheduling with environment configuration\n\n\n### Why This Architecture\n- Isolation via MCP: capabilities are provided as composable, process-isolated MCP servers for clear interfaces and crash containment.\n- Deterministic core with pluggable edges: core trading loop remains testable while data providers and research tools swap in/out.\n- Resilience by fallback: if Polygon is unavailable, a local market MCP maintains continuity with EOD/random pricing.\n- Traceability: all agent activity is traced and written to an audit log for post-hoc analysis.\n\n\n### Project Structure\n- `intellitrade/trading_floor.py`: Scheduler that runs all traders on a cadence\n- `intellitrade/traders.py`: Trader agent orchestration and research tool wiring\n- `intellitrade/accounts.py`: Account model, trades, reporting, and logging\n- `intellitrade/accounts_server.py`: MCP tools and resources exposing account operations\n- `intellitrade/accounts_client.py`: Client shim to call the accounts MCP server/tools\n- `intellitrade/market.py`: Polygon API and fallback pricing utilities with caching\n- `intellitrade/market_server.py`: Local MCP market server (fallback when Polygon tools aren’t used)\n- `intellitrade/push_server.py`: MCP tool for Pushover notifications\n- `intellitrade/mcp_params.py`: MCP server launch parameters for traders and researchers\n- `intellitrade/templates.py`: Prompt templates and task messages\n- `intellitrade/tracers.py`: Trace processor that logs spans/traces to SQLite\n- `intellitrade/database.py`: SQLite persistence for accounts, logs, and market cache\n- `intellitrade/reset.py`: Initializes four trader personas and their strategies\n- `intellitrade/memory/*.db`: Per-trader memory databases for the researcher MCP server\n- `intellitrade/accounts.db`: Main SQLite DB for accounts, logs, market cache\n\n\n### Deep Architecture Docs\nFor a deeper dive with additional diagrams and internals, see:\n- `docs/ARCHITECTURE.md`\n\n\n### Requirements\n- Python 3.12+\n- [`uv`](https://github.com/astral-sh/uv) for running Python apps and managing deps\n- [`node` and `npx`] for certain MCP servers (Brave Search and memory server)\n\nPython dependencies are declared in `pyproject.toml` and pinned in `uv.lock`.\n\n\n### Environment Variables\n- Core:\n - `POLYGON_API_KEY`: Polygon.io API key (optional; enables Polygon-backed pricing)\n - `POLYGON_PLAN`: one of `paid` or `realtime` to unlock richer Polygon tools\n - `PUSHOVER_USER`, `PUSHOVER_TOKEN`: credentials for push notifications (optional)\n - `RUN_EVERY_N_MINUTES`: scheduler cadence (default: `60`)\n - `RUN_EVEN_WHEN_MARKET_IS_CLOSED`: `true` to run regardless of market hours\n - `USE_MANY_MODELS`: `true` to assign different LLM backends to each trader\n- LLM/OpenRouter-style keys (optional; use those you intend to test):\n - `OPENROUTER_API_KEY`, `DEEPSEEK_API_KEY`, `GROK_API_KEY`, `GOOGLE_API_KEY`\n- Research/search:\n - `BRAVE_API_KEY`: for the Brave Search MCP server (optional; recommended)\n\nCreate a `.env` in the repo root to configure these:\n\n```bash\nPOLYGON_API_KEY=...\nPOLYGON_PLAN=paid\nPUSHOVER_USER=...\nPUSHOVER_TOKEN=...\nRUN_EVERY_N_MINUTES=30\nRUN_EVEN_WHEN_MARKET_IS_CLOSED=false\nUSE_MANY_MODELS=false\nBRAVE_API_KEY=...\nOPENROUTER_API_KEY=...\n```\n\n\n### Install\n\n```bash\n# Ensure uv is installed, see uv docs if needed\nuv sync\n```\n\nThis will resolve and prepare the environment based on `pyproject.toml` and `uv.lock`.\n\n\n### Quick Start Matrix\n- Realtime Polygon: set `POLYGON_API_KEY` and `POLYGON_PLAN=realtime` → uses Polygon MCP tools\n- Paid Polygon (delayed): set `POLYGON_API_KEY` and `POLYGON_PLAN=paid` → uses delayed snapshot tools\n- No Polygon: omit `POLYGON_API_KEY` → uses local `market_server.py` MCP with EOD/random fallback\n\n\n### Initialize the Traders\n\n```bash\nuv run intellitrade/reset.py\n```\n\nThis creates or resets four traders with strategies:\n- Warren (value, long-term)\n- George (macro, contrarian)\n- Ray (systematic, risk parity)\n- Cathie (disruptive innovation, crypto ETFs focus)\n\n\n### Run the Trading Floor\n\n```bash\nuv run intellitrade/trading_floor.py\n```\n\nWhat happens:\n- A scheduler loops every `RUN_EVERY_N_MINUTES`\n- When the market is open (or if override is set), all traders run concurrently\n- Each trader:\n - Reads their account and strategy via the Accounts MCP server\n - Delegates research to a Researcher agent connected to multiple research MCP servers\n - Queries market data via either Polygon MCP tools or the local market server\n - Executes trades using the Accounts MCP server\n - Sends a brief push notification (if configured)\n - Logs traces and actions to SQLite\n\n\n### How Pricing Works\n- If `POLYGON_API_KEY` is set:\n - With `POLYGON_PLAN=realtime`: realtime snapshot tools are used\n - With `POLYGON_PLAN=paid`: delayed snapshot tools are used\n- Otherwise:\n - A local MCP server (`intellitrade/market_server.py`) provides an EOD or random fallback (with on-disk cache)\n\n\n### Data Storage\n- `intellitrade/accounts.db` (SQLite):\n - `accounts`: JSON account state by trader name\n - `logs`: trace and event logs by trader name\n - `market`: EOD market cache keyed by date\n- `intellitrade/memory/.db`: per-trader memory for research tools\n\n\n### Architecture Diagrams\n\nComponent view:\n\n```mermaid\nflowchart LR\n subgraph Agents\n T1[Trader: Warren]\n T2[Trader: George]\n T3[Trader: Ray]\n T4[Trader: Cathie]\n R[Researcher Agent]\n end\n\n subgraph MCP Servers\n A[Accounts MCP\\n(accounts_server.py)]\n M{{Market MCP\\n(Polygon or market_server.py)}}\n P[Push MCP\\n(push_server.py)]\n F[Fetch MCP\\n(mcp-server-fetch)]\n B[Brave Search MCP]\n MM[Memory MCP\\n(mcp-memory-libsql)]\n end\n\n subgraph Persistence\n DB[(SQLite\\naccounts.db)]\n MEM[(Per-Trader Memory\\nmemory/*.db)]\n end\n\n T1 -- read/write --> A\n T2 -- read/write --> A\n T3 -- read/write --> A\n T4 -- read/write --> A\n\n T1 -- price/info --> M\n T2 -- price/info --> M\n T3 -- price/info --> M\n T4 -- price/info --> M\n\n T1 -- notify --> P\n T2 -- notify --> P\n T3 -- notify --> P\n T4 -- notify --> P\n\n T1 <--delegates--> R\n T2 <--delegates--> R\n T3 <--delegates--> R\n T4 <--delegates--> R\n\n R -- fetch --> F\n R -- search --> B\n R -- recall/store --> MM\n\n A <-- accounts,logs,market cache --> DB\n MM <-- per-trader --> MEM\n```\n\nSequence of a trading turn:\n\n```mermaid\nsequenceDiagram\n participant Scheduler as trading_floor.py\n participant Trader as Trader Agent\n participant Researcher as Researcher Agent\n participant Accounts as Accounts MCP\n participant Market as Market MCP\n participant Push as Push MCP\n participant DB as SQLite (accounts.db)\n\n Scheduler->>Trader: run()\n Trader->>Accounts: read_account(name)\n Accounts->>DB: SELECT accounts, logs\n Accounts-->>Trader: account JSON + metadata\n\n Trader->>Researcher: research_tool(request)\n Researcher->>Market: query price/info (via MCP or Polygon)\n Researcher-->>Trader: findings summary\n\n Trader->>Accounts: buy_shares/sell_shares(name,symbol,qty,rationale)\n Accounts->>Market: get_share_price(symbol)\n Market-->>Accounts: price\n Accounts->>DB: UPDATE accounts; INSERT logs\n Accounts-->>Trader: trade confirmation + report JSON\n\n Trader->>Push: push(\"summary of trades and outlook\")\n Push-->>Trader: ok\n Trader-->>Scheduler: completed\n```\n\n\n### Logs and Observability\n- Traces and spans are persisted via `tracers.LogTracer` to the `logs` table\n- You can explore `intellitrade/accounts.db` using any SQLite tool to inspect:\n - Recent actions per trader (`logs`)\n - Account state (`accounts`)\n - Cached EOD prices (`market`)\n\nOperational tips:\n- Trace IDs are derived from trader names via `tracers.make_trace_id` for easy correlation.\n- The system logs trace start/end and span-level events with optional error strings for postmortems.\n\n\n### Running Individual Servers (Optional)\nNormally the trader launches MCP servers on demand. You can also run them manually:\n\n```bash\n# Accounts MCP server\nuv run intellitrade/accounts_server.py\n\n# Local Market MCP server (fallback when not using Polygon MCP tools)\nuv run intellitrade/market_server.py\n\n# Push MCP server\nuv run intellitrade/push_server.py\n```\n\n\n### Development Notes and Extension Points\n- MCP server params are centralized in `intellitrade/mcp_params.py`\n- Pricing logic and fallback paths are in `intellitrade/market.py`\n- Account operations (buy/sell/report/strategy) are in `intellitrade/accounts.py`\n- Traders toggle between “trade” and “rebalance” runs on each cycle\n- The researcher agent is exposed to the trader as a single tool\n- Add a new data provider: extend `mcp_params.py` with a new MCP entry and integrate its tools in `traders.py` or the researcher agent.\n- Add a new trader: update `intellitrade/trading_floor.py` and seed strategy in `intellitrade/reset.py`.\n- Add new notifications: implement an MCP tool similar to `push_server.py`.\n\n\n### Reliability and Failure Modes\n- MCP process isolation contains failures within individual tools; trader runs can proceed even if some tools fail.\n- Market pricing has layered fallbacks: realtime → delayed → EOD cache → random.\n- Account operations are transactional at the SQLite level; per-trader runs minimize write contention.\n- Research servers may rate-limit; prompts instruct fallback to alternate fetch tools.\n\n\n### Security and Privacy\n- API keys are read from `.env` and not persisted in databases.\n- SQLite stores account states, logs, and market cache. Research memory DBs are per-trader and local.\n- MCP transport here is local stdio; if remote execution is introduced, use secure channels and authentication.\n\n\n### Performance Considerations\n- Traders run concurrently each cycle; heavy IO is isolated in external MCP processes.\n- Market EOD results are cached by date to reduce API calls (LRU + SQLite cache).\n- Tune `RUN_EVERY_N_MINUTES` for iteration speed vs. load; consolidate MCP startup where possible for long-lived sessions.\n\n\n### Troubleshooting\n- Missing Polygon key: the system falls back to EOD/random pricing; set `POLYGON_API_KEY` to improve fidelity\n- Missing Brave key: research still works via fetch, but search quality improves with `BRAVE_API_KEY`\n- No pushes: ensure `PUSHOVER_USER` and `PUSHOVER_TOKEN` are set, or disable notifications in your flows\n- MCP startup issues: ensure `uv`, `node`, and `npx` are installed and in PATH\n\n\n### License\nThis repository is for educational and experimental use. See project owners for licensing terms if not otherwise specified.\n\n\n"}, "59d6248c45d1d920d40bc928502946b89053d572": {"t": 1785772086.249185, "n": 11496, "h": "5d4fa726bf53b3ba", "c": "### IntelliTrade: Multi-Agent Trading Floor (MCP-powered)\n\nIntelliTrade is a teaching and experimentation project that simulates a small trading floor of autonomous AI traders. Each trader is an agent that periodically researches markets, makes decisions, and executes trades against an on-disk account ledger. Agents access capabilities through Model Context Protocol (MCP) tools and services, including:\n\n- Accounts service for portfolio state and trade execution\n- Market data service (Polygon-based or a local fallback)\n- Push notifications for trade summaries\n- Research services (web fetch, search, and per-trader memory)\n\nUnder the hood, agents coordinate multiple MCP servers over stdio, log traces and events, and store durable state in SQLite.\n\n\n### Key Features\n- Multiple trader personas with distinct strategies\n- Researcher tool as a delegated agent for web research\n- MCP servers for accounts, market data, notifications, and research\n- SQLite-backed accounts, logs, and market cache\n- Polygon.io integration with realtime or EOD fallback\n- Periodic scheduling with environment configuration\n\n\n### Why This Architecture\n- Isolation via MCP: capabilities are provided as composable, process-isolated MCP servers for clear interfaces and crash containment.\n- Deterministic core with pluggable edges: core trading loop remains testable while data providers and research tools swap in/out.\n- Resilience by fallback: if Polygon is unavailable, a local market MCP maintains continuity with EOD/random pricing.\n- Traceability: all agent activity is traced and written to an audit log for post-hoc analysis.\n\n\n### Project Structure\n- `intellitrade/trading_floor.py`: Scheduler that runs all traders on a cadence\n- `intellitrade/traders.py`: Trader agent orchestration and research tool wiring\n- `intellitrade/accounts.py`: Account model, trades, reporting, and logging\n- `intellitrade/accounts_server.py`: MCP tools and resources exposing account operations\n- `intellitrade/accounts_client.py`: Client shim to call the accounts MCP server/tools\n- `intellitrade/market.py`: Polygon API and fallback pricing utilities with caching\n- `intellitrade/market_server.py`: Local MCP market server (fallback when Polygon tools aren’t used)\n- `intellitrade/push_server.py`: MCP tool for Pushover notifications\n- `intellitrade/mcp_params.py`: MCP server launch parameters for traders and researchers\n- `intellitrade/templates.py`: Prompt templates and task messages\n- `intellitrade/tracers.py`: Trace processor that logs spans/traces to SQLite\n- `intellitrade/database.py`: SQLite persistence for accounts, logs, and market cache\n- `intellitrade/reset.py`: Initializes four trader personas and their strategies\n- `intellitrade/memory/*.db`: Per-trader memory databases for the researcher MCP server\n- `intellitrade/accounts.db`: Main SQLite DB for accounts, logs, market cache\n\n\n### Deep Architecture Docs\nFor a deeper dive with additional diagrams and internals, see:\n- `docs/ARCHITECTURE.md`\n\n\n### Requirements\n- Python 3.12+\n- [`uv`](https://github.com/astral-sh/uv) for running Python apps and managing deps\n- [`node` and `npx`] for certain MCP servers (Brave Search and memory server)\n\nPython dependencies are declared in `pyproject.toml` and pinned in `uv.lock`.\n\n\n### Environment Variables\n- Core:\n - `POLYGON_API_KEY`: Polygon.io API key (optional; enables Polygon-backed pricing)\n - `POLYGON_PLAN`: one of `paid` or `realtime` to unlock richer Polygon tools\n - `PUSHOVER_USER`, `PUSHOVER_TOKEN`: credentials for push notifications (optional)\n - `RUN_EVERY_N_MINUTES`: scheduler cadence (default: `60`)\n - `RUN_EVEN_WHEN_MARKET_IS_CLOSED`: `true` to run regardless of market hours\n - `USE_MANY_MODELS`: `true` to assign different LLM backends to each trader\n- LLM/OpenRouter-style keys (optional; use those you intend to test):\n - `OPENROUTER_API_KEY`, `DEEPSEEK_API_KEY`, `GROK_API_KEY`, `GOOGLE_API_KEY`\n- Research/search:\n - `BRAVE_API_KEY`: for the Brave Search MCP server (optional; recommended)\n\nCreate a `.env` in the repo root to configure these:\n\n```bash\nPOLYGON_API_KEY=...\nPOLYGON_PLAN=paid\nPUSHOVER_USER=...\nPUSHOVER_TOKEN=...\nRUN_EVERY_N_MINUTES=30\nRUN_EVEN_WHEN_MARKET_IS_CLOSED=false\nUSE_MANY_MODELS=false\nBRAVE_API_KEY=...\nOPENROUTER_API_KEY=...\n```\n\n\n### Install\n\n```bash\n# Ensure uv is installed, see uv docs if needed\nuv sync\n```\n\nThis will resolve and prepare the environment based on `pyproject.toml` and `uv.lock`.\n\n\n### Quick Start Matrix\n- Realtime Polygon: set `POLYGON_API_KEY` and `POLYGON_PLAN=realtime` → uses Polygon MCP tools\n- Paid Polygon (delayed): set `POLYGON_API_KEY` and `POLYGON_PLAN=paid` → uses delayed snapshot tools\n- No Polygon: omit `POLYGON_API_KEY` → uses local `market_server.py` MCP with EOD/random fallback\n\n\n### Initialize the Traders\n\n```bash\nuv run intellitrade/reset.py\n```\n\nThis creates or resets four traders with strategies:\n- Warren (value, long-term)\n- George (macro, contrarian)\n- Ray (systematic, risk parity)\n- Cathie (disruptive innovation, crypto ETFs focus)\n\n\n### Run the Trading Floor\n\n```bash\nuv run intellitrade/trading_floor.py\n```\n\nWhat happens:\n- A scheduler loops every `RUN_EVERY_N_MINUTES`\n- When the market is open (or if override is set), all traders run concurrently\n- Each trader:\n - Reads their account and strategy via the Accounts MCP server\n - Delegates research to a Researcher agent connected to multiple research MCP servers\n - Queries market data via either Polygon MCP tools or the local market server\n - Executes trades using the Accounts MCP server\n - Sends a brief push notification (if configured)\n - Logs traces and actions to SQLite\n\n\n### How Pricing Works\n- If `POLYGON_API_KEY` is set:\n - With `POLYGON_PLAN=realtime`: realtime snapshot tools are used\n - With `POLYGON_PLAN=paid`: delayed snapshot tools are used\n- Otherwise:\n - A local MCP server (`intellitrade/market_server.py`) provides an EOD or random fallback (with on-disk cache)\n\n\n### Data Storage\n- `intellitrade/accounts.db` (SQLite):\n - `accounts`: JSON account state by trader name\n - `logs`: trace and event logs by trader name\n - `market`: EOD market cache keyed by date\n- `intellitrade/memory/.db`: per-trader memory for research tools\n\n\n### Architecture Diagrams\n\nComponent view:\n\n```mermaid\nflowchart LR\n subgraph Agents\n T1[Trader: Warren]\n T2[Trader: George]\n T3[Trader: Ray]\n T4[Trader: Cathie]\n R[Researcher Agent]\n end\n\n subgraph MCP Servers\n A[Accounts MCP\\n(accounts_server.py)]\n M{{Market MCP\\n(Polygon or market_server.py)}}\n P[Push MCP\\n(push_server.py)]\n F[Fetch MCP\\n(mcp-server-fetch)]\n B[Brave Search MCP]\n MM[Memory MCP\\n(mcp-memory-libsql)]\n end\n\n subgraph Persistence\n DB[(SQLite\\naccounts.db)]\n MEM[(Per-Trader Memory\\nmemory/*.db)]\n end\n\n T1 -- read/write --> A\n T2 -- read/write --> A\n T3 -- read/write --> A\n T4 -- read/write --> A\n\n T1 -- price/info --> M\n T2 -- price/info --> M\n T3 -- price/info --> M\n T4 -- price/info --> M\n\n T1 -- notify --> P\n T2 -- notify --> P\n T3 -- notify --> P\n T4 -- notify --> P\n\n T1 <--delegates--> R\n T2 <--delegates--> R\n T3 <--delegates--> R\n T4 <--delegates--> R\n\n R -- fetch --> F\n R -- search --> B\n R -- recall/store --> MM\n\n A <-- accounts,logs,market cache --> DB\n MM <-- per-trader --> MEM\n```\n\nSequence of a trading turn:\n\n```mermaid\nsequenceDiagram\n participant Scheduler as trading_floor.py\n participant Trader as Trader Agent\n participant Researcher as Researcher Agent\n participant Accounts as Accounts MCP\n participant Market as Market MCP\n participant Push as Push MCP\n participant DB as SQLite (accounts.db)\n\n Scheduler->>Trader: run()\n Trader->>Accounts: read_account(name)\n Accounts->>DB: SELECT accounts, logs\n Accounts-->>Trader: account JSON + metadata\n\n Trader->>Researcher: research_tool(request)\n Researcher->>Market: query price/info (via MCP or Polygon)\n Researcher-->>Trader: findings summary\n\n Trader->>Accounts: buy_shares/sell_shares(name,symbol,qty,rationale)\n Accounts->>Market: get_share_price(symbol)\n Market-->>Accounts: price\n Accounts->>DB: UPDATE accounts; INSERT logs\n Accounts-->>Trader: trade confirmation + report JSON\n\n Trader->>Push: push(\"summary of trades and outlook\")\n Push-->>Trader: ok\n Trader-->>Scheduler: completed\n```\n\n\n### Logs and Observability\n- Traces and spans are persisted via `tracers.LogTracer` to the `logs` table\n- You can explore `intellitrade/accounts.db` using any SQLite tool to inspect:\n - Recent actions per trader (`logs`)\n - Account state (`accounts`)\n - Cached EOD prices (`market`)\n\nOperational tips:\n- Trace IDs are derived from trader names via `tracers.make_trace_id` for easy correlation.\n- The system logs trace start/end and span-level events with optional error strings for postmortems.\n\n\n### Running Individual Servers (Optional)\nNormally the trader launches MCP servers on demand. You can also run them manually:\n\n```bash\n# Accounts MCP server\nuv run intellitrade/accounts_server.py\n\n# Local Market MCP server (fallback when not using Polygon MCP tools)\nuv run intellitrade/market_server.py\n\n# Push MCP server\nuv run intellitrade/push_server.py\n```\n\n\n### Development Notes and Extension Points\n- MCP server params are centralized in `intellitrade/mcp_params.py`\n- Pricing logic and fallback paths are in `intellitrade/market.py`\n- Account operations (buy/sell/report/strategy) are in `intellitrade/accounts.py`\n- Traders toggle between “trade” and “rebalance” runs on each cycle\n- The researcher agent is exposed to the trader as a single tool\n- Add a new data provider: extend `mcp_params.py` with a new MCP entry and integrate its tools in `traders.py` or the researcher agent.\n- Add a new trader: update `intellitrade/trading_floor.py` and seed strategy in `intellitrade/reset.py`.\n- Add new notifications: implement an MCP tool similar to `push_server.py`.\n\n\n### Reliability and Failure Modes\n- MCP process isolation contains failures within individual tools; trader runs can proceed even if some tools fail.\n- Market pricing has layered fallbacks: realtime → delayed → EOD cache → random.\n- Account operations are transactional at the SQLite level; per-trader runs minimize write contention.\n- Research servers may rate-limit; prompts instruct fallback to alternate fetch tools.\n\n\n### Security and Privacy\n- API keys are read from `.env` and not persisted in databases.\n- SQLite stores account states, logs, and market cache. Research memory DBs are per-trader and local.\n- MCP transport here is local stdio; if remote execution is introduced, use secure channels and authentication.\n\n\n### Performance Considerations\n- Traders run concurrently each cycle; heavy IO is isolated in external MCP processes.\n- Market EOD results are cached by date to reduce API calls (LRU + SQLite cache).\n- Tune `RUN_EVERY_N_MINUTES` for iteration speed vs. load; consolidate MCP startup where possible for long-lived sessions.\n\n\n### Troubleshooting\n- Missing Polygon key: the system falls back to EOD/random pricing; set `POLYGON_API_KEY` to improve fidelity\n- Missing Brave key: research still works via fetch, but search quality improves with `BRAVE_API_KEY`\n- No pushes: ensure `PUSHOVER_USER` and `PUSHOVER_TOKEN` are set, or disable notifications in your flows\n- MCP startup issues: ensure `uv`, `node`, and `npx` are installed and in PATH\n\n\n### License\nThis repository is for educational and experimental use. See project owners for licensing terms if not otherwise specified.\n\n\n"}}}}