ThepaperanalyzesthetheoryandapplicationofMarkowitzMean-VarianceModelandCAPMmodel.Firstly,itexplainsthedevelopmentprocessandstandpointsoftwomodelsanddeducesthewholeprocessindetail.Then30stocksarechoosenfromShangzheng50stocksandaretestifiedwhetherthepricesofShanghaistocksconformtothetwomodels.Withthetechniqueoftimeseriesandpaneldataanalysis,theresearchonthestockriskandeffectiveportfoliobyORIGINandMATLABsoftwareisconducted.TheresultshowsthatShanghaistockmarketconformstoMarkowitzMean-VarianceModeltoacertainextentandcangiveinvestorsreliablesuggestiontogainhigherreturn,butthereisnopositiverelationbetweensystemriskandprofitratioandCAPMdoesn'tfunctionwellinChina'ssecuritymarket.