Socket
Socket
Sign inDemoInstall

cryptocompare

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cryptocompare - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

6

CHANGELOG.md

@@ -0,1 +1,7 @@

0.3.0 / 2017-11-27
------------------
- added: `coinList()` method
- fixed: `generateAvg()` was broken due to endpoint changes
0.2.0 / 2017-09-01

@@ -2,0 +8,0 @@ ------------------

10

index.js

@@ -15,2 +15,7 @@ 'use strict'

function coinList () {
const url = `${baseUrl}all/coinlist`
return fetchJSON(url)
}
function price (fsym, tsyms, options) {

@@ -51,4 +56,4 @@ options = options || {}

function generateAvg (fsym, tsym, markets, tryConversion) {
let url = `${baseUrl}generateAvg?fsym=${fsym}&tsym=${tsym}&markets=${markets}`
function generateAvg (fsym, tsym, e, tryConversion) {
let url = `${baseUrl}generateAvg?fsym=${fsym}&tsym=${tsym}&e=${e}`
if (tryConversion === false) url += '&tryConversion=false'

@@ -113,2 +118,3 @@ return fetchJSON(url).then(result => result.RAW)

module.exports = {
coinList,
price,

@@ -115,0 +121,0 @@ priceMulti,

2

package.json
{
"name": "cryptocompare",
"description": "CryptoCompare JavaScript API",
"version": "0.2.0",
"version": "0.3.0",
"author": "JP Richardson <jprichardson@gmail.com>",

@@ -6,0 +6,0 @@ "bugs": {

@@ -39,2 +39,62 @@ cryptocompare

### `coinList()`
Get the current list of all cryptocurrencies and the following information about each coin.
`coinList()`
- `No parameters`
- `Returns` (Object)...
- `BaseImageUrl` (String) The base url for all the images from the ImageUrl field (https://www.cryptocompare.com),
- `BaseLinkUrl` The base url for all the links from the Url field (https://www.cryptocompare.com)
- `Data` (Object) Contains the following infomration about each coin.
- `Id` (String)
- `Url` (String) Url to the CryptoCompare page for the coin. (Ex: `/coins/eth/overview`) Url must be appended to `https://www.cryptocompare.com`.
- `ImageUrl` (String) Url to get the coin logo image. (Ex: `/media/351001/404.png`). Url must be appended to `https://www.cryptocompare.com`.
- `Name` (String) Ticker name of the given cryptocurrency.
- `Symbol` (String) Ticker symbol of the given cryptocurrency (usually the same as the name).
- `CoinName` (String) Name of the given cryptocurrency.
- `FullName` (String) Name of the given cryptocurrency concatenated with the symbol (Ex: `Ethereum (ETH)`).
- `Algorithm` (String) Name cryptographic algorithm for that coin.
- `ProofType` (String) The proof type of the cryptocurrency.
- `ProofType` (String) The proof type of the cryptocurrency.
- `FullyPremined` (String) Returns "1" if the coin was premined, if not it returns "0".
- `TotalCoinSupply` (String) Total supply of the cryptocurrency.
- `PreMinedValue` (String) Value of premined coins.
- `TotalCoinsFreeFloat` (String)
- `SortOrder` (String) The order CryptoCompare ranks the coin inside their internal system.
- `Sponsored` (Boolean) Is `true` when the coin is sponsored by CryptoCompare, is `false` otherwise.
```js
const cc = require('cryptocompare')
// Usage:
cc.coinList()
.then(coinList => {
console.log(coinList)
// ->
// {
// BTC: {
// Id: "1182",
// Url: "/coins/btc/overview",
// ImageUrl: "/media/19633/btc.png",
// Name: "BTC",
// Symbol: "BTC",
// CoinName: "Bitcoin",
// FullName: "Bitcoin (BTC)",
// Algorithm: "SHA256",
// ProofType: "PoW",
// FullyPremined: "0",
// TotalCoinSupply: "21000000",
// PreMinedValue: "N/A",
// TotalCoinsFreeFloat: "N/A",
// SortOrder: "1",
// Sponsored: false
// },
// ETH: {...},
// }
})
.catch(console.error)
```
### `price()`

@@ -41,0 +101,0 @@

@@ -8,2 +8,13 @@ 'use strict'

test('coinList()', t => {
t.plan(4)
cc.coinList().then(coins => {
t.strictEqual(typeof coins.Data.ETH.Name, 'string', 'coins.Data.ETH.Name` is a string')
t.strictEqual(coins.Data.ETH.Name, 'ETH', 'coins.Data.ETH.Name is \'ETH\'')
t.strictEqual(coins.Data.ETH.FullName, 'Ethereum (ETH)', 'coins.Data.ETH.FullName is \'Ethereum (ETH)\'')
t.strictEqual(coins.Data.ETH.Sponsored, false, 'coins.Data.ETH.Sponsored is \'false\'')
t.end()
}).catch(t.end)
})
test('price()', t => {

@@ -10,0 +21,0 @@ t.plan(2)

'use strict'
// NOT_USD_TRADABLE is a cryptocurrency which does not trade directly with USD.
// This value is used in testing tryConversion. Currently, this is set to LTD.
// If LTD trades directly with USD in the future, tests will fail.
// This value is used in testing tryConversion. Currently, this is set to MRSA.
// If MRSA trades directly with USD in the future, tests will fail.
// In that case, change this value:
exports.NOT_USD_TRADABLE = 'LTD'
exports.NOT_USD_TRADABLE = 'MRSA'

@@ -9,0 +9,0 @@ exports.testTryConversion = function (promise, t) {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc