liqui

package
v0.0.0-...-8bcfbc3 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2018 License: MIT Imports: 15 Imported by: 0

README

GoCryptoTrader package Liqui

Build Status Software License GoDoc Coverage Status Go Report Card

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

Liqui Exchange

Current Features
  • Initial generation
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 {
	Funds  map[string]float64 `json:"funds"`
	Rights struct {
		Info     bool `json:"info"`
		Trade    bool `json:"trade"`
		Withdraw bool `json:"withdraw"`
	} `json:"rights"`
	ServerTime       float64 `json:"server_time"`
	TransactionCount int     `json:"transaction_count"`
	OpenOrders       int     `json:"open_orders"`
	Success          int     `json:"success"`
	Error            string  `json:"error"`
}

AccountInfo contains full account details information

type ActiveOrders

type ActiveOrders struct {
	Pair             string  `json:"pair"`
	Type             string  `json:"sell"`
	Amount           float64 `json:"amount"`
	Rate             float64 `json:"rate"`
	TimestampCreated float64 `json:"time_created"`
	Status           int     `json:"status"`
	Success          int     `json:"success"`
	Error            string  `json:"error"`
}

ActiveOrders holds active order information

type CancelOrder

type CancelOrder struct {
	OrderID float64            `json:"order_id"`
	Funds   map[string]float64 `json:"funds"`
	Success int                `json:"success"`
	Error   string             `json:"error"`
}

CancelOrder holds cancelled order information

type Info

type Info struct {
	ServerTime int64               `json:"server_time"`
	Pairs      map[string]PairData `json:"pairs"`
	Success    int                 `json:"success"`
	Error      string              `json:"error"`
}

Info holds the current pair information as well as server time

type Liqui

type Liqui struct {
	exchange.Base
	Ticker map[string]Ticker
	Info   Info
	*request.Handler
}

Liqui is the overarching type across the liqui package

func (*Liqui) CancelOrder

func (l *Liqui) CancelOrder(OrderID int64) (bool, error)

CancelOrder method is used for order cancelation.

func (*Liqui) GetAccountInfo

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

GetAccountInfo returns information about the user’s current balance, API-key privileges, the number of open orders and Server Time. To use this method you need a privilege of the key info.

func (*Liqui) GetActiveOrders

func (l *Liqui) GetActiveOrders(pair string) (map[string]ActiveOrders, error)

GetActiveOrders returns the list of your active orders.

func (*Liqui) GetAvailablePairs

func (l *Liqui) GetAvailablePairs(nonHidden bool) []string

GetAvailablePairs returns all available pairs

func (*Liqui) GetDepth

func (l *Liqui) GetDepth(currencyPair string) (Orderbook, error)

GetDepth information about active orders on the pair. Additionally it accepts an optional GET-parameter limit, which indicates how many orders should be displayed (150 by default). Is set to less than 2000.

func (*Liqui) GetExchangeAccountInfo

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

GetExchangeAccountInfo retrieves balances for all enabled currencies for the Liqui exchange

func (*Liqui) GetExchangeHistory

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

GetExchangeHistory returns historic trade data since exchange opening.

func (*Liqui) GetFee

func (l *Liqui) GetFee(currency string) (float64, error)

GetFee returns a fee for a specific currency

func (*Liqui) GetInfo

func (l *Liqui) GetInfo() (Info, error)

GetInfo provides all the information about currently active pairs, such as the maximum number of digits after the decimal point, the minimum price, the maximum price, the minimum transaction size, whether the pair is hidden, the commission for each pair.

func (*Liqui) GetOrderInfo

func (l *Liqui) GetOrderInfo(OrderID int64) (map[string]OrderInfo, error)

GetOrderInfo returns the information on particular order.

func (*Liqui) GetOrderbookEx

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

GetOrderbookEx returns orderbook base on the currency pair

func (*Liqui) GetTicker

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

GetTicker returns information about currently active pairs, such as: the maximum price, the minimum price, average price, trade volume, trade volume in currency, the last trade, Buy and Sell price. All information is provided over the past 24 hours.

currencyPair - example "eth_btc"

func (*Liqui) GetTickerPrice

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

GetTickerPrice returns the ticker for a currency pair

func (*Liqui) GetTradeHistory

func (l *Liqui) GetTradeHistory(vals url.Values, pair string) (map[string]TradeHistory, error)

GetTradeHistory returns trade history

func (*Liqui) GetTrades

func (l *Liqui) GetTrades(currencyPair string) ([]Trades, error)

GetTrades returns information about the last trades. Additionally it accepts an optional GET-parameter limit, which indicates how many orders should be displayed (150 by default). The maximum allowable value is 2000.

func (*Liqui) Run

func (l *Liqui) Run()

Run implements the Liqui wrapper

func (*Liqui) SendAuthenticatedHTTPRequest

func (l *Liqui) SendAuthenticatedHTTPRequest(method string, values url.Values, result interface{}) (err error)

SendAuthenticatedHTTPRequest sends an authenticated http request to liqui

func (*Liqui) SendHTTPRequest

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

SendHTTPRequest sends an unauthenticated HTTP request

func (*Liqui) SetDefaults

func (l *Liqui) SetDefaults()

SetDefaults sets current default values for liqui

func (*Liqui) Setup

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

Setup sets exchange configuration parameters for liqui

func (*Liqui) Start

func (l *Liqui) Start()

Start starts the Liqui go routine

func (*Liqui) Trade

func (l *Liqui) Trade(pair, orderType string, amount, price float64) (float64, error)

Trade creates orders on the exchange. to-do: convert orderid to int64

func (*Liqui) UpdateOrderbook

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

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*Liqui) UpdateTicker

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

UpdateTicker updates and returns the ticker for a currency pair

func (*Liqui) WithdrawCoins

func (l *Liqui) WithdrawCoins(coin string, amount float64, address string) (WithdrawCoins, error)

WithdrawCoins is designed for cryptocurrency withdrawals. API mentions that this isn't active now, but will be soon - you must provide the first 8 characters of the key in your ticket to support.

type OrderInfo

type OrderInfo struct {
	Pair             string  `json:"pair"`
	Type             string  `json:"sell"`
	StartAmount      float64 `json:"start_amount"`
	Amount           float64 `json:"amount"`
	Rate             float64 `json:"rate"`
	TimestampCreated float64 `json:"time_created"`
	Status           int     `json:"status"`
	Success          int     `json:"success"`
	Error            string  `json:"error"`
}

OrderInfo holds specific order information

type Orderbook

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

Orderbook references both ask and bid sides

type PairData

type PairData struct {
	DecimalPlaces int     `json:"decimal_places"`
	MinPrice      float64 `json:"min_price"`
	MaxPrice      float64 `json:"max_price"`
	MinAmount     float64 `json:"min_amount"`
	Hidden        int     `json:"hidden"`
	Fee           float64 `json:"fee"`
}

PairData is a sub-type for Info

type Response

type Response struct {
	Return  interface{} `json:"return"`
	Success int         `json:"success"`
	Error   string      `json:"error"`
}

Response is a generalized return type

type Ticker

type Ticker struct {
	High           float64
	Low            float64
	Avg            float64
	Vol            float64
	VolumeCurrency float64
	Last           float64
	Buy            float64
	Sell           float64
	Updated        int64
}

Ticker contains ticker information

type Trade

type Trade struct {
	Received float64            `json:"received"`
	Remains  float64            `json:"remains"`
	OrderID  float64            `json:"order_id"`
	Funds    map[string]float64 `json:"funds"`
	Success  int                `json:"success"`
	Error    string             `json:"error"`
}

Trade holds trading information

type TradeHistory

type TradeHistory struct {
	Pair      string  `json:"pair"`
	Type      string  `json:"type"`
	Amount    float64 `json:"amount"`
	Rate      float64 `json:"rate"`
	OrderID   float64 `json:"order_id"`
	MyOrder   int     `json:"is_your_order"`
	Timestamp float64 `json:"timestamp"`
	Success   int     `json:"success"`
	Error     string  `json:"error"`
}

TradeHistory contains trade history data

type Trades

type Trades struct {
	Type      string  `json:"type"`
	Price     float64 `json:"bid"`
	Amount    float64 `json:"amount"`
	TID       int64   `json:"tid"`
	Timestamp int64   `json:"timestamp"`
}

Trades contains trade information

type WithdrawCoins

type WithdrawCoins struct {
	TID        int64              `json:"tId"`
	AmountSent float64            `json:"amountSent"`
	Funds      map[string]float64 `json:"funds"`
	Success    int                `json:"success"`
	Error      string             `json:"error"`
}

WithdrawCoins shows the amount of coins withdrawn from liqui not yet available

Jump to

Keyboard shortcuts

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