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).
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.
- 011 pt
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.
Loading editor… - 022 pts
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.
Loading editor… - 032 pts
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.
Loading editor… - 041 pt
Implement portfolio_return(weights, returns): return the portfolio return, i.e. the weighted sum of the asset returns (sum of weight[i] × return[i]).
Loading editor… - 052 pts
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.
Loading editor… - 062 pts
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.
Loading editor…