This repository has been archived by the owner on Sep 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement global market metrics endpoint
- Loading branch information
1 parent
1ab78e6
commit 509be5f
Showing
4 changed files
with
120 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
cmc "github.com/miguelmota/go-coinmarketcap/pro/v1" | ||
) | ||
|
||
func main() { | ||
client := cmc.NewClient(&cmc.Config{ | ||
ProAPIKey: os.Getenv("CMC_PRO_API_KEY"), | ||
}) | ||
|
||
metrics, err := client.GlobalMetrics.LatestQuotes(&cmc.QuoteOptions{ | ||
Convert: "USD", | ||
}) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
fmt.Println(metrics.BTCDominance) // 52.3318 | ||
fmt.Println(metrics.Quote["USD"].TotalMarketCap) // 1.76486412385549e+11 | ||
} |