feat(income): add account income analytics

This commit is contained in:
2026-08-28 01:25:52 +03:00
parent 71a214d7ad
commit 9364568202
18 changed files with 1746 additions and 7 deletions
+445 -2
View File
@@ -990,6 +990,194 @@
"brokerage-accounts"
]
}
},
"/api/v1/brokerage-accounts/{accountId}/income-summary": {
"get": {
"operationId": "IncomeAnalyticsController_summary",
"parameters": [
{
"name": "accountId",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/IncomeSummaryDto"
}
}
}
},
"400": {
"description": "Invalid request",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetailsDto"
}
}
}
},
"401": {
"description": "Authentication required",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetailsDto"
}
}
}
},
"404": {
"description": "Resource not found",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetailsDto"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetailsDto"
}
}
}
},
"503": {
"description": "Upstream service unavailable",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetailsDto"
}
}
}
}
},
"security": [
{
"bearer": []
}
],
"tags": [
"brokerage-accounts"
]
}
},
"/api/v1/brokerage-accounts/{accountId}/income-analytics": {
"get": {
"operationId": "IncomeAnalyticsController_analytics",
"parameters": [
{
"name": "accountId",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
},
{
"name": "from",
"required": false,
"in": "query",
"schema": {
"format": "date",
"type": "string"
}
},
{
"name": "to",
"required": false,
"in": "query",
"schema": {
"format": "date",
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/IncomeAnalyticsDto"
}
}
}
},
"400": {
"description": "Invalid request",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetailsDto"
}
}
}
},
"401": {
"description": "Authentication required",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetailsDto"
}
}
}
},
"404": {
"description": "Resource not found",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetailsDto"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetailsDto"
}
}
}
},
"503": {
"description": "Upstream service unavailable",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetailsDto"
}
}
}
}
},
"security": [
{
"bearer": []
}
],
"tags": [
"brokerage-accounts"
]
}
}
},
"info": {
@@ -1507,14 +1695,269 @@
"items": {
"$ref": "#/components/schemas/UpcomingEventDto"
}
},
"incomeTotalsByCurrency": {
"type": "array",
"items": {
"$ref": "#/components/schemas/MoneyDto"
}
}
},
"required": [
"accountId",
"calculatedAt",
"events"
"events",
"incomeTotalsByCurrency"
]
},
"IncomePeriodDto": {
"type": "object",
"properties": {
"from": {
"type": "string",
"format": "date"
},
"to": {
"type": "string",
"format": "date"
}
},
"required": [
"from",
"to"
]
},
"IncomeCurrencySummaryDto": {
"type": "object",
"properties": {
"currency": {
"type": "string"
},
"coupon": {
"$ref": "#/components/schemas/MoneyDto"
},
"dividend": {
"$ref": "#/components/schemas/MoneyDto"
},
"total": {
"$ref": "#/components/schemas/MoneyDto"
}
},
"required": [
"currency",
"coupon",
"dividend",
"total"
]
},
"IncomeSummaryDto": {
"type": "object",
"properties": {
"accountId": {
"type": "string"
},
"period": {
"$ref": "#/components/schemas/IncomePeriodDto"
},
"totalsByCurrency": {
"type": "array",
"items": {
"$ref": "#/components/schemas/IncomeCurrencySummaryDto"
}
},
"calculatedAt": {
"type": "string",
"format": "date-time"
}
},
"required": [
"accountId",
"period",
"totalsByCurrency",
"calculatedAt"
]
},
"IncomeComparisonCurrencyDto": {
"type": "object",
"properties": {
"currency": {
"type": "string"
},
"selected": {
"$ref": "#/components/schemas/IncomeCurrencySummaryDto"
},
"compared": {
"$ref": "#/components/schemas/IncomeCurrencySummaryDto"
},
"difference": {
"$ref": "#/components/schemas/IncomeCurrencySummaryDto"
}
},
"required": [
"currency",
"selected",
"compared",
"difference"
]
},
"IncomeComparisonDto": {
"type": "object",
"properties": {
"period": {
"$ref": "#/components/schemas/IncomePeriodDto"
},
"totalsByCurrency": {
"type": "array",
"items": {
"$ref": "#/components/schemas/IncomeComparisonCurrencyDto"
}
}
},
"required": [
"period",
"totalsByCurrency"
]
},
"IncomeBucketDto": {
"type": "object",
"properties": {
"period": {
"$ref": "#/components/schemas/IncomePeriodDto"
},
"totalsByCurrency": {
"type": "array",
"items": {
"$ref": "#/components/schemas/IncomeCurrencySummaryDto"
}
}
},
"required": [
"period",
"totalsByCurrency"
]
},
"IncomeInstrumentDto": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"figi": {
"type": "string",
"nullable": true
},
"instrumentUid": {
"type": "string",
"nullable": true
},
"ticker": {
"type": "string",
"nullable": true
},
"instrumentType": {
"type": "string",
"nullable": true
},
"displayName": {
"type": "string"
},
"coupon": {
"$ref": "#/components/schemas/MoneyDto"
},
"dividend": {
"$ref": "#/components/schemas/MoneyDto"
},
"total": {
"$ref": "#/components/schemas/MoneyDto"
},
"receiptCount": {
"type": "number"
}
},
"required": [
"key",
"figi",
"instrumentUid",
"ticker",
"instrumentType",
"displayName",
"coupon",
"dividend",
"total",
"receiptCount"
]
},
"IncomeAnalyticsDto": {
"type": "object",
"properties": {
"accountId": {
"type": "string"
},
"period": {
"$ref": "#/components/schemas/IncomePeriodDto"
},
"totalsByCurrency": {
"type": "array",
"items": {
"$ref": "#/components/schemas/IncomeCurrencySummaryDto"
}
},
"calculatedAt": {
"type": "string",
"format": "date-time"
},
"previous": {
"$ref": "#/components/schemas/IncomeComparisonDto"
},
"yearComparison": {
"nullable": true,
"type": "object",
"allOf": [
{
"$ref": "#/components/schemas/IncomeComparisonDto"
}
]
},
"bucketGranularity": {
"type": "string",
"enum": [
"day",
"week",
"month"
]
},
"buckets": {
"type": "array",
"items": {
"$ref": "#/components/schemas/IncomeBucketDto"
}
},
"instruments": {
"type": "array",
"items": {
"$ref": "#/components/schemas/IncomeInstrumentDto"
}
},
"entries": {
"type": "array",
"items": {
"$ref": "#/components/schemas/BrokerageOperationDto"
}
}
},
"required": [
"accountId",
"period",
"totalsByCurrency",
"calculatedAt",
"previous",
"yearComparison",
"bucketGranularity",
"buckets",
"instruments",
"entries"
]
}
}
}
}
}