FastPrepHedge Inventory with Return Covariance
Problems/Hedge Inventory with Return Covariance

Hedge Inventory with Return Covariance

Millennium logoMillennium● HardNEW GRADINTERNOA

Updated Nov 2026

QuestionConstraints

Problem statement

Source note: Reported in a Millennium online assessment for new grad and intern roles. The report covers return covariance, lining up inventory with the price columns, ridge regularization on liquid assets, the best hedge amounts, and the leftover variance. It leaves out the fixed table layout, the covariance convention, the optimization equation, how numbers are stored, the limits on conditioning, and how close an answer must be. Here prices and quantities are converted to float64. We set a range on the ratio between neighbors and a minimum ridge value. These keep the regularized solve well behaved and do not change the optimization in the report.

Our version is about 86% the same as the reported question.

A desk holds inventory in three assets and may add hedge quantities only in assets marked as liquid. Estimate return risk from the time-sorted price history, solve the ridge-regularized hedge, and report the remaining portfolio variance.

Risk model

  1. Sort prices by period. Convert the price columns to IEEE-754 float64, then compute consecutive simple returns current_price / previous_price - 1.
  2. Build the sample covariance matrix Sigma of those return rows, using denominator return_count - 1.
  3. Sort portfolio by asset_order; rows must align with asset_1, asset_2, and asset_3. Convert the quantities to float64.
  4. Let q be the inventory vector and L the indices marked is_liquid. Solve (Sigma_LL + ridge * I) * h_L = -Sigma_LA * q in float64. Set hedge quantities outside L to 0.
  5. Let r = q + h. Compute residual variance as r^T * Sigma * r.

Return exactly one row containing the three hedge quantities in price-column order and the residual variance.

Table schema

Pandas

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.

prices

ColumnTypeNullableDescription
periodPKIntegerNo—
asset_1DecimalNo—
asset_2DecimalNo—
asset_3DecimalNo—

portfolio

ColumnTypeNullableDescription
asset_orderPKIntegerNo—
assetTextNo—
quantityDecimalNo—
is_liquidBooleanNo—

parameters

ColumnTypeNullableDescription
config_idPKIntegerNo—
ridgeDecimalNo—

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
asset_1_hedgeDecimalNo—
asset_2_hedgeDecimalNo—
asset_3_hedgeDecimalNo—
residual_varianceDecimalNo—

Row order: must match exactly. Numeric tolerance: 0.000001.

Constraints

  • 3 <= prices.row_count <= 2000, and periods are unique.
  • Every price is an exact decimal in [1, 1000000] with at most 6 fractional digits. After sorting by period, every consecutive price ratio for the same asset lies in [0.9, 1.1].
  • portfolio contains exactly three rows with unique orders 1, 2, and 3 and matching asset names asset_1, asset_2, and asset_3.
  • Every portfolio quantity is in [-1000, 1000] with at most 6 fractional digits, and at least one portfolio row has is_liquid = true.
  • parameters contains exactly one row with 0.0001 <= ridge <= 1.
  • The ratio and ridge bounds keep each return in [-0.1, 0.1] and the ridge-regularized liquid system symmetric positive definite with 2-norm condition number at most 601.
  • The return covariance and every reported value are finite.
  • Numeric results are compared with absolute tolerance 0.000001.

More Millennium Online Assessment questions

  • Calculate the Half SpreadOA · Seen Sep 2026
  • Debug the Impact ModelOA · Seen Sep 2026
  • Debug the Risk-Limit QuoterOA · Seen Sep 2026
  • Quote One RequestOA · Seen Sep 2026
  • Risk Limits and Inventory SkewOA · Seen Sep 2026
  • Track the Book and Mark Final PnLOA · Seen Sep 2026
  • Clean the TapeOA · Seen Sep 2026
  • Client Markout AnalysisOA · Seen Sep 2026
  • Debug Fair-Value LookupOA · Seen Sep 2026
  • Debug the Tape CleanerOA · Seen Sep 2026

Similar questions at other companies

  • Balance a Chemical EquationMicrosoft · OAMicrosoft interview questions
  • Daily Temperature By TownTwo Sigma · OATwo Sigma interview questions
  • Count Valid A-B-C Sequences Under a Modulo-Four RuleInfosys · OAInfosys interview questions
  • Solve a Two-Variable Linear ODEAdobe · OAAdobe interview questions
  • The Three Knights 🎠TikTok · OATikTok interview questions
  • Survey Table: Group Given an AnswerSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Summarize Taxi Drivers and RidesBoston Consulting Group · OABoston Consulting Group interview questions
  • Gaussian Naive Bayes Classifier (Machine Learning OA)Pinterest · OAPinterest interview questions
  • Squared Frobenius Norm of a Reflect-and-Stretch MapWalleye Capital · OA
  • Scaled Dot-Product AttentionMeshy · OA

Millennium interview experiences

  • Millennium Full Stack Engineer Java Interview: 1 Experience
All Millennium interview questionsSee Millennium hiring insights