Skip to content

Tricked-dev/lowestbins

Repository files navigation

Logo

GitHub issues GitHub forks GitHub stars GitHub license Website Discord GitHub Sponsors

forthebadge forthebadge

Lowestbins-rs

A fast and effecient lowestbins implementation this uses parrallel requests to fetch all lowestbins in less than 2.5 SECONDS and uses the hyper server allowing for practically unlimited requests per second while only using 50mb of ram! Lowestbins-rs is used by Skytils for the lowestbins feature.

Hosted Instance

If you are using this in a project please credit me! or sponsor me on github github.com/sponsors/Tricked-dev

Using in your code

Javascript

node:

const fetch = require("undici"); // node-fetch also works
let json = await fetch("https://lb.tricked.dev/lowestbins").then((res) =>
  res.json()
);

console.log(json["ENCHANTMENT_ULTIMATE_SWARM_2"]);

web/deno:

let json = await fetch("https://lb.tricked.dev/lowestbins").then((res) =>
  res.json()
);
console.log(json["ENCHANTMENT_ULTIMATE_SWARM_2"]);

Python

import requests
json = requests.get("https://lb.tricked.dev/lowestbins").json()
print(json["ENCHANTMENT_ULTIMATE_SWARM_2"])

Api endpoints

/lowestbins | /lowestbins.json

Returns a JSON object with lowest bins and bazaar prices. Supports ?type and ?price filters.

/averages/{1-7}day

Returns the historical price average for the specified number of days (e.g., /averages/7day). Requires ENABLE_HISTORY=1.

Note on Compression: All endpoints support robust Gzip compression to save bandwidth. Just append .gz to the path (e.g., /lowestbins.json.gz, /averages/1day.json.gz).

Query Parameters: Most data endpoints support the following filters:

  • ?type=all|auction|bazaar (Default: all) - Filters items by their market source.
  • ?price=historical|available (Default: historical) - Filters auction items by their state (available means currently active on the Auction House).

Special handling

Some items are normalized into custom keys in /lowestbins.

  • Pets: PET-AMMONITE-LEGENDARY, PET-AMMONITE-LEGENDARY-100
  • Potions: POTION-HASTE-4-ENHANCED
  • Runes: RUNE-BITE-1
  • New Year Cake: NEW_YEAR_CAKE, NEW_YEAR_CAKE-1
  • Perfect stats variants: BOUNCY_BOOTS-PERFECT

Regular items still use normal ids, for example: HYPERION.

/lowestbins.txt

Returns a text file with all lowestbins easier to parse and smaller in size

/auction/{item} | lowestbin/{item}

Returns the price of a item as number this endpoint can be used to get more up to date prices due to it not being cached as often

/metrics

Returns prometheus metrics of the prices

/

Returns basic data about the api and update time

Usage

Docker

docker run  --name lowestbins -p 8080:8080 -e HOST=0.0.0.0 -e UPDATE_SECONDS=120 -d ghcr.io/tricked-dev/lowestbins:latest

Building

  • If you're on Linux, you can go to releases and download the binary
  • Windows/MacOS: you need to install cargo and run cargo build --release and the exe/binary should be in the ./target/release/lowestbins.

Config Options

Env variables

PORT # The port to run the server on
HOST # The host to run the server on
SAVE_TO_DISK # set to 0 to not save the auctions to disk
OVERWRITES # Overwrite values format: `BLESSED_BAIT:200,ROCK_CANDY:6000,NON_EXISTENT_ITEM:200`
UPDATE_SECONDS # The amount of seconds to wait before updating the lowestbins
WEBHOOK_URL # The webhook url used for reporting the requests (discord/discord compatible)
RUST_LOG # The log level lowestbins=debug recommended
ENABLE_HISTORY # set to 1 to enable historical price tracking (default: 0)

Features

  • NBT parsing
  • Fetching auctions and returning the lowest bin
  • hyper server
  • skytils compatible
  • metrics endpoint /metrics
  • rust
  • price history
  • granular filtering (?type & ?price)
  • gzip compression

Todo

  • use quiche for faster quests
  • use cargo pgo to optimize binaries

Licensed under the Apache 2 License

Packages

 
 
 

Contributors

Languages