Store exact RUB balances, atomic transfers, linked refunds and versioned edits independently of T-Bank. Add migration, HTTP and durability verification.
156 lines
6.5 KiB
TypeScript
156 lines
6.5 KiB
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
||
import { MoneyDto } from '../common/money.dto';
|
||
|
||
import {
|
||
StockSearchQueryDto,
|
||
StockTickerParamsDto,
|
||
StockCandlesQueryDto,
|
||
StockCandlesDto,
|
||
StockPositionDto,
|
||
} from './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' }) instrumentUid: string;
|
||
@ApiProperty({
|
||
description: 'Unambiguous ticker URL segment, or the exact instrument UID.',
|
||
})
|
||
slug: string;
|
||
@ApiProperty() name: string;
|
||
@ApiProperty({ type: String, nullable: true }) isin: string | null;
|
||
@ApiProperty({ type: String, nullable: true }) classCode: string | null;
|
||
@ApiProperty({ type: String, nullable: true }) realExchange: string | null;
|
||
@ApiProperty({ type: Boolean, nullable: true }) apiTradeAvailable:
|
||
boolean | null;
|
||
@ApiProperty({ type: String, nullable: true }) ticker: string | null;
|
||
@ApiProperty({ type: String, nullable: true }) logoName: string | null;
|
||
@ApiProperty({ type: String, nullable: true }) currency: string | null;
|
||
@ApiProperty({ type: String, nullable: true }) sector: string | null;
|
||
@ApiProperty({ type: Number, nullable: true }) lot: number | null;
|
||
@ApiProperty({ type: String, nullable: true, format: 'date-time' })
|
||
historyFrom: string | null;
|
||
@ApiProperty({ type: MoneyDto, nullable: true }) nominal: MoneyDto | null;
|
||
@ApiProperty({ type: MoneyDto, nullable: true })
|
||
initialNominal: MoneyDto | null;
|
||
@ApiProperty({ type: MoneyDto, nullable: true }) aci: MoneyDto | null;
|
||
@ApiProperty({ type: String, nullable: true }) maturityDate: string | null;
|
||
@ApiProperty({ type: String, nullable: true }) callDate: string | null;
|
||
@ApiProperty({ type: String, nullable: true }) bondType: string | null;
|
||
@ApiProperty({ type: String, nullable: true }) riskLevel: string | null;
|
||
@ApiProperty({ type: Number, nullable: true }) couponQuantityPerYear:
|
||
number | null;
|
||
@ApiProperty({ type: Boolean, nullable: true }) floatingCoupon:
|
||
boolean | null;
|
||
@ApiProperty({ type: Boolean, nullable: true }) perpetual: boolean | null;
|
||
@ApiProperty({ type: Boolean, nullable: true }) amortization: boolean | null;
|
||
@ApiProperty({ type: Boolean, nullable: true }) subordinated: boolean | null;
|
||
}
|
||
|
||
export class BondSearchResultDto extends BondDto {
|
||
@ApiProperty({
|
||
type: String,
|
||
nullable: true,
|
||
description: 'Clean price in percent of nominal, not money.',
|
||
})
|
||
pricePercent: string | null;
|
||
@ApiProperty({ type: String, nullable: true, format: 'date-time' }) priceAt:
|
||
string | null;
|
||
}
|
||
export class BondQuoteDto {
|
||
@ApiProperty({ type: String, nullable: true }) pricePercent: string | null;
|
||
@ApiProperty({
|
||
type: MoneyDto,
|
||
nullable: true,
|
||
description:
|
||
'Indicative clean value at the current nominal; no FX conversion.',
|
||
})
|
||
cleanPrice: MoneyDto | null;
|
||
@ApiProperty({ type: MoneyDto, nullable: true }) aci: MoneyDto | null;
|
||
@ApiProperty({
|
||
type: MoneyDto,
|
||
nullable: true,
|
||
description:
|
||
'Indicative clean value plus current accrued interest, excluding fees.',
|
||
})
|
||
dirtyPrice: MoneyDto | null;
|
||
@ApiProperty({ type: String, nullable: true }) changePercentagePoints:
|
||
string | null;
|
||
@ApiProperty({ type: String, nullable: true }) previousCloseDate:
|
||
string | null;
|
||
@ApiProperty({ type: String, nullable: true }) tradingStatus: string | null;
|
||
@ApiProperty({ type: String, nullable: true, format: 'date-time' }) priceAt:
|
||
string | null;
|
||
@ApiProperty({ type: [String] }) unavailable: string[];
|
||
@ApiProperty({ format: 'date-time' }) observedAt: string;
|
||
}
|
||
export class BondCouponDto {
|
||
@ApiProperty({ type: String, nullable: true }) number: string | null;
|
||
@ApiProperty({ type: String, nullable: true }) paymentDate: string | null;
|
||
@ApiProperty({ type: String, nullable: true }) recordDate: string | null;
|
||
@ApiProperty({ type: String, nullable: true }) couponType: string | null;
|
||
@ApiProperty({ type: Number, nullable: true }) periodDays: number | null;
|
||
@ApiProperty({ type: MoneyDto, nullable: true }) perBond: MoneyDto | null;
|
||
@ApiProperty({ type: MoneyDto, nullable: true })
|
||
estimatedAmount: MoneyDto | null;
|
||
@ApiProperty({ enum: ['upcoming', 'past', 'undated'] }) timing:
|
||
'upcoming' | 'past' | 'undated';
|
||
}
|
||
export class BondCouponsDto {
|
||
@ApiProperty({ type: [BondCouponDto] }) coupons: BondCouponDto[];
|
||
@ApiProperty() from: string;
|
||
@ApiProperty() to: string;
|
||
@ApiProperty() observedAt: string;
|
||
@ApiProperty({ type: String, nullable: true }) positionAt: string | null;
|
||
@ApiProperty() estimateUnavailable: boolean;
|
||
@ApiProperty() positionIsStale: boolean;
|
||
}
|
||
|
||
export class BondYieldDto {
|
||
@ApiProperty({ description: 'MOEX effective annual yield in percent.' })
|
||
value: string;
|
||
@ApiProperty() pricePercent: string;
|
||
@ApiProperty({ format: 'date' }) date: string;
|
||
@ApiProperty({
|
||
type: String,
|
||
nullable: true,
|
||
description: 'MOEX yield target, e.g. MATDATE or OFFERDATE.',
|
||
})
|
||
dateType: string | null;
|
||
@ApiProperty({ format: 'date-time' }) tradeAt: string;
|
||
}
|
||
export class BondCreditRatingDto {
|
||
@ApiProperty({ enum: ['NCR'] }) agency: 'NCR';
|
||
@ApiProperty({ type: String, nullable: true }) value: string | null;
|
||
@ApiProperty({ enum: ['active', 'withdrawn'] }) status:
|
||
'active' | 'withdrawn';
|
||
@ApiProperty({ format: 'date' }) date: string;
|
||
@ApiProperty({ format: 'uri' }) sourceUrl: string;
|
||
@ApiProperty({ format: 'date-time' }) observedAt: string;
|
||
}
|
||
export class BondMetricsDto {
|
||
@ApiProperty({ type: BondCreditRatingDto, nullable: true })
|
||
creditRating: BondCreditRatingDto | null;
|
||
@ApiProperty({ type: MoneyDto, nullable: true }) coupon: MoneyDto | null;
|
||
@ApiProperty({ type: String, nullable: true, format: 'date' }) couponDate:
|
||
string | null;
|
||
@ApiProperty({ type: String, nullable: true }) couponType: string | null;
|
||
@ApiProperty({ type: Number, nullable: true }) couponPeriodDays:
|
||
number | null;
|
||
@ApiProperty({
|
||
type: String,
|
||
nullable: true,
|
||
description:
|
||
'Next coupon × 365 / period days / indicative clean price × 100. Not yield to maturity.',
|
||
})
|
||
couponYieldPercent: string | null;
|
||
@ApiProperty({ type: String, nullable: true, format: 'date-time' })
|
||
couponYieldPriceAt: string | null;
|
||
@ApiProperty({ type: BondYieldDto, nullable: true })
|
||
effectiveYield: BondYieldDto | null;
|
||
@ApiProperty({ type: [String] }) unavailable: string[];
|
||
@ApiProperty({ format: 'date-time' }) observedAt: string;
|
||
}
|