AKShare provides basic data, real-time and historical market data and derivative data of more than 10 kinds of financial and other products such as stocks, futures, bonds, options, foreign exchange, currency, private placement, public offering, and cryptocurrency, including a set of open source tools for data collection, data cleaning, and data landing. To meet the needs of financial data scientists and data science enthusiasts in financial data acquisition.
characteristic:
- The code syntax conforms to PEP8 standard, and the naming of data interface is unified.
- Python 3.7.5 or later is best supported.
- Provide the best documentation support, each data interface provides detailed instructions and examples, only need to copy and paste to download data;
- Continuous maintenance of some data interface anomalies caused by changes in the target web page;
- Continuously update the financial data interface while optimizing the source code;
- Provides comprehensive interface documentation to improve the ease of use of AKShare.
data dictionary:
- stock data
- Futures data
- Bond data
- Option data
- Industry index
- Energy data
- Other data
give a typical example:
- Get the rollover yield
import akshare as akget_roll_yield_bar_df = ak.get_roll_yield_bar(type_method="date", var="RB", start_day="20180618", end_day="20180718", plot=True)print(get_roll_yield_bar_df)
result display: roll_yield near_by deferred date,Rollover yield Most recent contract, next contract 2018-06-19 0.191289 RB1810 RB19012018-06-20 0.192123 RB1810 RB19012018-06-21 0.183304 RB1810 RB19012018-06-22 0.190642 RB1810 RB19012018-06-25 0.194838 RB1810 RB19012018-06-26 0.204314 RB1810 RB19012018-06-27 0.213667 RB1810 RB19012018-06-28 0.211701 RB1810 RB19012018-06-29 0.205892 RB1810 RB1901
- Display price information for a certain range
import akshare as akimport mplfinance as mpf stock_us_daily_df = ak。stock_us_daily ( symbol = "AAPL" , adjust = "qfq" )stock_us_daily_df = stock_us_daily_df [[ "open" , "high" , "low" , "close" , "volume" ]]stock_us_daily_df。list = [ “Open Price”、“ High Price”、“Low Price”、“Close Price”、“Volume” ]stock_us_daily_df。indexes.name = "Date"stock_us_daily_df = stock_us_daily_df [ "2020-04-01" : "2020-04-29" ]mpf .
( stock_us_daily_df , type = 'candle' , mav = ( 3 , 6 , 9 ), volume = True , show_nontrading = False )
output
AKShare will later add more data interfaces and derivative metrics based on academic papers and research reports, and provide the corresponding calculation code, which you can read on your own.