O'Reilly logo
live online training icon Live Online training

Introduction to quantitative financial risk management with R

Evaluate risk versus reward in stocks, consumer credit, and nontraditional markets

Ted Kwartler

You don’t have to be an investment banker or even a large investor to benefit from financial models that help you evaluate risk versus reward.The R programming language makes financial modeling simple. R is excellent for algorithmic trading. It’s easy to use with a flexible syntax that lets you focus on trading indicators and concepts rather than esoteric coding.

Join expert Ted Kwartler to learn how to create your own trading workflows, evaluate risk, and identify investment opportunities across three financial markets: stocks, consumer credit, and nontraditional markets. Along the way, you’ll download and assess real equity data, perform common stock evaluations, and visualize stocks using R. You’ll also explore basic trading indicators and methods for modeling risk.

What you'll learn-and how you can apply it

By the end of this live, hands-on, online course, you’ll understand:

  • How to interpret and evaluate stock indicators
  • Common visualizations for quantitative equity trades
  • Basic risk modeling in consumer credit
  • How to simulate the return in an unregulated investment market

And you’ll be able to:

  • Build financial indications to identify stock opportunities
  • Model risk in consumer credit to visualize risk versus reward
  • Create common stock visualizations that mimic online and paid services
  • Evaluate an unregulated investment market

This training course is for you because...

  • You want to improve your financial acumen and investment opportunities.
  • You work with financial data.
  • You’re a retail investor looking to improve returns.

Prerequisites

  • A machine with R installed
  • A free RStudio Cloud account
  • Basic knowledge of R, RStudio, and Git
  • Familiarity with data structures in R, particularly data frames and XTS (time series)
  • Experience with ggplot2 (useful but not required)

Recommended preparation:

  • Read “Getting Started and Getting Help” and “Data Structures” (chapters 1 and 5 in R Cookbook, second edition)
  • Read “Data Visualization with ggplot2” (chapter 1 in R for Data Science)

Recommended follow-up:

About your instructor

  • Ted Kwartler is an adjunct professor at Harvard Extension School, where he teaches data mining for business. He also teaches a seminar on natural language processing at the University of St. Gallen, in Switzerland. His teaching and data science practice focuses on practical applications in business and finance.Ted has held leadership roles at Amazon, Liberty Mutual Insurance, and DataRobot. He has an MBA from the University of Notre Dame with citations in marketing and analytics.

Schedule

The timeframes are only estimates and may vary according to how the class is progressing

Introduction (10 minutes)

  • Lecture: Introduction and review of key terms
  • Hands-on exercise: Perform a Git pull to ensure you have all scripts and data

Stock data and basic visualization (15 minutes)

  • Lecture: The financial market and types of investment strategies; APIs; basic financial plots
  • Hands-on exercises: Manipulate a time series object; create basic and dynamic plots
  • Q&A

Creating the first indicator (15 minutes)

  • Lecture: Technical trading rules and indicators; simple moving averages
  • Hands-on exercises: Calculate and visualize simple moving averages
  • Q&A

Simple moving average (SMA) indicator (15 minutes)

  • Lecture: Calculating investment returns using simple moving averages; tests for evaluating indicators
  • Hands-on exercises: Calculate death cross and golden cross patterns; structure simple moving averages as trading indicators; visualize historical performance using a backtest
  • Q&A

Break (5 minutes)

Moving average convergence/divergence (MACD) indicator (20 minutes)

  • Lecture: Moving average convergence/divergence indicator overview
  • Hands-on exercises: Construct a standard MACD indicator; apply the MACD signal as an indicator; visualize a stock and MACD in a dynamic plot; perform a backtest
  • Q&A

Relative strength index (RSI) (20 minutes)

  • Lecture: Relative strength index overview
  • Hands-on exercises: Construct the RSI; visualize the RSI in a dynamic plot

Compounding two or more indicators (10 minutes)

  • Lecture: Testing and visualizing results
  • Hands-on exercises: Apply the MACD and RSI indicators for buying and selling
  • Q&A

Break (5 minutes)

Consumer credit modeling (20 minutes)

  • Lecture: Investment scenarios and logistic regression
  • Hands-on exercises: Create a logistic regression to model loan default probability
  • Q&A

Predicting loan defaults (20 minutes)

  • Lecture: Modeling KPI and realistic investment scenarios; the capital asset pricing model (CAPM)
  • Hands-on exercises: Apply logistic regression to new loans; evaluate training and test partitions; build a dynamic capital asset pricing visual to evaluate investment opportunities
  • Q&A

Simulate a nontraditional market opportunity (15 minutes)

  • Lecture: The trading card market as an investment vehicle; structuring a problem for analysis
  • Hands-on exercises: Examine how to sample with probability; simulate market buying opportunity to quantify risk

Wrap-up and Q&A (10 minutes)