Files
gocryptotrader/exchanges/kraken
Scott 32b43387fd Kraken websocket orderbook buffer (#276)
* Adds a orderbook buffer to prevent out of order issues with WS orderbooks. Internalises latest orderbook for comparisons sake as getorderbookex is unreliable due to REST updates

* Adds a basic rate limiter for WS requests. Updates buffer to support multiple channels

* Uses earliest buffer 'lastupdate' to compate to existing orderbook's 'lastupdate' instead of last

* Adds WS test for buffer use

* Adds out of order test

* Fixes blocking bid updates, fixes issue where orderbook processing occured in wrong area, adds detailed verbose debugging, uses pointer for channelData use

* Updates test to adapt to buffer limits, reduces kraken buffer to 3

* Change websocket connection check in tests. Change error handling. Implement requestID in data responses for WS. Change test to prevent default subscriptions from preventing test execution with extra data. Updates orderbook tests to call correct functions to prevent resubscriptions. Removes resubscribe on subscription status failure

* Fixes linting issues

* Fixes error handling
2019-04-12 09:21:37 +10:00
..

GoCryptoTrader package Kraken

Build Status Software License GoDoc Coverage Status Go Report Card

This kraken package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progresss on this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

Kraken Exchange

Current Features

  • REST Support

How to enable

  // Exchanges will be abstracted out in further updates and examples will be
  // supplied then

How to do REST public/private calls

  • If enabled via "configuration".json file the exchange will be added to the IBotExchange array in the go var bot Bot and you will only be able to use the wrapper interface functions for accessing exchange data. View routines.go for an example of integration usage with GoCryptoTrader. Rudimentary example below:

main.go

var k exchange.IBotExchange

for i := range bot.exchanges {
  if bot.exchanges[i].GetName() == "Kraken" {
    k = bot.exchanges[i]
  }
}

// Public calls - wrapper functions

// Fetches current ticker information
tick, err := k.GetTickerPrice()
if err != nil {
  // Handle error
}

// Fetches current orderbook information
ob, err := k.GetOrderbookEx()
if err != nil {
  // Handle error
}

// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
// set and AuthenticatedAPISupport is set to true

// Fetches current account information
accountInfo, err := k.GetAccountInfo()
if err != nil {
  // Handle error
}
  • If enabled via individually importing package, rudimentary example below:
// Public calls

// Fetches current ticker information
ticker, err := k.GetTicker()
if err != nil {
  // Handle error
}

// Fetches current orderbook information
ob, err := k.GetOrderBook()
if err != nil {
  // Handle error
}

// Private calls - make sure your APIKEY and APISECRET are set and
// AuthenticatedAPISupport is set to true

// GetUserInfo returns account info
accountInfo, err := k.GetUserInfo(...)
if err != nil {
  // Handle error
}

// Submits an order and the exchange and returns its tradeID
tradeID, err := k.Trade(...)
if err != nil {
  // Handle error
}

Please click GoDocs chevron above to view current GoDoc information for this package

Contribution

Please feel free to submit any pull requests or suggest any desired features to be added.

When submitting a PR, please abide by our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Code must adhere to our coding style.
  • Pull requests need to be based on and opened against the master branch.

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB