MTG Proxy Price Optimizer
Chrome extension — buy it or proxy it, whichever is cheaper
TypeScriptReactWebpackJestChrome MV3
- Built
- July 2024
- Status
- Working — loads unpacked
- Stack
- TypeScript, React, Webpack, Jest, Chrome Manifest V3
- Code
- github.com/fudgemasterultra/mtg-proxy
Problem
Building a Magic deck you can actually afford means going card by card and deciding which ones to buy real and which to print as proxies. For a hundred-card list that is a hundred small decisions, and doing it by hand is exactly as fun as it sounds.
It is also harder than it looks, because proxy printing is priced in bulk tiers — order more, pay less per card. So whether a given card is worth proxying depends on how many other cards you’re proxying, which changes the per-card price, which changes whether those other cards were worth proxying. The decision loops back on itself.
Solution
The extension reads the decklist straight off the page and then settles the circular part by iterating until it stops changing.
- A content script scrapes name, quantity, and price from the decklist table on the page — no copy-paste, no export step
- Bulk tiers are modelled directly: 200+ cards at $0.75 each, 50+ at $1.00, 10+ at $1.50, otherwise $2.00
- Each pass takes the current tier price and moves every card cheaper to buy than to proxy into the buy pile. That shrinks the proxy order, which may bump it into a more expensive tier, which may push more cards over. The loop repeats until a full pass changes nothing
- The result is the two lists you actually want: what to order as proxies, and what to buy real
Worth noting
Settling to a fixed point rather than computing a formula is what makes this correct. Removing cards from the proxy order can only ever raise the per-card price, never lower it, so each pass moves in one direction and the loop is guaranteed to stop — it can’t oscillate between two answers.
The pricing logic is a pure function taking a decklist and returning two arrays, which meant the interesting half could be unit tested without a browser anywhere near it.