SnaBe / node-steam-market-fetcher

A Node.js wrapper for the Steam Community Market API.
https://www.npmjs.com/package/steam-market-fetcher
MIT License
26 stars 3 forks source link

Currency error #18

Closed matvejs16 closed 1 year ago

matvejs16 commented 1 year ago

Setting price to EUR but shows in USD, why that happens?

const market = new SteamMarketFetcher({
     currency: 'EUR',
     format: 'json'
})
const marketQuery = market.getMarketListings({
     query: 'AK-47',
     appid: 730
}) as Promise<GetMarketListingsResponse>

marketQuery.then(data => {
     console.log(data);
})

Response


{
  success: true,
  start: 0,
  pagesize: 100,
  total_count: 388,
  searchdata: {
    query: 'AK-47',
    search_descriptions: false,
    total_count: 388,
    pagesize: 100,
    prefix: 'searchResults',
    class_prefix: 'market'
  },
  results: [
    {
      name: 'Sticker | Hello AK-47',
      hash_name: 'Sticker | Hello AK-47',
      sell_listings: 166,
      sell_price: 48,
      sell_price_text: '$0.48',
      app_icon: 'https://cdn.cloudflare.steamstatic.com/steamcommunity/public/images/apps/730/69f7ebe2735c366c65c0b33dae00e12dc40edbe4.jpg',
      app_name: 'Counter-Strike: Global Offensive',
      asset_description: [Object],
      sale_price_text: '$0.46'
    }
  ]
}
SnaBe commented 1 year ago

Hi,

The getMarketListings method calls the following endpoint - https://steamcommunity.com/market/search/render. This endpoint doesn't take the currency parameter as an input, resulting in the currency being rendered in dollars.

Usually, Steam determines the currency based on your browser and displays prices in that currency. However, attaching your Steamcommunity cookie to the request could trick Steam into showing the prices in your local or default currency. This is something I could implement for the method, similar to getMyHistory and getMyListings. Let me know if this has any interest.

I hope this helps.

Best regards, SnaBe