Documentation Index
Fetch the complete documentation index at: https://docs.reportify.cn/llms.txt
Use this file to discover all available pages before exploring further.
npm install reportify-sdk
快速开始
import { Reportify } from 'reportify-sdk';
// 初始化客户端
const client = new Reportify({ apiKey: 'your-api-key' });
// 搜索文档
const docs = await client.search.all('Tesla earnings', { num: 10 });
docs.forEach(doc => console.log(doc.title));
// 搜索新闻
const news = await client.search.news('Apple iPhone', { symbols: ['US:AAPL'] });
// 获取股票财务数据
const income = await client.stock.incomeStatement('AAPL', { period: 'quarterly' });
console.log(income);
文档搜索
支持多种文档类型搜索:新闻、研报、公告、电话会议纪要等
配置选项
你的 Reportify API 密钥,可在开发者中心获取
baseUrl
string
default:"https://api.reportify.cn"
API 基础 URL,通常不需要修改
错误处理
import {
Reportify,
AuthenticationError,
RateLimitError,
NotFoundError,
APIError
} from 'reportify-sdk';
try {
const docs = await client.search.all('Tesla');
} catch (error) {
if (error instanceof AuthenticationError) {
console.error('API Key 无效');
} else if (error instanceof RateLimitError) {
console.error('请求过于频繁,请稍后重试');
} else if (error instanceof NotFoundError) {
console.error('资源不存在');
} else if (error instanceof APIError) {
console.error(`API 错误: ${error.message}`);
}
}
TypeScript 支持
SDK 提供完整的 TypeScript 类型定义:
import type {
Document,
SearchOptions,
IncomeStatement,
BalanceSheet,
TimelineItem
} from 'reportify-sdk';
const options: SearchOptions = {
num: 10,
categories: ['news', 'reports'],
symbols: ['US:TSLA']
};
const docs: Document[] = await client.search.all('Tesla', options);
ESM 和 CommonJS
SDK 同时支持 ES Modules 和 CommonJS:
import { Reportify } from 'reportify-sdk';
下一步