contango.stream.indicators.calculations.rsi
contango.stream.indicators.calculations.rsi
RSI
RSI(pd: 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 |
|---|---|---|---|
pd
|
days
|
Lookback period for the Wilder averages. |
14
|
Source code in src\contango\stream\indicators\calculations\rsi.py
19 20 21 22 23 24 25 26 27 28 29 30 | |
value
property
value: float | None
Returns the latest value for the RSI.
update
update(event: MarketDataEvent) -> float | None
Takes in a new price and returns the current RSI.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
MarketDataEvent
|
The underlying event to update the RSI with. |
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\stream\indicators\calculations\rsi.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |