https://github.com/siris2314/node-coinlayer-wrapper
A Node Wrapper for the Coin Layer API
https://github.com/siris2314/node-coinlayer-wrapper
crypto cryptocurrency hacktoberfest hacktoberfest2021 nodejs npm npm-package wrapper
Last synced: 6 months ago
JSON representation
A Node Wrapper for the Coin Layer API
- Host: GitHub
- URL: https://github.com/siris2314/node-coinlayer-wrapper
- Owner: Siris2314
- Created: 2021-06-24T19:02:09.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-10-15T04:15:33.000Z (over 4 years ago)
- Last Synced: 2025-06-05T00:20:13.097Z (8 months ago)
- Topics: crypto, cryptocurrency, hacktoberfest, hacktoberfest2021, nodejs, npm, npm-package, wrapper
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## A node wrapper for the CoinLayer Crypto API.
[](https://www.npmjs.com/package/coinlayer-wrapper)
[](https://www.npmjs.com/package/coinlayer-wrapper)
[](https://packagephobia.com/result?p=coinlayer-wrapper)
[](https://nodei.co/npm/coinlayer-wrapper/)
### Installation:
npm:https://www.npmjs.com/package/coinlayer-wrapper
npm i coinlayer-wrapper
### Existing Methods:
* livedata(currency,crypto) - Returns Live Cryptocurrency Data
* histdata(data, currency, crypto) - Returns Historical Data from 2011 - Date Given
### Setup:
```javascript
const crypto = require('coinlayer-wrapper')
const coin = new crypto(token)
//You can get your API Token from https://coinlayer.com
```
### Simple Example:
```js
const crypto = require('coinlayer-wrapper')
const coin = new crypto(token)
const cur = 'usd';
const cryp = 'btc';
const data = coin.livedata(cur, cryp)
console.log(data)
//Sends an object with the live cryptocurrency
/*{
rate: 32806.429893,
high: 36557.84,
low: 31583.7,
vol: 247761373.242442,
cap: 614565508506.3904,
sup: 18733081,
change: -2906.1135490000015,
change_pct: -8.137514914667895
}
```
### Historical Data Example
```js
const date = '2018-04-29'
const cur = 'usd';
const cryp = 'btc';
const data = coin.histdata(date,cur, cryp)
console.log(data)
```
```
List of all available country currencies: https://coinlayer.com/target
List of all available crypto currencies: https://coinlayer.com/symbols
Quick Note:
If you get a socket error, it's on the API side,it has been going on and off, so just keep that in mind
```