Documentation ¶
Overview ¶
Package Livecoin is an implementation of the Livecoin API in Golang.
Index ¶
- Constants
- func NewClient(apiKey, apiSecret string) (c *client)
- func NewClientWithCustomHttpConfig(apiKey, apiSecret string, httpClient *http.Client) (c *client)
- func NewClientWithCustomTimeout(apiKey, apiSecret string, timeout time.Duration) (c *client)
- type Balance
- type CancelledOrder
- type DepositAddress
- type Livecoin
- func (b *Livecoin) BuyLimit(market string, quantity, rate decimal.Decimal) (order NewOrder, err error)
- func (b *Livecoin) BuyMarket(market string, quantity decimal.Decimal) (order NewOrder, err error)
- func (b *Livecoin) CancelOrder(market, orderId string) (cancelledOrder CancelledOrder, err error)
- func (b *Livecoin) GetAllOrderBook() (allOrderbook map[string]Orderbook, err error)
- func (b *Livecoin) GetBalance(currency string) (balance Balance, err error)
- func (b *Livecoin) GetBalances() (balances []Balance, err error)
- func (b *Livecoin) GetDepositAddress(currency string) (address DepositAddress, err error)
- func (b *Livecoin) GetOrder(orderId string) (orderInfo OrderInfo, err error)
- func (b *Livecoin) GetOrderBook(currency string) (orderbook Orderbook, err error)
- func (b *Livecoin) GetRestrictions() (restrictions Restrictions, err error)
- func (b *Livecoin) GetTrades(currencyPair string) (trades []Trade, err error)
- func (b *Livecoin) GetTransactions(start uint64, end uint64) (transactions []Transaction, err error)
- func (b *Livecoin) SellLimit(market string, quantity, rate decimal.Decimal) (order NewOrder, err error)
- func (b *Livecoin) SellMarket(market string, quantity decimal.Decimal) (order NewOrder, err error)
- func (c *Livecoin) SetDebug(enable bool)
- func (b *Livecoin) Withdraw(wallet, currency string, quantity decimal.Decimal) (withdrawal Withdrawal, err error)
- type NewOrder
- type OrderInfo
- type Orderbook
- type OrderbookPair
- type Restriction
- type Restrictions
- type Trade
- type Transaction
- type Withdrawal
Constants ¶
const (
API_BASE = "https://api.livecoin.net" // Livecoin API endpoint
)
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient(apiKey, apiSecret string) (c *client)
NewClient return a new Livecoin HTTP client
func NewClientWithCustomHttpConfig ¶
NewClientWithCustomHttpConfig returns a new Livecoin HTTP client using the predefined http client
func NewClientWithCustomTimeout ¶
NewClient returns a new Livecoin HTTP client with custom timeout
Types ¶
type CancelledOrder ¶
type DepositAddress ¶
type Livecoin ¶
type Livecoin struct {
// contains filtered or unexported fields
}
livecoin represent a livecoin client
func NewWithCustomHttpClient ¶
NewWithCustomHttpClient returns an instantiated livecoin struct with custom http client
func NewWithCustomTimeout ¶
NewWithCustomTimeout returns an instantiated livecoin struct with custom timeout
func (*Livecoin) BuyLimit ¶
func (b *Livecoin) BuyLimit(market string, quantity, rate decimal.Decimal) (order NewOrder, err error)
BuyLimit is used to place a buy order (limit) for particular currency pair.
func (*Livecoin) BuyMarket ¶
BuyMarket is used to place a buy order (market) of specified amount for particular currency pair.
func (*Livecoin) CancelOrder ¶
func (b *Livecoin) CancelOrder(market, orderId string) (cancelledOrder CancelledOrder, err error)
CancelOrder is used to cancel an order. NOTE: market orders CANNOT be cancelled
func (*Livecoin) GetAllOrderBook ¶
GetAllOrderBook is used to retrieve the orderbook for every currency pair.
func (*Livecoin) GetBalance ¶
Getbalance is used to retrieve the balance from your account for a specific currency. currency: a string literal for the currency (ex: LTC)
func (*Livecoin) GetBalances ¶
GetBalances is used to retrieve all balances from your account
func (*Livecoin) GetDepositAddress ¶
func (b *Livecoin) GetDepositAddress(currency string) (address DepositAddress, err error)
GetDepositAddress is used to get the deposit address for a specific currency
func (*Livecoin) GetOrderBook ¶
GetOrderBook is used to retrieve the orderbook for specified currency pair
func (*Livecoin) GetRestrictions ¶
func (b *Livecoin) GetRestrictions() (restrictions Restrictions, err error)
GetRestrictions is used to retrieve the restrictions of all currency pairs
func (*Livecoin) GetTrades ¶
GetTrades used to retrieve your trade history. market string literal for the market (ie. BTC/LTC). If set to "all", will return for all market
func (*Livecoin) GetTransactions ¶
func (b *Livecoin) GetTransactions(start uint64, end uint64) (transactions []Transaction, err error)
GetTransactions is used to retrieve your withdrawal and deposit history "Start" and "end" are given in UNIX timestamp format in miliseconds and used to specify the date range for the data returned.
func (*Livecoin) SellLimit ¶
func (b *Livecoin) SellLimit(market string, quantity, rate decimal.Decimal) (order NewOrder, err error)
SellLimit is used to place a sell order (limit) for a specified currency pair.
func (*Livecoin) SellMarket ¶
SellMarket is used to place a sell order (market) for specified amount of selected currency pair.
type OrderInfo ¶
type OrderInfo struct { Id uint64 `json:"id"` ClientId uint64 `json:"client_id"` Status string `json:"status"` TickerPair string `json:"symbol"` Price decimal.Decimal `json:"price"` Quantity decimal.Decimal `json:"quantity"` RemainingQuantity decimal.Decimal `json:"remaining_quantity"` Blocked decimal.Decimal `json:"blocked"` BlockedRemain decimal.Decimal `json:"blocked_remain"` CommissionRate decimal.Decimal `json:"commission_rate"` Trades interface{} `json:"trades"` }
type Orderbook ¶
type Orderbook struct { Asks []OrderbookPair `json:"asks"` Bids []OrderbookPair `json:"bids"` Timestamp int64 `json:"timestamp"` }
type OrderbookPair ¶
func (*OrderbookPair) UnmarshalJSON ¶
func (p *OrderbookPair) UnmarshalJSON(buf []byte) error
type Restriction ¶
type Restrictions ¶
type Restrictions struct { Success bool `json:"success"` MinBtcVolume decimal.Decimal `json:"minBtcVolume"` Restrictions []Restriction `json:"restrictions"` }
type Trade ¶
type Trade struct { Id uint64 `json:"id"` ClientOrderId uint64 `json:"clientorderid"` Type string `json:"type"` Symbol string `json:"symbol"` Date time.Time `json:"datetime"` Price decimal.Decimal `json:"price"` Quantity decimal.Decimal `json:"quantity"` Commission decimal.Decimal `json:"commission"` }
func (*Trade) UnmarshalJSON ¶
type Transaction ¶
type Transaction struct { Id string `json:"id"` Type string `json:"type"` Date time.Time `json:"date"` Amount decimal.Decimal `json:"amount"` Fee decimal.Decimal `json:"fee"` FixedCurrency string `json:"fixedCurrency"` TaxCurrency string `json:"taxCurrency"` External string `json:"external"` ExternalKey string `json:"externalKey"` Login string `json:"login"` }
func (*Transaction) UnmarshalJSON ¶
func (t *Transaction) UnmarshalJSON(data []byte) error
type Withdrawal ¶
type Withdrawal struct { Fault interface{} `json:"fault"` UserId int64 `json:"userId"` UserName string `json:"userName"` Id int64 `json:"id"` State string `json:"state"` CreateDate int64 `json:"createDate"` LastModifyDate int64 `json:"lastModifyDate"` VerificationType string `json:"verificationType"` VerificationData interface{} `json:"verificationData"` Comment interface{} `json:"comment"` Description string `json:"description"` Amount decimal.Decimal `json:"amount"` Currency string `json:"currency"` AccountTo string `json:"accountTo"` AcceptDate interface{} `json:"acceptDate"` ValueDate interface{} `json:"valueDate"` DocDate int64 `json:"docDate"` DocNumber int64 `json:"docNumber"` CorrespondentDetails interface{} `json:"correspondentDetails"` AccountFrom string `json:"accountFrom"` Outcome bool `json:"outcome"` External interface{} `json:"external"` ExternalKey string `json:"externalKey"` ExternalSystemId int `json:"externalSystemId"` ExternalServiceId interface{} `json:"externalServiceId"` Wallet string `json:"wallet"` }