Rogers-Satchell Volatility
Install and import#
npm install fintech-algorithmsimport { calculate } from "fintech-algorithms/volatility-and-covariance/historical-estimators/rogers-satchell-volatility";Signature#
calculate(data)Track the upper and lower log-distance products. Supplied-parameter educational reference; no fitted performance claim.
Parameters#
| Name | Type | Notes |
|---|---|---|
data | TopicInput | See data-contract/CONTRACT.md. |
Returns#
TopicResult
Structured result with readiness, values, parameters, and diagnostics.
Warm-up#
The first depends on window or model order positions are null prefix until minimum history exists.
Errors#
- When required data is missing, non-finite, malformed, or out of range — raises ContractError / Error
Complexity: time O(nw),
space Full diagnostic trace retained for teaching; see implementation for observation/window/matrix dimensions.
Worked example#
executed Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.
Input#
{
"bars": [
{
"timestamp": "2026-01-01T09:00:00Z",
"open": 99.50124791926824,
"close": 100,
"high": 101.00501670841679,
"low": 98.51119396030626
},
{
"timestamp": "2026-01-02T09:00:00Z",
"open": 100.5012520859401,
"close": 101.00501670841679,
"high": 102.02013400267558,
"low": 99.50124791926824
},
{
"timestamp": "2026-01-03T09:00:00Z",
"open": 98.51119396030626,
"close": 99.0049833749168,
"high": 100,
"low": 97.53099120283326
}
],
"parameters": {
"window": 2,
"annualization_factor": 1
}
}Call#
calculate(data)Returns#
object with 8 fields: topic_id, title, parameters, series, latest, ready, ready_at, diagnostics
{
"topic_id": "D10-F01-A04",
"title": "Rogers-Satchell Volatility",
"parameters": {
"window": 2,
"annualization_factor": 1
},
"series": [
null,
{
"timestamp": "2026-01-02T09:00:00Z",
"variance": 0.00029999999999999916,
"volatility": 0.01732050807568875,
"contributions": [0.00029999999999999954, 0.00029999999999999884],
"components": {},
"window_start": 0,
"window_end": 1
},
{
"timestamp": "2026-01-03T09:00:00Z",
"variance": 0.0003000000000000008,
"volatility": 0.017320508075688797,
"contributions": [0.00029999999999999884, 0.00030000000000000274],
"components": {},
"window_start": 1,
"window_end": 2
}
],
"latest": {
"timestamp": "2026-01-03T09:00:00Z",
"variance": 0.0003000000000000008,
"volatility": 0.017320508075688797,
"contributions": [0.00029999999999999884, 0.00030000000000000274],
"components": {},
"window_start": 1,
"window_end": 2
},
"ready": true,
"ready_at": 1,
"diagnostics": {
"input_count": 3,
"annualization_factor": 1,
"causal": true
}
}Diagrams#
Calculation flow#
Rogers-Satchell Volatility — calculation-flow
flowchart TD
N0["High relative to open and close"]
N1["Low relative to open and close"]
N2["Add the two nonnegative products"]
N3["Average inside the chosen window"]
N0 --> N1 --> N2 --> N3
Rogers-Satchell Volatility — decision-boundary
flowchart TD
A["Supplied observations and parameters"] --> B{"Contract valid?"}
B -->|No| E["Reject with explicit error"]
B -->|Yes| C{"Required history available?"}
C -->|No| W["Withhold; never insert zero"]
C -->|Yes| D["Rogers-Satchell Volatility calculation"]
D --> F["Inspect diagnostics and stated limits"]
How it works#
This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.
References#
- Scope of evidence