130 lines
4.7 KiB
C#
130 lines
4.7 KiB
C#
using System;
|
|
using System.Data;
|
|
using YLErp.BLL.EodSettlement;
|
|
using YLErp.Modules.ClientModule;
|
|
using YLErp.Modules.VolatilityModule;
|
|
|
|
namespace YLErp.Web.WebAPI.Controllers
|
|
{
|
|
public class ClientBalanceController
|
|
{
|
|
|
|
///
|
|
/// </summary>
|
|
[HttpPost("m/api/ClientBalance/GetClientRsikMonitor")]
|
|
public JsonResult GetClientRsikMonitor([FromBody]MonitorReq req)
|
|
{
|
|
LogFactory.GetLogger("GetClientRsikMonitor请求").Info(JsonHelper.Serialize(req));
|
|
if (!req.SearchDate.HasValue)
|
|
{
|
|
req.SearchDate = valuedateBLL.ValueDate;
|
|
}
|
|
if (string.IsNullOrWhiteSpace(req.marginShownType))
|
|
{
|
|
req.marginShownType = "default";
|
|
}
|
|
if (req.ClientIds == null || req.ClientIds.Count <= 0)
|
|
{
|
|
req.ClientIds = DataCacheProvider.GetClientDataSource().AsQueryable().Select(o => o.id).Distinct().ToList();
|
|
}
|
|
var result = ClientBalanceUtility.GetClientRiskMonitorForShanXiGuShou(req.ClientIds, req.SearchDate.Value, req.marginShownType);
|
|
//精简字段
|
|
var resultList = result.Select(item => new resultParam
|
|
{
|
|
Number = item.ClientNumber,
|
|
Name = item.ClientName,
|
|
TotalTradeCount = item.TotalTradeCount,
|
|
TotalNotionalPrincipal = item.TotalNotionalPrincipal,
|
|
TransactionPenNumber = item.TradeCount,
|
|
TodayNotionalPrincipal = item.TodayNotionalPrincipal,
|
|
PositionNotionalPrincipal = item.PositionNotionalPrincipal,
|
|
CurrentHoldingPenNumber = item.PositionCount,
|
|
WinLoss = item.WinLoss,
|
|
PositionPnl = item.PositionPnl,
|
|
RoundedPositionPnl = item.RoundedPositionPnl,
|
|
LastDayRemainFund = item.LastDayRemainFund,
|
|
NetFundAll = item.NetFundAll,
|
|
NetFund = item.NetFund,
|
|
VmFundSum = item.VmFundSum,
|
|
OtherFund = item.OtherFund,
|
|
AmountFund = item.AmountFund,
|
|
MySideMargin = item.MySideMargin,
|
|
MaintenanceMargin = item.MaintenanceMargin,
|
|
SwapMarketAmount = item.SwapMarketAmount,
|
|
SwapMarketAmountPercent = item.SwapMarketAmountPercent,
|
|
AvailableAmount = item.AvailableAmount,
|
|
InsuredAmount = item.MarginByPayableMarginTotal,
|
|
DesirableFund = item.DesirableFund
|
|
}).ToList();
|
|
LogFactory.GetLogger().Info($"GetClientRsikMonitor: {JsonHelper.Serialize(resultList)}");
|
|
return new JsonResult(resultList);
|
|
}
|
|
|
|
public class MonitorReq
|
|
{
|
|
public List<int> ClientIds { get; set; }
|
|
|
|
public DateTime? SearchDate { get; set; }
|
|
|
|
public string marginShownType { get; set; }
|
|
}
|
|
|
|
public class resultParam
|
|
{
|
|
/*客户编号 客户名称 交易总数 名义本金总额 当日交易数 当日交易名义本金
|
|
持仓名义本金 持仓笔数 实现盈亏 持仓盈亏 期初结存 出金入金 初保账户 追保账户 其他收支
|
|
期末结存 初始保证金金额 维持保证金金额 盯市金额 履约保证金比例 可用资金 追保金额 可取资金*/
|
|
|
|
public string Number { get; set; }
|
|
|
|
public string Name { get; set; }
|
|
|
|
public int TotalTradeCount { get; set; }
|
|
|
|
public double TotalNotionalPrincipal { get; set; }
|
|
|
|
public int TransactionPenNumber { get; set; }
|
|
|
|
public double TodayNotionalPrincipal { get; set; }
|
|
|
|
public double PositionNotionalPrincipal { get; set; }
|
|
|
|
public int CurrentHoldingPenNumber { get; set; }
|
|
|
|
public double WinLoss { get; set; }
|
|
|
|
public double PositionPnl { get; set; }
|
|
|
|
public double RoundedPositionPnl { get; set; }
|
|
|
|
public double LastDayRemainFund { get; set; }
|
|
|
|
public double NetFundAll { get; set; }
|
|
|
|
public double NetFund { get; set; }
|
|
|
|
public double VmFundSum { get; set; }
|
|
|
|
public double OtherFund { get; set; }
|
|
|
|
public double AmountFund { get; set; }
|
|
|
|
public double MySideMargin { get; set; }
|
|
|
|
public double MaintenanceMargin { get; set; }
|
|
|
|
public double SwapMarketAmount { get; set; }
|
|
|
|
public decimal SwapMarketAmountPercent { get; set; }
|
|
|
|
public double AvailableAmount { get; set; }
|
|
|
|
public double InsuredAmount { get; set; }
|
|
|
|
public double DesirableFund { get; set; }
|
|
}
|
|
|
|
|
|
}
|
|
}
|