From a99bc6bb55ea5424c84ab55304a586631b4be6c8 Mon Sep 17 00:00:00 2001 From: PJ Date: Wed, 18 Nov 2026 20:45:12 +0100 Subject: [PATCH] feat(targets): add typed target model and allocation calculator --- .../interfaces/portfolio-targets.interface.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 libs/common/src/lib/interfaces/portfolio-targets.interface.ts diff --git a/libs/common/src/lib/interfaces/portfolio-targets.interface.ts b/libs/common/src/lib/interfaces/portfolio-targets.interface.ts new file mode 100644 index 0000000000..8c06f90737 --- /dev/null +++ b/libs/common/src/lib/interfaces/portfolio-targets.interface.ts @@ -0,0 +1,21 @@ +import { AssetClass } from '@ghostfolio/prisma/enums'; + +/** + * The first release uses a single global profile. The collection supports + * future account-specific profiles without changing the persisted shape. + */ +export interface PortfolioTargetProfile { + id: string; + name: string; + presetId?: string; + /** Fractions in [0, 1]; the complete allocation must sum to 1. */ + allocations: Record; + /** Maximum absolute drift per asset class, as a fraction (0.05 = 5%). */ + tolerance: number; +} + +export interface PortfolioTargetsSettings { + version: 1; + activeProfileId: string; + profiles: PortfolioTargetProfile[]; +}