Portfolio Optimization: Relationship between Risk vs. Reward

Posted on Feb 22, 2020



The skills I demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

LinkedIn |ย  GitHub |ย  Email | Data | Web App


The main motivation behind this web scraping project is based on Modern Portfolio Theory (MPT), a quantitative framework applied to investment portfolios that optimizes the relationship between risk vs. reward. This financial theory was founded by Harry Markowitz in the 1950s, and at the time, mathematics were severely underused in the economic and financial world, and Markowitz's approach replaced the world's reliance of judgement with statistical models for several decades.ย 

Background (MPT)

The underlying assumption underlying Markowitz's portfolio theory is normal distribution of stock returns, and only three variables are analyzed for relevant decision making: i.) mean returns ; ii.) variance of the returns (volatility) ; iii.) covariance between each security.ย 

Modern Portfolio Theory remains a pillar of finance, despite the emergence of artificial intelligence in today's investment landscape and the ability to deploy complex portfolio modeling that goes outside the scope of statistical normality. Large financial institutions (pension funds, hedge funds, high-frequency trading firms) with abundant capital deploy complex strategies to optimize their holdings, and most overlook the foundations of Markowitz's framework.

The Project Data

The data was scraped using BeautifulSoup from the websites Yahoo Finance and Quandl in demonstrate i.) portfolio optimization ; ii.) A visual roadmap of macroeconomic relationships and asset classes. Historical 10-year daily closing prices for 10 stocks were used as the sample data for the portfolio, and 3-year daily closing prices of economic data were used for the visual roadmap.ย 

An optimal portfolio is defined as the portfolio with either minimum volatility (risk) for a given target return level, or maximum return for a given risk level. Of paramount interest to investors is the risk-return profiles that are possible for a given set of securities and their statistical characteristics.ย 

Portfolio Optimization

I.) Monte Carlo Simulation

  • Simulation generates thousands of vectors with random portfolio weights.
  • For every simulated allocation, we record the resulting ย portfolio variance and mean return.
  • Optimization Constraints:ย 
    • All position weights add to 100%ย 
    • Short Sale is not allowed


II.) Maximize Return-Volatility / Minimize Portfolio Variance

  • Two optimization methods were utilized to generate optimal portfolios : ย 
    • #1 - Maximize Risk-Reward ratio (Sharpe)ย 
    • #2 - Minimize Portfolio Variance
  • Mean-Variance Optimization is performed with a minimization function from SciPy module, and ptimal portfolio under both methods.


III.) Efficient Frontier

  • The efficient frontier is a derivation of all optimal portfolios (minimum volatility for target return or maximum return for a given level of volatility) - and is similar to the previous optimization
  • The only difference is that the efficient frontier iterates over multiple starting conditions. The approach we take is that we fix a target return level and derive for each such level those portfolio weights that lead to the minimum volatility value.
  • For the optimization, this leads to two conditions:
    1.) target return level (trets)
    2.) sum of portfolio weights.
  • ย 
Efficient Frontier

To illustrate, the plotted dots represent all portfolio combinations generated from the Monte Carlo simulation. The crosses that form a hyperbola represent the optimal mean-variance portfolios.

The leftmost portfolio and top-right corner generated by optimization are represented by the two larger stars.

About Author

Related Articles

Leave a Comment

No comments found.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI