feat(dca): keel dca plan -- propose a DCA schedule within the venue plan's cap - #846
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…xemption Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l reads it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… existing DCA rule Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…kers and warnings R7 as amended after #843: live DCA commitment is each rule's own budget_usd; R9's executor-sizing warning is withdrawn and its absence pinned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ever fee-free Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…add, all or nothing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…te-only on approval Off a terminal the database is opened read-only, so the preview cannot write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Sep 28, 2026
eaitbrahim
commented
Sep 28, 2026
…-colliding weights (#847, #848) - R6 amended: the blocker compares the worst UTC calendar month for the cadence (max cadence days in any month x the per-cycle total) against rail 14's cap; per-buy sizing is unchanged. The output says the worst month is what was checked. - target_weights (and [E] edits) whose keys collide once uppercased are refused, naming both keys, instead of silently dropping one. - A live DCA row with no stored budget_usd is counted at Dca's own default (read from its signature) and named in a warning, not as $0. - An absurd --budget is a usage error, not a decimal traceback. - A DcaPlanError from the plan build reaches the CLI as a clean error; [E] re-prompting on a bad weight is covered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eaitbrahim
commented
Sep 28, 2026
…weights (#849) - allowlist entries are de-duplicated case-insensitively, first-seen order, so [BTC, ETH, btc] gives one BTC allocation, buy and rule rather than a double share and two candidates. - A NaN/inf target_weights value is a DcaPlanError naming the key, not an InvalidOperation traceback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Sep 28, 2026
eaitbrahim
added a commit
that referenced
this pull request
Sep 28, 2026
…n and its read-only card (#877) MINOR: a rail changes scope for DCA (#869) and new commands and routes land (#846, #850). No schema change since 0.19.0. What lands: #846 (#831 follow-up) -- keel dca plan: schedule by target weights within rail 14's worst calendar month; [Y] writes candidate rules only. #850 -- GET /api/dca-plan and a read-only card on /rules. #869 (#853) -- rail 6 (per-asset) no longer vetoes DCA buys; the plan blocks on rail 3 and warns on rail 5. #867 (#854), #876 (#874) -- a blocked plan names the largest passing budget and smallest passing buffer, clearing rails 14, 3 and 2. #870 (#856) -- admission screen cached 5 minutes. #858 (#855) -- deploy/live-rules.json synced. #859 (#857) -- design spec for the DCA sleeve's sell side. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 1 of
docs/superpowers/plans/2026-09-27-dca-plan.md(Tasks 1–6): the plan service and thekeel dca planCLI. The read-only web card (Tasks 7–8) comes in PR 2.Behaviour
keel dca plan --budget <monthly USD> --buffer-pct <fraction> [--cadence-days 7]proposes a weekly DCA schedule.screen_product∩ positivetarget_weights, minus assets that already have a non-disableddcarule. Weights are renormalised over that set.not_on_allowlist,not_admitted,no_weight, orhas_dca_rule. An asset with a DCA rule is shown as "existing, unchanged".guards.checkreads it. A parity test drivesguards.checkat the cap and one cent over it.fees.taker_pctand labelled as such. The venue minimum order size is unknown to keel, and the output says so.[Y] Approve / [E] Edit weights / [N] Cancel.[Y]writes onecandidatedcarule per asset throughrules.add_rule_row, all or nothing (R2).paperorlive, and never touches an existing rule.[Y].keel/commands/dca_plan.pyis a pure service with no click, ready for PR 2's GET-only reader.keel/commands/dca.pyis the thin click front-end.Rulings in force
R1–R19 as in the plan, with these changes:
liveDCA rule's monthly commitment uses that rule's ownbudget_usd, because the executor sizes each DCA buy from the rule'ssize_usd. The commitment is added to spend, and the plan warns, without blocking, when the sum exceeds the cap. A live rule withdip_bonus_pct > 0gets its own warning, since its buys can exceed the listed amount.config.dca.budget_usd" warning, and noexecutor_budget_usdfield. A test pins the warning's absence.max_exposure_usdas a DCA limit, and a test pins that._open_repo_ro(mode=ro), so the preview cannot create a missing DB file or migrate an old schema.sqlite3.Error(new). A locked database mid-write is caught and refused, and the refusal names the rule ids already written. This is R2's stated cost-if-wrong, now made explicit.Test evidence
tests/commands/test_dca_plan.pyandtests/commands/test_dca_cli.py.tests/test_rail14_is_a_buy_cap.pygets one test, andSERVICE_MODULESgets two modules.select_universe;apply_dca_plan;screen_fnis called 3 times, the patchedbuild_rule_from_paramsis called for PAXG, the patchedadd_rule_rowis called twice, and_open_repo_rois called once off a TTY.uv run pytest -q: 6962 passed, 3 skipped, exit 0.uv run ruff check keel testsexited 0,uv run ruff format --check keel testsexited 0, and bareuv run mypyexited 0.guards.pyandexecutor.pyare untouched.🤖 Generated with Claude Code