Documentation ¶
Overview ¶
Package bittrex is an implementation of the Biitrex API in Golang.
Index ¶
- Constants
- type Bittrex
- func (b *Bittrex) Authentication(c *signalr.Client) error
- func (b *Bittrex) GetCandles(marketSymbol string, candleInterval string) (candles []Candle, err error)
- func (b *Bittrex) GetCandlesHistory(marketSymbol string, candleInterval string, year int) (candles []Candle, err error)
- func (b *Bittrex) GetCandlesHistoryWithOpts(marketSymbol string, candleInterval string, year int, ...) (candles []Candle, err error)
- func (b *Bittrex) GetCandlesWithOpts(marketSymbol string, candleInterval string, opts *GetCandlesOpts) (candles []Candle, err error)
- func (b *Bittrex) GetCurrencies() (currencies []Currency, err error)
- func (b *Bittrex) GetCurrency(symbol string) (currency Currency, err error)
- func (b *Bittrex) GetMarket(marketSymbol string) (market Market, err error)
- func (b *Bittrex) GetMarkets() (markets []Market, err error)
- func (b *Bittrex) GetMarketsSummaries() (marketSummaries []MarketSummary, err error)
- func (b *Bittrex) GetMarketsTickers() (marketTickers []Ticker, err error)
- func (b *Bittrex) GetOrderBook(marketSymbol string) (orderBook OrderBook, err error)
- func (b *Bittrex) GetOrderBookWithOpts(marketSymbol string, opts *GetOrderBookOpts) (orderBook OrderBook, err error)
- func (b *Bittrex) GetSummary(marketSymbol string) (marketSummary MarketSummary, err error)
- func (b *Bittrex) GetTicker(marketSymbol string) (ticker Ticker, err error)
- func (b *Bittrex) GetTrades(marketSymbol string) (trades []Trade, err error)
- func (b *Bittrex) Ping() (serverTime int64, err error)
- func (b *Bittrex) SetDebug(enable bool)
- func (b *Bittrex) SubscribeCandleUpdates(market string, candles chan<- Candle, stop <-chan bool) error
- func (b *Bittrex) SubscribeCandleUpdatesWithOpts(market string, candleInterval string, candles chan<- Candle, stop <-chan bool) error
- func (b *Bittrex) SubscribeMarketSummariesUpdates(marketSummaries chan<- MarketSummary, stop <-chan bool) error
- func (b *Bittrex) SubscribeMarketSummaryUpdates(market string, marketSummaries chan<- MarketSummary, stop <-chan bool) error
- func (b *Bittrex) SubscribeOrderbookUpdates(marketSymbol string, orderbooks chan<- OrderBook, stop <-chan bool) error
- func (b *Bittrex) SubscribeOrderbookUpdatesWithOpts(marketSymbol string, depth int, orderbooks chan<- OrderBook, stop <-chan bool) error
- func (b *Bittrex) SubscribeTickerUpdates(marketSymbol string, tickers chan<- Ticker, stop <-chan bool) error
- func (b *Bittrex) SubscribeTickersUpdates(tickers chan<- Ticker, stop <-chan bool) error
- func (b *Bittrex) SubscribeTradeUpdates(marketSymbol string, trades chan<- Trade, stop <-chan bool) error
- type Candle
- type CandleSlice
- type Client
- type Currency
- type GetCandlesHistoryOpts
- type GetCandlesOpts
- type GetOrderBookOpts
- type Market
- type MarketSummary
- type MarketSummarySlice
- type Order
- type OrderBook
- type OrderBookSlice
- type Ping
- type Response
- type Ticker
- type TickerSlice
- type Trade
- type TradeSlice
Constants ¶
const ( API_BASE = "https://api.bittrex.com/" // HTTP API endpoint API_VERSION = "v3" // API version )
const ( CANDLETYPE_TRADE = "TRADE" CANDLETYPE_MIDPOINT = "MIDPOINT" INTERVAL_DAY1 = "DAY_1" INTERVAL_HOUR1 = "HOUR_1" INTERVAL_MINUTE5 = "MINUTE_5" INTERVAL_MINUTE1 = "MINUTE_1" )
const ( WS_BASE = "socket-v3.bittrex.com" // WS API endpoint WS_HUB = "C3" // SignalR main hub STREAM_CANDLE = "candle" STREAM_ORDERBOOK = "orderBook" STREAM_TICKER = "ticker" STREAM_TICKERS = "tickers" STREAM_MARKETSUMMARIES = "marketSummaries" STREAM_MARKETSUMMARY = "marketSummary" STREAM_ORDER = "order" STREAM_TRADE = "trade" STREAM_HEARTBEAT = "heartbeat" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bittrex ¶
type Bittrex struct {
// contains filtered or unexported fields
}
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 ¶
Some streams contain private data and require that you be authenticated prior to subscribing.
func (*Bittrex) GetCandles ¶ added in v0.1.4
func (b *Bittrex) GetCandles(marketSymbol string, candleInterval string) (candles []Candle, err error)
Retrieve recent candles for a specific market and candle interval.
The maximum age of the returned candles depends on the interval as follows: (MINUTE_1: 1 day, MINUTE_5: 1 day, HOUR_1: 31 days, DAY_1: 366 days). Candles for intervals without any trading activity will match the previous close and volume will be zero.
func (*Bittrex) GetCandlesHistory ¶ added in v0.1.4
func (b *Bittrex) GetCandlesHistory(marketSymbol string, candleInterval string, year int) (candles []Candle, err error)
Retrieve recent candles for a specific market and candle interval.
The date range of returned candles depends on the interval as follows: (MINUTE_1: 1 day, MINUTE_5: 1 day, HOUR_1: 31 days, DAY_1: 366 days). Candles for intervals without any trading activity will match the previous close and volume will be zero.
func (*Bittrex) GetCandlesHistoryWithOpts ¶ added in v0.1.4
func (b *Bittrex) GetCandlesHistoryWithOpts(marketSymbol string, candleInterval string, year int, opts *GetCandlesHistoryOpts) (candles []Candle, err error)
Retrieve recent candles for a specific market and candle interval.
The date range of returned candles depends on the interval as follows: (MINUTE_1: 1 day, MINUTE_5: 1 day, HOUR_1: 31 days, DAY_1: 366 days). Candles for intervals without any trading activity will match the previous close and volume will be zero.
func (*Bittrex) GetCandlesWithOpts ¶ added in v0.1.4
func (b *Bittrex) GetCandlesWithOpts(marketSymbol string, candleInterval string, opts *GetCandlesOpts) (candles []Candle, err error)
Retrieve recent candles for a specific market and candle interval.
The maximum age of the returned candles depends on the interval as follows: (MINUTE_1: 1 day, MINUTE_5: 1 day, HOUR_1: 31 days, DAY_1: 366 days). Candles for intervals without any trading activity will match the previous close and volume will be zero.
func (*Bittrex) GetCurrencies ¶ added in v0.1.4
List currencies.
func (*Bittrex) GetCurrency ¶
Retrieve info on a specified currency.
func (*Bittrex) GetMarkets ¶
List markets.
func (*Bittrex) GetMarketsSummaries ¶ added in v0.1.4
func (b *Bittrex) GetMarketsSummaries() (marketSummaries []MarketSummary, err error)
List summaries of the last 24 hours of activity for all markets.
func (*Bittrex) GetMarketsTickers ¶ added in v0.1.4
List tickers for all markets.
func (*Bittrex) GetOrderBook ¶ added in v0.1.4
Retrieve the order book for a specific market.
func (*Bittrex) GetOrderBookWithOpts ¶ added in v0.1.4
func (b *Bittrex) GetOrderBookWithOpts(marketSymbol string, opts *GetOrderBookOpts) (orderBook OrderBook, err error)
Retrieve the order book for a specific market.
func (*Bittrex) GetSummary ¶ added in v0.1.4
func (b *Bittrex) GetSummary(marketSymbol string) (marketSummary MarketSummary, err error)
Retrieve summary of the last 24 hours of activity for a specific market.
func (*Bittrex) SubscribeCandleUpdates ¶ added in v0.1.5
func (b *Bittrex) SubscribeCandleUpdates(market string, candles chan<- Candle, stop <-chan bool) error
Sends a message at the start of each candle (based on the subscribed interval) and when trades have occurred on the market.
Note that this means on an active market you will receive many updates over the course of each candle interval as trades occur. You will always receive an update at the start of each interval. If no trades occurred yet, this update will be a 0-volume placeholder that carries forward the Close of the previous interval as the current interval's OHLC values.
func (*Bittrex) SubscribeCandleUpdatesWithOpts ¶ added in v0.1.5
func (b *Bittrex) SubscribeCandleUpdatesWithOpts(market string, candleInterval string, candles chan<- Candle, stop <-chan bool) error
Sends a message at the start of each candle (based on the subscribed interval) and when trades have occurred on the market.
Note that this means on an active market you will receive many updates over the course of each candle interval as trades occur. You will always receive an update at the start of each interval. If no trades occurred yet, this update will be a 0-volume placeholder that carries forward the Close of the previous interval as the current interval's OHLC values.
func (*Bittrex) SubscribeMarketSummariesUpdates ¶ added in v0.1.5
func (b *Bittrex) SubscribeMarketSummariesUpdates(marketSummaries chan<- MarketSummary, stop <-chan bool) error
Provides regular updates of the current market summary data for all markets.
Market summary data is different from candles in that it is a rolling 24-hour number as opposed to data for a fixed interval like candles.
func (*Bittrex) SubscribeMarketSummaryUpdates ¶ added in v0.1.5
func (b *Bittrex) SubscribeMarketSummaryUpdates(market string, marketSummaries chan<- MarketSummary, stop <-chan bool) error
Provides regular updates of the current market summary data for a given market.
Market summary data is different from candles in that it is a rolling 24-hour number as opposed to data for a fixed interval like candles.
func (*Bittrex) SubscribeOrderbookUpdates ¶ added in v0.1.4
func (b *Bittrex) SubscribeOrderbookUpdates(marketSymbol string, orderbooks chan<- OrderBook, stop <-chan bool) error
Sends a message when there are changes to the order book within the subscribed depth.
func (*Bittrex) SubscribeOrderbookUpdatesWithOpts ¶ added in v0.1.5
func (b *Bittrex) SubscribeOrderbookUpdatesWithOpts(marketSymbol string, depth int, orderbooks chan<- OrderBook, stop <-chan bool) error
Sends a message when there are changes to the order book within the subscribed depth.
func (*Bittrex) SubscribeTickerUpdates ¶ added in v0.1.4
func (b *Bittrex) SubscribeTickerUpdates(marketSymbol string, tickers chan<- Ticker, stop <-chan bool) error
Sends a message with the best bid and ask price for the given market as well as the last trade price whenever there is a relevant change to the order book or a trade.
func (*Bittrex) SubscribeTickersUpdates ¶ added in v0.1.5
Sends a message with the best bid price, best ask price, and last trade price for all markets as there are changes to the order book or trades.
type Candle ¶ added in v0.1.4
type Candle struct { MarketSymbol string Interval string StartsAt time.Time `json:"startsAt"` Open decimal.Decimal `json:"open"` High decimal.Decimal `json:"high"` Low decimal.Decimal `json:"low"` Close decimal.Decimal `json:"close"` Volume decimal.Decimal `json:"volume"` QuoteVolume decimal.Decimal `json:"quoteVolume"` }
type CandleSlice ¶ added in v0.1.5
type CandleSlice struct { Sequence int `json:"sequence"` MarketSymbol string `json:"marketSymbol"` Interval string `json:"interval"` Delta struct { StartsAt time.Time `json:"startsAt"` Open decimal.Decimal `json:"open"` High decimal.Decimal `json:"high"` Low decimal.Decimal `json:"low"` Close decimal.Decimal `json:"close"` Volume decimal.Decimal `json:"volume"` QuoteVolume decimal.Decimal `json:"quoteVolume"` } }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientWithCustomHTTPConfig ¶
NewClientWithCustomHTTPConfig returns a new Bittrex HTTP client using the predefined http client
type Currency ¶
type Currency struct { Symbol string `json:"symbol"` Name string `json:"name"` CoinType string `json:"coinType"` Status string `json:"status"` MinConfirmations int `json:"minConfirmations"` Notice string `json:"notice"` TxFee string `json:"txFee"` LogoURL string `json:"logoUrl"` ProhibitedIn []interface{} `json:"prohibitedIn"` BaseAddress string `json:"baseAddress"` AssociatedTermsOfService []interface{} `json:"associatedTermsOfService"` Tags []interface{} `json:"tags"` }
type GetCandlesHistoryOpts ¶ added in v0.1.4
type GetCandlesOpts ¶ added in v0.1.4
type GetCandlesOpts struct {
CandleType string
}
type GetOrderBookOpts ¶ added in v0.1.4
type GetOrderBookOpts struct {
Depth int
}
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 time.Time `json:"createdAt"` ProhibitedIn []string `json:"prohibitedIn"` AssociatedTermsOfService []string `json:"associatedTermsOfService"` Tags []string `json:"tags"` }
type MarketSummary ¶ added in v0.1.4
type MarketSummary struct { Symbol string `json:"symbol"` High decimal.Decimal `json:"high"` Low decimal.Decimal `json:"low"` Volume decimal.Decimal `json:"volume"` QuoteVolume decimal.Decimal `json:"quoteVolume"` PercentChange decimal.Decimal `json:"percentChange"` UpdatedAt time.Time `json:"updatedAt"` }
type MarketSummarySlice ¶ added in v0.1.5
type MarketSummarySlice struct { Sequence int `json:"sequence"` Deltas []struct { Symbol string `json:"symbol"` High decimal.Decimal `json:"high"` Low decimal.Decimal `json:"low"` Volume decimal.Decimal `json:"volume"` QuoteVolume decimal.Decimal `json:"quoteVolume"` PercentChange decimal.Decimal `json:"percentChange"` UpdatedAt time.Time `json:"updatedAt"` } }
type OrderBookSlice ¶ added in v0.1.4
type Response ¶ added in v0.1.4
type Response struct { Success bool `json:"Success"` ErrorCode interface{} `json:"ErrorCode"` }
type TickerSlice ¶ added in v0.1.5
type TradeSlice ¶
type TradeSlice 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"` }