lakebtc

package
v0.0.0-...-a2c5123 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2018 License: MIT Imports: 14 Imported by: 0

README

GoCryptoTrader package Lakebtc

Build Status Software License GoDoc Coverage Status Go Report Card

This lakebtc 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

LakeBTC 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 l exchange.IBotExchange

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

// Public calls - wrapper functions

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

// Fetches current orderbook information
ob, err := l.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 := l.GetExchangeAccountInfo()
if err != nil {
  // Handle error
}
  • If enabled via individually importing package, rudimentary example below:
// Public calls

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

// Fetches current orderbook information
ob, err := l.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 := l.GetUserInfo(...)
if err != nil {
  // Handle error
}

// Submits an order and the exchange and returns its tradeID
tradeID, err := l.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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountInfo

type AccountInfo struct {
	Balance map[string]string `json:"balance"`
	Locked  map[string]string `json:"locked"`
	Profile struct {
		Email             string `json:"email"`
		UID               string `json:"uid"`
		BTCDepositAddress string `json:"btc_deposit_addres"`
	} `json:"profile"`
}

AccountInfo contains account information

type AuthenticatedTradeHistory

type AuthenticatedTradeHistory struct {
	Type   string  `json:"type"`
	Symbol string  `json:"symbol"`
	Amount float64 `json:"amount,string"`
	Total  float64 `json:"total,string"`
	At     int64   `json:"at"`
}

AuthenticatedTradeHistory is a store of personalised auth trade history

type ExternalAccounts

type ExternalAccounts struct {
	ID         int64       `json:"id,string"`
	Type       string      `json:"type"`
	Address    string      `json:"address"`
	Alias      interface{} `json:"alias"`
	Currencies string      `json:"currencies"`
	State      string      `json:"state"`
	UpdatedAt  int64       `json:"updated_at,string"`
}

ExternalAccounts holds external account information

type LakeBTC

type LakeBTC struct {
	exchange.Base
}

LakeBTC is the overarching type across the LakeBTC package

func (*LakeBTC) CancelAllExchangeOrders

func (l *LakeBTC) CancelAllExchangeOrders() error

CancelAllExchangeOrders cancels all orders associated with a currency pair

func (*LakeBTC) CancelExchangeOrder

func (l *LakeBTC) CancelExchangeOrder(orderID int64) error

CancelExchangeOrder cancels an order by its corresponding ID number

func (*LakeBTC) CancelOrder

func (l *LakeBTC) CancelOrder(orderID int64) error

CancelOrder cancels an order by ID number and returns an error

func (*LakeBTC) CreateWithdraw

func (l *LakeBTC) CreateWithdraw(amount float64, accountID int64) (Withdraw, error)

CreateWithdraw allows your to withdraw to external account WARNING: Only for BTC!

func (*LakeBTC) GetAccountInfo

func (l *LakeBTC) GetAccountInfo() (AccountInfo, error)

GetAccountInfo returns your current account information

func (*LakeBTC) GetExchangeAccountInfo

func (l *LakeBTC) GetExchangeAccountInfo() (exchange.AccountInfo, error)

GetExchangeAccountInfo retrieves balances for all enabled currencies for the LakeBTC exchange

func (*LakeBTC) GetExchangeDepositAddress

func (l *LakeBTC) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error)

GetExchangeDepositAddress returns a deposit address for a specified currency

func (*LakeBTC) GetExchangeFundTransferHistory

func (l *LakeBTC) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error)

GetExchangeFundTransferHistory returns funding history, deposits and withdrawals

func (*LakeBTC) GetExchangeHistory

func (l *LakeBTC) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error)

GetExchangeHistory returns historic trade data since exchange opening.

func (*LakeBTC) GetExchangeOrderInfo

func (l *LakeBTC) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error)

GetExchangeOrderInfo returns information on a current open order

func (*LakeBTC) GetExternalAccounts

func (l *LakeBTC) GetExternalAccounts() ([]ExternalAccounts, error)

GetExternalAccounts returns your external accounts WARNING: Only for BTC!

func (*LakeBTC) GetFee

func (l *LakeBTC) GetFee(maker bool) float64

GetFee returns maker or taker fee

func (*LakeBTC) GetOpenOrders

func (l *LakeBTC) GetOpenOrders() ([]OpenOrders, error)

GetOpenOrders returns all open orders associated with your account

func (*LakeBTC) GetOrderBook

func (l *LakeBTC) GetOrderBook(currency string) (Orderbook, error)

GetOrderBook returns the order book from LakeBTC

func (*LakeBTC) GetOrderbookEx

func (l *LakeBTC) GetOrderbookEx(p pair.CurrencyPair, assetType string) (orderbook.Base, error)

GetOrderbookEx returns orderbook base on the currency pair

func (*LakeBTC) GetOrders

func (l *LakeBTC) GetOrders(orders []int64) ([]Orders, error)

GetOrders returns your orders

func (*LakeBTC) GetTicker

func (l *LakeBTC) GetTicker() (map[string]Ticker, error)

GetTicker returns the current ticker from lakeBTC

func (*LakeBTC) GetTickerPrice

func (l *LakeBTC) GetTickerPrice(p pair.CurrencyPair, assetType string) (ticker.Price, error)

GetTickerPrice returns the ticker for a currency pair

func (*LakeBTC) GetTradablePairs

func (l *LakeBTC) GetTradablePairs() ([]string, error)

GetTradablePairs returns a list of available pairs from the exchange

func (*LakeBTC) GetTradeHistory

func (l *LakeBTC) GetTradeHistory(currency string) ([]TradeHistory, error)

GetTradeHistory returns the trade history for a given currency pair

func (*LakeBTC) GetTrades

func (l *LakeBTC) GetTrades(timestamp int64) ([]AuthenticatedTradeHistory, error)

GetTrades returns trades associated with your account by timestamp

func (*LakeBTC) ModifyExchangeOrder

func (l *LakeBTC) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error)

ModifyExchangeOrder will allow of changing orderbook placement and limit to market conversion

func (*LakeBTC) Run

func (l *LakeBTC) Run()

Run implements the LakeBTC wrapper

func (*LakeBTC) SendAuthenticatedHTTPRequest

func (l *LakeBTC) SendAuthenticatedHTTPRequest(method, params string, result interface{}) (err error)

SendAuthenticatedHTTPRequest sends an autheticated HTTP request to a LakeBTC

func (*LakeBTC) SendHTTPRequest

func (l *LakeBTC) SendHTTPRequest(path string, result interface{}) error

SendHTTPRequest sends an unauthenticated http request

func (*LakeBTC) SetDefaults

func (l *LakeBTC) SetDefaults()

SetDefaults sets LakeBTC defaults

func (*LakeBTC) Setup

func (l *LakeBTC) Setup(exch config.ExchangeConfig)

Setup sets exchange configuration profile

func (*LakeBTC) Start

func (l *LakeBTC) Start(wg *sync.WaitGroup)

Start starts the LakeBTC go routine

func (*LakeBTC) SubmitExchangeOrder

func (l *LakeBTC) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error)

SubmitExchangeOrder submits a new order

func (*LakeBTC) Trade

func (l *LakeBTC) Trade(orderType int, amount, price float64, currency string) (Trade, error)

Trade executes an order on the exchange and returns trade inforamtion or an error

func (*LakeBTC) UpdateOrderbook

func (l *LakeBTC) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*LakeBTC) UpdateTicker

func (l *LakeBTC) UpdateTicker(p pair.CurrencyPair, assetType string) (ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*LakeBTC) WithdrawCryptoExchangeFunds

func (l *LakeBTC) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error)

WithdrawCryptoExchangeFunds returns a withdrawal ID when a withdrawal is submitted

func (*LakeBTC) WithdrawFiatExchangeFunds

func (l *LakeBTC) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error)

WithdrawFiatExchangeFunds returns a withdrawal ID when a withdrawal is submitted

func (*LakeBTC) WithdrawFiatExchangeFundsToInternationalBank

func (l *LakeBTC) WithdrawFiatExchangeFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error)

WithdrawFiatExchangeFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted

type OpenOrders

type OpenOrders struct {
	ID     int64   `json:"id"`
	Amount float64 `json:"amount,string"`
	Price  float64 `json:"price,string"`
	Symbol string  `json:"symbol"`
	Type   string  `json:"type"`
	At     int64   `json:"at"`
}

OpenOrders stores full information on your open orders

type Orderbook

type Orderbook struct {
	Bids []OrderbookStructure `json:"bids"`
	Asks []OrderbookStructure `json:"asks"`
}

Orderbook contains arrays of orderbook information

type OrderbookStructure

type OrderbookStructure struct {
	Price  float64
	Amount float64
}

OrderbookStructure stores price and amount for order books

type Orders

type Orders struct {
	ID             int64   `json:"id"`
	OriginalAmount float64 `json:"original_amount,string"`
	Amount         float64 `json:"amount,string"`
	Price          float64 `json:"price,string"`
	Symbol         string  `json:"symbol"`
	Type           string  `json:"type"`
	State          string  `json:"state"`
	At             int64   `json:"at"`
}

Orders holds current order information

type Ticker

type Ticker struct {
	Last   float64
	Bid    float64
	Ask    float64
	High   float64
	Low    float64
	Volume float64
}

Ticker holds ticker information

type TickerResponse

type TickerResponse struct {
	Last   interface{}
	Bid    interface{}
	Ask    interface{}
	High   interface{}
	Low    interface{}
	Volume interface{}
}

TickerResponse stores temp response Silly hack due to API returning null instead of strings

type Trade

type Trade struct {
	ID     int64  `json:"id"`
	Result string `json:"result"`
}

Trade holds trade information

type TradeHistory

type TradeHistory struct {
	Date   int64   `json:"data"`
	Price  float64 `json:"price,string"`
	Amount float64 `json:"amount,string"`
	TID    int64   `json:"tid"`
}

TradeHistory holds trade history data

type Withdraw

type Withdraw struct {
	ID                int64   `json:"id,string"`
	Amount            float64 `json:"amount,string"`
	Currency          string  `json:"currency"`
	Fee               float64 `json:"fee,string"`
	State             string  `json:"state"`
	Source            string  `json:"source"`
	ExternalAccountID int64   `json:"external_account_id,string"`
	At                int64   `json:"at"`
}

Withdraw holds withdrawal information

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL