LIVE·WAITING…
connecting to the live quote stream…
--:--:--UTC
#26
Quantile outputs → signal
mediumMLacceptance —~20 min
Implement quantile_signal(p10, p50, p90) — turn a quantile-regression forecast into a position for each asset: 1 (long) when the 10th percentile of the forecast return is above zero, -1 (short) when the 90th percentile is below zero, else 0 (flat). The three inputs are lists of equal length.
A median forecast alone says nothing about conviction; the interval does. This is the exact rule the workbench's quantile model uses to commit. Return the list of signals.
example 1
input
p10=[0.01, -0.02, 0.005], p50=[0.03, 0.0, 0.02], p90=[0.05, 0.02, 0.04]
output
[1, 0, 1]
example 2
input
p10=[0.01, -0.06, -0.02], p50=[0.03, -0.03, 0.0], p90=[0.05, -0.01, 0.02]
output
[1, -1, 0]
constraints
- 1 ≤ len(p10) == len(p50) == len(p90) ≤ 1_000
- p10 ≤ p50 ≤ p90 elementwise
teacher · 2 hints · the first is free
↗ read the theory
the chapter this problem is cut from
▶ open in the workbench
run the same math on a real tape
●solution.py· utf-8 · spaces:4
ln 1, col 1tab indent · esc leave editor
python 3.13 · pyodide
+ 6 hidden on submit
input · keyword arguments to quantile_signal()
p10=[0.01, -0.02, 0.005], p50=[0.03, 0.0, 0.02], p90=[0.05, 0.02, 0.04]
expected
[1, 0, 1]
the judge calls quantile_signal() with exactly these inputs · outputs are compared to 6 decimal places
● standing bypython 3.13 in your browser · pyodide 0.28.3 · judged on the server to 6 dp⌘↵ run · ⌘⇧↵ submit
paper only · educational · not advice