mcap

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: MIT Imports: 8 Imported by: 0

README

marketcap-client

marketcap.backend.currency.com

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset struct {
	Name        string  `json:"name"`
	Description string  `json:"description"`
	CanWithdraw bool    `json:"can_withdraw"`
	CanDeposit  bool    `json:"can_deposit"`
	MinWithdraw float64 `json:"min_withdraw"`
	MaxWithdraw float64 `json:"max_withdraw"`
	MakerFee    float64 `json:"maker_fee"`
	TakerFee    float64 `json:"taker_fee"`
}

type Assets

type Assets map[string]Asset

type Candle

type Candle struct {
	Time  time.Time
	High  float64
	Low   float64
	Open  float64
	Close float64
}

type Candles

type Candles []Candle

type CandlesRequest

type CandlesRequest struct {
	EndTime   int64  `url:"endTime,omitempty"`
	Interval  string `url:"interval"`
	Limit     int    `url:"limit,omitempty"`
	StartTime int64  `url:"startTime,omitempty"`
	Symbol    string `url:"symbol"`
}

type Client

type Client struct {
	Client  *http.Client
	BaseURL *url.URL
}

func NewClient

func NewClient(httpClient *http.Client) *Client

func (*Client) GetAssets

func (c *Client) GetAssets() (listOfAssets Assets, err error)

func (*Client) GetCandles

func (c *Client) GetCandles(cr CandlesRequest) (candles Candles, err error)

func (*Client) GetOrderbook

func (c *Client) GetOrderbook(obr OrderbookRequest) (ob Orderbook, err error)

func (*Client) GetSummary

func (c *Client) GetSummary() (md MarketData, err error)

func (*Client) GetTicker

func (c *Client) GetTicker() (t Ticker, err error)

func (*Client) GetTrades

func (c *Client) GetTrades(tr TradesRequest) (t Trades, err error)

type ErrorResponse

type ErrorResponse struct {
	// HTTP response that caused this error
	Response *http.Response `json:"-"`
	// Error message
	Timestamp int64  `json:"timestamp"`
	Status    int    `json:"status"`
	ErrorMsg  string `json:"error"`
	Message   string `json:"message"`
	Path      string `json:"path"`
	Msg       string `json:"msg"`
	Code      int    `json:"code"`
}

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

type MarketData

type MarketData struct {
	Message string                `json:"msg"`
	Data    map[string]MarketProp `json:"data"`
}

type MarketProp

type MarketProp struct {
	ID            int64  `json:"id"`
	BaseVolume    string `json:"baseVolume"`
	High24Hr      string `json:"high24hr"`
	HighestBid    string `json:"highestBid"`
	IsFrozen      string `json:"isFrozen"`
	Last          string `json:"last"`
	Low24Hr       string `json:"low24hr"`
	LowestAsk     string `json:"lowestAsk"`
	PercentChange string `json:"percentChange"`
	QuoteVolume   string `json:"quoteVolume"`
}

type Orderbook

type Orderbook struct {
	Timestamp int64       `json:"timestamp"`
	Asks      [][]float64 `json:"asks"`
	Bids      [][]float64 `json:"bids"`
}

type OrderbookRequest

type OrderbookRequest struct {
	Depth  int    `url:"depth,omitempty"`
	Level  int    `url:"level,omitempty"`
	Symbol string `url:"symbol"`
}

type PriceChange

type PriceChange struct {
	BaseCurrency         string  `json:"base_currency"`
	BaseVolume           float64 `json:"base_volume"`
	Description          string  `json:"description"`
	HighestBidPrice      float64 `json:"highest_bid_price"`
	IsFrozen             bool    `json:"isFrozen"`
	LastPrice            float64 `json:"last_price"`
	LowestAskPrice       float64 `json:"lowest_ask_price"`
	Past24HrsHighPrice   float64 `json:"past_24hrs_high_price"`
	Past24HrsLowPrice    float64 `json:"past_24hrs_low_price"`
	Past24HrsPriceChange float64 `json:"past_24hrs_price_change"`
	QuoteVolume          float64 `json:"quote_volume"`
	QuoteCurrency        string  `json:"quote_currency"`
}

type Ticker

type Ticker map[string]PriceChange

type Trades

type Trades []struct {
	TradeID        int64   `json:"tradeID"`
	Price          float64 `json:"price"`
	BaseVolume     float64 `json:"base_volume"`
	QuoteVolume    float64 `json:"quote_volume"`
	TradeTimestamp int64   `json:"trade_timestamp"`
	Type           string  `json:"type"`
}

type TradesRequest

type TradesRequest struct {
	Symbol string `url:"symbol"`
	Type   string `url:"type,omitempty"`
}

Jump to

Keyboard shortcuts

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