contango.trading.analysis.graphing.downsample
contango.trading.analysis.graphing.downsample
downsample_curve
downsample_curve(curve: tuple[tuple[int, float], ...], max_points: int = 1500) -> tuple[tuple[int, float], ...]
Reduces a curve to at most max_points points via
fixed stride sampling, always keeping the final point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
curve
|
tuple[tuple[int, float], ...]
|
The raw (timestamp, value) points, in order. |
required |
max_points
|
int
|
The maximum number of points to keep. |
1500
|
Returns:
| Type | Description |
|---|---|
tuple[tuple[int, float], ...]
|
The downsampled curve. Returned unchanged if already within max_points. |
Source code in src\contango\trading\analysis\graphing\downsample.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |