Documentation
¶
Overview ¶
Package bittrex is an implementation of the Biitrex API in Golang.
Index ¶
- Constants
- Variables
- type Address
- type Balance
- type BalanceD
- type Bittrex
- func (b *Bittrex) Authentication(c *signalr.Client) error
- func (b *Bittrex) CancelOrder(orderID string) (respone []byte, err error)
- func (b *Bittrex) GetBalances() (balances []Balance, err error)
- func (b *Bittrex) GetMarkets() (markets []Market, err error)
- func (b *Bittrex) GetOpenOrders(market string) (openOrders []Order, err error)
- func (b *Bittrex) GetOrder(orderUUID string) (order Order, err error)
- func (b *Bittrex) GetOrderBook(book *OrderBook) (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) NewOrder(order NewOrder) (response []byte, err error)
- func (b *Bittrex) SetDebug(enable bool)
- func (b *Bittrex) SubscribeOrderUpdates(dataCh chan<- OrderUpdate) error
- func (b *Bittrex) SubscribeOrderbookUpdates(market string, orderbook chan<- OrderBook, stop chan bool) error
- func (b *Bittrex) SubscribeTickerUpdates(market string, quotes chan<- Quote) error
- type Client
- type Currency
- type Deposit
- type Distribution
- type Market
- type MarketSummary
- type NewOrder
- type Order
- type OrderBook
- type OrderBook2
- type OrderDelta
- type OrderUpdate
- type Quote
- type Responce
- type Ticker
- type Trade
- type TradeUpdate
Constants ¶
const ( //APIBASE Bittrex API endpoint APIBASE = "https://api.bittrex.com/" //APIVERSION api version APIVERSION = "v3" //WSBASE Bittrex WS API endpoint WSBASE = "socket-v3.bittrex.com" //WSHUB SignalR main hub WSHUB = "C3" //ORDERBOOK const ORDERBOOK = "orderBook" //TICKER const TICKER = "ticker" //ORDER const ORDER = "order" //TRADE const TRADE = "trade" //HEARTBEAT const HEARTBEAT = "heartbeat" //AUTHEXPIRED const AUTHEXPIRED = "authenticationExpiring" )
const TIMEFORMAT = "2006-01-02T15:04:05.999Z"
TIMEFORMAT const
Variables ¶
var CANDLEINTERVALS = map[string]bool{ "oneMin": true, "fiveMin": true, "thirtyMin": true, "hour": true, "day": true, }
CANDLEINTERVALS variable
Functions ¶
This section is empty.
Types ¶
type Balance ¶
type Balance struct {
CurrencySymbol string `json:"currencySymbol"`
Total decimal.Decimal `json:"total"`
Available decimal.Decimal `json:"available"`
UpdatedAt *jTime `json:"updatedAt"`
}
Balance struct
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) Authentication ¶
Authentication func
func (*Bittrex) CancelOrder ¶
CancelOrder is used to cancel a buy or sell order.
func (*Bittrex) GetBalances ¶
GetBalances is used to retrieve all balances from your account
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.
func (*Bittrex) GetOrderBook ¶
GetOrderBook is used to get the current orderbook values for a market.
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) SubscribeOrderUpdates ¶
func (b *Bittrex) SubscribeOrderUpdates(dataCh chan<- OrderUpdate) error
SubscribeOrderUpdates func
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client struct
func NewClientWithCustomHTTPConfig ¶
NewClientWithCustomHTTPConfig returns a new Bittrex HTTP client using the predefined http client
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"`
}
Currency struct
type Deposit ¶
type Deposit struct {
ID int64 `json:"Id"`
Amount decimal.Decimal `json:"Amount"`
Currency string `json:"Currency"`
Confirmations int `json:"Confirmations"`
LastUpdated jTime `json:"LastUpdated"`
TxID string `json:"TxId"`
CryptoAddress string `json:"CryptoAddress"`
}
Deposit struct
type Distribution ¶
type Distribution struct {
Distribution []BalanceD `json:"Distribution"`
Balances decimal.Decimal `json:"Balances"`
AverageBalance decimal.Decimal `json:"AverageBalance"`
}
Distribution struct
type Market ¶
type Market struct {
Symbol string `json:"symbol"`
BaseCurrencySymbol string `json:"baseCurrencySymbol"`
QuoteCurrencySymbol string `json:"quoteCurrencySymbol"`
MinTradeSize decimal.Decimal `json:"minTradeSize"`
Precision int `json:"precision"`
Status string `json:"status"`
CreatedAt jTime `json:"createdAt"`
Notice string `json:"notice"`
ProhibitedIn []string `json:"prohibitedIn"`
}
Market struct
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"`
}
MarketSummary struct
type NewOrder ¶
type NewOrder struct {
MarketSymbol string `json:"marketSymbol"`
Direction string `json:"direction"`
Type string `json:"type"`
Quantity string `json:"quantity"`
Ceiling string `json:"ceiling,omitempty"`
Limit string `json:"limit,omitempty"`
TimeInForce string `json:"timeInForce"`
ClientOrderID string `json:"clientOrderId,omitempty"`
UseAwards bool `json:"useAwards"`
}
NewOrder struct
type Order ¶
type Order 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"`
ClientOrderID string `json:"clientOrderId"`
FillQuantity decimal.Decimal `json:"fillQuantity"`
Commission decimal.Decimal `json:"commission"`
Proceeds decimal.Decimal `json:"proceeds"`
Status string `json:"status"`
CreatedAt jTime `json:"createdAt"`
UpdatedAt *jTime `json:"updatedAt"`
ClosedAt *jTime `json:"closedAt"`
OrderToCancel struct {
Type string `json:"type"`
ID string `json:"id"`
} `json:"orderToCancel"`
}
Order struct
type OrderBook ¶
type OrderBook struct {
MarketSymbol string `json:"marketSymbol"`
Depth int `json:"depth"`
Sequence int `json:"sequence"`
BidDeltas []OrderDelta `json:"bidDeltas"`
AskDeltas []OrderDelta `json:"askDeltas"`
}
OrderBook struct
type OrderBook2 ¶
type OrderBook2 struct {
BidDeltas []OrderDelta `json:"bid"`
AskDeltas []OrderDelta `json:"ask"`
}
OrderBook2 struct
type OrderDelta ¶
type OrderDelta struct {
Quantity decimal.Decimal `json:"quantity"`
Rate decimal.Decimal `json:"rate"`
}
OrderDelta struct
type OrderUpdate ¶
type OrderUpdate struct {
AccountID string `json:"accountId"`
Sequence int `json:"sequence"`
Delta struct {
ID string `json:"id"`
MarketSymbol string `json:"marketSymbol"`
Direction string `json:"direction"`
Type string `json:"type"`
Quantity string `json:"quantity"`
Limit string `json:"limit"`
TimeInForce string `json:"timeInForce"`
FillQuantity string `json:"fillQuantity"`
Commission string `json:"commission"`
Proceeds string `json:"proceeds"`
Status string `json:"status"`
CreatedAt jTime `json:"createdAt"`
UpdatedAt *jTime `json:"updatedAt"`
ClosedAt *jTime `json:"closedAt"`
} `json:"delta"`
}
OrderUpdate struct
type Responce ¶
type Responce struct {
Success bool `json:"Success"`
ErrorCode interface{} `json:"ErrorCode"`
}
Responce struct
type Ticker ¶
type Ticker struct {
Symbol string
LastTradeRate decimal.Decimal `json:"lastTradeRate"`
BidRate decimal.Decimal `json:"bidRate"`
AskRate decimal.Decimal `json:"askRate"`
}
Ticker struct
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"`
}
Trade Used in getmarkethistory
type TradeUpdate ¶
type TradeUpdate struct {
Deltas []struct {
ID string `json:"id"`
ExecutedAt time.Time `json:"executedAt"`
Quantity decimal.Decimal `json:"quantity"`
Rate decimal.Decimal `json:"rate"`
TakerSide string `json:"takerSide"`
} `json:"deltas"`
Sequence int `json:"sequence"`
MarketSymbol string `json:"marketSymbol"`
}
