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 🙏

© 2026 – Pkg Stats / Ryan Hefner

mt5feed

v1.0.0

Published

Official JavaScript SDK for the mt5feed.com real-time metals & crypto price API

Readme

mt5feed

Official JavaScript SDK for the mt5feed.com real-time metals & crypto price API.

Installation

npm install mt5feed

Quick Start

const { MT5Feed } = require('mt5feed');

const feed = new MT5Feed({ apiKey: 'your-api-key' });

REST API

Get all prices

const prices = await feed.getPrices();
console.log(prices.XAUUSD.price); // 2345.67

Get a single price

const gold = await feed.getPrice('XAUUSD');
console.log(gold.price);     // 2345.67
console.log(gold.bid);       // 2345.50
console.log(gold.ask);       // 2345.84
console.log(gold.changePct); // 0.42
console.log(gold.high);      // 2360.10
console.log(gold.low);       // 2330.55

WebSocket — Live Prices

Option 1 — inline callback (simplest)

feed.subscribe(['XAUUSD', 'BTCUSDT'], (data) => {
  console.log(data.symbol, data.price);
});

Option 2 — per-symbol events

feed.connect().subscribe(['XAUUSD', 'BTCUSDT']);

feed.on('tick:XAUUSD',  (data) => console.log('Gold:',    data.price));
feed.on('tick:BTCUSDT', (data) => console.log('Bitcoin:', data.price));

Option 3 — single tick handler for all symbols

feed.connect().subscribe(['XAUUSD', 'XAGUSD', 'BTCUSDT', 'ETHUSDT']);

feed.on('tick', (data) => {
  console.log(`${data.symbol}: ${data.price}`);
});

Unsubscribe from a symbol

feed.unsubscribe('XAGUSD');

Disconnect

feed.disconnect();

Events

| Event | Payload | Description | |---|---|---| | connected | — | WebSocket connected | | disconnected | reason: string | WebSocket disconnected | | error | Error | Connection error | | rate_limit | { code, limit, used } | Daily limit reached | | tick | PriceData | Price tick (all symbols) | | tick:SYMBOL | PriceData | Price tick for a specific symbol |


PriceData shape

{
  symbol:    string;   // e.g. "XAUUSD"
  price:     number;   // mid price
  bid:       number;
  ask:       number;
  spread:    number;
  changePct: number;   // % change from open
  high:      number;   // day high
  low:       number;   // day low
  weekHigh:  number;
  weekLow:   number;
  display:   string;   // formatted display string
  updatedAt: string;   // ISO 8601 timestamp
}

Error handling

// REST errors have a .status property
try {
  const price = await feed.getPrice('XAUUSD');
} catch (err) {
  console.error(err.message); // e.g. "Upgrade to Pro to access this pair"
  console.error(err.status);  // 403
}

// WebSocket errors
feed.on('error', (err) => console.error('WS error:', err.message));

// Rate limit reached
feed.on('rate_limit', ({ code, limit, used }) => {
  console.warn(`Rate limit: ${used}/${limit} daily requests used`);
  feed.disconnect();
});

TypeScript

Full TypeScript types are included.

import { MT5Feed, PriceData } from 'mt5feed';

const feed = new MT5Feed({ apiKey: 'your-api-key' });

feed.on('tick:XAUUSD', (data: PriceData) => {
  console.log(data.price);
});

Available Symbols

| Symbol | Description | |---|---| | XAUUSD | Gold / US Dollar | | XAGUSD | Silver / US Dollar | | XPTUSD | Platinum / US Dollar | | BTCUSDT | Bitcoin / Tether | | ETHUSDT | Ethereum / Tether |

Symbol availability depends on your subscription plan.


Requirements

  • Node.js 18+ (uses native fetch)
  • An API key from mt5feed.com