switch to free api
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Steven Polley 2024-09-09 17:47:17 -06:00
parent 7689e3e1f2
commit 5e401c06ae

View File

@ -5,7 +5,7 @@ import (
"net/http" "net/http"
) )
const fiatConvertURL = "https://pro-api.coingecko.com/api/v3/coins/bitcoin?localization=false&tickers=false&market_data=true&community_data=false&developer_data=false&sparkline=false" const fiatConvertURL = "https://api.coingecko.com/api/v3/coins/bitcoin?localization=false&tickers=false&market_data=true&community_data=false&developer_data=false&sparkline=false"
type coinGeckoResponse struct { type coinGeckoResponse struct {
MarketData struct { MarketData struct {
@ -18,7 +18,7 @@ type coinGeckoResponse struct {
func (c *client) convertBTCToCAD(amount int) (int, error) { func (c *client) convertBTCToCAD(amount int) (int, error) {
coinGeckoData := &coinGeckoResponse{} coinGeckoData := &coinGeckoResponse{}
req, err := http.NewRequest("GET", fmt.Sprintf("%s&x_cg_pro_api_key=%s", fiatConvertURL, c.coinGeckoApiKey), nil) req, err := http.NewRequest("GET", fmt.Sprintf("%s&x-cg-demo-api-key=%s", fiatConvertURL, c.coinGeckoApiKey), nil)
if err != nil { if err != nil {
return 0, fmt.Errorf("failed to create new GET request: %v", err) return 0, fmt.Errorf("failed to create new GET request: %v", err)
} }