Documentation ¶
Overview ¶
Package Bittrex is an implementation of the Biitrex API in Golang.
Index ¶
- Constants
- Variables
- 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 Address
- type Balance
- type BalanceD
- type Bittrex
- func (b *Bittrex) BuyLimit(market string, quantity, rate decimal.Decimal) (uuid string, err error)
- func (b *Bittrex) CancelOrder(orderID string) (err error)
- func (b *Bittrex) GetBalance(currency string) (balance Balance, err error)
- func (b *Bittrex) GetBalances() (balances []Balance, err error)
- func (b *Bittrex) GetCurrencies() (currencies []Currency, err error)
- func (b *Bittrex) GetDepositAddress(currency string) (address Address, err error)
- func (b *Bittrex) GetDepositHistory(currency string) (deposits []Deposit, err error)
- func (b *Bittrex) GetDistribution(market string) (distribution Distribution, err error)
- func (b *Bittrex) GetLatestTick(market string, interval string) ([]Candle, error)
- func (b *Bittrex) GetMarketHistory(market string) (trades []Trade, err error)
- func (b *Bittrex) GetMarketSummaries() (marketSummaries []MarketSummary, err error)
- func (b *Bittrex) GetMarketSummary(market string) (marketSummary []MarketSummary, err error)
- func (b *Bittrex) GetMarkets() (markets []Market, err error)
- func (b *Bittrex) GetOpenOrders(market string) (openOrders []Order, err error)
- func (b *Bittrex) GetOrder(order_uuid string) (order Order2, err error)
- func (b *Bittrex) GetOrderBook(market, cat string) (orderBook OrderBook, err error)
- func (b *Bittrex) GetOrderBookBuySell(market, cat string) (orderb []Orderb, err error)
- func (b *Bittrex) GetOrderHistory(market string) (orders []Order, err error)
- func (b *Bittrex) GetTicker(market string) (ticker Ticker, err error)
- func (b *Bittrex) GetTicks(market string, interval string) ([]Candle, error)
- func (b *Bittrex) GetWithdrawalHistory(currency string) (withdrawals []Withdrawal, err error)
- func (b *Bittrex) OrderV3(newOrder *NewOrderV3) (response *OrderV3, err error)
- func (b *Bittrex) SellLimit(market string, quantity, rate decimal.Decimal) (uuid string, err error)
- func (c *Bittrex) SetDebug(enable bool)
- func (b *Bittrex) SubscribeExchangeUpdate(market string, dataCh chan<- ExchangeState, stop <-chan bool) error
- func (b *Bittrex) Withdraw(address, currency string, quantity decimal.Decimal) (withdrawUuid string, err error)
- type Candle
- type CandleTime
- type Currency
- type Deposit
- type Distribution
- type ExchangeState
- type Fill
- type Market
- type MarketSummary
- type NewCandles
- type NewOrderV3
- type Order
- type Order2
- type OrderBook
- type OrderUpdate
- type OrderV3
- type Orderb
- type Ticker
- type Trade
- type Uuid
- type Withdrawal
Constants ¶
const ( API_BASE = "https://bittrex.com/api/" // Bittrex API endpoint API_BASE_3 = "https://api.bittrex.com/" // Bittrex API endpoint API_VERSION = "v1.1" API_VERSION_3 = "v3" WS_BASE = "socket.bittrex.com" // Bittrex WS API endpoint WS_HUB = "CoreHub" // SignalR main hub )
const TIME_FORMAT = "2006-01-02T15:04:05"
Variables ¶
Functions ¶
func NewClient ¶
func NewClient(apiKey, apiSecret string) (c *client)
NewClient return a new Bittrex HTTP client
func NewClientWithCustomHttpConfig ¶
NewClientWithCustomHttpConfig returns a new Bittrex HTTP client using the predefined http client
func NewClientWithCustomTimeout ¶
NewClient returns a new Bittrex HTTP client with custom timeout
Types ¶
type Bittrex ¶
type Bittrex struct {
// contains filtered or unexported fields
}
bittrex represent a bittrex client
func NewWithCustomHttpClient ¶
NewWithCustomHttpClient returns an instantiated bittrex struct with custom http client
func NewWithCustomTimeout ¶
NewWithCustomTimeout returns an instantiated bittrex struct with custom timeout
func (*Bittrex) CancelOrder ¶
CancelOrder is used to cancel a buy or sell order.
func (*Bittrex) 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 (*Bittrex) GetBalances ¶
GetBalances is used to retrieve all balances from your account
func (*Bittrex) GetCurrencies ¶
GetCurrencies is used to get all supported currencies at Bittrex along with other meta data.
func (*Bittrex) GetDepositAddress ¶
GetDepositAddress is sed to generate or retrieve an address for a specific currency. currency a string literal for the currency (ie. BTC)
func (*Bittrex) GetDepositHistory ¶
GetDepositHistory is used to retrieve your deposit history currency string a string literal for the currency (ie. BTC). If set to "all", will return for all currencies
func (*Bittrex) GetDistribution ¶
func (b *Bittrex) GetDistribution(market string) (distribution Distribution, err error)
GetDistribution is used to get the distribution.
func (*Bittrex) GetLatestTick ¶
GetLatestTick returns array with a single element latest candle object
func (*Bittrex) GetMarketHistory ¶
GetMarketHistory is used to retrieve the latest trades that have occured for a specific market. market a string literal for the market (ex: BTC-LTC)
func (*Bittrex) GetMarketSummaries ¶
func (b *Bittrex) GetMarketSummaries() (marketSummaries []MarketSummary, err error)
GetMarketSummaries is used to get the last 24 hour summary of all active exchanges
func (*Bittrex) GetMarketSummary ¶
func (b *Bittrex) GetMarketSummary(market string) (marketSummary []MarketSummary, err error)
GetMarketSummary is used to get the last 24 hour summary for a given market
func (*Bittrex) GetMarkets ¶
GetMarkets is used to get the open and available trading markets at Bittrex along with other meta data.
func (*Bittrex) GetOpenOrders ¶
GetOpenOrders returns orders that you currently have opened. If market is set to "all", GetOpenOrders return all orders If market is set to a specific order, GetOpenOrders return orders for this market
func (*Bittrex) GetOrderBook ¶
GetOrderBook is used to get retrieve the orderbook for a given market market: a string literal for the market (ex: BTC-LTC) cat: buy, sell or both to identify the type of orderbook to return.
func (*Bittrex) GetOrderBookBuySell ¶
GetOrderBookBuySell is used to get retrieve the buy or sell side of an orderbook for a given market market: a string literal for the market (ex: BTC-LTC) cat: buy or sell to identify the type of orderbook to return.
func (*Bittrex) GetOrderHistory ¶
GetOrderHistory used to retrieve your order history. market string literal for the market (ie. BTC-LTC). If set to "all", will return for all market
func (*Bittrex) GetTicks ¶
GetTicks is used to get ticks history values for a market. Interval can be -> ["oneMin", "fiveMin", "thirtyMin", "hour", "day"]
func (*Bittrex) GetWithdrawalHistory ¶
func (b *Bittrex) GetWithdrawalHistory(currency string) (withdrawals []Withdrawal, err error)
GetWithdrawalHistory is used to retrieve your withdrawal history currency string a string literal for the currency (ie. BTC). If set to "all", will return for all currencies
func (*Bittrex) OrderV3 ¶
func (b *Bittrex) OrderV3(newOrder *NewOrderV3) (response *OrderV3, err error)
func (*Bittrex) SubscribeExchangeUpdate ¶
func (b *Bittrex) SubscribeExchangeUpdate(market string, dataCh chan<- ExchangeState, stop <-chan bool) error
SubscribeExchangeUpdate subscribes for updates of the market. Updates will be sent to dataCh. To stop subscription, send to, or close 'stop'.
func (*Bittrex) Withdraw ¶
func (b *Bittrex) Withdraw(address, currency string, quantity decimal.Decimal) (withdrawUuid string, err error)
Withdraw is used to withdraw funds from your account. address string the address where to send the funds. currency string literal for the currency (ie. BTC) quantity decimal.Decimal the quantity of coins to withdraw
type CandleTime ¶
func (*CandleTime) UnmarshalJSON ¶
func (t *CandleTime) UnmarshalJSON(b []byte) error
type Currency ¶
type Currency struct { Currency string `json:"Currency"` CurrencyLong string `json:"CurrencyLong"` MinConfirmation int `json:"MinConfirmation"` TxFee decimal.Decimal `json:"TxFee"` IsActive bool `json:"IsActive"` CoinType string `json:"CoinType"` BaseAddress string `json:"BaseAddress"` Notice string `json:"Notice"` IsRestricted bool `json:"IsRestricted"` }
type Distribution ¶
type ExchangeState ¶
type ExchangeState struct { MarketName string Nounce int Buys []OrderUpdate Sells []OrderUpdate Fills []Fill Initial bool }
ExchangeState contains fills and order book updates for a market.
type Market ¶
type Market struct { MarketCurrency string `json:"MarketCurrency"` BaseCurrency string `json:"BaseCurrency"` MarketCurrencyLong string `json:"MarketCurrencyLong"` BaseCurrencyLong string `json:"BaseCurrencyLong"` MinTradeSize decimal.Decimal `json:"MinTradeSize"` MarketName string `json:"MarketName"` IsActive bool `json:"IsActive"` IsRestricted bool `json:"IsRestricted"` Notice string `json:"Notice"` IsSponsored bool `json:"IsSponsored"` LogoUrl string `json:"LogoUrl"` Created string `json:"Created"` }
type MarketSummary ¶
type MarketSummary struct { MarketName string `json:"MarketName"` High decimal.Decimal `json:"High"` Low decimal.Decimal `json:"Low"` Ask decimal.Decimal `json:"Ask"` Bid decimal.Decimal `json:"Bid"` OpenBuyOrders int `json:"OpenBuyOrders"` OpenSellOrders int `json:"OpenSellOrders"` Volume decimal.Decimal `json:"Volume"` Last decimal.Decimal `json:"Last"` BaseVolume decimal.Decimal `json:"BaseVolume"` PrevDay decimal.Decimal `json:"PrevDay"` TimeStamp string `json:"TimeStamp"` }
type NewCandles ¶
type NewCandles struct {
Ticks []Candle `json:"ticks"`
}
type NewOrderV3 ¶
type NewOrderV3 struct { MarketSymbol string `json:"marketSymbol"` Direction string `json:"direction"` Type string `json:"type"` // LIMIT Quantity decimal.Decimal `json:"quantity"` Limit decimal.Decimal `json:"limit"` TimeInForce string `json:"timeInForce"` // GOOD_TIL_CANCELLED||IMMEDIATE_OR_CANCEL||FILL_OR_KILL||POST_ONLY_GOOD_TIL_CANCELLED||IMMEDIATE_OR_CANCEL||FILL_OR_KILL||POST_ONLY_GOOD_TIL_CANCELLED ClientOrderId *string `json:"clientOrderId"` }
type Order ¶
type Order struct { OrderUuid string `json:"OrderUuid"` Exchange string `json:"Exchange"` TimeStamp jTime `json:"TimeStamp"` OrderType string `json:"OrderType"` Limit decimal.Decimal `json:"Limit"` Quantity decimal.Decimal `json:"Quantity"` QuantityRemaining decimal.Decimal `json:"QuantityRemaining"` Commission decimal.Decimal `json:"Commission"` Price decimal.Decimal `json:"Price"` PricePerUnit decimal.Decimal `json:"PricePerUnit"` Opened string `json:"Opened,omitempty"` }
type Order2 ¶
type Order2 struct { AccountId string OrderUuid string `json:"OrderUuid"` Exchange string `json:"Exchange"` Type string `json:"OrderType"` Quantity decimal.Decimal `json:"Quantity"` QuantityRemaining decimal.Decimal `json:"QuantityRemaining"` Limit decimal.Decimal `json:"Limit"` Reserved decimal.Decimal ReserveRemaining decimal.Decimal CommissionReserved decimal.Decimal CommissionReserveRemaining decimal.Decimal CommissionPaid decimal.Decimal Price decimal.Decimal `json:"Price"` PricePerUnit decimal.Decimal `json:"PricePerUnit"` Opened string Closed string IsOpen bool Sentinel string CancelInitiated bool ImmediateOrCancel bool IsConditional bool Condition string ConditionTarget decimal.Decimal }
For getorder
type OrderUpdate ¶
type OrderV3 ¶
type OrderV3 struct { ID string `json:"id"` MarketSymbol string `json:"marketSymbol"` Direction string `json:"direction"` Type string `json:"type"` Quantity decimal.Decimal `json:"quantity"` Limit decimal.Decimal `json:"limit"` Ceiling decimal.Decimal `json:"ceiling"` TimeInForce string `json:"timeInForce"` ExpiresAt time.Time `json:"expiresAt"` ClientOrderId string `json:"clientOrderId"` FillQuantity decimal.Decimal `json:"fillQuantity"` Commission decimal.Decimal `json:"commission"` Proceeds decimal.Decimal `json:"proceeds"` Status string `json:"status"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` ClosedAt time.Time `json:"closedAt"` Error string `json:"error"` Code string `json:"code"` }
type Trade ¶
type Trade struct { OrderUuid int64 `json:"Id"` Timestamp jTime `json:"TimeStamp"` Quantity decimal.Decimal `json:"Quantity"` Price decimal.Decimal `json:"Price"` Total decimal.Decimal `json:"Total"` FillType string `json:"FillType"` OrderType string `json:"OrderType"` }
Used in getmarkethistory
type Withdrawal ¶
type Withdrawal struct { PaymentUuid string `json:"PaymentUuid"` Currency string `json:"Currency"` Amount decimal.Decimal `json:"Amount"` Address string `json:"Address"` Opened jTime `json:"Opened"` Authorized bool `json:"Authorized"` PendingPayment bool `json:"PendingPayment"` TxCost decimal.Decimal `json:"TxCost"` TxId string `json:"TxId"` Canceled bool `json:"Canceled"` }