tickers

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: GPL-2.0, GPL-3.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BinanceReq = "https://api.binance.com/api/v1/ticker/price?symbol=XLMUSDT"

BinanceReq is the binance ticker from the API

View Source
var BinanceVol = "https://api.binance.com/api/v1/ticker/24hr?symbol=XLMUSDT"

BinanceVol is the binance ticker from the API

View Source
var CoinbaseReq = "https://api.pro.coinbase.com/products/XLM-USD/ticker"

CoinbaseReq is the coinbase ticker from the API

View Source
var KrakenReq = "https://api.kraken.com/0/public/Ticker?pair=XLMUSD"

KrakenReq is the kraken ticker from the API

Functions

func BinanceTicker

func BinanceTicker() (float64, error)

BinanceTicker gets price data from Binance

func BinanceVolume

func BinanceVolume() (float64, error)

BinanceVolume gets volume data from Binance

func CoinbaseTicker

func CoinbaseTicker() (float64, error)

CoinbaseTicker gets ticker data from coinbase

func CoinbaseVolume

func CoinbaseVolume() (float64, error)

CoinbaseVolume gets volume data from coinbase

func ExchangeXLMforUSD

func ExchangeXLMforUSD(amount float64) float64

ExchangeXLMforUSD retrieves the current price of XLM/USD and then returns the USD amount

func KrakenTicker

func KrakenTicker() (float64, error)

KrakenTicker gets ticker data from kraken

func KrakenVolume

func KrakenVolume() (float64, error)

KrakenVolume gets volume data from kraken

func XLMUSD

func XLMUSD() (float64, error)

XLMUSD returns aggregated XLMUSD ticker data

Types

type BinanceTickerResponse

type BinanceTickerResponse struct {
	Symbol string `json:"symbol"`
	Price  string `json:"price"`
}

BinanceTickerResponse defines the ticker API response from Binanace

type BinanceVolumeResponse

type BinanceVolumeResponse struct {
	// there are other fields as well, but we ignore them for now
	Symbol string `json:"symbol"`
	Volume string `json:"volume"`
}

BinanceVolumeResponse defines the structure of binance's volume endpoint response

type CoinbaseTickerResponse

type CoinbaseTickerResponse struct {
	TradeId int    `json:"trade_id"`
	Price   string `json:"price"`
	Volume  string `json:"volume"`
}

CoinbaseTickerResponse defines the structure of coinbase's ticker endpoitt response

type KrakenTickerResponse

type KrakenTickerResponse struct {
	Error  []string `json:"error"`
	Result struct {
		XXLMZUSD struct {
			// there's some additional info here but we don't require that
			C []string // c = last trade closed array(<price>, <lot volume>),
			V []string // volume array(<today>, <last 24 hours>)
		}
	}
}

KrakenTickerResponse defines the structure of kraken's ticker response

Jump to

Keyboard shortcuts

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