trading.indicators.calculations.rsi
trading.indicators.calculations.rsi
RSI
RSI(period: days = 14)
Bases: Indicator[float | None]
Relative Strength Index (RSI).
Uses Wilder's Moving Average to smooth average gains and losses over the given period. Returns None until both averages are seeded.
Initializes RSI.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
period
|
days
|
Lookback period for the Wilder averages. |
14
|
Source code in src\contango\trading\indicators\calculations\rsi.py
34 35 36 37 38 39 40 41 42 43 44 | |
update
update(price: USD) -> float | None
Takes in a new price and returns the current RSI.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
price
|
USD
|
The price for the current bar. |
required |
Returns:
| Type | Description |
|---|---|
float | None
|
RSI in the range [0, 100], or None if the period has not been reached. |
Source code in src\contango\trading\indicators\calculations\rsi.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |