Whole file
SilentFleetKK/ai-market-pulse
The author described this change as “fix: base portfolio allocation_pct on gross exposure, not net”. It counts as a record because the check below fails on the code as it stood at 9add4d681 and passes on d725ba504, with nothing else changed between the two runs.
Fix saved2026-07-09
Sharing licenceMIT · LICENSE
Change size+3 −1
What the code was meant to do, written into the code itself as a save note
fix: base portfolio allocation_pct on gross exposure, not net
The change
| 10 | 10 | totals_by_currency: dict[str, float] = {} | |
| 11 | 11 | for position in positions: | |
| 12 | 12 | if position: | |
| 13 | - | totals_by_currency[position.currency] = totals_by_currency.get(position.currency, 0) + position.market_value | |
| 13 | + | totals_by_currency[position.currency] = totals_by_currency.get(position.currency, 0) + abs( | |
| 14 | + | position.market_value | |
| 15 | + | ) | |
| 14 | 16 | ||
| 15 | 17 | enriched: list[AssetAnalysis] = [] | |
| 16 | 18 | for analysis, position in zip(analyses, positions): |
The check that tells the two apart
fail→pass·tests/test_portfolio.py::test_enrich_portfolio_offsetting_positions_get_gross_exposure_allocation
Check file tests/test_portfolio.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it9add4d681dc794dbafb57ecc4a3148e1d3cb0ef2
Broken version dated2026-07-09
Moduleai_market_pulse.portfolio
Units changedenrich_portfolio
Fingerprinte084c39afce496d5
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.