npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bancor-api-node

v0.3.0

Published

NodeJS client for the Bancor API

Downloads

11

Readme

bancor-api-node

NodeJS client for the Bancor API.

Table of Contents

Installation

npm install bancor-api-node

API

tickerBySymbol

This function returns a ticker showing price (low, high, current), supply, and volume of specified currency.

Parameters

  • currencyId String Input desired currency.
  • fromCurrencyId String The price of first currency is displayed in this currency.
  • callback callback Callback function.

Examples

bancor.ticker("OMG", "GNO", function(data, response) {
     console.log(data);
  })
 { name: 'OmiseGo',
   symbol: 'OMG',
   code: 'OMG',
   decimals: 18,
   price24hHigh: 0,
   price24hLow: 0,
   price: 0.05595976535725013,
   price24h: 0.044364364108873615,
   totalSupply: '140245398245132780789239631',
   volume24h: '119202620641242380323' } }

Returns object JSON object.

ticker

This function returns a ticker showing price (low, high, current), supply, and volume of specified currency.

Parameters

  • currencyId String Input desired currency id.
  • fromCurrencyId String The price of first currency is displayed in this currency.
  • callback callback Callback function.

Examples

bancor.ticker("5a086f93875e890001605abc", "5a174c5145a97200011ad30a", function(data, response) {
     console.log(data);
  })
 { name: 'OmiseGo',
   symbol: 'OMG',
   code: 'OMG',
   decimals: 18,
   price24hHigh: 0,
   price24hLow: 0,
   price: 0.05595976535725013,
   price24h: 0.044364364108873615,
   totalSupply: '140245398245132780789239631',
   volume24h: '119202620641242380323' } }

Returns object JSON object.

rate

This function returns a the current price of the specified currency.

Parameters

  • fromCurrencyCode
  • toCurrencyCode
  • callback callback Callback function.
  • currencyId String Input desired currency.
  • fromCurrencyId String The price of first currency is displayed in this currency.

Examples

bancor.rate("ETH", "USD", function(data, response) {
     console.log(data);
  })
 {"data":{"USD":1033.87}}

Returns object JSON object.

tokens

This function returns a list of tokens on Bancor.

Parameters

  • limit number Maximum number of tokens to list.
  • skip number Skip this number of tokens.
  • fromCurrencyCode String Currency to display prices in.
  • includeTotal boolean Include total.
  • includePrice24H boolean Include 24 hour price.
  • includePrice boolean Include price.
  • includePriceHistory boolean Include price history.
  • callback callback Callback function.

Examples

bancor.tokens(0, 0, "OMG", true,true,true,true, function(data, response) {
console.log(data);
})
data: 
{ currencies: { page: [Object] },
price: 
{ '5a1327c9c92a1700011c7baf': 0.030692632427397986,
'5a03590f08849f0001097d29': 0.13846103543655108,
'5a3cb6868fb75500011ab51d': 0.23149159025255506,
'5a174c5145a97200011ad30a': 0.021382577804332024,
'5a1d8d7b634e00000187855b': 0.000043367446001951,
'59d27d45acb3c12634d19efb': 0.06530552814813005,
'5a048e3078658d0001ffdab8': 0.07528024881828617,
'59d745ff90509add31e9db14': 17.961486298296112,
'5a1af60e9f604e00011f09eb': 0.015107538325629414,
'5a2cfacad0129700019a7270': 0.00890152494283532,
'594bb7e468a95e00203b048d': 0.3726407497709882,
'5a086f93875e890001605abc': 1,
'5a3800604b02a6ad9f85324f': 0.007558379155117594,
'5a37e92fed8a500001de70da': 0.03601647227852549 },
price24h: 
{ '5a086f93875e890001605abc': 1,
'594bb7e468a95e00203b048d': 0.37856454757867614,
'59d27d45acb3c12634d19efb': 0.059521291958231165,
'5a3cb6868fb75500011ab51d': 0,
'5a174c5145a97200011ad30a': 0.022126351058902722,
'5a048e3078658d0001ffdab8': 0.06775040652793572,
'5a1d8d7b634e00000187855b': 0.00005011696895057975,
'5a37e92fed8a500001de70da': 0.03556953896192395,
'5a3800604b02a6ad9f85324f': 0.009187771984328866,
'5a03590f08849f0001097d29': 0.1434845498812609,
'5a1af60e9f604e00011f09eb': 0.016895927407386328,
'5a2cfacad0129700019a7270': 0.00920144823242839,
'59d745ff90509add31e9db14': 22.540613848221113,
'5a1327c9c92a1700011c7baf': 0.02289891182252949 },
priceHistory7d: {} } }

Returns object JSON object.

relays

This function returns a list of relays on Bancor.

Parameters

  • limit number Maximum number of tokens to list.
  • skip number Skip this number of tokens.
  • fromCurrencyCode String Currency to display prices in.
  • includeTotal boolean Include total.
  • includePrice24H boolean Include 24 hour price.
  • includePrice boolean Include price.
  • includePriceHistory boolean Include price history.
  • callback callback Callback function.

Examples

bancor.relays(0, 0, "OMG", true,true,true,true, function(data, response) {
console.log(data);
})
data: 
{ currencies: { page: [Object] },
price: 
{ '594bb7e468a95e00203b048d': 0.3726407497709882,
'5a1af60e9f604e00011f09eb': 0.015107538325629414,
'5a174c5145a97200011ad30a': 0.021382577804332024,
'59d745ff90509add31e9db14': 17.961486298296112,
'5a3800604b02a6ad9f85324f': 0.007558379155117594,
'5a3cb6868fb75500011ab51d': 0.23149159025255506,
'5a086f93875e890001605abc': 1,
'5a1d8d7b634e00000187855b': 0.000043367446001951,
'5a048e3078658d0001ffdab8': 0.07528024881828617,
'5a37e92fed8a500001de70da': 0.03601647227852549,
'5a03590f08849f0001097d29': 0.13846103543655108,
'59d27d45acb3c12634d19efb': 0.06530552814813005,
'5a1327c9c92a1700011c7baf': 0.030692632427397986,
'5a2cfacad0129700019a7270': 0.00890152494283532 },
price24h: 
{ '5a086f93875e890001605abc': 1,
'594bb7e468a95e00203b048d': 0.37856454757867614,
'59d27d45acb3c12634d19efb': 0.059521291958231165,
'5a3cb6868fb75500011ab51d': 0,
'5a2cfacad0129700019a7270': 0.00920144823242839,
'5a03590f08849f0001097d29': 0.1434845498812609,
'59d745ff90509add31e9db14': 22.540613848221113,
'5a37e92fed8a500001de70da': 0.03556953896192395,
'5a1327c9c92a1700011c7baf': 0.02289891182252949,
'5a048e3078658d0001ffdab8': 0.06775040652793572,
'5a174c5145a97200011ad30a': 0.022126351058902722,
'5a1d8d7b634e00000187855b': 0.00005011696895057975,
'5a1af60e9f604e00011f09eb': 0.016895927407386328,
'5a3800604b02a6ad9f85324f': 0.009187771984328866 },
priceHistory7d: {} } }

Returns object JSON object.

currencies

This function can be used to search for a token or list all tokens.

Parameters

  • name String Search string, leave blank for list tokens.
  • limit number Maximum number of tokens to list.
  • skip number Skip this number of tokens.
  • callback callback Callback function.

Examples

bancor.currencies("", 20,0, function(data, response) {
console.log(data);
})
 { data: 
{ currencies: 
{ includeTotal: false,
skip: 0,
limit: 20,
total: null,
page: [Object] } } }

Returns object JSON object.

Future Work

  • Offline Symbol lookup table
  • Add further APIs (community/bounty)
  • Payment APIs

Tip Jar

  • ETH - 0xA1975D105949cC3d3b4637aC893A4Fe1b06aABAa