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 🙏

© 2024 – Pkg Stats / Ryan Hefner

runelite

v2.0.5

Published

A real time grand exchange prices API wrapper (runelite).

Downloads

22

Readme

runelite

This is a typed wrapper of real-time grand exchange prices, brought to you by a partnership between RuneLite and the RuneScape wiki team. Please be aware that this is a fairly new project, and the endpoints may have downtime, and the prices may not be 100% accurate. Read more here.

Build

Acceptable use policy

The wiki team reserve the right to limit access to anyone, if their usage is so frequent that it threatens the stability of the entire runelite API. Please read the acceptable use policy on the wiki.

To ensure this package complies with the use policy, all requests must specify a meaningful user agent.

Table of contents

Installing

npm install runelite

Importing the package

Using import

import * as runelite from 'runelite';

Using require

const runelite = require('runelite');

Usage

Latest Price

Get the latest high and low prices for the items that we have data for, and the Unix timestamp when that transaction took place.


const useragent = "https://www.npmjs.com/package/runelite useragent/example";
// Ensure you're using a meaningful useragent to represent your use-case.

const latest = await runelite.latest({
    useragent,
});

console.log(latest)

/* output
{
  ...,
  '25833': { high: 800, highTime: 1633541890, low: 400, lowTime: 1633564731 },
  '25849': { high: 330, highTime: 1633570020, low: 320, lowTime: 1633569964 },
  ...
}
*/

console.log(latest["25849"]);

/* output
{
  high: 330, highTime: 1633570020, low: 320, lowTime: 1633569964
}
*/

You may also request specific items:

const latest = await runelite.latest({ id: 4151, useragent });
const transaction = request["4151"];

console.log(transaction);

/* output
{
  high: 1761642,
  highTime: 1633570221,
  low: 1760000,
  lowTime: 1633570184
}
*/

Mapping

Gives a list of objects containing the name, id, examine text, members status, lowalch, highalch, GE buy limit, icon file name (on the wiki).

const mapping = await runelite.mapping({ useragent });
console.log(mapping);

/* output
{
  ...,
  '25034': {
      examine: 'The trousers of a trailblazer relic hunter.',
      id: 25034,
      members: true,
      lowalch: 6000,
      limit: 5,
      value: 15000,
      highalch: 9000,
      icon: 'Trailblazer trousers (t1).png',
      name: 'Trailblazer trousers (t1)'
    },
  '25037': {
      examine: 'The boots of a trailblazer relic hunter.',
      id: 25037,
      members: true,
      lowalch: 6000,
      limit: 5,
      value: 15000,
      highalch: 9000,
      icon: 'Trailblazer boots (t1).png',
      name: 'Trailblazer boots (t1)'
    }, ...
}
*/

console.log(mapping["4151"]);

/** output
{
  examine: 'A weapon from the abyss.',
  id: 4151,
  members: true,
  lowalch: 48000,
  limit: 70,
  value: 120001,
  highalch: 72000,
  icon: 'Abyssal whip.png',
  name: 'Abyssal whip'
}
*/

Prices

Gives 5 or 60 minute average of item high and low prices as well as the number traded for the items that we have data on. Comes with a Unix timestamp indicating the 5 or 60 minute block the data is from.

const data = await runelite.prices({ useragent, timestep: "5m" });
console.log(data);

/* output
  ...,
  '25775': {
    avgHighPrice: null,
    highPriceVolume: 0,
    avgLowPrice: 1400,
    lowPriceVolume: 15,
    timestamp: 1634688300
  },
  '25778': {
    avgHighPrice: null,
    highPriceVolume: 0,
    avgLowPrice: 2001,
    lowPriceVolume: 9,
    timestamp: 1634688300
  }, ...
}
*/

console.log(data["25849"]);

/* output
{
  avgHighPrice: 466,
  highPriceVolume: 30,
  avgLowPrice: null,
  lowPriceVolume: 0,
  timestamp: 1634688300
}
*/

You may optionally provide a timestamp to return prices for. If provided, will display (in this example) 5-minute averages for all items we have data on for this time. The timestamp field represents the beginning of the 5-minute period being averaged

const data = await runelite.prices({ useragent, timestamp: 1634688300, timestep: "5m"  });

Time-series

Gives a list of the high and low prices of item with the given id at the given interval, up to 300 maximum.

Available intervals are 5m, 1h and 6h

const timeseries = await runelite.timeseries({ id: 4151, timestep: "5m", useragent });

console.log(timeseries);

/* output
[
  { timestamp: 1634629200,
    avgHighPrice: 1641363,
    avgLowPrice: 1639652,
    highPriceVolume: 7,
    lowPriceVolume: 6
  },
  {
    timestamp: 1634629500,
    avgHighPrice: 1641436,
    avgLowPrice: 1639579,
    highPriceVolume: 3,
    lowPriceVolume: 6
    },
  ...
]
*/

console.log(timeseries[0]);

/* output
{
  timestamp: 1634599800,
  avgHighPrice: 1631217,
  avgLowPrice: 1628786,
  highPriceVolume: 9,
  lowPriceVolume: 8
}
*/

license

MIT