feat:新增接口
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
"""赎回相关 DTO。"""
|
||||
from decimal import Decimal
|
||||
|
||||
from pydantic import BaseModel, Field, field_serializer
|
||||
|
||||
from schemas.holdings import HoldingResp
|
||||
|
||||
|
||||
class RedeemReq(BaseModel):
|
||||
"""赎回入参。shares 为正数(份额),按净值折算入账金额。"""
|
||||
|
||||
product_id: int
|
||||
shares: Decimal = Field(gt=0)
|
||||
|
||||
|
||||
class RedeemResp(BaseModel):
|
||||
"""赎回结果:最新余额 + 该产品最新持仓。"""
|
||||
|
||||
balance: Decimal
|
||||
holding: HoldingResp
|
||||
|
||||
@field_serializer("balance")
|
||||
def _fmt_balance(self, value: Decimal) -> str:
|
||||
return f"{value:.2f}"
|
||||
Reference in New Issue
Block a user