Table of Contents

   What this Book includes
   Is This Book for You
   What Do You Need to Use This Book
   How The Book Is Organized
   Using Code Examples
   Customer Support

Chapter 1 Introduction to R
   Getting Started with R

      Variablea and Assignment
      Built-in Functions
      Random Numbers
Vectors and Matrices

         Matrix Elements
         Special Matrices
         Matrix Operations
Arrays and List


Data Frame

Data Table

      DT[i, j, by] Command
      Data Join
Functions in R

Chapter 2 Market Data
   Market Data from Yahoo

      EOD Stock Date
         Import CSV File
         Uisng R Function
         Using quantmod Package
      Stock Quotes
         Using R Function
         Using quantmod Package
      Option Chain Data
         Using R Function
         Using quantmod Package
   Market Data from Google

      EOD and Minute-Bar Data
         Using R Function
         Using quantmod Package
      Real-Time Stock Quotes
      Option Chain Data
   Market Data from Quandl

      Quandl API
      Adjusted Stock EOD Data
      Other Market Data
   ISDA Rates from Markit

Chapter 3 Plots and Graphics in R
   Base R Graphics

      Simple 2D Plots
      Plots with Two Y Axes
      Specialized 2D Plots
         Bar Plots
         Stair-Step Plots
         Stem Plots
         Error Bar Plots
         Area Plots
         Pia Plots
   Creating Graphs Using ggplot2

      Scatter Plots
      Line Plots
      Area Plots
      Polar Plots
   3D Plots

      3D Line Plots
      3D Scatter Plots
      3D Surface-Like Charts
      Specialized 3D Plots
         X-Y Color Plots
         Contour Plots
         Combination Plots
      3D Parametric Surfaces
         Helicoid Surface
         Sphere Surface
         Torus Surface
         Quadric Surfaces
   Interactive 3D Plots

      Using plot3Drgl
      Using rgl
         Scatter Plots
         Custom Colormap
         Surface Plots

Chapter 4 Stock Charts and Technical Indicators
   Using Standard R Graphics

   Using quantmod Package

      Line Stock Charts
      Bar and Candlestick Charts
   Technical Indicators

      Moving Avreage Based Indicators
      Envelope and Bollinger Band Indicators
      MACD and RSI Indicators
      On Balance Volume Indicator
      Williams %R Indicator
      Stochastic Indicator
      Commodity Channel Index Indicator
      Add Custom Indicators

Chapter 5 Option Pricing
   Introduction to Options

      Option Payoffs
      Option Value
   Pricing European Options

      Black-Scholes Model
      Generalized Black-Scholes Model
      Black-Scholes Greeks
      Implied Volatility
   Pricing American Options

      BAW Approximation
      Applying BAW Approximation
   Pricing Barrier Options

      Standard Narrier Option Formulas
      Barrier Option Applications
   Pricing European Options Using RQuantLib

      Scalar Inputs
      Vector Inputs
      Option Price
      Dividend Rho
      Implied Volatility
   Pricing American Options Using RQuantLib

      Option Prices
      Implied Volatility
   Pricing Barrier Options Using RQuantLib

Chapter 6 Pricing Fixed-Income Instruments
   Simple Bond Pricing

      Discounting Factors
      Pricing Bonds Using RQuantLib
      Creating QUantLib-SWIG R
      Pricing Bonds USing QuantLib-SWIG R
      Compounding Frequency Conventions
      Pricing Bonds with a Rate Curve
      Yield to Maturity
   Zero-Coupon Yield Curve

      Treasury Zero-Coupon Yield Curve
      Interbank Zero-Coupon Yield Curve
      Credit Spread Term Structures
   CDS Pricing

      Hazard Rate and Default Probability
      Risky Annuities and Risky Durations
      CDS Pricing Engine

Chapter 7 Linear Analysis
   Simple Linear Regression

      What are Alpha and Beta?
      Linear Regression in R
   Simple 2D PCA

      PCA in R
   Compairing Linear Regression and PCA

   Multiple Linear Regressions

      MLR for Indices
      MLR for Stocks
   Multiple PCA

      PCA for Indices
      PCA for Stocks

Chapter 8 Time Series Analysis

      White Noise
      Random Walk with Drift
      Model for Financial Data
   Model Selection

   ARIMA Model

      AR Model
      Moving Avreage Model
      Autoregressive Moving Average Model
      ARIMA Model Applications
   GARCH Model


      Testing for Stationarity
      Cointegratting Time Series

Chapter 9 Machine Learning
   KNN Classifier

      KNN Model
      KNN Model for Classification
      Confusion Matrix
      KNN Model for Regression
   Random Forest

      Random Foret Algorithm
      Random Forest for Classification
      Random Forest for Regression
   Support Vector Machine

      SVM for Classification
      SVM for Regression
   Artificial Neural Networks

      Introduction to Neural Networks
      Neural Networks for Classification
      Neural Netwroks for Regression

Chapter 10 Trading Strategies and Backtesting
   Trading Strategy Identification

   Trading Signals

      Stock Data
      Signals from Moving Average
      Signals from Linear Regression
      Signals from RSI
      Signal from Williams %R
   Backtest System Implementation

      P&L Computation
      Risk Measures
   Pairs Trading

      Pairs Identification
      Signals for Pairs Trading
      Market Neutral
      P&L for Pairs Trading
   Regime-Switching Model

      Hidden Markov Model
      Average True Range Indicator
      Regime-Switching Strategy
   R Packages for Trading System

      Using Standard Indicators
      Using Custom Indicators
      Multi-Asset Portfolios

Chapter 11 Portfolio Optimization
   Theoretical Background

      Efficient Frontier
      Portfolio Weights
   Quadratic Programming

      QP Model
      QP Solvers
      Portfolio Optimization Using QP Solver
   PortfolioAnalytics Package

      Standrad Deviation as Risk
      Expected Shortfall as Risk
      Efficient Frontier
   Complex Portfolios

      Market Neutral Porfolios
      Portfolio Rebalancing