fix(trading): 为做市商 DTO 添加 class-validator 装饰器
修复做市商初始化失败问题。由于 ValidationPipe 配置了 forbidNonWhitelisted: true,没有装饰器的属性会被拒绝。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
4bb5a2b09d
commit
edd6ced2a3
|
|
@ -9,48 +9,117 @@ import {
|
|||
HttpStatus,
|
||||
} from '@nestjs/common';
|
||||
import { ApiTags, ApiOperation, ApiResponse, ApiQuery } from '@nestjs/swagger';
|
||||
import { IsString, IsOptional, IsNumber } from 'class-validator';
|
||||
import { MarketMakerService, LedgerType, AssetType } from '../../application/services/market-maker.service';
|
||||
import { Public } from '../../shared/guards/jwt-auth.guard';
|
||||
|
||||
// DTO 定义
|
||||
class InitializeMarketMakerDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
name?: string;
|
||||
|
||||
@IsString()
|
||||
accountSequence: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
initialCash?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
maxBuyRatio?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
minIntervalMs?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
maxIntervalMs?: number;
|
||||
}
|
||||
|
||||
class DepositDto {
|
||||
@IsString()
|
||||
amount: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
memo?: string;
|
||||
}
|
||||
|
||||
class WithdrawDto {
|
||||
@IsString()
|
||||
amount: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
memo?: string;
|
||||
}
|
||||
|
||||
class UpdateConfigDto {
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
maxBuyRatio?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
minIntervalMs?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
maxIntervalMs?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
priceStrategy?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
discountRate?: number;
|
||||
}
|
||||
|
||||
class UpdateMakerConfigDto {
|
||||
@IsOptional()
|
||||
bidEnabled?: boolean;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
bidLevels?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
bidSpread?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
bidLevelSpacing?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
bidQuantityPerLevel?: string;
|
||||
|
||||
@IsOptional()
|
||||
askEnabled?: boolean;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
askLevels?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
askSpread?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
askLevelSpacing?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
askQuantityPerLevel?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
refreshIntervalMs?: number;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue