Securities Bao Www.baostock.com is a free, open-source securities data platform.
Provide a large number of accurate and complete securities historical market data, listed company financial data, real-time securities market push services.
Acquisition of securities data information through the Python API, to meet quantitative trading investors, quantitative financial enthusiasts, metering economic practitioners data needs.
This introduction interface: To obtain the quarterly frequency cash flow data :query_cash_flow_data ()
(The following code from the official website, invasion and deletion )
Method Description: Query the quarterly cash flow information, can be set by the parameters to obtain the corresponding year, quarter data, to provide 2007 to date data.
return type: The Dataframe type of pandas.
The sample code is as follows:
IMPORT BAOSTOCK AS BSIMPORT PANDAS AS PD # Landing System Lg = bs.login (user_id= "Anonymous", password= "123456") # display login return information print (' Login respond error_code: ' +lg.error_code ' Print (' login respond error_msg: ' +lg.error_msg) # Tiping Cash Flow cash_flow_list = []rs_cash_flow = bs.query_cash_flow_data (code= "sh.600000", year=2017, quarter=2) while (rs_cash_flow.error_code == ' 0 ') & rs_cash_ Flow.next (): cash_flow_list.append (Rs_cash_flow.get_row_data ()) result_cash_flow =  PD. DataFrame (cash_flow_list, columns=rs_cash_flow.fields) # printed output print (Result_cash_flow) # Result set Output to CSV file Result_cash_flow.to_csv ("D:\\cash_flow_data.csv", encoding= "GBK", index=false) # Logout System bs.logout ()
parameter meaning:
Code: Stock code, SH or sz.+6 digit code, or index code, such as: sh.601398. SH: Shanghai; SZ: Shenzhen. This parameter is not nullable;
Year: Statistic year, default current year for empty;
Quarter: Statistics quarter, empty when default current quarter. When not empty, there are only 4 values: 1,2,3,4.
Return Data Description
parameter name |
parameter description |
code |
security code |
pubdate |
date of publication of the company's earnings |
statdate |
Last day of the quarter of the earnings statistics, such as 2017-03-31, 2017-06-30 |
catoasset |
Liquid assets divided by total assets |
ncatoasset |
non-current assets divided by total asset |
tangibleassettoasset |
tangible assets divided by total assets |
ebittointerest |
Cash multiplier |
cfotoor |
net cash flow from operating activities divided by operating income |
cfotonp |
Net operating cash flow divided by net profit |
cfotogr |
Net operating cash flow divided by total operating income |
Sample data:
Baostock: Use Python's Baostock interface to query for seasonal cash flow