feat(accounts): выключатель счёта, ручное создание брокерских счетов, брокеры в капитале

Отключённый счёт выпадает из всех скоупов, капитала и подсказок импорта, события остаются в леджере. Брокерский счёт без баланса попадает в net worth по оценке из леджера. POST /accounts заводит счёт под импорт отчёта, AccountOut отдаёт value_rub. Сверка со снапшотом не считает расхождением позиции счетов, у которых снапшота нет (отчёты Сбера и ВТБ).
This commit is contained in:
Dmitry
2026-09-19 21:54:42 +03:00
parent 1b521be35e
commit 4236993106
12 changed files with 559 additions and 13 deletions
@@ -74,6 +74,9 @@ class Account(TimestampMixin, Base):
)
opened_at: Mapped[date | None]
archived: Mapped[bool] = mapped_column(Boolean, default=False)
disabled: Mapped[bool] = mapped_column(Boolean, default=False)
"""The user switched the account off: no sync or source ever writes this. It leaves the
lists, net worth, portfolios and every metric scope; its history stays in the ledger."""
deposit_terms: Mapped[dict[str, Any] | None]
"""ZenMoney deposit/loan terms: percent, startDate, endDateOffset, capitalization…"""
balance: Mapped[Decimal | None]