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,
|
HttpStatus,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { ApiTags, ApiOperation, ApiResponse, ApiQuery } from '@nestjs/swagger';
|
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 { MarketMakerService, LedgerType, AssetType } from '../../application/services/market-maker.service';
|
||||||
import { Public } from '../../shared/guards/jwt-auth.guard';
|
import { Public } from '../../shared/guards/jwt-auth.guard';
|
||||||
|
|
||||||
// DTO 定义
|
// DTO 定义
|
||||||
class InitializeMarketMakerDto {
|
class InitializeMarketMakerDto {
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
name?: string;
|
name?: string;
|
||||||
|
|
||||||
|
@IsString()
|
||||||
accountSequence: string;
|
accountSequence: string;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
initialCash?: string;
|
initialCash?: string;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
maxBuyRatio?: number;
|
maxBuyRatio?: number;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
minIntervalMs?: number;
|
minIntervalMs?: number;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
maxIntervalMs?: number;
|
maxIntervalMs?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
class DepositDto {
|
class DepositDto {
|
||||||
|
@IsString()
|
||||||
amount: string;
|
amount: string;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
memo?: string;
|
memo?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
class WithdrawDto {
|
class WithdrawDto {
|
||||||
|
@IsString()
|
||||||
amount: string;
|
amount: string;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
memo?: string;
|
memo?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
class UpdateConfigDto {
|
class UpdateConfigDto {
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
maxBuyRatio?: number;
|
maxBuyRatio?: number;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
minIntervalMs?: number;
|
minIntervalMs?: number;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
maxIntervalMs?: number;
|
maxIntervalMs?: number;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
priceStrategy?: string;
|
priceStrategy?: string;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
discountRate?: number;
|
discountRate?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
class UpdateMakerConfigDto {
|
class UpdateMakerConfigDto {
|
||||||
|
@IsOptional()
|
||||||
bidEnabled?: boolean;
|
bidEnabled?: boolean;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
bidLevels?: number;
|
bidLevels?: number;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
bidSpread?: number;
|
bidSpread?: number;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
bidLevelSpacing?: number;
|
bidLevelSpacing?: number;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
bidQuantityPerLevel?: string;
|
bidQuantityPerLevel?: string;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
askEnabled?: boolean;
|
askEnabled?: boolean;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
askLevels?: number;
|
askLevels?: number;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
askSpread?: number;
|
askSpread?: number;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
askLevelSpacing?: number;
|
askLevelSpacing?: number;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
askQuantityPerLevel?: string;
|
askQuantityPerLevel?: string;
|
||||||
|
|
||||||
|
@IsOptional()
|
||||||
|
@IsNumber()
|
||||||
refreshIntervalMs?: number;
|
refreshIntervalMs?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue