# mcyeremia/idxanalyst architecture

> Architecture diagram of the GitHub repository mcyeremia/idxanalyst, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mcyeremia/idxanalyst
- Repository: https://github.com/mcyeremia/idxanalyst

## Overview

IDXAnalyst is an Indonesian equities research and trading terminal. Users explore market and stock data, screen technical signals and fundamentals, inspect strategies through backtests, and manage or compare USER, GEMINI, and CLAUDE portfolios. The FastAPI application exposes those capabilities to Next.js screens; trade and market history are persisted in SQLite. The README also documents autonomous-agent access through MCP and AI portfolio competition. Some backend route-to-service wiring and unsampled screens are not shown, so uncertain call edges are omitted.

Main entry points: [`frontend/app`](https://github.com/mcyeremia/idxanalyst/tree/main/frontend/app) (Next.js screens), [`frontend/lib/api.ts`](https://github.com/mcyeremia/idxanalyst/blob/main/frontend/lib/api.ts) (API client), [`backend/main.py`](https://github.com/mcyeremia/idxanalyst/blob/main/backend/main.py) (FastAPI application), [`frontend/app/dashboard/page.tsx`](https://github.com/mcyeremia/idxanalyst/blob/main/frontend/app/dashboard/page.tsx) (Market dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Trading Terminal"]
  node_terminal["Next.js screens"]
  node_dashboard["Market dashboard<br/>[page.tsx]"]
  node_screener["Stock screener<br/>[page.tsx]"]
  node_stock_detail["Stock analysis<br/>[page.tsx]"]
  node_portfolio_ui["Portfolio battle<br/>[page.tsx]"]
  node_backtest_ui["Strategy backtests<br/>[page.tsx]"]
  node_broker_ui["Broker flow<br/>[page.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_api["Application API"]
  node_app["FastAPI application<br/>[main.py]"]
  node_stocks_api["Stocks routes<br/>[stocks.py]"]
  node_trades_api["Trade routes<br/>[trades.py]"]
  node_backtest_api["Backtest routes<br/>[backtest.py]"]
  node_broker_api["Broker routes<br/>[broker.py]"]
end

subgraph group_intelligence["Market Intelligence"]
  node_fetcher["Market data fetch<br/>[data_fetcher.py]"]
  node_indicators["Technical indicators<br/>[indicators.py]"]
  node_watcher["Signal scanner<br/>[watcher.py]"]
  node_backtester["Backtest engine<br/>[backtester.py]"]
  node_predictor["ML predictor<br/>[ml_predictor.py]"]
  node_scraper["Broker scraper<br/>[broker_scraper.py]"]
end

subgraph group_state["Portfolio Data"]
  node_db_session["Database access<br/>[database.py]"]
  node_sqlite[("SQLite database<br/>[database.py]")]
  node_models["Market and trade models<br/>[models.py]"]
end

subgraph group_agents["Agent Access"]
  node_mcp["MCP server<br/>[mcp_server.py]"]
end

node_trader(("Trader"))
node_ai_agents(("Claude / Gemini"))
node_yahoo["Yahoo Finance"]

node_trader -->|"uses"| node_terminal
node_terminal -->|"opens"| node_dashboard
node_terminal -->|"opens"| node_screener
node_terminal -->|"opens"| node_stock_detail
node_terminal -->|"opens"| node_portfolio_ui
node_terminal -->|"opens"| node_backtest_ui
node_terminal -->|"opens"| node_broker_ui
node_dashboard -->|"requests data"| node_api_client
node_screener -->|"requests data"| node_api_client
node_stock_detail -->|"requests data"| node_api_client
node_portfolio_ui -->|"requests data"| node_api_client
node_backtest_ui -->|"runs tests"| node_api_client
node_broker_ui -->|"requests data"| node_api_client
node_api_client -->|"HTTP requests"| node_app
node_app -->|"mounts routes"| node_stocks_api
node_app -->|"mounts routes"| node_trades_api
node_app -->|"mounts routes"| node_backtest_api
node_app -->|"mounts routes"| node_broker_api
node_trades_api -->|"opens session"| node_db_session
node_db_session -->|"reads and writes"| node_sqlite
node_models -->|"maps records"| node_sqlite
node_fetcher -.->|"fetches prices"| node_yahoo
node_ai_agents -.->|"sends commands"| node_mcp

click node_terminal "https://github.com/mcyeremia/idxanalyst/tree/main/frontend/app"
click node_dashboard "https://github.com/mcyeremia/idxanalyst/blob/main/frontend/app/dashboard/page.tsx"
click node_screener "https://github.com/mcyeremia/idxanalyst/blob/main/frontend/app/screener/page.tsx"
click node_stock_detail "https://github.com/mcyeremia/idxanalyst/blob/main/frontend/app/stocks/%5Bticker%5D/page.tsx"
click node_portfolio_ui "https://github.com/mcyeremia/idxanalyst/blob/main/frontend/app/portfolio/page.tsx"
click node_backtest_ui "https://github.com/mcyeremia/idxanalyst/blob/main/frontend/app/backtest/page.tsx"
click node_broker_ui "https://github.com/mcyeremia/idxanalyst/blob/main/frontend/app/broker-flow/page.tsx"
click node_api_client "https://github.com/mcyeremia/idxanalyst/blob/main/frontend/lib/api.ts"
click node_app "https://github.com/mcyeremia/idxanalyst/blob/main/backend/main.py"
click node_stocks_api "https://github.com/mcyeremia/idxanalyst/blob/main/backend/routers/stocks.py"
click node_trades_api "https://github.com/mcyeremia/idxanalyst/blob/main/backend/routers/trades.py"
click node_backtest_api "https://github.com/mcyeremia/idxanalyst/blob/main/backend/routers/backtest.py"
click node_broker_api "https://github.com/mcyeremia/idxanalyst/blob/main/backend/routers/broker.py"
click node_fetcher "https://github.com/mcyeremia/idxanalyst/blob/main/backend/services/data_fetcher.py"
click node_indicators "https://github.com/mcyeremia/idxanalyst/blob/main/backend/services/indicators.py"
click node_watcher "https://github.com/mcyeremia/idxanalyst/blob/main/backend/services/watcher.py"
click node_backtester "https://github.com/mcyeremia/idxanalyst/blob/main/backend/services/backtester.py"
click node_predictor "https://github.com/mcyeremia/idxanalyst/blob/main/backend/services/ml_predictor.py"
click node_scraper "https://github.com/mcyeremia/idxanalyst/blob/main/backend/services/broker_scraper.py"
click node_db_session "https://github.com/mcyeremia/idxanalyst/blob/main/backend/database.py"
click node_sqlite "https://github.com/mcyeremia/idxanalyst/blob/main/backend/database.py"
click node_models "https://github.com/mcyeremia/idxanalyst/blob/main/backend/models.py"
click node_mcp "https://github.com/mcyeremia/idxanalyst/blob/main/backend/mcp_server.py"

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_terminal,node_dashboard,node_screener,node_stock_detail,node_portfolio_ui,node_backtest_ui,node_broker_ui,node_api_client toneBlue
class node_app,node_stocks_api,node_trades_api,node_backtest_api,node_broker_api toneAmber
class node_fetcher,node_indicators,node_watcher,node_backtester,node_predictor,node_scraper toneMint
class node_db_session,node_sqlite,node_models toneRose
class node_mcp,node_trader,node_ai_agents,node_yahoo toneIndigo
```

## Components

### Trading Terminal

- [Next.js screens](https://github.com/mcyeremia/idxanalyst/tree/main/frontend/app): `frontend/app`
- [Market dashboard](https://github.com/mcyeremia/idxanalyst/blob/main/frontend/app/dashboard/page.tsx): `frontend/app/dashboard/page.tsx`
- [Stock screener](https://github.com/mcyeremia/idxanalyst/blob/main/frontend/app/screener/page.tsx): `frontend/app/screener/page.tsx`
- [Stock analysis](https://github.com/mcyeremia/idxanalyst/blob/main/frontend/app/stocks/%5Bticker%5D/page.tsx): `frontend/app/stocks/[ticker]/page.tsx`
- [Portfolio battle](https://github.com/mcyeremia/idxanalyst/blob/main/frontend/app/portfolio/page.tsx): `frontend/app/portfolio/page.tsx`
- [Strategy backtests](https://github.com/mcyeremia/idxanalyst/blob/main/frontend/app/backtest/page.tsx): `frontend/app/backtest/page.tsx`
- [Broker flow](https://github.com/mcyeremia/idxanalyst/blob/main/frontend/app/broker-flow/page.tsx): `frontend/app/broker-flow/page.tsx`
- [API client](https://github.com/mcyeremia/idxanalyst/blob/main/frontend/lib/api.ts): `frontend/lib/api.ts`

### Application API

- [FastAPI application](https://github.com/mcyeremia/idxanalyst/blob/main/backend/main.py): `backend/main.py`
- [Stocks routes](https://github.com/mcyeremia/idxanalyst/blob/main/backend/routers/stocks.py): `backend/routers/stocks.py`
- [Trade routes](https://github.com/mcyeremia/idxanalyst/blob/main/backend/routers/trades.py): `backend/routers/trades.py`
- [Backtest routes](https://github.com/mcyeremia/idxanalyst/blob/main/backend/routers/backtest.py): `backend/routers/backtest.py`
- [Broker routes](https://github.com/mcyeremia/idxanalyst/blob/main/backend/routers/broker.py): `backend/routers/broker.py`

### Market Intelligence

- [Market data fetch](https://github.com/mcyeremia/idxanalyst/blob/main/backend/services/data_fetcher.py): `backend/services/data_fetcher.py`
- [Technical indicators](https://github.com/mcyeremia/idxanalyst/blob/main/backend/services/indicators.py): `backend/services/indicators.py`
- [Signal scanner](https://github.com/mcyeremia/idxanalyst/blob/main/backend/services/watcher.py): `backend/services/watcher.py`
- [Backtest engine](https://github.com/mcyeremia/idxanalyst/blob/main/backend/services/backtester.py): `backend/services/backtester.py`
- [ML predictor](https://github.com/mcyeremia/idxanalyst/blob/main/backend/services/ml_predictor.py): `backend/services/ml_predictor.py`
- [Broker scraper](https://github.com/mcyeremia/idxanalyst/blob/main/backend/services/broker_scraper.py): `backend/services/broker_scraper.py`

### Portfolio Data

- [Database access](https://github.com/mcyeremia/idxanalyst/blob/main/backend/database.py): `backend/database.py`
- [SQLite database](https://github.com/mcyeremia/idxanalyst/blob/main/backend/database.py): `backend/database.py`
- [Market and trade models](https://github.com/mcyeremia/idxanalyst/blob/main/backend/models.py): `backend/models.py`

### Agent Access

- [MCP server](https://github.com/mcyeremia/idxanalyst/blob/main/backend/mcp_server.py): `backend/mcp_server.py`

### Other components

- **Trader**
- **Claude / Gemini**
- **Yahoo Finance**

## Connections

- Trader → Next.js screens: uses
- Next.js screens → Market dashboard: opens
- Next.js screens → Stock screener: opens
- Next.js screens → Stock analysis: opens
- Next.js screens → Portfolio battle: opens
- Next.js screens → Strategy backtests: opens
- Next.js screens → Broker flow: opens
- Market dashboard → API client: requests data
- Stock screener → API client: requests data
- Stock analysis → API client: requests data
- Portfolio battle → API client: requests data
- Strategy backtests → API client: runs tests
- Broker flow → API client: requests data
- API client → FastAPI application: HTTP requests
- FastAPI application → Stocks routes: mounts routes
- FastAPI application → Trade routes: mounts routes
- FastAPI application → Backtest routes: mounts routes
- FastAPI application → Broker routes: mounts routes
- Trade routes → Database access: opens session
- Database access → SQLite database: reads and writes
- Market and trade models → SQLite database: maps records
- Market data fetch → Yahoo Finance: fetches prices
- Claude / Gemini → MCP server: sends commands
