FastPrepDebug the Impact Model
Problems/Debug the Impact Model

Debug the Impact Model

Millennium logoMillennium● HardNEW GRADINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Millennium online assessment for new grad and intern roles. The report first gives the size-and-impact update. Then it gives a buggy quote_impact_stream as a starting point. The first quote looks right, but the state drifts over many requests. The Java version shown here keeps that same bug in the recurrence, through the portable quoteImpactStream function. The report leaves out the array shape across languages, the number limits, and how close an answer must be. We filled those in.

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

A market-making desk quotes an ordered stream of client requests for one asset. Each completed request leaves a temporary signed market impact that biases later quotes and then decays. The supplied implementation produces the expected first quote, but its state drifts across a multi-request stream. Repair the recurrence without changing the method signature.

Buggy implementation to repair

Request objects are represented here by parallel arrays. This implementation has a decay-placement defect:

public double[] quoteImpactStream(double reference, double[] impactParams, double liquidityScore, String[] sides, double[] quantities) {
    double k = impactParams[0];
    double decay = impactParams[1];
    double halfSpread = impactParams[2];
    double accumulatedImpact = 0.0;
    double[] quotes = new double[sides.length];
    boolean first = true;

    for (int i = 0; i < sides.length; i++) {
        double direction = sides[i].equals("BUY") ? 1.0 : -1.0;
        double signedSpread = direction * halfSpread;
        if (first) {
            quotes[i] = reference + signedSpread;
            first = false;
        } else {
            quotes[i] = reference + signedSpread + accumulatedImpact;
        }
        double currentSizeImpact = direction * k * quantities[i] * (1.0 - liquidityScore);
        accumulatedImpact = accumulatedImpact * decay + currentSizeImpact;
    }
    return quotes;
}

Correct quote and state rules

  1. Let impactParams = [k, decay, halfSpread]. The accumulated impact starts at 0.
  2. For the current request, use direction +1 for BUY and -1 for SELL.
  3. Emit reference + direction * halfSpread + accumulatedImpact. The current request must not affect its own quote.
  4. Compute the current size impact as direction * k * quantity * (1 - liquidityScore).
  5. After emitting the quote, update the state to (accumulatedImpact + currentSizeImpact) * decay. The resulting value biases the next request.

Return one quote per request in the original order.

Function

quoteImpactStream(reference: double, impactParams: double[], liquidityScore: double, sides: String[], quantities: double[]) → double[]

Examples

Example 1

reference = 100impactParams = [0.01,0.5,0.1]liquidityScore = 0.8sides = ["BUY","BUY","SELL"]quantities = [10,20,5]return = [100.1,100.11,99.925]

The first quote has no prior impact. Its accepted BUY contributes 0.02 before decay, so the next offset is 0.01. The second BUY leaves an offset of 0.025 for the SELL quote.

Example 2

reference = 50impactParams = [0.2,0.7,0.05]liquidityScore = 1sides = ["SELL","BUY"]quantities = [100,250]return = [49.95,50.05]

Perfect liquidity makes every size-impact contribution zero, so only the side-specific half spread changes each quote.

Example 3

reference = 10impactParams = [0.1,0,0.2]liquidityScore = 0sides = ["BUY","BUY"]quantities = [3,4]return = [10.2,10.2]

A decay of zero clears the updated state after every request, so the second request also sees zero prior impact.

Constraints

  • 1 <= sides.length = quantities.length <= 500.
  • impactParams.length = 3, representing nonnegative k, decay in [0, 1], and nonnegative halfSpread.
  • reference > 0 and every quantity is positive.
  • 0 <= liquidityScore <= 1.
  • Every side is exactly BUY or SELL.
  • Every input and intermediate result fits in a finite double.

More Millennium Online Assessment questions

  • Calculate the Half SpreadOA · Seen Sep 2026
  • Debug the Risk-Limit QuoterOA · Seen Sep 2026
  • Hedge Inventory with Return CovarianceOA · 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

  • Distribute Elements Into Two Arrays IIRubrik · OARubrik interview questions
  • Incident MonitorStripe · OAStripe interview questions
  • Parcel Attribute Store with TTLAirbnb · OAAirbnb interview questions
  • Four-Player Trick-Taking Card Game SimulationScale AI · OA · PHONE SCREENScale AI interview questions
  • Update Pod Counts From LogsSalesforce · OASalesforce interview questions
  • Extract CardsInfosys · OAInfosys interview questions
  • Configuration SystemPostman · OAPostman interview questions
  • Macaron Order with Set DiscountsShopify · OAShopify interview questions
  • Bank Accounts with Balance HistoryMeta · OAMeta interview questions
  • Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions

Millennium interview experiences

  • Millennium Full Stack Engineer Java Interview: 1 Experience
All Millennium interview questionsSee Millennium hiring insights
Saved
class Solution {
    public double[] quoteImpactStream(double reference, double[] impactParams, double liquidityScore, String[] sides, double[] quantities) {
        // write your code here
    }
}
Checking account…