moex-vibe/apps/backend/src/modules/tbank/dto/broker-events-response.dto.ts
2026-06-22 06:41:37 +03:00

81 lines
1.7 KiB
TypeScript

import { ApiProperty } from '@nestjs/swagger';
const eventTypes = ['dividend', 'coupon', 'maturity', 'offer'] as const;
const eventCategories = ['cashflow', 'corporate'] as const;
const instrumentTypes = ['share', 'bond', 'other'] as const;
export class BrokerEventItemDto {
@ApiProperty()
id!: string;
@ApiProperty({ enum: eventTypes })
type!: string;
@ApiProperty({ enum: eventCategories })
category!: string;
@ApiProperty()
eventDate!: string;
@ApiProperty({ nullable: true })
paymentDate!: string | null;
@ApiProperty({ nullable: true })
ticker!: string | null;
@ApiProperty({ nullable: true })
name!: string | null;
@ApiProperty({ nullable: true })
instrumentUid!: string | null;
@ApiProperty({ enum: instrumentTypes })
instrumentType!: string;
@ApiProperty({ nullable: true })
quantitySnapshot!: number | null;
@ApiProperty({ nullable: true })
payoutPerUnit!: number | null;
@ApiProperty({ nullable: true })
estimatedAmount!: number | null;
@ApiProperty({ nullable: true })
currency!: string | null;
@ApiProperty()
estimateMode!: 'current_position';
}
export class BrokerEventsSummaryDto {
@ApiProperty({ minimum: 0 })
eventCount!: number;
@ApiProperty({ nullable: true })
nearestEventDate!: string | null;
@ApiProperty()
totalEstimatedCashflow!: number;
@ApiProperty()
dividendsTotal!: number;
@ApiProperty()
couponsTotal!: number;
@ApiProperty()
principalRepaymentTotal!: number;
}
export class BrokerEventsDataDto {
@ApiProperty({ type: [BrokerEventItemDto] })
items!: BrokerEventItemDto[];
@ApiProperty({ type: BrokerEventsSummaryDto })
summary!: BrokerEventsSummaryDto;
@ApiProperty()
asOf!: string;
}