Git Product home page Git Product logo

golang-crypto-trading-bot's Introduction

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

golang-crypto-trading-bot's People

Contributors

fiore avatar gocruncher avatar marioarranzr avatar saniales avatar slawo avatar sunrunawayawayaway avatar testwill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

golang-crypto-trading-bot's Issues

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

Add Simulation Mode

This mode allows to calculate profits assuming trades are always made without investing

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

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

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.

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?

Unreachable code bittrex.go

func (wrapper BittrexWrapper) FeedConnect(markets []*environment.Market) error {
	return ErrWebsocketNotSupported

	wrapper.websocketOn = true

	...
}

the function returns immediately, so the rest of the code will never be executed.

func (wrapper BittrexWrapper) subscribeMarketSummaryFeed(market *environment.Market) {
	...
	panic("Not implemented")

	go func(market *environment.Market, results <-chan api.ExchangeState) {
		...
	}(market, results)
}

The go routine will never be executed due panic call before.

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,

Get Order status

The bot should be able to know order status (eg. if an order is still open or is closed)

Market Orders support

We should support market orders when possible
e.g. Bittrex does not support market orders, nor does binance

Currently the following exchanges support market orders

  • Binance
  • Bitfinex
  • HitBTC
  • Kraken

Negative amount on bitfinex orderbook

in exchanges/bitfinex.go change this

			// now let's create the cache
			for price, amount := range orderbookMap {
				if amount < 0 {
					orderbook.Asks = insertSort(orderbook.Asks, environment.Order{
						Value:    decimal.NewFromFloat(price),
						Quantity: decimal.NewFromFloat(amount),
					}, false)
				} else if amount > 0 {
					orderbook.Bids = insertSort(orderbook.Bids, environment.Order{
						Value:    decimal.NewFromFloat(price),
						Quantity: decimal.NewFromFloat(-amount),
					}, true)
				}
			}

to this

			// now let's create the cache
			for price, amount := range orderbookMap {
				if amount < 0 {
					orderbook.Asks = insertSort(orderbook.Asks, environment.Order{
						Value:    decimal.NewFromFloat(price),
						Quantity: decimal.NewFromFloat(-amount),
					}, false)
				} else if amount > 0 {
					orderbook.Bids = insertSort(orderbook.Bids, environment.Order{
						Value:    decimal.NewFromFloat(price),
						Quantity: decimal.NewFromFloat(amount),
					}, true)
				}
			}

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

`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

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?

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.