Documentation
¶
Index ¶
- func WithCategory(category string) marketsOption
- func WithCoinSparkline(sparkline bool) coinsIdOption
- func WithCommunityData(communityData bool) coinsIdOption
- func WithDepth(depth string) idTickersOption
- func WithDeveloperData(developerData bool) coinsIdOption
- func WithExchangeId(exchangeIds string) idTickersOption
- func WithIDs(ids []string) marketsOption
- func WithIdTickersOrder(order string) idTickersOption
- func WithIdTickersPage(page int64) idTickersOption
- func WithIncludeExchangeLogo(includeLogo bool) idTickersOption
- func WithIncludePlatform(include bool) listOption
- func WithIntervalIdCirculatingSupplyChart(interval string) idCirculatingSupplyChartOption
- func WithIntervalIdMarketChart(interval string) idMarketChartOption
- func WithIntervalIdMarketChartRange(interval string) idMarketChartRangeOption
- func WithIntervalIdTotalSupplyChart(interval string) idTotalSupplyChartOption
- func WithLocalization(localization bool) coinsIdOption
- func WithLocalizationIdHistoryOption(loc bool) idHistoryOption
- func WithMarketData(marketData bool) coinsIdOption
- func WithOhlcIntervalOption(interval string) ohlcOption
- func WithOhlcPrecisionOption(precision string) ohlcOption
- func WithOrder(order string) marketsOption
- func WithPage(page int) marketsOption
- func WithPerPage(perPage int) marketsOption
- func WithPrecisionIdMarketChart(precision string) idMarketChartOption
- func WithPrecisionIdMarketChartRange(precision string) idMarketChartRangeOption
- func WithPriceChangePercentage(intervals []string) marketsOption
- func WithSparkline(sparkline bool) marketsOption
- func WithStatus(status string) listOption
- func WithTickers(tickers bool) coinsIdOption
- func WithTopCoins(topCoins string) topGainersLosersOption
- func WithTopGainersLosersDuration(duration string) topGainersLosersOption
- func WithTopGainersLosersPriceChangePercentage(intervals []string) topGainersLosersOption
- type CoinsClient
- func (c *CoinsClient) CoinsId(ctx context.Context, id string, options ...coinsIdOption) (*types.CoinID, error)
- func (c *CoinsClient) CoinsIdCirculatingSupplyChart(ctx context.Context, id, days string, ...) (*types.SupplyChart, error)
- func (c *CoinsClient) CoinsIdCirculatingSupplyChartRange(ctx context.Context, id, from, to string) (*types.SupplyChart, error)
- func (c *CoinsClient) CoinsIdHistory(ctx context.Context, id, date string, options ...idHistoryOption) (*types.History, error)
- func (c *CoinsClient) CoinsIdMarketChart(ctx context.Context, id, vsCurrency, days string, ...) (*types.MarketChart, error)
- func (c *CoinsClient) CoinsIdMarketChartRange(ctx context.Context, id, currency, from, to string, ...) (*types.MarketChart, error)
- func (c *CoinsClient) CoinsIdSupplyBreakdown(ctx context.Context, id string) (*types.SupplyBreakdown, error)
- func (c *CoinsClient) CoinsIdTickers(ctx context.Context, id string, options ...idTickersOption) (*types.Tickers, error)
- func (c *CoinsClient) CoinsIdTotalSupplyChart(ctx context.Context, id, days string, options ...idTotalSupplyChartOption) (*types.SupplyChart, error)
- func (c *CoinsClient) CoinsIdTotalSupplyChartRange(ctx context.Context, id, from, to string) (*types.SupplyChart, error)
- func (c *CoinsClient) CoinsList(ctx context.Context, options ...listOption) ([]*types.CoinInfo, error)
- func (c *CoinsClient) CoinsListNew(ctx context.Context) ([]*types.RecentlyAddedCoin, error)
- func (c *CoinsClient) CoinsMarket(ctx context.Context, currency string, options ...marketsOption) ([]*types.Market, error)
- func (c *CoinsClient) CoinsOhlc(ctx context.Context, id, vsCurrency, days string, options ...ohlcOption) (*types.Ohlc, error)
- func (c *CoinsClient) CoinsOhlcRange(ctx context.Context, id, vsCurrency, from, to, interval string) (*types.Ohlc, error)
- func (c *CoinsClient) CoinsTopGainersLosers(ctx context.Context, currency string, options ...topGainersLosersOption) (*types.TopGainersLosers, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithCategory ¶
func WithCategory(category string) marketsOption
WithCategory filters results by coin category. Valid values include: "decentralized_finance_defi", "stablecoins", etc.
func WithCoinSparkline ¶
func WithCoinSparkline(sparkline bool) coinsIdOption
WithCoinSparkline includes sparkline data in the response if true. Default: false
func WithCommunityData ¶
func WithCommunityData(communityData bool) coinsIdOption
WithCommunityData includes community data in the response if true. Default: true
func WithDepth ¶
func WithDepth(depth string) idTickersOption
WithDepth includes 2% orderbook depth info if "cost_to_move_up_usd" or "cost_to_move_down_usd". Valid values: "", "cost_to_move_up_usd", "cost_to_move_down_usd"
func WithDeveloperData ¶
func WithDeveloperData(developerData bool) coinsIdOption
WithDeveloperData includes developer data in the response if true. Default: true
func WithExchangeId ¶
func WithExchangeId(exchangeIds string) idTickersOption
WithExchangeId filters tickers by exchange id. Multiple exchange ids can be provided as a comma-separated string. Refers to /exchanges/list.
func WithIDs ¶
func WithIDs(ids []string) marketsOption
WithIDs specifies the coin ids to filter results by. Multiple ids can be provided as a string slice.
func WithIdTickersOrder ¶
func WithIdTickersOrder(order string) idTickersOption
WithIdTickersOrder specifies the ordering of results. Valid values: "trust_score_desc", "trust_score_asc", "volume_desc", "volume_asc
func WithIdTickersPage ¶
func WithIdTickersPage(page int64) idTickersOption
WithIdTickersPage specifies which page of results to return.
func WithIncludeExchangeLogo ¶
func WithIncludeExchangeLogo(includeLogo bool) idTickersOption
WithIncludeExchangeLogo includes exchange logo URLs in the response if true. Default: false
func WithIncludePlatform ¶
func WithIncludePlatform(include bool) listOption
WithIncludePlatform include platform and token's contract addresses, default: false.
func WithIntervalIdCirculatingSupplyChart ¶ added in v3.2.0
func WithIntervalIdCirculatingSupplyChart(interval string) idCirculatingSupplyChartOption
WithIntervalIdCirculatingSupplyChart sets the interval between data points in the response. Valid values: 5m, hourly, daily.
func WithIntervalIdMarketChart ¶
func WithIntervalIdMarketChart(interval string) idMarketChartOption
WithIntervalIdMarketChart sets the interval between data points in the response. Valid values: 5m, hourly, daily
func WithIntervalIdMarketChartRange ¶
func WithIntervalIdMarketChartRange(interval string) idMarketChartRangeOption
WithIntervalIdMarketChartRange sets the interval between data points in the response. Valid values: 5m, hourly, daily
func WithIntervalIdTotalSupplyChart ¶ added in v3.2.0
func WithIntervalIdTotalSupplyChart(interval string) idTotalSupplyChartOption
WithIntervalIdTotalSupplyChart sets the interval between data points in the response. Valid value: daily.
func WithLocalization ¶
func WithLocalization(localization bool) coinsIdOption
WithLocalization includes localized data in the response if true. Default: true
func WithLocalizationIdHistoryOption ¶
func WithLocalizationIdHistoryOption(loc bool) idHistoryOption
WithLocalizationIdHistoryOption sets whether to include localized data. If true, returns localized data in response (name, description, etc.) If false, returns data in English.
func WithMarketData ¶
func WithMarketData(marketData bool) coinsIdOption
WithMarketData includes market data in the response if true. Default: true
func WithOhlcIntervalOption ¶
func WithOhlcIntervalOption(interval string) ohlcOption
WithOhlcIntervalOption sets the interval between data points in the response. Valid values: hourly, daily
func WithOhlcPrecisionOption ¶
func WithOhlcPrecisionOption(precision string) ohlcOption
WithOhlcPrecisionOption sets the number of decimal places in the response data. Valid values: from 1 to 18
func WithOrder ¶
func WithOrder(order string) marketsOption
WithOrder specifies the ordering of results. Valid values: "market_cap_desc", "market_cap_asc", "volume_desc", "volume_asc", "id_desc", "id_asc", "gecko_desc", "gecko_asc"
func WithPage ¶
func WithPage(page int) marketsOption
WithPage specifies which page of results to return. Default: 1
func WithPerPage ¶
func WithPerPage(perPage int) marketsOption
WithPerPage sets the number of results per page. Valid values: 1-250, default: 100
func WithPrecisionIdMarketChart ¶
func WithPrecisionIdMarketChart(precision string) idMarketChartOption
WithPrecisionIdMarketChart sets the number of decimal places in the response data. Valid values: from 1 to 18
func WithPrecisionIdMarketChartRange ¶
func WithPrecisionIdMarketChartRange(precision string) idMarketChartRangeOption
WithPrecisionIdMarketChartRange sets the number of decimal places in the response data. Valid values: from 1 to 18
func WithPriceChangePercentage ¶
func WithPriceChangePercentage(intervals []string) marketsOption
WithPriceChangePercentage includes price change percentage for specified intervals. Valid intervals: "1h", "24h", "7d", "14d", "30d", "200d", "1y"
func WithSparkline ¶
func WithSparkline(sparkline bool) marketsOption
WithSparkline includes sparkline data in results if true. Default: false
func WithStatus ¶
func WithStatus(status string) listOption
WithStatus filter by status of coins, default: active valid values: active and inactive.
func WithTickers ¶
func WithTickers(tickers bool) coinsIdOption
WithTickers includes tickers data in the response if true. Default: true
func WithTopCoins ¶ added in v3.2.0
func WithTopCoins(topCoins string) topGainersLosersOption
WithTopCoins filters the result by market cap ranking or all coins. Valid values: "300", "500", "1000", "all".
func WithTopGainersLosersDuration ¶ added in v3.2.0
func WithTopGainersLosersDuration(duration string) topGainersLosersOption
WithTopGainersLosersDuration filters the result by time range. Valid values: "1h", "24h", "7d", "14d", "30d", "60d", "1y".
func WithTopGainersLosersPriceChangePercentage ¶ added in v3.2.0
func WithTopGainersLosersPriceChangePercentage(intervals []string) topGainersLosersOption
WithTopGainersLosersPriceChangePercentage includes price change percentage for specified intervals. Valid intervals: "1h", "24h", "7d", "14d", "30d", "60d", "200d", "1y".
Types ¶
type CoinsClient ¶
func NewClient ¶
func NewClient(c geckohttp.HttpClient, url string) *CoinsClient
func (*CoinsClient) CoinsId ¶
func (c *CoinsClient) CoinsId(ctx context.Context, id string, options ...coinsIdOption) (*types.CoinID, error)
CoinsId allows you to query all the coin data of a coin (name, price, market .... including exchange tickers) on CoinGecko coin page based on a particular coin id.
👍 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 also flag to include more data such as tickers, market data, community data, developer data and sparkline You may refer to last_updated in the endpoint response to check whether the price is stale
📘 Notes
Tickers are limited to 100 items, to get more tickers, please go to /coins/{id}/tickers Cache/Update Frequency: Every 60 seconds for all the API plans Community data for Twitter and Telegram will be updated on weekly basis (Reddit community data is no longer supported)
func (*CoinsClient) CoinsIdCirculatingSupplyChart ¶ added in v3.2.0
func (c *CoinsClient) CoinsIdCirculatingSupplyChart(ctx context.Context, id, days string, options ...idCirculatingSupplyChartOption) (*types.SupplyChart, error)
CoinsIdCirculatingSupplyChart allows you to query historical circulating supply of a coin by number of days from now.
This is an Enterprise API endpoint.
func (*CoinsClient) CoinsIdCirculatingSupplyChartRange ¶ added in v3.2.0
func (c *CoinsClient) CoinsIdCirculatingSupplyChartRange(ctx context.Context, id, from, to string) (*types.SupplyChart, error)
CoinsIdCirculatingSupplyChartRange allows you to query historical circulating supply of a coin within a time range.
This is an Enterprise API endpoint.
func (*CoinsClient) CoinsIdHistory ¶
func (c *CoinsClient) CoinsIdHistory(ctx context.Context, id, date string, options ...idHistoryOption) (*types.History, error)
CoinsIdHistory allows you to query the historical data (price, market cap, 24hrs volume, etc) at a given date for a coin based on a particular coin id.
👍 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
📘 Notes
The data returned is at 00:00:00 UTC The last completed UTC day (00:00) is available 35 minutes after midnight on the next UTC day (00:35)
func (*CoinsClient) CoinsIdMarketChart ¶
func (c *CoinsClient) CoinsIdMarketChart(ctx context.Context, id, vsCurrency, days string, options ...idMarketChartOption) (*types.MarketChart, error)
CoinsIdMarketChart allows you to get the historical chart data of a coin including time in UNIX, price, market cap and 24hrs volume based on particular coin id.
👍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 use tools like epoch converter to convert human readable date to UNIX timestamp
📘Notes
You may leave the interval params as empty for automatic granularity:
1 day from current time = 5-minutely data
2 - 90 days from current time = hourly data
above 90 days from current time = daily data (00:00 UTC)
For non-Enterprise plan subscribers who would like to get hourly data, please leave the interval params empty for auto granularity
The 5-minutely and hourly interval params are also exclusively available to Enterprise plan subscribers, bypassing auto-granularity:
interval=5m: 5-minutely historical data (responses include information from the past 10 days, up until 2 days ago)
interval=hourly: hourly historical data
(responses include information from the past 100 days, up until now)
Cache / Update Frequency:
every 30 seconds for all the API plans (for last data point)
The last completed UTC day (00:00) data is available 10 minutes after midnight on the next UTC day (00:10).
func (*CoinsClient) CoinsIdMarketChartRange ¶
func (c *CoinsClient) CoinsIdMarketChartRange(ctx context.Context, id, currency, from, to string, options ...idMarketChartRangeOption) (*types.MarketChart, error)
func (*CoinsClient) CoinsIdSupplyBreakdown ¶ added in v3.2.0
func (c *CoinsClient) CoinsIdSupplyBreakdown(ctx context.Context, id string) (*types.SupplyBreakdown, error)
CoinsIdSupplyBreakdown allows you to query the supply breakdown of a coin based on a provided coin ID.
This is a Pro API endpoint.
func (*CoinsClient) CoinsIdTickers ¶
func (c *CoinsClient) CoinsIdTickers(ctx context.Context, id string, options ...idTickersOption) (*types.Tickers, error)
CoinsIdTickers allows you to query the coin tickers on both centralized exchange (cex) and decentralized exchange (dex) based on a particular coin id.
👍 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 specify the exchange_ids if you want to retrieve tickers for specific exchange only You may include values such as page to specify which page of responses you would like to show You may also flag to include more data such as exchange logo and depth
📘 Notes
The tickers are paginated to 100 items Cache / Update Frequency: every 2 minutes for all the API plans When order is sorted by 'volume', converted_volume will be used instead of volume
func (*CoinsClient) CoinsIdTotalSupplyChart ¶ added in v3.2.0
func (c *CoinsClient) CoinsIdTotalSupplyChart(ctx context.Context, id, days string, options ...idTotalSupplyChartOption) (*types.SupplyChart, error)
CoinsIdTotalSupplyChart allows you to query historical total supply of a coin by number of days from now.
This is an Enterprise API endpoint.
func (*CoinsClient) CoinsIdTotalSupplyChartRange ¶ added in v3.2.0
func (c *CoinsClient) CoinsIdTotalSupplyChartRange(ctx context.Context, id, from, to string) (*types.SupplyChart, error)
CoinsIdTotalSupplyChartRange allows you to query historical total supply of a coin within a time range.
This is an Enterprise API endpoint.
func (*CoinsClient) CoinsList ¶
func (c *CoinsClient) CoinsList(ctx context.Context, options ...listOption) ([]*types.CoinInfo, error)
CoinsList allows you to query all the supported coins on CoinGecko with coins id, name and symbol.
👍 Tips You may use this endpoint to query the list of coins with coin id for other endpoints that contain params like id or ids (coin id). By default, this endpoint returns full list of active coins that are currently listed on CoinGecko.com , you can also flag status=inactive to retrieve coins that are no longer available on CoinGecko.com . The inactive coin ids can also be used with selected historical data endpoints.
📘 Notes There is no pagination required for this endpoint Cache/Update Frequency: Every 5 minutes for all the API plans
func (*CoinsClient) CoinsListNew ¶ added in v3.2.0
func (c *CoinsClient) CoinsListNew(ctx context.Context) ([]*types.RecentlyAddedCoin, error)
CoinsListNew allows you to query the latest 200 coins recently listed on CoinGecko.
This is a Pro API endpoint.
func (*CoinsClient) CoinsMarket ¶
func (c *CoinsClient) CoinsMarket(ctx context.Context, currency string, options ...marketsOption) ([]*types.Market, error)
CoinsMarket allows you to query all the supported coins with price, market cap, volume and market related data. 👍 Tips You may specify the coins’ ids in ids parameter if you want to retrieve market data for specific coins only instead of the whole list You may also provide value in category to filter the responses based on coin's category You can use per_page and page values to control the number of results per page and specify which page of results you want to display in the responses
📘 Notes If you provide values for both category and ids parameters, the category parameter will be prioritized over the ids parameter Cache/Update Frequency: Every 45 seconds for all the API plans
func (*CoinsClient) CoinsOhlc ¶
func (c *CoinsClient) CoinsOhlc(ctx context.Context, id, vsCurrency, days string, options ...ohlcOption) (*types.Ohlc, error)
CoinsOhlc allows you to get the OHLC chart (Open, High, Low, Close) of a coin based on particular coin id.
👍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
For historical chart data with better granularity, you may consider using /coins/{id}/market_chart endpoint
📘 Notes
The timestamp displayed in the payload (response) indicates the end (or close) time of the OHLC data
Data granularity (candle's body) is automatic:
1 - 2 days: 30 minutes
3 - 30 days: 4 hours
31 days and beyond: 4 days
Cache / Update Frequency:
every 15 minutes for all the API plans
The last completed UTC day (00:00) is available 35 minutes after midnight on the next UTC day (00:35)
Exclusive daily and hourly candle interval parameter for all paid plan subscribers (interval = daily, interval=hourly)
'daily' interval is available for 1 / 7 / 14 / 30 / 90 / 180 days only.
'hourly' interval is available for 1 /7 / 14 / 30 / 90 days only.
func (*CoinsClient) CoinsOhlcRange ¶ added in v3.2.0
func (c *CoinsClient) CoinsOhlcRange(ctx context.Context, id, vsCurrency, from, to, interval string) (*types.Ohlc, error)
CoinsOhlcRange allows you to get the OHLC chart (Open, High, Low, Close) of a coin within a range of timestamps.
This is a Pro API endpoint.
func (*CoinsClient) CoinsTopGainersLosers ¶ added in v3.2.0
func (c *CoinsClient) CoinsTopGainersLosers(ctx context.Context, currency string, options ...topGainersLosersOption) (*types.TopGainersLosers, error)
CoinsTopGainersLosers allows you to query the top 30 coins with largest price gain and loss by a specific time duration.
This is a Pro API endpoint.