1.0.2 • Published 5 months ago

crypto-price-fetcher v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

crypto-price-fetcher

crypto-price-fetcher is an npm package that simplifies the retrieval of cryptocurrency prices from the Binance API. It provides functions to fetch detailed ticker information for specific cryptocurrency symbols and get an overview of current prices for multiple symbols.

Installation

To install crypto-price-fetcher, use npm:

npm install crypto-price-fetcher

Usage

To use the package, require the crypto-price-fetcher module:

const { getCryptoPrices } = require("crypto-price-fetcher");

getCryptoPrices(symbols) This function fetches the current prices of multiple cryptocurrencies for a list of symbols. Example:

// Define symbols 
const symbols = ['BTCUSDT', 'ETHUSDT'];

// Call the function to get cryptocurrency prices
getCryptoPrices(symbols)
  .then(prices => {
    // Display the prices
    console.log('Cryptocurrency Prices:');
    Object.entries(prices).forEach(([symbol, data]) => {
      console.log(`${symbol}:`);
      console.log(`  Last Price: $${data.lastPrice}`);
      console.log(`  Price Change Percent: ${data.priceChangePercent}%`);
      console.log(`  Quote Volume: $${data.quoteVolume}`);
      console.log(`  Price Change: $${data.priceChange}`);
      console.log(`  High Price: $${data.highPrice}`);
      console.log(`  Low Price: $${data.lowPrice}`);
    });
  })
  .catch(error => {
    console.error('Error:', error.message);
  });

Support

If you facing any issues then you can contact the developer on telegram @UnknownScripter99.