[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-115351":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":15,"stars7d":16,"stars30d":16,"stars90d":14,"forks30d":14,"starsTrendScore":17,"compositeScore":18,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":9,"pushedAt":23,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":14,"starSnapshotCount":14,"syncStatus":27,"lastSyncTime":28,"discoverSource":29},115351,"MarketAtlas","againsturbwang\u002FMarketAtlas","againsturbwang","A Python-powered global financial market intelligence and analytics platform.",null,"Python",92,17,12,0,9,29,42,76.17,false,"main",true,[],"2026-11-09 14:44:34","2026-11-23 15:59:37","# MarketAtlas — Global Financial Market Intelligence Platform\n\nA self-hosted market monitor for EastMoney: 48 markets across 10 regions, a\nsingle-stock terminal, a T+1 intelligence layer, and an evidence protocol an LLM\nagent can query without reading a single web page.\n\nRuns on the Python standard library alone. No framework, no build step, no LLM\ninside — the model you attach decides what the numbers mean; this thing gathers\nand delivers them.\n\n![Dashboard](docs\u002Fdashboard.png)\n\n---\n\n## What it does\n\n**Global overview** — indices, sector heat, movers and a full instrument table for\n48 markets, from A-shares and Hong Kong to US, Europe, Asia-Pacific, FX, futures,\ncommodities and bonds. Each market has a real trading calendar, so the collector\nnever polls a closed exchange.\n\n**Single-stock terminal** — order book, intraday trend, daily\u002Fweekly\u002Fmonthly\ncandles, capital flow, tick prints and a watchlist. Every chart is interactive:\nhover to get a crosshair with the exact bar values, not just a line.\n\n![Stock terminal](docs\u002Fkline-hover.png)\n\n**T+1 intelligence** — ten scraped feeds chosen for next-session relevance:\nlimit-up and limit-down pools, the dragon-tiger list, main capital flow, sector\nrotation, northbound flows, margin balances, announcements, broker research and\nretail popularity. Stored by trading day, pruned at seven days.\n\n![T+1 signals](docs\u002Fsignals.png)\n\n**Full-text news** — six EastMoney sections (财经导读, 7x24快讯, 东方视点, 全球,\n焦点专题, 社区) with the article body extracted, so you read the piece in place\ninstead of bouncing to the source site.\n\n![Reader](docs\u002Freader.png)\n\n**Agent protocol** — every query takes an `as_of` cutoff and returns typed facts\nwith units, source ids and an explicit caveat list. Signals are filtered by their\n*publication* hour, so a replay at 15:00 sees the limit-up pool but not the\n17:30 dragon-tiger list. Predictions can be written back and are scored against\nrealised returns.\n\n![Info panel](docs\u002Fintel.png)\n\n---\n\n## Why it is built this way\n\nThree constraints shaped the design, and each one is a tradeoff worth knowing:\n\n**Markets are not all open.** A naive loop over 48 markets wastes most of its\nrequests and gets rate-limited. Each market carries a session calendar (26 of\nthem, DST-aware), and the collector only touches what is trading. When everything\nis closed it idles at 30 s instead of hammering idle endpoints.\n\n**The clock cannot be the local one.** T+1 reasoning depends on knowing whether a\nsession has actually closed. Time is synced from Cloudflare, then `timeapi.io`,\nthen EastMoney's own `Date` header, with RTT\u002F2 compensation and a monotonic\nanchor. If the clock goes stale the collector degrades deliberately rather than\nguessing.\n\n**EastMoney rate-limits by IP.** The dynamic proxy pool refreshes a batch every\ncycle, ranks proxies by latency EMA, and evicts after three failures. Interactive\nrequests hedge: a single-stock payload gets a 1 s budget, and only stragglers are\nduplicated rather than all four calls.\n\n---\n\n## Quick start\n\nRequires Python 3.11+ (3.13 tested) on Windows, Linux or macOS.\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fagainsturbwang\u002FMarketAtlas.git\ncd MarketAtlas\n\npython -m venv .venv\nsource .venv\u002Fbin\u002Factivate          # Windows: .venv\\Scripts\\activate\npip install -r requirements.txt\n\ncp .env.example .env               # then edit it (see Configuration)\npython run.py init                 # schema + 48 market definitions\npython run.py collect --klines     # one full pass, about 2 minutes\npython run.py run                  # collector loop + dashboard\n```\n\nOpen \u003Chttp:\u002F\u002F127.0.0.1:8787>.\n\nOther commands:\n\n```bash\npython run.py collect --only global.asia,us.index   # a subset\npython run.py serve                                 # dashboard only, no polling\npython run.py status                                # per-market health table\npython run.py proxy --test                          # extract and probe the proxy pool\n```\n\nBackground start\u002Fstop on Windows:\n\n```powershell\n.\\scripts\\start.ps1              # detached, logs to logs\\run.out, waits for \u002Fapi\u002Fhealth\n.\\scripts\\start.ps1 -Port 9000\n.\\scripts\\stop.ps1\n```\n\n---\n\n## Configuration\n\nEverything lives in `.env`; real environment variables win over the file.\n\n| Variable | Default | Meaning |\n| --- | --- | --- |\n| `dmdaili_apikey` \u002F `dmdaili_pwd` | — | Proxy provider credentials. Leave empty to run direct. |\n| `EM_USE_PROXY` | `1` | Set `0` to bypass the pool entirely. |\n| `EM_PROXY_BATCH` | `20` | IPs fetched per refresh |\n| `EM_PROXY_TARGET` | `20` | Pool size to maintain |\n| `EM_PAGE_SIZE` | `100` | EastMoney caps list pages at 100 |\n| `EM_WORKERS` | `8` | Concurrent page fetches |\n| `EM_RATE` | `10` | Requests per second, global |\n| `EM_TIMEOUT` | `6` | Per-request timeout (s) |\n| `EM_RETENTION_HOURS` | `24` | Intraday quote history kept |\n| `EM_SIGNAL_DAYS` | `7` | Signals, articles and predictions kept |\n| `EM_KLINE_HOURS` | `6` | Daily-bar refresh interval |\n| `EM_IDLE_SLEEP` | `30` | Idle delay when every market is closed |\n| `EM_HOST` \u002F `EM_PORT` | `127.0.0.1` \u002F `8787` | Dashboard bind address |\n\nWithout proxy credentials the platform still runs; it just falls back to direct\nrequests and will be rate-limited sooner.\n\n---\n\n## Architecture\n\n```\nrun.py          CLI: init \u002F collect \u002F serve \u002F run \u002F status \u002F proxy\ncollector.py    session-aware collection loop, per-market page fan-out\nmarkets.py      48 market definitions (secid filters, intervals, calendars)\nsessions.py     26 trading calendars, DST via tzdata, BASKETS per region\ntimesync.py     multi-source clock with RTT compensation and staleness guard\nproxy_pool.py   rotating proxy pool: latency EMA, scoring, eviction\nem_client.py    HTTP client: keep-alive, gzip, hedging, common API surface\nfeeds.py        ten T+1 signal feeds, normalised records\nsignal_hub.py   schedule for those feeds (intraday window vs evening publishes)\nintel.py        news sections, article bodies, 7-day store\nevidence.py     point-in-time evidence packets + prediction scoring\nserver.py       HTTP server, JSON API, static UI\nmcp_server.py   MCP binding over the same HTTP contract\ndb.py           SQLite schema, readers, retention\nweb\u002F            vanilla JS dashboard (no build step)\n```\n\n**Data flow.** The collector fans out per market, writes to SQLite (WAL, one\nwriter, read-only connections per thread), and keeps a hot in-memory cache so the\ndashboard is a cache read. Background hubs add signals and article bodies on their\nown cadence. The API is a read model over that database; live per-stock reads go\nupstream on demand and are cached.\n\n**Storage.** One SQLite file. Intraday ticks, bars, quotes, signals, articles and\npredictions each prune on their own schedule.\n\n---\n\n## API\n\nTwo surfaces over the same data.\n\n**`\u002Fapi\u002F*` — operational.** Markets, rows, movers, search, stock snapshot, K-line\nbars, signals, news, watchlist, status.\n\n**`\u002Fapi\u002Fv1\u002F*` — agent protocol.** Evidence packets with `as_of`:\n\n| Endpoint | Returns |\n| --- | --- |\n| `GET \u002Fapi\u002Fv1\u002Fmeta` | schema version, units, field glossary |\n| `GET \u002Fapi\u002Fv1\u002Fregime?as_of=` | breadth, limit-up pool, sector flows, connect, margin |\n| `GET \u002Fapi\u002Fv1\u002Fcandidates?as_of=` | names ranked by signal confluence, with reasons |\n| `GET \u002Fapi\u002Fv1\u002Fstock\u002F{secid}\u002Fevidence?as_of=` | price, momentum, signals, related news |\n| `GET \u002Fapi\u002Fv1\u002Fnews\u002Fsearch?q=&as_of=` | full-text search over seven days |\n| `POST \u002Fapi\u002Fv1\u002Fpredictions` | record a call for scoring |\n| `GET \u002Fapi\u002Fv1\u002Fpredictions\u002Fscorecard` | hit rate, Brier score, calibration |\n| `GET \u002Fapi\u002Fv1\u002Fopenapi.json` | OpenAPI 3.1 description |\n\nEnumerate the universe with `GET \u002Fapi\u002Finstruments?page=1&size=1000` (29,834\nsymbols, 30 pages), filter with `market=`, `kind=`, `q=`. Bars take an explicit\nrange: `GET \u002Fapi\u002Fstock\u002F1.600519\u002Fkline?klt=101&from=2026-09-01&to=2026-09-30`.\n\nDetails: [agent protocol](docs\u002Fagent-protocol.md),\n[API audit](docs\u002Fapi-audit.md),\n[capabilities](docs\u002Fapi-capabilities.md),\n[delivery report](docs\u002Fapi-delivery-report.md).\n\n### MCP\n\n```bash\npython mcp_server.py --selftest     # tool manifest + live check\npython mcp_server.py                # stdio transport\n```\n\nEight tools — `market_regime`, `screen_candidates`, `stock_evidence`,\n`search_news`, `read_article`, `list_signals`, `report_prediction`, `scorecard` —\nover the same HTTP contract, so a plain HTTP client and an MCP host see identical\ndata.\n\n---\n\n## Testing\n\n```bash\npython tests\u002Ftest_sessions.py        # 25 trading-calendar boundary assertions\npython scripts\u002Faudit_api.py          # 30 endpoints, browser vs plain-Python UA\npython scripts\u002Faudit_delivery.py     # K-lines verified field-by-field vs upstream\npython scripts\u002Fcheck_capabilities.py # enumeration, time, symbol and dependency checks\n```\n\nThe delivery audit compares served bars against EastMoney itself: 591 closed bars\nacross A-share, index, HK and US instruments, zero mismatches.\n\n---\n\n## Notes and limitations\n\n- **Market holidays are not modelled.** Weekends and session hours are exact; a\n  public holiday looks like a closed market with stale data. Documented, not hidden.\n- **The newest bar can be forming.** Responses carry `last_final` and a `note` so\n  a caller can tell a settled bar from one still moving.\n- **HK fund-flow figures use a different caliber** and are flagged\n  `flow_reliable: false` rather than shown as if comparable.\n- **Northbound net inflow is no longer disclosed** by the exchanges; only turnover\n  is available, and the API labels it as such.\n- **Community posts** come from the server-rendered 股吧 list pages. The market-wide\n  JSON endpoint returns an empty array to unauthenticated clients.\n- **The proxy tunnels HTTP only**; HTTPS CONNECT is unsupported by the provider, so\n  EastMoney calls go over `http:\u002F\u002F` when routed through the pool.\n- **Not investment advice.** Data is scraped from public EastMoney endpoints for\n  personal analysis. Respect the site's terms and your local regulations.\n\n---\n\n## Project structure\n\n```\n.\n├── run.py                 CLI entry point\n├── collector.py           collection loop\n├── markets.py             market definitions\n├── sessions.py            trading calendars\n├── timesync.py            clock sync\n├── proxy_pool.py          proxy rotation\n├── em_client.py           EastMoney HTTP client\n├── feeds.py               T+1 signal feeds\n├── signal_hub.py          signal scheduler\n├── intel.py               news + article bodies\n├── evidence.py            evidence packets, prediction scoring\n├── server.py              HTTP API + static server\n├── mcp_server.py          MCP binding\n├── db.py                  SQLite layer\n├── config.py              settings\n├── web\u002F                   dashboard (index.html, app.js, styles.css)\n├── scripts\u002F               start\u002Fstop helpers + audits\n├── tests\u002F                 calendar tests\n├── docs\u002F                  protocol and audit reports, screenshots\n└── requirements.txt\n```\n\n---\n\n## License\n\nNo license has been chosen for this repository yet. Add one before distributing\nit — without a license, default copyright applies and others may not reuse it.\n","MarketAtlas 是一个基于 Python 的自托管全球金融市场情报与分析平台，专注从东方财富网实时采集和结构化处理多市场金融数据。核心功能包括：覆盖48个市场的全局行情监控（含A股、港股、美股、外汇、期货等）、单只股票终端（支持逐笔成交、盘口、K线及资金流）、T+1级事件信号层（如涨跌停池、龙虎榜、北向资金、行业轮动等）、全文财经新闻聚合，以及面向LLM代理的标准化查询协议（带时间戳、来源标识与置信提示）。所有模块仅依赖 Python 标准库，无外部框架，强调时序准确性、交易所交易日历适配与反限频代理调度。适用于量化研究、投研辅助、自动化情报订阅及金融AI Agent的数据底座构建。",2,"2026-11-24 04:50:45","CREATED_QUERY"]