{"record":{"id":"bfca7201fe39c44f","repo":"freqtrade/freqtrade","slug":"start-date-is-after-stop-date-for-timerange-text","errorCode":null,"errorMessage":"Start date is after stop date for timerange \"{text}\"","messagePattern":"Start date is after stop date for timerange \"(.+?)\"","errorType":"validation","errorClass":"ConfigurationError","httpStatus":null,"severity":"error","filePath":"freqtrade/configuration/timerange.py","lineNumber":183,"sourceCode":"                            datetime.strptime(starts, \"%Y%m%d\").replace(tzinfo=UTC).timestamp()\n                        )\n                    elif len(starts) == 13:\n                        start = int(starts) // 1000\n                    else:\n                        start = int(starts)\n                    index += 1\n                if stype[1]:\n                    stops = rvals[index]\n                    if stype[1] == \"date\" and len(stops) == 8:\n                        stop = int(\n                            datetime.strptime(stops, \"%Y%m%d\").replace(tzinfo=UTC).timestamp()\n                        )\n                    elif len(stops) == 13:\n                        stop = int(stops) // 1000\n                    else:\n                        stop = int(stops)\n                if start > stop > 0:\n                    raise ConfigurationError(\n                        f'Start date is after stop date for timerange \"{text}\"'\n                    )\n                return cls(stype[0], stype[1], start, stop)\n        raise ConfigurationError(f'Incorrect syntax for timerange \"{text}\"')\n","sourceCodeStart":165,"sourceCodeEnd":188,"githubUrl":"https://github.com/freqtrade/freqtrade/blob/1c8edfe4d1e8d11bd4b40e8fc3237c26c3a60e15/freqtrade/configuration/timerange.py#L165-L188","documentation":"ConfigurationError from TimeRange parsing when the parsed start timestamp is greater than the stop timestamp (and stop > 0). The timerange string is valid syntactically but chronologically reversed, which would produce an empty data window.","triggerScenarios":"Passing `--timerange 20240101-20230101` (start 2024-01-01, stop 2023-01-01): after parsing both dates, `start > stop > 0` holds and the error is raised.","commonSituations":"Swapping the two dates when hand-writing a timerange; YYYYMMDD vs YYYYMMDDHHMMSS confusion leading to wrong ordering; timezone mix-ups when computing ranges in scripts.","solutions":["Swap the dates so the earlier date comes first: `--timerange 20230101-20240101`","Double-check the format: both sides must be YYYYMMDD or YYYYMMDDHHMMSS","Omit the start (`-20240101`) or stop (`20230101-`) for open-ended ranges"],"exampleFix":"# before\nfreqtrade backtesting --timerange 20240101-20230101\n\n# after\nfreqtrade backtesting --timerange 20230101-20240101","handlingStrategy":"validation","validationCode":"from datetime import datetime, timezone\ndef timerange_ok(text: str) -> bool:\n    try:\n        parts = text.split('-')\n        starts = [datetime.strptime(p, '%Y%m%d').replace(tzinfo=timezone.utc).timestamp() for p in parts if len(p) == 8]\n        return len(starts) < 2 or starts[0] <= starts[1]\n    except ValueError:\n        return False","typeGuard":null,"tryCatchPattern":"from freqtrade.exceptions import ConfigurationError\nfrom freqtrade.configuration import TimeRange\ntry:\n    tr = TimeRange.parse(args_timerange)\nexcept ConfigurationError as e:\n    sys.exit(str(e))","preventionTips":["Compute timeranges programmatically from sorted dates","Remember format is YYYYMMDD with '-' as the only separator"],"tags":["timerange","validation","cli"],"backgroundTag":null,"analyzedSha":"1c8edfe4d1e8d11bd4b40e8fc3237c26c3a60e15","analyzedAt":"2026-08-15T05:09:08.096Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}