Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Options IVolatility c++

This is a C++ bot for options trading that is meant to speed up performance over the python implementation. The application includes custom interpolation models to analyze option chains and mispricings.

Requirements

Make sure you have the following dependencies installed:

  • Eigen
  • Curl
  • nlohmann/json
  • CMake 3.14 or later

You can install these libraries via vcpkg or your preferred package manager.

Configuration

  1. Create a .env file in the root directory with the following structure:
   SCHWAB_API_KEY=your_schwab_api_key 
   SCHWAB_SECRET=your_schwab_secret 
   SCHWAB_CALLBACK_URL=your_callback_url 
   SCHWAB_ACCOUNT_HASH=your_account_hash 
   FRED_API_KEY=your_fred_api_key 
   DRY_RUN=true 
   TIME_TO_REST=2
  1. Create a stocks.json file in the root directory with the following structure:
[   
   { 
       "ticker": "JPM", 
       "date_index": 0, 
       "option_type": "calls", 
       "min_overpriced": 0.14, 
       "min_oi": 400.0 
   } 
]

Usage

  1. Clone the repository and navigate to the project folder:

`git clone https://github.com/nichoc0/options.git

  1. Build the project using CMake:

mkdir build cd build cmake .. make

  1. Run the program using the following command:

./options

Features

  • filters option chains by bid price, implied volatility, and open interest
  • fits SVI, SSVI, RFV+RBF and SVI+RBF to the IV smile, with arbitrage-free constraints
  • compares model IV against realized vol and writes the results to CSV

Python Tooling

A set of Python scripts wrap the C++ modeler for backtests, analysis, plotting, and an HTTP service.

Requirements

Pinned in requirements.txt. Install into a virtualenv:

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Scripts resolve repo-relative locations through paths.py, so they run from any checkout without editing absolute paths. The historical arkham/{options,treasury,results} layout is assumed for external data and result directories (they resolve next to the repo).

Plotting and surfaces

  • plot_smile.py --source {rbf,cpp,models} --style {serif,sans} --out PREFIX renders the 2D volatility smile from the committed model CSVs.
  • plot_vol_surface_3d.py renders the 3D surface.
  • build_surface.py --model {raw,rfvrbf} --input-dir DIR --out FILE builds surface JSON from spy_<dte>dte.csv tenor files.

Backtests and analysis

The scripts under scripts/ run the modeler across dates and analyze the output, for example:

python3 scripts/run_call_backtest.py
python3 scripts/plot_volatility_smiles.py

IV service

deploy/iv_server.py is a Flask app served by gunicorn behind loopback. It requires the X-API-Key header to match IV_API_KEY.

export IV_API_KEY=your_secret
gunicorn -w 2 -b 127.0.0.1:8080 iv_server:app

See deploy/deploy.sh and deploy/terraform/ for the EC2 deployment (private subnet, SSM access, no SSH).

License

All Rights Reserved License (ARR).

This project is licensed under an All Rights Reserved License (ARR). See the LICENSE file for more details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages