Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nomics

Package Overview
Dependencies
Maintainers
3
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nomics

A Node and Browser client to make using the [Nomics API](https://api.nomics.com) a breeze in your JavaScript project.

  • 0.3.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
24
decreased by-63.64%
Maintainers
3
Weekly downloads
 
Created
Source

Nomics JavaScript client

A Node and Browser client to make using the Nomics API a breeze in your JavaScript project.

This project is currently under development

Installation and Usage

To install the Nomics client, simply install the package:

npm install --save nomics
yarn add nomics

Then import and initialize the client:

import Nomics from "nomics";

// ...

const nomics = new Nomics({
  apiKey: "<your api key>"
});

// ...

Ticker functions

To interact with the API after initializing the client, call the corresponding function off of the client variable:

async function client() {
  // all currencies provided by the ticker with default options
  const currencies = await nomics.currenciesTicker();
}

Please note the use of await here. Because these requests are asynchronous and are returned via Promise, the functions must be awaited. Using promise syntax will also work:

function client() {
  let currencies;
  nomics.currenciesTicker().then(ticker => (currencies = ticker));
}
Currently supported Ticker functions

Currencies

nomics.currenciesTicker({
  /*
    Specify the interval for interval data in return
    One or more strings can be provided. If not provided, **all** are used.
    The intervals specified will affect what is returned in the response (see below)
  */
  interval?: ['1d'], // '1d', '7d', '30d', '365d', 'ytd'
  /*
    Limit the returned currencies to the ones in the following array. If not
    specified, **all** will be returned
  */
  ids?: ['BTC', 'ETH'],
  /*
    Specify the currency to quote all returned prices in
  */
  quoteCurrency?: "EUR", // [DEPRECATED] use "convert" below instead
  convert?: "EUR", // defaults to "USD"
});

This returns a list of all currencies from the currencies ticker endpoint with the following data:

NameTypeDescription
idstringThe currency's display id
symbolstringThe currency's original symbol
namestringThe full name
logo_urlstringThe url for the currency logo image
pricestringCurrent price
price_datestringThe date (YYYY-MM-DD) of the price
circulating_supplystringThe current circulating supply
max_supplystringThe max supply of the currency
market_capstringTotal market cap for the currency
rankstringRank by market cap
highstringAll time high for the currency
high_timestampstringThe date of the all time high

Additionally, the returned data will come with interval information corresponding to the interval options passed with the call for each of the currency rows. For each interval string, the response will will have a key of the same name with interval data.

For example:

const currencies = await nomics.currenciesTicker();
const oneDayIntervalData = currencies[0]["1d"]; // the first row's 1d interval

The interval data is as follows:

NameTypeDescription
volumestringCurrent volume
price_changestringPrice change over the interval
price_change_pctstringPrice change percent over the interval
volume_changestringVolume change over the interval
volume_change_pctstringVolume change percent over the interval
market_cap_changestringMarket cap change over the interval
market_cap_change_pctstringMarket cap change percent over the interval

Development

Publishing a new version

  1. Version the package: npm version {patch | minor | major} — this updates the package json accordingly
  2. Publish the package: npm publish — this does a pre-publish step to transpile the code to /dist, and then it publishes that. If you have 2FA setup, it’ll prompt you to enter that before publish finishes
  3. Commit and push the update back to master: git push origin master — just make sure that the package.json in master matches the published version

Keywords

FAQs

Package last updated on 18 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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