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

e-04-kencrypto

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

e-04-kencrypto

Get the current quote and conversions of your favorite cryptos, based on the [coinmarketcap](https://coinmarketcap.com/api/) api.

  • 1.0.8
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

KenCrypto

Get the current quote and conversions of your favorite cryptos, based on the coinmarketcap api.

Description

First of all, you need to go to their website, sign in and get your personal key. Visit the Official Site.

Instalation

$ npm i e-04-kencrypto

or

$ yarn add e-04-kencrypto

How to use

import { KenCrypto } from "e-04-kencryto";

Create an instance:

const my_crypto = new KenCrypto(API_KEY) -> Use your personal key that you got before.

That instance provides two methods:

  • quotes

Inside an array you can use an string with the crypto sign.

my_crypto.quotes(['BTC']);

The return is a promise where you can get the response with then()

example:

my_crypto.quotes(['BTC', 'eth']).then((response) => {
	console.log(response)
});

log:

{
	data: {
		BTC: {
			id: 1,
			name: 'Bitcoin',
			symbol: 'BTC',
			slug: 'bitcoin',
			date_added: '2013-04-28T00:00:00.000Z',
			last_updated: '2022-01-27T20:23:00.000Z',
			quote: {
				USD: {
					price: 36102.923873715255,
					last_updated: '2022-01-27T20:23:00.000Z'
				}
			}
		}

	}
}
  • conversion

With the conversion method you can, obviously, convert currencies. For that you'll need three arguments: the amount to be converted, the origin currency, the target currency

my_crypto.conversion(1, 'BTC', ['BRL']); --> The convertTo array can have multiple currencies, but it depends on your plan on Coin Market Cap.

Also the response is a promise where you can get the response with then()

example:

my_crypto.conversion(1, 'BTC', ['BRL']).then((response) => {
	console.log(response);
});

log:

{
	data: {
		id: 1,
		symbol: 'BTC',
		name: 'Bitcoin',
		amount: 1,
		last_updated: '2022-01-27T22:02:00.000Z',
		quote: {
			BRL: {
				price: 195481.12567089536,
				last_updated: '2022-01-27T22:02:02.000Z'
			}
		}
	}
}

Tecnologies

  • TypeScript

FAQs

Package last updated on 20 Feb 2022

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