npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

steam-market

v3.0.2

Published

Steam market API client

Downloads

191

Readme

steam-market

Steam market API client. Designed for use with steam-user.

If you are creating a bot for Steam, you may need more suitable steam-robot.

This package is intended for educational purposes only. Use it at your own risk, automation on the community market is prohibited by the rules of the Steam subscriber agreement:

You may not use Cheats, automation software (bots), mods, hacks, or any other unauthorized third-party software, to modify or automate any Subscription Marketplace process.

TypeDoc documentation is available on wiki.

Install

Without log in

Using npm:

npm install steam-market

Using yarn:

yarn add steam-market

With log in

Using npm:

npm install steam-totp steam-user steam-market

Using yarn:

yarn add steam-totp steam-user steam-market

Usage

Without log in

import SteamMarket, { ECurrencyCode } from 'steam-market'

const market = new SteamMarket()

// If necessary, set the currency and language
market.setCurrency(ECurrencyCode.RUB) // Default ECurrencyCode.USD
market.setCountry('RU')               // Default 'US'

// Use only methods available without login
const appId = 730
const marketHashName = 'AWP | Asiimov (Field-Tested)'

const search = await market.search(appId)
console.log('search', search.success)

const listings = await market.listings(appId, marketHashName)
const itemNameId = await listings.itemNameId()
const priceHistory = await listings.priceHistory()
console.log('itemNameId', itemNameId)
console.log('priceHistory', priceHistory.success)

const itemOrdersHistogram = await market.itemOrdersHistogram(appId, marketHashName, itemNameId)
console.log('itemOrdersHistogram', itemOrdersHistogram.success)

const priceOverview = await market.priceOverview(appId, marketHashName)
console.log('priceOverview', priceOverview.success)

With log in

import SteamTotp from 'steam-totp'
import SteamUser from 'steam-user'
import SteamMarket from 'steam-market'

const client = new SteamUser()
const market = new SteamMarket()

client.logOn({
  accountName: 'username',
  password: 'password',
  twoFactorCode: SteamTotp.generateAuthCode('sharedSecret')
})

// Waiting for all client object events to set up market before using it
await Promise.all([
  new Promise((resolve) => {
    client.on('webSession', (sessionId, cookies) => {
      market.setCookies(cookies)
      resolve()
    })
  }),
  new Promise((resolve) => {
    client.on('wallet', (hasWallet, currency) => {
      market.setCurrency(currency)
      resolve()
    })
  }),
  new Promise((resolve) => {
    client.on('accountInfo', (name, country) => {
      market.setCountry(country)
      resolve()
    })
  })
])

// Also set the vanityURL after initializing the client object
market.setVanityURL(client.vanityURL ?? client.steamID?.getSteamID64() ?? '')

// The market object is now fully configured and ready to use
// The following shows examples of using authorized methods
const appId = 730
const marketHashName = 'AWP | Asiimov (Field-Tested)'

const priceHistory = await market.priceHistory(appId, marketHashName)
console.log('priceHistory', priceHistory.success)

const myListings = await market.myListings()
console.log('myListings', myListings.success)

const myHistory = await market.myHistory()
console.log('myHistory', myHistory.success)

const createBuyOrder = await market.createBuyOrder(appId, {
  marketHashName,
  price: 50,
  amount: 1
})
const buyOrderId = createBuyOrder.buyOrderId
console.log('createBuyOrder', createBuyOrder.success)

const assetId = myListings.assets[0].id ?? 0
const contextId = myListings.assets[0].contextId ?? 0
const createSellOrder = await market.createSellOrder(appId, {
  assetId,
  contextId,
  price: 250,
  amount: 1
})
console.log('createSellOrder', createSellOrder.success)

const buyOrderStatus = await market.buyOrderStatus(appId, marketHashName, buyOrderId)
console.log('buyOrderStatus', buyOrderStatus.success)

const cancelBuyOrder = await market.cancelBuyOrder(buyOrderId)
console.log('cancelBuyOrder', cancelBuyOrder)

const listingId = myListings.listings[0].listingId
const cancelSellOrder = await market.cancelSellOrder(listingId)
console.log('cancelSellOrder', cancelSellOrder)

See also

| Module | Description | Author | |------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|-------------------| | steam-totp | Lightweight module to generate Steam-style TOTP auth codes | DoctorMcKay | | steam-user | Allows interaction with the Steam network via the Steam client protocol | DoctorMcKay | | steamcommunity | Interact with various interfaces on Steam Community from Node.js | DoctorMcKay | | steam-tradeoffer-manager | Simple and sane Steam trade offer management | DoctorMcKay | | steam-market (YOU HERE) | Steam market API client | Vladislav Puzyrev | | steam-robot | Creating Steam bots based on middlewares | Vladislav Puzyrev |