feat(FEAT-MO-001): 增加市场概览分模块接口

This commit is contained in:
2026-08-18 13:31:24 +08:00
parent c2fa929936
commit 15a25002ce
12 changed files with 834 additions and 1 deletions
@@ -0,0 +1,112 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
export type MarketOverviewStatus = 'fresh' | 'delayed' | 'partial' | 'unavailable';
export type QuoteDirection = 'up' | 'down' | 'flat';
export class MarketOverviewMetaDto {
@ApiProperty({ type: String })
snapshotId!: string;
@ApiProperty({ type: String, format: 'date-time' })
asOf!: string;
@ApiProperty({ type: String, enum: ['tdx'] })
source!: 'tdx';
@ApiProperty({ enum: ['fresh', 'delayed', 'partial', 'unavailable'] })
status!: MarketOverviewStatus;
@ApiProperty({ type: [String] })
warnings!: string[];
}
export class IndexQuoteDto {
@ApiProperty({ type: String })
code!: string;
@ApiProperty({ type: String })
name!: string;
@ApiProperty({ type: Number })
price!: number;
@ApiPropertyOptional({ type: Number, nullable: true })
changePercent!: number | null;
@ApiProperty({ enum: ['up', 'down', 'flat'] })
direction!: QuoteDirection;
@ApiProperty({ type: String })
tradeDate!: string;
}
export class IndicesDataDto {
@ApiProperty({ type: [IndexQuoteDto] })
items!: IndexQuoteDto[];
}
export class SummaryDataDto {
@ApiProperty({ type: String })
verdict!: string;
@ApiProperty({ type: String })
marketStatus!: string;
@ApiProperty({ type: String })
volumeStatus!: string;
@ApiProperty({ type: String })
sentimentStatus!: string;
@ApiProperty({ type: [String] })
drivers!: string[];
@ApiProperty({ type: [String] })
risks!: string[];
}
export class BreadthDataDto {
@ApiProperty({ type: Number })
advancing!: number;
@ApiProperty({ type: Number })
declining!: number;
@ApiProperty({ type: Number })
unchanged!: number;
}
export class SectorDataDto {
@ApiProperty({ type: [String] })
items!: string[];
}
export class FundDataDto {
@ApiProperty({ type: [String] })
items!: string[];
}
export class SummaryResponseDto extends MarketOverviewMetaDto {
@ApiProperty({ type: () => SummaryDataDto, nullable: true })
data!: SummaryDataDto | null;
}
export class IndicesResponseDto extends MarketOverviewMetaDto {
@ApiProperty({ type: () => IndicesDataDto, nullable: true })
data!: IndicesDataDto | null;
}
export class BreadthResponseDto extends MarketOverviewMetaDto {
@ApiProperty({ type: () => BreadthDataDto, nullable: true })
data!: BreadthDataDto | null;
}
export class SectorsResponseDto extends MarketOverviewMetaDto {
@ApiProperty({ type: () => SectorDataDto, nullable: true })
data!: SectorDataDto | null;
}
export class FundsResponseDto extends MarketOverviewMetaDto {
@ApiProperty({ type: () => FundDataDto, nullable: true })
data!: FundDataDto | null;
}