示例#1
0
        public static PaaData UsdFied(PaaData fm, IDictionary <int, Dictionary <string, double> > fxHist)
        {
            if (!fxHist.ContainsKey(fm.EodDate))
            {
                return(null);
            }
            var fx = Utility.GetFxRate(fxHist[fm.EodDate], fm.CCY.Trim());

            return(new PaaData
            {
                EodDate = fm.EodDate,
                PosId = fm.PosId,
                Quantity = fm.Quantity,
                Spot = Math.Round(fm.Spot / fx, 4),
                Delta = Utility.Round(fm.Delta / fx),
                Theta = Utility.Round(fm.Theta / fx),
                FairValue = Utility.Round(fm.FairValue / fx),
                AverageCost = Math.Round(fm.AverageCost / fx, 4),
                Interest = Utility.Round(fm.Interest / fx),
                Coupon = Utility.Round(fm.Coupon / fx),
                Dividend = Utility.Round(fm.Dividend / fx),
                Realised = Utility.Round(fm.Realised / fx),
                Commission = Utility.Round(fm.Commission / fx),
                MOK = fm.MOK,
                PLOK = fm.PLOK,
                AvgCostA = Math.Round(fm.AvgCostA / fx, 4),
                RlsdA = Utility.Round(fm.RlsdA / fx),
                CommA = Utility.Round(fm.CommA / fx),
                EOPL = Utility.Round(fm.EOPL / fx),
                ThetaPL = Utility.Round(fm.ThetaPL / fx),
                EOPLE = Utility.Round(fm.EOPLE / fx),
                AccIntPLRD = Utility.Round(fm.AccIntPLRD / fx),
                CouponPLRD = Utility.Round(fm.CouponPLRD / fx),
                DivPLRD = Utility.Round(fm.DivPLRD / fx),
                CCY = fm.CCY + "->USD",
                DayCount = fm.DayCount,
                LiborRate = fm.LiborRate / fx,
                LiborPrem = Utility.Round(fm.LiborPrem / fx),
                EquityPrem = Utility.Round(fm.EquityPrem / fx),
                DivPrem = Utility.Round(fm.DivPrem / fx),
                PfsId = fm.PfsId,
            });
        }
示例#2
0
 public static PaaData DtdDiffed(PaaData fm, PaaData to)
 {
     return(new PaaData
     {
         EodDate = to.EodDate,
         PosId = to.PosId,
         Quantity = to.Quantity - fm.Quantity,
         Spot = Math.Round(to.Spot - fm.Spot, 2),
         Delta = to.Delta - fm.Delta,
         Theta = to.Theta - fm.Theta,
         FairValue = to.FairValue - fm.FairValue,
         AverageCost = Math.Round(to.AverageCost - fm.AverageCost, 2),
         Interest = to.Interest - fm.Interest,
         Coupon = to.Coupon - fm.Coupon,
         Dividend = to.Dividend - fm.Dividend,
         Realised = to.Realised - fm.Realised,
         Commission = to.Commission - fm.Commission,
         MOK = fm.MOK,
         PLOK = fm.PLOK,
         AvgCostA = Math.Round(to.AvgCostA - fm.AvgCostA, 2),
         RlsdA = to.RlsdA - fm.RlsdA,
         CommA = to.CommA - fm.CommA,
         EOPL = to.EOPL - fm.EOPL,
         ThetaPL = to.ThetaPL - fm.ThetaPL,
         EOPLE = to.EOPLE - fm.EOPLE,
         AccIntPLRD = to.AccIntPLRD - fm.AccIntPLRD,
         CouponPLRD = to.CouponPLRD - fm.CouponPLRD,
         DivPLRD = to.DivPLRD - fm.DivPLRD,
         CCY = to.CCY,
         DayCount = to.DayCount - fm.DayCount,
         LiborRate = to.LiborRate - fm.LiborRate,
         LiborPrem = to.LiborPrem - fm.LiborPrem,
         EquityPrem = to.EquityPrem - fm.EquityPrem,
         DivPrem = to.DivPrem - fm.DivPrem,
         PfsId = to.PfsId,
     });
 }
示例#3
0
 public static List <PaaData> PaaUsdFiedData(IList <PaaData> input, IDictionary <int, Dictionary <string, double> > fxHist)
 {
     return(input.Select(p => PaaData.UsdFied(p, fxHist)).ToList());
 }
示例#4
0
 public static List <PaaData> PaaDtDData(IList <PaaData> input)
 {
     return(input.Select((p, i) => i > 0 ? PaaData.DtdDiffed(input[i - 1], p) : p).ToList());
 }
 public static PfsDbConsistencyData CreatePfsDbConsistencyData(ISwapDescription p, PaaData d)
 {
     return(new PfsDbConsistencyData
     {
         EodDate = p.ValueDate,
         PosId = d.PosId,
         PfsTQ = p.Position.TradedQuantity,
         DbTQ = d.Quantity,
         PfsAvgCost = Math.Round(p.Position.ProfitLoss.AverageCost, 6),
         DbAvgCost = d.AverageCost,
         DbAvgCostA = d.AvgCostA,
         PfsRlsd = Utility.Round(p.Position.RealisedCashFlows.Where(cf => cf.ShortCashFlowType != ShortCashFlowTypeEnum.Distibution && cf.ShortCashFlowType != ShortCashFlowTypeEnum.Reset && cf.ShortCashFlowType != ShortCashFlowTypeEnum.TransactionFee)?.Sum(cf => cf.LtdAmount) ?? 0.0),
         DbRlsd = d.Realised,
         DbRlsdA = d.RlsdA,
         PfsComm = Utility.Round(p.Position.RealisedCashFlows.Where(cf => cf.ShortCashFlowType == ShortCashFlowTypeEnum.TransactionFee)?.Sum(cf => cf.LtdAmount) ?? 0.0),
         DbComm = d.Commission,
         DbCommA = d.CommA,
         PfsDiv = Utility.Round(p.Position.RealisedCashFlows.Where(cf => cf.ShortCashFlowType == ShortCashFlowTypeEnum.Distibution)?.Sum(cf => cf.LtdAmount) ?? 0.0),
         DbDiv = d.Dividend,
         PfsCoupon = Utility.Round(p.Position.RealisedCashFlows.Where(cf => cf.ShortCashFlowType == ShortCashFlowTypeEnum.Reset)?.Sum(cf => cf.LtdAmount) ?? 0.0),
         DbCoupon = d.Coupon,
         PfsId = d.PfsId,
     });
 }