Skip to content

Quantitative Trading Strategy Backtesting Environment

License

Notifications You must be signed in to change notification settings

simonpotel/QTSBE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QTSBE - Quantitative Trading Strategy Backtesting Environment

QTSBE is an open-source platform for backtesting quantitative trading strategies. It features a Python-based API built with Flask, offering multiple endpoints to facilitate seamless integration into existing projects.

Key Features

  • Comprehensive backtesting environment powered by NumPy and Pandas
  • Flask-based API with caching system for optimized performance
  • Interactive strategy visualization using Plotly
  • Data integration with Yahoo Finance and Binance APIs
  • Scanner tool for applying strategies across multiple cryptocurrencies and stocks
  • Rich API endpoints for quick backtesting analysis and integration

Getting Started

Installation

  1. Clone the repository:

    git clone https://github.com/simonpotel/QTSBE
  2. Install dependencies:

    cd QTSBE
    pip install -r requirements.txt

Usage Guide

  1. Implement Your Strategy

    • Use the template in api/strategies/default.py or refer to api/strategies/rsi_example
    • Create a new Python file with an analyse function that returns the required data
    • Implement indicators directly in your code without including them in the JSON response
  2. Launch the API

    python api/api.py
  3. Available API Endpoints

    • Get available tokens: http://127.0.0.1:5000/QTSBE/get_tokens
    • List strategies: http://127.0.0.1:5000/QTSBE/get_strategies
    • Run analysis: http://127.0.0.1:5000/QTSBE/analyse
    • Custom analysis: http://127.0.0.1:5000/QTSBE/analyse_custom (POST method)

    Note: Replace 127.0.0.1:5000 with your server's IP or domain name as needed.

  4. Visualization Options

    • Generate Plotly charts:

      sh tests/integrations/plotly_unit.sh
    • Use the Discord bot:

      1. Configure settings in integrations/discord_chat_bot/bot.py
      2. Launch the bot:
        sh sh/discord_chat_bot.sh
    • Create custom interfaces (e.g., web interface) similar to the Smartswap project

  5. Data Collection

    • Configure tools/auto_fetch/config.json following instructions in tools/auto_fetch/README.md
    • Run the auto-fetch tool:
      sh sh/auto_fetch.sh

Builtin Visualization Plotly

Example Chart 1 Example Chart 2

Projects Samples (here is what you can create using QTSBE)

  • Automated trading bot that uses your strategy for live trading
  • Dashboard to visualize your strategies with live data
  • Alert system that notifies you of trading opportunities
  • Scanner to find the best trading pairs for your strategy
  • Tool to test and compare different trading strategies

License

This project is distributed under the MIT License. See the LICENSE file for details.

Important Disclaimer

Caution

Please review all code thoroughly before implementation. Documentation and code purposes may not be current. The developers are not liable for any financial losses, calculation errors, or related issues that may occur from using this software.


For questions or support, connect with me on LinkedIn.