import { ApiProperty } from '@nestjs/swagger'; import { MoneyDto } from '../../../../../common/money.dto'; import { InvestmentResourceMetaDto } from '../../../investment-resource.dto'; import { StockCandlesDto, StockCandlesQueryDto, StockPositionDto, StockSearchQueryDto, StockTickerParamsDto, } from '../../stocks/presentation/stock.dto'; export class BondSearchQueryDto extends StockSearchQueryDto {} export class BondTickerParamsDto extends StockTickerParamsDto {} export class BondCandlesQueryDto extends StockCandlesQueryDto {} export class BondCandlesDto extends StockCandlesDto {} export class BondPositionDto extends StockPositionDto {} export class BondDto { @ApiProperty({ format: 'uuid' }) declare instrumentUid: string; @ApiProperty({ description: 'Unambiguous ticker URL segment, or the exact instrument UID.', }) declare slug: string; @ApiProperty() declare name: string; @ApiProperty({ type: String, nullable: true }) declare isin: null | string; @ApiProperty({ type: String, nullable: true }) declare classCode: null | string; @ApiProperty({ type: String, nullable: true }) declare realExchange: null | string; @ApiProperty({ type: Boolean, nullable: true }) declare apiTradeAvailable: boolean | null; @ApiProperty({ type: String, nullable: true }) declare ticker: null | string; @ApiProperty({ type: String, nullable: true }) declare logoName: null | string; @ApiProperty({ type: String, nullable: true }) declare currency: null | string; @ApiProperty({ type: String, nullable: true }) declare sector: null | string; @ApiProperty({ type: Number, nullable: true }) declare lot: null | number; @ApiProperty({ type: String, nullable: true, format: 'date-time' }) declare historyFrom: null | string; @ApiProperty({ type: MoneyDto, nullable: true }) declare nominal: MoneyDto | null; @ApiProperty({ type: MoneyDto, nullable: true }) declare initialNominal: MoneyDto | null; @ApiProperty({ type: MoneyDto, nullable: true }) declare aci: MoneyDto | null; @ApiProperty({ type: String, nullable: true }) declare maturityDate: null | string; @ApiProperty({ type: String, nullable: true }) declare callDate: null | string; @ApiProperty({ type: String, nullable: true }) declare bondType: null | string; @ApiProperty({ type: String, nullable: true }) declare riskLevel: null | string; @ApiProperty({ type: Number, nullable: true }) declare couponQuantityPerYear: null | number; @ApiProperty({ type: Boolean, nullable: true }) declare floatingCoupon: boolean | null; @ApiProperty({ type: Boolean, nullable: true }) declare perpetual: boolean | null; @ApiProperty({ type: Boolean, nullable: true }) declare amortization: boolean | null; @ApiProperty({ type: Boolean, nullable: true }) declare subordinated: boolean | null; } export class BondSearchResultDto extends BondDto { @ApiProperty({ type: String, nullable: true, description: 'Clean price in percent of nominal, not money.', }) declare pricePercent: null | string; @ApiProperty({ type: String, nullable: true, format: 'date-time' }) declare priceAt: null | string; } export class BondQuoteDto { @ApiProperty({ type: String, nullable: true }) declare pricePercent: null | string; @ApiProperty({ type: MoneyDto, nullable: true, description: 'Indicative clean value at the current nominal; no FX conversion.', }) declare cleanPrice: MoneyDto | null; @ApiProperty({ type: MoneyDto, nullable: true }) declare aci: MoneyDto | null; @ApiProperty({ type: MoneyDto, nullable: true, description: 'Indicative clean value plus current accrued interest, excluding fees.', }) declare dirtyPrice: MoneyDto | null; @ApiProperty({ type: String, nullable: true }) declare changePercentagePoints: null | string; @ApiProperty({ type: String, nullable: true }) declare previousCloseDate: null | string; @ApiProperty({ type: String, nullable: true }) declare tradingStatus: null | string; @ApiProperty({ type: String, nullable: true, format: 'date-time' }) declare priceAt: null | string; @ApiProperty({ type: String, isArray: true }) declare unavailable: string[]; @ApiProperty({ format: 'date-time' }) declare observedAt: string; } export class BondCouponDto { @ApiProperty({ type: String, nullable: true }) declare number: null | string; @ApiProperty({ type: String, nullable: true }) declare paymentDate: null | string; @ApiProperty({ type: String, nullable: true }) declare recordDate: null | string; @ApiProperty({ type: String, nullable: true }) declare couponType: null | string; @ApiProperty({ type: Number, nullable: true }) declare periodDays: null | number; @ApiProperty({ type: MoneyDto, nullable: true }) declare perBond: MoneyDto | null; @ApiProperty({ type: MoneyDto, nullable: true }) declare estimatedAmount: MoneyDto | null; @ApiProperty({ enum: ['upcoming', 'past', 'undated'] }) declare timing: 'past' | 'undated' | 'upcoming'; } export class BondCouponsDto { @ApiProperty({ type: BondCouponDto, isArray: true }) declare coupons: BondCouponDto[]; @ApiProperty() declare from: string; @ApiProperty() declare to: string; @ApiProperty() declare observedAt: string; @ApiProperty({ type: String, nullable: true }) declare positionAt: null | string; @ApiProperty() declare estimateUnavailable: boolean; @ApiProperty() declare positionIsStale: boolean; } export class BondYieldDto { @ApiProperty({ description: 'MOEX effective annual yield in percent.' }) declare value: string; @ApiProperty() declare pricePercent: string; @ApiProperty({ format: 'date' }) declare date: string; @ApiProperty({ type: String, nullable: true, description: 'MOEX yield target, e.g. MATDATE or OFFERDATE.', }) declare dateType: null | string; @ApiProperty({ format: 'date-time' }) declare tradeAt: string; } export class BondCreditRatingDto { @ApiProperty({ enum: ['NCR'] }) declare agency: 'NCR'; @ApiProperty({ type: String, nullable: true }) declare value: null | string; @ApiProperty({ enum: ['active', 'withdrawn'] }) declare status: 'active' | 'withdrawn'; @ApiProperty({ format: 'date' }) declare date: string; @ApiProperty({ format: 'uri' }) declare sourceUrl: string; @ApiProperty({ format: 'date-time' }) declare observedAt: string; } export class BondMetricsDto { @ApiProperty({ type: BondCreditRatingDto, nullable: true }) declare creditRating: BondCreditRatingDto | null; @ApiProperty({ type: MoneyDto, nullable: true }) declare coupon: MoneyDto | null; @ApiProperty({ type: String, nullable: true, format: 'date' }) declare couponDate: null | string; @ApiProperty({ type: String, nullable: true }) declare couponType: null | string; @ApiProperty({ type: Number, nullable: true }) declare couponPeriodDays: null | number; @ApiProperty({ type: String, nullable: true, description: 'Next coupon × 365 / period days / indicative clean price × 100. Not yield to maturity.', }) declare couponYieldPercent: null | string; @ApiProperty({ type: String, nullable: true, format: 'date-time' }) declare couponYieldPriceAt: null | string; @ApiProperty({ type: BondYieldDto, nullable: true }) declare effectiveYield: BondYieldDto | null; @ApiProperty({ type: String, isArray: true }) declare unavailable: string[]; @ApiProperty({ format: 'date-time' }) declare observedAt: string; } export class BondPositionResourceDto { @ApiProperty({ type: BondPositionDto, nullable: true }) declare data: BondPositionDto | null; @ApiProperty({ type: InvestmentResourceMetaDto }) declare meta: InvestmentResourceMetaDto; } export class BondSearchResourceDto { // eslint-disable-next-line @darraghor/nestjs-typed/api-property-returning-array-should-set-array -- Nullable array union requires isArray in the explicit wire schema. @ApiProperty({ type: BondSearchResultDto, isArray: true, nullable: true }) declare data: BondSearchResultDto[] | null; @ApiProperty({ type: InvestmentResourceMetaDto }) declare meta: InvestmentResourceMetaDto; } export class BondResourceDto { @ApiProperty({ type: BondDto, nullable: true }) declare data: BondDto | null; @ApiProperty({ type: InvestmentResourceMetaDto }) declare meta: InvestmentResourceMetaDto; } export class BondQuoteResourceDto { @ApiProperty({ type: BondQuoteDto, nullable: true }) declare data: BondQuoteDto | null; @ApiProperty({ type: InvestmentResourceMetaDto }) declare meta: InvestmentResourceMetaDto; } export class BondMetricsResourceDto { @ApiProperty({ type: BondMetricsDto, nullable: true }) declare data: BondMetricsDto | null; @ApiProperty({ type: InvestmentResourceMetaDto }) declare meta: InvestmentResourceMetaDto; } export class BondCandlesResourceDto { @ApiProperty({ type: BondCandlesDto, nullable: true }) declare data: BondCandlesDto | null; @ApiProperty({ type: InvestmentResourceMetaDto }) declare meta: InvestmentResourceMetaDto; } export class BondCouponsResourceDto { @ApiProperty({ type: BondCouponsDto, nullable: true }) declare data: BondCouponsDto | null; @ApiProperty({ type: InvestmentResourceMetaDto }) declare meta: InvestmentResourceMetaDto; }