rest

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2019 License: BSD-2-Clause Imports: 7 Imported by: 1

Documentation

Overview

Package rest provides a client for using the Cryptowatch REST API.

Index

Constants

View Source
const (
	DefaultRESTURL = "https://api.cryptowat.ch"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CWRESTClient

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

func NewCWRESTClient

func NewCWRESTClient(params *CWRESTClientParams) *CWRESTClient

func (*CWRESTClient) GetExchangeDescr

func (c *CWRESTClient) GetExchangeDescr(exchangeSymbol string) (*ExchangeDescr, error)

func (*CWRESTClient) GetExchangeMarketsDescr

func (c *CWRESTClient) GetExchangeMarketsDescr(exchangeSymbol string) ([]MarketDescr, error)

func (*CWRESTClient) GetExchangesIndex

func (c *CWRESTClient) GetExchangesIndex() ([]ExchangeDescrBrief, error)

func (*CWRESTClient) GetMarketDescr

func (c *CWRESTClient) GetMarketDescr(exchangeSymbol, pairSymbol string) (MarketDescr, error)

func (*CWRESTClient) GetMarketSummaries

func (c *CWRESTClient) GetMarketSummaries() (map[string]common.SummaryUpdate, error)

GetMarketSummaries returns a map from market symbol like "<exchange>:<pair>" to the corresponding summary.

func (*CWRESTClient) GetMarketsIndex

func (c *CWRESTClient) GetMarketsIndex() ([]MarketDescr, error)

func (*CWRESTClient) GetOHLC

func (c *CWRESTClient) GetOHLC(
	exchangeSymbol, pairSymbol string,
) (map[common.Period][]common.Interval, error)

GetOHLC returns a map from a period (represented as a number of seconds: 60, 180, etc) to a slice of OHLC candles for that period, in the time ascending order.

func (*CWRESTClient) GetOrderBook

func (c *CWRESTClient) GetOrderBook(
	exchangeSymbol string, pairSymbol string,
) (common.OrderBookSnapshot, error)

func (*CWRESTClient) GetPairDescr

func (c *CWRESTClient) GetPairDescr(symbol string) (PairDescr, error)

func (*CWRESTClient) GetPairsIndex

func (c *CWRESTClient) GetPairsIndex() ([]PairDescr, error)

type CWRESTClientParams

type CWRESTClientParams struct {
	// APIURL is the API URL to use. If empty, production will be used
	// (DefaultRESTURL)
	APIURL string
}

type ExchangeDescr

type ExchangeDescr 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"`
}

type ExchangeDescrBrief

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

type MarketDescr

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

type PairDescr

type PairDescr struct {
	ID      int           `json:"id"`
	Symbol  string        `json:"symbol"`
	Route   string        `json:"route"`
	Base    PairSideDescr `json:"base"`
	Quote   PairSideDescr `json:"quote"`
	Markets []MarketDescr `json:"markets"`
}

type PairSideDescr

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

Jump to

Keyboard shortcuts

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