Minimum Impact Schedule for Liquidating a Futures Position

Last updated: November 29, 2026

Quick Overview

Sell Q contracts over T time buckets. Selling x contracts in bucket t costs impact[t] times x squared plus spread[t] times x, and bucket t can absorb at most cap[t] contracts. Find the minimum total cost and the per bucket allocation, or report that it is infeasible.

DRW
Coding & Algorithms
Quantitative Researcher
DRW
November 29, 2026
Quantitative Researcher
Onsite
Coding & Algorithms
Hard

0

0

0 solved


Sell Q contracts over T time buckets. Selling x contracts in bucket t costs impact[t] times x squared plus spread[t] times x, and bucket t can absorb at most cap[t] contracts. Find the minimum total cost and the per bucket allocation, or report that it is infeasible.

Execution cost modeling matters to DRW because large positions in futures and rates must be worked without moving the market. The question tests 2D DP over time and quantity, and strong candidates notice that the convex cost allows a much faster greedy, which the interviewer will push toward.

What the Interviewer Expects
  • Defines dp over buckets and units sold so far
  • Handles capacity limits and infeasibility
  • Reconstructs the allocation from stored choices
  • States O(T Q C) complexity honestly
  • Recognizes convexity enables a marginal cost greedy with a heap
Key Topics to Cover
2D dynamic programming
knapsack
convexity
optimal execution
market impact
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • Prove the greedy by marginal cost is optimal for convex per bucket costs.
  • Add a penalty for holding inventory (risk aversion). What does the DP state need?
  • Impact decays across buckets instead of being independent. How does that change the problem?
  • How would you handle Q in the millions?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Inputs: integer Q, arrays impact, spread, cap of length T. Each bucket's cost depends only on its own x (no cross bucket impact). Output: (cost, allocation) or (inf, None) if the caps sum be...

High-Level Design

This is a bounded knapsack with a convex cost per item group. dp_t[q] is the cheapest way to sell q units using buckets 0..t. Transition: `dp_t[q] = min over x in [0, min(cap_t, q)] of dp_{t-1}[q-...


Submit Your Answer
Markdown supported

Related Questions