修复成交日算了利息
This commit is contained in:
@@ -331,8 +331,7 @@ namespace YLErp.Modules.SwapModule
|
||||
var orginPv = lastEod != null ? lastEod.NotionalValue : stockEqvNotional;
|
||||
var grossPrice = realPostitions.Where(x => x.PosiDirection > 0).FirstOrDefault()?.PosiGrossPrice;
|
||||
bool tdClose = DbContext.swap_flow_event.Any(x => x.SwapTradeId == tradeId && x.UnwindDate == unwindDate && eventTypes.Contains(x.EventType) && x.DataState == (int)SwapFlowDateStateEnum.完成);
|
||||
var calcLastNew = tradeExtend?.ExtendObj?.InterestCalcMode?.EndsWith("1") ?? true;
|
||||
interests = GetInterests(td, tradeExtend, valueDate, unwindDate, lastEodPositions, positions, stockEqvNotional, posiLongNotionalValue, posiShortNotionalValue, posiNotionalValue, closePercent, eventType, tdClose, false, grossPrice ?? 0, orginPv, true, calcLastNew, false);
|
||||
interests = GetInterests(td, tradeExtend, valueDate, unwindDate, lastEodPositions, positions, stockEqvNotional, posiLongNotionalValue, posiShortNotionalValue, posiNotionalValue, closePercent, eventType, tdClose, false, grossPrice ?? 0, orginPv, true, false);
|
||||
return interests;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -370,13 +369,12 @@ namespace YLErp.Modules.SwapModule
|
||||
decimal grossPrice,
|
||||
decimal orginPv,
|
||||
bool add = false,
|
||||
bool calcLast = true,
|
||||
bool settment = true)
|
||||
{
|
||||
List<swap_flow_event> interests = new List<swap_flow_event>();
|
||||
var annualDays = tradeExtend == null ? 365 : tradeExtend.ExtendObj.AnnualDays;
|
||||
bool calcFirst = tradeExtend?.ExtendObj.InterestCalcMode?.StartsWith("1") ?? true;
|
||||
|
||||
bool calcLast = tradeExtend?.ExtendObj.InterestCalcMode.EndsWith("1") ?? true;
|
||||
foreach (var position in positions)
|
||||
{
|
||||
// 初始化持仓信息
|
||||
@@ -386,7 +384,7 @@ namespace YLErp.Modules.SwapModule
|
||||
|
||||
// 计算计息区间
|
||||
int interestPeriod = position.interest_rest_days ?? 1;
|
||||
bool swap = InitInterestDate(unwindDate, preDealDate, td, tdClose, calcLast, out DateTime startDate, out DateTime endDate);
|
||||
bool swap = InitInterestDate(unwindDate, preDealDate, td, tdClose, out DateTime startDate, out DateTime endDate);
|
||||
|
||||
// 计算名义本金
|
||||
var (closePrincipal, posiPrincipal, newClosePercent) = CalcNotionalByMode(position, closePrecent, posiNotionalValue, posiLongNotionalValue, posiShortNotionalValue);
|
||||
@@ -496,6 +494,10 @@ namespace YLErp.Modules.SwapModule
|
||||
bool calcToday = true;
|
||||
if (calcFirst == false && valueDate == td.StartDate.Value) calcToday = false; // 首日不算头
|
||||
if (calcLast == false && valueDate == td.ExerciseDate.Value) calcToday = false; // 到期日不算尾
|
||||
if (valueDate < position.PosiStartDate)
|
||||
{
|
||||
calcToday = false;
|
||||
}
|
||||
// 初始化EOD持仓信息
|
||||
if (preEod.id == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user