Skip to content

PortfolioDB 1.7.3

Choose a tag to compare

@amosgeva amosgeva released this 10 Sep 08:28
· 10 commits to main since this release
bae6289

The third pass over the audit: the three findings the re-audit of 1.7.2 left
open. Two are the remaining branches of cases 1.7.2 fixed at the reported
sites only — the weekly and executive reports still mixed split units in
other calculations, and the weekly report still crashed on an unnamed account
one section after the fixed helper — and one is a scope bug in the
--replace-estimates flag 1.7.2 added. The tests for the reports now run the
whole command rather than its helpers. No schema change and no migration.

Upgrading

  • If you ran add_income.py --backfill --replace-estimates --since … on
    1.7.2, the estimates dated before the cutoff were deleted and not rebuilt.
    Rerun the same command without --since once on 1.7.3 to restore them;
    manual rows are never touched.
  • Nothing else. The 1.7.2 Upgrading steps still apply if you have not
    done them.

Fixed

  • add_income.py --backfill --replace-estimates --since … no longer
    deletes estimates before the cutoff.
    The deletion covered every
    backfilled row for the symbol while the rebuild honoured --since, so a
    bounded correction removed the older estimates and did not put them back.
    The two halves now share one scope: with --since, only estimates dated on
    or after it are deleted; nothing is deleted when the vendor series has
    nothing to rebuild in that range; and the command was already one
    transaction, so a failed insert restores the deleted rows. Manual rows are
    never touched (1.7.2 re-audit, N04).

  • The weekly report completes with unnamed accounts present. 1.7.2 fixed
    the account sort inside the positions helper, but the account-totals loop
    in the report itself sorted the same union of accounts (plus the cash
    accounts) with the default ordering, so an unnamed lot beside a named
    account still stopped the report two sections later with a TypeError.
    Every account boundary now uses one sort key (unnamed first, None and
    "" kept distinct) and unnamed accounts print as (no account) instead
    of None. The test runs the whole command, not the helper
    (1.7.2 re-audit, N01 remaining case).

  • The weekly and executive reports state splits in one unit basis. The
    weekly report valued its start and end positions in each date's units but
    multiplied them by raw snapshot quotes, and fed raw trade rows into its
    contribution arithmetic, so a pure 2:1 split inside the week printed the
    holding as a 50% loser with a qty Δ +10. The executive report restated
    its lots and its EOD series but joined the raw latest quotes, so a symbol
    whose newest snapshot predated a recorded split was worth twice its value
    with the whole excess as unrealized profit. Both reports now prepare one
    ledger and pass every quote and every week trade through it; the weekly
    report lists the week's corporate actions in their own block, and the
    trades block still shows what was entered. A pure split contributes $0
    and changes neither value nor P&L (1.7.2 re-audit, F03 remaining cases).