| name | finshare |
| description | 获取中国A股、基金、期货的实时行情和历史数据。功能包括K线数据、实时快照、资金流向、龙虎榜、融资融券、基金净值等。 |
| user-invocable | true |
finshare - 金融数据获取工具
finshare 是一个专业的中国金融数据获取工具库,完全免费,无需 API Key。
安装
pip install finshare
主要功能
1. 获取股票K线数据
import finshare as fs
df = fs.get_historical_data('000001.SZ', start='2024-01-01', end='2024-12-31')
print(df.head())
2. 获取实时快照
snapshot = fs.get_snapshot_data('000001.SZ')
print(f"最新价: {snapshot.last_price}")
snapshots = fs.get_batch_snapshots(['000001.SZ', '600519.SH'])
3. 资金流向数据
df = fs.get_money_flow('000001.SZ')
df = fs.get_money_flow_industry()
4. 龙虎榜数据
df = fs.get_lhb()
df = fs.get_lhb_detail('000001.SZ')
5. 融资融券
df = fs.get_margin()
df = fs.get_margin_detail('000001.SZ')
6. 基金数据
df = fs.get_fund_nav('161039', '2024-01-01', '2024-12-31')
info = fs.get_fund_info('161039')
funds = fs.get_fund_list()
7. 期货数据
df = fs.get_future_kline('cu0', '2024-06-01', '2024-07-17')
snapshot = fs.get_future_snapshot('cu0')
8. 证券列表
stocks = fs.get_stock_list()
etfs = fs.get_etf_list()
lofs = fs.get_lof_list()
futures = fs.get_future_list()
支持的数据源
- 东方财富
- 腾讯财经
- 新浪财经
- 通达信
- BaoStock
更多信息