Documentation
¶
Index ¶
- func ErrorCapture(code int64) error
- type CreateOrderResponse
- type ErrCapture
- type ExchangeRateResponse
- type GetAllOpenIDResp
- type InfoFinalResponse
- type InfoResponse
- type KlineResponse
- type Lbank
- func (l *Lbank) AuthenticateWebsocket() error
- func (l *Lbank) CancelAllOrders(orders *exchange.OrderCancellation) (exchange.CancelAllOrdersResponse, error)
- func (l *Lbank) CancelOrder(order *exchange.OrderCancellation) error
- func (l *Lbank) CreateOrder(pair, side string, amount, price float64) (CreateOrderResponse, error)
- func (l *Lbank) GetAccountInfo() (exchange.AccountInfo, error)
- func (l *Lbank) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
- func (l *Lbank) GetCurrencyPairs() ([]string, error)
- func (l *Lbank) GetDepositAddress(cryptocurrency currency.Code, accountID string) (string, error)
- func (l *Lbank) GetExchangeHistory(p currency.Pair, assetType string) ([]exchange.TradeHistory, error)
- func (l *Lbank) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)
- func (l *Lbank) GetFundingHistory() ([]exchange.FundHistory, error)
- func (l *Lbank) GetKlines(symbol, size, klineType, time string) ([]KlineResponse, error)
- func (l *Lbank) GetMarketDepths(symbol, size, merge string) (MarketDepthResponse, error)
- func (l *Lbank) GetOpenOrders(pair, pageNumber, pageLength string) (OpenOrderFinalResponse, error)
- func (l *Lbank) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
- func (l *Lbank) GetOrderInfo(orderID string) (exchange.OrderDetail, error)
- func (l *Lbank) GetOrderbookEx(currency currency.Pair, assetType string) (orderbook.Base, error)
- func (l *Lbank) GetPairInfo() ([]PairInfoResponse, error)
- func (l *Lbank) GetSubscriptions() ([]wshandler.WebsocketChannelSubscription, error)
- func (l *Lbank) GetTicker(symbol string) (TickerResponse, error)
- func (l *Lbank) GetTickerPrice(p currency.Pair, assetType string) (ticker.Price, error)
- func (l *Lbank) GetTrades(symbol, size, time string) ([]TradeResponse, error)
- func (l *Lbank) GetUserInfo() (InfoFinalResponse, error)
- func (l *Lbank) GetWebsocket() (*wshandler.Websocket, error)
- func (l *Lbank) GetWithdrawConfig(assetCode string) ([]WithdrawConfigResponse, error)
- func (l *Lbank) GetWithdrawalRecords(assetCode, status, pageNo, pageSize string) (WithdrawalResponse, error)
- func (l *Lbank) ModifyOrder(action *exchange.ModifyOrder) (string, error)
- func (l *Lbank) OrderTransactionDetails(symbol, orderID string) (TransactionHistoryResp, error)
- func (l *Lbank) QueryOrder(pair, orderIDs string) (QueryOrderFinalResponse, error)
- func (l *Lbank) QueryOrderHistory(pair, pageNumber, pageLength string) (OrderHistoryFinalResponse, error)
- func (l *Lbank) RemoveOrder(pair, orderID string) (RemoveOrderResponse, error)
- func (l *Lbank) RevokeWithdraw(withdrawID string) (RevokeWithdrawResponse, error)
- func (l *Lbank) Run()
- func (l *Lbank) SendAuthHTTPRequest(method, endpoint string, vals url.Values, result interface{}) error
- func (l *Lbank) SendHTTPRequest(path string, result interface{}) error
- func (l *Lbank) SetDefaults()
- func (l *Lbank) Setup(exch *config.ExchangeConfig)
- func (l *Lbank) Start(wg *sync.WaitGroup)
- func (l *Lbank) SubmitOrder(p currency.Pair, side exchange.OrderSide, _ exchange.OrderType, ...) (exchange.SubmitOrderResponse, error)
- func (l *Lbank) SubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
- func (l *Lbank) TransactionHistory(symbol, transactionType, startDate, endDate, from, direct, size string) (TransactionHistoryResp, error)
- func (l *Lbank) USD2RMBRate() (ExchangeRateResponse, error)
- func (l *Lbank) UnsubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
- func (l *Lbank) UpdateOrderbook(p currency.Pair, assetType string) (orderbook.Base, error)
- func (l *Lbank) UpdateTicker(p currency.Pair, assetType string) (ticker.Price, error)
- func (l *Lbank) Withdraw(account, assetCode, amount, memo, mark string) (WithdrawResponse, error)
- func (l *Lbank) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
- func (l *Lbank) WithdrawFiatFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
- func (l *Lbank) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.WithdrawRequest) (string, error)
- type ListDataResponse
- type MarketDepthResponse
- type OpenOrderFinalResponse
- type OpenOrderResponse
- type OrderHistory
- type OrderHistoryFinalResponse
- type OrderHistoryResponse
- type OrderResponse
- type PairInfoResponse
- type QueryOrderFinalResponse
- type QueryOrderResponse
- type RemoveOrderResponse
- type RevokeWithdrawResponse
- type Ticker
- type TickerResponse
- type TradeResponse
- type TransactionHistoryResp
- type TransactionTemp
- type WithdrawConfigResponse
- type WithdrawResponse
- type WithdrawalResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreateOrderResponse ¶
type CreateOrderResponse struct {
ErrCapture `json:",omitempty"`
OrderID string `json:"order_id"`
}
CreateOrderResponse stores the result of the Order and
type ErrCapture ¶
ErrCapture helps with error info
type ExchangeRateResponse ¶
type ExchangeRateResponse struct {
USD2CNY string `json:"USD2CNY"`
}
ExchangeRateResponse stores information about USD-RMB rate
type GetAllOpenIDResp ¶
GetAllOpenIDResp stores orderIds and currency pairs for open orders
type InfoFinalResponse ¶
type InfoFinalResponse struct {
ErrCapture `json:",omitempty"`
Info InfoResponse `json:"info"`
}
InfoFinalResponse stores info
type InfoResponse ¶
type InfoResponse struct {
Freeze map[string]string `json:"freeze"`
Asset map[string]string `json:"asset"`
Free map[string]string `json:"Free"`
}
InfoResponse stores info
type KlineResponse ¶
type KlineResponse struct {
TimeStamp int64 `json:"timestamp"`
OpenPrice float64 `json:"openprice"`
HigestPrice float64 `json:"highestprice"`
LowestPrice float64 `json:"lowestprice"`
ClosePrice float64 `json:"closeprice"`
TradingVolume float64 `json:"tradingvolume"`
}
KlineResponse stores kline info for given currency exchange
type Lbank ¶
type Lbank struct {
exchange.Base
WebsocketConn *wshandler.WebsocketConnection
// contains filtered or unexported fields
}
Lbank is the overarching type across this package
func (*Lbank) AuthenticateWebsocket ¶
AuthenticateWebsocket authenticates it
func (*Lbank) CancelAllOrders ¶
func (l *Lbank) CancelAllOrders(orders *exchange.OrderCancellation) (exchange.CancelAllOrdersResponse, error)
CancelAllOrders cancels all orders associated with a currency pair
func (*Lbank) CancelOrder ¶
func (l *Lbank) CancelOrder(order *exchange.OrderCancellation) error
CancelOrder cancels an order by its corresponding ID number
func (*Lbank) CreateOrder ¶
func (l *Lbank) CreateOrder(pair, side string, amount, price float64) (CreateOrderResponse, error)
CreateOrder creates an order
func (*Lbank) GetAccountInfo ¶
func (l *Lbank) GetAccountInfo() (exchange.AccountInfo, error)
GetAccountInfo retrieves balances for all enabled currencies for the Lbank exchange
func (*Lbank) GetActiveOrders ¶
func (l *Lbank) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
GetActiveOrders retrieves any orders that are active/open
func (*Lbank) GetCurrencyPairs ¶
GetCurrencyPairs returns a list of supported currency pairs by the exchange
func (*Lbank) GetDepositAddress ¶
GetDepositAddress returns a deposit address for a specified currency
func (*Lbank) GetExchangeHistory ¶
func (l *Lbank) GetExchangeHistory(p currency.Pair, assetType string) ([]exchange.TradeHistory, error)
GetExchangeHistory returns historic trade data since exchange opening.
func (*Lbank) GetFeeByType ¶
func (l *Lbank) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)
GetFeeByType returns an estimate of fee based on the type of transaction *
func (*Lbank) GetFundingHistory ¶
func (l *Lbank) GetFundingHistory() ([]exchange.FundHistory, error)
GetFundingHistory returns funding history, deposits and withdrawals
func (*Lbank) GetKlines ¶
func (l *Lbank) GetKlines(symbol, size, klineType, time string) ([]KlineResponse, error)
GetKlines returns kline data
func (*Lbank) GetMarketDepths ¶
func (l *Lbank) GetMarketDepths(symbol, size, merge string) (MarketDepthResponse, error)
GetMarketDepths returns arrays of asks, bids and timestamp
func (*Lbank) GetOpenOrders ¶
func (l *Lbank) GetOpenOrders(pair, pageNumber, pageLength string) (OpenOrderFinalResponse, error)
GetOpenOrders gets opening orders Lbank returns an empty string as their []OrderResponse instead of returning an empty array, so when len(tempResp.Orders) > 2 its not empty and should be unmarshalled separately
func (*Lbank) GetOrderHistory ¶
func (l *Lbank) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
GetOrderHistory retrieves account order information * Can Limit response to specific order status
func (*Lbank) GetOrderInfo ¶
func (l *Lbank) GetOrderInfo(orderID string) (exchange.OrderDetail, error)
GetOrderInfo returns information on a current open order
func (*Lbank) GetOrderbookEx ¶
GetOrderbookEx returns orderbook base on the currency pair
func (*Lbank) GetPairInfo ¶
func (l *Lbank) GetPairInfo() ([]PairInfoResponse, error)
GetPairInfo finds information about all trading pairs
func (*Lbank) GetSubscriptions ¶
func (l *Lbank) GetSubscriptions() ([]wshandler.WebsocketChannelSubscription, error)
GetSubscriptions gets subscriptions
func (*Lbank) GetTicker ¶
func (l *Lbank) GetTicker(symbol string) (TickerResponse, error)
GetTicker returns a ticker for the specified symbol symbol: eth_btc
func (*Lbank) GetTickerPrice ¶
GetTickerPrice returns the ticker for a currency pair
func (*Lbank) GetTrades ¶
func (l *Lbank) GetTrades(symbol, size, time string) ([]TradeResponse, error)
GetTrades returns an array of available trades regarding a particular exchange
func (*Lbank) GetUserInfo ¶
func (l *Lbank) GetUserInfo() (InfoFinalResponse, error)
GetUserInfo gets users account info
func (*Lbank) GetWebsocket ¶
GetWebsocket returns a pointer to the exchange websocket
func (*Lbank) GetWithdrawConfig ¶
func (l *Lbank) GetWithdrawConfig(assetCode string) ([]WithdrawConfigResponse, error)
GetWithdrawConfig gets information about withdrawals
func (*Lbank) GetWithdrawalRecords ¶
func (l *Lbank) GetWithdrawalRecords(assetCode, status, pageNo, pageSize string) (WithdrawalResponse, error)
GetWithdrawalRecords gets withdrawal records
func (*Lbank) ModifyOrder ¶
func (l *Lbank) ModifyOrder(action *exchange.ModifyOrder) (string, error)
ModifyOrder will allow of changing orderbook placement and limit to market conversion
func (*Lbank) OrderTransactionDetails ¶
func (l *Lbank) OrderTransactionDetails(symbol, orderID string) (TransactionHistoryResp, error)
OrderTransactionDetails gets info about transactions
func (*Lbank) QueryOrder ¶
func (l *Lbank) QueryOrder(pair, orderIDs string) (QueryOrderFinalResponse, error)
QueryOrder finds out information about orders (can pass up to 3 comma separated values to this) Lbank returns an empty string as their []OrderResponse instead of returning an empty array, so when len(tempResp.Orders) > 2 its not empty and should be unmarshalled separately
func (*Lbank) QueryOrderHistory ¶
func (l *Lbank) QueryOrderHistory(pair, pageNumber, pageLength string) (OrderHistoryFinalResponse, error)
QueryOrderHistory finds order info in the past 2 days Lbank returns an empty string as their []OrderResponse instead of returning an empty array, so when len(tempResp.Orders) > 2 its not empty and should be unmarshalled separately
func (*Lbank) RemoveOrder ¶
func (l *Lbank) RemoveOrder(pair, orderID string) (RemoveOrderResponse, error)
RemoveOrder cancels a given order
func (*Lbank) RevokeWithdraw ¶
func (l *Lbank) RevokeWithdraw(withdrawID string) (RevokeWithdrawResponse, error)
RevokeWithdraw cancels the withdrawal given the withdrawalID
func (*Lbank) SendAuthHTTPRequest ¶
func (l *Lbank) SendAuthHTTPRequest(method, endpoint string, vals url.Values, result interface{}) error
SendAuthHTTPRequest sends an authenticated request
func (*Lbank) SendHTTPRequest ¶
SendHTTPRequest sends an unauthenticated HTTP request
func (*Lbank) SetDefaults ¶
func (l *Lbank) SetDefaults()
SetDefaults sets the basic defaults for Lbank
func (*Lbank) Setup ¶
func (l *Lbank) Setup(exch *config.ExchangeConfig)
Setup takes in the supplied exchange configuration details and sets params
func (*Lbank) SubmitOrder ¶
func (l *Lbank) SubmitOrder(p currency.Pair, side exchange.OrderSide, _ exchange.OrderType, amount, price float64, clientID string) (exchange.SubmitOrderResponse, error)
SubmitOrder submits a new order
func (*Lbank) SubscribeToWebsocketChannels ¶
func (l *Lbank) SubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
SubscribeToWebsocketChannels appends to ChannelsToSubscribe which lets websocket.manageSubscriptions handle subscribing
func (*Lbank) TransactionHistory ¶
func (l *Lbank) TransactionHistory(symbol, transactionType, startDate, endDate, from, direct, size string) (TransactionHistoryResp, error)
TransactionHistory stores info about transactions
func (*Lbank) USD2RMBRate ¶
func (l *Lbank) USD2RMBRate() (ExchangeRateResponse, error)
USD2RMBRate finds USD-CNY Rate
func (*Lbank) UnsubscribeToWebsocketChannels ¶
func (l *Lbank) UnsubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
UnsubscribeToWebsocketChannels removes from ChannelsToSubscribe which lets websocket.manageSubscriptions handle unsubscribing
func (*Lbank) UpdateOrderbook ¶
UpdateOrderbook updates and returns the orderbook for a currency pair
func (*Lbank) UpdateTicker ¶
UpdateTicker updates and returns the ticker for a currency pair
func (*Lbank) Withdraw ¶
func (l *Lbank) Withdraw(account, assetCode, amount, memo, mark string) (WithdrawResponse, error)
Withdraw sends a withdrawal request
func (*Lbank) WithdrawCryptocurrencyFunds ¶
func (l *Lbank) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted
func (*Lbank) WithdrawFiatFunds ¶
func (l *Lbank) WithdrawFiatFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted
func (*Lbank) WithdrawFiatFundsToInternationalBank ¶
func (l *Lbank) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.WithdrawRequest) (string, error)
WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted
type ListDataResponse ¶
type ListDataResponse struct {
ErrCapture `json:",omitempty"`
Amount float64 `json:"amount"`
AssetCode string `json:"assetCode"`
Address string `json:"address"`
Fee float64 `json:"fee"`
ID int64 `json:"id"`
Time int64 `json:"time"`
TXHash string `json:"txhash"`
Status string `json:"status"`
}
ListDataResponse contains some of withdrawal data
type MarketDepthResponse ¶
type MarketDepthResponse struct {
ErrCapture `json:",omitempty"`
Asks [][]float64 `json:"asks"`
Bids [][]float64 `json:"bids"`
Timestamp int64 `json:"timestamp"`
}
MarketDepthResponse stores arrays for asks, bids and a timestamp for a currecy pair
type OpenOrderFinalResponse ¶
type OpenOrderFinalResponse struct {
ErrCapture
PageLength uint8
PageNumber uint8
Total string
Orders []OrderResponse
}
OpenOrderFinalResponse stores the unmarshalled value of OpenOrderResponse
type OpenOrderResponse ¶
type OpenOrderResponse struct {
ErrCapture `json:",omitempty"`
PageLength uint8 `json:"page_length"`
PageNumber uint8 `json:"page_number"`
Total string `json:"total"`
Orders json.RawMessage `json:"orders"`
}
OpenOrderResponse stores information about the opening orders
type OrderHistory ¶
type OrderHistory struct {
Result bool `json:"result,string"`
Total string `json:"total"`
PageLength uint8 `json:"page_length"`
Orders json.RawMessage `json:"orders"`
CurrentPage uint8 `json:"current_page"`
ErrorCode int64 `json:"error_code"`
}
OrderHistory stores data for past orders
type OrderHistoryFinalResponse ¶
type OrderHistoryFinalResponse struct {
ErrCapture
PageLength uint8
Orders []OrderResponse
CurrentPage uint8
}
OrderHistoryFinalResponse stores past orders
type OrderHistoryResponse ¶
type OrderHistoryResponse struct {
ErrCapture `json:",omitempty"`
PageLength uint8 `json:"page_length"`
Orders json.RawMessage `json:"orders"`
CurrentPage uint8 `json:"current_page"`
}
OrderHistoryResponse stores past orders
type OrderResponse ¶
type OrderResponse struct {
Symbol string `json:"symbol"`
Amount float64 `json:"amount"`
CreateTime int64 `json:"created_time"`
Price float64 `json:"price"`
AvgPrice float64 `json:"avg_price"`
Type string `json:"type"`
OrderID string `json:"order_id"`
DealAmount float64 `json:"deal_amount"`
Status int64 `json:"status"`
}
OrderResponse stores the data related to the given OrderIDs
type PairInfoResponse ¶
type PairInfoResponse struct {
MinimumQuantity string `json:"minTranQua"`
PriceAccuracy string `json:"priceAccuracy"`
QuantityAccuracy string `json:"quantityAccuracy"`
Symbol string `json:"symbol"`
}
PairInfoResponse stores information about trading pairs
type QueryOrderFinalResponse ¶
type QueryOrderFinalResponse struct {
ErrCapture
Orders []OrderResponse
}
QueryOrderFinalResponse stores data from queries
type QueryOrderResponse ¶
type QueryOrderResponse struct {
ErrCapture `json:",omitempty"`
Orders json.RawMessage `json:"orders"`
}
QueryOrderResponse stores the data from queries
type RemoveOrderResponse ¶
type RemoveOrderResponse struct {
ErrCapture `json:",omitempty"`
Err string `json:"error"`
OrderID string `json:"order_id"`
Success string `json:"success"`
}
RemoveOrderResponse stores the result when an order is cancelled
type RevokeWithdrawResponse ¶
type RevokeWithdrawResponse struct {
ErrCapture `json:",omitempty"`
WithdrawID string `json:"string"`
}
RevokeWithdrawResponse stores info about the revoked withdrawal
type Ticker ¶
type Ticker struct {
Change float64 `json:"change"`
High float64 `json:"high"`
Latest float64 `json:"latest"`
Low float64 `json:"low"`
Turnover float64 `json:"turnover"`
Volume float64 `json:"vol"`
}
Ticker stores the ticker price data for a currency pair
type TickerResponse ¶
type TickerResponse struct {
Symbol string `json:"symbol"`
Timestamp int64 `json:"timestamp"`
Ticker Ticker `json:"ticker"`
}
TickerResponse stores the ticker price data and timestamp for a currency pair
type TradeResponse ¶
type TradeResponse struct {
DateMS int64 `json:"date_ms"`
Amount float64 `json:"amount"`
Price float64 `json:"price"`
Type string `json:"type"`
TID string `json:"tid"`
}
TradeResponse stores date_ms, amount, price, type, tid for a currency pair
type TransactionHistoryResp ¶
type TransactionHistoryResp struct {
ErrCapture `json:",omitempty"`
Transaction []TransactionTemp `json:"transaction"`
}
TransactionHistoryResp stores details about past transactions
type TransactionTemp ¶
type TransactionTemp struct {
TxUUID string `json:"txUuid"`
OrderUUID string `json:"orderUuid"`
TradeType string `json:"tradeType"`
DealTime int64 `json:"dealTime"`
DealPrice float64 `json:"dealPrice"`
DealQuantity float64 `json:"dealQuantity"`
DealVolPrice float64 `json:"dealVolumePrice"`
TradeFee float64 `json:"tradeFee"`
TradeFeeRate float64 `json:"tradeFeeRate"`
}
TransactionTemp stores details about transactions
type WithdrawConfigResponse ¶
type WithdrawConfigResponse struct {
AssetCode string `json:"assetCode"`
Minimum string `json:"min"`
CanWithDraw bool `json:"canWithDraw"`
Fee string `json:"fee"`
}
WithdrawConfigResponse stores info about withdrawal configurations
type WithdrawResponse ¶
type WithdrawResponse struct {
ErrCapture `json:",omitempty"`
WithdrawID string `json:"withdrawId"`
Fee float64 `json:"fee"`
}
WithdrawResponse stores info about the withdrawal
type WithdrawalResponse ¶
type WithdrawalResponse struct {
ErrCapture `json:",omitempty"`
TotalPages int64 `json:"totalPages"`
PageSize int64 `json:"pageSize"`
PageNo int64 `json:"pageNo"`
List []ListDataResponse `json:"list"`
}
WithdrawalResponse stores data for withdrawals