SPB Git forge

spb/hfmarketdata

Public

Open high-frequency market data platform — FirstRate full-history downloader, DuckDB/Parquet lake, open REST API and React docs platform (www.hfmarketdata.io)

127commits 1branches 0releases
24.7 MBsize
maindefault branch
11 days agolast push
JavaScript 53.7% Python 38.3% CSS 4.6% TypeScript 3.1%
1.3 KB · 22 lines javascript
Raw Blame History
1#!/usr/bin/env node2// Live smoke test: spawn the built server over stdio, list tools, call get_bars against the real API.3// Usage: node scripts/live-smoke.mjs   (requires `npm run build`; respects HFMD_API_KEY / HFMD_BASE_URL)4import { Client } from '@modelcontextprotocol/sdk/client/index.js';5import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';6import { fileURLToPath } from 'node:url';7import path from 'node:path';89const here = path.dirname(fileURLToPath(import.meta.url));10const transport = new StdioClientTransport({ command: process.execPath, args: [path.join(here, '..', 'dist', 'index.js')], env: { ...process.env } });11const client = new Client({ name: 'live-smoke', version: '1.0.0' });12await client.connect(transport);13const tools = await client.listTools();14console.log(`tools: ${tools.tools.length} → ${tools.tools.map((t) => t.name).join(', ')}`);15const t0 = Date.now();16const res = await client.callTool({ name: 'get_bars', arguments: { asset: 'stock', symbol: 'AAPL', timeframe: '1day', start: '2025-01-02', end: '2025-01-10' } });17console.log(`get_bars AAPL (${Date.now() - t0} ms, isError=${!!res.isError}):`);18console.log(res.content[0].text.slice(0, 700));19const status = await client.readResource({ uri: 'hfmarketdata://limits' });20console.log(status.contents[0].text.slice(0, 300));21await client.close();22