Skip to content

Research on options using machine learning algorithms trained on historical data.

License

Notifications You must be signed in to change notification settings

jacktan1/Options-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Options Project

Description

Goal: Use Greeks and sentiment features derived from end-of-day (EOD) option snapshots to predict performance of different option strategies (e.g. vertical spreads).

Alpha Vantage, Questrade API, and FRED are used to retrieve historical stock prices, current stock prices, and treasury yields (respectively).

For more details, I have written an article explaining the methodology use in section 4.1 below.

Overview

  • Part 1: Closing price, splits and dividends

    • Retrieve historical closing prices
    • Adjust for splits
    • Estimate dividend time series
  • Part 2: Treasury Yields

    • Retrieve market yields on constant maturity securities
    • Convert linearly interpolated interest rates to continuous rates
  • Part 3: Preprocess Options

    • Filter options data for specified ticker
    • Remove errors caused by stock splits
    • Adjust options by split factors
    • Attach dividend and closing prices on data/exp date(s)
  • Part 4: Engineer Features

    • 4.1 - Greeks
      • Calculate Greeks from clean option spread
      • Delta
        • For each of call & put, we parameterize: "skew", in-the-money (ITM) spread, out-of-the-money (OTM) spread
        • Interpolation at 1, 2, 3, 6 and 12 months constant maturity
      • VIX
        • Modified stock-specific VIX calculation based on CBOE VIX
        • Parameterization
          • Call & put VIXs
          • Interpolation at 1, 2, 3, 6 and 12 months constant maturity
      • Gamma
        • No parameterization yet (future)
      • Theta (future)
    • 4.2 - Custom Input Features
      • Use daily change in open interest (methodology - EDA) and volume to parameterize options via linear regression
        • Years until expiry vs. adjusted moneyness ratio (7 variations on sample weights)
        • Call, put slopes and intercepts (2 parameters per variation)
  • Part 5: Fit & Predict Models

    • Fit - For each model type:
      • Fit separate sub-models that predict EOD price [1, 5, 10, 15, 20, 40, 65, 90, 130, 260, 390, 520] days out
      • Generate 2-dimensional probability density kernels (1 per sub-model) using multi-variate kernel density estimates
    • Predict - For each expiry date in test options data date:
      • Use the two nearest sub-model kernels and their discrete predictions to linearly interpolate a 1-dimensional density plot for each [data date, expiration date]
    • Model Types:
      • Baseline model
        • Simply uses previous day's EOD price as predictor for target
      • Baseline model with target standardization and autoregression
      • XGBoost model
        • De-trend target variable to be stationary (ARIMA, Augmented Dickey-Fuller)
  • Part 6: Trading Strategies

    • Select the most suitable option(s) per [data date, expiration date] based on prediction PDF
    • Strategies:

Demonstration of parts 5 & 6

About

Research on options using machine learning algorithms trained on historical data.

Topics

Resources

License

Stars

Watchers

Forks