Debug Fair-Value Lookup
Updated
Problem statement
The provided Pandas starter attempts an as-of fair-value lookup, but it mishandles timestamp order, exact-time observations, invalid prices, and the staleness boundary. Fix fair_value_at so it returns a one-row DataFrame with the column price.
Lookup rules
- Read the single row in
query_paramsand convert all timestamps before comparing them. - Consider only price rows whose
timestampis at or beforequery_time. - Starting with the most recent eligible row, walk backward until the requested asset has a non-null, strictly positive price.
- If no valid observation exists, return
NULL. - Otherwise, calculate the candidate's age from its own timestamp. Return
NULLonly when that age is strictly greater thanmax_staleness_minutes; an observation exactly on the boundary is accepted.
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
Price tape with one timestamp and three asset columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| timestampPK | Timestamp | No | — |
| Asset_1 | Decimal | Yes | — |
| Asset_2 | Decimal | Yes | — |
| Asset_3 | Decimal | Yes | — |
query_params
The one requested asset, query time, and allowed staleness.
| Column | Type | Nullable | Description |
|---|---|---|---|
| asset | Text | No | — |
| query_time | Timestamp | No | — |
| max_staleness_minutes | Integer | No | — |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| price | Decimal | Yes | — |
Row order: must match exactly. Numeric tolerance: 0.
Constraints
- The
pricestable contains at least1row and at most2000rows. - Price timestamps are unique but may arrive out of order.
- The
query_paramstable contains exactly one row. - The requested
assetis exactlyAsset_1,Asset_2, orAsset_3. max_staleness_minutesis a nonnegative integer.- Return exactly one row; its
pricemay beNULL.
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
- 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 the Tape CleanerOA · Seen Sep 2026
Similar questions at other companies
- Prepare Taxi Driver Classification DataBoston Consulting Group · OABoston Consulting Group interview questions
- Weekend Appointments for Consular Services ReschedulingMcKinsey & Company · OAMcKinsey & Company interview questions
- Summarize Customer RecordsAgoda · OAAgoda interview questions
- Benchmarking Tool ReportPalantir · OAPalantir interview questions
- Latest New JobSphere · ONSITE INTERVIEW
- In-Memory Database QueriesOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
- Second Highest SalaryHartford Financial Services · ONSITE INTERVIEWHartford Financial Services interview questions
- Worker Management (Promotion Track), Part 4: Full-Shift Double PayAirbnb · OAAirbnb interview questions
- Deployment Window SchedulerStripe · OAStripe interview questions
- Hard Disk Clustering CostConfluent · OAConfluent interview questions