← Back to examples
📈 Stock Returns Analysis
Scenario: A junior quant wants to inspect a price history: compute daily returns, a 5-day rolling mean and volatility, and detect a simple moving-average crossover signal.
Skills: pctChangeSeries, Series.rolling().mean/std, derived columns, basic signal generation.
1 · Daily prices and returns
Compute daily percentage returns from raw closing prices.
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent
2 · Rolling stats & SMA crossover signal
A common workflow: fast SMA (3-day) crossing a slow SMA (5-day) is a buy signal; the reverse is a sell signal.
Click ▶ Run to execute
Ctrl+Enter to run · Tab to indent