fix(fx): skip all CASH trades in auto-convert accounts#170
Conversation
In auto-convert accounts (AFx/FXCONV markers present), manual CASH trades on IDEALFX are cleanup conversions of leftover USD from dividends/commissions. The underlying FCY was created by the auto-convert mechanism, never tracked as a lot. Processing these manual sells creates orphan disposals with UNKNOWN lot IDs and gain=0, confusing users (e.g. showing "1146.90 EUR" transmission value with zero net gain). Fix: when detectAutoConvert() returns true, skip ALL CASH-category trades in extractFxEvents(), not just those with AFx/FXCONV markers. This eliminates UNKNOWN lots entirely for auto-convert accounts. Verified with real user data (hybrid account with both AFx and manual CASH trades): FX disposals drop to 0, matching competitor output.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughWhen ChangesAuto-convert CASH-trade suppression
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #170 +/- ##
=======================================
Coverage 97.61% 97.61%
=======================================
Files 38 38
Lines 7786 7787 +1
Branches 1594 1595 +1
=======================================
+ Hits 7600 7601 +1
Misses 185 185
Partials 1 1
🚀 New features to boost your workflow:
|
Summary
UNKNOWNlot IDs and gain=0, confusing users (showed "1146.90 EUR" FX transmission value with zero net gain)detectAutoConvert()returns true, eliminating UNKNOWN lots entirelyContext
User
elmasvitalreported that monodivisa toggle had no effect and UNKNOWN lot IDs appeared. Their account is a hybrid: auto-convert for stock purchases (AFx markers) but they also manually sold USD back on IDEALFX. The manual sells found no lots (the corresponding buys were all AFx, which we correctly skip), producing confusing zero-gain entries.Test plan
Summary by CodeRabbit
Bug Fixes