Deterministic PnL Aggregator - Quant Developer Interview Question
Difficulty: Hard
Category: systems
Asked at: Jump Trading, Tower Research, Citadel Securities, IMC, HRT
Topics: floating-point, systems, numerical-analysis, c++
Problem Description
Maintaining an exact internal state of Profit and Loss (PnL) is critical, yet standard floating-point addition is not associative due to rounding errors. This lack of precision can lead to catastrophic cancellation when aggregating small fees or profits against large notional positions, requiring numerically stable summation algorithms to ensure deterministic results.
Task
Implement the PnLCalculator class to accurately compute the cumulative Net PnL from a stream of trades. You must implement
Practice this hard developer interview question on MyntBit - the LeetCode for quants with 200+ quant interview questions for Jane Street, Citadel, Two Sigma, and other top quantitative finance firms.