cw

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package cw allows sdk users to easily get Cryptowatch objects without doing any extra work.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAsset

func GetAsset(opt GetAssetParams) (common.Asset, error)

GetAsset is a convenience method which does not require an instance of CWClient.

func GetMarket

func GetMarket(opt GetMarketParams) (common.Market, error)

GetMarket is a convenience method on package cw which does not require an instance of CWClient.

Types

type CWClient

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

CWClient is a convenience tool for getting Cryptowatch objects from the api. Instead of having to create a REST client, CWClient makes one internally based on the config settings.

func NewCWClient

func NewCWClient(opt *CWClientParams) *CWClient

NewCWClient creates a new instance of CWClient. It will use the default RESTClient.

func (*CWClient) GetAsset

func (cw *CWClient) GetAsset(opt GetAssetParams) (common.Asset, error)

func (*CWClient) GetMarket

func (cw *CWClient) GetMarket(opt GetMarketParams) (common.Market, error)

GetMarket uses the REST API to get a market by exchange + base + quote. This method is not thread-safe.

func (*CWClient) MustGetAsset

func (cw *CWClient) MustGetAsset(opt GetAssetParams) common.Asset

func (*CWClient) MustGetMarket

func (cw *CWClient) MustGetMarket(opt GetMarketParams) common.Market

type CWClientParams

type CWClientParams struct {
	RESTClient rest.V2
}

CWClientParams allows you to control the RESTClient in CWClient.

type GetAssetParams

type GetAssetParams struct {
	Symbol common.AssetSymbol
	ID     common.AssetID
}

GetAssetParams is the parameter type to GetAsset which allows you to get an asset by Symbol or ID. Only one needs to be present.

type GetMarketParams

type GetMarketParams struct {
	Symbol common.MarketSymbol
	ID     common.MarketID
}

GetMarketParams is the parameter type to GetMarket which allows you to get a market by Symbol OR ID. Only one needs to be present.

type Interface

type Interface interface {
	GetMarket(GetMarketParams) (common.Market, error)
	MustGetMarket(GetMarketParams) common.Market
	GetAsset(GetAssetParams) (common.Asset, error)
	MustGetAsset(GetAssetParams) common.Asset
}

Jump to

Keyboard shortcuts

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