### Initialize Local Development Source: https://github.com/thebiggavin/marketingdashboard/blob/main/README.md Install dependencies and start the development server. ```bash npm install # or pnpm install npm run dev ``` -------------------------------- ### Start Local Development Server Source: https://github.com/thebiggavin/marketingdashboard/blob/main/README.md Command to run the dashboard locally for LAN testing on TV devices. ```bash npm start ``` -------------------------------- ### Import iOS Scriptable Script Source: https://github.com/thebiggavin/marketingdashboard/blob/main/README.md URL for one-tap installation of the dashboard script into the Scriptable app. ```text https://scripting.fun/import_scripts?urls=%5B%22https%3A%5C%2F%5C%2Fgithub.com%5C%2FtheBigGavin%5C%2Fmrd-scripting%5C%2Ftree%5C%2Fmain%22%5D ``` -------------------------------- ### Interact with MCP Server via cURL Source: https://github.com/thebiggavin/marketingdashboard/blob/main/README.md Commands to start the server, initialize the connection, list available tools, and execute specific market data queries. ```bash # Start the server npm start # 1. Discover — get server metadata curl http://localhost:3000/mcp # 2. Initialize (required first call) curl -X POST http://localhost:3000/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' # 3. List tools curl -X POST http://localhost:3000/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' # 4. Call a tool — get A-share index quotes curl -X POST http://localhost:3000/mcp \ -H "Content-Type: application/json" \ -d '{ "jsonrpc":"2.0","id":3,"method":"tools/call", "params":{ "name":"get_quotes", "arguments":{"codes":"sh000001,sz399001,hkHSI,usNVDA"} } }' # 5. Get sector rankings curl -X POST http://localhost:3000/mcp \ -H "Content-Type: application/json" \ -d '{ "jsonrpc":"2.0","id":4,"method":"tools/call", "params":{ "name":"get_boards", "arguments":{"type":"01","dir":"0","n":"10"} } }' # 6. Ping (keep-alive / health check) curl -X POST http://localhost:3000/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","id":5,"method":"ping","params":{}}' ``` -------------------------------- ### GET /mcp/stream Source: https://github.com/thebiggavin/marketingdashboard/blob/main/README.md Provides an SSE stream for server-initiated notifications. ```APIDOC ## GET /mcp/stream ### Description Provides an SSE stream for server-initiated notifications. ### Method GET ### Endpoint /mcp/stream ``` -------------------------------- ### GET /mcp Source: https://github.com/thebiggavin/marketingdashboard/blob/main/README.md Retrieves server metadata including version, tool list, and resource list. ```APIDOC ## GET /mcp ### Description Retrieves server metadata including version, tool list, and resource list. ### Method GET ### Endpoint /mcp ``` -------------------------------- ### GET /api/quotes Source: https://github.com/thebiggavin/marketingdashboard/blob/main/README.md Retrieves real-time index or stock quotes. ```APIDOC ## GET /api/quotes ### Description Retrieves real-time index or stock quotes. ### Method GET ### Endpoint /api/quotes ### Parameters #### Query Parameters - **codes** (string) - Required - Comma-separated list of stock or index codes. ``` -------------------------------- ### Sideload Android TV APK Source: https://github.com/thebiggavin/marketingdashboard/blob/main/README.md Command to install the generated APK onto an Android TV device via ADB. ```bash adb install app-debug.apk ``` -------------------------------- ### GET /api/boards Source: https://github.com/thebiggavin/marketingdashboard/blob/main/README.md Retrieves industry or concept sector rankings. ```APIDOC ## GET /api/boards ### Description Retrieves industry or concept sector rankings. ### Method GET ### Endpoint /api/boards ### Parameters #### Query Parameters - **type** (string) - Required - The type of sector ranking. - **dir** (string) - Required - The sorting direction. - **n** (integer) - Required - The number of items to return. ``` -------------------------------- ### GET /api/minute Source: https://github.com/thebiggavin/marketingdashboard/blob/main/README.md Retrieves intraday minute series data for a specific stock. ```APIDOC ## GET /api/minute ### Description Retrieves intraday minute series data for a specific stock. ### Method GET ### Endpoint /api/minute ### Parameters #### Query Parameters - **code** (string) - Required - The stock code. ``` -------------------------------- ### GET /api/health Source: https://github.com/thebiggavin/marketingdashboard/blob/main/README.md Performs a health check on the API service. ```APIDOC ## GET /api/health ### Description Performs a health check on the API service. ### Method GET ### Endpoint /api/health ``` -------------------------------- ### Build and Configure for Production Source: https://github.com/thebiggavin/marketingdashboard/blob/main/README.md Build the project and configure optional API keys and data files for production use. ```bash npm run build # builds to dist/ # Optional: configure API keys (AI panels) # echo 'OPENROUTER_API_KEY=sk-or-v1-xxxx' > server/.env # AI cockpit usage panel # echo 'ARTIFICIAL_ANALYSIS_API_KEY=aa_xxxx' >> server/.env # LLM price panels # Optional: full TTSI history — download ttsi.csv from traktoken.com and # place it at server/data/ttsi.csv (CC BY 4.0). Without it the trend # panel falls back to the 60-day RSS tail automatically. npm start # single process, visit http://localhost:3000 ``` -------------------------------- ### Containerize with Docker Source: https://github.com/thebiggavin/marketingdashboard/blob/main/README.md Build and run the application using Docker. ```bash docker build -t market-cockpit . docker run -p 3000:3000 market-cockpit ``` -------------------------------- ### Build macOS Desktop App Source: https://github.com/thebiggavin/marketingdashboard/blob/main/README.md Open the native Swift WKWebView shell project in Xcode. ```bash open macos/MarketCockpit.xcodeproj # Open in Xcode, press ⌘R to build & run ``` -------------------------------- ### Build Android TV APK Source: https://github.com/thebiggavin/marketingdashboard/blob/main/README.md Commands to build the Android TV application from the source directory. ```bash cd android-tv && ./gradlew assembleDebug ``` -------------------------------- ### Configure Claude Desktop for MCP Source: https://github.com/thebiggavin/marketingdashboard/blob/main/README.md Add the server configuration to the Claude Desktop settings file to enable tool integration. ```yaml mcpServers: mrd: command: npx args: - -y - @modelcontextprotocol/server-http - http://localhost:3000/mcp ``` -------------------------------- ### Import UI Components Source: https://github.com/thebiggavin/marketingdashboard/blob/main/info.md Standard import syntax for accessing components from the project's UI library. ```typescript import { Button } from '@/components/ui/button' import { Card, CardHeader, CardTitle } from '@/components/ui/card' ``` -------------------------------- ### Project Directory Structure Source: https://github.com/thebiggavin/marketingdashboard/blob/main/README.md Visual representation of the project's file hierarchy, highlighting the separation between server logic, frontend components, and platform-specific code. ```text ├── server/ │ ├── dev.cjs # Dev entry: starts Vite and the data proxy together │ ├── index.cjs # Data proxy + production static file serving │ └── data/ # Runtime-accumulated data (gitignored): spot-history.json, │ # model-prices.json, ttsi.csv (optional full TTSI history) ├── macos/ # macOS desktop app (Swift + WKWebView) │ ├── MarketCockpit.xcodeproj │ └── MarketCockpit/ ├── src/ │ ├── App.tsx # Cockpit layout & routing (/ market cockpit, /ai AI cockpit, /goods commodity prices, /fin earnings window) │ ├── AiDashboard.tsx # AI cockpit page (2×3 grid: OpenRouter usage spanning two rows + 4 LLM price panels) │ ├── FinDashboard.tsx # Earnings window page (panels in components/dash/fin/) │ ├── GoodsDashboard.tsx # Commodity prices page (6-group trend panels + spot/basis panel) │ ├── components/ │ │ └── dash/ # Cockpit panels + shared UI primitives │ │ ├── fin/ # Earnings window panels (calendar, forecast, industry rank, stock rank, company, trend, peer comparison) │ │ │ ├── FinContext.ts # Shared company selection & reporting period state │ │ │ └── utils.ts # quarterLabel, forecastTone (re-exports from lib/) │ │ ├── Spark.tsx # Mini sparklines (A-share / 24h continuous / daily session axes) │ │ ├── SharedUI.tsx # TabBar (segmented control), AsyncContent (loading/error/empty wrapper) │ │ └── ... │ ├── config/ # Static config for indices, commodities, industry chains, goods groups │ ├── hooks/ # Shared hooks │ │ ├── usePolling.ts # Per-component polling (hidden-tab pause, inflight guard) │ │ ├── useSharedPolling.ts # Same-key components share one timer via useSyncExternalStore │ │ ├── useElementSize.ts # ResizeObserver → {ref, size} for SVG auto-sizing │ │ ├── useStockSearch.ts # Debounced search + dropdown + keyboard nav for stock pickers │ │ └── ... │ └── lib/ # API client, unified quote hub, shared utilities │ ├── market.ts # MarketHub: reference-counted quote subscriptions, single 5s poll loop │ ├── api.ts # Typed fetch wrappers (server-first, browser-direct fallback) │ ├── format.ts # fmtPrice, fmtPct, fmtYi, fmtWan, clsChg, hexChg, TNUM… │ ├── code.ts # normalizeStockCode / toMarketCode — stock code prefix normalization │ └── storage.ts # loadJson / saveJson — typed localStorage with error handling └── docs/ # Screenshots and other doc assets ``` -------------------------------- ### Repackage Scriptable Script Source: https://github.com/thebiggavin/marketingdashboard/blob/main/README.md Command to rebuild the .scripting package using the provided Python utility. ```bash python3 scriptable/package.py ``` -------------------------------- ### POST /mcp Source: https://github.com/thebiggavin/marketingdashboard/blob/main/README.md Executes JSON-RPC 2.0 requests such as initialize, tools/list, tools/call, or ping. ```APIDOC ## POST /mcp ### Description Executes JSON-RPC 2.0 requests such as initialize, tools/list, tools/call, or ping. ### Method POST ### Endpoint /mcp ### Request Body - **jsonrpc** (string) - Required - Version of the JSON-RPC protocol (e.g., "2.0") - **id** (number) - Required - Request identifier - **method** (string) - Required - The method to invoke (e.g., "initialize", "tools/list", "tools/call", "ping") - **params** (object) - Optional - Parameters for the method call ``` -------------------------------- ### Configure Dashboard Icon Styles Source: https://github.com/thebiggavin/marketingdashboard/blob/main/scripts/icon-b-any.html Sets the html, body, and svg elements to occupy the full viewport width and height with a transparent background. ```css html, body { margin: 0; width: 100%; height: 100%; background: transparent; } svg { width: 100vw; height: 100vh; display: block; } ``` -------------------------------- ### 个股盈利榜行格式 Source: https://github.com/thebiggavin/marketingdashboard/blob/main/docs/fin-window-design.md 定义了个股盈利榜单的行布局,包含排名、公司名、净利额、同比增速及 ROE。 ```text 1 工商银行 2,699亿 +0.5% ROE 9.8% 9px 11px 12px 10px 9px slate-500 slate-500 slate-200 semibold 红绿 ←增速Tab时此列加粗为主列 ``` -------------------------------- ### 公司财报指标卡布局 Source: https://github.com/thebiggavin/marketingdashboard/blob/main/docs/fin-window-design.md 定义了公司财报面板中指标卡的 2x3 网格布局结构。 ```text ┌──────────┬──────────┐ │营收 949亿 │净利 47亿 │ 值 12px semibold tabular-nums │+5.2% │+15.4% │ 同比 9px 红绿 ├──────────┼──────────┤ │ROE 11.2% │EPS 1.85 │ 标签 9px slate-500 │毛利率 68%│报告期 Q3 │ └──────────┴──────────┘ ``` -------------------------------- ### Dashboard Icon CSS Styles Source: https://github.com/thebiggavin/marketingdashboard/blob/main/scripts/icon-b-full.html Sets the full-screen layout and background color for the dashboard icon container. ```css html, body { margin: 0; width: 100%; height: 100%; background: #0b1220; } svg { width: 100vw; height: 100vh; display: block; } ``` -------------------------------- ### 业绩预告明细表行格式 Source: https://github.com/thebiggavin/marketingdashboard/blob/main/docs/fin-window-design.md 定义了业绩预告明细表中每一行的显示格式,包含日期、公司名、类型标签及财务数据。 ```text 01-28 宁德时代 [预增] 净利 490亿~530亿 +9.7%~+18.5% 9px 11px chip 11px tabular-nums rose/emerald 按区间中值符号 slate-500 slate-200 ``` -------------------------------- ### 财报日历右栏列表格式 Source: https://github.com/thebiggavin/marketingdashboard/blob/main/docs/fin-window-design.md 定义了财报日历右侧公司清单的行布局,包含时间、公司名称、报告期及市值/自选星标。 ```text 20:15 贵州茅台 2025Q3 ★ slate-300 11px 9px slate-500 amber 星标=市值TOP100/自选中重磅 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.