FastPrepTrade and Hedge Totals by Symbol
Problems/Trade and Hedge Totals by Symbol

Trade and Hedge Totals by Symbol

Wolverine Trading logoWolverine Trading● EasyINTERNNEW GRADOA
QuestionConstraints

Problem statement

Source note: The visible source omits the complete hedge-table schema and a row-order rule. The judged core task matches the visible source at about 90%.

Two tables describe option trades and their optional risk-offsetting hedges:

  • wolve_trades contains each trade's identifier, symbol, quantity, profit or loss, and option type.
  • wolve_hedges contains the optional hedge associated with a trade.

Return one row for every distinct symbol in wolve_trades. For each symbol, calculate the sums of trade_qty, trade_pnl, hedge_qty, and hedge_pnl.

Treat a missing hedge row or any NULL quantity or PnL value as 0.

Return exactly these columns, in this order: symbol, total_trade_qty, total_trade_pnl, total_hedge_qty, and total_hedge_pnl. Result rows may appear in any order.

Table schema

MySQLPostgreSQLPandas

Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.

wolve_trades

One row per option trade.

ColumnTypeNullableDescription
trade_idPKIntegerNoUnique trade identifier.
symbolTextNoTicker symbol.
trade_qtyIntegerYesTrade quantity.
trade_pnlIntegerYesTrade profit and loss.
option_typeTextNoOption type.

wolve_hedges

At most one optional hedge row per option trade.

ColumnTypeNullableDescription
trade_idPKIntegerNoIdentifier of the hedged trade.
hedge_qtyIntegerYesHedge quantity.
hedge_pnlIntegerYesHedge profit and loss.

Foreign key: trade_id → wolve_trades(trade_id)

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
symbolTextNo—
total_trade_qtyIntegerNo—
total_trade_pnlIntegerNo—
total_hedge_qtyIntegerNo—
total_hedge_pnlIntegerNo—

Row order: any order is accepted. Numeric tolerance: 0.

Constraints

  • wolve_trades.trade_id is unique.
  • For this exercise, assume wolve_hedges.trade_id references wolve_trades.trade_id, and each trade has at most one hedge row.
  • For this exercise, assume the output contains every distinct non-NULL symbol in wolve_trades, including symbols whose trades have no matching hedge rows.
  • For this exercise, assume result rows may be returned in any order.
  • For this exercise, assume quantity and PnL fields are nullable signed 64-bit integers and every required aggregate fits a signed 64-bit integer.

More Wolverine Trading problems

  • Hedges Outperforming Their TradesOA · Seen Aug 2026
  • Market Share Ticker with ImbalanceOA · Seen Aug 2026
  • Longest Cumulative Kitchen Delivery TimeOA · Seen Aug 2026
All Wolverine Trading interview questionsSee Wolverine Trading hiring insights