Baostock: Use Python's Baostock interface to query for seasonal cash flow

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.