Skip to content
Simon Sørensen edited this page Jun 2, 2023 · 9 revisions

steam-market-fetcher

A Node.js wrapper for the Steam Community Market API.

Documentation

When you require() the module, the SteamMarketFetcher class is returned. This page lists all methods (properties are private) available from that class.

However, you'll first need to instantiate a new module instance and supply it with your preferred dev options.

Below is a CommonJS example:

// Require the module 
const SteamMarketFetcher = require('steam-market-fetcher');
// and supplying your options
const market = new SteamMarketFetcher({ 
    currency: 'EUR',
    format: 'json'
});

A list of constructor options is available here.

Methods

All methods support both callbacks and async/await.

Also, please note: Function parameters are all supplied in a single object. If one or more are omitted, the function resorts to its default values.

constructor (options)

Creates a new SteamMarketFetcher instance.

  • options - An object of valid options for the SteamMarketFetcher class constructor.
    • currency - Any valid currency the Steam Community Market uses, defaults to USD.
    • format - Any valid data format accepted by Steam, defaults to JSON.
    • CDN - Steam CDN handler for CS:GO items and their image URLs.

Returns a new SteamMarketFetcher instance.

getItemPrice ({ market_hash_name, appid, callback })

Get the market price from the first listing that matches the market_hash_name and appid arguments.

  • market_hash_name - The item's universal market name.
  • appid - The app that owns the item.
  • callback - Optional, called when a response is available. If omitted, the function returns a promise.
    • error - An Error object on failure, or null on success.
    • response - The response object.

Returns a GetItemPriceResponse object with price data that match the market_hash_name and appid arguments.

getItemImage ({ market_hash_name, appid, size, callback })

Retrieves an image URL from the first market listing that matches the market_hash_name and appid arguments.

  • market_hash_name - The item's universal market name.
  • appid - The app that owns the item.
  • size - Optional parameter for a desired image size (Defaults to 360x360 pixels).
  • callback - Optional, called when a response is available. If omitted, the function returns a promise.
    • error - An Error object on failure, or null on success.
    • image - The URL to the image.

Returns a string with a Steam Community or Steam CDN image URL.

getItemPriceHistory({ market_hash_name, appid, cookie, callback })

Get an item's price history from the first market listing that matches the market_hash_name and appid arguments.

  • market_hash_name - The item's universal market name.
  • appid - The app that owns the item.
  • cookie - A steamLoginSecure cookie obtained from Steamcommunity.com. This parameter is required as you must be logged into Steam to perform the request.
  • callback - Optional, called when a response is available. If omitted, the function returns a promise.
    • error - An Error object on failure, or null on success.
    • response - The response object.

Returns a GetItemPriceHistoryResponse object with the price history for the item matching the market_hash_name and appid arguments.

Guide - Obtaining your steamLoginSecure cookie from the Chrome browser.

getMarketListings ({ query, descriptions, appid, start, callback })

Get the current Steam Community Market listings for any given Steam app.

  • query - The query value narrows down the search, an optional parameter that defaults to an empty state.
  • descriptions - If set to 1, includes the query in the item's description when searching for matches.
  • appid - The app that owns the items.
  • start - The market listing from which to start the request, an optional parameter that defaults to 0 (the first items listed on the market for that app).
  • count - The maximum number of items to be returned by the request, an optional parameter that defaults to 100.
  • callback - Optional, called when a response is available. If omitted, the function returns a promise.
    • error - An Error object on failure, or null on success.
    • response - The response object.

Returns a GetMarketListingsResponse with an object of market listings that match the query and appid arguments.

getItemActivity ({ item_nameid, callback })

Get a list of Steam Community Market order activities for a specific item.

  • item_nameid - The nameid of the item.
  • callback - Optional, called when a response is available. If omitted, the function returns a promise.
    • error - An Error object on failure, or null on success.
    • response - The response object.

Returns a GetItemActivityResponse with an array of order activities that match the item_nameid argument.

getItemHistogram ({ item_nameid, callback })

Get a Steam Community Market order histogram for a specific item.

  • item_nameid - The nameid of the item.
  • callback - Optional, called when a response is available. If omitted, the function returns a promise.
    • error - An Error object on failure, or null on success.
    • response - The response object.

Returns a GetItemHistogramResponse with a histogram object for buy and sell orders that match the item_nameid argument.

getMyHistory ({ cookie, callback })

Get your own Steam Community Market history.

  • cookie - A steamLoginSecure cookie obtained from Steamcommunity.com. This parameter is required as you must be logged into Steam to perform the request.
  • callback - Optional, called when a response is available. If omitted, the function returns a promise.
    • error - An Error object on failure, or null on success.
    • response - The response object.

Returns a GetMyHistoryResponse object with an object that contains your Steam Community Market history.

getMyListings ({ cookie, callback })

Get your own Steam Community Market listings.

  • cookie - A steamLoginSecure cookie obtained from Steamcommunity.com. This parameter is required as you must be logged into Steam to perform the request.
  • callback - Optional, called when a response is available. If omitted, the function returns a promise.
    • error - An Error object on failure, or null on success.
    • response - The response object.

Returns a GetMyListingsResponse object with an object that contains your Steam Community Market listings.

getPopularListings ({ start, count, callback })

Get the most popular Steam Community Market listings.

  • start - The market listing from which to start the request, an optional parameter that defaults to 0 (the first popular item listed on the market).
  • count - The maximum number of items to be returned by the request, an optional parameter that defaults to 100.
  • callback - Optional, called when a response is available. If omitted, the function returns a promise.
    • error - An Error object on failure, or null on success.
    • response - The response object.

Returns a GetPopularListingsResponse object with an object that contains the most popular Steam Community Market listings.

getRecentListings ({ callback })

Get the most recent Steam Community Market listings.

  • callback - Optional, called when a response is available. If omitted, the function returns a promise.
    • error - An Error object on failure, or null on success.
    • response - The response object.

Returns a GetRecentListingsResponse object with an object that contains the most recent Steam Community Market listings.

Examples

For now, there are some examples available in the test directory.

Support

Feel free to create an issue if you need to report any bugs or have a suggestion for a new feature.