Skip to content

Instantly share code, notes, and snippets.

@djanatyn
Created April 6, 2026 15:57
Show Gist options
  • Select an option

  • Save djanatyn/5fd2c4cf816d7bc93170c90e97d6a5a5 to your computer and use it in GitHub Desktop.

Select an option

Save djanatyn/5fd2c4cf816d7bc93170c90e97d6a5a5 to your computer and use it in GitHub Desktop.
[
{
"name": "Osmumten's fang",
"price": {
"low": 19011776,
"high": 19112713
}
},
{
"name": "Amulet of fury",
"price": {
"low": 2631721,
"high": 2664000
}
},
{
"name": "Dragon felling axe",
"price": {
"low": 1991949,
"high": 2070003
}
},
{
"name": "Zamorakian hasta",
"price": {
"low": 1361451,
"high": 1392647
}
},
{
"name": "Zombie axe",
"price": {
"low": 967353,
"high": 999000
}
},
{
"name": "Dagon'hai robe bottom",
"price": {
"low": 476668,
"high": 487618
}
},
{
"name": "Dragon pickaxe",
"price": {
"low": 438622,
"high": 449627
}
},
{
"name": "Dagon'hai robe top",
"price": {
"low": 428888,
"high": 449166
}
},
{
"name": "Blue moon spear",
"price": {
"low": 389326,
"high": 413795
}
},
{
"name": "Dragon boots",
"price": {
"low": 251511,
"high": 258305
}
},
{
"name": "Dagon'hai hat",
"price": {
"low": 226666,
"high": 246308
}
},
{
"name": "Shattered banner",
"price": {
"low": 220000,
"high": 750000
}
},
{
"name": "Bandos d'hide boots",
"price": {
"low": 172942,
"high": 182925
}
},
{
"name": "Torag's helm",
"price": {
"low": 166555,
"high": 172222
}
},
{
"name": "Granite maul",
"price": {
"low": 154150,
"high": 158069
}
},
{
"name": "Dragon halberd",
"price": {
"low": 148900,
"high": 149405
}
},
{
"name": "Dragon 2h sword",
"price": {
"low": 131000,
"high": 131576
}
},
{
"name": "Wizard boots",
"price": {
"low": 96336,
"high": 109077
}
},
{
"name": "Dragon axe",
"price": {
"low": 88500,
"high": 89629
}
},
{
"name": "Zamorak bracers",
"price": {
"low": 73831,
"high": 66633
}
},
{
"name": "Ancient staff",
"price": {
"low": 59619,
"high": 60595
}
},
{
"name": "Helm of neitiznot",
"price": {
"low": 48900,
"high": 50352
}
},
{
"name": "Skull of vet'ion",
"price": {
"low": 48003,
"high": 51000
}
},
{
"name": "Bracelet of ethereum (uncharged)",
"price": {
"low": 43000,
"high": 42734
}
},
{
"name": "Huasca seed",
"price": {
"low": 38552,
"high": 39464
}
}
]
from osrsreboxed import items_api
from osrsreboxed.items_api.item_properties import ItemProperties
from osrsreboxed.items_api.all_items import AllItems
import requests
from dataclasses import dataclass
from typing import Optional, List, Dict
import json
type Price = Dict[str, int]
type Prices = Dict[int, Price]
@dataclass
class PriceData:
low: int
high: int
@dataclass
class TradeableItem:
item: ItemProperties
price: PriceData
def lookup(db: AllItems, id: int) -> Optional[ItemProperties]:
"""Lookup an item by ID in osrsreboxed-db."""
try:
return db.lookup_by_item_id(id)
except KeyError:
return None
def get_prices() -> Prices:
"""Fetch prices for OSRS Wiki."""
# https://oldschool.runescape.wiki/w/RuneScape:Real-time_Prices
return requests.get(
"https://prices.runescape.wiki/api/v1/osrs/latest",
headers={"user-agent": "singleton-trader - @djanatyn on Discord"},
).json()["data"]
def lookup_price(prices: Prices, item: ItemProperties) -> Optional[TradeableItem]:
if (price := prices.get(str(item.id))) is not None:
return TradeableItem(
item=item, price=PriceData(low=price["low"], high=price["high"])
)
else:
return None
def main() -> None:
"""Find tradeable bank items that can be sold to free up space."""
db = items_api.load()
prices = get_prices()
# fetch all bank items
bank: List[ItemProperties] = filter(
lambda item: item is not None,
[
lookup(db, item["id"])
for item in requests.get("http://localhost/status").json()["bank"]
# if item["quantity"] == 1
],
)
# filter tradeable items
tradeables: List[ItemProperties] = filter(lambda item: item.tradeable_on_ge, bank)
# lookup prices
priced_items: List[TradeableItem] = filter(
lambda item: item is not None,
map(lambda item: lookup_price(prices, item), tradeables),
)
# sort by low price, return top 25
top25 = sorted(priced_items, key=lambda item: item.price.low, reverse=True)[:25]
print(
json.dumps(
[
{
"name": item.item.name,
"price": {"low": item.price.low, "high": item.price.high},
}
for item in top25
]
)
)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment