mojo
jojo
Editor
Pricing
Docs
Research
Keys
Usage
Credits
Sign in
Sign up — $1 free
Editor
write Python, run it, see exactly what it cost
You are not signed in.
Code still runs — in your own browser, free and private, via WebAssembly. Sign up to use our machines, GPUs and the full package index; new accounts get
1000 credits ($1) of compute free
, no card.
Sign up — $1 free
Sign in
Run
⌘↵
Auto — cheapest that works
Browser — free
Server — billed
GPU
timeout
s
Clear output
# Imports are installed for you — no packages field, no image to build. import numpy as np def rolling_sharpe(returns, window: int) -> float: best = -1e9 for i in range(window, len(returns)): total = 0.0 sq = 0.0 for j in range(i - window, i): total += returns[j] sq += returns[j] * returns[j] mean = total / window var = sq / window - mean * mean if var > 1e-12: s = mean / (var ** 0.5) if s > best: best = s return best rng = np.random.default_rng(7) returns = rng.normal(0.0004, 0.01, 60_000) print("best rolling sharpe:", round(rolling_sharpe(returns, 64), 4))
Output
ready
This session
0 runs · 0 ms · 0 credits
#
Where
Ran
Billed
Cost
Native
nothing yet
Same run, from your own code