Skip to content

dca plan: a duplicated allowlist entry doubles that asset's weight and writes two DCA rules for it #849

Description

@eaitbrahim

Found reviewing PR #846 (head 2d92fb5).

load_config accepts a repeated allowlist entry (allowlist: [BTC, ETH, BTC, PAXG] loads as ['BTC', 'ETH', 'BTC', 'PAXG']). select_universe (keel/commands/dca_plan.py:283) iterates that list as-is, so the asset is allocated twice: its weight counts twice in the renormalisation, [E] prompts for it twice, and [Y] writes two candidate DCA rules for the same product. apply_dca_plan's stale check only compares against rules already in the table, not within the plan.

Reproduced: replace(config, allowlist=['BTC','BTC','ETH']) -> buys [('BTC', 37.63), ('BTC', 37.63), ('ETH', 28.22)], no blocker; apply_dca_plan writes rules (1, BTC-USD), (2, BTC-USD), (3, ETH-USD).

Fix: dedupe the allowlist in select_universe (order-preserving) or refuse it with a DcaPlanError naming the duplicate; add a test with a repeated entry asserting one allocation and one written rule per asset.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions