Skip to main content
股票数据模块的方法返回 pandas DataFrame,方便进行数据分析。

公司信息

overview()

获取公司概览信息。
info = client.stock.overview("US:AAPL")
print(info["name"], info["sector"], info["industry"])
symbol
string
required
股票代码,格式:市场:代码,如 US:AAPL, HK:0700, CN:600519
返回值
dict
公司信息,包含 name, description, sector, industry, market_cap

shareholders()

获取主要股东列表。
shareholders = client.stock.shareholders("US:AAPL")
for holder in shareholders:
    print(holder["name"], holder["percentage"])
symbol
string
required
股票代码
返回值
list[dict]
股东列表,包含 name, shares, percentage

财务报表

income_statement()

获取利润表数据。
income = client.stock.income_statement(
    symbol="US:AAPL",
    period="quarterly",
    limit=8
)
print(income[["revenue", "net_income", "eps"]].head())
symbol
string
required
股票代码
period
string
default:"annual"
报告期间:annual(年报)或 quarterly(季报)
limit
int
default:"10"
返回期数
返回值
DataFrame
利润表数据,以日期为索引,包含 revenue, gross_profit, operating_income, net_income, eps 等列

balance_sheet()

获取资产负债表数据。
balance = client.stock.balance_sheet("US:AAPL", period="annual")
print(balance[["total_assets", "total_liabilities", "total_equity"]].head())
symbol
string
required
股票代码
period
string
default:"annual"
报告期间:annualquarterly
limit
int
default:"10"
返回期数
返回值
DataFrame
资产负债表数据

cashflow_statement()

获取现金流量表数据。
cashflow = client.stock.cashflow_statement("US:AAPL")
print(cashflow[["operating_cashflow", "investing_cashflow", "financing_cashflow"]].head())
symbol
string
required
股票代码
period
string
default:"annual"
报告期间:annualquarterly
limit
int
default:"10"
返回期数
返回值
DataFrame
现金流量表数据

revenue_breakdown()

获取营收分解数据。
breakdown = client.stock.revenue_breakdown("US:AAPL", breakdown_type="segment")
print(breakdown)
symbol
string
required
股票代码
breakdown_type
string
default:"segment"
分解类型:segment(业务分部), product(产品), region(地区)

行情数据

prices()

获取历史股价数据。
prices = client.stock.prices(
    symbol="US:AAPL",
    start_date="2024-01-01",
    end_date="2024-06-30",
    limit=100
)
print(prices[["close", "volume", "market_cap"]].tail())
symbol
string
required
股票代码
start_date
str
开始日期,格式:YYYY-MM-DD
end_date
str
结束日期,格式:YYYY-MM-DD
limit
int
default:"100"
返回记录数
返回值
DataFrame
股价数据,包含 close, volume, market_cap, pe, ps

kline()

获取 K 线数据。
kline = client.stock.kline(
    symbol="US:TSLA",
    interval="1d",
    adjust="forward",
    limit=100
)
print(kline[["open", "high", "low", "close", "volume"]].tail())
symbol
string
required
股票代码
interval
string
default:"1d"
时间周期:1d(日线), 1w(周线), 1m(月线)
adjust
string
default:"forward"
复权类型:forward(前复权), backward(后复权), none(不复权)
start_date
str
开始日期
end_date
str
结束日期
limit
int
default:"100"
返回记录数

quote()

获取实时行情。
quotes = client.stock.quote(["US:AAPL", "US:MSFT", "US:GOOGL"])
print(quotes[["symbol", "price", "change_percent"]])
symbols
str | list[str]
required
单个或多个股票代码
返回值
DataFrame
实时行情数据

选股和日历

screener()

股票筛选器。
stocks = client.stock.screener(
    market="US",
    min_market_cap=1e10,  # 100亿美元以上
    max_pe=30,
    limit=50
)
market
str
市场:US, HK, CN
sector
str
行业板块
min_market_cap
float
最小市值
max_market_cap
float
最大市值
min_pe
float
最小市盈率
max_pe
float
最大市盈率
limit
int
default:"50"
返回数量

earnings_calendar()

财报日历。
calendar = client.stock.earnings_calendar(
    area="us",
    start_date="2024-01-01",
    end_date="2024-01-31"
)
area
string
default:"us"
市场区域:us, hk, cn
start_date
str
开始日期
end_date
str
结束日期
symbol
str
指定股票代码

ipo_calendar_hk()

港股 IPO 日历。
ipos = client.stock.ipo_calendar_hk(status="Filing")
status
string
default:"Filing"
IPO 状态:Filing(申报), Hearing(聆讯), Priced(定价)