@luxlhm/crypto_alternative
v1.1.1
Published
CryptoAlternative package enable us to use cyrpto [Alternative API](https://alternative.me/) with functionnal programmation. You can use these functions to acces to the API : - [GetTicker](#getticker) - [GetTickerSpecificCurrency](#gettickerspecificcur
Downloads
4
Readme
CryptoAlternative
CryptoAlternative package enable us to use cyrpto Alternative API with functionnal programmation. You can use these functions to acces to the API :
How use CryptoAlternative ?
To begin, install the npm package with the command :
npm i @luxlhm/crypto_alternative
GetTicker
Get coin prices updated every 5 minutes
Example :
const crypto = require('@luxlhm/crypto_alternative')
crypto.GetTicker().then(data => console.log(data))
// or
crypto.GetTicker({limit: 2,convert: 'EUR'}).then(data => console.log(data))
Optional parameters :
{
limit?:Number;
start?:Number;
convert?:'USD'|'EUR'|'GBP'|'RUB'|'JPY'|'CAD'|'KRW'|'PLN';
structure?:'string'|'dictionnary'|'array';
sort?:'id'|'rank'|'volume_24h'|'percent_change_24h'|'price'|'percent_change_1h'|'percent_change_1h'|'percent_change_7d'|'circulating_supply'|'name';
}
GetTickerSpecificCurrency
Get ticker data of a specified coin by providing the 'id' or the 'website_slug' of the coin, for example id of bitcoin is 1 and its 'website_slug' is 'bitcoin'.
Example :
const crypto = require('@luxlhm/crypto_alternative')
crypto.GetTickerSpecificCurrency('bitcoin').then(data => console.log(data))
// or
crypto.GetTickerSpecificCurrency(1).then(data => console.log(data))
Parameters :
{
id:Numer|String;
}
GetGlobal
Get global market information at a glance.
Example :
const crypto = require('@luxlhm/crypto_alternative')
crypto.GetBlobal().then(data => console.log(data))
// or
crypto.GetBlobal({convert:'EUR'}).then(data => console.log(data))
Optional parameters :
{
convert? :'USD'|'EUR'|'GBP'|'RUB'|'JPY'|'CAD'|'KRW'|'PLN';
}
GetFearIndex
Get the latest data of the Fear and Greed Index. Fear index represent the atmosphere of the day in the crypto sphere. This data is between 0 and 100.
Example :
const crypto = require('@luxlhm/crypto_alternative')
crypto.GetFearIndex().then(data => console.log(data))
// or
crypto.GetFearIndex({limit:2, date_format:'world', format:'json'}).then(data => console.log(data))
Optional parameters :
{
limit?:number;
format?: 'csv'|'json';
date_format?: 'us'|'cn'|'kr'|'world'
}
GetFearIndexPhoto
Get the latest png graph of fear index. Graph example :
Example :
const crypto = require('@luxlhm/crypto_alternative')
crypto.GetFearIndexPhoto({name:'monday_fearindex'}).then(data => console.log(data))
// or
crypto.GetFearIndexPhoto({name:'monday_fearindex', RelativePath:'/PhotoDist'}).then(data => console.log(data))
Parameters and optional parameters :
{
name:string;
RelativePath?:string;
}
GetFearIndexPhotoDate
As before, with this function we can get the latest png graph of fear index, but the graph of an accurate day.
Example :
const crypto = require('@luxlhm/crypto_alternative')
crypto.GetFearIndexPhotoDate({name:'monday_fearindex',date:{day:20,month:3, year:2021}}).then(data => console.log(data))
// or
crypto.GetFearIndexPhotoDate({name:'monday_fearindex', RelativePath:'/PhotoDist', date:{day:20,month:3, year:2021}}).then(data => console.log(data))
Parameters and optional parameters :
{
name:string;
date:{
day:number;
month:number;
year:number;
}
RelativePath?:string;
}
Sources
Official crypto alternative documentation.