Code Monkey home page Code Monkey logo

backtester's Introduction

backtester

An event-driven backtester

About

This backtesting suite is based on a guide written by Quantstart's Michael Halls-Moore on how to write an event-driven backtester. Improvements to the code in the guide made by Douglas Denhartog has also been incorporated. The code has then been modified by me to actually run and include more features.

Guide:

  1. Event-Driven Backtesting with Python - Part I
  2. Event-Driven Backtesting with Python - Part II
  3. Event-Driven Backtesting with Python - Part III
  4. Event-Driven Backtesting with Python - Part IV
  5. Event-Driven Backtesting with Python - Part V
  6. Event-Driven Backtesting with Python - Part VI
  7. Event-Driven Backtesting with Python - Part VII
  8. Event-Driven Backtesting with Python - Part VIII

How To

Define Strategy

You can define a strategy by implementing the Strategy class found in strategy.py. There also exists three predefined strategies in strategy.py.

Backtest a Strategy

In order to choose strategy to backtest, you have to change the strategy class used in loop.py. You can also specify which CSV files/symbols that should be used in the backtesting suite by changing the CSV directory path and symbols in the same python file.
Note: The specified CSV files must have the same format as CSV files downloaded from Yahoo Finance. If the CSV files have another format, they need to be converted to Yahoo's format.
Special Case: If the specified CSV files were downloaded from Nasdaq, you can change the parser in data.py to the Nasdaq CSV parser.

To run the backtesting suite, use python3 loop.py from the terminal.

Dependencies

  • pandas
  • numpy
  • matplotlib

backtester's People

Contributors

tobiasbrodd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

backtester's Issues

hi tobias

thanks for the effort , after having a closer look in to the overall framework , I can't see where does it adapt to different types of orders , I see you have used type : market in all over the examples that you provided within the module , is it possible to define OTHER TYPES LIKE LIMITS AND MARKET PEGGED type of orders ?
secondly , would you provide an example where you trade two legs / two instruments say on the same trade , say short SPY while long calls at the same time by an amount calculated according to other trading rules like delta , gamma ...etc ?

looking forward to your response
ashraf

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.