Menu

How I compute a "typical price" for 22,000 LEGO offers (and why shop discounts are mostly theatre)
📰

How I compute a "typical price" for 22,000 LEGO offers (and why shop discounts are mostly theatre)

DEV Community: php·klockers.pl·7 days ago
#sgC1kstX
#devto#dev#price#shop#median
Reading 0:00
15s threshold

Every price comparison site eventually has to answer one question, and it is not "where is it cheapest". It is: is this actually cheap?

Retailers answer it for you, loudly, with a red badge: -50%. The badge means that the current price is half of the regular price the shop declares. That number is a field in a feed. Nobody audits it.

I run https://klockers.pl/ , a LEGO price comparison for the Polish market: 18 shops, 5,600 active sets, roughly 22,000 offers, all built on Symfony 8 and MariaDB. This post is about the part that took the most iterations - turning a firehose of affiliate offers into a price history I can reason about. The code is real, trimmed for readability.

The dataset

At the time of writing: 22,842 offers, 5,595 sets with at least two shops, 18 shops, daily snapshots since October. LEGO is a friendly domain for this because two numbers are public for every set: the retail price and the piece count.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.