goingecko

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: MIT Imports: 16 Imported by: 1

README

Goingecko

Coingecko API client for golang.

goingecko

Endpoints

Endpoint Status Function
ping Ping
simple/price SimplePrice
simple/token_price/{id} SimpleTokenPrice
simple/supported_vs_currencies SimpleSupportedVsCurrency
coins/list CoinsList
coins/markets CoinsMarket
coins/{id} CoinsId
coins/{id}/tickers CoinsIdTickers
coins/{id}/history CoinsIdHistory
coins/{id}/market_chart CoinsIdMarketChart
coins/{id}/market_chart/range CoinsIdMarketChartRange
coins/{id}/status_updates
coins/{id}/ohlc CoinsOhlc
/coins/{id}/contract/{contract_address} ContractInfo
/coins/{id}/contract/{contract_address}/market_chart/ ContractMarketChart
/coins/{id}/contract/{contract_address}/market_chart/range ContractMarketChartRange
/events Events
/events/countries EventsCountries
/events/types EventsTypes
/exchange_rates ExchangeRates
/search/trending Trending
/global Global
/global/decentralized_finance_defi DecentrilizedFinanceDEFI
Beta endpoints

Beta endpoins are to be implemented in a matter of time 😄

Usage

package main

import (
	"fmt"

	"github.com/JulianToledano/goingecko"
)

func main() {
	cgClient := goingecko.NewClient(nil)
	defer cgClient.Close()

	data, err := cgClient.CoinsId("bitcoin", true, true, true, false, false, false)
	if err != nil {
		fmt.Print("Somethig went wrong...")
		return
	}
	fmt.Printf("Bitcoin price is: %f$", data.MarketData.CurrentPrice.Usd)
}

Check dir examples for more.

Thanks

This repo is based some how in superoo7/go-gecko work.

Image was created with Gophers

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(httpClient *http.Client) *Client

func (*Client) Close

func (c *Client) Close()

func (*Client) CoinsId

func (c *Client) CoinsId(id string, localization, tickers, marketData, communityData, developerData, sparkline bool) (*coins.CoinID, error)

func (*Client) CoinsIdHistory

func (c *Client) CoinsIdHistory(id, date string, localization bool) (*coins.History, error)

func (*Client) CoinsIdMarketChart

func (c *Client) CoinsIdMarketChart(id, currency, days string) (*types.MarketChart, error)

func (*Client) CoinsIdMarketChartRange

func (c *Client) CoinsIdMarketChartRange(id, currency, from, to string) (*types.MarketChart, error)

func (*Client) CoinsIdTickers

func (c *Client) CoinsIdTickers(id, exchangeId, includeExchangeLogo, page, order, depth string) (*coins.Tickers, error)

func (*Client) CoinsList

func (c *Client) CoinsList() ([]*coins.CoinInfo, error)

func (*Client) CoinsMarket

func (c *Client) CoinsMarket(currency string, ids []string, category string, order string, perPage, page string, sparkline bool, priceChange []string) ([]*coins.Market, error)

func (*Client) CoinsOhlc

func (c *Client) CoinsOhlc(id, currency, days string) (*coins.Ohlc, error)

func (*Client) CoinsStatusUpdates

func (c *Client) CoinsStatusUpdates(id string) (*coins.StatusUpdates, error)

func (*Client) ContractInfo

func (c *Client) ContractInfo(id, contractAddress string) (*contract.ContractAddressInfo, error)

func (*Client) ContractMarketChart

func (c *Client) ContractMarketChart(id, contractAddress, vsCurrency, days string) (*types.MarketChart, error)

func (*Client) ContractMarketChartRange

func (c *Client) ContractMarketChartRange(id, contractAddress, vsCurrency, from, to string) (*types.MarketChart, error)

func (*Client) DecentrilizedFinanceDEFI

func (c *Client) DecentrilizedFinanceDEFI() (*global.Defi, error)

func (*Client) Events

func (c *Client) Events(countryCode, eventType, page, from, to string, onlyUpcoming bool) (*events.Events, error)

func (*Client) EventsCountries

func (c *Client) EventsCountries() (*events.Country, error)

func (*Client) EventsTypes

func (c *Client) EventsTypes() (*events.Types, error)

func (*Client) ExchangeRates

func (c *Client) ExchangeRates() (*exchangeRates.Rates, error)

func (*Client) Global

func (c *Client) Global() (*global.Global, error)

func (*Client) MakeReq

func (c *Client) MakeReq(url string) ([]byte, error)

MakeReq HTTP request helper

func (*Client) Ping

func (c *Client) Ping() (*ping.Ping, error)

Ping /ping endpoint

func (*Client) SimplePrice

func (c *Client) SimplePrice(ids, vsCurrencies string, includeMarketCap, includeDayVolume, includeDayChange, includeLastTimeUpdated bool) (simple.Price, error)

func (*Client) SimpleSupportedVsCurrency

func (c *Client) SimpleSupportedVsCurrency() (*simple.SupportedVsCurrency, error)

func (*Client) SimpleTokenPrice

func (c *Client) SimpleTokenPrice(id, contractAddresses, vsCurrencies string, includeMarketCap, includeDayVolume, includeDayChange, includeLastTimeUpdated bool) (simple.TokenPrice, error)

func (*Client) Trending

func (c *Client) Trending() (*trending.Trending, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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