feat(FEAT-MO-004): 实现指数板块详情分析页

This commit is contained in:
2026-08-25 00:16:43 +08:00
parent f8f4da93dc
commit 0131f863b6
32 changed files with 2262 additions and 8 deletions
@@ -0,0 +1,100 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { MarketOverviewMetaDto, type QuoteDirection } from '../market-overview.dto';
export type DetailInstrumentType = 'index' | 'sector';
export type DetailPeriod = '1d';
export class DetailInstrumentDto {
@ApiProperty({ type: String })
code!: string;
@ApiProperty({ type: String })
name!: string;
@ApiProperty({ enum: ['index', 'sector'] })
type!: DetailInstrumentType;
}
export class DetailQuoteDto {
@ApiProperty({ type: Number })
price!: number;
@ApiPropertyOptional({ type: Number, nullable: true })
changePercent!: number | null;
@ApiProperty({ enum: ['up', 'down', 'flat'] })
direction!: QuoteDirection;
@ApiProperty({ type: String, example: '20260818' })
tradeDate!: string;
}
export class DetailSeriesPointDto {
@ApiProperty({ type: String, example: '20260818' })
time!: string;
@ApiProperty({ type: Number })
open!: number;
@ApiProperty({ type: Number })
high!: number;
@ApiProperty({ type: Number })
low!: number;
@ApiProperty({ type: Number })
close!: number;
@ApiPropertyOptional({ type: Number, nullable: true })
amount!: number | null;
@ApiPropertyOptional({ type: Number, nullable: true })
volume!: number | null;
}
export class DetailAvailableViewsDto {
@ApiProperty({ type: Boolean })
kline!: boolean;
@ApiProperty({ type: Boolean })
intraday!: boolean;
}
export class IndexDetailDataDto {
@ApiProperty({ type: () => DetailInstrumentDto })
instrument!: DetailInstrumentDto;
@ApiProperty({ type: () => DetailQuoteDto })
quote!: DetailQuoteDto;
@ApiProperty({ type: [DetailSeriesPointDto] })
series!: DetailSeriesPointDto[];
@ApiProperty({ type: () => DetailAvailableViewsDto })
availableViews!: DetailAvailableViewsDto;
}
export class SectorDetailDataDto {
@ApiProperty({ type: () => DetailInstrumentDto })
instrument!: DetailInstrumentDto;
@ApiProperty({ type: () => DetailQuoteDto })
quote!: DetailQuoteDto;
@ApiProperty({ type: [DetailSeriesPointDto] })
series!: DetailSeriesPointDto[];
@ApiProperty({ type: () => DetailAvailableViewsDto })
availableViews!: DetailAvailableViewsDto;
}
export class IndexDetailResponseDto extends MarketOverviewMetaDto {
@ApiProperty({ type: () => IndexDetailDataDto, nullable: true })
data!: IndexDetailDataDto | null;
}
export class SectorDetailResponseDto extends MarketOverviewMetaDto {
@ApiProperty({ type: () => SectorDetailDataDto, nullable: true })
data!: SectorDetailDataDto | null;
}