Giter VIP home page Giter VIP logo

btanalyzer's Introduction

PipsArtist - Backtrader Analyzers

This repository is a set of analyzer for backtrader that helps review a strategy. These analyzers have been made for Forex strategies is mind but may be used for other instruments.

This repository is under heay development and is not production ready

Analyzer available

ForexTrades

This is a simple Analyzer that keeps track of all trades closed. It can be used for live or backtesting. It allows to keep track of:

  • Trade closed position (Buy or Sell)
  • Profit in absolute value and pips
  • Open and Close datetime
  • Open and Close price
  • Maximum drawback in pips
  • Maximum profit in pips

ForexStats

This Analyzer is using the output of ForexTrades Analyzer to give details about the strategy including: It returns several analysis for a strategy in 4 different areas:

  1. Overal strategy (For full period of trading or backtesting)
    • Gross Profit
    • Gross Profit (pips)
    • Gross Loss
    • Gross Loss (pips)
    • Net Profit
    • Net Profit (pips)
    • Profit Factor
    • Expected Payoff
  2. Total
    • Total Number of Trades
    • Total Won
    • Percentage of won
    • Total Loss
    • Percentage of loss
    • Average Trade profit in absolute value
    • Average Trade profit in pips
    • Max Profit in absolute value
    • Max Profit in pips
    • Average Loss in absolute value
    • Average Loss in pips
    • Max Loss in absolute value
    • Max Loss in pips
  3. Short Trades
    • Same as for Total but only for short trades
  4. Long Trades
    • Same as for Total but only for long trades
  5. Streak - Win and Loss Streak with the following for each:
    • Max number of trades in a streak
    • Average number of trades in a streak
    • Max Profit/Loss in absolute value
    • Max Profit/Loss in pips
    • Average Profit/Loss in absolute value
    • Average Profit/Loss in pips

Known Limitation

These analyzers have only been tested with Currencies and with a 4/5 digits currencies. It does not support 2/3 digits currencies such as USD/JPY

Requirements

  • python 3.6+
  • Backtrader
  • Pandas
  • pipenv

Installation

  1. Clone this repository git clone [email protected]:edesmars/btAnalyzer.git
  2. Go into the newly created directory: cd btAnalyzer
  3. Install dependencies. Pipenv is recommended: pipenv --python 3.6 && pipenv install or use pip install
  4. In your backtrader script, add a new path to be able to import these Analyzers
import sys
sys.path.append('/path/to/clone')

import bt_analyzers
  1. Add the analyzers into your cerebro instance
cerebro.addanalyzer(bt_analyzer.stats.ForexStats)

btanalyzer's People

Contributors

edesmars avatar

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.