DeskPrep
Desk screenfree~25 min· Python code run & grade

Python Quant Screen

Write and run real Python in your browser short finance functions, graded on their outputs. Free, no account needed.

The scenario

The coding screen. You're dropped into an editor and asked to implement small, precise finance functions returns, drawdown, a quick Monte Carlo the kind of thing a CoderPad or HackerRank quant screen throws at you. Write it, run it against the given inputs, and make the numbers come out right.

Where this shows up

A short, timed Python coding screen implement a few numerical/finance functions that must return exact outputs on fixed inputs is a standard early round for quant research and quant-dev roles (typically on HackerRank or CoderPad).

quant researchquant developersystematic funds

Firms such as Citadel, Two Sigma, G-Research.

DeskPrep is not affiliated with, endorsed by, or sponsored by any named firm. Firm names are used for illustrative, educational purposes only and do not imply that these materials are official assessments of, or are connected with, those firms.

The drill

Complete each function in the editor and click Run to execute it against the shown inputs. Everything runs in your browser (Python via Pyodide) the first Run loads the runtime, so give it a few seconds. When you're happy, submit the drill: your computed outputs are graded against the expected results, with floats compared to a tolerance.

practiceelapsed0:00
  1. 01

    Implement simple_returns(prices): given a list of prices, return the list of simple returns r[i] = (price[i] − price[i−1]) / price[i−1]. The output has one fewer element than the input.

    1 pt
    Loading editor…
  2. 02

    Implement rolling_mean(values, window): return the list of rolling means of `values` over the given window size. The output has len(values) − window + 1 elements.

    2 pts
    Loading editor…
  3. 03

    Implement max_drawdown(prices): return the maximum drawdown of a price series as a POSITIVE fraction the largest peak-to-trough decline (peak − trough) / peak, where the peak is the running maximum up to that point.

    2 pts
    Loading editor…
  4. 04

    Implement portfolio_return(weights, returns): return the portfolio return, i.e. the weighted sum of the asset returns (sum of weight[i] × return[i]).

    1 pt
    Loading editor…
  5. 05

    Implement parity_mispricing(call, put, spot, strike, rate, t): put-call parity says (call − put) should equal spot − strike·e^(−rate·t). Return the mispricing = (call − put) − (spot − strike·e^(−rate·t)). Positive means the call is rich; ~0 means fairly priced.

    2 pts
    Loading editor…
  6. 06

    Implement monte_carlo_pi(n): estimate π by Monte Carlo. The seed is set for you. For each of n points draw x = random.random() then y = random.random(); count the point if x·x + y·y ≤ 1.0. Return 4 × inside / n.

    Draw x first, then y, each iteration the fixed seed makes the result reproducible.

    2 pts
    Loading editor…
10 auto-graded pts
Python Quant Screen Graded Interview Drill | DeskPrep