Work / Quant

CS2 trade-up contracts, priced like any other market

An expected-value engine for CS2 trade-up contracts: post-2024 float math cross-validated to six decimal places, deliberately pessimistic fee and slippage assumptions, and probability-coverage tracking across 39 collections — with an audit honest enough to call the tool a scanner, not a calculator.

Abstract. Trade-up contracts are CS2's built-in derivative: ten skins in, one probabilistic skin out. This engine prices every branch of that outcome tree — per-skin float normalization, collection-weighted probabilities, a 13% fee and a 10% slippage buffer — across all 39 collections at once. The float formula is cross-validated to six decimal places against two independent tools, and the audit's own verdict stays on the page: it is a scanner, not yet a calculator, because midpoint-float assumptions fail for real trades.

§ 1 · Problem

A derivative market inside a video game

Trade-up contracts are CS2’s built-in derivative: consume ten skins of one rarity, receive one skin of the next rarity up, with the outcome drawn probabilistically from the input collections and its wear set by a float formula. Whether a contract is +EV decomposes exactly like any market bet — input prices, outcome probabilities, output floats, fees, liquidity. Existing tools (TradeUpSpy, TradeUpX) analyze one contract or one collection at a time; I wanted to scan all 39 collections at once and see where the EV actually lives.

Same discipline as the trading work, pointed at a different market: define the payoff structure precisely, price every branch of the outcome tree, and distrust your own numbers until they agree with independent references.

§ 2 · Data & provenance

Two hostile APIs and a hand-mapped universe

Prices come from the Steam Market priceoverview endpoint (no auth, aggressively rate-limited — 3.5 seconds between requests, roughly an hour for a full refresh) and the keyed CSFloat marketplace API. The cache holds 1,459 Steam prices and 325 CSFloat entries, with daily snapshots retained for 90 days. Every entry carries a fetched-at timestamp, because skin prices can move 5–20% in a day; the dashboard shows a staleness banner once data is older than 24 hours.

The collection universe — 39 collections, roughly 520 skins with per-skin float ranges — was hand-mapped and then verified against csgostash, totalcsgo.com, the Counter-Strike Wiki and ByMykel’s CSGO-API, because the first pass had skins in the wrong collections. One soft spot is documented rather than hidden: legacy map collections still use a default 0.06–0.80 float range that hasn’t been individually verified.

§ 3 · Method

Pessimistic EV on top of exact float math

The core is the post-October-2024 output-float formula: normalize each input float to its own skin’s range, average the ten normalized values, then map onto the output skin’s range. The normalization step is the whole game — a raw-float average (which FloatTool still uses) diverges by enough to flip the predicted wear tier on mixed-range inputs.

# post-Oct-2024 trade-up float formula.
# the step whose absence caused the founding bug:
# normalize each input to ITS OWN skin's float range first.
def output_float(inputs, out_lo, out_hi):
    normalized = [
        (f - lo) / (hi - lo)
        for f, lo, hi in inputs   # (float, range_lo, range_hi)
    ]
    avg = sum(normalized) / len(normalized)
    return out_lo + avg * (out_hi - out_lo)

On top of the float math, the EV layers are deliberately pessimistic: outcome probabilities weighted by input counts per collection, a 13% Steam fee, a 10% slippage buffer on input costs (you are buying ten listings, not one), probability-mass coverage tracking, liquidity scoring that flags outputs with fewer than ten listings, and boundary-wear sensitivity — any predicted float within 0.005 of a wear boundary gets a warning, since 0.069 versus 0.071 can be a 10× price difference. A separate dip-detector module flags dip/swing entries from the price history using heuristics.

Sources
Steam Market · priceoverview
CSFloat · keyed API
39 collections · hand-mapped
core/ · stdlib only
float math · EV · fees
coverage · liquidity · boundary
dip detector · price history
app/ · FastAPI
/api/opportunities · /api/refresh
dashboard · filters + warnings
Swagger at /docs
Fig. 1 — strict two-layer split: the engine is pure stdlib and imports no web dependencies; FastAPI is just a surface over it.

Because the engine imports nothing from the web layer, the same math powers the FastAPI dashboard, the CLI batch refresher, and whatever comes next.

§ 4 · Results

Calibration first — and an honest audit

The headline result is a calibration result, not a profit figure. A dedicated accuracy audit (2026-05-26) cross-validated the float formula against independent implementations: numerically identical to tradeup_optimizer and TradeUpX to six decimal places, and it caught FloatTool’s simplified formula diverging by 0.057 in a mixed-range test — a full wear tier. The probability and fee models matched all references. 36/36 unit tests pass, and an end-to-end smoke scan computed 678 candidate opportunities from the migrated cache.

$ audit --float-formula --refs tradeup_optimizer TradeUpX FloatTool
[✓] output-float formula 6 dp agreement
[✓] probability model sums to 1.0
[✓] fee model (13% + 10% slippage)
[✗] midpoint-float assumption 0.277 → 0.392
VERDICT: formula correct — float assumptions fail for real trades.
audit conclusion, verbatim: the tool is a Scanner pretending to be a Calculator.

The audit cuts the other way too, verbatim: “the tool is a Scanner pretending to be a Calculator.” The scanner assumes midpoint floats per wear tier, but the cheapest real listings cluster at the worst floats in the tier — a midpoint 0.265 input predicts a Field-Tested output at 0.277, while a realistic cheapest-listing float of 0.35 produces 0.392, which is Well-Worn. What the scanner shows as FT profit can be WW loss, so the EV numbers are for discovery and ranking, not for pulling the trigger. The coverage tracker refuses to fake completeness the same way: 78 trade-ups are flagged where missing output prices leave the probability mass under 100%. No trades have been placed off this tool, and several validations remain explicitly open — the slippage buffer against a real ten-listing buy, a mixed-ratio EV cross-check against TradeUpSpy, StatTrak pricing, and boundary-flag verification.

§ 5 · What it taught

The founding bug, and knowing what you approximate

  • The founding bug: the calculator once showed +212% ROI on a PP-Bizon Carbon Fiber contract where TradeUpSpy showed −68.8%. The cause was treating a raw float of 0.035 as 3.5% through the range when, for a skin with range 0.00–0.12, it’s 29.2%. One missing normalization step inflated every ROI in the tool — and when your number disagrees with the reference by 280 points, the reference is right.
  • The scanner/calculator distinction: know exactly which of your assumptions are approximations, and label them in the output instead of averaging them away.
  • From the reference literature: generic trade-ups with average skins are usually negative EV. The real profit mechanism is the “condition cliff” — cheap low-float inputs that mathematically guarantee a higher wear tier — which needs the inverse formula and per-listing float data, not midpoint scanning.
  • Data hygiene earned its own decision-log entries: OneDrive sync corrupted the price cache once and injected null bytes into a source file mid-edit, which is why the canonical repo lives on a non-syncing drive.
§ 6 · What's next

Sniper mode, then an honest split

The roadmap follows the audit’s prioritized findings, and none of it is built yet. P0 is the inverse formula — “sniper mode”: given a target output wear, solve for the maximum acceptable input float, then check whether CSFloat actually lists skins under that threshold at a viable price (a planned POST /api/sniper endpoint). After that, the tool splits honestly into Scanner mode (midpoint assumptions, bulk discovery — what exists today) and Calculator mode (ten specific floats in, exact EV out). Also queued: CSFloat listing integration with real per-listing floats, replacing the hand-maintained collections file with ByMykel API metadata, filling the price gaps (roughly 334 Steam prices still missing; CSFloat coverage at 171 of 523 skins at last status), and scheduled refresh automation.