All Projects → sirnfs → Optionsuite

sirnfs / Optionsuite

Licence: mit
Option and stock backtester / live trader

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Optionsuite

Lean
Lean Algorithmic Trading Engine by QuantConnect (Python, C#)
Stars: ✭ 5,675 (+9684.48%)
Mutual labels:  options, trading
Turingtrader
The Open-Source Backtesting Engine/ Market Simulator by Bertram Solutions.
Stars: ✭ 132 (+127.59%)
Mutual labels:  trading, options
Tradingview Trainer
A lightweight app for practicing your trading on Tradingview
Stars: ✭ 106 (+82.76%)
Mutual labels:  trading, options
SierraChartZorroPlugin
A Zorro broker API plugin for Sierra Chart, written in Win32 C++.
Stars: ✭ 22 (-62.07%)
Mutual labels:  options, trading
Go Robinhood
A golang library for interacting with the Robinhood private API
Stars: ✭ 48 (-17.24%)
Mutual labels:  trading, options
Optopsy
A nimble options backtesting library for Python
Stars: ✭ 373 (+543.1%)
Mutual labels:  trading, options
Trade Frame
c++ based application for testing options based automated trading ideas using DTN IQ real time data feed and Interactive Brokers (TWS API) for trade execution.
Stars: ✭ 187 (+222.41%)
Mutual labels:  trading, options
Algotrader
Simple algorithmic stock and option trading for Node.js.
Stars: ✭ 468 (+706.9%)
Mutual labels:  trading, options
Volatility Trading
A complete set of volatility estimators based on Euan Sinclair's Volatility Trading
Stars: ✭ 538 (+827.59%)
Mutual labels:  trading, options
Trading Indicator
provide trading technical indicator values based on data of almost crypto currency exchanges
Stars: ✭ 31 (-46.55%)
Mutual labels:  trading
Gekko Strategies
Strategies to Gekko trading bot with backtests results and some useful tools.
Stars: ✭ 1,022 (+1662.07%)
Mutual labels:  trading
Ta4j
A Java library for technical analysis.
Stars: ✭ 948 (+1534.48%)
Mutual labels:  trading
Sibyl
Platform for backtesting and live-trading intraday Stock/ETF/ELW using recurrent neural networks
Stars: ✭ 32 (-44.83%)
Mutual labels:  trading
Trading Vue Js
💹 Hackable charting lib for traders. You can draw literally ANYTHING on top of candlestick charts.
Stars: ✭ 1,021 (+1660.34%)
Mutual labels:  trading
Bitvision
Terminal dashboard for trading Bitcoin, predicting price movements, and losing all your money
Stars: ✭ 957 (+1550%)
Mutual labels:  trading
Tacharting
A charing application to download, plott and analyse securities, indicators, strategies and trading records
Stars: ✭ 50 (-13.79%)
Mutual labels:  trading
Iconswitch
🍭 Custom Android Switch widget
Stars: ✭ 874 (+1406.9%)
Mutual labels:  options
Swipeformore
Manage Cydia packages via swipe.
Stars: ✭ 11 (-81.03%)
Mutual labels:  options
Jesse
An advanced crypto trading bot written in Python
Stars: ✭ 1,038 (+1689.66%)
Mutual labels:  trading
Hfcrypto
Machine-learning based high frequency trading algorithm for altcoin cryptocurrencies [moved to closed source]
Stars: ✭ 48 (-17.24%)
Mutual labels:  trading

OptionSuite

Option / stock strategy backtester and live trader* framework.

Getting started decribes what you need in order to get started backtesting.

Please note that you need to purchase a data package in order to use this library since the sample data is quite limited.

Objective

The objective of the OptionSuite library is to create a general framework to backtest options strategies and to be extensible enough to handle live trading.

*Live trader is currently not supported, but the general framework is in place to enable support for live trading.

Overview of Library

The library is designed in a modular way, and several abstractions are provided which allow the user to add additional features. The directory structure of the library is as follows:

base - contains the abstract options class (option.py) and the two derived classes (call.py and put.py), which serve as the general options types for all other classes.

dataHandler - contains the abstract class (dataHandler.py), which is set up to handle loading option data from different sources. The framework has been tested with CSV data, and a CSV data handler class (csvData.py) is provided to load tick data provided through the CSV format. Any example CSV format is provided in the sampleData directory. More information on the CSV data needed for back testing is covered in the getting started section section.

events - the entire library / framework is event driven, and the abstract event class (event.py) handles the creation and deletion of events. The framework currently supports two different types of events: tick events (tickEvent.py) and signal events (signalEvent.py). The tick events are used to load data from the dataHandler and create the base option types (puts and calls). Signal events are generated to indicate that the criteria for the strategy in strategyManager has been successfully met.

optionPrimitives - option primitives allow for naked puts and calls as well as combinations of puts and calls. For example, an option primtive could describe a naked put, or it could describe a strangle, which is a combination of puts and calls. Since certain trades like strangles are common, the option primitives abstract class (optionPrimitive.py) wraps the base types (calls and puts), and describes the functionality needed to create and update the primitive. The strangle primitive (strangle.py) is fully functional, and the naked put primitive (nakedPut.py) declares the abstract methods, but the methods have yet to be implemented.

portfolioManager - the portfolio manager (portfolio.py) holds and manages all of the open positions. Potential positions are first generated by the strategyManager, and the portfolio manager opens a new positions if all risk paramters have been met. The portfolio is current held in memory, but a future implementation would ideally store the positions into a database or other non-volatile source.

sampleData - a single file aapl_sample_ivolatility.csv is provided. This file is used for several of the units tests in the different classes, and it also serves as an example of the CSV data format provided by iVolatility.

strategyManager - the strategy manager module provides an abstract class (strategy.py) which defines the basic parameters needed for an options strategy. The purpose of the strategy manager module is to filter the incoming tick data (by means of a tick event) to determine if a position should be opened (which would in turn fire a signal event). A full strangle stategy is provided (StrangleStrat.py), which includes options for trade management as well as several different criteria for determining if a trade should be opened (signal event generated).

utils - the utilities directory provides a few examples of plots from different backtests (see .png files) as well as a utility for combining CSVs (e.g., if there are multiple CSVs for different years of historical data) and plotting the results of the backtests (plotStats.py).

backTester.py - this is the "main" method for the library. It sets up all parameters for a backtesting session, and initializes the dataHandler class, the portfolioManager class, and the strategyManager class. It is helpful to start with this file to see how all of the modules work together.

Getting Started

The library has been tested with Python 2.7+

To get started, you first need some historical data for the backtests.

Getting the Data

The combinedCSV.csv file used during development and testing contains SPX data from 1990 to 2017 provided by iVolatility. If you'd like to use the same dataset I did, then you want to request the EOD Raw IV dataset for SPX.

There is a 10% discount on all orders greater than $100 if you use code SupraCV10PCTOFF in the "Please tell us what data you want to receive:" field.

You can request different time periods. A large time period such as 1990 to 2017 is broken up into multiple CSVs. The combineCSVs.py in utils can be used to combine multiple CSVs into a single CSV.

Loading the Data

Once you have downloaded the data, simply update the three lines below, and you are ready to run backTester.py.

dataProvider = 'iVolatility'
directory = '/Users/msantoro/PycharmProjects/Backtester/marketData/iVolatility/SPX'
filename = 'combinedCSV.csv'

Visualizing the Data

To plot output data such as cumulative profit / loss, I used Python's logging module to write output data to a file. The logging initialization is done in the __main__ function of backTester.py as shown below. There is a basic script plotStats.py in utils which takes the logging data and uses matplotlib to do the plotting. If you are going to be doing several plots, it is worth improving and automating this process.

# Set up logging for the session.
logging.basicConfig(filename='session.log', level=logging.DEBUG)

Troubleshooting

Please send bugs or any other issues you encounter to [email protected]. I will do my best to help you get up and running. You can also report an issue using GitHub's issue tracker.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].