Skip to main content

公司信息

overview()

获取公司概览信息。
// 通过股票代码查询(支持多个,逗号分隔)
const info = await client.stock.overview({ symbols: 'AAPL,00700' });
console.log(info);

// 通过股票名称查询(支持多个,逗号分隔)
const info2 = await client.stock.overview({ names: '腾讯,苹果' });
console.log(info2);
参数:
参数类型必填说明
options.symbolsstring股票代码,支持多个,用逗号分隔,如 AAPL,00700
options.namesstring股票名称,支持多个,用逗号分隔,如 腾讯,苹果
返回值: Promise<CompanyOverview> - 公司信息

shareholders()

获取主要股东列表。
const shareholders = await client.stock.shareholders('AAPL');
shareholders.forEach(holder => {
  console.log(holder.name, holder.percentage);
});

// 获取流通股股东
const outstandingShareholders = await client.stock.shareholders('AAPL', {
  type: 'outstanding_shareholders',
  limit: 20
});
参数:
参数类型必填默认值说明
symbolstring-股票代码
options.typestringshareholders股东类型:shareholders(全部股东)或 outstanding_shareholders(流通股股东)
options.limitnumber10返回数量
返回值: Promise<Shareholder[]> - 股东列表数组

财务报表

incomeStatement()

获取利润表数据。
const income = await client.stock.incomeStatement('AAPL', {
  period: 'quarterly',
  limit: 8
});
console.log(income[0].revenue, income[0].netIncome);
参数:
参数类型必填默认值说明
symbolstring-股票代码
options.periodstringannual报告期间:annual(年报)或 quarterly(季报)
options.limitnumber8返回期数
options.startDatestring-开始日期(YYYY-MM-DD)
options.endDatestring-结束日期(YYYY-MM-DD)
options.calendarstringfiscal日历类型:calendarfiscal
options.fiscalYearstring-指定财年(如 2023
options.fiscalQuarterstring-指定财季(Q1, Q2, Q3, Q4, FY, H1, Q3 (9 months)
返回值: Promise<FinancialStatement[]> - 利润表数据数组

balanceSheet()

获取资产负债表数据。
const balance = await client.stock.balanceSheet('AAPL', { period: 'annual' });
console.log(balance[0].totalAssets, balance[0].totalLiabilities);
参数:
参数类型必填默认值说明
symbolstring-股票代码
options.periodstringannual报告期间:annualquarterly
options.limitnumber8返回期数
options.startDatestring-开始日期(YYYY-MM-DD)
options.endDatestring-结束日期(YYYY-MM-DD)
options.calendarstringfiscal日历类型:calendarfiscal
options.fiscalYearstring-指定财年(如 2023
options.fiscalQuarterstring-指定财季(Q1, Q2, Q3, Q4, FY)
返回值: Promise<FinancialStatement[]> - 资产负债表数据数组

cashflowStatement()

获取现金流量表数据。
const cashflow = await client.stock.cashflowStatement('AAPL');
console.log(cashflow[0].operatingCashflow);

// 带参数查询
const cashflow2 = await client.stock.cashflowStatement('AAPL', {
  period: 'quarterly',
  limit: 8,
  calendar: 'fiscal'
});
参数:
参数类型必填默认值说明
symbolstring-股票代码
options.periodstringannual报告期间:annualquarterlycumulative quarterly
options.limitnumber8返回期数
options.startDatestring-开始日期(YYYY-MM-DD)
options.endDatestring-结束日期(YYYY-MM-DD)
options.calendarstringfiscal日历类型:calendarfiscal
options.fiscalYearstring-指定财年(如 2023
options.fiscalQuarterstring-指定财季(Q1, Q2, Q3, Q4, FY, H1, Q3 (9 months)
返回值: Promise<FinancialStatement[]> - 现金流量表数据数组

revenueBreakdown()

获取营收分解数据。
const breakdown = await client.stock.revenueBreakdown('AAPL', {
  limit: 6
});
参数:
参数类型必填默认值说明
symbolstring-股票代码
options.periodstring-报告周期(如 FYQ2
options.limitnumber6返回记录数
options.startDatestring-开始日期(YYYY-MM-DD)
options.endDatestring-结束日期(YYYY-MM-DD)
options.fiscalYearstring-指定财年(如 2023
返回值: Promise<FinancialStatement[]> - 营收分解数据数组

行情数据

quote()

获取股票行情数据(当前和历史价格)。
const quote = await client.stock.quote('AAPL', {
  startDate: '2024-01-01',
  endDate: '2024-06-30'
});
quote.forEach(p => console.log(p.date, p.close, p.volume));
参数:
参数类型必填说明
symbolstring股票代码
options.startDatestring开始日期,格式:YYYY-MM-DD
options.endDatestring结束日期,格式:YYYY-MM-DD
返回值: Promise<PriceData[]> - 股票行情数据数组

indexQuote()

获取指数行情数据。
const prices = await client.stock.indexQuote('HSI', {
  startDate: '2024-01-01',
  endDate: '2024-06-30'
});
prices.forEach(p => console.log(p.date, p.close));

// 获取标普500指数
const spx = await client.stock.indexQuote('SPX');
参数:
参数类型必填说明
symbolstring指数代码,如 HSI(恒生指数), SPX(标普500), DJI(道琼斯)
options.startDatestring开始日期,格式:YYYY-MM-DD
options.endDatestring结束日期,格式:YYYY-MM-DD
返回值: Promise<PriceData[]> - 指数价格数据数组

指数和行业

indexConstituents()

获取指数成分股列表。
// 获取沪深300指数成分股
const csi300 = await client.stock.indexConstituents('000300');
console.log(csi300);

// 获取创业板指数成分股
const chinext = await client.stock.indexConstituents('399006');
参数:
参数类型必填说明
symbolstring指数代码,如 000300(沪深300), 000016(上证50), 399006(创业板指)
返回值: Promise<IndexConstituent[]> - 成分股列表数组

indexTrackingFunds()

获取指数跟踪基金列表。
// 获取沪深300指数跟踪基金
const funds = await client.stock.indexTrackingFunds('000300');
console.log(funds);

// 获取中证500指数跟踪基金
const funds500 = await client.stock.indexTrackingFunds('000905');
参数:
参数类型必填说明
symbolstring指数代码,如 000300(沪深300), 000016(上证50), 000905(中证500)
返回值: Promise<IndexFund[]> - 跟踪基金列表数组

industryConstituents()

获取行业成分股列表。
// 获取中国军工行业成分股
const stocks = await client.stock.industryConstituents('cn', '军工');
console.log(stocks);

// 使用特定分类标准
const stocksSW = await client.stock.industryConstituents('cn', '军工', 'sw');
参数:
参数类型必填说明
marketstring股票市场:cn(中国), hk(香港), us(美国)
namestring行业名称,如 军工, Technology
typestring行业分类类型:CN 使用 sw(申万,默认)或 wind;HK 使用 hs(恒生,默认);US 使用 GICS(默认)
返回值: Promise<IndustryConstituent[]> - 成分股列表数组

日历

earningsCalendar()

财报日历。
const calendar = await client.stock.earningsCalendar({
  market: 'us',
  startDate: '2024-01-01',
  endDate: '2024-01-31'
});

// 查询特定股票的财报日程
const appleEarnings = await client.stock.earningsCalendar({
  market: 'us',
  startDate: '2024-01-01',
  endDate: '2024-12-31',
  symbol: 'AAPL'
});
参数:
参数类型必填说明
options.marketstring股票市场:cn(中国), hk(香港), us(美国)
options.startDatestring开始日期(YYYY-MM-DD)
options.endDatestring结束日期(YYYY-MM-DD)
options.symbolstring股票代码,如 AAPL
返回值: Promise<EarningsEvent[]> - 财报日历事件列表

ipoCalendarHK()

港股 IPO 日历。
// 查询已定价的 IPO
const pricedIPOs = await client.stock.ipoCalendarHK('Priced');

// 查询正在招股的 IPO
const filingIPOs = await client.stock.ipoCalendarHK('Filing');

// 查询待上市的 IPO
const pendingIPOs = await client.stock.ipoCalendarHK('Pending');
参数:
参数类型必填说明
statusstringIPO 状态:Priced(已定价), Filing(招股中), Pending(待上市), Withdrawn(已撤回)
返回值: Promise<IPOEvent[]> - IPO 事件列表

类型定义

interface CompanyOverview {
  symbol: string;
  name: string;
  sector: string;
  industry: string;
  marketCap: number;
  price: number;
  description?: string;
}

interface Shareholder {
  name: string;
  percentage: number;
  shares?: number;
  type?: string;
}

interface FinancialStatement {
  date: string;
  revenue?: number;
  grossProfit?: number;
  operatingIncome?: number;
  netIncome?: number;
  eps?: number;
  ebitda?: number;
  totalAssets?: number;
  totalLiabilities?: number;
  totalEquity?: number;
  cash?: number;
  totalDebt?: number;
  operatingCashflow?: number;
  investingCashflow?: number;
  financingCashflow?: number;
}

interface PriceData {
  date: string;
  open: number;
  high: number;
  low: number;
  close: number;
  volume: number;
  marketCap?: number;
}

interface IndexConstituent {
  market: string;
  symbol: string;
}

interface IndexFund {
  symbol: string;
  shortName: string;
  name: string;
}

interface IndustryConstituent {
  symbol: string;
  market: string;
  name: string;
  typeName?: string;
  industryOneLevelName?: string;
  industrySecondLevelName?: string;
  industryThirdLevelName?: string;
}

interface EarningsEvent {
  symbol: string;
  name: string;
  date: string;
  time?: string;
  estimate?: number;
  actual?: number;
}

interface IPOEvent {
  symbol: string;
  name: string;
  status: string;
  priceRange?: string;
  expectedDate?: string;
  shares?: number;
}