• Stars
    star
    1,327
  • Rank 35,420 (Top 0.7 %)
  • Language
    Go
  • License
    MIT License
  • Created over 3 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A fast trading bot platform for cryptocurrency in Go (Binance)

Ninjabot

tests codecov Go Reference Discord Discord

A fast cryptocurrency trading bot framework implemented in Go. Ninjabot permits users to create and test custom strategies for sport and future markets.

Docs: https://rodrigo-brito.github.io/ninjabot/

DISCLAIMER
This software is for educational purposes only. Do not risk money which you are afraid to lose. USE THE SOFTWARE AT YOUR OWN RISK. THE AUTHORS AND ALL AFFILIATES ASSUME NO RESPONSIBILITY FOR YOUR TRADING RESULTS

Installation

go get -u github.com/rodrigo-brito/ninjabot/...

Examples of Usage

Check examples directory:

  • Paper Wallet (Live Simulation)
  • Backtesting (Simulation with historical data)
  • Real Account (Binance)

CLI

To download historical data you can download ninjabot CLI from:

  • Pre-build binaries in release page
  • Or with go install github.com/rodrigo-brito/ninjabot/cmd/ninjabot@latest

Example of usage

# Download candles of BTCUSDT to btc.csv file (Last 30 days, timeframe 1D)
ninjabot download --pair BTCUSDT --timeframe 1d --days 30 --output ./btc.csv

Backtesting Example

  • Backtesting a custom strategy from examples directory:
go run examples/backtesting/main.go

Output:

INFO[2023-03-25 13:54] [SETUP] Using paper wallet                   
INFO[2023-03-25 13:54] [SETUP] Initial Portfolio = 10000.000000 USDT 
---------+--------+-----+------+--------+--------+-----+----------+-----------+
|  PAIR   | TRADES | WIN | LOSS | % WIN  | PAYOFF | SQN |  PROFIT  |  VOLUME   |
+---------+--------+-----+------+--------+--------+-----+----------+-----------+
| ETHUSDT |      9 |   6 |    3 | 66.7 % |  3.407 | 1.3 | 21748.41 | 407769.64 |
| BTCUSDT |     14 |   6 |    8 | 42.9 % |  5.929 | 1.5 | 13511.66 | 448030.05 |
+---------+--------+-----+------+--------+--------+-----+----------+-----------+
|   TOTAL |     23 |  12 |   11 | 52.2 % |  4.942 | 1.4 | 35260.07 | 855799.68 |
+---------+--------+-----+------+--------+--------+-----+----------+-----------+

-- FINAL WALLET --
0.0000 BTC = 0.0000 USDT
0.0000 ETH = 0.0000 USDT
45260.0735 USDT

----- RETURNS -----
START PORTFOLIO     = 10000.00 USDT
FINAL PORTFOLIO     = 45260.07 USDT
GROSS PROFIT        =  35260.073493 USDT (352.60%)
MARKET CHANGE (B&H) =  407.09%

------ RISK -------
MAX DRAWDOWN = -11.76 %

------ VOLUME -----
BTCUSDT         = 448030.05 USDT
ETHUSDT         = 407769.64 USDT
TOTAL           = 855799.68 USDT
-------------------
Chart available at http://localhost:8080

Plot result

Features

Binance Spot Binance Futures
Order Market ๐Ÿ†— ๐Ÿ†—
Order Market Quote ๐Ÿ†—
Order Limit ๐Ÿ†— ๐Ÿ†—
Order Stop ๐Ÿ†— ๐Ÿ†—
Order OCO ๐Ÿ†—
Backtesting ๐Ÿ†— ๐Ÿ†—
  • Backtesting

    • Paper Wallet (Live Trading with fake wallet)
    • Load Feed from CSV
    • Order Limit, Market, Stop Limit, OCO
  • Bot Utilities

    • CLI to download historical data
    • Plot (Candles + Sell / Buy orders, Indicators)
    • Telegram Controller (Status, Buy, Sell, and Notification)
    • Heikin Ashi candle type support
    • Trailing stop tool
    • In app order scheduler

Roadmap

  • Include Web UI Controller
  • Include more chart indicators - Details

Exchanges

Currently, we only support Binance exchange. If you want to include support for other exchanges, you need to implement a new struct that implements the interface Exchange. You can check some examples in exchange directory.

Support the project

Address
BTC bc1qpk6yqju6rkz33ntzj8kuepmynmztzydmec2zm4
ETH 0x2226FFe4aBD2Afa84bf7222C2b17BBC65F64555A
LTC ltc1qj2n9r4yfsm5dnsmmtzhgj8qcj8fjpcvgkd9v3j

Patreon: https://www.patreon.com/ninjabot_github

More Repositories

1

gocity

๐Ÿ“Š Code City metaphor for visualizing Go source code in 3D
Go
1,770
star
2

backtrader-binance-bot

๐Ÿ’ธ A example of bot using Backtrader to trade Bitcoins in Binance Exchange.
Python
259
star
3

refactoring-aware-diff

RAID is a tool pipeline that seamlessly enriches GitHub diff results with refactoring information.
JavaScript
79
star
4

json-to-go-map

๐ŸŽฏ Online tool that convert JSON to Go (Golang) map.
JavaScript
58
star
5

facility-location-gurobi

Exact approach to solve the facility location problem with Gurobi.
Python
33
star
6

fire-todo

๐Ÿ“ฑ Android App - simple todo-list
Java
19
star
7

go-whatsapp

Simple chat with Go, GraphQL (GQLGen) and React.
TypeScript
19
star
8

memory-cache

A zero-dependency cache library for storing data in memory with generics.
Go
12
star
9

rb-external-thumbnail

๐Ÿ”Œ WordPress Plugin - Enable external images for post thumbnail
PHP
11
star
10

WebRTC-Playground

Simple example of WebRTC usage: P2P and a SFU server with video recordering
Go
11
star
11

ninjabot-portfolio-balancer

Example of a cryptocurrency portfolio balancer with Ninjabot
Go
9
star
12

tradingview-strategies

Trade strategies for Tradingview in Pine
7
star
13

morfeu-theme

๐ŸŽ‘ WordPress Theme - A clean blog theme
CSS
7
star
14

grafana-investments

A simple dashboard to control finances and investments
6
star
15

dotfiles

๐Ÿ”ง My personal settings - Linux / Mac
Vim Script
5
star
16

domains-diff

Ferramenta simples para checar novos domรญnios em leilรฃo no registro.br
Python
5
star
17

Matrix-Distance-Google-Maps-UI

Interface for Matrix Distance with Google Maps Search
JavaScript
4
star
18

refdiff-go

Java
4
star
19

facility-location

Facility location problem solved in Go
Go
4
star
20

cripto-crawler

Historical values from cripto market
Python
4
star
21

thumbnail

A simple CLI for thumbnails creation
Go
4
star
22

google-oauth-example

Example of OAuth for Google APIs in Go (Token / Refresh Token)
Go
3
star
23

natron-docker

Docker image for Natron render
Dockerfile
3
star
24

youtube-music-search

Search songs in Youtube Music without an API Key. Chrome Headless.
JavaScript
3
star
25

bala-coin

Bala coin
Solidity
3
star
26

Pongnator

A simple game developed with Matter JS - PONG
JavaScript
3
star
27

VND-VNS-Hub-and-Spoke

Heuristic method for resolution of the hub-and-spoke network design
C++
3
star
28

yt-music-search

Go
2
star
29

concorde-tsp

TSP Solver in C++ with Concorde Library
C++
2
star
30

onibus-api

๐ŸšŒ Generic Spring Boot API for Bus Schedules
Java
2
star
31

uptimerobot-bitbar

Bitbar / Argos plugin for UptimeRobot monitors
Python
2
star
32

co-change-analysis

๐Ÿ”ง Extract and analysis co-changes functions in Go projects
C
2
star
33

ifmg-eventos

Tema Wordpress desenvolvido para divulgaรงรฃo de eventos no IFMG - Campus Sabarรก
PHP
2
star
34

arduino-marmitocoptero

๐Ÿš A quadcopter developed with Arduino and built inside a lunch box
Arduino
2
star
35

rodrigo-brito

2
star
36

rinha-de-backend-2023-q3

Go
1
star
37

Tabuleiro-Xadrez

JavaScript
1
star
38

elasticsearch-playground

My personal playground for Elasticsearch in Go
Go
1
star
39

go-async-benchmark

๐Ÿš€ Benchmark of controlled async calls with Goroutines
Go
1
star
40

ion-sfu-avp-example

simple example of SFU server with video recordering
Go
1
star
41

issues-crawler

Crawler for Github issues
Go
1
star
42

8-Poll-Chrome-Extension

A simple aim tool for 8 Poll Game in Chrome Browser
JavaScript
1
star
43

advent-of-code-2021

https://adventofcode.com/2021/
Rust
1
star
44

talks

Go
1
star
45

tensorflow-playground

:squirrel: My personal playground for machine learning tests with Tensorflow
Jupyter Notebook
1
star
46

hurst

Hurst exponent estimation in Go
Go
1
star
47

graphql-playground

My personal tests with GraphQL, React, Typescritpt and Relay
TypeScript
1
star
48

apollo-playground

My personal playground for Apollo / GraphQL tests
TypeScript
1
star
49

ml-bitcoin-prediction

Predicting bitcoin value with machine learning
Jupyter Notebook
1
star
50

docker-tutorial

Repository for tutorial published at https://rodrigobrito.net/
CSS
1
star
51

nginx-playground

Nginx Playground - Simple examples of configs and personal tests
HTML
1
star
52

refdiff-github-action

Dockerfile
1
star
53

humilde-css

A clean and simple CSS base for small projects
SCSS
1
star
54

go-refactoring-example

Toy example for refactoring extraction in Go (RefDiff Plugin)
Go
1
star
55

flutter-pkg

Testando sistema de pacotes do Flutter
Dart
1
star
56

refactoring-diff-example

Toy example for RefDiff Plugin test.
Java
1
star