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

Listed on Awesome Go Develop Branch Build Status Godoc reference Last Release License Goreportcard

Golang Crypto Trading Bot

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

Usage

Download a release or directly build the code from this repository.

go get github.com/saniales/golang-crypto-trading-bot

If you need to, you can create a strategy and bind it to the bot:

import bot "github.com/saniales/golang-crypto-trading-bot/cmd"

func main() {
    bot.AddCustomStrategy(examples.MyStrategy)
    bot.Execute()
}

For strategy reference see the Godoc documentation.

Simulation Mode

If enabled, the bot will do paper trading, as it will execute fake orders in a sandbox environment.

A Fake balance for each coin must be specified for each exchange if simulation mode is enabled.

Supported Exchanges

Exchange Name REST Supported Websocket Support
Bittrex Yes No
Poloniex Yes Yes
Kraken Yes (no withdraw) No
Bitfinex Yes Yes
Binance Yes Yes
Kucoin Yes No
HitBtc Yes Yes

Configuration file template

Create a configuration file from this example or run the init command of the compiled executable.

simulation_mode: true # if you want to enable simulation mode.
exchange_configs:
  - exchange: bitfinex
    public_key: bitfinex_public_key
    secret_key: bitfinex_secret_key
    deposit_addresses:
      BTC: bitfinex_deposit_address_btc
      ETH: bitfinex_deposit_address_eth
      ZEC: bitfinex_deposit_address_zec
    fake_balances: # used only if simulation mode is enabled, can be omitted if not enabled.
      BTC: 100
      ETH: 100
      ZEC: 100
      ETC: 100
  - exchange: hitbtc
    public_key: hitbtc_public_key
    secret_key: hitbtc_secret_key
    deposit_addresses:
      BTC : hitbtc_deposit_address_btc
      ETH: hitbtc_deposit_address_eth
      ZEC: hitbtc_deposit_address_zec
    fake_balances:
      BTC: 100
      ETH: 100
      ZEC: 100
      ETC: 100
strategies:
  - strategy: strategy_name
    markets:
      - market: ETH-BTC
        bindings:
        - exchange: bitfinex
          market_name: ETHBTC
        - exchange: hitbtc
          market_name: ETHBTC
      - market: ZEC-BTC
        bindings:
        - exchange: bitfinex
          market_name: ZECBTC
        - exchange: hitbtc
          market_name: ZECBTC
      - market: ETC-BTC
        bindings:
        - exchange: bitfinex
          market_name: ETCBTC
        - exchange: hitbtc
          market_name: ETCBTC

Donate

Feel free to donate:

METHOD ADDRESS
Paypal https://paypal.me/AlessandroSanino
BTC 1DVgmv6jkUiGrnuEv1swdGRyhQsZjX9MT3
XVG DFstPiWFXjX8UCyUCxfeVpk6JkgaLBSNvS
ETH 0x2fe7bd8a41e91e9284aada0055dbb15ecececf02
USDT 18obCEVmbT6MHXDcPoFwnUuCmkttLbK5Xo
Owner
Alessandro Sanino
CTO at The Tryvium Company | Syscoin Community Developer | Blockchain Researcher | Blockchain Developer and Architect
Alessandro Sanino
Comments
  • new way to start with a new strategy

    new way to start with a new strategy

    I found a bit complicated to copy and paste every strategy into main.go and I think this is a simpler solution when the moment of switching strategies comes.

    I basically moved the examples of every type of strategy to a new package examples and, instead having to copy and paste the available strategies into main.go

    var myStrategy = WebsocketStrategy{...} // old way
    bot.AddCustomStrategy(myStrategy)
    

    we define now the strategies in the examples package as functions

    func MyStrategy() strategies.Strategy {...}
    

    and the ones we need to have available are added in main.go

    bot.AddCustomStrategy(examples.MyStrategy()) // new way
    
  • Cannot add tactic: Strategy Watch5Sec does not exist

    Cannot add tactic: Strategy Watch5Sec does not exist

    Hello,

    I am using the .bot_config.yaml.example for my configuration. I have renamed the -strategy field in this yaml to Watch5Sec and I am receiving the error:

    Cannot add tactic: Strategy Watch5Sec does not exist Do I need to do anything in the main.go file of my project in order for this Strategy to be seen?

  • What is the default strategy name?

    What is the default strategy name?

    Hi, I'm trying to up and run this bot in simulation mode, But I don't know what to enter as strategy_name. Is there any default strategy? or I should implement one for my own?

    thanks

  • wrapper.api.NewBookTickerService undefined and wrapper.api.NewPriceChangeStatsService undefined

    wrapper.api.NewBookTickerService undefined and wrapper.api.NewPriceChangeStatsService undefined

    Hello!

    I can't compile app.

    golang/src/github.com/saniales/golang-crypto-trading-bot/exchanges/binance.go:191:35: wrapper.api.NewBookTickerService undefined (type *binance.Client has no field or method NewBookTickerService) golang/src/github.com/saniales/golang-crypto-trading-bot/exchanges/binance.go:209:37: wrapper.api.NewPriceChangeStatsService undefined (type *binance.Client has no field or method NewPriceChangeStatsService)

    Can you fix it?

  • Test Strategy

    Test Strategy

    Hi,

    I would like to know if there Watch5Sec strategy should work for default? I had been trying to configure it in my config for testing and it is not working, the bot says the strategy does not exist. Do I need to add my own in the code?

    thanks in advance

  • New way to use a strategy

    New way to use a strategy

    I found a bit complicated to copy and paste the example into main.go and I think with this is a simpler solution to switch strategies.

    Congrats, you are doing a really good job!

  • `AddCustomStrategy` function is undefined

    `AddCustomStrategy` function is undefined

    The example in Readme.me file does not work.

    package main
    
    import bot "github.com/saniales/golang-crypto-trading-bot/cmd"
    
    func main() {
    	bot.AddCustomStrategy(examples.MyStrategy)
    	bot.Execute()
    }
    

    AddCustomStrategy function is undefined.

    ./main.go:6:6: undefined: bot.AddCustomStrategy
    
  • Can't get project thebotguys/signalr Repository not found.

    Can't get project thebotguys/signalr Repository not found.

    thebotguys/signalr Repository not found.

    command line:

    go get -u github.com/saniales/golang-crypto-trading-bot
    
    # cd .; git clone -- https://github.com/thebotguys/signalr C:\projects\src\github.com\thebotguys\signalr
    Cloning into 'C:\projects\src\github.com\thebotguys\signalr'...     
    remote: Repository not found.
    fatal: repository 'https://github.com/thebotguys/signalr/' not found
    package github.com/thebotguys/signalr: exit status 128
    
  • go mod tidy

    go mod tidy

    Hi, I just run "go mod tidy" to fix the dependency problem, maybe it may fix https://github.com/saniales/golang-crypto-trading-bot/issues/103

  • Invitation on developing golang based trading bot

    Invitation on developing golang based trading bot

    Hello @saniales , I've accidentally found this repo and seems you've already implemented several exchanges' connectivity that the other projects don't have.

    As a golang developer, I would like to invite you to help with another crypto trading bot also written in golang:
    https://github.com/c9s/bbgo

    Also any pr been accepted will get project tokens in polygon chain (not much at this moment, also the pool in dex is still small).

    Best regards,

  • cannot find module providing package github.com/adshao/go-binance

    cannot find module providing package github.com/adshao/go-binance

    When running go get github.com/saniales/golang-crypto-trading-bot the following is outputted to stdout/err:

    github.com/saniales/golang-crypto-trading-bot imports
            github.com/saniales/golang-crypto-trading-bot/cmd imports
            github.com/saniales/golang-crypto-trading-bot/exchanges imports
            github.com/adshao/go-binance: cannot find module providing package github.com/adshao/go-binance
    

    Not sure but looks like a dependency broke

  • Binance empty interval

    Binance empty interval

    I have configured a yaml file like the following:

    simulation_mode: true
    exchange_configs:
    - exchange: binance
      public_key: aaa
      secret_key: bbb
      deposit_addresses: {}
      fake_balances:
        USDT: 35
    strategies:
    - strategy: prueba
      markets:
      - market: BTC-USDT
        bindings:
        - exchange: binance
          market_name: BTCUSDT
    

    I get an API error ([] <APIError> code=-1105, msg=Parameter 'interval' was empty.) when I try to get the candles ( wrappers[0].GetCandles(markets[0])).

    The problem is in binance.go file, line 236: binanceCandles, err := wrapper.api.NewKlinesService().Symbol(MarketNameFor(market, wrapper)).Do(context.Background())

    NewKlinesService create a new Klines service without Interval field, only with the client (c):

    type KlinesService struct {
    	c         *Client
    	symbol    string
    	interval  string
    	limit     *int
    	startTime *int64
    	endTime   *int64
    }
    
    func (c *Client) NewKlinesService() *KlinesService {
    	return &KlinesService{c: c}
    }
    

    Then (as you can see above), it calls a Symbol method to set the symbol, but it never calls to Interval method to set it.

  • Support Basic order triggers (CLOSED, PARTIALLY FILLED, ETC...)

    Support Basic order triggers (CLOSED, PARTIALLY FILLED, ETC...)

    this would be supported only on websocket mode, since polling would bring 429 error almost immediatly (assuming cap = 60 req/min, which is what most exchanges have as rate limit)

Kelp is a free and open-source trading bot for the Stellar DEX and 100+ centralized exchanges
Kelp is a free and open-source trading bot for the Stellar DEX and 100+ centralized exchanges

Kelp Kelp is a free and open-source trading bot for the Stellar universal marketplace and for centralized exchanges such as Binance, Kraken, CoinbaseP

Jan 6, 2023
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
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
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
BlueBot is an open-source trading bot that can be customized to handle specific investment strategies.

BlueBot Quick Note BlueBot and all mentioned services are free to use, including supported financial APIs. Overview BlueBot is a self-healing trading

Sep 7, 2022
Crypto signal trading bot

Crypto-signal-trading-bot Firstly a warning This project has the ability to spen

Dec 15, 2022
Compares the BTC and ETH buy and sell prices between two exchanges.

CryptoComparer Repo for the crypto comparer, where I compare prices between two exchanges(Blockchain and Binance), and tell you which is the best plac

Oct 28, 2021
Bot-template - A simple bot template for creating a bot which includes a config, postgresql database

bot-template This is a simple bot template for creating a bot which includes a c

Sep 9, 2022
A bot based on Telegram Bot API written in Golang allows users to download public Instagram photos, videos, and albums without receiving the user's credentials.

InstagramRobot InstagramRobot is a bot based on Telegram Bot API written in Golang that allows users to download public Instagram photos, videos, and

Dec 16, 2021
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
Automated Trader (at). Framework for building trading bots.
Automated Trader (at). Framework for building trading bots.

Automated Trader (at) Purpose: Framework for building automated trading strategies in three steps: Build your own strategy. Verify it with the backtes

Dec 14, 2022
Tripwire is trading platform interface

Tripwire A Golang SDK for binance API. All the REST APIs listed in binance API document are implemented, as well as the websocket APIs. For best compa

Nov 28, 2021
A trading robot, that can submit basic orders in an automated fashion.
A trading robot, that can submit basic orders in an automated fashion.

Source: https://github.com/harunnryd/btrade Issues: https://github.com/harunnryd/btrade/issues Twitter: @harunnryd LinkedIn: @harunnryd btrade is a ro

Jan 26, 2022
Discord-bot - A Discord bot with golang

JS discord bots Install Clone repo git clone https://github.com/fu-js/discord-bo

Aug 2, 2022
Feline-bot - Feline Bot for Discord using Golang

Feline Bot for Discord Development This bot is implemented using Golang. Feature

Feb 10, 2022
Dlercloud-telegram-bot - A Telegram bot for managing your Dler Cloud account

Dler Cloud Telegram Bot A Telegram bot for managing your Dler Cloud account. Usa

Dec 30, 2021
Quote-bot - Un bot utilisant l'API Twitter pour tweeter une citation par jour sur la programmation et les mathématiques.

Description Ceci est un simple bot programmé en Golang qui tweet une citation sur la programmation tout les jours. Ce bot est host sur le compte Twitt

Jan 1, 2022
Bot - Telegram Music Bot in Go

Telegram Music Bot in Go An example bot using gotgcalls. Setup Install the serve

Jun 28, 2022