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.
Implemented /quotes/latest to get prices by symbol and also converted
- Loading branch information
Evandro Zilli Pavei
committed
Jan 30, 2019
1 parent
975586d
commit 514aec7
Showing
2 changed files
with
96 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
cmc ".." | ||
) | ||
|
||
func main() { | ||
client := cmc.NewClient(&cmc.Config{ | ||
ProAPIKey: "01585d6d-123-456-789-3146576cbc70", | ||
}) | ||
|
||
quotesLatest, err := client.CryptocurrencyQuotesLatest(&cmc.CryptocurrencyQuotesLatestOptions{ | ||
Symbol: "BTC", //add comma and other coin symbol e.g.: "BTC,ETH,XRP" | ||
Convert: "BRL", //add comma and other coin symbol e.g.: "BRL,USD" | ||
}) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
for _, quote := range quotesLatest { | ||
fmt.Println(quote.Name) // "Bitcoin" | ||
fmt.Println(quote.Quote["BRL"].Price) // 12880.958109581403 // BTC price converted to BRL | ||
} | ||
} |