Spaces:
Sleeping
Sleeping
Jimin Huang commited on
Commit ·
c7c73c3
1
Parent(s): 771b323
Change settings
Browse files- src/App.tsx +1 -1
src/App.tsx
CHANGED
|
@@ -222,7 +222,7 @@ export default function App() {
|
|
| 222 |
const rets = selections.map((s) => s.ret);
|
| 223 |
const N = rets.length;
|
| 224 |
const cum = portfolio.at(-1)?.value ?? 1;
|
| 225 |
-
|
| 226 |
const variance = N ? rets.reduce((a, b) => a + (b - mean) ** 2, 0) / N : 0;
|
| 227 |
const stdev = Math.sqrt(variance);
|
| 228 |
const sharpe = stdev ? (mean * 252) / (stdev * Math.sqrt(252)) : 0;
|
|
|
|
| 222 |
const rets = selections.map((s) => s.ret);
|
| 223 |
const N = rets.length;
|
| 224 |
const cum = portfolio.at(-1)?.value ?? 1;
|
| 225 |
+
const mean = N ? rets.reduce((a, b) => a + b, 0) / N : 0;
|
| 226 |
const variance = N ? rets.reduce((a, b) => a + (b - mean) ** 2, 0) / N : 0;
|
| 227 |
const stdev = Math.sqrt(variance);
|
| 228 |
const sharpe = stdev ? (mean * 252) / (stdev * Math.sqrt(252)) : 0;
|