Coder Social home page Coder Social logo

aimining / crypto-trading-bot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from haehnchen/crypto-trading-bot

0.0 2.0 1.0 932 KB

Cryptocurrency trading bot in javascript for Bitfinex, Bitmex, ... (public edition)

License: MIT License

JavaScript 92.43% HTML 7.28% CSS 0.29%

crypto-trading-bot's Introduction

Crypto Trading Bot

Build Status

A work in progress Cryptocurrency for common exchanges like Bitfinex, Bitmex and Binance. As most trading bots just provide basic buy and sell signals they provide many stuff to get profitable eg exchange orders like stop-losses or stop-limits are not supported by main bots. Also the limitation of fixed timeframe and technical indicators must be broken

Not production ready only basic functionality

Features

  • Fully use Websocket for exchange communication to react as fast as possible on market
  • Multi pair support in one instance
  • sqlite3 storage for candles, tickers, ...
  • Webserver UI
  • Support for going "Short" and "Long"
  • Signal browser dashboard for pairs
  • Slack and email notification
  • Join foreign exchange candles (eg. Trade on Bitmex with the faster moving Binace trades / candles)
  • TODO: Show possible arbitrage trades

Exchanges

TODOS:

Technical stuff and packages

How to use

Install packages

npm install

Create instance file for pairs and changes

cp instance.js.dist instance.js

Provide a configuration with your exchange credentials

cp conf.json.dist conf.json

Create a new sqlite data base

# use bot.sql scheme to create the tables
sqlite3 bot.db < bot.sql

Lets start it

node index.js trade

Webserver

Some browser links

Security / Authentication

As the webserver provides just basic auth for access you should combine some with eh a https for public server. Here s simple proxy_pass for nginx.

# /etc/nginx/sites-available/YOURHOST
server {
    server_name YOURHOST;

    location / {
        proxy_pass http://127.0.0.1:8080;
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/YOURHOST/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/YOURHOST/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

You should also set the listen ip to a local one

# config.json
webserver.ip: 127.0.0.1

Webserver UI

Backtesting

Currently there is a the UI for backtesting

Result Page

Webserver UI

Fill data

node index.js backfill -e bitmex -p 1m -s XRPZ18

Strategies

For custom strategies use var/strategies folder.

Find some example strategies inside modules/strategy/strategies

Tools / Watchdog

  • order_adjust Keep open orders in bid / ask of the orderbook in first position

Watchdog

  • stoploss provide general stoploss order in percent of entry price (Exchange Order)
  • risk_reward_ratio Creates Risk Reward order for take profit and stoploss (Exchange Order Limit+Stop)
  • stoploss_watch Close open position if ticker price falls below the percent lose; use this for exchange that dont support stop_loss order liek Binance
    'watchdogs': [
        {
            'name': 'stoploss',
            'percent': 3,
        },
        {
            'name': 'risk_reward_ratio',
            'target_percent': 6,
            'stop_percent': 3,
        },
        {
            'name': 'stoploss_watch',
            'stop': 1.2,
        }        
    ],

Signals

Slack

Webserver UI

Tests

npm test

Related Links

Trading Bots Inspiration

Other bots with possible design pattern

Strategies

Some strategies based on technical indicators for collection some ideas

crypto-trading-bot's People

Contributors

haehnchen avatar minhphuc429 avatar

Watchers

James Cloos avatar Jollen avatar

Forkers

emperorjesus

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.