Documentation
¶
Index ¶
- func WithIncludeDayChangeOption(includeDayChange bool) priceOption
- func WithIncludeDayVolumeOption(includeDayVolume bool) priceOption
- func WithIncludeLastTimeUpdatedAtOption(includeLastTimeUpdatedAt bool) priceOption
- func WithIncludeMarketCapOption(includeMarketCap bool) priceOption
- func WithPrecisionOption(precision string) priceOption
- type SimpleClient
- func (c *SimpleClient) SimplePrice(ctx context.Context, ids, vsCurrencies string, includeMarketCap bool, ...) (types.Price, error)
- func (c *SimpleClient) SimpleSupportedVsCurrency(ctx context.Context) (*types.SupportedVsCurrency, error)
- func (c *SimpleClient) SimpleTokenPrice(ctx context.Context, id, contractAddresses, vsCurrencies string, ...) (types.TokenPrice, error)
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 ¶
func NewClient ¶
func NewClient(c geckohttp.HttpClient, 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)