FangQuant › Stock

Stcok picking vs Sector

Fang submitted 2022-08-08 16:07:40

Here is a weekly performance review for stock pitched by securities firms on August since 1st Aug to 5th Aug, 2022.

There are total 174 stocks performed positive for the past week. Some of them are as below: (PCT_CHG_PER means the change of price in last week, the unit is %, for 300260.sz, the number of 34.38983051 means the price of 300260.sz increased 34.38% in last week)

code PCT_CHG_PER sectorid AVG_AMT_PER AVG_MV_PER FA_ROE_AVG WEST_NETPROFIT_FY1_6M
300260.SZ 34.3898305 6220106020000000 474040334 1.5845E+10 6.1484 90.0699159
688786.SH 33.7398374 6215104020000000 343706818 5924294190 4.3538
688521.SH 30.4628633 6245301020000000 452937071 2.5579E+10 0.1201 571.838757
688536.SH 28.4435789 6245301020000000 433649849 4.2395E+10 2.8028 23.7390247
002409.SZ 26.7192118 6215101050000000 871107520 2.8067E+10 2.4581 2.74384032
688261.SH 26.4005151 6245301020000000 222890746 1.8948E+10 2.9972
300049.SZ 25.9583053 6235202011000000 406732002 4503995178 0.5674 48.4413686
300487.SZ 25.5526357 6215101010000000 734907169 2.63E+10 9.1537 66.8569799
002371.SZ 25.1912611 6245301010000000 3896542245 1.50E+11 1.2089 81.7692219
688107.SH 24.0824308 6245301020000000 218507569 2.9005E+10 1.1643 110.614154
688012.SH 21.559255 6245301010000000 1944309110 8.31E+10 0.8361 46.2984914
000596.SZ 18.6369176 6230201020000000 1167126206 1.32E+11 6.4322 26.2315004
300655.SZ 18.4554231 6215101050000000 768710044 1.162E+10 1.835 9.02611105
002402.SZ 17.9287305 6245203010000000 1071547818 1.8342E+10 1.9593 22.5423701
300666.SZ 17.3507967 6245203010000000 877564583 1.8834E+10 2.1655 55.7085017
600079.SH 14.9686966 6235202010000000 930275658 3.0584E+10 6.8711 35.1552208
605358.SH 14.7390691 6245301020000000 1225535074 4.0214E+10 3.1585 72.6464063
603019.SH 14.5833333 6245202010000000 1178535857 4.4304E+10 0.8921 44.1897596
300416.SZ 14.1501976 6220202020000000 153204739 1.0078E+10 1.6704 46.7839168
603566.SH 13.794339 6235201010000000 222077413 1.0005E+10 2.0626 -9.9237864
600745.SH 13.1632653 6245201020000000 2322107408 9.1855E+10 1.4797 17.9814417
002436.SZ 13.0163679 6245203010000000 1104784654 2.0599E+10 5.202 23.2563712
600460.SH 12.7884615 6245301020000000 1739282764 6.0645E+10 4.1013 12.47081
688202.SH 12.5716018 6235202010000000 272115925 3.1003E+10 5.644 77.3495942
688018.SH 12.5511596 6245301020000000 234577344 8609467320 1.5066 19.5480446
300223.SZ 12.5450045 6245301020000000 1083944037 4.482E+10 2.2294 36.3769392
600416.SH 11.3287905 6220104020000000 403777435 2.8613E+10 1.2834 159.92998
002557.SZ 10.9414226 6230202030000000 272837604 2.5863E+10 4.2782 22.2325759
688213.SH 10.9313809 6245301020000000 134159864 2.36E+10 0.5352
600703.SH 10.8352145 6245301020000000 2064536586 1.02E+11 1.3988 13.7929047
300604.SZ 10.4761905 6220106020000000 1213244135 3.2313E+10 3.9264 118.687207
688526.SH 10.3603604 6235201010000000 53741283.4 1.1963E+10 2.8374 5.65409361
301117.SZ 10.2400784 6245102010000000 152135157 6013537367 -0.5439 60.9
688301.SH 10.1439132 6220104010000000 214025560 3.4765E+10 3.3306 38.9825114
688232.SH 10.0762268 6245101010000000 87513794.8 1.4401E+10 -0.6996 33.4823601
601208.SH 10.0161551 6215101050000000 289391774 1.2221E+10 2.795 50.579048


And we countered the numbers of the stocks which performed positive categorized by their sectors.

sectorid code
6210101020000000 1
6215101010000000 4
6215101011000000 1
6215101050000000 9
6215102010000000 1
6215104020000000 11
6215104030000000 2
6215104050000000 1
6220101010000000 6
6220102010000000 1
6220103010000000 1
6220104010000000 7
6220104020000000 1
6220106020000000 3
6220202020000000 1
6220303010000000 1
6220305010000000 2
6225101010000000 2
6225101020000000 2
6225102010000000 2
6225201040000000 1
6225202010000000 1
6225203010000000 2
6225401010000000 2
6225401030000000 1
6230201010000000 2
6230201020000000 9
6230202030000000 8
6235101010000000 2
6235101020000000 1
6235102020000000 2
6235201010000000 8
6235202010000000 8
6235202011000000 2
6235203010000000 4
6240101015000000 1
6240203020000000 1
6245101010000000 2
6245102010000000 2
6245103010000000 8
6245103030000000 1
6245201020000000 8
6245202010000000 2
6245203010000000 13
6245203015000000 5
6245301010000000 2
6245301020000000 14
6255101010000000 1
6255102010000000 1

We can see that the numbers of the stocks in the sectorid of 6245301020000000, 6245203010000000 and 6215104020000000 ranked the top 3.

6245301020000000 stands for the semiconductor products industry.

6245203010000000 stands for the sector of electronic component industry.

6215104020000000 stands for the sector of non-metallic industry.

No review for other monthly data yet as the wind data quota is limited.


stock_picking_factor file can be downloaded there.



# -*- coding: utf-8 -*-
"""
Created on Sun Aug  7 21:21:00 2022

@author : fang
"""

import pandas as pd
from WindPy import *
w.start()

import datetime

date = datetime.datetime(2022,8,1)
date_str = date.strftime("%Y-%m-%d")


sectorids = ("6210101010000000","6210101020000000","6210102010000000","6210102020000000",
     "6210102030000000","6210102040000000","6210102050000000","6215101010000000",
      "6215101011000000","6215101020000000","6215101030000000","6215101040000000", 
      "6215101050000000","6215102010000000","6215103010000000","6215103020000000", 
      "6215104010000000","6215104020000000","6215104030000000","6215104040000000", 
      "6215104050000000","6215104045000000","6215105010000000", 
      "6215105020000000","6220101010000000","6220102010000000","6220103010000000", 
      "6220104010000000","6220104020000000","6220105010000000","6220106010000000",
      "6220106020000000","6220106015000000","6220107010000000","6220201010000000",
      "6220201050000000","6220201060000000","6220201070000000","6220201080000000", 
      "6220202010000000","6220202020000000","6220301010000000","6220302010000000", 
      "6220303010000000","6220304010000000","6220304020000000","6220305010000000",
      "6220305020000000","6220305030000000","6225101010000000","6225101020000000",
      "6225102010000000","6225102020000000","6225201010000000","6225201020000000", 
      "6225201030000000","6225201040000000","6225201050000000","6225202010000000", 
      "6225202020000000","6225203010000000","6225203020000000","6225203030000000", 
      "6225301010000000","6225301020000000","6225301030000000","6225301040000000",
      "6225302010000000","6225302020000000","6225401010000000","6225401020000000", 
      "6225401025000000","6225401030000000","6225401040000000","6225501010000000", 
      "6225502010000000","6225502020000000","6225503010000000","6225503020000000", 
      "6225504010000000","6225504020000000","6225504030000000","6225504040000000", 
      "6225504050000000","6225504060000000","6230101010000000","6230101020000000", 
      "6230101030000000","6230101040000000","6230201010000000","6230201020000000", 
      "6230201030000000","6230202010000000","6230202030000000","6230203010000000", 
      "6230301010000000","6230302010000000","6235101010000000","6235101020000000",
      "6235102010000000","6235102015000000","6235102020000000","6235102030000000", 
      "6235103010000000","6235201010000000","6235202010000000","6235202011000000", 
      "6235203010000000","6240101010000000","6240101015000000","6240102010000000", 
      "6240201020000000","6240201030000000","6240201040000000","6240202010000000", 
      "6240203010000000","6240203020000000","6240203030000000","6240301010000000", 
      "6240301020000000","6240301030000000","6240301040000000","6240301050000000", 
      "6245101010000000","6245102010000000","6245102020000000","6245103010000000", 
      "6245103020000000","6245103030000000","6245201020000000","6245202010000000",
      "6245202020000000","6245203010000000","6245203015000000","6245203020000000",
      "6245203030000000","6245204010000000","6245301010000000","6245301020000000",
      "6250101010000000","6250101020000000","6250102010000000","6255101010000000",
      "6255102010000000","6255103010000000","6255104010000000","6255105010000000",
      "6255105020000000","6260102010000000","6260102020000000","6260102030000000", 
      "6260102040000000")



out1 = pd.ExcelWriter('sector_stock_list.xlsx')
dfs = []
for sectorid in sectorids:
    data1=w.wset("sectorconstituent","date=%s;sectorid=%s"%(date_str,sectorid))
    if len(data1.Data) == 0:
        continue
    df1=pd.DataFrame(data1.Data).T
    df1.columns=data1.Fields
    df1.insert(1,"sectorid",sectorid)
    dfs.append(df1)
df1 =pd.concat(dfs)
df1.to_excel(out1)
out1.save()



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"]

out2 = pd.ExcelWriter('stock_picking_list.xlsx')
dfs = []
for index in indexes:
    data2=w.wset("sectorconstituent","date=%s;windcode=%s"%(date_str,index))
    df2=pd.DataFrame(data2.Data).T
    df2.columns=data2.Fields
    dfs.append(df2)
df2 = pd.concat(dfs)
df3=df2.drop_duplicates(["wind_code"])
df3.to_excel(out2)
out2.save()


startDate = datetime.datetime(2022,8,1)
startDate_str = startDate.strftime("%Y%m%d")
endDate = datetime.datetime(2022,8,5)
endDate_str = endDate.strftime("%Y%m%d")


out3 = pd.ExcelWriter('stock_picking_factor.xlsx')
df4 = pd.merge(df1,df3,on="wind_code")
dfs = []
for _, row in df4.iterrows():
    code = row['wind_code']
    sectorid = row['sectorid']
    #data = w.wss(code, "pct_chg_per","startDate=%s;endDate=%s"%(startDate,endDate))
    data = w.wss(code, "pct_chg_per,avg_amt_per,avg_MV_per,fa_roe_avg,west_netprofit_fy1_6m",
          "startDate=%s;endDate=%s;unit=1;currencyType=;tradeDate=%s"%(startDate,endDate,date_str))
    df=pd.DataFrame(data.Data).T
    df.columns=data.Fields
    df.insert(0,'code',code)
    df.insert(2,'sectorid',sectorid)
    dfs.append(df)
df = pd.concat(dfs)
df=df.sort_values(by=["PCT_CHG_PER"],ascending=False)
df.to_excel(out3)
out3.save()

df[df["PCT_CHG_PER"]>0].groupby("sectorid").count()["code"]


Without the criteria of positive return, the top 3 sectors ( ranked by the number of stocks pitched by securities firms) are:

industrial machinery;
semiconductor products ;
Electrical components and equipment.
The factor of sector is effective.

Currently no Comments.