gainer_looser

package
v0.1.71 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CryptocurrencyData

type CryptocurrencyData struct {
	Id                CryptocurrencyID `json:"id"`
	Name              string           `json:"name"`
	Symbol            string           `json:"symbol"`
	Slug              string           `json:"slug"`
	CmcRank           Rank             `json:"cmc_rank,omitempty"`
	NumMarketPairs    int              `json:"num_market_pairs"`
	CirculatingSupply int              `json:"circulating_supply"`
	TotalSupply       int              `json:"total_supply"`
	MaxSupply         int              `json:"max_supply"`
	LastUpdated       time.Time        `json:"last_updated"`
	DateAdded         time.Time        `json:"date_added"`
	Tags              []string         `json:"tags"`
	Platform          interface{}      `json:"platform"`
	Quote             Quote            `json:"quote"`
}

type CryptocurrencyID

type CryptocurrencyID int

type CurrencyQuote

type CurrencyQuote struct {
	Price            float64   `json:"price"`
	Volume24H        float64   `json:"volume_24h"`
	PercentChange1H  float64   `json:"percent_change_1h"`
	PercentChange24H float64   `json:"percent_change_24h"`
	PercentChange7D  float64   `json:"percent_change_7d"`
	MarketCap        float64   `json:"market_cap"`
	LastUpdated      time.Time `json:"last_updated"`
}

type GainersAndLosers

type GainersAndLosers struct {
	*c.Client
}

GainersAndLosers represents the gainers and losers data.

func New

func New(c *c.Client) *GainersAndLosers

func (*GainersAndLosers) FetchGainersLosers

func (g *GainersAndLosers) FetchGainersLosers(params *Params) ([]CryptocurrencyData, error)

type Params

type Params struct {
	Limit      *int        `json:"limit,omitempty"`
	TimePeriod *TimePeriod `json:"time_period,omitempty"`
	Convert    *string     `json:"convert,omitempty"`
	ConvertID  *int        `json:"convert_id,omitempty"`
	Sort       *Sort       `json:"sort,omitempty"`
	SortDir    *SortDir    `json:"sort_dir,omitempty"`
}

Params represents the query parameters for fetching data.

type Quote

type Quote map[string]CurrencyQuote

type Rank

type Rank int

type Response

type Response struct {
	Data struct {
		Data   []CryptocurrencyData `json:"data"`
		Status Status               `json:"status"`
	} `json:"data"`
	Status Status `json:"status"`
}

type Sort

type Sort string

Sort represents the fields by which data should be sorted.

const (
	PercentChange1h  Sort = "percent_change_1h"
	PercentChange24h Sort = "percent_change_24h"
	PercentChange7d  Sort = "percent_change_7d"
	PercentChange30d Sort = "percent_change_30d"
)

Sort values represent the fields by which data should be sorted.

type SortDir

type SortDir string

SortDir represents the direction in which data should be sorted.

const (
	ASC  SortDir = "asc"
	DESC SortDir = "desc"
)

SortDir values represent the direction in which data should be sorted.

type Status

type Status struct {
	Timestamp    time.Time `json:"timestamp"`
	ErrorCode    int       `json:"error_code"`
	ErrorMessage string    `json:"error_message"`
	Elapsed      int       `json:"elapsed"`
	CreditCount  int       `json:"credit_count"`
}

type TimePeriod

type TimePeriod string

TimePeriod represents the overall window of time for the gainers and losers.

const (
	OneHour        TimePeriod = "1h"
	TwentyFourHour TimePeriod = "24h"
	ThirtyDay      TimePeriod = "30d"
	SevenDay       TimePeriod = "7d"
)

TimePeriod values represent the overall window of time for the gainers and losers.

Jump to

Keyboard shortcuts

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