Skip to content

Instantly share code, notes, and snippets.

@TheLime1
Created June 18, 2023 16:42
Show Gist options
  • Save TheLime1/e4256226696ceac49e43228a8ea6c3fe to your computer and use it in GitHub Desktop.
Save TheLime1/e4256226696ceac49e43228a8ea6c3fe to your computer and use it in GitHub Desktop.
a methode to get lowes_float of a csgo weapon
import requests
def get_lowest_float_skin(market_hash_name: str) -> dict:
url = f"https://steamcommunity.com/market/listings/730/{market_hash_name}/render?start=0&count=10&currency=1&format=json"
response = requests.get(url)
if response.status_code == 200:
data = response.json()
listings = data["listinginfo"]
lowest_float_skin = None
for listing_id, listing in listings.items():
asset_id = listing["asset"]["id"]
float_value = get_float_value(asset_id)
if lowest_float_skin is None or float_value < lowest_float_skin["float_value"]:
lowest_float_skin = {
"listing_id": listing_id,
"float_value": float_value,
"price": listing["converted_price"] + listing["converted_fee"],
"asset_id": asset_id
}
return lowest_float_skin
return None
def get_float_value(asset_id: str) -> float:
url = f"https://api.steampowered.com/CSGOFloat/Market/GetMarketFloat/v1/?key=YOUR_API_KEY&appid=730&market_hash_name={market_hash_name}&asset_id={asset_id}"
response = requests.get(url)
if response.status_code == 200:
data = response.json()
return data["result"]["floatvalue"]
return None
market_hash_name = "SSG 08 | Ever Dream (Battle-Scarred)"
lowest_float_skin = get_lowest_float_skin(market_hash_name)
if lowest_float_skin is not None:
print(f"The lowest float skin is: {lowest_float_skin}")
else:
print("Could not find any skins.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment