0
# Financial Instruments
1
2
AKShare provides comprehensive coverage of financial instruments with 224 functions across four major categories: FUND (79 functions), BOND (41 functions), FUTURES (62 functions), and OPTION (42 functions). This includes mutual funds, ETFs, government and corporate bonds, commodity and financial futures, and stock and commodity options.
3
4
## Fund Data (79 functions)
5
6
### Exchange Traded Funds (ETFs)
7
8
#### Real-time ETF Data
9
```python { .api }
10
import akshare as ak
11
12
def fund_etf_spot_em() -> pd.DataFrame:
13
"""
14
Real-time ETF market data from East Money
15
16
Returns:
17
pd.DataFrame: ETF real-time quotes with columns:
18
- 代码 (Code): ETF code
19
- 名称 (Name): ETF name
20
- 最新价 (Latest): Current price
21
- 涨跌额 (Change): Price change amount
22
- 涨跌幅 (Pct_change): Percentage change
23
- 成交量 (Volume): Trading volume
24
- 成交额 (Amount): Trading amount
25
- 开盘价 (Open): Opening price
26
- 最高价 (High): Highest price
27
- 最低价 (Low): Lowest price
28
- 昨收价 (Prev_close): Previous close
29
- 换手率 (Turnover): Turnover rate
30
"""
31
32
# Get real-time ETF data
33
etf_df = ak.fund_etf_spot_em()
34
print(etf_df.head())
35
# 代码 名称 最新价 涨跌额 涨跌幅 成交量 成交额
36
# 0 510050 50ETF 2.885 0.01 0.35 45678901 131770234567
37
# 1 510300 沪深300 4.123 -0.02 -0.48 23456789 96789012345
38
```
39
40
#### Historical ETF Data
41
```python { .api }
42
import akshare as ak
43
44
def fund_etf_fund_daily_em(symbol: str, start_date: str = "19700101",
45
end_date: str = "20500101") -> pd.DataFrame:
46
"""
47
ETF daily historical data
48
49
Parameters:
50
symbol: ETF code (e.g., "510050")
51
start_date: Start date in YYYYMMDD format
52
end_date: End date in YYYYMMDD format
53
54
Returns:
55
pd.DataFrame: Historical OHLCV data
56
"""
57
58
# Get 50ETF historical data
59
etf_hist = ak.fund_etf_fund_daily_em(
60
symbol="510050",
61
start_date="20240101",
62
end_date="20241201"
63
)
64
```
65
66
### Open-end Mutual Funds
67
68
#### Fund Daily Data
69
```python { .api }
70
import akshare as ak
71
72
def fund_open_fund_daily_em(symbol: str, start_date: str = "19700101",
73
end_date: str = "20500101") -> pd.DataFrame:
74
"""
75
Open-end fund daily net asset value data
76
77
Parameters:
78
symbol: Fund code (e.g., "000001")
79
start_date: Start date in YYYYMMDD format
80
end_date: End date in YYYYMMDD format
81
82
Returns:
83
pd.DataFrame: Fund NAV data with columns:
84
- 净值日期 (Date): NAV date
85
- 单位净值 (NAV): Net Asset Value per share
86
- 累计净值 (Cum_NAV): Cumulative NAV
87
- 日增长率 (Daily_return): Daily return rate
88
- 申购状态 (Purchase_status): Purchase status
89
- 赎回状态 (Redeem_status): Redemption status
90
"""
91
92
# Get fund daily data
93
fund_daily = ak.fund_open_fund_daily_em(symbol="000001")
94
print(fund_daily.head())
95
# 净值日期 单位净值 累计净值 日增长率 申购状态 赎回状态
96
# 0 2024-12-01 1.2345 2.5678 0.12 开放 开放
97
# 1 2024-11-29 1.2330 2.5663 -0.08 开放 开放
98
```
99
100
#### Fund Information and Rankings
101
```python { .api }
102
import akshare as ak
103
104
def fund_em_fund_name() -> pd.DataFrame:
105
"""
106
All fund codes and names from East Money
107
108
Returns:
109
pd.DataFrame: Fund directory with codes and names
110
"""
111
112
def fund_em_open_fund_info(fund: str, indicator: str = "单位净值走势") -> pd.DataFrame:
113
"""
114
Detailed fund information and performance
115
116
Parameters:
117
fund: Fund code
118
indicator: Information type
119
120
Returns:
121
pd.DataFrame: Fund detailed information
122
"""
123
124
# Get fund directory
125
fund_list = ak.fund_em_fund_name()
126
127
# Get specific fund information
128
fund_info = ak.fund_em_open_fund_info(fund="000001")
129
```
130
131
### Fund Performance and Ratings
132
133
#### Fund Rankings
134
```python { .api }
135
import akshare as ak
136
137
def fund_em_open_fund_rank() -> pd.DataFrame:
138
"""
139
Open-end fund performance rankings
140
141
Returns:
142
pd.DataFrame: Fund rankings by various metrics
143
"""
144
145
def fund_rating_all() -> pd.DataFrame:
146
"""
147
Fund ratings from multiple rating agencies
148
149
Returns:
150
pd.DataFrame: Comprehensive fund ratings
151
"""
152
153
# Get fund rankings
154
fund_ranks = ak.fund_em_open_fund_rank()
155
156
# Get fund ratings
157
fund_ratings = ak.fund_rating_all()
158
```
159
160
### Fund Manager Information
161
```python { .api }
162
import akshare as ak
163
164
def fund_manager() -> pd.DataFrame:
165
"""
166
Fund manager information and track records
167
168
Returns:
169
pd.DataFrame: Fund manager details and performance
170
"""
171
172
# Get fund manager data
173
managers = ak.fund_manager()
174
```
175
176
## Bond Data (41 functions)
177
178
### Government Bonds
179
180
#### Chinese Government Bonds
181
```python { .api }
182
import akshare as ak
183
184
def bond_zh_hs_daily() -> pd.DataFrame:
185
"""
186
Chinese government bond daily trading data
187
188
Returns:
189
pd.DataFrame: Government bond market data with columns:
190
- 代码 (Code): Bond code
191
- 名称 (Name): Bond name
192
- 最新价 (Price): Current price
193
- 涨跌额 (Change): Price change
194
- 涨跌幅 (Pct_change): Percentage change
195
- 成交量 (Volume): Trading volume
196
- 成交额 (Amount): Trading amount
197
- 收益率 (Yield): Current yield
198
"""
199
200
# Get government bond data
201
gov_bonds = ak.bond_zh_hs_daily()
202
```
203
204
#### Treasury Bond Yield Curves
205
```python { .api }
206
import akshare as ak
207
208
def bond_zh_yield() -> pd.DataFrame:
209
"""
210
Chinese treasury bond yield curve
211
212
Returns:
213
pd.DataFrame: Yield curve data across maturities
214
"""
215
216
# Get yield curve data
217
yield_curve = ak.bond_zh_yield()
218
```
219
220
### Corporate Bonds
221
222
#### Corporate Bond Trading
223
```python { .api }
224
import akshare as ak
225
226
def bond_cb_ths() -> pd.DataFrame:
227
"""
228
Corporate bond data from Tonghuashun
229
230
Returns:
231
pd.DataFrame: Corporate bond market information
232
"""
233
234
def bond_cbond() -> pd.DataFrame:
235
"""
236
Corporate bond comprehensive data
237
238
Returns:
239
pd.DataFrame: Corporate bond details and pricing
240
"""
241
242
# Get corporate bond data
243
corp_bonds_ths = ak.bond_cb_ths()
244
corp_bonds = ak.bond_cbond()
245
```
246
247
### Convertible Bonds
248
249
#### Convertible Bond Market
250
```python { .api }
251
import akshare as ak
252
253
def bond_convert_list() -> pd.DataFrame:
254
"""
255
Convertible bond list and basic information
256
257
Returns:
258
pd.DataFrame: Convertible bond directory with columns:
259
- 转债代码 (Code): Convertible bond code
260
- 转债名称 (Name): Bond name
261
- 现价 (Price): Current price
262
- 涨跌幅 (Change): Percentage change
263
- 转股价 (Conversion_price): Conversion price
264
- 转股价值 (Conversion_value): Conversion value
265
- 溢价率 (Premium): Premium rate
266
"""
267
268
def bond_convert_detail(symbol: str) -> pd.DataFrame:
269
"""
270
Detailed convertible bond information
271
272
Parameters:
273
symbol: Convertible bond code
274
275
Returns:
276
pd.DataFrame: Detailed bond information
277
"""
278
279
# Get convertible bond list
280
convert_list = ak.bond_convert_list()
281
282
# Get specific convertible bond details
283
convert_detail = ak.bond_convert_detail(symbol="113001")
284
```
285
286
### Bond Market Analysis
287
288
#### Bond Issue Information
289
```python { .api }
290
import akshare as ak
291
292
def bond_issue_cninfo() -> pd.DataFrame:
293
"""
294
Bond issuance information from CNInfo
295
296
Returns:
297
pd.DataFrame: New bond issuance data
298
"""
299
300
def bond_summary() -> pd.DataFrame:
301
"""
302
Bond market summary statistics
303
304
Returns:
305
pd.DataFrame: Overall bond market indicators
306
"""
307
308
# Get bond issuance data
309
bond_issues = ak.bond_issue_cninfo()
310
311
# Get market summary
312
bond_summary_data = ak.bond_summary()
313
```
314
315
## Futures Data (62 functions)
316
317
### Chinese Commodity Futures
318
319
#### Daily Futures Data
320
```python { .api }
321
import akshare as ak
322
323
def futures_zh_daily_sina(symbol: str = "RB0000") -> pd.DataFrame:
324
"""
325
Chinese futures daily data from Sina Finance
326
327
Parameters:
328
symbol: Futures contract code (e.g., "RB0000" for rebar)
329
330
Returns:
331
pd.DataFrame: Daily OHLCV data with columns:
332
- date: Trading date
333
- open: Opening price
334
- high: Highest price
335
- low: Lowest price
336
- close: Closing price
337
- volume: Trading volume
338
- hold: Open interest
339
"""
340
341
# Get rebar futures daily data
342
rebar_daily = ak.futures_zh_daily_sina(symbol="RB0000")
343
print(rebar_daily.head())
344
# date open high low close volume hold
345
# 0 2024-12-01 3456 3478 3445 3467 1234567 2345678
346
# 1 2024-11-29 3445 3465 3432 3456 1098765 2334567
347
```
348
349
#### Minute-level Futures Data
350
```python { .api }
351
import akshare as ak
352
353
def futures_zh_minute_sina(symbol: str, period: str = "1") -> pd.DataFrame:
354
"""
355
Chinese futures minute-level data
356
357
Parameters:
358
symbol: Futures contract code
359
period: Time period ("1", "5", "15", "30", "60")
360
361
Returns:
362
pd.DataFrame: Minute-level OHLCV data
363
"""
364
365
# Get 5-minute rebar data
366
rebar_5min = ak.futures_zh_minute_sina(symbol="RB2405", period="5")
367
```
368
369
### Futures Market Information
370
371
#### Futures Contract Specifications
372
```python { .api }
373
import akshare as ak
374
375
def futures_contract_info() -> pd.DataFrame:
376
"""
377
Futures contract specifications and details
378
379
Returns:
380
pd.DataFrame: Contract information including:
381
- 品种代码 (Product): Product code
382
- 品种名称 (Name): Product name
383
- 交易所 (Exchange): Trading exchange
384
- 合约乘数 (Multiplier): Contract multiplier
385
- 最小变动价位 (Tick_size): Minimum tick size
386
"""
387
388
# Get contract specifications
389
contract_info = ak.futures_contract_info()
390
```
391
392
#### Futures Main Contract Data
393
```python { .api }
394
import akshare as ak
395
396
def futures_main_sina(symbol: str) -> pd.DataFrame:
397
"""
398
Main contract data for specific futures product
399
400
Parameters:
401
symbol: Futures product code
402
403
Returns:
404
pd.DataFrame: Main contract historical data
405
"""
406
407
# Get main contract data
408
main_contract = ak.futures_main_sina(symbol="RB")
409
```
410
411
### International Futures
412
413
#### Foreign Futures Markets
414
```python { .api }
415
import akshare as ak
416
417
def futures_foreign_detail(symbol: str) -> pd.DataFrame:
418
"""
419
International futures market data
420
421
Parameters:
422
symbol: International futures symbol
423
424
Returns:
425
pd.DataFrame: Foreign futures data
426
"""
427
428
def futures_foreign_commodity() -> pd.DataFrame:
429
"""
430
International commodity futures overview
431
432
Returns:
433
pd.DataFrame: Global commodity futures prices
434
"""
435
436
# Get international futures data
437
foreign_futures = ak.futures_foreign_detail(symbol="CL")
438
commodity_overview = ak.futures_foreign_commodity()
439
```
440
441
### Futures Inventory and Warehouse Data
442
443
#### Warehouse Receipts
444
```python { .api }
445
import akshare as ak
446
447
def futures_inventory_99() -> pd.DataFrame:
448
"""
449
Futures warehouse inventory data
450
451
Returns:
452
pd.DataFrame: Inventory levels by product and warehouse
453
"""
454
455
def futures_inventory_shfe() -> pd.DataFrame:
456
"""
457
Shanghai Futures Exchange inventory data
458
459
Returns:
460
pd.DataFrame: SHFE warehouse receipts
461
"""
462
463
# Get inventory data
464
inventory_data = ak.futures_inventory_99()
465
shfe_inventory = ak.futures_inventory_shfe()
466
```
467
468
### Commitment of Traders (COT) Reports
469
470
#### COT Data Analysis
471
```python { .api }
472
import akshare as ak
473
474
def cot_report() -> pd.DataFrame:
475
"""
476
CFTC Commitment of Traders report
477
478
Returns:
479
pd.DataFrame: COT position data for US futures
480
"""
481
482
def cot_report_legacy() -> pd.DataFrame:
483
"""
484
Legacy COT report format
485
486
Returns:
487
pd.DataFrame: Historical COT data format
488
"""
489
490
# Get COT reports
491
cot_data = ak.cot_report()
492
cot_legacy = ak.cot_report_legacy()
493
```
494
495
## Options Data (42 functions)
496
497
### Stock Options
498
499
#### Options Market Overview
500
```python { .api }
501
import akshare as ak
502
503
def option_finance_board() -> pd.DataFrame:
504
"""
505
Options market overview and statistics
506
507
Returns:
508
pd.DataFrame: Options market summary with columns:
509
- 合约代码 (Contract): Option contract code
510
- 合约名称 (Name): Contract name
511
- 最新价 (Price): Current price
512
- 涨跌额 (Change): Price change
513
- 涨跌幅 (Pct_change): Percentage change
514
- 成交量 (Volume): Trading volume
515
- 持仓量 (Open_interest): Open interest
516
- 隐含波动率 (IV): Implied volatility
517
"""
518
519
# Get options market data
520
options_board = ak.option_finance_board()
521
```
522
523
#### Individual Option Contracts
524
```python { .api }
525
import akshare as ak
526
527
def option_finance_sina(symbol: str) -> pd.DataFrame:
528
"""
529
Individual option contract data from Sina Finance
530
531
Parameters:
532
symbol: Option contract code
533
534
Returns:
535
pd.DataFrame: Option contract details and pricing
536
"""
537
538
def option_sina_sse_list(symbol: str, trade_date: str) -> pd.DataFrame:
539
"""
540
Shanghai Stock Exchange option contracts list
541
542
Parameters:
543
symbol: Underlying asset symbol
544
trade_date: Trading date (YYYY-MM-DD)
545
546
Returns:
547
pd.DataFrame: SSE option contracts for underlying
548
"""
549
550
# Get individual option data
551
option_contract = ak.option_finance_sina(symbol="10004373")
552
553
# Get SSE option list for 50ETF
554
sse_options = ak.option_sina_sse_list(symbol="510050", trade_date="2024-12-01")
555
```
556
557
### Commodity Options
558
559
#### Commodity Option Markets
560
```python { .api }
561
import akshare as ak
562
563
def option_commodity_em() -> pd.DataFrame:
564
"""
565
Commodity options data from East Money
566
567
Returns:
568
pd.DataFrame: Commodity option market information
569
"""
570
571
def option_commodity_hist(symbol: str) -> pd.DataFrame:
572
"""
573
Historical commodity option data
574
575
Parameters:
576
symbol: Commodity option symbol
577
578
Returns:
579
pd.DataFrame: Historical option data
580
"""
581
582
# Get commodity options data
583
commodity_options = ak.option_commodity_em()
584
585
# Get historical commodity option data
586
commodity_hist = ak.option_commodity_hist(symbol="C2405C2800")
587
```
588
589
### Options Analytics
590
591
#### Implied Volatility and Greeks
592
```python { .api }
593
import akshare as ak
594
595
def option_finance_sina_sse_greeks(trade_date: str) -> pd.DataFrame:
596
"""
597
Options Greeks data for SSE options
598
599
Parameters:
600
trade_date: Trading date (YYYY-MM-DD)
601
602
Returns:
603
pd.DataFrame: Options Greeks including:
604
- Delta: Price sensitivity to underlying
605
- Gamma: Delta sensitivity to underlying
606
- Theta: Time decay
607
- Vega: Volatility sensitivity
608
- Rho: Interest rate sensitivity
609
"""
610
611
# Get options Greeks
612
greeks_data = ak.option_finance_sina_sse_greeks(trade_date="2024-12-01")
613
```
614
615
## Financial Instrument Analysis Patterns
616
617
### Cross-Asset Analysis
618
```python { .api }
619
import akshare as ak
620
import pandas as pd
621
622
def create_multi_asset_dashboard() -> dict:
623
"""Create comprehensive financial instruments dashboard"""
624
625
dashboard = {
626
'etfs': ak.fund_etf_spot_em(),
627
'bonds': ak.bond_zh_hs_daily(),
628
'futures': ak.futures_zh_daily_sina(symbol="RB0000"),
629
'options': ak.option_finance_board()
630
}
631
632
return dashboard
633
634
def analyze_yield_curve_impact() -> pd.DataFrame:
635
"""Analyze yield curve impact on different instruments"""
636
637
# Get yield curve
638
yield_curve = ak.bond_zh_yield()
639
640
# Get bond prices
641
bond_prices = ak.bond_zh_hs_daily()
642
643
# Get interest rate sensitive ETFs
644
rate_etfs = ak.fund_etf_spot_em()
645
646
# Analysis would combine these datasets
647
return combined_analysis
648
649
# Usage
650
multi_asset_data = create_multi_asset_dashboard()
651
yield_analysis = analyze_yield_curve_impact()
652
```
653
654
### Risk Management Applications
655
```python { .api }
656
import akshare as ak
657
658
def portfolio_risk_monitor(holdings: dict) -> dict:
659
"""Monitor risk across different financial instruments"""
660
661
risk_data = {}
662
663
# ETF volatility monitoring
664
if 'etfs' in holdings:
665
etf_data = ak.fund_etf_spot_em()
666
risk_data['etf_volatility'] = etf_data
667
668
# Bond duration risk
669
if 'bonds' in holdings:
670
bond_data = ak.bond_zh_hs_daily()
671
risk_data['bond_duration'] = bond_data
672
673
# Futures margin requirements
674
if 'futures' in holdings:
675
futures_data = ak.futures_contract_info()
676
risk_data['futures_margin'] = futures_data
677
678
# Options Greeks risk
679
if 'options' in holdings:
680
options_greeks = ak.option_finance_sina_sse_greeks(trade_date="2024-12-01")
681
risk_data['options_greeks'] = options_greeks
682
683
return risk_data
684
685
# Usage
686
portfolio_holdings = {
687
'etfs': ['510050', '510300'],
688
'bonds': ['019547', '019640'],
689
'futures': ['RB2405', 'AU2405'],
690
'options': ['10004373', '10004374']
691
}
692
693
risk_monitor = portfolio_risk_monitor(portfolio_holdings)
694
```
695
696
## Data Characteristics
697
698
### Update Frequencies
699
- **Real-time data**: ETF and futures prices during trading hours
700
- **Daily data**: End-of-day NAV for funds, settlement prices for futures
701
- **Weekly data**: Fund performance rankings and ratings
702
- **Monthly data**: Fund detailed reports and analytics
703
704
### Market Coverage
705
- **Chinese Markets**: Complete coverage of domestic funds, bonds, futures, options
706
- **International Markets**: Major global futures and some international funds
707
- **Product Breadth**: 224 functions covering all major financial instrument types
708
- **Historical Depth**: Multi-year historical data for most instruments
709
710
### Common Applications
711
1. **Asset Allocation**: Multi-asset portfolio construction and analysis
712
2. **Risk Management**: Cross-asset risk monitoring and hedging strategies
713
3. **Arbitrage**: Basis trading between futures and underlying assets
714
4. **Income Generation**: Bond yield analysis and options strategies
715
5. **Hedging**: Using derivatives for portfolio protection
716
717
The financial instruments capabilities in AKShare provide comprehensive coverage for sophisticated investment strategies across multiple asset classes and derivatives markets.