cryptowatch

package module
v0.0.0-...-e09f8c9 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

README

rest-cryptowatch

GO implementation for cryptowatch REST API

Documentation

Index

Constants

View Source
const (
	Bitfinex    = "bitfinex"
	CoinbasePro = "coinbase-pro"
	Bitstamp    = "bitstamp"
	Kraken      = "kraken"
	CEXIO       = "cexio"
	Gemini      = "gemini"
	Quoine      = "quoine"
	Liquid      = "liquid"

	OKCoin        = "okcoin"
	BitMEX        = "bitmex"
	Huobi         = "huobi"
	Luno          = "luno"
	Poloniex      = "poloniex"
	Bisq          = "bisq"
	Bithumb       = "bithumb"
	Bittrex       = "bittrex"
	Binance       = "binance"
	BitBay        = "bitbay"
	Okex          = "okex"
	Coinone       = "coinone"
	HitBTC        = "hitbtc"
	BitZ          = "bitz"
	Gateio        = "gateio"
	BinanceUS     = "binance-us"
	KrakenFutures = "kraken-futures"
	DEXAggregated = "dex-aggregated"
	FTX           = "ftx"
	Deribit       = "deribit"
)

List of supported exchanges.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset struct {
	ID     int    `json:"id"`
	Symbol string `json:"symbol"`
	Name   string `json:"name"`
	Fiat   bool   `json:"fiat"`
	Route  string `json:"route"`
}

Asset is something that is traded, like a crypto or fiat currency.

type AssetDetail

type AssetDetail struct {
	ID     int    `json:"id"`
	Symbol string `json:"symbol"`
	Name   string `json:"name"`
	// Fiat is true when the asset is fiat currency (such as usd, and false when it is a cryptocurrency.
	Fiat    bool `json:"fiat"`
	Markets struct {
		Base []struct {
			ID       int    `json:"id"`
			Exchange string `json:"exchange"`
			Pair     string `json:"pair"`
			Active   bool   `json:"active"`
			Route    string `json:"route"`
		} `json:"base"`
		Quote []struct {
			ID       int    `json:"id"`
			Exchange string `json:"exchange"`
			Pair     string `json:"pair"`
			Active   bool   `json:"active"`
			Route    string `json:"route"`
		} `json:"quote"`
	} `json:"markets"`
}

AssetDetail holds information about an asset.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client for cryptowatch API.

func NewClient

func NewClient() *Client

NewClient returns a new instance of Client.

func (*Client) GetAssetBySymbol

func (c *Client) GetAssetBySymbol(ctx context.Context, symbol string, opts ...Option) (AssetDetail, error)

GetAssetBySymbol returns an asset details.

func (*Client) GetPairDetail

func (c *Client) GetPairDetail(ctx context.Context, pair string, opts ...Option) (PairDetail, error)

GetPairDetail returns the detail of a pair.

func (*Client) GetPrice

func (c *Client) GetPrice(ctx context.Context, exchange, pair string, opts ...Option) (float64, error)

GetPrice returns the price of a pair in the given exchange.

func (*Client) ListAssets

func (c *Client) ListAssets(ctx context.Context, opts ...Option) ([]Asset, error)

ListAssets returns all assets.

func (*Client) ListExchangeDetails

func (c *Client) ListExchangeDetails(ctx context.Context, exchange string, opts ...Option) (ExchangeDetail, error)

ListExchangeDetails returns details of given exchange.

func (*Client) ListExchangeMarkets

func (c *Client) ListExchangeMarkets(ctx context.Context, exchange string, opts ...Option) ([]Market, error)

ListExchangeMarkets returns markets associated with an exchange.

func (*Client) ListExchanges

func (c *Client) ListExchanges(ctx context.Context, opts ...Option) ([]Exchange, error)

ListExchanges list all exchanges.

func (*Client) ListMarketDetails

func (c *Client) ListMarketDetails(ctx context.Context, exchange, pair string, opts ...Option) (MarketDetails, error)

ListMarketDetails returns markets associated with an exchange.

func (*Client) ListMarkets

func (c *Client) ListMarkets(ctx context.Context, opts ...Option) ([]Market, error)

ListMarkets returns markets associated with an exchange.

func (*Client) Remaining

func (c *Client) Remaining() uint64

Remaining returns the remaining counter.

func (*Client) RemainingPaid

func (c *Client) RemainingPaid() uint64

RemainingPaid returns the remaining paid counter.

type Exchange

type Exchange struct {
	ID     int    `json:"id"`
	Symbol string `json:"symbol"`
	Name   string `json:"name"`
	Route  string `json:"route"`
	Active bool   `json:"active"`
}

Exchange is where all the action happens!

type ExchangeDetail

type ExchangeDetail struct {
	ID     int    `json:"id"`
	Symbol string `json:"symbol"`
	Name   string `json:"name"`
	Active bool   `json:"active"`
	Routes struct {
		Markets string `json:"markets"`
	} `json:"routes"`
}

ExchangeDetail holds detailed information about an exhange.

type Market

type Market struct {
	ID       int    `json:"id"`
	Exchange string `json:"exchange"`
	Pair     string `json:"pair"`
	Active   bool   `json:"active"`
	Route    string `json:"route"`
}

Market is a pair listed on an exchange.

type MarketDetails

type MarketDetails struct {
}

MarketDetails holds information about the market.

type Option

type Option interface {
	Apply(r *http.Request, q url.Values)
}

Option is an optional argument used to add data to a request.

func WithAPIKey

func WithAPIKey(s string) Option

WithAPIKey sets apikey to header of the request

type PairDetail

type PairDetail struct {
	ID     int    `json:"id"`
	Symbol string `json:"symbol"`
	Base   struct {
		ID     int    `json:"id"`
		Symbol string `json:"symbol"`
		Name   string `json:"name"`
		Fiat   bool   `json:"fiat"`
		Route  string `json:"route"`
	} `json:"base"`
	Quote struct {
		ID     int    `json:"id"`
		Symbol string `json:"symbol"`
		Name   string `json:"name"`
		Fiat   bool   `json:"fiat"`
		Route  string `json:"route"`
	} `json:"quote"`
	Route   string   `json:"route"`
	Markets []Market `json:"markets"`
}

PairDetail holds details of a pair.

Jump to

Keyboard shortcuts

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