Research
Python Sandbox
A real CPython runtime running in your browser via Pyodide. NumPy, pandas, and a built-in qp module for prices and backtests.
Exercise
Calculate Simple Return
Implement the simple return formula r = (P_end - P_start) / P_start and print the result for a 100 → 110 move.
Hints
- ▸Simple return is percent change from start to end.
- ▸Use (end - start) / start.
qp module
import qp
qp.tickers()
qp.prices('AAPL', days=1825)
qp.backtest(
'AAPL',
signal, # list, len == len(prices)
cost_bps=5,
)First run downloads the Python runtime (~10 MB) — subsequent runs are instant.
Idle
stdout
python 3.12 · pyodide
(no output yet — click Run)