(interval: str)
| 155 | |
| 156 | |
| 157 | def _interval_to_seconds(interval: str) -> int: |
| 158 | s = interval.strip().lower() |
| 159 | if s.endswith("d"): |
| 160 | return int(s[:-1]) * 24 * 3600 |
| 161 | if s.endswith("h"): |
| 162 | return int(s[:-1]) * 3600 |
| 163 | if s.endswith("m"): |
| 164 | return int(s[:-1]) * 60 |
| 165 | if s.endswith("s"): |
| 166 | return int(s[:-1]) |
| 167 | raise ValueError(f"unsupported interval format: {interval}") |
| 168 | |
| 169 | |
| 170 | def clean_ohlcv( |