使用示例
初始化客户端:
from asharehub import AShareHub
client = AShareHub(api_key="ash_your_key_here")
获取日线行情:
df = client.market_daily(symbol="000001.SZ", start_date="20240101", end_date="20240331")
print(df.head())
获取北向资金:
flows = client.moneyflow_hsgt(start_date="20240101", end_date="20240131")
print(flows[["trade_date", "north_money"]].head())
获取财务指标:
fina = client.financial_indicators(symbol="000001.SZ")
print(fina[["end_date", "roe", "grossprofit_margin", "eps"]].head())
全部方法一览:
| 方法 | 接口 | 说明 |
|---|---|---|
| market_daily() | /v2/market/daily | 日线行情 |
| fundamentals() | /v2/market/fundamentals | PE/PB/换手率/市值 |
| adj_factor() | /v2/market/adj-factor | 复权因子 |
| technical_factors() | /v2/market/technical-factors | MACD/KDJ/RSI/BOLL/CCI |
| technical_factors_pro() | /v2/market/technical-factors-pro | 200+ 技术指标 |
| margin() | /v2/market/margin | 融资融券明细 |
| block_trade() | /v2/market/block-trade | 大宗交易 |
| top_list() | /v2/market/top-list | 龙虎榜 |
| top_inst() | /v2/market/top-inst | 龙虎榜机构席位 |
| shareholders() | /v2/market/shareholders | 股东人数 |
| holder_trade() | /v2/market/holder-trade | 股东增减持 |
| concepts() | /v2/market/concepts | 概念板块指数 |
| concept_members() | /v2/market/concept-members | 概念成分股 |
| limit_list() | /v2/market/limit-list | 涨跌停统计 |
| moneyflow_hsgt() | /v2/flows/moneyflow-hsgt | 沪深港通资金 |
| moneyflow() | /v2/flows/moneyflow | 个股资金流向 |
| northbound_holdings() | /v2/flows/northbound-holdings | 北向持股明细 |
| southbound_holdings() | /v2/flows/southbound-holdings | 南向持股明细 |
| chip_distribution() | /v2/chips/distribution | 筹码分布 |
| fx_daily() | /v2/fx/daily | 外汇行情 |
| index_daily() | /v2/indices/daily | 指数日线 |
| index_weight() | /v2/indices/index-weight | 指数权重 |
| financial_indicators() | /v2/financials/indicators | 50+ 财务指标 |
| income() | /v2/financials/income | 利润表 |
| balance_sheet() | /v2/financials/balance-sheet | 资产负债表 |
| cash_flow() | /v2/financials/cash-flow | 现金流量表 |
| forecast() | /v2/financials/forecast | 业绩预告 |
| express() | /v2/financials/express | 业绩快报 |
| audit() | /v2/financials/audit | 审计意见 |
| main_business() | /v2/financials/main-business | 主营业务构成 |
| disclosure_date() | /v2/financials/disclosure-date | 财报披露日期 |
| analyst_reports() | /v2/financials/analyst-reports | 研报分析 |
| dividend() | /v2/shareholders/dividend | 分红送股 |
| stock_list() | /v2/reference/stocks | 股票列表 |
| industry_list() | /v2/reference/industries | 申万行业分类 |
| trade_calendar() | /v2/reference/trade-calendar | 交易日历 |
Esc