I have written a python script that pulls data from an API ( https://api.hypixel.net/skyblock/auctions ) and it works pretty well for what I want it to do, however, I wanted to add a feature which would find the exact same item twice, then compare the lowest 2 prices for it (subtraction) then shows me the difference between the lowest price and 2nd lowest price. Example: Item X Lowest Price: 100,000 Item X 2nd Lowest Price: 300,000 if the difference is =< 200,000, it shows me the value with the exact difference between the item. Outputs: <item_name>, <price difference between 2 lowest prices>,
This is the code I have right now.
import requests
data = requests.get("https://api.hypixel.net/skyblock/auctions").json()
auctions = data["auctions"]
items = []
for auction in auctions:
try:
if auction["bin"] and (str(auction["item_name"]).startswith("")) and auction["category"] == "weapon" and auction["tier"] == "EPIC":
items.append([auction["item_name"], auction["starting_bid"], auction["tier"]])
except KeyError:
continue
items.sort(key=lambda x: x[1])
for item in items:
print(item)