alexander-pick / MKMTool

MKMTool ist a helper application I wrote for tinkering around with optimization of sale processes on magiccardmarket.eu and the idea of automisation of some tasks most people wouldn’t be able to get done by pure manpower.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pricing based on lowest price misses similar items

WitheredHope opened this issue · comments

image

(UK is the only sellected country)

Maybe my settings are set wrong but I think theres plenty of items that should have been pulled up for "Azorius Justiciar" The 2 cheapest items from my country are both the same condition as mine and there's a total of 23 listings of this card from sellers in my country.

The calculated price for Isperia seems wrong too, what I'd expect is it to find the cheapest card in the same or better quality, which is £0.35 (as seen in the screenshot) and price my card at 99% of that, 0.3465 then round that to the nearest penny, and price my card at 34p or 35p instead it priced it at 41p. Maybe pulling prices in EUR?

Ad Azorius Justicar and similar: when MKMTool fetches articles from other sellers, there is only limited filtering, specifically by minimal condition, language of the card, seller type and flags (is foil, is signed etc.), no other filters are supported on MKM side. We fetch 150 cheapest articles this way and do further filtering on that, including by seller's country among others. In this particular case, the problem is that among the cheapest 150 non-foil non-signed Azorius Justicars excellent or better in English language, there isn't a single British seller (as of writing this, the cheapest British seller is only 208th with those parameters). So since you filter by country, MKMTool will find no suitable candidates.
The 150 number is sort of arbitrary. It can theoretically be up to 1000 while still using just a single API request and if I remember correctly it used to be something like 500 in early versions of MKMTool but I lowered it because it actually affects the processing time quite a lot (MKM has to take longer to prepare the data and send them to us). So I don't want to just raise it high, since it would slow down MKMTool and most people would have no gain from it. What I am going to do is I am going to add that number among the config parameters, so people who don't use too restrictive filtering can keep it low while people like you can raise it for the cost of a bit slower processing time. BTW, in the meantime if you are running MKMTool directly from source code, you can easily change it yourself, it's line 735 in MKMBot.cs, just change the 150 to something higher (but lower than 1000).

Ad Isperia: it indeed seems that it is using EUR price, since that is 0.41€ for that Isperia from bustedmagicuk (and 0.41 x 0.99 = 0.4059 which rounds to 0.41). This contradicts what the support people told me though. In the data we get, there is a "primary" price, i.e. the only price that used to be there before and it is what we use in MKMTool. I was told that the primary price will be in the currency of the account of the person making the API request (so GBP for you). They also said they will update the documentation on this by the end of the year and they did not...
I just went through what I get from a bunch of British sellers and it is always in EUR, never GBP, so that seems correct (since my account is in EUR). I can't be sure, since I don't see what is the currency of the other accounts, but I am quite confident that the primary price is not in the currency of the holder of that account. However, from your experience it seems like it could simply always be EUR. If that is the case, there would have to be some modifications to MKMTool. We do receive the prices in all currencies, so it is certainly possible, but I would like to be sure that that is what is happening before I start working on it. But I cannot really test it since I don't have a GBP account. Are you per chance using MKMTool from source so that you could provide me some debug outputs? If not, I could build a special executable that would print out some additional information and you could try it and send me the output if thats ok?

edit: By they way, since you have worldwide search turned off, you don't actually have to use the "filter by country", it will only look for sellers from your country.

Hi, I' ve started using MKMTool from source, checking to see if your proposed modification fixes the Azorius Justicar issue, what debug information would you like?

I am sure about the Azorius Justicar issue, it's more about the one with Isperia (the GBP). For that, copy paste the following code to MKMBot.cs after line number 1080 (in visual studio you can turn on line numbers in Options -> Text Editor -> All languages -> General):

 if (article.GetAttribute(MCAttribute.Name) == "Isperia, Supreme Judge")
 {
      using (StreamWriter s = new StreamWriter(@".\\isperiaoffer.xml"))
      {
          s.Write(offer.InnerXml);
      }
  }

So the result sould look like this (added code is highlighted...also my line numbers are 1 lines off from what you will have):

image

Then run price update the way you did before. After it updates Isperia, it should write a isperiaoffer.xml file to your binary folder (MKMTool/bin/Debug or MKMTool/bin/Release, depending on what configuration you are using). You can stop MKMTool afterwards. Paste content of the file (or the file itself) here. It will have information about that cheapest Isperia so we take a look at what is cardmarket sending to you.

<idArticle>1064132270</idArticle><idProduct>258213</idProduct><language><idLanguage>1</idLanguage><languageName>English</languageName></language><comments></comments><price>0.41</price><idCurrency>1</idCurrency><currencyCode>EUR</currencyCode><count>3</count><inShoppingCart>false</inShoppingCart><prices><price>0.41</price><idCurrency>1</idCurrency><currencyCode>EUR</currencyCode></prices><prices><price>0.35</price><idCurrency>2</idCurrency><currencyCode>GBP</currencyCode></prices><seller><idUser>990494145</idUser><username>bustedmagicuk</username><isCommercial>1</isCommercial><reputation>1</reputation><sellCount>1236</sellCount><onVacation>false</onVacation><name><company>BustedMagicUK</company><firstName>Louise</firstName><lastName>Buchan</lastName></name><address><name>Louise Buchan</name><extra></extra><street>1 Dale Court</street><zip>DD11 1TT</zip><city>Arbroath</city><country>GB</country></address><phone>07729992158</phone><email>higherpeacemeditation@gmail.com</email><vat></vat><registrationDate>2020-10-19T17:59:54+0200</registrationDate><isSeller>true</isSeller><legalInformation></legalInformation><unsentShipments>0</unsentShipments><shipsFast>2</shipsFast><soldItems>7203</soldItems><avgShippingTime>0</avgShippingTime><riskGroup>0</riskGroup><lossPercentage>0 - 2%</lossPercentage></seller><condition>NM</condition><isFoil>false</isFoil><isSigned>false</isSigned><isPlayset>false</isPlayset><isAltered>false</isAltered><links><rel>buy</rel><href>shoppingcart</href><method>PUT</method><action>add</action><idArticle>1064132270</idArticle></links>

Thanks, it is as I suspected, the "primary" price is in EUR. And your account is in pounds right? It should be easy to fix, just to double check, please insert the following line to MainView.cs after line 207:

LogMainWindow(doc2["response"]["account"]["moneyDetails"]["idCurrency"].InnerText);

The whole code around should then look like this:

     try
            {
                var doc2 = MKMInteract.RequestHelper.getAccount();

                if (Config.MyCountryCode == "") // signifies user wants auto-detect, otherwise the chosen setting overrides what we get from MKM
                    Config.MyCountryCode = doc2["response"]["account"]["country"].InnerText;
                MKMHelpers.sMyId = doc2["response"]["account"]["idUser"].InnerText;
                LogMainWindow(doc2["response"]["account"]["moneyDetails"]["idCurrency"].InnerText);
            }
            catch (Exception eError)
            {
                MKMHelpers.LogError("initializing product list and account info", eError.Message, true);
            }

Then just start MKMTool, it will write a single number to the log window. Let me know what it is (for accounts in pounds it should be "2"...).

If somebody with a pounds account could try the code above and confirm it writes "2" in the log, I have a fix ready that should make sure prices are computed correctly in the currency of your account.

Issue addressed in version 0.8.1.0:

  • ArticleCountFetched now added as a parameter to config to address the issue of not finding similar items (commit d382e30), see settings documentation for details.
  • We no longer rely on the "default" price but instead explicitly take the price in the currency of the account (commit 957ff4e). This was not tested on a pounds account, reopen this issue or start a new one if there are some problems with it.