请 [注册] 或 [登录]  | 返回主站

量化交易吧 /  数理科学 帖子:3364762 新帖:0

利用现金流量表对上市公司进行分类

外汇老老法师发表于:5 月 9 日 20:38回复(1)

利用上市公司的现金流量表对上市公司进行分类。


理论支持来自头条号:投行大师兄。本人只作为python练手的项目。

经营活动净流 投资活动净流 筹资活动净流 类型 关注点
妖精型 计划投资项目情况
- 老母鸡型 低PE、高股息率
- 蛮牛型 项目前景、资金支持
- - 奶牛型 可持续性
- 骗吃骗喝型 不建议投资
- - 混吃等死型 不建议投资
- - 赌徒型 项目前景与管理层品性
- - - 大出血型 拒绝参与

利用上市公司的现金流量表对上市公司进行分类。¶


理论支持来自头条号:投行大师兄。本人只作为python练手的项目。

经营活动净流 投资活动净流 筹资活动净流 类型 专注点
+ + + 妖精型 计划投资项目情况
+ + - 老母鸡型 低PE、高股息率
+ - + 蛮牛型 项目前景、资金支持
+ - - 奶牛型 可持续性
- + + 骗吃骗喝型 不建议投资
- + - 混吃等死型 不建议投资
- - + 赌徒型 项目前景与管理层品性
- - - 大出血型 拒绝参与
#获取上市公司股票代码
stock_list=[]
indexcode=['000001.XSHG','399106.XSHE','399006.XSHE']
for code in indexcode:
    stock_list.extend(get_index_stocks(code))
以下开始获取每个类型的现金流量表上市公司
q = query(
    cash_flow.code,
    cash_flow.net_operate_cash_flow,
    cash_flow.net_invest_cash_flow,
    cash_flow.net_finance_cash_flow,
    cash_flow.pubDate
).filter(
    cash_flow.code.in_(stock_list),
    cash_flow.net_operate_cash_flow>0,
    cash_flow.net_invest_cash_flow>0,
    cash_flow.net_finance_cash_flow>0

)
style_yaojing=get_fundamentals(q,statDate='2018')
C:\JoinQuant-Desktop-Py3\Python\lib\site-packages\ipykernel_launcher.py:14: SADeprecationWarning: Compiled objects now compile within the constructor.
  
style_yaojing
.dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; }
code net_operate_cash_flow net_invest_cash_flow net_finance_cash_flow pubDate
0 002675.XSHE 4.930631e+08 7.280224e+07 4.217303e+06 2019-02-01
1 300132.XSHE 4.542762e+07 2.046617e+07 3.839545e+07 2019-02-27
2 300723.XSHE 2.385998e+08 4.084511e+08 1.987712e+07 2019-03-13
3 300024.XSHE 5.462745e+07 2.698793e+08 4.367943e+08 2019-03-15
4 600603.XSHG 5.633707e+08 5.462639e+07 8.105596e+08 2019-03-18
5 001979.XSHE 1.047814e+10 2.955234e+09 8.509470e+08 2019-03-19
6 300556.XSHE 1.458641e+07 2.901583e+07 1.113085e+08 2019-03-19
q = query(
    cash_flow.code,
    cash_flow.net_operate_cash_flow,
    cash_flow.net_invest_cash_flow,
    cash_flow.net_finance_cash_flow,
    cash_flow.pubDate
).filter(
    cash_flow.code.in_(stock_list),
    cash_flow.net_operate_cash_flow>0,
    cash_flow.net_invest_cash_flow>0,
    cash_flow.net_finance_cash_flow<0

)
style_laomuji=get_fundamentals(q,statDate='2018')
style_laomuji
C:\JoinQuant-Desktop-Py3\Python\lib\site-packages\ipykernel_launcher.py:14: SADeprecationWarning: Compiled objects now compile within the constructor.
  
.dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; }
code net_operate_cash_flow net_invest_cash_flow net_finance_cash_flow pubDate
0 000055.XSHE 3.871027e+08 2.076963e+08 -5.715971e+08 2019-01-30
1 600738.XSHG 1.281044e+08 2.317382e+09 -8.647206e+08 2019-01-31
2 002315.XSHE 3.014575e+08 1.299464e+08 -1.491342e+08 2019-02-01
3 002552.XSHE 3.352703e+07 3.509791e+07 -7.875039e+07 2019-02-01
4 600722.XSHG 2.165408e+08 2.901912e+08 -4.035162e+07 2019-02-13
5 600507.XSHG 3.572898e+09 3.414942e+08 -1.638310e+09 2019-02-22
6 603806.XSHG 1.695740e+08 1.509872e+08 -2.263143e+08 2019-02-28
7 002381.XSHE 1.471269e+08 1.492841e+07 -1.593314e+08 2019-02-28
8 002167.XSHE 3.703066e+08 1.595114e+08 -5.089316e+08 2019-03-01
9 002728.XSHE 1.879695e+08 6.374721e+07 -7.673896e+06 2019-02-28
10 000948.XSHE 5.302057e+07 4.979891e+08 -1.309562e+08 2019-03-06
11 603136.XSHG 2.253821e+08 8.070410e+07 -1.307292e+08 2019-03-08
12 600113.XSHG 1.259985e+08 6.046633e+07 -6.517255e+07 2019-03-12
13 600158.XSHG 4.330039e+08 2.870130e+07 -2.251898e+08 2019-03-12
14 600814.XSHG 4.624189e+08 1.146693e+09 -1.734960e+08 2019-03-12
15 002612.XSHE 5.438338e+07 1.400710e+08 -1.421012e+08 2019-03-12
16 300690.XSHE 8.928885e+07 1.487332e+07 -1.011181e+08 2019-03-12
17 000043.XSHE 1.281062e+09 1.378495e+09 -2.473766e+09 2019-03-13
18 002750.XSHE 3.169880e+07 2.937132e+08 -1.201500e+07 2019-03-13
19 000423.XSHE 1.009049e+09 6.411291e+07 -6.625471e+08 2019-03-14
20 600588.XSHG 2.042653e+09 1.516435e+08 -7.666032e+08 2019-03-16
21 600835.XSHG 1.884503e+08 1.246152e+09 -1.415756e+09 2019-03-16
22 300025.XSHE 1.791843e+08 1.503034e+08 -4.723977e+08 2019-03-16
23 002820.XSHE 6.616584e+07 1.042684e+05 -3.840000e+07 2019-03-16
24 600332.XSHG 5.216888e+09 1.109718e+09 -2.751337e+09 2019-03-18
25 002585.XSHE 1.734641e+08 6.578809e+06 -4.428278e+07 2019-03-18
26 600386.XSHG 3.029798e+08 6.090744e+07 -5.173618e+08 2019-03-20
27 600649.XSHG 5.666520e+07 5.414448e+08 -1.271709e+09 2019-03-20
28 601975.XSHG 8.949917e+08 3.522120e+07 -7.038813e+08 2019-03-20
29 603025.XSHG 3.030976e+08 1.130196e+08 -4.561034e+08 2019-03-20
30 002801.XSHE 6.649978e+07 2.606735e+07 -9.676519e+07 2019-03-20
31 002879.XSHE 6.007713e+07 2.453619e+08 -2.069010e+07 2019-03-19
32 601015.XSHG 4.711567e+08 6.374234e+07 -7.276527e+08 2019-03-20
33 601588.XSHG 2.532908e+09 1.349752e+09 -1.877580e+09 2019-03-21
34 000877.XSHE 1.719691e+09 1.132721e+08 -2.118409e+09 2019-03-21
35 601969.XSHG 9.173513e+07 1.256452e+08 -2.792163e+08 2019-03-22
36 000421.XSHE 9.398063e+08 2.395989e+07 -1.693747e+09 2019-03-22
37 000698.XSHE 6.450085e+07 4.600624e+07 -6.537388e+08 2019-03-21
38 002380.XSHE 7.517016e+07 2.403385e+08 -9.832766e+07 2019-03-22
39 002469.XSHE 7.346234e+07 1.278963e+08 -2.079439e+07 2019-03-22
40 002507.XSHE 5.593818e+08 5.445883e+08 -1.184036e+08 2019-03-22
41 002782.XSHE 2.700756e+07 7.524676e+07 -8.899984e+07 2019-03-22
42 300023.XSHE 9.676029e+08 8.025229e+07 -1.185734e+09 2019-03-22
43 300345.XSHE 2.890907e+07 1.694553e+07 -7.578521e+07 2019-03-22
44 600422.XSHG 3.520741e+08 2.392459e+08 -1.936601e+08 2019-03-23
45 600548.XSHG 3.222229e+09 9.579395e+08 -3.483902e+09 2019-03-23
46 600560.XSHG 3.742095e+07 4.881421e+06 -1.430443e+07 2019-03-23
47 600602.XSHG 1.931039e+08 1.108935e+09 -1.011622e+08 2019-03-23
48 600830.XSHG 1.667981e+08 7.570288e+07 -1.200642e+08 2019-03-23
49 600841.XSHG 4.647525e+08 8.391150e+06 -3.782491e+07 2019-03-23
50 600865.XSHG 1.043891e+08 2.469302e+08 -1.688949e+08 2019-03-23
51 000404.XSHE 1.723454e+08 1.087816e+09 -5.818247e+08 2019-03-23
52 000712.XSHE 1.830893e+09 1.482345e+06 -1.812154e+09 2019-03-23
53 300579.XSHE 1.279631e+08 8.434433e+07 -2.400000e+07 2019-03-23
54 300188.XSHE 7.184925e+07 2.785049e+07 -7.726314e+07 2019-03-23
q = query(
    cash_flow.code,
    cash_flow.net_operate_cash_flow,
    cash_flow.net_invest_cash_flow,
    cash_flow.net_finance_cash_flow,
    cash_flow.pubDate
).filter(
    cash_flow.code.in_(stock_list),
    cash_flow.net_operate_cash_flow>0,
    cash_flow.net_invest_cash_flow<0,
    cash_flow.net_finance_cash_flow>0

)
style_manniu=get_fundamentals(q,statDate='2018')
style_manniu
C:\JoinQuant-Desktop-Py3\Python\lib\site-packages\ipykernel_launcher.py:14: SADeprecationWarning: Compiled objects now compile within the constructor.
  
.dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; }
code net_operate_cash_flow net_invest_cash_flow net_finance_cash_flow pubDate
0 300619.XSHE 3.802082e+07 -1.900377e+08 9.945008e+07 2019-01-22
1 000929.XSHE 3.100135e+07 -5.128344e+08 5.541292e+05 2019-02-01
2 002245.XSHE 3.038466e+08 -5.223788e+08 1.875706e+08 2019-02-01
3 002825.XSHE 8.329531e+07 -1.372577e+08 5.235335e+06 2019-02-01
4 300748.XSHE 5.809301e+07 -1.085350e+08 2.379178e+08 2019-02-01
5 603225.XSHG 9.793299e+08 -3.375773e+09 3.103750e+09 2019-02-02
6 600982.XSHG 1.791993e+07 -3.550631e+08 3.785520e+08 2019-02-20
7 603638.XSHG 6.538811e+07 -2.528509e+08 1.691866e+08 2019-02-20
8 300632.XSHE 9.922653e+07 -7.880625e+07 1.646717e+08 2019-02-19
9 002258.XSHE 3.480388e+08 -9.057035e+08 7.469070e+08 2019-02-23
10 600785.XSHG 3.181290e+08 -7.049345e+08 3.337026e+08 2019-02-26
11 603179.XSHG 4.913902e+08 -3.630236e+08 3.327190e+08 2019-02-26
12 603826.XSHG 7.042083e+07 -1.254103e+08 8.398452e+06 2019-02-26
13 002793.XSHE 1.141152e+08 -2.847435e+08 3.650926e+08 2019-02-26
14 300260.XSHE 1.572250e+08 -2.353734e+08 9.889792e+07 2019-02-26
15 300398.XSHE 1.834237e+08 -2.899107e+08 2.346630e+08 2019-02-26
16 300487.XSHE 1.962237e+07 -7.304450e+06 1.114131e+08 2019-02-26
17 300751.XSHE 4.986313e+05 -4.082682e+07 6.974288e+08 2019-02-26
18 000708.XSHE 7.323244e+08 -3.803379e+07 6.024636e+07 2019-02-27
19 300602.XSHE 6.096177e+07 -2.642963e+08 3.349045e+07 2019-02-27
20 300623.XSHE 2.613933e+08 -1.917844e+08 2.669149e+07 2019-02-27
21 603319.XSHG 1.409210e+08 -1.865595e+08 9.507816e+07 2019-02-28
22 002162.XSHE 1.355078e+08 -1.487217e+08 2.174667e+07 2019-02-28
23 002262.XSHE 4.045247e+08 -3.438946e+08 1.167375e+08 2019-02-28
24 600681.XSHG 1.219451e+09 -1.803774e+09 3.179066e+08 2019-03-01
25 000667.XSHE 7.101234e+08 -1.028200e+09 2.838808e+08 2019-02-28
26 002616.XSHE 6.999918e+08 -9.552884e+08 4.533761e+08 2019-02-28
27 300146.XSHE 1.349053e+09 -4.040966e+09 1.744049e+09 2019-02-28
28 300586.XSHE 7.393582e+07 -7.001727e+07 6.432728e+06 2019-02-28
29 603677.XSHG 7.719403e+07 -4.908735e+08 4.967465e+08 2019-03-05
... ... ... ... ... ...
109 300652.XSHE 8.729304e+07 -9.099394e+07 2.246747e+08 2019-03-21
110 600256.XSHG 4.140466e+09 -4.856143e+09 9.193116e+08 2019-03-22
111 600323.XSHG 1.651855e+09 -2.050764e+09 3.261756e+08 2019-03-22
112 600787.XSHG 9.242817e+08 -4.667510e+08 2.506314e+09 2019-03-22
113 600823.XSHG 3.978209e+09 -1.100745e+10 8.170396e+09 2019-03-22
114 603186.XSHG 9.232122e+07 -1.825900e+08 5.669822e+07 2019-03-22
115 603393.XSHG 6.842585e+08 -4.319236e+08 6.220273e+08 2019-03-22
116 603595.XSHG 1.914649e+08 -2.806260e+08 9.052744e+07 2019-03-22
117 603663.XSHG 3.502639e+07 -7.474756e+07 3.935401e+07 2019-03-22
118 000949.XSHE 2.806755e+07 -4.299860e+08 5.590793e+08 2019-03-22
119 002022.XSHE 1.267906e+08 -5.783552e+08 2.539012e+08 2019-03-22
120 002524.XSHE 3.210506e+08 -1.398055e+08 3.498679e+07 2019-03-22
121 002549.XSHE 2.203934e+08 -3.580514e+08 1.081236e+08 2019-03-22
122 002644.XSHE 3.666311e+07 -2.921316e+08 6.665493e+06 2019-03-22
123 300081.XSHE 4.015174e+06 -7.948540e+08 1.660621e+08 2019-03-21
124 300575.XSHE 2.801652e+08 -4.515841e+08 9.724715e+07 2019-03-22
125 600207.XSHG 1.003052e+08 -7.807251e+07 6.068351e+07 2019-03-23
126 600343.XSHG 1.460724e+08 -1.418441e+08 5.109853e+06 2019-03-23
127 600859.XSHG 1.521968e+09 -1.179895e+09 5.680026e+08 2019-03-23
128 601865.XSHG 4.309093e+08 -1.302945e+09 4.366434e+08 2019-03-22
129 603259.XSHG 1.640428e+09 -5.276662e+09 6.984160e+09 2019-03-23
130 603713.XSHG 1.301442e+08 -6.442732e+08 4.561814e+08 2019-03-22
131 000987.XSHE 3.211772e+08 -8.214748e+09 1.039110e+10 2019-03-23
132 002108.XSHE 1.665981e+08 -8.472093e+08 5.765351e+08 2019-03-23
133 002831.XSHE 7.988863e+08 -7.727691e+08 7.991064e+07 2019-03-23
134 601869.XSHG 5.653509e+08 -1.530096e+09 1.783530e+09 2019-03-23
135 601899.XSHG 1.023301e+10 -1.364021e+10 7.655168e+09 2019-03-23
136 601601.XSHG 8.944900e+10 -9.174800e+10 1.155400e+10 2019-03-25
137 000756.XSHE 3.446091e+08 -3.983496e+08 4.452921e+07 2019-03-25
138 002649.XSHE 1.470648e+08 -5.770517e+07 5.740198e+07 2019-03-25

139 rows × 5 columns

q = query(
    cash_flow.code,
    cash_flow.net_operate_cash_flow,
    cash_flow.net_invest_cash_flow,
    cash_flow.net_finance_cash_flow,
    cash_flow.pubDate
).filter(
    cash_flow.code.in_(stock_list),
    cash_flow.net_operate_cash_flow>0,
    cash_flow.net_invest_cash_flow<0,
    cash_flow.net_finance_cash_flow<0

)
style_nainiu=get_fundamentals(q,statDate='2018')
style_nainiu
C:\JoinQuant-Desktop-Py3\Python\lib\site-packages\ipykernel_launcher.py:14: SADeprecationWarning: Compiled objects now compile within the constructor.
  
.dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; }
code net_operate_cash_flow net_invest_cash_flow net_finance_cash_flow pubDate
0 601619.XSHG 8.214782e+08 -7.446780e+07 -7.110946e+08 2019-01-29
1 002211.XSHE 1.225231e+08 -1.166165e+08 -8.126300e+06 2019-02-01
2 002910.XSHE 1.037228e+08 -3.994670e+08 -5.209718e+07 2019-01-31
3 300700.XSHE 4.625973e+06 -1.226909e+08 -3.667980e+07 2019-02-01
4 002107.XSHE 1.078836e+08 -6.222591e+07 -2.778250e+07 2019-02-01
5 002406.XSHE 1.499758e+08 -1.984710e+08 -1.785200e+08 2019-02-14
6 002442.XSHE 2.764093e+08 -7.933584e+07 -1.623186e+08 2019-02-15
7 600276.XSHG 2.774213e+09 -2.855510e+09 -3.683914e+08 2019-02-16
8 603005.XSHG 2.921575e+08 -2.001767e+08 -9.648448e+05 2019-02-18
9 002099.XSHE 7.914492e+08 -1.097421e+09 -9.062782e+08 2019-02-18
10 002349.XSHE 8.343008e+07 -1.581020e+08 -9.981163e+07 2019-02-18
11 600702.XSHG 4.431809e+08 -3.094992e+08 -4.187495e+08 2019-02-20
12 002458.XSHE 4.287953e+08 -2.288900e+08 -1.693007e+08 2019-02-20
13 002795.XSHE 1.206191e+08 -2.801112e+07 -5.168966e+07 2019-02-21
14 600765.XSHG 3.848407e+08 -1.466503e+08 -5.664556e+08 2019-02-22
15 002727.XSHE 6.357717e+08 -8.942657e+08 -7.203904e+08 2019-02-26
16 300033.XSHE 5.282019e+08 -4.968571e+07 -4.838400e+08 2019-02-26
17 002234.XSHE 4.444014e+08 -1.621982e+08 -7.778467e+07 2019-02-27
18 600605.XSHG 4.677290e+08 -7.968032e+06 -1.159241e+08 2019-02-28
19 600887.XSHG 8.624772e+09 -5.373984e+09 -1.074898e+10 2019-02-28
20 603278.XSHG 3.213956e+08 -3.241997e+08 -1.255629e+08 2019-02-28
21 002014.XSHE 3.238335e+08 -5.281415e+07 -1.314038e+08 2019-02-28
22 002138.XSHE 5.971087e+08 -3.761154e+08 -1.764306e+08 2019-02-28
23 002145.XSHE 6.056024e+08 -3.111564e+08 -2.800252e+08 2019-02-28
24 300016.XSHE 1.757542e+08 -1.981185e+08 -1.206167e+07 2019-02-28
25 300220.XSHE 2.970300e+07 -5.490470e+06 -3.050624e+07 2019-02-28
26 300285.XSHE 3.497585e+08 -2.068363e+08 -3.506780e+08 2019-02-28
27 002306.XSHE 1.886044e+07 -4.189726e+06 -6.989473e+06 2019-03-01
28 300613.XSHE 1.029006e+08 -3.768053e+08 -1.581791e+07 2019-03-01
29 300617.XSHE 5.831818e+07 -5.273755e+07 -8.205417e+05 2019-02-28
... ... ... ... ... ...
187 000655.XSHE 3.167754e+08 -1.269371e+07 -1.010549e+08 2019-03-23
188 000705.XSHE 2.548898e+07 -4.162726e+07 -2.654865e+06 2019-03-23
189 000715.XSHE 1.058947e+08 -1.365974e+08 -2.232048e+07 2019-03-22
190 000802.XSHE 8.992383e+07 -2.964272e+08 -9.493391e+07 2019-03-22
191 000973.XSHE 1.096757e+09 -9.145368e+07 -7.147668e+08 2019-03-23
192 002028.XSHE 1.743194e+08 -3.794342e+08 -5.744620e+07 2019-03-23
193 002368.XSHE 6.804642e+08 -1.276215e+08 -2.317723e+08 2019-03-22
194 002417.XSHE 1.366254e+08 -1.001103e+08 -2.756955e+07 2019-03-23
195 002490.XSHE 3.695896e+08 -3.381301e+08 -1.131131e+08 2019-03-23
196 002732.XSHE 1.394458e+08 -1.253333e+08 -5.911045e+07 2019-03-23
197 002800.XSHE 1.128763e+08 -2.366956e+07 -9.960954e+07 2019-03-22
198 300054.XSHE 2.978171e+08 -1.350616e+08 -2.153488e+08 2019-03-23
199 300403.XSHE 1.043142e+08 -1.029823e+08 -2.288451e+08 2019-03-23
200 300414.XSHE 2.267053e+07 -1.187511e+08 -1.229549e+07 2019-03-23
201 300435.XSHE 1.026173e+08 -5.298005e+07 -2.917244e+07 2019-03-23
202 601088.XSHG 8.824800e+10 -5.305600e+10 -4.471500e+10 2019-03-23
203 601633.XSHG 1.969783e+10 -1.004044e+10 -6.500838e+09 2019-03-23
204 000576.XSHE 3.283103e+08 -1.972685e+08 -3.671169e+06 2019-03-23
205 002186.XSHE 7.998373e+07 -3.126733e+07 -8.461478e+07 2019-03-23
206 300148.XSHE 1.461356e+08 -5.033343e+08 -1.393217e+07 2019-03-23
207 600012.XSHG 1.807617e+09 -7.141350e+08 -4.694025e+08 2019-03-25
208 600028.XSHG 1.758680e+11 -6.642200e+10 -1.112600e+11 2019-03-25
209 600116.XSHG 4.312648e+08 -2.881967e+08 -2.056836e+08 2019-03-25
210 600377.XSHG 5.715490e+09 -4.773578e+09 -6.895436e+08 2019-03-25
211 603118.XSHG 5.158041e+08 -8.365934e+08 -1.691736e+08 2019-03-25
212 603527.XSHG 1.374609e+08 -5.006377e+07 -1.006354e+08 2019-03-25
213 000551.XSHE 2.502209e+08 -1.336695e+08 -9.688088e+07 2019-03-25
214 000798.XSHE 1.259493e+07 -7.889870e+06 -2.421152e+07 2019-03-25
215 002393.XSHE 1.626867e+08 -6.387840e+07 -9.228726e+07 2019-03-25
216 002532.XSHE 1.522872e+08 -1.191428e+08 -4.574185e+07 2019-03-25

217 rows × 5 columns

q = query(
    cash_flow.code,
    cash_flow.net_operate_cash_flow,
    cash_flow.net_invest_cash_flow,
    cash_flow.net_finance_cash_flow,
    cash_flow.pubDate
).filter(
    cash_flow.code.in_(stock_list),
    cash_flow.net_operate_cash_flow<0,
    cash_flow.net_invest_cash_flow>0,
    cash_flow.net_finance_cash_flow>0

)
style_pianchi=get_fundamentals(q,statDate='2018')
style_pianchi
C:\JoinQuant-Desktop-Py3\Python\lib\site-packages\ipykernel_launcher.py:14: SADeprecationWarning: Compiled objects now compile within the constructor.
  
.dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; }
code net_operate_cash_flow net_invest_cash_flow net_finance_cash_flow pubDate
0 002188.XSHE -1.052328e+08 2.188344e+06 6.900000e+07 2019-01-31
1 000737.XSHE -2.108968e+08 1.033576e+08 3.739201e+08 2019-03-05
2 000001.XSHE -5.732300e+10 6.138200e+10 1.902100e+10 2019-03-07
3 300638.XSHE -8.931813e+06 5.602084e+07 1.124176e+08 2019-03-08
4 600284.XSHG -2.314430e+07 8.352025e+07 2.212322e+08 2019-03-12
5 600800.XSHG -4.318601e+07 1.704006e+08 9.474553e+06 2019-03-12
6 002807.XSHE -1.189704e+10 2.054402e+09 8.617129e+09 2019-03-15
7 000628.XSHE -1.542661e+08 4.027124e+07 2.092381e+08 2019-03-16
8 000610.XSHE -6.160988e+07 1.798614e+08 1.247480e+08 2019-03-20
9 002819.XSHE -1.363195e+08 7.328608e+07 9.929345e+07 2019-03-20
10 300450.XSHE -4.796996e+07 9.909702e+06 7.477321e+08 2019-03-21
11 600036.XSHG -3.572100e+10 1.971800e+10 9.433300e+10 2019-03-23
12 600120.XSHG -1.115345e+09 1.948045e+08 6.026179e+08 2019-03-23
13 600725.XSHG -4.179335e+07 6.441442e+07 1.501781e+06 2019-03-23
14 000918.XSHE -7.792384e+08 2.067625e+08 3.239785e+08 2019-03-23
15 002362.XSHE -1.690022e+07 4.671445e+07 7.334152e+06 2019-03-23
16 300052.XSHE -5.467977e+06 2.848015e+07 2.868284e+07 2019-03-23
17 300242.XSHE -3.143302e+08 5.023264e+07 3.269884e+08 2019-03-25
q = query(
    cash_flow.code,
    cash_flow.net_operate_cash_flow,
    cash_flow.net_invest_cash_flow,
    cash_flow.net_finance_cash_flow,
    cash_flow.pubDate
).filter(
    cash_flow.code.in_(stock_list),
    cash_flow.net_operate_cash_flow<0,
    cash_flow.net_invest_cash_flow>0,
    cash_flow.net_finance_cash_flow<0

)
style_hunchi=get_fundamentals(q,statDate='2018')
style_hunchi
C:\JoinQuant-Desktop-Py3\Python\lib\site-packages\ipykernel_launcher.py:14: SADeprecationWarning: Compiled objects now compile within the constructor.
  
.dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; }
code net_operate_cash_flow net_invest_cash_flow net_finance_cash_flow pubDate
0 300125.XSHE -1.533401e+07 4.978605e+07 -9.987908e+07 2019-01-29
1 002473.XSHE -9.578840e+07 2.267816e+08 -3.104762e+07 2019-03-01
2 600826.XSHG -4.110909e+07 1.589127e+08 -9.969066e+07 2019-03-09
3 000953.XSHE -5.246349e+07 4.552863e+07 -1.727500e+08 2019-03-12
4 002392.XSHE -4.028783e+07 9.678776e+08 -7.878032e+08 2019-03-15
5 002389.XSHE -4.072197e+07 2.383658e+08 -2.972884e+07 2019-03-15
6 601519.XSHG -3.780123e+08 5.780492e+08 -8.003299e+07 2019-03-20
7 000626.XSHE -1.081083e+09 9.840011e+08 -9.653308e+08 2019-03-21
8 300458.XSHE -6.979848e+07 2.716714e+07 -3.114051e+07 2019-03-22
9 601008.XSHG -5.944809e+08 2.376840e+08 -3.467933e+07 2019-03-23
10 000750.XSHE -1.496133e+09 9.611701e+08 -1.418552e+09 2019-03-23
11 002041.XSHE -2.870093e+07 4.538575e+08 -4.881851e+08 2019-03-22
12 600877.XSHG -8.497192e+07 8.837030e+07 -3.555905e+08 2019-03-25
q = query(
    cash_flow.code,
    cash_flow.net_operate_cash_flow,
    cash_flow.net_invest_cash_flow,
    cash_flow.net_finance_cash_flow,
    cash_flow.pubDate
).filter(
    cash_flow.code.in_(stock_list),
    cash_flow.net_operate_cash_flow<0,
    cash_flow.net_invest_cash_flow<0,
    cash_flow.net_finance_cash_flow>0

)
style_dutu=get_fundamentals(q,statDate='2018')
style_dutu
C:\JoinQuant-Desktop-Py3\Python\lib\site-packages\ipykernel_launcher.py:14: SADeprecationWarning: Compiled objects now compile within the constructor.
  
.dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; }
code net_operate_cash_flow net_invest_cash_flow net_finance_cash_flow pubDate
0 002240.XSHE -1.424934e+06 -2.276406e+08 8.191479e+07 2019-02-01
1 002494.XSHE -2.004139e+08 -3.777376e+07 2.496352e+07 2019-02-26
2 603333.XSHG -2.162555e+08 -3.687708e+07 2.189431e+08 2019-02-28
3 002796.XSHE -1.588266e+07 -1.509111e+08 1.761066e+08 2019-02-28
4 000166.XSHE -1.388216e+10 -3.609253e+09 2.579715e+10 2019-02-28
5 002462.XSHE -2.917565e+08 -4.168340e+07 2.869337e+08 2019-02-28
6 603577.XSHG -8.396702e+07 -8.192999e+07 9.802840e+07 2019-03-05
7 603822.XSHG -5.793259e+07 -7.086175e+07 4.094008e+07 2019-03-05
8 603991.XSHG -7.476521e+07 -4.129917e+07 1.053298e+08 2019-03-06
9 600257.XSHG -3.931756e+07 -6.123406e+07 7.463082e+07 2019-03-09
10 002334.XSHE -1.354955e+08 -1.118014e+08 2.345205e+07 2019-03-09
11 300423.XSHE -4.837791e+08 -4.530016e+08 1.373752e+09 2019-03-12
12 300692.XSHE -2.239979e+08 -1.419323e+08 3.857777e+08 2019-03-12
13 300591.XSHE -8.772606e+07 -6.325222e+07 2.681147e+07 2019-03-12
14 603536.XSHG -6.601855e+05 -3.229718e+07 4.853386e+07 2019-03-13
15 600705.XSHG -3.897156e+10 -1.734323e+10 5.162166e+10 2019-03-15
16 600973.XSHG -8.312293e+08 -6.293868e+08 2.712291e+09 2019-03-15
17 002013.XSHE -9.092606e+08 -2.048420e+09 2.146581e+09 2019-03-15
18 600067.XSHG -7.792506e+08 -8.314819e+08 2.514846e+09 2019-03-16
19 601878.XSHG -1.827852e+09 -8.946488e+07 3.065964e+09 2019-03-18
20 600753.XSHG -9.825446e+07 -6.859072e+04 9.800000e+05 2019-03-19
21 600862.XSHG -6.883992e+08 -1.401528e+08 4.457780e+08 2019-03-19
22 603337.XSHG -2.082529e+07 -1.178244e+07 9.012175e+07 2019-03-20
23 300374.XSHE -2.786132e+08 -4.558250e+08 2.904202e+07 2019-03-20
24 600502.XSHG -2.060324e+09 -1.769590e+08 2.550850e+09 2019-03-21
25 603315.XSHG -5.446813e+07 -3.302259e+07 6.700563e+06 2019-03-20
26 600375.XSHG -3.943753e+08 -4.597895e+08 1.174318e+09 2019-03-22
27 601339.XSHG -5.596187e+08 -3.740618e+08 7.919216e+08 2019-03-22
28 000619.XSHE -1.947684e+08 -1.132918e+07 2.236844e+08 2019-03-21
29 002190.XSHE -1.869891e+08 -5.832946e+08 6.857970e+08 2019-03-22
30 002272.XSHE -2.231880e+07 -2.809008e+06 3.486875e+06 2019-03-22
31 002937.XSHE -2.323781e+08 -5.630176e+07 2.979016e+08 2019-03-21
32 600685.XSHG -1.544910e+09 -1.792362e+09 1.801009e+08 2019-03-23
33 600719.XSHG -8.612195e+07 -2.693048e+08 3.555502e+08 2019-03-23
34 300365.XSHE -3.413169e+07 -6.615472e+07 3.516480e+07 2019-03-22
35 601319.XSHG -1.680300e+10 -1.460700e+10 2.006400e+10 2019-03-23
36 002564.XSHE -2.306826e+09 -3.600561e+08 3.135828e+09 2019-03-23
37 002824.XSHE -3.779321e+07 -9.096426e+07 1.389387e+08 2019-03-23
38 601577.XSHG -3.826221e+10 -1.336599e+10 4.162126e+10 2019-03-25
39 002703.XSHE -1.284964e+07 -4.581297e+07 1.853741e+07 2019-03-25
%matplotlib inline
import matplotlib.pyplot as plt
data_dict={'妖精':style_yaojing.code.count(),
          "老母鸡":style_laomuji.code.count(),
          '蛮牛':style_manniu.code.count(),
          '奶牛':style_nainiu.code.count(),
          '骗吃骗喝':style_pianchi.code.count(),
          '混吃等死':style_hunchi.code.count(),
          '赌徒':style_dutu.code.count()}
import pandas as pd


total=pd.DataFrame(pd.Series(data_dict),columns=['count'])
total.sum()
count    489
dtype: int64
画个图
import matplotlib
matplotlib.rcParams['font.sans-serif']=['SimHei'] 
total.sort_values(by='count').plot(kind='bar',figsize=(7,8),)
<matplotlib.axes._subplots.AxesSubplot at 0x18bd39a5978>
 
 

全部回复

0/140

达人推荐

量化课程

    移动端课程