GithubHelp home page GithubHelp logo

webclinic017 / pyautofinance Goto Github PK

View Code? Open in Web Editor NEW

This project forked from estebanthi/pyautofinance

0.0 0.0 1.0 22.36 MB

A trading bot in Python, for backtesting or live trading purposes

License: MIT License

Python 100.00%

pyautofinance's Introduction

forthebadge made-with-python

Basic Overview

Build and test trading systems. Once you found something satisfying, go live with it automatically. Be notified on Telegram about what's happening while live trading.

Visualize the results

Key features

  • Develop trading components easily :
    • Strategies : to decide whether to enter / exit a trade or not.
    • Indicators : to give information about data to your strategies.
    • Analyzers : to analyze the results of your backtests or trading sessions.
    • Sizers : to define how much quantity of assets the engine should buy depending on parameters.
    • Observers : to define what you plot on the results chart.
    • Timers : to define actions to do at a precise time, repeatedly or not.
  • Test your strategies through any testing process you wish : split train/test testing, walk forward testing, Monte-Carlo simulation, etc...
  • Optimize your strategies parameters to find the more appropriate to a market, or a ticker.
  • Visualize the results on a chart you can configure.
  • Automatic live trading with fake or real money, using any API you want.
  • Telegram configuration to get information about what is happening within your scripts.
  • Advanced features : develop your own data sources, write your data anywhere you want, etc...

How to install

# clone the repo
git clone https://github.com/estebanthi/PyAutoFinance

# go to folder
cd PyAutoFinance/pyautofinance

# install requirements
pip3 install -r requirements.txt
pip3 install git+https://github.com/Dave-Vallance/bt-ccxt-store.git

Go into backtrader package, in folder plot, open file locator.py, and remove warnings in line 35, because it is deprecated :

from matplotlib.dates import (HOURS_PER_DAY, MIN_PER_HOUR, SEC_PER_MIN,
                              MONTHS_PER_YEAR, DAYS_PER_WEEK,
                              SEC_PER_HOUR, SEC_PER_DAY,
                              num2date, rrulewrapper, YearLocator,
                              MicrosecondLocator, warnings) # Remove warnings here

Go into ccxt package, in binance.py, and add at line 2723 :

                request['stopPrice'] = self.price_to_precision(symbol, stopPrice)

        params = {}  # Add this
        response = getattr(self, method)(self.extend(request, params))

How to use

To use the package, just go in the folder pyautofinance and create your first run script, or edit the one already existing. But first, you have to create the config.yml file.

Create and configure the config file

First, create a config.yml in the pyautofinance file. Fill it like the following :

datasets_pathname: "<FOLDER WHERE YOU WANT TO SAVE YOUR DATASETS>"

# If you want to use Telegram
telegram_token: "<YOUR TELEGRAM BOT TOKEN>"
user: "<YOUR TELEGRAM USER ID>"


# If you want to use live trading
BROKER_NAME_api_key: "<YOUR BROKER'S API KEY>"
BROKER_NAME_api_secret: "<YOUR BROKER'S API SECRET>"


# Example for Binance
binance_api_key: "AZERTYUIOPazertyuiop"
binance_api_secret: "azertyuiopAZERTYUIOP"

If you don't know how to get a Telegram token, you can check it on https://sendpulse.com/knowledge-base/chatbot/create-telegram-chatbot.

Develop !

If you want to use the bot the best way, you will have to develop strategies, indicators, analyzers, ... First, you have to understand the backtrader python library, because everything operates around this. Find the documentation here : https://www.backtrader.com/docu/.

Multiple strategies

Running multiple strategies at once is not fully supported, so prefer not to do this.

To Do

  • Walk-forward tester
  • Monte-Carlo simulator
  • Performance reports
  • More plotting options

pyautofinance's People

Contributors

estebanthi avatar

Forkers

r4rpa

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.