A synchronous Python read-only wrapper for the Steam Community Market API.
steam-community-market
is a Python library that provides a simple and efficient way to interact with the Steam Community Market API. It is designed to be easy to use and provides support for Python 3.9 and above.
- Easy-to-use API
- Compatible with Python 3.9 and above
- Extensive documentation
To install the steam-community-market
library, simply run:
- Linux / macOS:
python3 -m pip install -U steam-community-market
- Windows:
pip install -U steam-community-market
To use the library, first import it in your Python script:
from steam_community_market import *
Then, create an instance of the Market
class, specifying the currency you want to use:
market = Market(currency=Currency.USD)
Now you can use the various functions provided by the library to interact with the Steam Community Market API.
Below you can find some examples on how to use different methods of the steam-community-market
library.
First, let's import the required libraries for beautifully and correctly print our outputs, and define an item name constant:
import json
import os
# Because we love "Mann Co. Supply Crate Key" <3
MANN_CO_SUPPLY_CRATE_KEY = "Mann Co. Supply Crate Key"
print(
"get_overview:",
json.dumps(
market.get_overview(AppID.TF2, MANN_CO_SUPPLY_CRATE_KEY),
indent=2,
ensure_ascii=False,
),
sep=os.linesep,
)
# get_overview:
# {
# 'success': True,
# 'lowest_price': '2,22€',
# 'volume': '18,015',
# 'median_price': '2,25€'
# }
market_hash_names = [MANN_CO_SUPPLY_CRATE_KEY, "Name Tag", "The Festivizer"]
print(
"get_overviews:",
json.dumps(
market.get_overviews(AppID.TF2, market_hash_names),
indent=2,
ensure_ascii=False,
),
sep=os.linesep,
)
# get_overviews:
# {
# "Mann Co. Supply Crate Key": {
# "success": true,
# "lowest_price": "2,24€",
# "volume": "18,015",
# "median_price": "2,25€"
# },
# "Name Tag": {
# "success": true,
# "lowest_price": "0,37€",
# "volume": "1,114",
# "median_price": "0,38€"
# },
# "The Festivizer": {
# "success": true,
# "lowest_price": "1,26€",
# "volume": "510",
# "median_price": "1,25€"
# }
# }
try:
print(
"get_lowest_price:",
market.get_lowest_price(AppID.CSGO, "Weapon Barrel"),
sep=os.linesep,
end=os.linesep * 2,
)
except InvalidItemOrAppIDException as e:
print(
"[InvalidItemOrAppIDException] get_lowest_price:",
e,
sep=os.linesep,
end=os.linesep * 2,
)
print(
"get_price (lowest_price):",
market.get_price(252490, "No Mercy AK47", "lowest_price"),
sep=os.linesep,
end=os.linesep * 2,
)
# 252490 - Rust's App ID
# [InvalidItemOrAppIDException] get_lowest_price:
# Item "Weapon Barrel" with app ID "730" is considered invalid by the Steam Community Market.
#
# get_price (lowest_price):
# 6.33
# get_prices
print(
"get_prices:",
json.dumps(
market.get_prices(440, MANN_CO_SUPPLY_CRATE_KEY),
indent=2,
ensure_ascii=False
),
sep=os.linesep,
)
# 440 - Team Fortress 2's App ID
# get_prices:
# {
# 'lowest_price': 2.22,
# 'median_price': 2.25
# }
# get_volume
# Getting information about "Steam" items is kind of weird, you need to look at its URL.
# IDF (CSGO Trading Card), you need to add 730- to. So it would be "730-IDF".
print(
"get_volume:",
market.get_volume(AppID.STEAM, "753-Sack of Gems"),
sep=os.linesep,
)
# get_volume:
# 4982
For more examples and detailed explanations, please refer to the official documentation and the examples module.
If you have any questions, issues, or suggestions, please create an issue on GitHub or join our Discord server.
Contributions are always welcome! If you want to contribute, please fork the repository and submit a pull request.
If you find this library useful and would like to support the author and maintainer, you can donate using the following methods:
-
Author - @offish
- Bitcoin:
bc1qg275cltpez2dcedv2qucrtjxyhq4xurykstldk
- Bitcoin:
-
Maintainer - @RoachxD
- Bitcoin:
bc1qmyyratw3zaf6jj7azrvyr8vqmflpvhwzcf2zp7
- Ethereum:
0x8Ce07EA13A79bd40FeC8eEbC51BE5F2c69631031
- Bitcoin:
steam-community-market
is licensed under the MIT License.