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
+227
View File
@@ -164,6 +164,38 @@ export interface paths {
patch?: never;
trace?: never;
};
"/api/v1/brokerage-accounts/{accountId}/income-summary": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get: operations["IncomeAnalyticsController_summary"];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/brokerage-accounts/{accountId}/income-analytics": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get: operations["IncomeAnalyticsController_analytics"];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
}
export type webhooks = Record<string, never>;
export interface components {
@@ -287,6 +319,66 @@ export interface components {
/** Format: date-time */
calculatedAt: string;
events: components["schemas"]["UpcomingEventDto"][];
incomeTotalsByCurrency: components["schemas"]["MoneyDto"][];
};
IncomePeriodDto: {
/** Format: date */
from: string;
/** Format: date */
to: string;
};
IncomeCurrencySummaryDto: {
currency: string;
coupon: components["schemas"]["MoneyDto"];
dividend: components["schemas"]["MoneyDto"];
total: components["schemas"]["MoneyDto"];
};
IncomeSummaryDto: {
accountId: string;
period: components["schemas"]["IncomePeriodDto"];
totalsByCurrency: components["schemas"]["IncomeCurrencySummaryDto"][];
/** Format: date-time */
calculatedAt: string;
};
IncomeComparisonCurrencyDto: {
currency: string;
selected: components["schemas"]["IncomeCurrencySummaryDto"];
compared: components["schemas"]["IncomeCurrencySummaryDto"];
difference: components["schemas"]["IncomeCurrencySummaryDto"];
};
IncomeComparisonDto: {
period: components["schemas"]["IncomePeriodDto"];
totalsByCurrency: components["schemas"]["IncomeComparisonCurrencyDto"][];
};
IncomeBucketDto: {
period: components["schemas"]["IncomePeriodDto"];
totalsByCurrency: components["schemas"]["IncomeCurrencySummaryDto"][];
};
IncomeInstrumentDto: {
key: string;
figi: string | null;
instrumentUid: string | null;
ticker: string | null;
instrumentType: string | null;
displayName: string;
coupon: components["schemas"]["MoneyDto"];
dividend: components["schemas"]["MoneyDto"];
total: components["schemas"]["MoneyDto"];
receiptCount: number;
};
IncomeAnalyticsDto: {
accountId: string;
period: components["schemas"]["IncomePeriodDto"];
totalsByCurrency: components["schemas"]["IncomeCurrencySummaryDto"][];
/** Format: date-time */
calculatedAt: string;
previous: components["schemas"]["IncomeComparisonDto"];
yearComparison: components["schemas"]["IncomeComparisonDto"] | null;
/** @enum {string} */
bucketGranularity: "day" | "week" | "month";
buckets: components["schemas"]["IncomeBucketDto"][];
instruments: components["schemas"]["IncomeInstrumentDto"][];
entries: components["schemas"]["BrokerageOperationDto"][];
};
};
responses: never;
@@ -1085,4 +1177,139 @@ export interface operations {
};
};
};
IncomeAnalyticsController_summary: {
parameters: {
query?: never;
header?: never;
path: {
accountId: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["IncomeSummaryDto"];
};
};
/** @description Invalid request */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/problem+json": components["schemas"]["ProblemDetailsDto"];
};
};
/** @description Authentication required */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/problem+json": components["schemas"]["ProblemDetailsDto"];
};
};
/** @description Resource not found */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/problem+json": components["schemas"]["ProblemDetailsDto"];
};
};
/** @description Internal server error */
500: {
headers: {
[name: string]: unknown;
};
content: {
"application/problem+json": components["schemas"]["ProblemDetailsDto"];
};
};
/** @description Upstream service unavailable */
503: {
headers: {
[name: string]: unknown;
};
content: {
"application/problem+json": components["schemas"]["ProblemDetailsDto"];
};
};
};
};
IncomeAnalyticsController_analytics: {
parameters: {
query?: {
from?: string;
to?: string;
};
header?: never;
path: {
accountId: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["IncomeAnalyticsDto"];
};
};
/** @description Invalid request */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/problem+json": components["schemas"]["ProblemDetailsDto"];
};
};
/** @description Authentication required */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/problem+json": components["schemas"]["ProblemDetailsDto"];
};
};
/** @description Resource not found */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/problem+json": components["schemas"]["ProblemDetailsDto"];
};
};
/** @description Internal server error */
500: {
headers: {
[name: string]: unknown;
};
content: {
"application/problem+json": components["schemas"]["ProblemDetailsDto"];
};
};
/** @description Upstream service unavailable */
503: {
headers: {
[name: string]: unknown;
};
content: {
"application/problem+json": components["schemas"]["ProblemDetailsDto"];
};
};
};
};
}
+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"
]
}
}
}
}
}