Both methods takes coin name, you can find all available names in symbols.json. If symbols.json doesn't contain coin name that you need, just pass coin symbol. (list on coinmap.io)
#####`.history(String coinName [, Number interval])` -> `Promise`
Available intervals: 1, 7, 30, 90, 180, 365 or skip this if you want all data.
Return {cap: {date: Number, value: Number}[], price: {date: Number, value: Number}[]}
var coincapio = require('coincapio-data')
coincapio.history('bitcoin', 365).then(function (data) {
var maxPrice = data.price[0]
data.price.forEach(function (price) {
if (price.value > maxPrice.value) maxPrice = price
})
console.log('The higest price at the last year is ' + maxPrice.value + '$ at ' + new Date(maxPrice.date))
})
#####`.current(String coinName)` -> `Promise`
Return {cap: Number, price: Number}
.
var coincapio = require('coincapio-data')
coincapio.current('bitcoin').then(function (data) {
console.log('Current bitcoin price is: ' + data.price + '$ (capitalization: ' + data.cap + '$)')
})
or with with custom symbol for devcoin:
var coincapio = require('coincapio-data')
coincapio.current('DVC').then(function (data) {
console.log('Current devcoin price is: ' + data.price + '$ (capitalization: ' + data.cap + '$)')
})