POST /metrics/refresh ставит задачу в sync_job (source=METRICS_JOB) и отвечает 202, пересчёт делает worker; GET /metrics/status отдаёт refreshing и consistent. metric_refresh_log хранит failed_step и step_timings. Источники с needs="tinvest_token" не попадают в расписание без токена, tinvest/moex добавлены в default_schedule. Воркер трогает heartbeat-файл для healthcheck.
189 lines
3.8 KiB
Python
189 lines
3.8 KiB
Python
"""ORM models. Importing this package registers every table on `Base.metadata`."""
|
|
|
|
from fintracker.models.accounts import (
|
|
Account,
|
|
AccountKind,
|
|
AccountLink,
|
|
AccountRole,
|
|
Broker,
|
|
EventSource,
|
|
Portfolio,
|
|
PortfolioAccount,
|
|
)
|
|
from fintracker.models.auth import AppUser, RefreshToken
|
|
from fintracker.models.instruments import AssetClass, Instrument, InstrumentAlias
|
|
from fintracker.models.ledger import (
|
|
EXTERNAL_FLOW_KINDS,
|
|
POSITION_KINDS,
|
|
Event,
|
|
EventKind,
|
|
EventStatus,
|
|
FlowLink,
|
|
FlowLinkKind,
|
|
Lot,
|
|
LotDisposal,
|
|
)
|
|
from fintracker.models.metrics import (
|
|
AllocationDimension,
|
|
IncomeBasis,
|
|
MetricAllocation,
|
|
MetricBenchmarkReturns,
|
|
MetricCashFlowBroker,
|
|
MetricCashFlowMonthly,
|
|
MetricDataQuality,
|
|
MetricGoalProgress,
|
|
MetricHolding,
|
|
MetricIncomeCalendar,
|
|
MetricIncomeMonthly,
|
|
MetricNetWorthDaily,
|
|
MetricPortfolioValueDaily,
|
|
MetricRebalance,
|
|
MetricRefreshLog,
|
|
MetricReturns,
|
|
MetricRunway,
|
|
MetricSpendingByCategory,
|
|
MetricTaxYear,
|
|
)
|
|
from fintracker.models.planning import (
|
|
Benchmark,
|
|
BenchmarkKind,
|
|
Goal,
|
|
PortfolioTarget,
|
|
)
|
|
from fintracker.models.pricing import (
|
|
BondNominalSchedule,
|
|
CashSnapshot,
|
|
CorporateAction,
|
|
CorporateActionKind,
|
|
CorporateActionStatus,
|
|
FxRateDaily,
|
|
PositionSnapshot,
|
|
PriceCoverage,
|
|
PriceDaily,
|
|
PriceLast,
|
|
PriceManual,
|
|
RawCbrRate,
|
|
)
|
|
from fintracker.models.reports import (
|
|
PendingInstrument,
|
|
PendingInstrumentStatus,
|
|
RawReportFile,
|
|
RawReportLine,
|
|
ReportParseStatus,
|
|
)
|
|
from fintracker.models.sync import (
|
|
METRICS_JOB,
|
|
JobStatus,
|
|
RunStatus,
|
|
SourceCredential,
|
|
SyncJob,
|
|
SyncRun,
|
|
SyncState,
|
|
)
|
|
from fintracker.models.tinvest import (
|
|
RawTinvestEvent,
|
|
RawTinvestInstrument,
|
|
RawTinvestOperation,
|
|
RawTinvestSnapshot,
|
|
)
|
|
from fintracker.models.zenmoney import (
|
|
CashTxn,
|
|
CashTxnTag,
|
|
Category,
|
|
FlowType,
|
|
Merchant,
|
|
RawZenmoneyDeletion,
|
|
RawZenmoneyEntity,
|
|
Rule,
|
|
RuleKind,
|
|
RuleMatchType,
|
|
Trip,
|
|
)
|
|
|
|
__all__ = [
|
|
"EXTERNAL_FLOW_KINDS",
|
|
"METRICS_JOB",
|
|
"POSITION_KINDS",
|
|
"Account",
|
|
"AccountKind",
|
|
"AccountLink",
|
|
"AccountRole",
|
|
"AllocationDimension",
|
|
"AppUser",
|
|
"AssetClass",
|
|
"Benchmark",
|
|
"BenchmarkKind",
|
|
"BondNominalSchedule",
|
|
"Broker",
|
|
"CashSnapshot",
|
|
"CashTxn",
|
|
"CashTxnTag",
|
|
"Category",
|
|
"CorporateAction",
|
|
"CorporateActionKind",
|
|
"CorporateActionStatus",
|
|
"Event",
|
|
"EventKind",
|
|
"EventSource",
|
|
"EventStatus",
|
|
"FlowLink",
|
|
"FlowLinkKind",
|
|
"FlowType",
|
|
"FxRateDaily",
|
|
"Goal",
|
|
"IncomeBasis",
|
|
"Instrument",
|
|
"InstrumentAlias",
|
|
"JobStatus",
|
|
"Lot",
|
|
"LotDisposal",
|
|
"Merchant",
|
|
"MetricAllocation",
|
|
"MetricBenchmarkReturns",
|
|
"MetricCashFlowBroker",
|
|
"MetricCashFlowMonthly",
|
|
"MetricDataQuality",
|
|
"MetricGoalProgress",
|
|
"MetricHolding",
|
|
"MetricIncomeCalendar",
|
|
"MetricIncomeMonthly",
|
|
"MetricNetWorthDaily",
|
|
"MetricPortfolioValueDaily",
|
|
"MetricRebalance",
|
|
"MetricRefreshLog",
|
|
"MetricReturns",
|
|
"MetricRunway",
|
|
"MetricSpendingByCategory",
|
|
"MetricTaxYear",
|
|
"PendingInstrument",
|
|
"PendingInstrumentStatus",
|
|
"Portfolio",
|
|
"PortfolioAccount",
|
|
"PortfolioTarget",
|
|
"PositionSnapshot",
|
|
"PriceCoverage",
|
|
"PriceDaily",
|
|
"PriceLast",
|
|
"PriceManual",
|
|
"RawCbrRate",
|
|
"RawReportFile",
|
|
"RawReportLine",
|
|
"RawTinvestEvent",
|
|
"RawTinvestInstrument",
|
|
"RawTinvestOperation",
|
|
"RawTinvestSnapshot",
|
|
"RawZenmoneyDeletion",
|
|
"RawZenmoneyEntity",
|
|
"RefreshToken",
|
|
"ReportParseStatus",
|
|
"Rule",
|
|
"RuleKind",
|
|
"RuleMatchType",
|
|
"RunStatus",
|
|
"SourceCredential",
|
|
"SyncJob",
|
|
"SyncRun",
|
|
"SyncState",
|
|
"Trip",
|
|
]
|