chore(swap): 删除格林大华保证金#if DEBUG明显bug分支——Release下case空体误落国泰君安公式组
本部署CompanyEnum=国联(走default→DefaultMarginCalculation),且保证金正在其他分支重写,各家期货公司定制对本分支无意义;格林大华case体整体包在#if DEBUG里,Release编译时空case直接fall-through到国泰君安/光大光子/兴业商贸组——若格林大华环境用Release版,保证金一直在用别家公式。连同DAL的GLDHMarginCalculation.cs与UT下整文件注释的死备份一并删除。dotnet build 0错误
This commit is contained in:
@@ -1,217 +0,0 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using YLErp.DBModels;
|
||||
//using YLErp.Model;
|
||||
|
||||
//namespace YLErp.BLL.MarginCalculationBak
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// 格林大华
|
||||
// /// </summary>
|
||||
// public class GLDHMarginCalculation : MarginCalculationBase
|
||||
// {
|
||||
// // 定义一个静态变量来保存类的实例
|
||||
// public static readonly GLDHMarginCalculation Instance;
|
||||
|
||||
// static GLDHMarginCalculation()
|
||||
// {
|
||||
// Instance = new GLDHMarginCalculation();
|
||||
// }
|
||||
|
||||
// // 定义私有构造函数,使外界不能创建该类实例
|
||||
// private GLDHMarginCalculation()
|
||||
// {
|
||||
// }
|
||||
|
||||
// public override List<trade_span> RunMarginCalculation(int userId, string userName, List<trade> tradeList, DateTime settleDate, Dictionary<int, double> priceDict, bool hasOptionInfo = false, bool isEodSettle = false, bool forSingleTrade = true, string volType = "交易", bool forOtherSide = false)
|
||||
// {
|
||||
// List<trade_span> tradeSpans = new List<trade_span>();
|
||||
// //实际计算的时候没有使用到收盘价格,所以先把取价格的逻辑注释掉;
|
||||
// //if (!(priceDict?.Count > 0))
|
||||
// //{
|
||||
// // var codes = tradeList.Select(O => O.UnderlyingCode).ToArray();
|
||||
// // priceDict = base.GetSettlePrice(codes, settleDate);
|
||||
// //}
|
||||
// //if (priceDict.Count == 0)
|
||||
// //{
|
||||
// // //如果价格没有传入也没从数据库获取到,就直接返回,没必要往下运行了。但不应该报错;
|
||||
// // return tradeSpans;
|
||||
// //}
|
||||
// if (tradeList != null && tradeList.Count > 0)
|
||||
// {
|
||||
// var tempStockTradeList = tradeList.Where(t => t.UnderlyingInstrumentType == ConsGlobal.InstrumentType.Stock).ToList();
|
||||
// if (tempStockTradeList.Any())
|
||||
// {
|
||||
// var stockTradeSpanlist = StockMarginCalculation(userId, userName, tempStockTradeList, settleDate, priceDict, hasOptionInfo, isEodSettle);
|
||||
// if (stockTradeSpanlist.Count > 0)
|
||||
// {
|
||||
// tradeSpans.AddRange(stockTradeSpanlist);
|
||||
// }
|
||||
// }
|
||||
// var tempFutureTradeList = tradeList.Where(t => t.UnderlyingInstrumentType == ConsGlobal.InstrumentType.CommodityFutures).ToList();
|
||||
// if (tempFutureTradeList.Any())
|
||||
// {
|
||||
// var futureTradeSpanlist = FutureMarginCalculation(userId, userName, tempFutureTradeList, settleDate, priceDict, hasOptionInfo, isEodSettle);
|
||||
// if (futureTradeSpanlist.Count > 0)
|
||||
// {
|
||||
// tradeSpans.AddRange(futureTradeSpanlist);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return tradeSpans;
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// 股票类期权计算保证金
|
||||
// /// </summary>
|
||||
// /// <param name="userId"></param>
|
||||
// /// <param name="userName"></param>
|
||||
// /// <param name="tradeList"></param>
|
||||
// /// <param name="settleDate"></param>
|
||||
// /// <param name="priceDict"></param>
|
||||
// /// <returns></returns>
|
||||
// public List<trade_span> StockMarginCalculation(int userId, string userName, List<trade> tradeList, DateTime settleDate, Dictionary<int, double> priceDict, bool hasOptionInfo = false, bool isEodSettle = false)
|
||||
// {
|
||||
// List<trade_span> tradeSpans = new List<trade_span>();
|
||||
// if (tradeList != null && tradeList.Count > 0)
|
||||
// {
|
||||
// using (YLContext db = new YLContext())
|
||||
// {
|
||||
// var marginRation = valuedateBLL.SystemDate.MarginRatio ?? 0.15;
|
||||
// var clientIds = tradeList.Select(t => t.ClientId).ToList();
|
||||
// var clientList = (from client in db.client
|
||||
// join clientlevel in db.clientlevel
|
||||
// on client.LevelId equals clientlevel.id into tempClientlevel
|
||||
// from clientlevelTT in tempClientlevel.DefaultIfEmpty()
|
||||
// where clientIds.Contains(client.id)
|
||||
// select new
|
||||
// {
|
||||
// client,
|
||||
// clientlevel = clientlevelTT
|
||||
// }).ToList();
|
||||
|
||||
// if (clientList != null)
|
||||
// {
|
||||
|
||||
// tradeList.ForEach(t =>
|
||||
// {
|
||||
// var client = clientList.FirstOrDefault(c => c.client.id == t.ClientId);
|
||||
// if (client != null)
|
||||
// {
|
||||
// //未设置相关保证金系数默认为1.0
|
||||
// var clientRatio = client.clientlevel == null ? 1.0 : (client.clientlevel.Ratio ?? 1.0);
|
||||
// //如果是股票去名义本金,如果是期货取:份额 * 即期价格
|
||||
// var value = (t.StockEqvNotional ?? (t.Notional * t.SpotPrice ?? 0.0)) * marginRation * (t.BuySell == "买入" ? 1 : (PS.Config.ErpElement.TwoSideMargin && client.client.HasTwoSideMargin == 1 ? -1 : 0)) * clientRatio;
|
||||
// var twoSideMargin = (t.StockEqvNotional ?? (t.Notional * t.SpotPrice ?? 0.0)) * marginRation * (t.BuySell == "买入" ? 1 : -1) * clientRatio;
|
||||
// tradeSpans.Add(new trade_span
|
||||
// {
|
||||
// TradeId = t.id,
|
||||
// OptDate = DateTime.Now,
|
||||
// OptId = userId,
|
||||
// OptName = userName,
|
||||
// ClientId = client.client.id,
|
||||
// UnderlyingId = t.UnderlyingId,
|
||||
// UnderlyingCode = t.UnderlyingCode,
|
||||
// ValueDate = settleDate,
|
||||
// Spv1 = value,
|
||||
// Spv2 = value,
|
||||
// Spv3 = value,
|
||||
// Spv4 = value,
|
||||
// WorstCastClientPayable = value,
|
||||
// TwoSideMargin = twoSideMargin
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return tradeSpans;
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// 商品期权计算保证金
|
||||
// /// </summary>
|
||||
// /// <param name="userId"></param>
|
||||
// /// <param name="userName"></param>
|
||||
// /// <param name="futureTradeList"></param>
|
||||
// /// <param name="settleDate"></param>
|
||||
// /// <param name="priceDict"></param>
|
||||
// /// <returns></returns>
|
||||
// public List<trade_span> FutureMarginCalculation(int userId, string userName, List<trade> futureTradeList, DateTime settleDate, Dictionary<int, double> priceDict, bool hasOptionInfo = false, bool isEodSettle = false)
|
||||
// {
|
||||
// List<trade_span> tradeSpans = new List<trade_span>();
|
||||
// if (futureTradeList != null && futureTradeList.Count > 0)
|
||||
// {
|
||||
// using (YLContext db = new YLContext())
|
||||
// {
|
||||
// var marginRation = valuedateBLL.SystemDate.FutureMarginRatio ?? 0.15;
|
||||
// var clientIds = futureTradeList.Select(t => t.ClientId).ToList();
|
||||
// var clientList = (from client in db.client
|
||||
// join clientlevel in db.clientlevel
|
||||
// on client.LevelId equals clientlevel.id into tempClientlevel
|
||||
// from clientlevelTT in tempClientlevel.DefaultIfEmpty()
|
||||
// where clientIds.Contains(client.id)
|
||||
// select new
|
||||
// {
|
||||
// client,
|
||||
// clientlevel = clientlevelTT
|
||||
// }).ToList();
|
||||
|
||||
// if (clientList != null)
|
||||
// {
|
||||
|
||||
// futureTradeList.ForEach(t =>
|
||||
// {
|
||||
// var client = clientList.FirstOrDefault(c => c.client.id == t.ClientId);
|
||||
// if (client != null)
|
||||
// {
|
||||
// //未设置相关保证金系数默认为1.0
|
||||
// var clientRatio = client.clientlevel == null ? 1.0 : (client.clientlevel.Ratio ?? 1.0);
|
||||
// //如果是股票去名义本金,如果是期货取:份额 * 即期价格
|
||||
// var value = (t.StockEqvNotional ?? (t.Notional * t.SpotPrice ?? 0.0)) * marginRation * (t.BuySell == "买入" ? 1 : (PS.Config.ErpElement.TwoSideMargin && client.client.HasTwoSideMargin == 1 ? -1 : 0)) * clientRatio;
|
||||
// var twoSideMargin = (t.StockEqvNotional ?? (t.Notional * t.SpotPrice ?? 0.0)) * marginRation * (t.BuySell == "买入" ? 1 : -1) * clientRatio;
|
||||
// tradeSpans.Add(new trade_span
|
||||
// {
|
||||
// TradeId = t.id,
|
||||
// OptDate = DateTime.Now,
|
||||
// OptId = userId,
|
||||
// OptName = userName,
|
||||
// ClientId = client.client.id,
|
||||
// UnderlyingId = t.UnderlyingId,
|
||||
// UnderlyingCode = t.UnderlyingCode,
|
||||
// ValueDate = settleDate,
|
||||
// Spv1 = value,
|
||||
// Spv2 = value,
|
||||
// Spv3 = value,
|
||||
// Spv4 = value,
|
||||
// WorstCastClientPayable = value,
|
||||
// TwoSideMargin = twoSideMargin
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return tradeSpans;
|
||||
// }
|
||||
|
||||
// public override double GetTradeMargin(trade trade, double price, bool isInitialMargin = false, bool hasOptionInfo = false)
|
||||
// {
|
||||
// using (YLContext db = new YLContext())
|
||||
// {
|
||||
// if (trade.TradeType == "结构化交易")
|
||||
// {
|
||||
// trade.SubTrades = db.trade.Where(x => x.ParentTradeId == trade.id).ToList();
|
||||
// }
|
||||
// }
|
||||
|
||||
// var tradeMargin = RunMarginCalculation(0, "系统", new List<trade> { trade }, isInitialMargin ? (trade.TradeDate ?? valuedateBLL.ValueDate) : valuedateBLL.ValueDate, new Dictionary<int, double> { { trade.UnderlyingId, price } }, hasOptionInfo: hasOptionInfo);
|
||||
// if (null != tradeMargin)
|
||||
// {
|
||||
// return tradeMargin.FirstOrDefault()?.WorstCastClientPayable ?? 0.0;
|
||||
// }
|
||||
// return 0.0;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
Reference in New Issue
Block a user