Documentation ¶
Overview ¶
Package rest provides a client for using the Cryptowatch REST API.
Index ¶
- Variables
- type ExchangeDescr
- type ExchangeDescrBrief
- type ExchangeDescrRoutes
- type MarketDescr
- type MockV2Client
- func (mc *MockV2Client) GetAssetByID(id common.AssetID) (common.Asset, error)
- func (mc *MockV2Client) GetAssetBySymbol(symbol common.AssetSymbol) (common.Asset, error)
- func (mc *MockV2Client) GetMarketByID(id common.MarketID) (common.Market, error)
- func (mc *MockV2Client) GetMarketBySymbol(ms common.MarketSymbol) (common.Market, error)
- type PairDescr
- type PairSideDescr
- type RESTClient
- func (c *RESTClient) GetAssetByID(id common.AssetID) (common.Asset, error)
- func (c *RESTClient) GetAssetBySymbol(symbol common.AssetSymbol) (common.Asset, error)
- func (c *RESTClient) GetExchangeBySymbol(xchSymbol common.ExchangeSymbol) (common.Exchange, error)
- func (c *RESTClient) GetExchangeDescr(exchangeSymbol string) (*ExchangeDescr, error)
- func (c *RESTClient) GetExchangeMarketsDescr(exchangeSymbol string) ([]MarketDescr, error)
- func (c *RESTClient) GetExchangesIndex() ([]ExchangeDescrBrief, error)
- func (c *RESTClient) GetMarket(params common.MarketParams) (common.Market, error)
- func (c *RESTClient) GetMarketByID(id common.MarketID) (common.Market, error)
- func (c *RESTClient) GetMarketBySymbol(params common.MarketSymbol) (common.Market, error)
- func (c *RESTClient) GetMarketDescr(exchangeSymbol, pairSymbol string) (MarketDescr, error)
- func (c *RESTClient) GetMarketSummaries() (map[string]common.SummaryUpdate, error)
- func (c *RESTClient) GetMarketsIndex() ([]MarketDescr, error)
- func (c *RESTClient) GetOHLC(exchangeSymbol, pairSymbol string) (map[common.Period][]common.Interval, error)
- func (c *RESTClient) GetOrderBook(exchangeSymbol string, pairSymbol string) (common.OrderBookSnapshot, error)
- func (c *RESTClient) GetPairDescr(symbol string) (PairDescr, error)
- func (c *RESTClient) GetPairsIndex() ([]PairDescr, error)
- func (c *RESTClient) GetPrice(exchangeSymbol string, pairSymbol string) (decimal.Decimal, error)
- func (c *RESTClient) GetSummary(exchangeSymbol, pairSymbol string) (common.SummaryUpdate, error)
- func (c *RESTClient) GetTrades(exchangeSymbol string, pairSymbol string) ([]common.PublicTrade, error)
- type RESTClientParams
- type V2
Constants ¶
This section is empty.
Variables ¶
var APIErrorResponse = errors.New("API error response")
Functions ¶
This section is empty.
Types ¶
type ExchangeDescr ¶
type ExchangeDescr struct { ID int `json:"id"` Symbol string `json:"symbol"` Name string `json:"name"` Active bool `json:"active"` Routes ExchangeDescrRoutes `json:"routes"` }
type ExchangeDescrBrief ¶
type ExchangeDescrRoutes ¶
type ExchangeDescrRoutes struct {
Markets string `json:"markets"`
}
type MarketDescr ¶
type MockV2Client ¶
func NewMockV2Client ¶
func NewMockV2Client() *MockV2Client
func (*MockV2Client) GetAssetByID ¶
func (*MockV2Client) GetAssetBySymbol ¶
func (mc *MockV2Client) GetAssetBySymbol(symbol common.AssetSymbol) ( common.Asset, error, )
func (*MockV2Client) GetMarketByID ¶
func (*MockV2Client) GetMarketBySymbol ¶
func (mc *MockV2Client) GetMarketBySymbol(ms common.MarketSymbol) ( common.Market, error, )
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 RESTClient ¶
type RESTClient struct {
// contains filtered or unexported fields
}
func NewRESTClient ¶
func NewRESTClient(params *RESTClientParams) *RESTClient
func (*RESTClient) GetAssetByID ¶
func (*RESTClient) GetAssetBySymbol ¶
func (c *RESTClient) GetAssetBySymbol(symbol common.AssetSymbol) ( common.Asset, error, )
func (*RESTClient) GetExchangeBySymbol ¶
func (c *RESTClient) GetExchangeBySymbol(xchSymbol common.ExchangeSymbol) ( common.Exchange, error, )
GetMarketBySymbol returns Market object based on exchange, base, and quote.
func (*RESTClient) GetExchangeDescr ¶
func (c *RESTClient) GetExchangeDescr(exchangeSymbol string) (*ExchangeDescr, error)
func (*RESTClient) GetExchangeMarketsDescr ¶
func (c *RESTClient) GetExchangeMarketsDescr(exchangeSymbol string) ([]MarketDescr, error)
func (*RESTClient) GetExchangesIndex ¶
func (c *RESTClient) GetExchangesIndex() ([]ExchangeDescrBrief, error)
func (*RESTClient) GetMarket ¶
func (c *RESTClient) GetMarket(params common.MarketParams) ( common.Market, error, )
GetMarket returns the Market based on an ID or symbol
func (*RESTClient) GetMarketByID ¶
GetMarketByID returns a Market object based on the market's ID.
func (*RESTClient) GetMarketBySymbol ¶
func (c *RESTClient) GetMarketBySymbol(params common.MarketSymbol) ( common.Market, error, )
GetMarketBySymbol returns Market object based on exchange, base, and quote.
func (*RESTClient) GetMarketDescr ¶
func (c *RESTClient) GetMarketDescr(exchangeSymbol, pairSymbol string) (MarketDescr, error)
func (*RESTClient) GetMarketSummaries ¶
func (c *RESTClient) GetMarketSummaries() (map[string]common.SummaryUpdate, error)
GetMarketSummaries returns a map from market symbol like "<exchange>:<pair>" to the corresponding summary.
func (*RESTClient) GetMarketsIndex ¶
func (c *RESTClient) GetMarketsIndex() ([]MarketDescr, error)
func (*RESTClient) GetOHLC ¶
func (c *RESTClient) 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 (*RESTClient) GetOrderBook ¶
func (c *RESTClient) GetOrderBook( exchangeSymbol string, pairSymbol string, ) (common.OrderBookSnapshot, error)
func (*RESTClient) GetPairDescr ¶
func (c *RESTClient) GetPairDescr(symbol string) (PairDescr, error)
func (*RESTClient) GetPairsIndex ¶
func (c *RESTClient) GetPairsIndex() ([]PairDescr, error)
func (*RESTClient) GetSummary ¶
func (c *RESTClient) GetSummary( exchangeSymbol, pairSymbol string, ) (common.SummaryUpdate, error)
func (*RESTClient) GetTrades ¶
func (c *RESTClient) GetTrades( exchangeSymbol string, pairSymbol string, ) ([]common.PublicTrade, error)
GetTrades returns latest trades on the given market, sorted in ascending order.