bittrex

package
v0.0.0-...-27a8629 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2021 License: Apache-2.0 Imports: 10 Imported by: 16

Documentation

Index

Constants

View Source
const (
	BaseURL    = "https://bittrex.com/api"
	Private    = "auth"
	Public     = "pub"
	APIVersion = "2.0"
)

BaseURL represents the base URL for all requests

Variables

View Source
var CandleIntervals = map[string]bool{
	"oneMin":    true,
	"fiveMin":   true,
	"thirtyMin": true,
	"hour":      true,
	"day":       true,
}

CandleIntervals represent all valid intervals supported by the GetTicks and GetLatestTick calls.

Functions

func IsAPIAlive

func IsAPIAlive() error

IsAPIAlive returns true if the bittrex api is reachable with the current network connection.

func SetCustomHTTPClient

func SetCustomHTTPClient(value http.Client)

SetCustomHTTPClient sets a custom client for requests.

Types

type Auth

type Auth struct {
	PublicKey  string // The public key to connect to bittrex API.
	PrivateKey string // The private key to connect to bittrex API.
}

Auth represents the auth credentials to authenticate to the Bittrex API:

It consists of a set of a private and a public key.

type BTCPrice

type BTCPrice struct {
	USDValue  decimal.Decimal
	Timestamp time.Time
}

BTCPrice represents the BTC price at the specified timestamp.

func GetBTCPrice

func GetBTCPrice() (*BTCPrice, error)

GetBTCPrice returns the current BTC Price.

type CandleStick

type CandleStick struct {
	High       decimal.Decimal `json:"H,required"`
	Open       decimal.Decimal `json:"O,required"`
	Close      decimal.Decimal `json:"C,required"`
	Low        decimal.Decimal `json:"L,required"`
	Volume     decimal.Decimal `json:"V,required"`
	BaseVolume decimal.Decimal `json:"BV,required"`
	Timestamp  candleTime      `json:"T,required"`
}

CandleStick represents a single candlestick in a chart.

func GetLatestTick

func GetLatestTick(marketName, tickInterval string) (*CandleStick, error)

GetLatestTick returns the latest tick of the specified market's candlestick chart, following the specified tick interval.

type CandleSticks

type CandleSticks []CandleStick

CandleSticks is an array of CandleStick objects. It is a result from GetTicks and GetLatestTick calls too.

func GetTicks

func GetTicks(marketName, tickInterval string) (CandleSticks, error)

GetTicks returns the ticks of the specified market's candlestick chart, following the specified tick interval.

type Market

type Market struct {
	BaseCurrency       string          `json:"BaseCurrency,required"`
	BaseCurrencyLong   string          `json:"BaseCurrencyLong,required"`
	MarketCurrency     string          `json:"MarketCurrency,required"`
	MarketCurrencyLong string          `json:"MarketCurrencyLong,required"`
	MarketName         string          `json:"MarketName,required"`
	MinTradeSize       decimal.Decimal `json:"MinTradeSize,required"`
	IsActive           bool            `json:"IsActive,required"`
	Created            string          `json:"Created,required"`
	Notice             string          `json:"Notice,required"`
	IsSponsored        bool            `json:"IsSponsored,required"`
	LogoURL            string          `json:"LogoUrl,required"`
}

Market represents a market metadata (name, base currency, trade currency) and so forth.

type MarketSummaries

type MarketSummaries []MarketSummary

MarketSummaries is a set of MarketSummary objects.

func GetMarketSummaries

func GetMarketSummaries() (MarketSummaries, error)

GetMarketSummaries gets the summary of all markets.

type MarketSummariesResult

type MarketSummariesResult []MarketSummaryResult

MarketSummariesResult is the response from a GetSummaries call.

func (MarketSummariesResult) Markets

func (msr MarketSummariesResult) Markets() Markets

Markets returns only the markets.

func (MarketSummariesResult) Summaries

func (msr MarketSummariesResult) Summaries() MarketSummaries

Summaries returns only the market summaries.

type MarketSummary

type MarketSummary struct {
	MarketName     string          `json:"MarketName,required"`     //The name of the market (e.g. BTC-ETH).
	High           decimal.Decimal `json:"High,required"`           // The 24h high for the market.
	Low            decimal.Decimal `json:"Low,required"`            // The 24h low for the market.
	Last           decimal.Decimal `json:"Last,required"`           // The value of the last trade for the market (in base currency).
	Bid            decimal.Decimal `json:"Bid,required"`            // The current highest bid value for the market.
	Ask            decimal.Decimal `json:"Ask,required"`            // The current lowest ask value for the market.
	Volume         decimal.Decimal `json:"Volume,required"`         // The 24h volume of the market, in market currency.
	BaseVolume     decimal.Decimal `json:"BaseVolume,required"`     // The 24h volume for the market, in base currency.
	Timestamp      string          `json:"Timestamp,required"`      // The timestamp of the request.
	OpenBuyOrders  uint64          `json:"OpenBuyOrders,required"`  // The number of currently open buy orders.
	OpenSellOrders uint64          `json:"OpenSellOrders,required"` // The number of currently open sell orders.
	PrevDay        decimal.Decimal `json:"PrevDay,required"`        // The closing price 24h before.
	Created        string          `json:"Created,required"`        // The timestamp of the creation of the market.
}

MarketSummary is the summary data of a market (usually 24h summary).

func GetMarketSummary

func GetMarketSummary(marketName string) (*MarketSummary, error)

GetMarketSummary gets the summary of a single market.

type MarketSummaryResult

type MarketSummaryResult struct {
	IsVerified bool          `json:"IsVerified"`
	Market     Market        `json:"Market,required"`
	Summary    MarketSummary `json:"Summary,required"`
}

MarketSummaryResult is a single unit of a MarketSummariesResult response and represents a single couple (Market Data, Market Summary) value.

type Markets

type Markets []Market

Markets is a set of markets.

func GetMarkets

func GetMarkets() (Markets, error)

GetMarkets gets all markets data.

type OpenOrder

type OpenOrder struct {
}

OpenOrder represents a currently open order.

type OrderBook

type OrderBook []OpenOrder

OrderBook represents a set of public open Orders, which compose the OrderBook.

func GetOrderBook

func GetOrderBook(marketName string) (OrderBook, error)

GetOrderBook gets the current order book, made up by currently open orders.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL