dv01全局去除

This commit is contained in:
吴方海
2024-06-12 10:28:49 +08:00
parent 258b05a3c8
commit 62db850bae
18 changed files with 27 additions and 629 deletions
@@ -495,11 +495,6 @@ namespace YLErp.Modules.CalculationModule
/// Theta(轧差)
/// </summary>
public double ThetaNet { get; set; }
/// <summary>
/// dv01值
/// </summary>
public double DV01 { get; set; }
}
public class TradeValueResultExtend
@@ -136,8 +136,7 @@ namespace YLErp.Modules.CalculationModule
Rho = 0,
DeltaCash = (lastEodSwap.MarketValueLong > 0 ? spotPrice : -spotPrice) * trade.Notional,
GammaCash = 0,
SpotPrice= spotPrice,
DV01= Convert.ToDouble(lastEodSwap.DV01)
SpotPrice= spotPrice
};
return OptionValue;
@@ -158,7 +157,6 @@ namespace YLErp.Modules.CalculationModule
eodSwap.NotionalValueLong = positions.Where(x => x.PositionType == (int)PositionTypeFlag.Long).Sum(s => s.PosiNotionalValue);
eodSwap.NotionalValueShort = positions.Where(x => x.PositionType == (int)PositionTypeFlag.Short).Sum(s => s.PosiNotionalValue);
eodSwap.NotionalValue = eodSwap.NotionalValueLong + eodSwap.NotionalValueShort;
eodSwap.DV01 = 0;
var lastEod = db.eod_swap.Where(x => x.SwapTradeId == trade.id).OrderByDescending(o => o.ValueDate).FirstOrDefault();
eodSwap.RealizedPnL = lastEod?.RealizedPnL ?? 0;
eodSwap.InterestPnL = lastEod?.InterestPnL ?? 0;
@@ -168,14 +166,12 @@ namespace YLErp.Modules.CalculationModule
int directionRatio = item.PosiDirection == (int)SwapDirectionEnum. ? 1 : -1;
var pv = item.PosiQuantity * shortRatio * item.ContractSize;
var pvNoPrice = item.PosiQuantity * item.ContractSize;
decimal vobp = 0;
var data = DataCacheProvider.GetUnderlyingDataSource().GetData(item.UnderlyingCode);
if (data != null)
{
if (data.IsBond())
{
var bondPrice = EodPriceQueryService.GetBondPrice(valuedateBLL.ValueDate, data.UnderlyingCode);
vobp = bondPrice?.Vobp ?? 0;
var price = Convert.ToDecimal(bondPrice?.ClosePrice??0);
eodSwap.FloatingPnL = (price - item.PosiGrossPrice) * item.PosiQuantity * item.ContractSize * shortRatio * directionRatio;
}
@@ -189,7 +185,6 @@ namespace YLErp.Modules.CalculationModule
eodSwap.MarketValueShort += pv;
}
eodSwap.NotionalValue += pvNoPrice;
eodSwap.DV01 += pvNoPrice * vobp * shortRatio * directionRatio * 0.01m;
}
eodSwap.PostionValue = eodSwap.InterestPnL + eodSwap.FloatingPnL;
return eodSwap;