Skip to content

Commit

Permalink
Update train_and_evaluate.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
rhamnett authored May 27, 2024
1 parent 222d56e commit f6c93dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/train_and_evaluate.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@
"\n",
"def rsi(price: 'pd.Series[pd.Float64Dtype]', period: float) -> 'pd.Series[pd.Float64Dtype]':\n",
" r = price.diff()\n",
" upside = np.minimum(r, 0).abs()\n",
" downside = np.maximum(r, 0).abs()\n",
" upside = r.clip(lower=0)\n",
" downside = -r.clip(upper=0)\n",
" rs = upside.ewm(alpha=1 / period).mean() / downside.ewm(alpha=1 / period).mean()\n",
" return 100*(1 - (1 + rs) ** -1)\n",
"\n",
Expand Down

0 comments on commit f6c93dc

Please sign in to comment.