# Prices

## How prices are calculated

CSGOTrader mostly relies on Steam Community Market historical sales data to calculate it's prices. If there is no market data it uses other providers, the whole algorithm is described in plain english below. If you prefer to read the Python code itself you can scroll through this. For popular items with stable market sales it's pretty simple.
• A, If there is more than 5 sold in the past 24 hours and the average price does not differ more than 10% from the past week's average this is what the extension takes as the price of the item. This is the case for most popular items.
• B, If that is not the case the extension takes the last week's average and adjusts it with the general market trend of the last week.
If the item is not that popular (in this case defined as sold less than 5 times in the past 24 hours) then the next best thing that can be checked is the average of the last week.
• C, If there were more than 5 sales during the last week and the difference between that and the last month's average is less than 10% this average is taken and used as the price after it gets adjusted by general market trends.
• D, When there is less than 5 sold in the past week or there is no weekly data at all the monthly average is taken after adjusted with market trends.
• E, If the item is StatTrak then the prices are compared to the non-st one. If the price of the StatTrak one is lower then the non-st one's price is taken and an additional 10% is added. This case should be pretty rare.
If there is no market sales data the algorithm proceeds to other providers
• F, If there is pricing info on CS.MONEY it takes that price and adjusts with the average difference between CS.MONEY and market prices.
• G, If there is no CS.MONEY price it tries taking the Buff price and adjusts with the average difference between Buff and market prices.
• H, If there is no Buff price it takes a price from a database table where prices are set manually. This is pretty much unused for now. I have built this functionality so I can add prices for new items when there is no data from the providers yet.
• I, If all of the above doesn't happen then the extension does not set any price to the item.
Special cases:
• J, Doppler and Gamma doppler knives have special pricing, if there is price info for the given phase for the knife on CS.MONEY, it takes that price and adjusts with the average difference between CS.MONEY and market prices. If there isn't it falls back to the price calculated by the algorithm above.
• H,When the Steam price of an item is over 800, the buff price is taken instead and it's adjusted by the average difference between the two.

## Architecture - How the prices are scrapped, processed, stored and served

It all happens on AWS. There is a python script that is responsible for price scraping and another one that updates exchange rates. The price scrapper script runs daily at 3AM UTC. The exchange rates update every 3 hours. Both of these Lambda functions are triggered by CloudWatch events and are executed in a Python 3.7 environment. The pricing script scrapes prices from steamapis.com, CS.MONEY, BITSKINS.COM, LOOT.FARM and CSGO.TM then the extension calculates it's own pricing with the algorithm described above. The pricing data is stored in an S3 Bucket and made available and distributed around the world under the prices.csgotrader.app domain by Cloudfront.

The latest prices are always available at: