FastPrepCalculate the Half Spread
Problems/Calculate the Half Spread

Calculate the Half Spread

Millennium logoMillennium● EasyNEW GRADINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Millennium online assessment for new grad and intern roles. The report gives the pricing factors and a lower bound. It leaves out the exact formula, the range of numbers, and how many decimal places the output has. We filled those in.

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

A market-making model starts with a base half spread, then adjusts it for volatility and liquidity. Higher volatility must make the quote wider, while higher liquidity must make it narrower.

Implement calculateHalfSpread and compute:

modeledHalfSpread = baseHalfSpread * (1 + volatility) / liquidityScore

Each input is a decimal value with at most seven digits after the decimal point; interpret those decimal values exactly. Return the larger of modeledHalfSpread and minimumHalfSpread. Round the result to six decimal places; an exact halfway case rounds upward.

Function

calculateHalfSpread(baseHalfSpread: double, volatility: double, liquidityScore: double, minimumHalfSpread: double) → double

Examples

Example 1

baseHalfSpread = 0.02volatility = 0.5liquidityScore = 0.75minimumHalfSpread = 0.03return = 0.04

The modeled value is 0.02 * 1.5 / 0.75 = 0.04. It is larger than the minimum 0.03.

Example 2

baseHalfSpread = 0.01volatility = 0.1liquidityScore = 1.0minimumHalfSpread = 0.02return = 0.02

The modeled value is 0.011, so the minimum half spread 0.02 becomes the result.

Constraints

  • 0 < baseHalfSpread <= 100
  • 0 <= volatility <= 10
  • 10^-6 <= liquidityScore <= 1
  • 0 <= minimumHalfSpread <= 100
  • Every input has at most seven digits after the decimal point.
  • The unrounded modeled value is at most 10^9.

More Millennium Online Assessment questions

  • Debug the Impact ModelOA · 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

  • Basic Item DiscountsPalantir · OAPalantir interview questions
  • Diagonal Bounce TraversalAutodesk · OAAutodesk interview questions
  • Costliest ChocolateRippling · OARippling interview questions
  • Distinct Chapters Missed During a Cyclic AbsenceVisa · OAVisa interview questions
  • Count Palindromic Base RepresentationsSEDEMAC · OA
  • Reduce a Number to One DigitAccenture · OAAccenture interview questions
  • Online No-Intercept Linear RegressionTwo Sigma · OATwo Sigma interview questions
  • Plus Mult ArrayIBM · OAIBM interview questions
  • Product Minus Sum of DigitsTikTok · OATikTok interview questions
  • Progressive Tax CalculatorInteractive Brokers · OA

Millennium interview experiences

  • Millennium Full Stack Engineer Java Interview: 1 Experience
All Millennium interview questionsSee Millennium hiring insights
Saved
class Solution {
    public double calculateHalfSpread(double baseHalfSpread, double volatility, double liquidityScore, double minimumHalfSpread) {
        // write your code here
    }
}
Checking account…