GithubHelp home page GithubHelp logo

joengelh / binance-fibonaccibot Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 5.0 5.15 MB

Just a fun exercise to see if fibonacci retracement levels and simple correlation can predict the value of cryptocurrencies to one antoher. Have fun =)

License: The Unlicense

Dockerfile 1.20% Python 63.05% R 9.19% HTML 5.77% JavaScript 7.46% Rust 13.34%
cryptocurrency binance microservices-architecture

binance-fibonaccibot's Introduction

Introduction

This is a fun exercise to see if fibonacci retracement levels and statistical tools can predict the value of cryptocurrencies. Have fun =)

This Project was meant to explore the concept of microservices, aswell as getting to know a couple of programming languages. In this project Python, Rust, R and JavaScript are used to write Binance marketdata to a database, make trading decisions, cache performance information and present it to the user in a website or through a Telegram Bot.

Architecture

Architecture

The Trading bot comes as a microservices architecture launched via docker-compose. Docker compose can be installed using the ansible Role go to github

Preparation

After cloning the repository from GitHub using git clone https://github.com/joengelh/binance-fibonaccibot.git copy the .env.sample file to .env and fill in your information.

apiKey                     = your binance api key
apiSecret                  = your binance api secret
dbName                     = set to preferences or leave default
dbUser                     = set to preferences or leave default
dbTable                    = set to preferences or leave default
POSTGRES_PASSWORD          = set to preferences or leave default
dbHost                     = set to preferences or leave default
dbPort                     = set to preferences or leave default
liveTrading                = enable or disable live trading, while the backtesting method is not as accurate
liveVolume                 = amount of base currency used per signal
botToken                   = telegram bot token, given by the bot father
baseCurrency               = base currency to grow
brokerFees                 = binance fees depending on VIP status and BNB use

Thereafter the service can be started using docker-compose up -d --build and stopped using docker-compose down.

Components

The bot consists of the following components:

Component Function Ports Volumes
fibonacci-db postgres database 5432 /private/db:/var/lib/postgresql/data:rw
./container-db/initdb.d:/docker-entrypoint-initdb.d
fibonacci-validator profit calculator
fibonacci-webui result display 13000
fibonacci-cache redis database 6379
fibonacci-predictor calculating present trades performance
fibonacci-analyzer writing past performance stats to cache
fobonacci-telegram can use bot to give live performance overview

Testing

Currenty, only for the component container-analyzer proper unittests have been developed. These can be run after installing Rust using the following command:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

The unittests can be run using the command cargo run

⚠️ Loading dotenv vars: Unit tests will fail without them

The .env file from the parent directory can be brought into scope using:

export $(cat ../.env | xargs)

Webui

The Webui Displays Information about the Bot´s performance.

webui

  • Free Spot gives an information about how buch selected base currency is still available to open more positions.
  • Open Trades displays the amount of trades opened and not closed yet.
  • Sum Result can either show how much base currency has been earned yet in live mode or how many percent growth based on the selected volume has been gained, taking the markets spread and trading fees, aswell as market movements into account.
  • 24h Sum Result can either show how much base currency has been earned in the past 24h in live mode or how many percent growth based on the selected volume has been gained, taking the markets spread and trading fees, aswell as market movements into account.
  • Simulated Avg shows by how many percent points all open positions are in profit/loss when they would be closed immediately.
  • Simulated Sum shows how much base currency would be earned if all open positions would be closed immediately.
  • Simulated Winners counts the open positions in profit at the moment.
  • Simulated Losers counts the open positions out of profit at the moment.

Tools

for monitoring the RScripts:

  • fibLvlValidator.R grafik

  • plotValidator.R

grafik

can be used.

backup & restore

backup

sudo docker exec -i fibonacci-db /bin/bash -c "PGPASSWORD=password pg_dump --username postgres postgres" > dump.sql

The backup process can also be automated using the Ansible Role: cron-place.

restore

sudo docker-compose up -d db
sudo docker exec -i fibonacci-db /bin/bash -c "PGPASSWORD=password psql --username postgres postgres" < dump.sql
sudo docker-compose up -d

binance-fibonaccibot's People

Contributors

joengelh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.