O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Learning Quantitative Finance with R

Book Description

Implement machine learning, time-series analysis, algorithmic trading and more

About This Book

  • Understand the basics of R and how they can be applied in various Quantitative Finance scenarios
  • Learn various algorithmic trading techniques and ways to optimize them using the tools available in R.
  • Contain different methods to manage risk and explore trading using Machine Learning.

Who This Book Is For

If you want to learn how to use R to build quantitative finance models with ease, this book is for you. Analysts who want to learn R to solve their quantitative finance problems will also find this book useful. Some understanding of the basic financial concepts will be useful, though prior knowledge of R is not required.

What You Will Learn

  • Get to know the basics of R and how to use it in the field of Quantitative Finance
  • Understand data processing and model building using R
  • Explore different types of analytical techniques such as statistical analysis, time-series analysis, predictive modeling, and econometric analysis
  • Build and analyze quantitative finance models using real-world examples
  • How real-life examples should be used to develop strategies
  • Performance metrics to look into before deciding upon any model
  • Deep dive into the vast world of machine-learning based trading
  • Get to grips with algorithmic trading and different ways of optimizing it
  • Learn about controlling risk parameters of financial instruments

In Detail

The role of a quantitative analyst is very challenging, yet lucrative, so there is a lot of competition for the role in top-tier organizations and investment banks. This book is your go-to resource if you want to equip yourself with the skills required to tackle any real-world problem in quantitative finance using the popular R programming language.

You'll start by getting an understanding of the basics of R and its relevance in the field of quantitative finance. Once you've built this foundation, we'll dive into the practicalities of building financial models in R. This will help you have a fair understanding of the topics as well as their implementation, as the authors have presented some use cases along with examples that are easy to understand and correlate.

We'll also look at risk management and optimization techniques for algorithmic trading. Finally, the book will explain some advanced concepts, such as trading using machine learning, optimizations, exotic options, and hedging.

By the end of this book, you will have a firm grasp of the techniques required to implement basic quantitative finance models in R.

Style and approach

This book introduces you to the essentials of quantitative finance with the help of easy-to-understand, practical examples and use cases in R. Each chapter presents a specific financial concept in detail, backed with relevant theory and the implementation of a real-life example.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Learning Quantitative Finance with R
    1. Learning Quantitative Finance with R
    2. Credits
    3. About the Authors
    4. About the Reviewer
    5. www.PacktPub.com
      1. Why subscribe?
    6. Customer Feedback
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Introduction to R
      1. The need for R
      2. How to download/install R
      3. How to install packages
        1. Installing directly from CRAN
        2. Installing packages manually
      4. Data types
        1. Vectors
        2. Lists
        3. Matrices
        4. Arrays
        5. Factors
        6. DataFrames
      5. Importing and exporting different data types
        1. How to read and write a CSV format file
        2. XLSX
        3. Web data or online sources of data
        4. Databases
      6. How to write code expressions
        1. Expressions
          1. Constant expression
          2. Arithmetic expression
          3. Conditional expression
          4. Functional call expression
        2. Symbols and assignments
        3. Keywords
        4. Naming variables
      7. Functions
        1. Calling a function without an argument
        2. Calling a function with an argument
        3. How to execute R programs
        4. How to run a saved file through R Window
        5. How to source R script
      8. Loops (for, while, if, and if...else)
        1. if statement
        2. if...else statement
        3. for loop
        4. while loop
        5. apply()
        6. sapply()
      9. Loop control statements
        1. break
        2. next
      10. Questions
      11. Summary
    9. 2. Statistical Modeling
      1. Probability distributions
        1. Normal distribution
          1. norm
          2. pnorm
          3. qnorm
          4. rnorm
        2. Lognormal distribution
          1. dlnorm
          2. plnorm
          3. qlnorm
          4. rlnorm
        3. Poisson distribution
        4. Uniform distribution
        5. Extreme value theory
      2. Sampling
        1. Random sampling
        2. Stratified sampling
      3. Statistics
        1. Mean
        2. Median
        3. Mode
        4. Summary
        5. Moment
        6. Kurtosis
        7. Skewness
      4. Correlation
        1. Autocorrelation
        2. Partial autocorrelation
        3. Cross-correlation
      5. Hypothesis testing
        1. Lower tail test of population mean with known variance
        2. Upper tail test of population mean with known variance
        3. Two-tailed test of population mean with known variance
        4. Lower tail test of population mean with unknown variance
        5. Upper tail test of population mean with unknown variance
        6. Two tailed test of population mean with unknown variance
      6. Parameter estimates
        1. Maximum likelihood estimation
        2. Linear model
      7. Outlier detection
        1. Boxplot
        2. LOF algorithm
      8. Standardization
      9. Normalization
      10. Questions
      11. Summary
    10. 3. Econometric and Wavelet Analysis
      1. Simple linear regression
        1. Scatter plot
        2. Coefficient of determination
        3. Significance test
        4. Confidence interval for linear regression model
        5. Residual plot
        6. Normality distribution of errors
      2. Multivariate linear regression
        1. Coefficient of determination
          1. Confidence interval
      3. Multicollinearity
      4. ANOVA
      5. Feature selection
        1. Removing irrelevant features
      6. Stepwise variable selection
        1. Variable selection by classification
      7. Ranking of variables
      8. Wavelet analysis
      9. Fast Fourier transformation
      10. Hilbert transformation
      11. Questions
      12. Summary
    11. 4. Time Series Modeling
      1. General time series
      2. Converting data to time series
      3. zoo
        1. Constructing a zoo object
        2. Reading an external file using zoo
        3. Advantages of a zoo object
          1. Subsetting the data
          2. Merging zoo objects
          3. Plotting zoo objects
        4. Disadvantages of a zoo object
      4. xts
        1. Construction of an xts object using as.xts
        2. Constructing an xts object from scratch
      5. Linear filters
      6. AR
      7. MA
      8. ARIMA
      9. GARCH
      10. EGARCH
      11. VGARCH
      12. Dynamic conditional correlation
      13. Questions
      14. Summary
    12. 5. Algorithmic Trading
      1. Momentum or directional trading
        1. Pairs trading
          1. Distance-based pairs trading
          2. Correlation based pairs trading
          3. Co-integration based pairs trading
      2. Capital asset pricing model
      3. Multi factor model
      4. Portfolio construction
      5. Questions
      6. Summary
    13. 6. Trading Using Machine Learning
      1. Logistic regression neural network
      2. Neural network
      3. Deep neural network
      4. K means algorithm
      5. K nearest neighborhood
      6. Support vector machine
      7. Decision tree
      8. Random forest
      9. Questions
      10. Summary
    14. 7. Risk Management
      1. Market risk
      2. Portfolio risk
      3. VaR
        1. Parametric VaR
        2. Historical VaR
      4. Monte Carlo simulation
      5. Hedging
      6. Basel regulation
      7. Credit risk
      8. Fraud detection
      9. Liability management
      10. Questions
      11. Summary
    15. 8. Optimization
      1. Dynamic rebalancing
        1. Periodic rebalancing
      2. Walk forward testing
      3. Grid testing
      4. Genetic algorithm
      5. Questions
      6. Summary
    16. 9. Derivative Pricing
      1. Option pricing
        1. Black-Scholes model
        2. Cox-Ross-Rubinstein model
        3. Greeks
      2. Implied volatility
      3. Bond pricing
      4. Credit spread
      5. Credit default swaps
      6. Interest rate derivatives
      7. Exotic options
      8. Questions
      9. Summary