Jump to content
McKay Development

How to change currency in getMarketItem?


teoformartel

Recommended Posts

How to change currency in getMarketItem? Is it possible?

I wanna get price of item in another currency(not usd).

UPD: ye, "Currently, non-USD currencies are not supported." on CMarketItem wiki
When will it be supported? It's very important for me.

UPD2: I've just found another nmp package named "steam-market-pricing" that can help me

UPD3: I was looking for better solution. So(from "steamcommunity\components\CMarketItem.js"):

SteamCommunity.prototype.getMarketItem = function(appid, hashName, currency, callback) {
	if (typeof currency == "function") {
		callback = currency;
		currency = 1;
	}
	var self = this;
	this.httpRequest("https://steamcommunity.com/market/listings/" + appid + "/" + encodeURIComponent(hashName), function(err, response, body) {
		if (err) {
			callback(err);
			return;
		}

		var $ = Cheerio.load(body);
		if($('.market_listing_table_message') && $('.market_listing_table_message').text().trim() == 'There are no listings for this item.') {
			callback(new Error("There are no listings for this item."));
			return;
		}

		var item = new CMarketItem(appid, hashName, self, body, $);
		item.updatePrice(currency, function(err) {
			if(err) {
				callback(err);
			} else {
				callback(null, item);
			}
		});
	}, "steamcommunity");
};

Yep. I can set currency. So wiki on github is outdated.
P.S  lowestPrice and highestBuyOrder is set to the correct currency
but medianSalePrices' currency is usd
so, I checked it
medianSalePrices can be converted from usd to XXX by exchange rate
but lowestPrice and highestBuyOrder cant

Edited by teoformartel
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...