• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Finance Train

Finance Train

High quality tutorials for finance, risk, data science, fintech, accounting and more

  • Home
  • Finance Exams
    • CFA Exam
    • CAIA Exam
    • ERP Exam
    • FRM Exam
    • PRM Exam
  • Tutorials
  • Careers
  • Calculators
  • Products

R Financial Packages for Portfolio Analysis

Data Science, Portfolio Management

This lesson is part 1 of 5 in the course Portfolio Analysis in R

This tutorial will teach you about how to use R for portfolio analysis. We will be using various financial packages from R that will help us perform portfolio analysis. Let’s look at these packages:

Quantmod

Quantmod is a very powerful package that is designed for quant traders to explore and build quantitative trading models. For our work related to portfolio analysis, it will primarily be used to download relevant stock data, although it has further functionality for advanced techniques. It comes with both the xts and zoo packages, both of which are excellent programmes for manipulating time series data. The quantmod package can be used for three important things: 1) downloading data, 2) creating charts and 3) technical indicators and other functions.

PortfolioAnalytics

The second package that is used is PortfolioAnalytics. This package is designed especially to optimise portfolios according to specific criteria, for example, Markowitz mean-variance portfolio optimisation. Using the PortfolioAnalytics package, you can get solutions and visualizations for portfolio problems with complex objectives and constraints. It allows you to specify a portfolio with assets, constraints and objectives that are solver agnostic. It supports various objective types such as: return, risk, risk budget, and weight concentration. It has solid functions for optimization problems. It can also be used for creating charts such as risk budgets and efficient frontier. 

PerformanceAnalytics

The PortfolioAnalytics package also comes with the PerformanceAnalytics package, which is useful for calculating portfolio returns. It is used for performance and risk analysis of financial instruments or portfolios. It includes various functions to calculate various metrics such as Conditional Value at Risk (CVAR), Standard Deviation, Expected Tail Loss (ETL), and Expected Shortfall (ES). 

DerivMkts

Finally, DerivMkts is used for the valuation of options and is specifically used in this tutorial to calculate implied volatility for portfolio optimisation. The package contains a set of pricing and expository functions that are useful in teaching financial derivatives.

Note that this is not an exhaustive list. There are many financial packages, however, for the purpose of portfolio analysis we will be using these packages. 

Series Navigation‹ Downloading Stock Data in R Using QuantMod ›
Join Our Facebook Group - Finance, Risk and Data Science

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

In this Course

  • R Financial Packages for Portfolio Analysis
  • Downloading Stock Data in R Using QuantMod
  • Calculating Stock Returns and Portfolio Returns in R
  • Modern Portfolio Theory
  • Portfolio Optimisation in R

Finance Exam Products

  • CFA Level I Mock Exam
  • CFA Level I Practice Questions
  • CFA Level I Authority
  • PRM Exam I Practice Questions
View All Products

Latest Tutorials

    • Machine Learning in Finance Using Python
    • Portfolio Analysis in R
    • Credit Risk Modelling in R
    • Quantitative Trading Strategies in R
    • Financial Time Series Analysis in R
    • VaR Mapping
    • Option Valuation
    • Prime Brokerage
    • Financial Reporting Standards
    • Fraud
Facebook Group

Footer

Recent Posts

  • Social media reporting – it is not as difficult as you think
  • Model Selection in Machine Learning
  • Evaluate Model Performance – Loss Function
  • Train-Test Datasets in Machine Learning
  • Feature Selection in Machine Learning

Products

  • Level I Authority for CFA® Exam
  • CFA Level I Practice Questions
  • CFA Level I Mock Exam
  • Level II Question Bank for CFA® Exam
  • PRM Exam 1 Practice Question Bank
  • All Products

Quick Links

  • Privacy Policy
  • Contact Us

Copyright © 2019 Finance Train. All rights reserved.

  • About Us
  • Privacy Policy
  • Contact Us