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) CancelAllOrders(orders *order.Cancel) (order.CancelAllResponse, error)
- func (l *Lbank) CancelOrder(order *order.Cancel) error
- func (l *Lbank) CreateOrder(pair, side string, amount, price float64) (CreateOrderResponse, error)
- func (l *Lbank) FetchAccountInfo() (account.Holdings, error)
- func (l *Lbank) FetchOrderbook(currency currency.Pair, assetType asset.Item) (*orderbook.Base, error)
- func (l *Lbank) FetchTicker(p currency.Pair, assetType asset.Item) (*ticker.Price, error)
- func (l *Lbank) FetchTradablePairs(asset asset.Item) ([]string, error)
- func (l *Lbank) FormatExchangeKlineInterval(in kline.Interval) string
- func (l *Lbank) GetActiveOrders(getOrdersRequest *order.GetOrdersRequest) ([]order.Detail, error)
- func (l *Lbank) GetCurrencyPairs() ([]string, error)
- func (l *Lbank) GetDefaultConfig() (*config.ExchangeConfig, error)
- func (l *Lbank) GetDepositAddress(cryptocurrency currency.Code, accountID string) (string, error)
- func (l *Lbank) GetExchangeHistory(p currency.Pair, assetType asset.Item, timestampStart, timestampEnd time.Time) ([]exchange.TradeHistory, error)
- func (l *Lbank) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)
- func (l *Lbank) GetFundingHistory() ([]exchange.FundHistory, error)
- func (l *Lbank) GetHistoricCandles(pair currency.Pair, a asset.Item, start, end time.Time, ...) (kline.Item, error)
- func (l *Lbank) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, start, end time.Time, ...) (kline.Item, 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 *order.GetOrdersRequest) ([]order.Detail, error)
- func (b *Lbank) GetOrderHistoryById(getOrdersRequest string) ([]order.Detail, error)
- func (l *Lbank) GetOrderInfo(orderID string) (order.Detail, error)
- func (l *Lbank) GetPairInfo() ([]PairInfoResponse, error)
- func (l *Lbank) GetTicker(symbol string) (TickerResponse, error)
- func (l *Lbank) GetTickers() ([]TickerResponse, error)
- func (l *Lbank) GetTrades(symbol, size, time string) ([]TradeResponse, error)
- func (l *Lbank) GetUserInfo() (InfoFinalResponse, 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 *order.Modify) (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) error
- func (l *Lbank) Start(wg *sync.WaitGroup)
- func (l *Lbank) SubmitOrder(s *order.Submit) (order.SubmitResponse, error)
- func (l *Lbank) TransactionHistory(symbol, transactionType, startDate, endDate, from, direct, size string) (TransactionHistoryResp, error)
- func (l *Lbank) USD2RMBRate() (ExchangeRateResponse, error)
- func (l *Lbank) UpdateAccountInfo() (account.Holdings, error)
- func (l *Lbank) UpdateOrderbook(p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
- func (l *Lbank) UpdateTicker(p currency.Pair, assetType asset.Item) (*ticker.Price, error)
- func (l *Lbank) UpdateTradablePairs(forceUpdate bool) error
- func (l *Lbank) ValidateCredentials() error
- func (l *Lbank) Withdraw(account, assetCode, amount, memo, mark, withdrawType string) (WithdrawResponse, error)
- func (l *Lbank) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (l *Lbank) WithdrawFiatFunds(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (l *Lbank) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, 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 *stream.WebsocketConnection // contains filtered or unexported fields }
Lbank is the overarching type across this package
func (*Lbank) CancelAllOrders ¶
CancelAllOrders cancels all orders associated with a currency pair
func (*Lbank) CancelOrder ¶
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) FetchAccountInfo ¶
FetchAccountInfo retrieves balances for all enabled currencies
func (*Lbank) FetchOrderbook ¶
func (l *Lbank) FetchOrderbook(currency currency.Pair, assetType asset.Item) (*orderbook.Base, error)
FetchOrderbook returns orderbook base on the currency pair
func (*Lbank) FetchTicker ¶
FetchTicker returns the ticker for a currency pair
func (*Lbank) FetchTradablePairs ¶
FetchTradablePairs returns a list of the exchanges tradable pairs
func (*Lbank) FormatExchangeKlineInterval ¶
FormatExchangeKlineInterval returns Interval to exchange formatted string
func (*Lbank) GetActiveOrders ¶
GetActiveOrders retrieves any orders that are active/open
func (*Lbank) GetCurrencyPairs ¶
GetCurrencyPairs returns a list of supported currency pairs by the exchange
func (*Lbank) GetDefaultConfig ¶
func (l *Lbank) GetDefaultConfig() (*config.ExchangeConfig, error)
GetDefaultConfig returns a default exchange config
func (*Lbank) GetDepositAddress ¶
GetDepositAddress returns a deposit address for a specified currency
func (*Lbank) GetExchangeHistory ¶
func (l *Lbank) GetExchangeHistory(p currency.Pair, assetType asset.Item, timestampStart, timestampEnd time.Time) ([]exchange.TradeHistory, error)
GetExchangeHistory returns historic trade data within the timeframe provided.
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) GetHistoricCandles ¶
func (l *Lbank) GetHistoricCandles(pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error)
GetHistoricCandles returns candles between a time period for a set time interval
func (*Lbank) GetHistoricCandlesExtended ¶
func (l *Lbank) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error)
GetHistoricCandlesExtended returns candles between a time period for a set time interval
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 ¶
GetOrderHistory retrieves account order information * Can Limit response to specific order status
func (*Lbank) GetOrderHistoryById ¶
GetOrderHistoryById retrieves specified closed order information Can Limit response to specific order status
func (*Lbank) GetOrderInfo ¶
GetOrderInfo returns information on a current open order
func (*Lbank) GetPairInfo ¶
func (l *Lbank) GetPairInfo() ([]PairInfoResponse, error)
GetPairInfo finds information about all trading pairs
func (*Lbank) GetTicker ¶
func (l *Lbank) GetTicker(symbol string) (TickerResponse, error)
GetTicker returns a ticker for the specified symbol symbol: eth_btc
func (*Lbank) GetTickers ¶
func (l *Lbank) GetTickers() ([]TickerResponse, error)
GetTickers returns all tickers
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) 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 ¶
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) error
Setup sets exchange configuration profile
func (*Lbank) SubmitOrder ¶
SubmitOrder submits a new order
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) UpdateAccountInfo ¶
UpdateAccountInfo retrieves balances for all enabled currencies for the Lbank exchange
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) UpdateTradablePairs ¶
UpdateTradablePairs updates the exchanges available pairs and stores them in the exchanges config
func (*Lbank) ValidateCredentials ¶
ValidateCredentials validates current credentials used for wrapper functionality
func (*Lbank) Withdraw ¶
func (l *Lbank) Withdraw(account, assetCode, amount, memo, mark, withdrawType string) (WithdrawResponse, error)
Withdraw sends a withdrawal request
func (*Lbank) WithdrawCryptocurrencyFunds ¶
func (l *Lbank) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted
func (*Lbank) WithdrawFiatFunds ¶
func (l *Lbank) WithdrawFiatFunds(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted
func (*Lbank) WithdrawFiatFundsToInternationalBank ¶
func (l *Lbank) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, 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 currency.Pair `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