Example of a cryptocurrency portfolio balancer with Ninjabot

Ninjabot Portfolio Balancer

Example of strategy that balances a given portfolio with weights.

Related Discussion: https://github.com/rodrigo-brito/ninjabot/discussions/65

Downloading Data

ninjabot download --pair BTCUSDT --timeframe 1d --days 365 --output ./data/btc.csv
ninjabot download --pair ETHUSDT --timeframe 1d --days 365 --output ./data/eth.csv
ninjabot download --pair DOTUSDT --timeframe 1d --days 365 --output ./data/dot.csv
ninjabot download --pair ADAUSDT --timeframe 1d --days 365 --output ./data/ada.csv

How to execute

go run main.go

Teorical Wallet

20% of BTC
20% of ETH
20% of DOT
20% of ADA
20% of USDT (free cash)

The strategy will buy or sell each week to balance the portfolio.

Backtest result

INFO[2021-11-19 22:45] [SETUP] Using paper wallet                   
INFO[2021-11-19 22:45] [SETUP] Initial Portfolio = 1000.000000 USDT 
+---------+--------+-----+------+---------+--------+---------+----------+
|  PAIR   | TRADES | WIN | LOSS |  % WIN  | PAYOFF | PROFIT  |  VOLUME  |
+---------+--------+-----+------+---------+--------+---------+----------+
| ETHUSDT |     24 |  24 |    0 | 100.0 % |  0.000 |  755.49 |  2747.22 |
| ADAUSDT |     22 |  22 |    0 | 100.0 % |  0.000 | 1293.77 |  3982.54 |
| BTCUSDT |     19 |  15 |    4 | 78.9 %  |  1.185 |  220.34 |  3471.36 |
| DOTUSDT |     24 |  19 |    5 | 79.2 %  |  8.688 |  990.18 |  4027.96 |
+---------+--------+-----+------+---------+--------+---------+----------+
|   TOTAL |     89 |  80 |    9 |  89.9 % |  2.596 | 3259.78 | 14229.09 |
+---------+--------+-----+------+---------+--------+---------+----------+

--------------
WALLET SUMMARY
--------------
619.457127 ADA = 948.361987 USDT
0.019902 BTC = 1819.799873 USDT
26.713543 DOT = 2450.025785 USDT
0.272265 ETH = 3010.440556 USDT

TRADING VOLUME
ADAUSDT        = 3982.54 USDT
BTCUSDT        = 3471.36 USDT
DOTUSDT        = 4027.96 USDT
ETHUSDT        = 2747.22 USDT

1249.341469 USDT
--------------
START PORTFOLIO = 1000.00 USDT
FINAL PORTFOLIO = 4259.78 USDT
GROSS PROFIT    =  3259.782025 USDT (325.98%)
MARKET (B&H)    =  784.12%
MAX DRAWDOWN    =  -37.48 %
VOLUME          =  14229.09 USDT
COSTS (0.001*V) =  14.23 USDT (ESTIMATION) 
--------------

image

Owner
Similar Resources

Example of querying the balance of Crypton and UUSD with Utopia Ecosystem API and utopialib-go

account-balance-go Example of querying the balance of Crypton and UUSD with Utopia Ecosystem API and utopialib-go example of use flags: -host string

Oct 8, 2021

Epaper - Driver and example program for tri-color 7.5" 880x528 waveshare eink display

epaper Driver and example program for tri-color 7.5" 880x528 waveshare eink display It's a work in progress, which lacks a lot of safeguarding (meanin

Jan 5, 2022

Golang-Devnet-Interfaces - Quick example of using Scrapligo and TextFSM to parse interfaces from Devnet Sandbox

Scrapligo & TextFSM This is a simple example of using the Scrapligo library deve

Mar 7, 2022

Content and build toolchain for Zig by Example

Content and build toolchain for Zig by Example

Content and build toolchain for Zig by Example. Building To build the site you'll need Go installed. Run: tools/build To build continuously in a loop:

Dec 5, 2022

Cat Balancer is line based load balancer for net cat nc.

Cat Balancer is line based load balancer for net cat nc.

Cat Balancer Cat Balancer is line based load balancer for net cat nc. Usage cb [-p producers-port] [-c consumers-port] One Producer to One Consum

Jul 6, 2022

Kiwi-balancer - A balancer is a gateway between the clients and the server

Task description Imagine a standard client-server relationship, only in our case

Feb 11, 2022

A rest-api that works with golang as coin portfolio

Koinfolio A rest-api that works with golang as coin portfolio Technical Details Golang/Gin is used as application framework MongoDB is database Usage

Jun 1, 2022

A golang implementation of a console-based trading bot for cryptocurrency exchanges

A golang implementation of a console-based trading bot for cryptocurrency exchanges

Golang Crypto Trading Bot A golang implementation of a console-based trading bot for cryptocurrency exchanges. Usage Download a release or directly bu

Dec 30, 2022

Trader is a framework that automated cryptocurrency exchange with strategy

Trader is a framework that automated cryptocurrency exchange with strategy

A framework that automated cryptocurrency exchange with strategy

Nov 29, 2022

The modern cryptocurrency trading bot written in Go.

bbgo A trading bot framework written in Go. The name bbgo comes from the BB8 bot in the Star Wars movie. aka Buy BitCoin Go! Current Status Features E

Jan 2, 2023

Community-run technology powering the cryptocurrency, and decentralized applications on TrustFi Network

Go TrustFi-Ethereum Official Golang implementation of the TrustFi-Ethereum protocol. Automated builds are available for stable releases and the unstab

May 26, 2021

A telegram bot that fetches multiple RSS cryptocurrency news feeds for sentiment analysis

Crypto News Telegram Bot A simple telegram bot that will help you stay updated on your latest crypto news This bot will help you keep track of the lat

Aug 22, 2021

SwissWallet is a deterministic cryptocurrency wallet generator heavily based on MindWallet and MemWallet

SwissWallet SwissWallet is a deterministic cryptocurrency wallet generator heavily based on MindWallet and MemWallet but using argon2 and scrypt by de

Jul 28, 2022

A fast cryptocurrency trading bot implemented in Go

A fast cryptocurrency trading bot implemented in Go

A fast cryptocurrency bot framework implemented in Go. Ninjabot permits users to create and test custom strategies for spot markets. ⚠️ Caution: Worki

Jan 1, 2023

CryptoPump is a cryptocurrency trading bot that focuses on high speed and flexibility

CryptoPump is a cryptocurrency trading bot that focuses on high speed and flexibility

CryptoPump is a cryptocurrency trading bot that focuses on high speed and flexibility. The algorithms utilize Go Language and WebSockets to react in real-time to market movements based on Bollinger statistical analysis and pre-defined profit margins.

Nov 24, 2022

Cryptocurrency implemented using the Go programming language

Nomadcoin Making a Cryptocurrency using the Go programming language. Features Mining Transactions Database Backend Wallets REST API HTML Explorer P2P

Dec 7, 2022

Arbitrum is a Layer 2 cryptocurrency platform that makes smart contracts scalable, fast, and private.

Arbitrum is a Layer 2 cryptocurrency platform that makes smart contracts scalable, fast, and private.

Arbitrum is a Layer 2 cryptocurrency platform that makes smart contracts scalable, fast, and private. Arbitrum interoperates closely with Ethereum, so Ethereum developers can easily cross-compile their contracts to run on Arbitrum. Arbitrum achieves these goals through a unique combination of incentives, network protocol design, and virtual machine architecture.

Jan 8, 2023

A Golang cryptocurrency trading API & Library. Support Binance, BitMEX, Deribit, Bybit, Huobi DM, OKEX Futures and more.

A Golang cryptocurrency trading API & Library. Support Binance, BitMEX, Deribit, Bybit, Huobi DM, OKEX Futures and more.

CREX 中文 | English CREX 是一个用Golang语言开发的量化交易库。支持tick级别数字币期货平台的回测和实盘。实盘与回测无缝切换,无需更改代码。 回测 示例 @backtest 交易结果 开源策略 https://github.com/coinrust/trading-stra

Nov 18, 2022

A decentralized, cryptocurrency platform that can change this world!

Go Detonus Official Golang implementation of the Detonus protocol. Building the source For prerequisites and detailed build instructions please read t

Oct 19, 2021
Community-run technology powering the cryptocurrency, and decentralized applications on TrustFi Network

Go TrustFi-Ethereum Official Golang implementation of the TrustFi-Ethereum protocol. Automated builds are available for stable releases and the unstab

May 26, 2021
SwissWallet is a deterministic cryptocurrency wallet generator heavily based on MindWallet and MemWallet

SwissWallet SwissWallet is a deterministic cryptocurrency wallet generator heavily based on MindWallet and MemWallet but using argon2 and scrypt by de

Jul 28, 2022
Arbitrum is a Layer 2 cryptocurrency platform that makes smart contracts scalable, fast, and private.
Arbitrum is a Layer 2 cryptocurrency platform that makes smart contracts scalable, fast, and private.

Arbitrum is a Layer 2 cryptocurrency platform that makes smart contracts scalable, fast, and private. Arbitrum interoperates closely with Ethereum, so Ethereum developers can easily cross-compile their contracts to run on Arbitrum. Arbitrum achieves these goals through a unique combination of incentives, network protocol design, and virtual machine architecture.

Jan 8, 2023
A Golang cryptocurrency trading API & Library. Support Binance, BitMEX, Deribit, Bybit, Huobi DM, OKEX Futures and more.
A Golang cryptocurrency trading API & Library. Support Binance, BitMEX, Deribit, Bybit, Huobi DM, OKEX Futures and more.

CREX 中文 | English CREX 是一个用Golang语言开发的量化交易库。支持tick级别数字币期货平台的回测和实盘。实盘与回测无缝切换,无需更改代码。 回测 示例 @backtest 交易结果 开源策略 https://github.com/coinrust/trading-stra

Nov 18, 2022
A decentralized, cryptocurrency platform that can change this world!

Go Detonus Official Golang implementation of the Detonus protocol. Building the source For prerequisites and detailed build instructions please read t

Oct 19, 2021
🍕 PizzaCoin - cryptocurrency for buying and selling pizza or another stuff
🍕 PizzaCoin - cryptocurrency for buying and selling pizza or another stuff

?? PizzaCoin Cryptocurrency for buying and selling pizza or another stuff Installation Compilation Windows go build -o pizzacoin.exe ./cmd/PizzaCoin/m

Nov 21, 2021
A cryptocurrency implementation in less than 1500 lines of code
A cryptocurrency implementation in less than 1500 lines of code

Naivecoin - a cryptocurrency implementation in less than 1500 lines of code Motivation Cryptocurrencies and smart-contracts on top of a blockchain are

Dec 11, 2022
Monero: the secure, private, untraceable cryptocurrency
Monero: the secure, private, untraceable cryptocurrency

Monero Copyright (c) 2014-2021 The Monero Project. Portions Copyright (c) 2012-2013 The Cryptonote developers. Table of Contents Development resources

Jan 2, 2023
This project was builded to improve my knowledge about blockchain and cryptocurrency

Blockchain Hello World in GoLang This project was builded to improve my knowledge about blockchain and cryptocurrency. To build this project, I've fol

Feb 20, 2022
Quoter - Get real-time Cryptocurrency quotes via CoinMarketCap

quoter Get real-time Cryptocurrency quotes via CoinMarketCap. Get it go get -u g

May 12, 2022