simple

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithIncludeDayChangeOption

func WithIncludeDayChangeOption(includeDayChange bool) priceOption

WithIncludeDayChangeOption returns a priceOption that configures whether to include 24-hour price change data in the price response

func WithIncludeDayVolumeOption

func WithIncludeDayVolumeOption(includeDayVolume bool) priceOption

WithIncludeDayVolumeOption returns a priceOption that configures whether to include 24-hour volume data in the price response

func WithIncludeLastTimeUpdatedAtOption

func WithIncludeLastTimeUpdatedAtOption(includeLastTimeUpdatedAt bool) priceOption

WithIncludeLastTimeUpdatedAtOption returns a priceOption that configures whether to include the last update timestamp in the price response

func WithIncludeMarketCapOption

func WithIncludeMarketCapOption(includeMarketCap bool) priceOption

WithIncludeMarketCapOption returns a priceOption that configures whether to include market cap data in the price response

func WithPrecisionOption

func WithPrecisionOption(precision string) priceOption

WithPrecisionOption returns a priceOption that configures the decimal precision of price values in the response

Types

type SimpleClient

type SimpleClient struct {
	*internal.Client
}

func NewClient

func NewClient(c *geckohttp.Client, url string) *SimpleClient

func (*SimpleClient) SimplePrice

func (c *SimpleClient) SimplePrice(ctx context.Context, ids, vsCurrencies string, includeMarketCap bool, options ...priceOption) (types.Price, error)

SimplePrice allows you to query the prices of one or more coins by using their unique Coin API IDs.

 👍 Tips

    You may obtain the coin id (api id) via several ways:
        refers to respective coin page and find ‘api id’
        refers to /coins/list endpoint
        refers to google sheets here
    You may flag to include more data such as market cap, 24hr volume, 24hr change, last updated time etc.
    To verify if a price is stale, you may flag include_last_updated_at=true in your request to obtain the latest updated time. Alternatively, you may flag include_24hr_change=true to determine if it returns a 'null' value.

📘Notes

    You may cross-check the price on CoinGecko and learn more about our price methodology here
    Cache/Update Frequency: every 30 seconds for Pro API (Analyst, Lite, Pro, Enterprise)

func (*SimpleClient) SimpleSupportedVsCurrency

func (c *SimpleClient) SimpleSupportedVsCurrency(ctx context.Context) (*types.SupportedVsCurrency, error)

SimpleSupportedVsCurrency allows you to query all the supported currencies on CoinGecko.

👍 Tips

    You may use this endpoint to query the list of currencies for other endpoints that contain params like vs_currencies

📘Notes

    Cache/Update Frequency: every 30 seconds for Pro API (Analyst, Lite, Pro, Enterprise)

func (*SimpleClient) SimpleTokenPrice

func (c *SimpleClient) SimpleTokenPrice(ctx context.Context, id, contractAddresses, vsCurrencies string, options ...priceOption) (types.TokenPrice, error)

SimpleTokenPrice allows you to query a token price by using token contract address.

👍 Tips

    You may obtain the asset platform and contract address via several ways:
        refers to respective coin page and find ‘contract’
        refers to /coins/list endpoint (include platform = true)
    You may flag to include more data such as market cap, 24hr volume, 24hr change, last updated time etc.

📘 Notes

    The endpoint returns the global average price of the coin that is aggregated across all active exchanges on CoinGecko
    You may cross-check the price on CoinGecko and learn more about our price methodology here
    Cache/Update Frequency: every 30 seconds for Pro API (Analyst, Lite, Pro, Enterprise)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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