Javier Rodríguez Chatruc be56c8e1a0 Merge pull request #57 from lambdaclass/rebalancing_days
rebalancing days calculation with days in data
2020-03-17 16:02:53 -03:00
2019-05-13 17:28:34 -03:00
2020-02-07 14:28:14 -03:00
2019-05-13 15:28:23 -03:00
2019-05-13 15:28:23 -03:00
2019-05-13 15:28:23 -03:00
2019-05-13 15:28:23 -03:00
2019-05-08 11:48:05 -03:00
2019-05-30 14:02:31 -03:00
2019-05-13 15:28:23 -03:00

Options Backtester

Simple backtester to evaluate and analyse options strategies over historical price data.

Requirements

  • Python >= 3.5
  • pipenv

Setup

For backtesting, set $OPTIONS_DATA_PATH to the appropriate directory where the data is located. All file paths parsed by the backtester will be relative to this directory.

To use the data scraper the following environment variables need to be set:

  • $SAVE_DATA_PATH: where the data will be saved to (default is ./data/scraped)
  • $TIINGO_API_KEY: used to fetch data from Tiingo
  • $S3_BUCKET: name of the S3 bucket to backup data
  • $AWS_ACCESS_KEY_ID: AWS acces key id
  • $AWS_SECRET_ACCESS_KEY: AWS secret key

You can configure the data scraper by editing the configuration file data_scraper.conf (json-formated).

Sample file:

{
  "cboe": {
    "mute_notifications": ["BFB", "CBSA"]
  },
  "notifications": {
      "slack_webhook": "https://hooks.slack.com/services/MY_WORKSPACE_WEBHOOK"
  }
}

HINT: store environment variables in an .env file and pipenv will load them automatically when using make env.

Usage

Create environment and download dependencies

$> make init

Activate environment

$> make env

Run tests

$> make test

Scrape data (supported scrapers: CBOE, Tiingo)

$> make scrape scraper=cboe

$> make scrape scraper=tiingo

Run backtester with benchmark strategy

$> make bench

For complete novices in finance and economics, this post gives a comprehensive introduction.

Books

Introductory

  • Option Volatility and Pricing 2nd Ed. - Natemberg, 2014
  • Options, Futures, and Other Derivatives 10th Ed. - Hull 2017
  • Trading Options Greeks: How Time, Volatility, and Other Pricing Factors Drive Profits 2nd Ed. - Passarelli 2012

Intermediate

  • Trading Volatility - Bennet 2014
  • Volatility Trading 2nd Ed. - Sinclair 2013

Advanced

  • Dynamic Hedging - Taleb 1997
  • The Volatility Surface: A Practitioner's Guide - Gatheral 2006
  • The Volatility Smile - Derman & Miller 2016

Papers

Data sources

Exchanges

Historical Data

S
Description
Simple backtesting software for options
Readme MIT 32 MiB
Languages
Jupyter Notebook 98.5%
Python 1.5%