Scale index Introduction, how to get data using Python

Source: Internet
Author: User
Tags stock prices

the person who touches the investment will hear more or less: the certificate100, the certificate200, Shanghai and Shenzhen300, the certificate500, the certificate700, the certificate800, the certificate1000These financial abbreviations ... But in fact, many people do not know what these represent? What is the point of dealing with yourself?

in fact, These are the index of the size of the market, which is reflected in the index of the Chinese certificate . So what do these indices represent in particular the market performance of stocks?

first of all, we must first understand the certificate - , Shanghai and Shenzhen - and the three key indicators of the Chinese certificate :

in China , the Shanghai and Shenzhen market capitalisation of the stock (such as the four major lines, two barrels of oil);

Shanghai and Shenzhen, Shanghai and Shenzhen market value of the pre-large stock;

the stock of theShanghai-Shenzhen market, which is large before the value of the securities;

On this basis, the following indices are deduced:

in the certificate, Shanghai and Shenzhen to eliminate the 101-300, that is, the market capitalization of the stock;

in the certificate, the Chinese certificate is excluded from Shanghai and Shenzhen , that is, the market capitalisation of 301-800 stocks;

in the certificate of the 101-800, the Chinese certificate is excluded from the certificate, that is, the market capitalization of the stock;

in the certificate, the remaining market value after the 801-1800 of the stock, that is, the market value of the stock .

Shanghai , according to the scientific objective method, select the most representative stock of the Shanghai stock market with large scale and good fluidity , in order to comprehensively reflect the overall situation of a group of leading enterprises with the most market influence in Shanghai securities market. the Shanghai Index has been officially released since 2004 1 months and 2 days. The goal is to create an investment index that is active, large-scale, and mainly based on derivative financial instruments.

SSE Sample selection:

sample space: SSE Index sample unit.

number of samples: only stock.

Sampling criteria: scale; liquidity.

Sampling method: According to the total market value, the transaction amount of the stock to a comprehensive ranking, take the top four stock composition sample, but the market performance is abnormal and the Expert Committee decided not suitable as a sample of stocks except.

Shanghai Index is a financial indicator which is jointly released by the Shanghai and Shenzhen Stock Exchange on the 4- month 8-day period , which reflects the target and operational status of the Shanghai and Shenzhen Index, and can be used as an evaluation criterion for the investment performance. Provide the basic conditions for the innovation of index-based investment and index derivative products.

The CSI Index is based on size and liquidity as the two fundamental criteria for sampling and gives greater liquidity weight, in line with the characteristics of the index in the trading index. After the listing of listed companies to choose the index, also set a detailed conditions for inclusion, such as new shares (except a few large-cap companies) will not soon enter the index, in general, after a quarter of the time to market stock is likely to be selected in the Index sample unit; Stocks and shares with unusual operating conditions or financial reports that have a significant loss of stock and stock prices that fluctuate significantly and that market performance is clearly manipulated. therefore, - The index reflects the comprehensive change of the stock price of the liquid and large-scale representative stock, which can provide the investors with the authoritative investment direction, and also facilitate the investors to track and make the investment portfolio, which ensures the stability, representativeness and operability of the index.

Chinese Certificate Index is one of the indices developed by the index Company Limited, and the stock in its sample space is made up of all A shares , which exclude the stocks of the Shanghai-Shenzhen Index and the top-ranked stock in the total market capitalisation , constitute the top stock of the total market capitalisation and reflect China a Share price performance of a group of small and medium-sized companies in the stock market.

Sampling Method

follow the steps below to select the sample stocks for the index:

Step 1 The stock in the sample space is deducted from the Shanghai- Shenzhen Index sample stock, which is the last year's average market value .

Step 2 The remaining stocks in step 1 according to the most recent year (the IPO since the listing) Average daily deal amount from high to low ranking, excluding the post -20% stock;

Step 3 The remaining stocks in step 2 According to the average daily market value from high to low ranking, select the top ranked in the stock as a sample stock index.

How to use How do Python choose these indices? The answer is to use the Python baostock Interface, the sample code is as follows:

import baostock as bsimport pandas as pd ####  Landing System  ### #lg  =  bs.login () #  display login return information print (' Login respond error_code: ' +lg.error_code) print (' login  Respond  error_msg: ' +lg.error_msg '  ####  get Index (composite index, scale Index, industry index, level two industry index, strategy Index, Growth Index, value Index, subject index) Candlestick Data  ##### #综合指数, such as:sh.000001  Shanghai Composite Index,sz.399106   , etc.. # #规模指数, for example:sh.000016  Shanghai 50,sh.000300   Shenzhen 300,sh.000905  certificate 500,sz.399001  exponentially, etc. # #一级行业指数, for example:sh.000037  Shanghai Pharmaceutical,sz.399433  National Certificate delivery   etc; # #二级行业指数, for example: sh.000952 300 real estate, sz.399951 300 bank   etc; # #策略指数, for example: sh.000050 50 rights, sh.000982  500   etc; # #成长指数, such as:sz.399376  small plate growth   etc; # #价值指数, for example: sh.000029 180 value   etc; # #主题指数, For example, the:sh.000015  dividend index,sh.000063  The; #  detailed indicator parameters of the SSE period  , see the "Historical Market Indicator Parameters" section Rs = bs.query_ History_k_data ("sh.600000",     "Date,code,open,high,low,close,preclose,volume,amount, Pctchg ",     start_Date= ' 2017-01-01 ',  end_date= ' 2017-06-30 ',      frequency= "D",  adjustflag= "3" Print (' Query_history_k_data respond error_code: ' +rs.error_code) print (' query_history_k_data  Respond  error_msg: ' +rs.error_msg '  ####  print result set  ### #data_list  = []while  (rs.error_code ==  ' 0 ')  & rs.next ():    #  gets a record that merges the records together     data_list.append (Rs.get_row_data ()) result = pd. DataFrame (data_list, columns=rs.fields) ####  result set Output to CSV file  ####   result.to_csv ("D : \\history_Index_k_data.csv ",  index=false) print (Result)  ####  logout system  ### #bs. Logout ()


Return data as follows, it can be seen that there are open high and low income indicators, very convenient.

Scale index Introduction, how to get data using Python

Related Article

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.