coinkraal-api-interface
Advanced tools
Comparing version 0.2.7 to 0.2.8
@@ -7,7 +7,34 @@ | ||
this.agent = agent; | ||
this.apiRoot = 'https://api.coinmarketcap.com/v1'; | ||
this.apiRoot = 'https://api.coinmarketcap.com/v2'; | ||
} | ||
getCoinTopList(start, limit) { | ||
return this.agent.requests.get(`${this.apiRoot}/ticker/?start=${start}&limit=${limit}`); | ||
return this.agent.requests.get(`${this.apiRoot}/ticker/?start=${start}&limit=${limit}`) | ||
.then(data => { | ||
let arr = []; | ||
let coins = data.data; | ||
for (let id in coins) { | ||
if (coins.hasOwnProperty(id)) { | ||
let c = coins[id]; | ||
let coin = { | ||
rank: c.rank, | ||
priceUsd: c.quotes.USD.price, | ||
volumeUsd24h: c.quotes.USD.volume_24h, | ||
marketCapUsd: c.quotes.USD.market_cap, | ||
maxSupply: c.max_supply, | ||
availableSupply: c.circulating_supply, | ||
totalSupply: c.total_supply, | ||
percentChange1h: c.quotes.USD.percent_change_1h, | ||
percentChange24h: c.quotes.USD.percent_change_24h, | ||
percentChange7d: c.quotes.USD.percent_change_7d | ||
} | ||
arr.push(coin); | ||
} | ||
} | ||
return arr; | ||
}); | ||
} | ||
@@ -14,0 +41,0 @@ |
{ | ||
"name": "coinkraal-api-interface", | ||
"version": "0.2.7", | ||
"version": "0.2.8", | ||
"description": "Api Interface for CoinKraal Applications", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19334
493