Reported August 2026
Wolverine Trading

Market Share Ticker with Imbalance

Reported by candidates from Wolverine Trading's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Wolverine Trading OA. Under 2s to a working solution.
Founder's read

The SQL question at Wolverine Trading, reported in August 2026, looks small but it hides a trap. You need the participant's share of each product's exchange volume, pick the top product, then report a buy minus sell imbalance. If you join the tables carelessly, the sums double up and every ratio is wrong. It's aggregation plus a join, nothing exotic. If you blank on the structure mid-assessment, StealthCoder runs invisibly on your desktop and gives you a working query as a safety net. Know the shape before you sit down.

The problem

An exchange publishes market trades, and one participant separately records the subset of trades in which it participated. A symbology table maps exchange product identifiers to ticker symbols.
For every product in which the participant traded, compute its market share as the participant's total traded quantity divided by the exchange's total traded quantity for that product. Select the product with the largest exact market-share ratio.
For the selected product, compute the participant's closing imbalance: total quantity on buy rows (B) minus total quantity on sell rows (S).
Return exactly one row with columns product and imbalance, in that order. FastPrep represents the source routine's two-key dictionary as this one-row result table.

Tables
market_trades: product_id (Integer), trade_id PK (Integer), quantity (Integer)
participant_trades: product (Text), trade_id PK (Integer), side (Text), quantity (Integer)
symbology: product (Text), product_id PK (Integer)

Constraints
market_trades.trade_id, symbology.product, and symbology.product_id are unique.
Every participant row references one market trade, and its product matches that trade's mapped symbology product. Products with no participant row are not candidates.
Every participant product has a positive total exchange quantity. Market and participant quantities are positive integers, and all required sums fit a signed 64-bit integer.
side is exactly B or S, and at least one participant row is present.
Compare market-share ratios without rounding. If products tie, return the lexicographically smaller uppercase ASCII product.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is aggregating each table separately before you combine them. Sum participant quantity per product from participant_trades. Sum market quantity per product by joining market_trades to symbology on product_id. Then join those two small results on product. Joining raw rows first fans out the sums, and that's the classic pitfall. Compare ratios exactly. Don't use ROUND or float division. Cross-multiply: p1 * m2 > p2 * m1, or order by the ratio using integer math, since sums fit in 64 bits. Break ties with product ascending, then LIMIT 1. For imbalance, use SUM(CASE WHEN side = 'B' THEN quantity ELSE -quantity END) on the winning product only. A CTE for the winner then a second aggregate keeps it readable. If the live OA has you stuck on the exact-ratio ordering, StealthCoder is the hedge that gets you unstuck without anyone seeing it.

Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.

If this hits your live OA

You can drill Market Share Ticker with Imbalance cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Wolverine Trading's OA.

Wolverine Trading reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Market Share Ticker with Imbalance FAQ

How hard is the Wolverine Trading market share SQL question really?+

Medium. No window functions are required. The difficulty is correctness: aggregating before joining, comparing ratios exactly, and handling the tie-break. If you can write two CTEs and a CASE sum, you can solve it. Most wrong answers come from fan-out in the join.

What's the trick to avoid wrong sums?+

Aggregate each table on its own first. Total participant quantity per product, total market quantity per product via symbology, then join the two summaries. Joining trade rows directly multiplies quantities and ruins the ratio. Check by hand on a tiny example before submitting.

How do I compare market share without rounding?+

Cross-multiply. Product A beats B if partA * mktB > partB * mktA. Or order by the ratio using integer arithmetic so no precision is lost. Avoid casting to float or using ROUND, since the problem demands exact comparison and the sums fit in 64 bits.

How do I compute the imbalance for just the winning product?+

Pick the winner in a CTE with ORDER BY share descending, product ascending, LIMIT 1. Then sum participant_trades for that product with CASE WHEN side = 'B' THEN quantity ELSE -quantity END. Output columns must be product then imbalance, exactly one row.

How do I prepare for this in 48 hours?+

Practice grouped aggregation with CTEs, conditional sums with CASE, and top-1-with-tiebreak queries. Write this exact query once from scratch on sample data. Focus on the join order and exact ratio ordering, since that's where candidates lose points.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Wolverine Trading.

OA at Wolverine Trading?
Invisible during screen share
Get it