From b037fd9cab13e14e8bb744241a9a39e7cde81103 Mon Sep 17 00:00:00 2001 From: Sergey Krylov Date: Mon, 26 Oct 2026 22:19:55 +0300 Subject: [PATCH] chore: sync brokerage accounts contract (WealthLedger/backend#138) --- src/shared/api/generated/schema.d.ts | 67 ++++--- src/shared/api/spec/openapi.json | 259 +++++++++++++++++---------- 2 files changed, 202 insertions(+), 124 deletions(-) diff --git a/src/shared/api/generated/schema.d.ts b/src/shared/api/generated/schema.d.ts index ba8d0ce..b73622d 100644 --- a/src/shared/api/generated/schema.d.ts +++ b/src/shared/api/generated/schema.d.ts @@ -909,12 +909,54 @@ export interface components { version: number; archived?: boolean; }; + PortfolioStructureCategoryDto: { + /** @enum {string} */ + type: "STOCK" | "BOND" | "OTHER" | "CASH"; + /** @description Exact known value as a decimal string. */ + value: string; + /** @description Percentage including cash, rounded to six decimal places. Null for incomplete, negative or zero-total compositions. */ + sharePercent: string | null; + }; + PortfolioStructureCurrencyDto: { + currency: string; + totalValue: string; + /** @description Any negative constituent, even if netted positive. */ + hasNegativeValues: boolean; + categories: components["schemas"]["PortfolioStructureCategoryDto"][]; + }; + PortfolioUnvaluedCategoryDto: { + /** @enum {string} */ + type: "STOCK" | "BOND" | "OTHER"; + count: number; + }; + PortfolioStructureDto: { + currencies: components["schemas"]["PortfolioStructureCurrencyDto"][]; + /** @description Positions without current value and known valuation currency. Shares are unavailable across all currencies when nonempty. */ + unvaluedCategories: components["schemas"]["PortfolioUnvaluedCategoryDto"][]; + }; + UnrealizedReturnDto: { + currency: string; + /** @example 12.345678901 */ + absolute: string; + /** @example 100.00 */ + costBasis: string; + /** @example 12.34 */ + percent: string | null; + partial: boolean; + }; PortfolioSummaryDto: { totalsByCurrency: components["schemas"]["MoneyDto"][]; + cashBalances: components["schemas"]["MoneyDto"][]; + structure: components["schemas"]["PortfolioStructureDto"]; + unrealizedReturnByCurrency: components["schemas"]["UnrealizedReturnDto"][]; /** @description Number of non-zero stock positions, not the number of units. */ stockPositionCount: number; /** @description Number of non-zero bond positions, not the number of units. */ bondPositionCount: number; + /** @description Number of non-zero fund positions, not the number of units. */ + fundPositionCount: number; + /** @description Number of all non-zero positions, not the number of units. */ + totalPositionCount: number; }; BrokerageAccountDto: { id: string; @@ -1026,31 +1068,6 @@ export interface components { ticker: string | null; logoName: string | null; }; - PortfolioStructureCategoryDto: { - /** @enum {string} */ - type: "STOCK" | "BOND" | "OTHER" | "CASH"; - /** @description Exact known value as a decimal string. */ - value: string; - /** @description Percentage including cash, rounded to six decimal places. Null for incomplete, negative or zero-total compositions. */ - sharePercent: string | null; - }; - PortfolioStructureCurrencyDto: { - currency: string; - totalValue: string; - /** @description Any negative constituent, even if netted positive. */ - hasNegativeValues: boolean; - categories: components["schemas"]["PortfolioStructureCategoryDto"][]; - }; - PortfolioUnvaluedCategoryDto: { - /** @enum {string} */ - type: "STOCK" | "BOND" | "OTHER"; - count: number; - }; - PortfolioStructureDto: { - currencies: components["schemas"]["PortfolioStructureCurrencyDto"][]; - /** @description Positions without current value and known valuation currency. Shares are unavailable across all currencies when nonempty. */ - unvaluedCategories: components["schemas"]["PortfolioUnvaluedCategoryDto"][]; - }; PortfolioDto: { /** Format: date-time */ lastSuccessfulAt: string; diff --git a/src/shared/api/spec/openapi.json b/src/shared/api/spec/openapi.json index 8ed9d81..eba7e13 100644 --- a/src/shared/api/spec/openapi.json +++ b/src/shared/api/spec/openapi.json @@ -5819,6 +5819,135 @@ "version" ] }, + "PortfolioStructureCategoryDto": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "STOCK", + "BOND", + "OTHER", + "CASH" + ] + }, + "value": { + "type": "string", + "description": "Exact known value as a decimal string." + }, + "sharePercent": { + "type": "string", + "nullable": true, + "description": "Percentage including cash, rounded to six decimal places. Null for incomplete, negative or zero-total compositions." + } + }, + "required": [ + "type", + "value", + "sharePercent" + ] + }, + "PortfolioStructureCurrencyDto": { + "type": "object", + "properties": { + "currency": { + "type": "string" + }, + "totalValue": { + "type": "string" + }, + "hasNegativeValues": { + "type": "boolean", + "description": "Any negative constituent, even if netted positive." + }, + "categories": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PortfolioStructureCategoryDto" + } + } + }, + "required": [ + "currency", + "totalValue", + "hasNegativeValues", + "categories" + ] + }, + "PortfolioUnvaluedCategoryDto": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "STOCK", + "BOND", + "OTHER" + ] + }, + "count": { + "type": "number", + "minimum": 1 + } + }, + "required": [ + "type", + "count" + ] + }, + "PortfolioStructureDto": { + "type": "object", + "properties": { + "currencies": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PortfolioStructureCurrencyDto" + } + }, + "unvaluedCategories": { + "description": "Positions without current value and known valuation currency. Shares are unavailable across all currencies when nonempty.", + "type": "array", + "items": { + "$ref": "#/components/schemas/PortfolioUnvaluedCategoryDto" + } + } + }, + "required": [ + "currencies", + "unvaluedCategories" + ] + }, + "UnrealizedReturnDto": { + "type": "object", + "properties": { + "currency": { + "type": "string" + }, + "absolute": { + "type": "string", + "example": "12.345678901" + }, + "costBasis": { + "type": "string", + "example": "100.00" + }, + "percent": { + "type": "string", + "nullable": true, + "example": "12.34" + }, + "partial": { + "type": "boolean" + } + }, + "required": [ + "currency", + "absolute", + "costBasis", + "percent", + "partial" + ] + }, "PortfolioSummaryDto": { "type": "object", "properties": { @@ -5828,6 +5957,21 @@ "$ref": "#/components/schemas/MoneyDto" } }, + "cashBalances": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MoneyDto" + } + }, + "structure": { + "$ref": "#/components/schemas/PortfolioStructureDto" + }, + "unrealizedReturnByCurrency": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UnrealizedReturnDto" + } + }, "stockPositionCount": { "type": "integer", "minimum": 0, @@ -5837,12 +5981,27 @@ "type": "integer", "minimum": 0, "description": "Number of non-zero bond positions, not the number of units." + }, + "fundPositionCount": { + "type": "integer", + "minimum": 0, + "description": "Number of non-zero fund positions, not the number of units." + }, + "totalPositionCount": { + "type": "integer", + "minimum": 0, + "description": "Number of all non-zero positions, not the number of units." } }, "required": [ "totalsByCurrency", + "cashBalances", + "structure", + "unrealizedReturnByCurrency", "stockPositionCount", - "bondPositionCount" + "bondPositionCount", + "fundPositionCount", + "totalPositionCount" ] }, "BrokerageAccountDto": { @@ -6314,104 +6473,6 @@ "logoName" ] }, - "PortfolioStructureCategoryDto": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "STOCK", - "BOND", - "OTHER", - "CASH" - ] - }, - "value": { - "type": "string", - "description": "Exact known value as a decimal string." - }, - "sharePercent": { - "type": "string", - "nullable": true, - "description": "Percentage including cash, rounded to six decimal places. Null for incomplete, negative or zero-total compositions." - } - }, - "required": [ - "type", - "value", - "sharePercent" - ] - }, - "PortfolioStructureCurrencyDto": { - "type": "object", - "properties": { - "currency": { - "type": "string" - }, - "totalValue": { - "type": "string" - }, - "hasNegativeValues": { - "type": "boolean", - "description": "Any negative constituent, even if netted positive." - }, - "categories": { - "type": "array", - "items": { - "$ref": "#/components/schemas/PortfolioStructureCategoryDto" - } - } - }, - "required": [ - "currency", - "totalValue", - "hasNegativeValues", - "categories" - ] - }, - "PortfolioUnvaluedCategoryDto": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "STOCK", - "BOND", - "OTHER" - ] - }, - "count": { - "type": "number", - "minimum": 1 - } - }, - "required": [ - "type", - "count" - ] - }, - "PortfolioStructureDto": { - "type": "object", - "properties": { - "currencies": { - "type": "array", - "items": { - "$ref": "#/components/schemas/PortfolioStructureCurrencyDto" - } - }, - "unvaluedCategories": { - "description": "Positions without current value and known valuation currency. Shares are unavailable across all currencies when nonempty.", - "type": "array", - "items": { - "$ref": "#/components/schemas/PortfolioUnvaluedCategoryDto" - } - } - }, - "required": [ - "currencies", - "unvaluedCategories" - ] - }, "PortfolioDto": { "type": "object", "properties": {