Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lewisxhe/cryptocurrencylib
https://github.com/lewisxhe/cryptocurrencylib
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/lewisxhe/cryptocurrencylib
- Owner: lewisxhe
- License: mit
- Created: 2020-03-09T08:03:03.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-18T03:05:46.000Z (about 2 years ago)
- Last Synced: 2023-03-03T16:10:18.487Z (almost 2 years ago)
- Language: C++
- Size: 14.6 KB
- Stars: 2
- Watchers: 5
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
CoinMarketCapApi2
=========================
This is an updated version of [witnessmenow/arduino-coinmarketcap-api](https://github.com/witnessmenow/arduino-coinmarketcap-api), because the original author is not maintained, I renamed it `CoinMarketCapApi2`- For the new API, you can use the currency ID or abbreviated name, such as Bitcoin, you can view the letter after Circulating Supply at https://coinmarketcap.com/, it is BTC
```
#include
#include
#include "CoinMarketCapApi.h"#define APIKEY "YOUR API KEY"
WiFiClientSecure client;
CoinMarketCapApi api(client, APIKEY);void printTickerData(String ticker){
CMCTickerResponse response = api.GetTickerInfo(ticker, "USD");
if (response.error == "") {
Serial.print("ID: ");
Serial.println(response.id);
Serial.print("Name: ");
Serial.println(response.name);
Serial.print("Symbol: ");
Serial.println(response.symbol);Serial.print("Rank: ");
Serial.println(response.cmc_rank);Serial.print("Price: ");
Serial.println(response.price);Serial.print("24h Volume: ");
Serial.println(response.volume_24h);
Serial.print("Market Cap: ");
Serial.println(response.market_cap);Serial.print("Circulating Supply: ");
Serial.println(response.circulating_supply);
Serial.print("Total Supply: ");
Serial.println(response.total_supply);Serial.print("Percent Change 1h: ");
Serial.println(response.percent_change_1h);
Serial.print("Percent Change 24h: ");
Serial.println(response.percent_change_24h);
Serial.print("Percent Change 7d: ");
Serial.println(response.percent_change_7d);
Serial.print("Last Updated: ");
Serial.println(response.last_updated);
}
}void setup()
{
//...connect your wifi
...
...//Get cryptocurrency data
printTickerData("BTC","USD");}
```