IPO新股列表new_share
1. 基础信息
import pandas as pd
import tushare as ts
from sqlalchemy import create_engine
import pymysql
pymysql.install_as_MySQLdb()
date_1 = '19600101'
date_2 = '19800101'
date_3 = '20000101'
date_4 = '20150101'
date_5 = '20210101'
2. 从数据接口取出new_share(由于限制,分两次取再合并)
2.1 20000101到20150101
pro = ts.pro_api()
df = pro.new_share(start_date = date_3, end_date = date_4)
df.head()
| ts_code | sub_code | name | ipo_date | issue_date | amount | market_amount | price | pe | limit_amount | funds | ballot |
---|
0 | 603889.SH | 732889 | 新澳股份 | 20141223 | 20141231 | 2668.0 | 2401.2 | 17.95 | 21.63 | 1.0 | 4.7891 | 0.43 |
---|
1 | 603017.SH | 732017 | 园区设计 | 20141222 | 20141231 | 1500.0 | 1350.0 | 29.97 | 22.88 | 0.6 | 4.4955 | 0.55 |
---|
2 | 603636.SH | 732636 | 南威软件 | 20141222 | 20141230 | 2500.0 | 2250.0 | 14.95 | 22.96 | 1.0 | 3.7375 | 0.40 |
---|
3 | 002736.SZ | 002736 | 国信证券 | 20141219 | 20141229 | 120000.0 | 60000.0 | 5.83 | 22.97 | 36.0 | 69.9600 | 1.80 |
---|
4 | 002738.SZ | 002738 | 中矿资源 | 20141219 | 20141230 | 3000.0 | 2700.0 | 7.57 | 22.98 | 1.2 | 2.2710 | 0.40 |
---|
df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1082 entries, 0 to 1081
Data columns (total 12 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 ts_code 1082 non-null object
1 sub_code 1082 non-null object
2 name 1082 non-null object
3 ipo_date 1082 non-null object
4 issue_date 1082 non-null object
5 amount 1082 non-null float64
6 market_amount 1082 non-null float64
7 price 1082 non-null float64
8 pe 1082 non-null float64
9 limit_amount 1082 non-null float64
10 funds 1082 non-null float64
11 ballot 1082 non-null float64
dtypes: float64(7), object(5)
memory usage: 101.6+ KB
2.2 20150101到20210101
pro = ts.pro_api()
df_2 = pro.new_share(start_date = date_4, end_date = date_5)
df_2.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1369 entries, 0 to 1368
Data columns (total 12 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 ts_code 1369 non-null object
1 sub_code 1369 non-null object
2 name 1369 non-null object
3 ipo_date 1369 non-null object
4 issue_date 1369 non-null object
5 amount 1369 non-null float64
6 market_amount 1369 non-null float64
7 price 1369 non-null float64
8 pe 1369 non-null float64
9 limit_amount 1369 non-null float64
10 funds 1369 non-null float64
11 ballot 1369 non-null float64
dtypes: float64(7), object(5)
memory usage: 128.5+ KB
2.3 将二者合并
frames = [df, df_2]
data = pd.concat(frames, ignore_index = True)
data.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 2451 entries, 0 to 2450
Data columns (total 12 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 ts_code 2451 non-null object
1 sub_code 2451 non-null object
2 name 2451 non-null object
3 ipo_date 2451 non-null object
4 issue_date 2451 non-null object
5 amount 2451 non-null float64
6 market_amount 2451 non-null float64
7 price 2451 non-null float64
8 pe 2451 non-null float64
9 limit_amount 2451 non-null float64
10 funds 2451 non-null float64
11 ballot 2451 non-null float64
dtypes: float64(7), object(5)
memory usage: 229.9+ KB
data.head()
| ts_code | sub_code | name | ipo_date | issue_date | amount | market_amount | price | pe | limit_amount | funds | ballot |
---|
0 | 603889.SH | 732889 | 新澳股份 | 20141223 | 20141231 | 2668.0 | 2401.2 | 17.95 | 21.63 | 1.0 | 4.7891 | 0.43 |
---|
1 | 603017.SH | 732017 | 园区设计 | 20141222 | 20141231 | 1500.0 | 1350.0 | 29.97 | 22.88 | 0.6 | 4.4955 | 0.55 |
---|
2 | 603636.SH | 732636 | 南威软件 | 20141222 | 20141230 | 2500.0 | 2250.0 | 14.95 | 22.96 | 1.0 | 3.7375 | 0.40 |
---|
3 | 002736.SZ | 002736 | 国信证券 | 20141219 | 20141229 | 120000.0 | 60000.0 | 5.83 | 22.97 | 36.0 | 69.9600 | 1.80 |
---|
4 | 002738.SZ | 002738 | 中矿资源 | 20141219 | 20141230 | 3000.0 | 2700.0 | 7.57 | 22.98 | 1.2 | 2.2710 | 0.40 |
---|
df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1082 entries, 0 to 1081
Data columns (total 12 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 ts_code 1082 non-null object
1 sub_code 1082 non-null object
2 name 1082 non-null object
3 ipo_date 1082 non-null object
4 issue_date 1082 non-null object
5 amount 1082 non-null float64
6 market_amount 1082 non-null float64
7 price 1082 non-null float64
8 pe 1082 non-null float64
9 limit_amount 1082 non-null float64
10 funds 1082 non-null float64
11 ballot 1082 non-null float64
dtypes: float64(7), object(5)
memory usage: 101.6+ KB
3. 分析筹集基金
3.1 选出募集基金前20的公司
data.sort_values(by='funds', ascending=False).head(20)
| ts_code | sub_code | name | ipo_date | issue_date | amount | market_amount | price | pe | limit_amount | funds | ballot |
---|
715 | 601288.SH | 780288 | 农业银行 | 20100706 | 20100715 | 2557058.80 | 1031032.5 | 2.68 | 14.43 | 1000.0 | 685.2918 | 9.29 |
---|
1001 | 601668.SH | 780668 | 中国建筑 | 20090722 | 20090729 | 1200000.00 | 600000.0 | 4.18 | 51.29 | 700.0 | 501.6000 | 2.83 |
---|
2276 | 601211.SH | 780211 | 国泰君安 | 20150618 | 20150626 | 152500.00 | 106750.0 | 19.71 | 22.99 | 45.7 | 300.5775 | 1.57 |
---|
1514 | 601138.SH | 780138 | 工业富联 | 20180524 | 20180608 | 196953.00 | 100610.0 | 13.77 | 17.09 | 41.3 | 267.9600 | 0.34 |
---|
1070 | 601898.SH | 780898 | 中煤能源 | 20080125 | 20080201 | 152533.34 | 118213.3 | 16.83 | 43.71 | 9999.9 | 256.7136 | 0.73 |
---|
1061 | 601186.SH | 780186 | 中国铁建 | 20080226 | 20080310 | 245000.00 | 196000.0 | 9.08 | 30.56 | 9999.9 | 222.4600 | 0.64 |
---|
686 | 601818.SH | 780818 | 光大银行 | 20100810 | 20100818 | 700000.00 | 245000.0 | 3.10 | 16.40 | 240.0 | 217.0000 | 3.63 |
---|
1120 | 688981.SH | 787981 | 中芯国际 | 20200707 | 20200716 | 193846.00 | 25284.0 | 27.46 | 0.00 | 42.1 | 202.8550 | 0.21 |
---|
982 | 601618.SH | 780618 | 中国中冶 | 20090909 | 20090921 | 350000.00 | 226634.7 | 5.42 | 41.90 | 200.0 | 189.7000 | 1.18 |
---|
846 | 601688.SH | 780688 | 华泰证券 | 20100209 | 20100226 | 78456.13 | 54919.3 | 20.00 | 29.41 | 30.0 | 156.9123 | 14.43 |
---|
926 | 601989.SH | 780989 | 中国重工 | 20091207 | 20091216 | 199500.00 | 119700.0 | 7.38 | 42.14 | 100.0 | 147.2310 | 1.36 |
---|
907 | 601299.SH | 780299 | 中国北车 | 20091221 | 20091229 | 250000.00 | 162500.0 | 5.56 | 49.21 | 150.0 | 139.0000 | 1.33 |
---|
325 | 601669.SH | 780669 | 中国水电 | 20110927 | 20111018 | 300000.00 | 150000.0 | 4.50 | 15.00 | 150.0 | 135.0000 | 9.70 |
---|
2306 | 601985.SH | 780985 | 中国核电 | 20150602 | 20150610 | 389100.00 | 272370.0 | 3.39 | 22.29 | 116.7 | 131.9049 | 1.63 |
---|
859 | 601106.SH | 780106 | 中国一重 | 20100201 | 20100209 | 200000.00 | 100000.0 | 5.70 | 41.22 | 100.0 | 114.0000 | 4.98 |
---|
1353 | 003816.SZ | 003816 | 中国广核 | 20190812 | 20190826 | 504986.00 | 184252.0 | 2.49 | 14.60 | 75.7 | 111.6720 | 0.60 |
---|
939 | 600999.SH | 730999 | 招商证券 | 20091110 | 20091117 | 35854.61 | 28683.7 | 31.00 | 56.26 | 10.0 | 111.1493 | 1.01 |
---|
998 | 601788.SH | 780788 | 光大证券 | 20090804 | 20090818 | 52000.00 | 34080.1 | 21.08 | 58.56 | 30.0 | 109.6160 | 0.81 |
---|
1382 | 688009.SH | 787009 | 中国通号 | 20190710 | 20190722 | 180000.00 | 37800.0 | 5.85 | 18.80 | 25.2 | 106.8470 | 0.23 |
---|
2071 | 601229.SH | 780229 | 上海银行 | 20161102 | 20161116 | 60045.00 | 54041.0 | 17.77 | 8.26 | 18.0 | 106.7000 | 0.23 |
---|
3.2 按基金数额画频数直方图
data.funds.hist()
<matplotlib.axes._subplots.AxesSubplot at 0x21436b3ebb0>
3.3 小于80的基金按数额画频数直方图
data[data.funds<80].funds.hist()
<matplotlib.axes._subplots.AxesSubplot at 0x21437341430>
3.4 小于50的基金按数额画频数直方图
data[data.funds<50].funds.hist()
<matplotlib.axes._subplots.AxesSubplot at 0x214373d6dc0>
3.5 小于30的基金按数额画频数直方图
data[data.funds<30].funds.hist()
<matplotlib.axes._subplots.AxesSubplot at 0x214373cad00>
发现大部分基金数额都集中在5亿左右。
4. 分析盈利
4.1 选出市盈率最小的前20公司
data.sort_values(by='pe').head(20)
| ts_code | sub_code | name | ipo_date | issue_date | amount | market_amount | price | pe | limit_amount | funds | ballot |
---|
1084 | 688185.SH | 787185 | 康希诺 | 20200731 | 20200813 | 2480.0 | 697.0 | 209.71 | 0.00 | 0.45 | 10.6700 | 0.03 |
---|
1140 | 688277.SH | 787277 | 天智航 | 20200622 | 20200707 | 4190.0 | 1081.0 | 12.04 | 0.00 | 0.70 | 5.0830 | 0.04 |
---|
1129 | 688180.SH | 787180 | 君实生物 | 20200702 | 20200715 | 8713.0 | 2120.0 | 55.50 | 0.00 | 1.35 | 29.3560 | 0.04 |
---|
1126 | 688165.SH | 787165 | 埃夫特 | 20200703 | 20200715 | 13045.0 | 3720.0 | 6.35 | 0.00 | 2.45 | 12.6650 | 0.05 |
---|
1120 | 688981.SH | 787981 | 中芯国际 | 20200707 | 20200716 | 193846.0 | 25284.0 | 27.46 | 0.00 | 42.10 | 202.8550 | 0.21 |
---|
1117 | 688256.SH | 787256 | 寒武纪 | 20200708 | 20200720 | 4010.0 | 972.0 | 64.39 | 0.00 | 0.60 | 29.2770 | 0.04 |
---|
1110 | 688561.SH | 787561 | 奇安信 | 20200714 | 20200722 | 10194.0 | 2159.0 | 56.10 | 0.00 | 1.40 | 47.7610 | 0.04 |
---|
1199 | 688126.SH | 787126 | 沪硅产业 | 20200409 | 20200420 | 62007.0 | 13457.0 | 3.89 | 0.00 | 8.65 | 26.4430 | 0.10 |
---|
1086 | 688339.SH | 787339 | 亿华通 | 20200729 | 20200810 | 1763.0 | 461.0 | 76.65 | 0.00 | 0.25 | 0.0000 | 0.04 |
---|
1229 | 688177.SH | 787177 | 百奥泰 | 20200211 | 20200221 | 6000.0 | 1734.0 | 32.76 | 0.00 | 1.15 | 20.8940 | 0.05 |
---|
1083 | 688313.SH | 787313 | 仕佳光子 | 20200731 | 20200812 | 4600.0 | 1311.0 | 10.82 | 0.00 | 0.85 | 0.0000 | 0.03 |
---|
1248 | 688266.SH | 787266 | 泽璟制药 | 20200114 | 20200123 | 6000.0 | 1722.0 | 33.76 | 0.00 | 1.10 | 25.4090 | 0.05 |
---|
1152 | 688520.SH | 787520 | 神州细胞 | 20200609 | 20200622 | 5000.0 | 1430.0 | 25.64 | 0.00 | 0.95 | 21.0150 | 0.04 |
---|
2142 | 601997.SH | 780997 | 贵阳银行 | 20160804 | 20160816 | 50000.0 | 45000.0 | 8.49 | 6.08 | 15.00 | 42.4500 | 0.22 |
---|
100 | 601225.SH | 780225 | 陕西煤业 | 20140117 | 20140128 | 100000.0 | 15000.0 | 4.00 | 6.23 | 15.00 | 40.0000 | 4.87 |
---|
2196 | 603528.SH | 732528 | 多伦科技 | 20160421 | 20160503 | 5168.0 | 4651.2 | 9.45 | 6.41 | 1.90 | 4.8838 | 0.06 |
---|
1486 | 002936.SZ | 002936 | 郑州银行 | 20180907 | 20180919 | 60000.0 | 54000.0 | 4.59 | 6.50 | 18.00 | 27.5400 | 0.25 |
---|
1024 | 002254.SZ | 002254 | 烟台氨纶 | 20080616 | 20080625 | 3200.0 | 2560.0 | 18.59 | 6.67 | 2560.00 | 5.9488 | 0.08 |
---|
1484 | 601577.SH | 780577 | 长沙银行 | 20180912 | 20180926 | 34216.0 | 30794.0 | 7.99 | 6.97 | 10.20 | 27.3380 | 0.17 |
---|
1963 | 601881.SH | 780881 | 中国银河 | 20170111 | 20170123 | 60000.0 | 54000.0 | 6.81 | 7.02 | 18.00 | 40.8600 | 0.21 |
---|
4.2 按盈利多少画频数直方图
data.pe.hist()
<matplotlib.axes._subplots.AxesSubplot at 0x214374f3880>
4.3 小于200的盈利画频数直方图
data[data.pe<200].pe.hist()
<matplotlib.axes._subplots.AxesSubplot at 0x214374ef5b0>
4.4 小于150的盈利画频数直方图
data[data.pe<150].pe.hist()
<matplotlib.axes._subplots.AxesSubplot at 0x214376d2790>
data.to_csv("new_share_20200821.csv")