fix: wrong margin account selection + pending deposit triggers#83
Draft
cursor[bot] wants to merge 3 commits into
Draft
fix: wrong margin account selection + pending deposit triggers#83cursor[bot] wants to merge 3 commits into
cursor[bot] wants to merge 3 commits into
Conversation
Margin metrics used the first syncable account, so a cash/IRA account listed ahead of taxable_margin silently produced no_margin / wrong equity while real margin debt lived on another account. Co-authored-by: Ossie Irondi <AojdevStudio@users.noreply.github.com>
pollDepositTriggers fetches pending transactions, but unsettled deposits can reverse. Skip pending / posted=0 rows so buy-ticket smoke is not fired against unavailable funds. Co-authored-by: Ossie Irondi <AojdevStudio@users.noreply.github.com>
Co-authored-by: Ossie Irondi <AojdevStudio@users.noreply.github.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.
Summary
read_snaptrade_balances()to use the enabledtaxable_marginSnapTrade account instead ofsyncable[0]. A cash/IRA account listed first was silently producingno_margin/ wrong equity while real margin debt lived on another account.posted=0transactions before firing buy-ticket triggers. Unsettled deposits can reverse and must not enqueue ticket generation.Test Plan
uv run pytest tests/python/test_margin_metrics.py -q --cov-fail-under=0)bun test src/trigger.test.tsinapps/simplefin-sync)uv run ruff check+ruff format)Review Checklist