woctezuma / steam-market

Find arbitrages on the Steam Market.
MIT License
161 stars 18 forks source link

Question #21

Closed Tasdv closed 2 years ago

Tasdv commented 2 years ago

File "C:\Users\User\Desktop\steam-market-master\market_arbitrage_with_foil_cards.py", line 955, in find_item_type_for_app_id listing_details = all_listing_details[representative_listing_hash_for_app_id] KeyError: '400750-15cm SfH 18 (Foil)'

Is that one item causing problems?

woctezuma commented 2 years ago

The error arises here: https://github.com/woctezuma/steam-market/blob/413d666e8305692b7163c9828b624c785cf61c84/market_arbitrage_with_foil_cards.py#L950-L955

The KeyError indicates that representative_listing_hash_for_app_id is not found in the dictionary all_listing_details, where the listing hash is 400750-15cm SfH 18 (Foil), which corresponds to this foil card: https://steamcommunity.com/market/listings/753/400750-15cm%20SfH%2018%20%28Foil%29

I don't know why there is an issue. I need to see if I can reproduce the issue to understand what happens.

--

For the record, this foil card is worth 220 gems now, and there are expensive buy orders, so it is not worth buying.

Listing

Tasdv commented 2 years ago

You need anything from me to patch it?

woctezuma commented 2 years ago

For now, I don't need anything from you. First, I need to find some time to run this function and replicate the bug.

Meanwhile, If you want to avoid this error, you could add a few lines in-between the lines of the function as below:

https://github.com/woctezuma/steam-market/blob/413d666e8305692b7163c9828b624c785cf61c84/market_arbitrage_with_foil_cards.py#L937-L948

    if int(app_id) == 400750:
        return None

https://github.com/woctezuma/steam-market/blob/413d666e8305692b7163c9828b624c785cf61c84/market_arbitrage_with_foil_cards.py#L950-L958

However, it is possible that you could encounter this bug with other appIDs.

Tasdv commented 2 years ago

Yeah just encountered it with some other appIDs

woctezuma commented 2 years ago

Thank you. I will try the command myself.

I wonder if the issue arises because Steam servers are under stress during the Winter sales. If this is the case, then it is not a bug with the code, but it could be better if the code handled the error and went on until completion.

Tasdv commented 2 years ago

Is there a way to skip the loading listings from disk and go directly to the second part? Every time I launch the program, it takes 30 mins to complete that, then bugs out at the appIDs part, I'm trying to remove all the bugged ids.

woctezuma commented 2 years ago

Not entirely sure to understand what you mean, but I guess you could set this to False: https://github.com/woctezuma/steam-market/blob/413d666e8305692b7163c9828b624c785cf61c84/market_arbitrage_with_foil_cards.py#L1013

During the part which takes 30 min, do you see an early termination of the download process of the listings?

Tasdv commented 2 years ago

No it finishes the first part, where it takes a while, then at the second part, where the bug happens.

Tasdv commented 2 years ago

yea this worked, it skipped the first part.

Tasdv commented 2 years ago

The trend I'm seeing so far from the bugged appIDs, are that the marketplace Trading cards have "(Foil)" in them, or some other symbols.

woctezuma commented 2 years ago

I think (Foil) is expected, because the program only checks the foil cards.

Other symbols could be an issue. I will see if I can reproduce the issue. If I cannot reproduce the issue, this may be an "encoding" issue, so you would have to ensure that you use UTF-8 encoding, or something along these lines.


By the way, this is mentioned in the README and it is worth repeating: be aware that you should manually check the goo values with this bookmarklet.

Check goo values

Indeed, I don't know what Valve does, but I suspect they change the amount of gems a trading card is worth from time to time. So it is possible that your local database of goo values has old values for the amount of gems.

It takes a lot of time to gather the goo values (due to very strict rate limits), so I don't have that process automatized for each run.

Tasdv commented 2 years ago

I'll try that now

Tasdv commented 2 years ago

Is there a python script in the program that auto gathers them? Or did you have to do it manually?

Tasdv commented 2 years ago

I'll execute the program on a vm to see if its just my pc thats bugged.

woctezuma commented 2 years ago

Is there a python script in the program that auto gathers them? Or did you have to do it manually?

I think the program will gather them again if you delete this file.

Goo details

I have done it once in several runs. I don't remember exactly because it was some time ago. Nowadays, the program gathers goo values for new games, and assumes the old goo values are still correct, if I remember right.

Tasdv commented 2 years ago

Trying now

Is there a python script in the program that auto gathers them? Or did you have to do it manually?

I think the program will gather them again if you delete this file.

Goo details

I have done it once in several runs. I don't remember exactly because it was some time ago. Nowadays, the program gathers goo values for new games, and assumes the old goo values are still correct, if I remember right.

Tasdv commented 2 years ago

Which python file gathers new good values?

woctezuma commented 2 years ago

Which python file gathers new good values?

It is goo_details_for_foil_cards.json which gets longer.

Tasdv commented 2 years ago

I mean which python file do I have to run for it to gather new values?

woctezuma commented 2 years ago

Closing the issue for now, because I cannot reproduce it. I have run the script just fine till completion.

I mean which python file do I have to run for it to gather new values?

It should be the same script. If the .json file does not exist, the script should look up goo values for every appID. If this does not work as intended, I will check the files, but that is what I would expect from memory.