The finance data vendor, Wind, had launched the stock pitch indexes (indexes composed of the most recommended stocks by different securities firms, updated monthly).
My code is for picking the most recommended stocks from these indexes.
The logic is to read the constituent stocks of these indexes, then calculate the total recommendation times of each stock, then select the top 20 recommended stocks, review the stock performance in 3 months. There were indeed some good stocks pitched by these securities firms, the stocks marked in yellow had positive return in the last 3 months, marked in red are the better ones.
1. stock_picking_review_20220101_20220330
code | chg | |
0 | 600519.SH | -15.6049 |
1 | 000568.SZ | -25.9385 |
2 | 002352.SZ | -35.621 |
3 | 600690.SH | -25.0585 |
4 | 002648.SZ | 0.549588 |
5 | 002142.SZ | -3.10867 |
6 | 601985.SH | -3.61446 |
7 | 600809.SH | -19.3742 |
8 | 002271.SZ | -16.268 |
9 | 300059.SZ | -29.7224 |
10 | 601012.SH | -12.5406 |
11 | 600887.SH | -10.9021 |
12 | 300451.SZ | -31.127 |
13 | 000657.SZ | -27.2388 |
14 | 000998.SZ | -16.423 |
15 | 002508.SZ | -19.1838 |
16 | 002624.SZ | -35.8936 |
17 | 600383.SH | 11.33385 |
18 | 601888.SH | -23.7956 |
19 | 300413.SZ | -43.6386 |
code | chg | |
0 | 600519.SH | -3.10652 |
1 | 300750.SZ | -30.9231 |
2 | 000333.SZ | -22.0082 |
3 | 601888.SH | -11.8948 |
4 | 601166.SH | -1.91571 |
5 | 600030.SH | -19.9593 |
6 | 600036.SH | -18.858 |
7 | 600048.SH | 15.41401 |
8 | 600522.SH | -1.62455 |
9 | 688169.SH | -35.4766 |
10 | 002648.SZ | -14.1905 |
11 | 002867.SZ | -27.0725 |
12 | 002371.SZ | -15.5477 |
13 | 002142.SZ | -7.11179 |
14 | 603236.SH | -20.7934 |
15 | 603816.SH | -20.011 |
16 | 000596.SZ | -6.6778 |
17 | 002311.SZ | -14.1545 |
18 | 002352.SZ | -19.0213 |
19 | 002372.SZ | -15.9735 |
code | chg | |
0 | 600048.SH | 0.252845 |
1 | 000858.SZ | -12.5368 |
2 | 002142.SZ | -15.5381 |
3 | 600519.SH | -0.66968 |
4 | 603019.SH | -25.501 |
5 | 600011.SH | -19.2702 |
6 | 300750.SZ | -24.6663 |
7 | 000733.SZ | 1.476487 |
8 | 600887.SH | -4.68117 |
9 | 002271.SZ | -0.50683 |
10 | 000768.SZ | -16.0603 |
11 | 603816.SH | -12.9119 |
12 | 300450.SZ | -30.2097 |
13 | 600383.SH | -5.82219 |
14 | 688005.SH | -38.9821 |
15 | 601985.SH | -2.02703 |
16 | 600522.SH | -4.32924 |
17 | 300861.SZ | 17.32319 |
18 | 601238.SH | 13.83894 |
19 | 002241.SZ | -14.9508 |
code | chg | |
0 | 600519.SH | 20.24814 |
1 | 000002.SZ | 7.049608 |
2 | 300122.SZ | -19.558 |
3 | 002271.SZ | 15.29658 |
4 | 601985.SH | -15.4131 |
5 | 601012.SH | 29.64528 |
6 | 002714.SZ | -2.31158 |
7 | 603236.SH | -2.54911 |
8 | 300059.SZ | 20.65625 |
9 | 600048.SH | -1.35593 |
10 | 601658.SH | 0 |
11 | 300861.SZ | 35.15602 |
12 | 600941.SH | -6.56523 |
13 | 603259.SH | -7.00518 |
14 | 300750.SZ | 4.235799 |
15 | 600887.SH | 8.320692 |
16 | 000001.SZ | -2.60078 |
17 | 603816.SH | 22.31745 |
18 | 002352.SZ | 22.55611 |
19 | 002555.SZ | -7.84481 |
5. stock_picking_review_20220501_20220730
code | chg | |
0 | 600519.SH | 4.952156 |
1 | 300059.SZ | -2.3266 |
2 | 600048.SH | -4.75457 |
3 | 002271.SZ | -10.2082 |
4 | 601668.SH | -15.9453 |
5 | 000002.SZ | -11.1971 |
6 | 603259.SH | -9.0721 |
7 | 300911.SZ | 2.036057 |
8 | 600887.SH | -4.44856 |
9 | 000001.SZ | -15.7428 |
10 | 002352.SZ | -2.50108 |
11 | 601888.SH | 16.16778 |
12 | 603816.SH | 5.007883 |
13 | 601985.SH | -11.4795 |
14 | 300015.SZ | 10.22315 |
15 | 600399.SH | 50.82919 |
16 | 600690.SH | -4.32266 |
17 | 000519.SZ | 57.7478 |
18 | 603236.SH | 37.70474 |
19 | 000977.SZ | -1.02345 |
code | chg | |
0 | 600519.SH | 6.368754 |
1 | 300413.SZ | -13.0409 |
2 | 600600.SH | 7.437205 |
3 | 002594.SZ | 8.295962 |
4 | 601888.SH | 19.64558 |
5 | 300059.SZ | -1.72261 |
6 | 601669.SH | -5.9342 |
7 | 601012.SH | 9.072148 |
8 | 601111.SH | -0.4128 |
9 | 300751.SZ | 25.20226 |
10 | 600048.SH | 11.27319 |
11 | 002714.SZ | 17.03249 |
12 | 603916.SH | -11.6999 |
13 | 002271.SZ | -9.20314 |
14 | 000568.SZ | 3.445065 |
15 | 601390.SH | -9.05725 |
16 | 688169.SH | -27.8618 |
17 | 000733.SZ | -0.6177 |
18 | 600690.SH | -2.36314 |
19 | 300428.SZ | 67.15644 |
code | chg | |
0 | 601888.SH | -9.23722 |
1 | 600519.SH | -7.16675 |
2 | 300413.SZ | -5.61187 |
3 | 000858.SZ | -11.6526 |
4 | 000733.SZ | -12.802 |
5 | 600600.SH | -4.11085 |
6 | 600690.SH | -9.72323 |
7 | 601012.SH | -7.69923 |
8 | 000568.SZ | -9.87264 |
9 | 601111.SH | -16.882 |
10 | 002371.SZ | -8.42933 |
11 | 600048.SH | -1.15423 |
12 | 300059.SZ | -12.4016 |
13 | 300750.SZ | -4.75655 |
14 | 603236.SH | 17.3874 |
15 | 300751.SZ | -3.85007 |
16 | 002271.SZ | -21.4105 |
17 | 600233.SH | -5.24767 |
18 | 600570.SH | -2.48048 |
19 | 300496.SZ | 8.966891 |
code:
# -*- coding: utf-8 -*- """ Created on Sat Jul 30 19:42:03 2022 @author : fangfang666 """ import pandas as pd from WindPy import * w.start() import datetime from collections import Counter date = datetime.datetime(2022,1,15) date_str = date.strftime("%Y-%m-%d") indexes = ["8841453.WI","8841454.WI","8841455.WI","8841456.WI","8841457.WI", "8841458.WI","8841459.WI","8841460.WI","8841461.WI","8841462.WI", "8841463.WI","8841464.WI","8841465.WI","8841466.WI","8841467.WI", "8841468.WI","8841469.WI","8841470.WI","8841471.WI","8841472.WI", "8841473.WI","8841474.WI","8841475.WI","8841476.WI","8841477.WI", "8841478.WI","8841479.WI","8841481.WI","8841482.WI","8841485.WI", "8841486.WI","8841487.WI","8841488.WI","8841489.WI","8841494.WI", "8841551.WI","8841552.WI","8841553.WI","8841554.WI","8841555.WI", "8841556.WI","8841565.WI","8841566.WI","8841590.WI","8841591.WI", "8841602.WI","8841603.WI","8841604.WI","8841605.WI","8841606.WI", "8841607.WI","8841608.WI","8841609.WI","8841610.WI","8841611.WI", "8841612.WI","8841613.WI","8841614.WI","8841615.WI","8841616.WI", "8841617.WI","8841618.WI","8841619.WI","8841620.WI","8841621.WI", "8841622.WI","8841623.WI","8841624.WI","8841625.WI","8841626.WI", "8841627.WI","8841628.WI"] counter = Counter() out = pd.ExcelWriter('stock_picking_%s.xlsx'%date_str) for index in indexes: data = w.wset("sectorconstituent","date=%s;windcode=%s"%(date_str,index)) if len(data.Data) == 0: continue df = pd.DataFrame(data.Data).T df.columns = data.Fields df.to_excel(out,index) for code in df["wind_code"]: counter[code]+=1 out.save() out2 = pd.ExcelWriter('stock_picking_times_%s.xlsx'%date_str) df2 = pd.DataFrame(counter.most_common(len(counter))) df2.columns =['code', 'times'] df2.to_excel(out2,date_str) out2.save() startDate = datetime.datetime(2022,1,15) startDate_str = startDate.strftime("%Y%m%d") endDate = datetime.datetime(2022,4,15) endDate_str = endDate.strftime("%Y%m%d") df3 =df2.head(20) df4 =df3['code'] out3 =pd.ExcelWriter('stock_picking_review_%s_%s.xlsx'%(startDate_str,endDate_str)) chg_list = [] for code in df4: chg= w.wss(code, "pct_chg_per","startDate=%s;endDate=%s"%(startDate_str,endDate_str)) chg_list.append((chg.Codes[0], chg.Data[0][0])) df3 = pd.DataFrame(chg_list) df3.columns =['code','chg'] df3.to_excel(out3) out3.save()