Reject or warn on a start date older than the reachable rate history #5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
A contract with
backfillon,paydaypricing, and a start date beyond what the rate providers can answer is a guaranteed failure, and nothing catches it until ~25 minutes later.Measured reach (
rates.py, verified against both live APIs):CoinGecko's free tier returns
401 Unauthorizedpast 365 days; Kraken's OHLC series is ~721 daily candles.So a contract starting three years ago fails period 0 on every tick, writes five failed ledger rows, and auto-pauses. That is correct behaviour — it refuses rather than guessing — but the operator only finds out after five ticks, and the fix (switch to
manualorcurrent) was knowable at creation time.Proposal
Validate in
_validate_terms, where the currency is already checked:pricing_mode == payday,backfillis on, andstart_dateis outside the reachable window for that currency → reject with a message naming the window, or warn in the dialog and let the operator proceedrates.pyalready knows the answer —_kraken_seriesreturns the parsed series, whosemin()/max()bound it exactly, and it is cached, so the check is nearly free.Note
The window is a property of the providers, not of payroll, so it moves. Better to probe than to hard-code "2 years".
🤖 Generated with Claude Code
https://claude.ai/code/session_018jy52j9GRZ6XKa1Zt21LLj