diff --git a/README.md b/README.md index 963fac5..e0b2c9a 100755 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ [![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/miguelmota/go-coinmarketcap/master/LICENSE.md) [![Build Status](https://travis-ci.org/miguelmota/go-coinmarketcap.svg?branch=master)](https://travis-ci.org/miguelmota/go-coinmarketcap) [![Go Report Card](https://goreportcard.com/badge/github.com/miguelmota/go-coinmarketcap?)](https://goreportcard.com/report/github.com/miguelmota/go-coinmarketcap) [![GoDoc](https://godoc.org/github.com/miguelmota/go-coinmarketcap?status.svg)](https://godoc.org/github.com/miguelmota/go-coinmarketcap) -Supports the CoinMarketCap Version [V2](https://coinmarketcap.com/api) and V1 Public API +Supports the CoinMarketCap API Pro Version, [V2](https://coinmarketcap.com/api) and V1 Public API ## Documentation @@ -25,7 +25,67 @@ Supports the CoinMarketCap Version [V2](https://coinmarketcap.com/api) and V1 Pu go get -u github.com/miguelmota/go-coinmarketcap ``` -## Getting started +## Pro V1 (latest) + +| Type | Endpoint | Implemented? | +|----------------|----------------------------------------|--------------| +| Cryptocurrency | /v1/cryptocurrency/info | Yes | +| Cryptocurrency | /v1/cryptocurrency/map | Not yet | +| Cryptocurrency | /v1/cryptocurrency/listings/latest | Yes | +| Cryptocurrency | /v1/cryptocurrency/market-pairs/latest | Not yet | +| Cryptocurrency | /v1/cryptocurrency/ohlcv/historical | Not yet | +| Cryptocurrency | /v1/cryptocurrency/quotes/latest | Not yet | +| Cryptocurrency | /v1/cryptocurrency/quotes/historical | Not yet | +| Exchange | /v1/exchange/info | Not yet | +| Exchange | /v1/exchange/map | Not yet | +| Exchange | /v1/exchange/listings/latest | Not yet | +| Exchange | /v1/exchange/market-pairs/latest | Not yet | +| Exchange | /v1/exchange/quotes/latest | Not yet | +| Exchange | /v1/exchange/quotes/historical | Not yet | +| Global Metrics | /v1/global-metrics/quotes/latest | Not yet | +| Global Metrics | /v1/global-metrics/quotes/historical | Not yet | +| Tools | /v1/tools/price-conversion | Not yet | + +### Getting started + +```go +package main + +import ( + "fmt" + "log" + + cmc "github.com/miguelmota/go-coinmarketcap/pro/v1" +) + +func main() { + client := cmc.NewClient(&Config{ + ProAPIKey: "01585d6d-123-456-789-3146576cbc70", + }) + + listings, err := client.CryptocurrencyListingsLatests(&cmc.CryptocurrencyListingsLatestsOptions{ + Limit: 1, + }) + if err != nil { + log.Fatal(err) + } + + fmt.Println(listings[0].Name) + fmt.Println(listings[0].Quote["USD"].Price) +} +``` + +### Examples + +For more examples, check out the [`./pro/v1/example`](./pro/v1/example) directory and [documentation](https://godoc.org/github.com/miguelmota/go-coinmarketcap/pro/v1) + +--- + +## V2 + +Note: will be deprecated December 2018 + +### Getting started ```go package main @@ -51,12 +111,51 @@ func main() { fmt.Println(ticker.Symbol, ticker.Quotes["USD"].Price) } } +``` + +### Examples + +For more examples, check out the [`./v2/example`](./v2/example) directory and [documentation](https://godoc.org/github.com/miguelmota/go-coinmarketcap/v2) +--- + +## V1 + +Note: will be deprecated November 2018 + +### Getting started + +```go +package main + +import ( + "fmt" + "log" + + cmc "github.com/miguelmota/go-coinmarketcap" +) + +func main() { + tickers, err := cmc.Tickers(&cmc.TickersOptions{ + Start: 0, + Limit: 100, + Convert: "USD", + }) + if err != nil { + log.Fatal(err) + } + + for _, ticker := range tickers { + fmt.Println(ticker.Symbol, ticker.Quotes["USD"].Price) + } +} ``` -## Examples +### Examples + +For more examples, check out the [`./v1/example`](./v1/example) directory and [documentation](https://godoc.org/github.com/miguelmota/go-coinmarketcap/v1) -Check out the [`./example`](./example) directory and documentation. +--- ## License diff --git a/pro/v1/coinmarketcap.go b/pro/v1/coinmarketcap.go index 51a6b7e..dd51032 100644 --- a/pro/v1/coinmarketcap.go +++ b/pro/v1/coinmarketcap.go @@ -1,6 +1,123 @@ // Package coinmarketcap Coin Market Cap API client for Go package coinmarketcap +import ( + "encoding/json" + "errors" + "fmt" + "log" + "os" + "strings" +) + +// Interface interface +type Interface interface { + CryptocurrencyInfo(options *CryptocurrencyInfoOptions) (map[string]*CryptocurrencyInfo, error) + CryptocurrencyListingsLatests(options *CryptocurrencyListingsLatestsOptions) ([]*Listing, error) +} + +// Status is the status structure +type Status struct { + Timestamp string `json:"timestamp"` + ErrorCode int `json:"error_code"` + ErrorMessage *string `json:"error_message"` + Elapsed int `json:"elapsed"` + CreditCount int `json:"credit_count"` +} + +// Response is the response structure +type Response struct { + Status Status `json:"status"` + Data interface{} `json:"data"` +} + +// Listing is the listing structure +type Listing struct { + ID float64 `json:"id"` + Name string `json:"name"` + Symbol string `json:"symbol"` + Slug string `json:"slug"` + CirculatingSupply float64 `json:"circulating_supply"` + TotalSupply float64 `json:"total_supply"` + MaxSupply float64 `json:"max_supply"` + DateAdded string `json:"date_added"` + NumMarketPairs float64 `json:"num_market_pairs"` + CMCRank float64 `json:"cmc_rank"` + LastUpdated string `json:"last_updated"` + Quote map[string]*Quote `json:"quote"` +} + +// Quote is the quote structure +type Quote 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 string `json:"last_updated"` +} + +// CryptocurrencyInfo options +type CryptocurrencyInfo struct { + ID float64 `json:"id"` + Name string `json:"name"` + Symbol string `json:"symbol"` + Category string `json:"category"` + Slug string `json:"slug"` + Logo string `json:"logo"` + Tags []string `json:"tags"` + Urls map[string]interface{} `json:"urls"` +} + +// CryptocurrencyInfoOptions options +type CryptocurrencyInfoOptions struct { + ID string + Symbol string +} + +// CryptocurrencyListingsLatestsOptions options +type CryptocurrencyListingsLatestsOptions struct { + Start int + Limit int + Convert string + Sort string +} + +// SortOptions sort options +var SortOptions sortOptions + +type sortOptions struct { + Name string + Symbol string + DateAdded string + MarketCap string + Price string + CirculatingSupply string + TotalSupply string + MaxSupply string + NumMarketPairs string + Volume24H string + PercentChange1H string + PercentChange24H string + PercentChange7D string +} + +// Client the CoinMarketCap client +type Client struct { + proAPIKey string +} + +// Config the client config structure +type Config struct { + ProAPIKey string +} + +var ( + // ErrCouldNotCast could not cast error + ErrCouldNotCast = errors.New("could not cast") +) + var ( siteURL = "https://coinmarketcap.com" baseURL = "https://pro-api.coinmarketcap.com/v1" @@ -11,7 +128,132 @@ var ( // NewClient initializes a new client func NewClient(cfg *Config) *Client { + if cfg == nil { + cfg = new(Config) + } + + if cfg.ProAPIKey == "" { + cfg.ProAPIKey = os.Getenv("CMC_PRO_API_KEY") + } + + if cfg.ProAPIKey == "" { + log.Fatal("Pro API Key is required") + } + return &Client{ proAPIKey: cfg.ProAPIKey, } } + +// CryptocurrencyInfo returns all static metadata for one or more cryptocurrencies including name, symbol, logo, and its various registered URLs. +func (s *Client) CryptocurrencyInfo(options *CryptocurrencyInfoOptions) (map[string]*CryptocurrencyInfo, error) { + var params []string + if options == nil { + options = new(CryptocurrencyInfoOptions) + } + if options.ID != "" { + params = append(params, fmt.Sprintf("id=%s", options.ID)) + } + if options.Symbol != "" { + params = append(params, fmt.Sprintf("symbol=%s", options.Symbol)) + } + + url := fmt.Sprintf("%s/cryptocurrency/info?%s", baseURL, strings.Join(params, "&")) + + body, err := s.makeReq(url) + resp := new(Response) + err = json.Unmarshal(body, &resp) + if err != nil { + return nil, err + } + + var result = make(map[string]*CryptocurrencyInfo) + ifcs, ok := resp.Data.(map[string]interface{}) + if !ok { + return nil, ErrCouldNotCast + } + + for k, v := range ifcs { + info := new(CryptocurrencyInfo) + b, err := json.Marshal(v) + if err != nil { + return nil, err + } + err = json.Unmarshal(b, info) + if err != nil { + return nil, err + } + result[k] = info + } + + return result, nil +} + +// CryptocurrencyListingsLatests gets a paginated list of all cryptocurrencies with latest market data. You can configure this call to sort by market cap or another market ranking field. Use the "convert" option to return market values in multiple fiat and cryptocurrency conversions in the same call. +func (s *Client) CryptocurrencyListingsLatests(options *CryptocurrencyListingsLatestsOptions) ([]*Listing, error) { + var params []string + if options == nil { + options = new(CryptocurrencyListingsLatestsOptions) + } + if options.Start != 0 { + params = append(params, fmt.Sprintf("start=%v", options.Start)) + } + if options.Limit != 0 { + params = append(params, fmt.Sprintf("limit=%v", options.Limit)) + } + if options.Convert != "" { + params = append(params, fmt.Sprintf("convert=%s", options.Convert)) + } + if options.Sort != "" { + params = append(params, fmt.Sprintf("sort=%s", options.Sort)) + } + + url := fmt.Sprintf("%s/cryptocurrency/listings/latest?%s", baseURL, strings.Join(params, "&")) + + body, err := s.makeReq(url) + resp := new(Response) + err = json.Unmarshal(body, &resp) + if err != nil { + return nil, err + } + + var listings []*Listing + ifcs, ok := resp.Data.([]interface{}) + if !ok { + return nil, ErrCouldNotCast + } + + for i := range ifcs { + ifc := ifcs[i] + listing := new(Listing) + b, err := json.Marshal(ifc) + if err != nil { + return nil, err + } + err = json.Unmarshal(b, listing) + if err != nil { + return nil, err + } + listings = append(listings, listing) + } + + return listings, nil +} + +func init() { + SortOptions = sortOptions{ + Name: "name", + Symbol: "symbol", + DateAdded: "date_added", + MarketCap: "market_cap", + Price: "price", + CirculatingSupply: "circulating_supply", + TotalSupply: "total_supply", + MaxSupply: "max_supply", + NumMarketPairs: "num_market_pairs", + Volume24H: "volume_24h", + PercentChange1H: "percent_change_1h", + PercentChange24H: "percent_change_24h", + PercentChange7D: "percent_change_7d", + } +} diff --git a/pro/v1/coinmarketcap_test.go b/pro/v1/coinmarketcap_test.go index 18fdeb7..021bea9 100644 --- a/pro/v1/coinmarketcap_test.go +++ b/pro/v1/coinmarketcap_test.go @@ -1,269 +1,49 @@ package coinmarketcap import ( + "os" "testing" ) -var proAPIKey = "02585d6d-fa6a-460c-833c-3146576cbc70" +var proAPIKey = os.Getenv("CMC_PRO_API_KEY") var client = NewClient(&Config{ ProAPIKey: proAPIKey, }) -func TestCryptocurrencyListingsLatests(t *testing.T) { - listings, err := client.CryptocurrencyListingsLatests(&CryptocurrencyListingsLatestsOptions{ - Limit: 1, +func TestCryptocurrencyInfo(t *testing.T) { + info, err := client.CryptocurrencyInfo(&CryptocurrencyInfoOptions{ + Symbol: "BTC", }) if err != nil { t.Error(err) } - if len(listings) == 0 { - t.FailNow() - } - if listings[0].Name != "Bitcoin" { - t.FailNow() - } - if listings[0].Quote["USD"].Price <= 0 { + if info["BTC"].Name != "Bitcoin" { t.FailNow() } } -func TestSortOptions(t *testing.T) { - if SortOptions.MarketCap != "market_cap" { - t.FailNow() - } -} - -/* -func TestTickers(t *testing.T) { - tickers, err := Tickers(&TickersOptions{ - Start: 0, - Limit: 10, - Convert: "USD", +func TestCryptocurrencyListingsLatests(t *testing.T) { + listings, err := client.CryptocurrencyListingsLatests(&CryptocurrencyListingsLatestsOptions{ + Limit: 1, }) if err != nil { t.Error(err) } - if len(tickers) != 10 { - t.FailNow() - } -} - -func TestTicker(t *testing.T) { - ticker, err := Ticker(&TickerOptions{ - Symbol: "ETH", - Convert: "USD", - }) - if err != nil { - t.FailNow() - } - if ticker.ID <= 0 { - t.FailNow() - } - if ticker.Name != "Ethereum" { - t.FailNow() - } - if ticker.Symbol != "ETH" { - t.FailNow() - } - if ticker.Slug != "ethereum" { - t.FailNow() - } - if ticker.Rank <= 0 { - t.FailNow() - } - if ticker.CirculatingSupply <= 0 { - t.FailNow() - } - if ticker.TotalSupply <= 0 { - t.FailNow() - } - if ticker.MaxSupply <= -1 { - t.FailNow() - } - if ticker.LastUpdated <= 0 { - t.FailNow() - } - if ticker.Quotes["USD"].MarketCap <= 0 { - t.FailNow() - } - if ticker.Quotes["USD"].Volume24H <= 0 { - t.FailNow() - } - if ticker.Quotes["USD"].MarketCap <= 0 { - t.FailNow() - } - if ticker.Quotes["USD"].PercentChange1H == 0 { - t.FailNow() - } - if ticker.Quotes["USD"].PercentChange24H == 0 { - t.FailNow() - } - if ticker.Quotes["USD"].PercentChange7D == 0 { - t.FailNow() - } -} - -func TestTickerGraph(t *testing.T) { - var threeMonths int64 = (60 * 60 * 24 * 90) - end := time.Now().Unix() - start := end - threeMonths - - graph, err := TickerGraph(&TickerGraphOptions{ - Symbol: "ETH", - Start: start, - End: end, - }) - if err != nil { - t.FailNow() - } - - if graph.MarketCapByAvailableSupply[0][0] == 0 { - t.FailNow() - } - if graph.PriceBTC[0][0] == 0 { - t.FailNow() - } - if graph.PriceUSD[0][0] == 0 { - t.FailNow() - } - if graph.VolumeUSD[0][0] == 0 { - t.FailNow() - } -} - -func TestGlobalMarket(t *testing.T) { - market, err := GlobalMarket(&GlobalMarketOptions{ - Convert: "USD", - }) - if err != nil { - t.FailNow() - } - if market.ActiveCurrencies <= 0 { - t.FailNow() - } - if market.ActiveMarkets <= 0 { - t.FailNow() - } - if market.LastUpdated <= 0 { - t.FailNow() - } - if market.BitcoinPercentageOfMarketCap == 0 { - t.FailNow() - } - if market.Quotes["USD"].TotalVolume24H == 0 { - t.FailNow() - } - if market.Quotes["USD"].TotalMarketCap == 0 { - t.FailNow() - } -} - -func TestGlobalMarketGraph(t *testing.T) { - var threeMonths int64 = (60 * 60 * 24 * 90) - end := time.Now().Unix() - start := end - threeMonths - graph, err := GlobalMarketGraph(&GlobalMarketGraphOptions{ - Start: start, - End: end, - }) - if err != nil { - t.FailNow() - } - if graph.MarketCapByAvailableSupply[0][0] == 0 { - t.FailNow() - } - if graph.VolumeUSD[0][0] == 0 { - t.FailNow() - } -} - -func TestGlobalAltcoinMarketGraph(t *testing.T) { - var threeMonths int64 = (60 * 60 * 24 * 90) - end := time.Now().Unix() - start := end - threeMonths - graph, err := GlobalAltcoinMarketGraph(&GlobalAltcoinMarketGraphOptions{ - Start: start, - End: end, - }) - if err != nil { - t.FailNow() - } - if graph.MarketCapByAvailableSupply[0][0] == 0 { - t.FailNow() - } - if graph.VolumeUSD[0][0] == 0 { - t.FailNow() - } -} - -func TestMarkets(t *testing.T) { - markets, err := Markets(&MarketsOptions{ - Symbol: "ETH", - }) - if err != nil { - t.FailNow() - } - if len(markets) == 0 { - t.FailNow() - } - - market := markets[0] - if market.Rank == 0 { - t.FailNow() - } - if market.Exchange == "" { - t.FailNow() - } - if market.Pair == "" { - t.FailNow() - } - if market.VolumeUSD == 0 { - t.FailNow() - } - if market.Price == 0 { - t.FailNow() - } - if market.VolumePercent == 0 { - t.FailNow() - } - if market.Updated == "" { - } -} - -func TestPrice(t *testing.T) { - price, err := Price(&PriceOptions{ - Symbol: "ETH", - Convert: "USD", - }) - if err != nil { + if len(listings) == 0 { t.FailNow() } - if price <= 0 { + if listings[0].Name != "Bitcoin" { t.FailNow() } -} - -func TestDoReq(t *testing.T) { - // TODO -} - -func TestMakeReq(t *testing.T) { - // TODO -} - -func TestToInt(t *testing.T) { - v := toInt("5") - if v != 5 { + if listings[0].Quote["USD"].Price <= 0 { t.FailNow() } } -func TestToFloat(t *testing.T) { - v := toFloat("5.2") - if v != 5.2 { +func TestSortOptions(t *testing.T) { + if SortOptions.MarketCap != "market_cap" { t.FailNow() } } -*/ diff --git a/pro/v1/cryptocurrency_api.go b/pro/v1/cryptocurrency_api.go deleted file mode 100644 index cf0c854..0000000 --- a/pro/v1/cryptocurrency_api.go +++ /dev/null @@ -1,57 +0,0 @@ -package coinmarketcap - -import ( - "encoding/json" - "fmt" - "log" - "strings" -) - -// CryptocurrencyListingsLatests gets the all cryptocurrencies (latest) -func (s *Client) CryptocurrencyListingsLatests(options *CryptocurrencyListingsLatestsOptions) ([]*Listing, error) { - var params []string - if options == nil { - options = new(CryptocurrencyListingsLatestsOptions) - } - if options.Start != 0 { - params = append(params, fmt.Sprintf("start=%v", options.Start)) - } - if options.Limit != 0 { - params = append(params, fmt.Sprintf("limit=%v", options.Limit)) - } - if options.Convert != "" { - params = append(params, fmt.Sprintf("convert=%s", options.Convert)) - } - if options.Sort != "" { - params = append(params, fmt.Sprintf("sort=%s", options.Sort)) - } - - url := fmt.Sprintf("%s/cryptocurrency/listings/latest?%s", baseURL, strings.Join(params, "&")) - - body, err := s.makeReq(url) - resp := new(Response) - err = json.Unmarshal(body, &resp) - if err != nil { - return nil, err - } - - var listings []*Listing - ifcs, ok := resp.Data.([]interface{}) - if ok { - for i := range ifcs { - ifc := ifcs[i] - listing := new(Listing) - b, err := json.Marshal(ifc) - if err != nil { - log.Fatal(err) - } - err = json.Unmarshal(b, listing) - if err != nil { - log.Fatal(err) - } - listings = append(listings, listing) - } - } - - return listings, nil -} diff --git a/pro/v1/example/all_listings.go b/pro/v1/example/all_listings.go new file mode 100644 index 0000000..cbf022b --- /dev/null +++ b/pro/v1/example/all_listings.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + "log" + + cmc "github.com/miguelmota/go-coinmarketcap/pro/v1" +) + +func main() { + client := cmc.NewClient(&Config{ + ProAPIKey: "01585d6d-123-456-789-3146576cbc70", + }) + + listings, err := client.CryptocurrencyListingsLatests(&cmc.CryptocurrencyListingsLatestsOptions{ + Limit: 1, + }) + if err != nil { + log.Fatal(err) + } + + fmt.Println(listings[0].Name) + fmt.Println(listings[0].Quote["USD"].Price) +} diff --git a/pro/v1/types.go b/pro/v1/types.go deleted file mode 100644 index e28c3d3..0000000 --- a/pro/v1/types.go +++ /dev/null @@ -1,120 +0,0 @@ -package coinmarketcap - -// Interface interface -type Interface interface { - //Listings() ([]*types.Listing, error) - /* - Tickers(options *TickersOptions) ([]*types.Ticker, error) - Ticker(options *TickerOptions) (*types.Ticker, error) - TickerGraph(options *TickerGraphOptions) (*types.TickerGraph, error) - GlobalMarket(options *GlobalMarketOptions) (*types.GlobalMarket, error) - GlobalMarketGraph(options *GlobalMarketGraphOptions) (*types.MarketGraph, error) - GlobalAltcoinMarketGraph(options *GlobalAltcoinMarketGraphOptions) (*types.MarketGraph, error) - Markets(options *MarketsOptions) ([]*types.Market, error) - Price(options *PriceOptions) (float64, error) - CoinID(symbol string) (int, error) - CoinSlug(symbol string) (string, error) - */ -} - -// listingsMedia listings response media -type listingsMedia struct { - //Data []*types.Listing `json:"data"` -} - -// Status is the status structure -type Status struct { - Timestamp string `json:"timestamp"` - ErrorCode int `json:"error_code"` - ErrorMessage *string `json:"error_message"` - Elapsed int `json:"elapsed"` - CreditCount int `json:"credit_count"` -} - -// Response is the response structure -type Response struct { - Status Status `json:"status"` - Data interface{} `json:"data"` -} - -// Listing is the listing structure -type Listing struct { - ID float64 `json:"id"` - Name string `json:"name"` - Symbol string `json:"symbol"` - Slug string `json:"slug"` - CirculatingSupply float64 `json:"circulating_supply"` - TotalSupply float64 `json:"total_supply"` - MaxSupply float64 `json:"max_supply"` - DateAdded string `json:"date_added"` - NumMarketPairs float64 `json:"num_market_pairs"` - CMCRank float64 `json:"cmc_rank"` - LastUpdated string `json:"last_updated"` - Quote map[string]*Quote `json:"quote"` -} - -// Quote is the quote structure -type Quote 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 string `json:"last_updated"` -} - -// CryptocurrencyListingsLatestsOptions options -type CryptocurrencyListingsLatestsOptions struct { - Start int - Limit int - Convert string - Sort string -} - -// SortOptions sort options -var SortOptions sortOptions - -type sortOptions struct { - Name string - Symbol string - DateAdded string - MarketCap string - Price string - CirculatingSupply string - TotalSupply string - MaxSupply string - NumMarketPairs string - Volume24H string - PercentChange1H string - PercentChange24H string - PercentChange7D string -} - -// Client the CoinMarketCap client -type Client struct { - proAPIKey string -} - -// Config the client config structure -type Config struct { - ProAPIKey string -} - -func init() { - SortOptions = sortOptions{ - Name: "name", - Symbol: "symbol", - DateAdded: "date_added", - MarketCap: "market_cap", - Price: "price", - CirculatingSupply: "circulating_supply", - TotalSupply: "total_supply", - MaxSupply: "max_supply", - NumMarketPairs: "num_market_pairs", - Volume24H: "volume_24h", - PercentChange1H: "percent_change_1h", - PercentChange24H: "percent_change_24h", - PercentChange7D: "percent_change_7d", - } -} diff --git a/example/v1_all_tickers.go b/v1/example/all_tickers.go similarity index 100% rename from example/v1_all_tickers.go rename to v1/example/all_tickers.go diff --git a/example/all_tickers.go b/v2/example/all_tickers.go similarity index 86% rename from example/all_tickers.go rename to v2/example/all_tickers.go index 57c794d..608afcc 100644 --- a/example/all_tickers.go +++ b/v2/example/all_tickers.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - cmc "github.com/miguelmota/go-coinmarketcap" + cmc "github.com/miguelmota/go-coinmarketcap/v2" ) func main() { diff --git a/example/global_market.go b/v2/example/global_market.go similarity index 83% rename from example/global_market.go rename to v2/example/global_market.go index aa46147..f3d1e02 100644 --- a/example/global_market.go +++ b/v2/example/global_market.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - cmc "github.com/miguelmota/go-coinmarketcap" + cmc "github.com/miguelmota/go-coinmarketcap/v2" ) func main() { diff --git a/example/price.go b/v2/example/price.go similarity index 81% rename from example/price.go rename to v2/example/price.go index 684e502..dcc927f 100644 --- a/example/price.go +++ b/v2/example/price.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - cmc "github.com/miguelmota/go-coinmarketcap" + cmc "github.com/miguelmota/go-coinmarketcap/v2" ) func main() { diff --git a/example/ticker.go b/v2/example/ticker.go similarity index 84% rename from example/ticker.go rename to v2/example/ticker.go index f274c90..aab4cc5 100644 --- a/example/ticker.go +++ b/v2/example/ticker.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - cmc "github.com/miguelmota/go-coinmarketcap" + cmc "github.com/miguelmota/go-coinmarketcap/v2" ) func main() { diff --git a/example/ticker_graph.go b/v2/example/ticker_graph.go similarity index 88% rename from example/ticker_graph.go rename to v2/example/ticker_graph.go index 3209326..38e29c7 100644 --- a/example/ticker_graph.go +++ b/v2/example/ticker_graph.go @@ -5,7 +5,7 @@ import ( "log" "time" - cmc "github.com/miguelmota/go-coinmarketcap" + cmc "github.com/miguelmota/go-coinmarketcap/v2" ) func main() {