- 修改ApiResponse、RiskParityConfig等DTO类的属性为可空类型 - 在策略计算器中添加空值检查逻辑 - 更新服务层代码处理可能的空值情况 - 添加发布配置文件FolderProfile.pubxml
156 lines
4.7 KiB
C#
156 lines
4.7 KiB
C#
namespace AssetManager.Models.DTOs;
|
|
|
|
public class CreatePortfolioRequest
|
|
{
|
|
public string? name { get; set; }
|
|
public string? strategyId { get; set; }
|
|
public string? currency { get; set; }
|
|
public List<StockItem>? stocks { get; set; }
|
|
}
|
|
|
|
public class StockItem
|
|
{
|
|
public string? name { get; set; }
|
|
public string? code { get; set; }
|
|
public double price { get; set; }
|
|
public int amount { get; set; }
|
|
public string? date { get; set; }
|
|
public string? currency { get; set; }
|
|
public string assetType { get; set; } = "Stock"; // Stock / Crypto
|
|
}
|
|
|
|
public class CreatePortfolioResponse
|
|
{
|
|
public string? id { get; set; }
|
|
public double totalValue { get; set; }
|
|
public double returnRate { get; set; }
|
|
public string? currency { get; set; }
|
|
public string? createdAt { get; set; }
|
|
}
|
|
|
|
public class PortfolioDetailResponse
|
|
{
|
|
public string? id { get; set; }
|
|
public string? name { get; set; }
|
|
public string? currency { get; set; }
|
|
public string? status { get; set; }
|
|
public StrategyInfo? strategy { get; set; }
|
|
public double portfolioValue { get; set; }
|
|
public double totalReturn { get; set; }
|
|
public double todayProfit { get; set; }
|
|
public double historicalChange { get; set; }
|
|
public double dailyVolatility { get; set; }
|
|
public string? todayProfitCurrency { get; set; }
|
|
public string? logicModel { get; set; }
|
|
public string? logicModelStatus { get; set; }
|
|
public string? logicModelDescription { get; set; }
|
|
public int totalItems { get; set; }
|
|
public double totalRatio { get; set; }
|
|
public List<PositionItem>? positions { get; set; }
|
|
}
|
|
|
|
public class StrategyInfo
|
|
{
|
|
public string? id { get; set; }
|
|
public string? name { get; set; }
|
|
public string? description { get; set; }
|
|
}
|
|
|
|
public class PositionItem
|
|
{
|
|
public string? id { get; set; }
|
|
public string? stockCode { get; set; }
|
|
public string? stockName { get; set; }
|
|
public string? symbol { get; set; }
|
|
public int amount { get; set; }
|
|
public double averagePrice { get; set; }
|
|
public double currentPrice { get; set; }
|
|
public double totalValue { get; set; }
|
|
public double profit { get; set; }
|
|
public double profitRate { get; set; }
|
|
public double changeAmount { get; set; }
|
|
public double ratio { get; set; }
|
|
public double deviationRatio { get; set; }
|
|
public string? currency { get; set; }
|
|
}
|
|
|
|
public class TransactionItem
|
|
{
|
|
public string? id { get; set; }
|
|
public string? portfolioId { get; set; }
|
|
public string? date { get; set; }
|
|
public string? time { get; set; }
|
|
public string? type { get; set; }
|
|
public string? title { get; set; }
|
|
public double amount { get; set; }
|
|
public string? currency { get; set; }
|
|
public string? status { get; set; }
|
|
public string? remark { get; set; }
|
|
}
|
|
|
|
public class GetTransactionsRequest
|
|
{
|
|
public string? portfolioId { get; set; }
|
|
public int limit { get; set; }
|
|
public int offset { get; set; }
|
|
}
|
|
|
|
public class GetTransactionsResponse
|
|
{
|
|
public List<TransactionItem>? items { get; set; }
|
|
public int total { get; set; }
|
|
public int page { get; set; }
|
|
public int pageSize { get; set; }
|
|
}
|
|
|
|
public class CreateTransactionRequest
|
|
{
|
|
public string? portfolioId { get; set; }
|
|
public string? type { get; set; }
|
|
public string? stockCode { get; set; }
|
|
public int amount { get; set; }
|
|
public double price { get; set; }
|
|
public string? currency { get; set; }
|
|
public string? remark { get; set; }
|
|
public string assetType { get; set; } = "Stock"; // Stock / Crypto
|
|
public string? transactionTime { get; set; } // 实际交易时间,可选
|
|
}
|
|
|
|
public class CreateTransactionResponse
|
|
{
|
|
public string? id { get; set; }
|
|
public double totalAmount { get; set; }
|
|
public string? status { get; set; }
|
|
public string? createdAt { get; set; }
|
|
}
|
|
|
|
public class PortfolioListItem
|
|
{
|
|
public string? id { get; set; }
|
|
public string? name { get; set; }
|
|
public string? tags { get; set; }
|
|
public string? status { get; set; }
|
|
public string? statusType { get; set; }
|
|
public string? iconChar { get; set; }
|
|
public string? iconBgClass { get; set; }
|
|
public string? iconTextClass { get; set; }
|
|
public double value { get; set; }
|
|
public string? currency { get; set; }
|
|
public double returnRate { get; set; }
|
|
public string? returnType { get; set; }
|
|
}
|
|
|
|
public class GetPortfoliosResponse
|
|
{
|
|
public List<PortfolioListItem>? items { get; set; }
|
|
}
|
|
|
|
public class TotalAssetsResponse
|
|
{
|
|
public double totalValue { get; set; }
|
|
public string? currency { get; set; }
|
|
public double todayProfit { get; set; }
|
|
public string? todayProfitCurrency { get; set; }
|
|
public double totalReturnRate { get; set; }
|
|
}
|