Skip to content

keel positions: attributed DCA tranches show a stop distance measured against the stop=0 sentinel #973

Closed

Description

@eaitbrahim

Found while reviewing PR #972 (round 1, held H3). Pre-existing.

agent._open_tranche copies Dca.detect's stop=0 sentinel onto every attributed live DCA tranche (live ledger: tranches 4-6 store initial_stop "0"). keel/commands/positions.py (module docstring ~line 25, field docstring ~line 120) says initial_stop is None for a DCA leg, and computes stop_distance = mark - initial_stop (~line 402). For these tranches that makes the distance equal to the mark, which is the "distance measured against a substituted zero" the module docstring warns against. doctor.py ~1813 repeats the "DCA initial_stop absent" claim, although its > 0 guard makes it harmless.

Fix: read the stop through status.recorded_stop (added in #972: zero or below counts as no stop) in positions.py, and correct the docstrings in positions.py and doctor.py.

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