-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a4620a4
Showing
8 changed files
with
162 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Logs | ||
logs | ||
*.log | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directory | ||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git | ||
node_modules |
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,9 @@ | ||
language: node_js | ||
node_js: | ||
- 'stable' | ||
- '0.12' | ||
- '0.10' | ||
sudo: false | ||
cache: | ||
directories: | ||
- node_modules |
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,7 @@ | ||
# cryptocompare change log | ||
|
||
All notable changes to this project will be documented in this file. | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
|
||
## Unreleased | ||
* engage |
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,9 @@ | ||
# [MIT License](https://spdx.org/licenses/MIT) | ||
|
||
Copyright (c) 2016 JP Richardson <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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,44 @@ | ||
cryptocompare | ||
============= | ||
|
||
[![npm][npm-image]][npm-url] | ||
[![travis][travis-image]][travis-url] | ||
[![standard][standard-image]][standard-url] | ||
|
||
[npm-image]: https://img.shields.io/npm/v/cryptocompare.svg?style=flat-square | ||
[npm-url]: https://www.npmjs.com/package/cryptocompare | ||
[travis-image]: https://img.shields.io/travis/jprichardson/cryptocompare.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/jprichardson/cryptocompare | ||
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square | ||
[standard-url]: http://npm.im/standard | ||
|
||
CryptoCompare JavaScript API | ||
|
||
Install | ||
------- | ||
|
||
npm install cryptocompare | ||
|
||
|
||
Usage | ||
----- | ||
|
||
### Methods | ||
|
||
#### coinList | ||
|
||
Reference: https://www.cryptocompare.com/api/#-api-data-coinlist- | ||
|
||
| ---: | :--- | | ||
| Signature | `coinList()` | | ||
| Parameters | (none) | | ||
| Returns | A Promise function. | | ||
|
||
```js | ||
var cryptocompare = require('cryptocompare') | ||
``` | ||
|
||
|
||
## License | ||
|
||
[MIT](LICENSE.md) |
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,22 @@ | ||
/* global fetch */ | ||
|
||
var baseUrl = 'https://www.cryptocompare.com/api/data/' | ||
|
||
function fetchJSON (url) { | ||
return fetch(url) | ||
.then(res => res.json()) | ||
.then(body => { | ||
// 'response' is a CryptoCompare field | ||
if (body.Response !== 'Success') throw new Error(body.Message) | ||
return body.Data | ||
}) | ||
} | ||
|
||
function coinList () { | ||
var url = baseUrl + 'coinlist/' | ||
return fetchJSON(url) | ||
} | ||
|
||
module.exports = { | ||
coinList | ||
} |
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,32 @@ | ||
{ | ||
"name": "cryptocompare", | ||
"description": "CryptoCompare JavaScript API", | ||
"version": "0.0.0", | ||
"author": "JP Richardson <[email protected]>", | ||
"bugs": { | ||
"url": "https://github.com/exodusmovement/cryptocompare/issues" | ||
}, | ||
"devDependencies": { | ||
"node-fetch": "^1.5.3", | ||
"standard": "*", | ||
"tap-spec": "^4.0.2", | ||
"tape": "^4.0.0" | ||
}, | ||
"homepage": "https://github.com/exodusmovement/cryptocompare", | ||
"keywords": [ | ||
"api", | ||
"bitcoin", | ||
"cryptocurrency", | ||
"ethereum", | ||
"price" | ||
], | ||
"license": "MIT", | ||
"main": "index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/exodusmovement/cryptocompare.git" | ||
}, | ||
"scripts": { | ||
"test": "standard && tape test/*.js | tap-spec" | ||
} | ||
} |
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,12 @@ | ||
var test = require('tape') | ||
|
||
// set to global | ||
global.fetch = require('node-fetch') | ||
var cc = require('../') | ||
|
||
test('coinList()', function (t) { | ||
t.plan(1) | ||
cc.coinList().then(coinList => { | ||
t.strictEqual(coinList.BTC.CoinName, 'Bitcoin') | ||
}).catch(t.end) | ||
}) |