-
Notifications
You must be signed in to change notification settings - Fork 12
Public API
This section describes how to use functions which implement Bittrex Public API
Checks if Bittrex servers are reachable by the client, returns an error if any encountered during the request.
func IsAPIAlive() error
// You can check as follows
err := bittrex.IsAPIAlive()
if err != nil {
// Something has gone wrong, Servers are not reachable.
return // or return err, it depends if you need the error.
}
// Servers are reachable
Returns the version of the API on the Bittrex servers.
func GetServerAPIVersion() (string, error)
// You can check as follows
version, err := bittrex.GetServerAPIVersion()
if err != nil {
// Something has gone wrong, Servers are not reachable.
return // or return err, it depends if you need the error.
}
fmt.Println("VERSION: ", version)
Returns current BTC Price as shown from Bittrex API (which rely on a third-party service)
func GetBTCPrice() (*BTCPrice, error)
// Example
BTCPrice, err := bittrex.GetServerAPIVersion()
if err != nil {
// Something has gone wrong, Servers are not reachable.
return // or return err, it depends if you need the error.
}
fmt.Printf("BTC PRICE AT TIMESTAMP %s = %f.2 USD\n",
BTCPrice.Timestamp, BTCPrice.USDValue)
Gets the full summaries from all markets.
func GetMarketSummaries() (MarketSummaries, error)
// Example
summaries, err := bittrex.GetMarketSummaries()
if err != nil {
// Something has gone wrong, Servers are not reachable.
return // or return err, it depends if you need the error.
}
for _, summary := range summaries {
fmt.Println("SUMMARY: ", summary) // Print summary data, DON'T DO THIS
// until a String() method is implemented
// for this type from devs.for this type
// from devs.
}
type MarketSummary struct {
MarketName string
High float64
Low float64
Last float64
Bid float64
Ask float64
Volume float64
BaseVolume float64
Timestamp string
OpenBuyOrders uint64
OpenSellOrders uint64
PrevDay float64
Created string
}
type MarketSummaries []MarketSummary
Gets the summary data from a specified market.
func GetMarketSummary() (*MarketSummary, error)
// Example
summary, err := bittrex.GetMarketSummary("BTC-ETH")
if err != nil {
// Something has gone wrong, Servers are not reachable.
return // or return err, it depends if you need the error.
}
fmt.Println("SUMMARY: ", summary) // Print summary data, DON'T DO THIS
// until a String() method is implemented
// for this type from devs.for this type
// from devs.
Returns the full data of all markets.
func GetMarkets() (Markets, error)
// Example
markets, err := bittrex.GetMarkets()
if err != nil {
// Something has gone wrong, Servers are not reachable.
return // or return err, it depends if you need the error.
}
for _, market := range markets {
fmt.Println("SUMMARY: ", market) // Print market data, DON'T DO THIS
// until a String() method is implemented
// for this type from devs.
}
Gets all candlesticks (ticks) to create a market’s candlestick chart.
func GetTicks() (Candlesticks, error)
// Example
candles, err := bittrex.GetTicks()
if err != nil {
// Something has gone wrong, Servers are not reachable.
return // or return err, it depends if you need the error.
}
for _, candle := range candles {
fmt.Println("CANDLE: ", candle) // Print candle data, DON'T DO THIS
// until a String() method is implemented
// for this type from devs.
}
Gets latest candlestick (tick) to create a market’s candlestick chart.
func GetLatestTick() (*Candlestick, error)
// Example
candle, err := bittrex.GetLatestTick()
if err != nil {
// Something has gone wrong, Servers are not reachable.
return // or return err, it depends if you need the error.
}
fmt.Println("CANDLE: ", candle) // Print candle data, DON'T DO THIS
// until a String() method is implemented
// for this type from devs.
If GetLatestTick
is called with a oneMin
interval every minute, it provides two minutes charts. Refer to THIS ISSUE for clarity.
Golang Bittrex API v2.0.
This wiki has been provided to you by The Bot Guy <[email protected]>
Please check out the license (GPLv3) and respect it.