예제 #1
0
 public static Boolean IsSame(AssetRateDatum datum1, AssetRateDatum datum2)
 {
     if (!MathUtil.IsSameDouble(datum1.KospiRate, datum2.KospiRate, 2))
     {
         return false;
     }
     if (!MathUtil.IsSameDouble(datum1.KtbRate, datum2.KtbRate, 2))
     {
         return false;
     }
     if (!MathUtil.IsSameDouble(datum1.DollarRate, datum2.DollarRate, 2))
     {
         return false;
     }
     return true;
 }
예제 #2
0
        Tuple<double, double, double, double> GetDailyPnL(
            AssetRateDatum aw, DateTime prevDate, DateTime curDate, long notional, MarketDataSet marketDataSet)
        {
            MarketData mdKospi = marketDataSet.GetData(MarketDataSetKey.KospiFuture);
            MarketData mdBond = marketDataSet.GetData(MarketDataSetKey.KtbFuture);
            MarketData mdDollar = marketDataSet.GetData(MarketDataSetKey.DollarFuture);

            double kospiUpDoweRate = GetUpDownRate(mdKospi, prevDate, curDate);
            double bondUpDoweRate = GetUpDownRate(mdBond, prevDate, curDate);
            double dollarUpDoweRate = GetUpDownRate(mdDollar, prevDate, curDate);

            double kospiPnL = aw.KospiRate * notional * kospiUpDoweRate;
            double bondPnL = aw.KtbRate * notional * bondUpDoweRate;
            double dollarPnL = aw.DollarRate * notional * dollarUpDoweRate;
            double sum = kospiPnL + bondPnL + dollarPnL;

            return new Tuple<double, double, double, double>(sum, kospiPnL, bondPnL, dollarPnL);
        }
예제 #3
0
 public AssetRateDatum CalculateAndGetAssetRateDatum(DateTime targetDate, MarketDataSet data)
 {
     AssetRateDatum aw = new AssetRateDatum(this.KospiWeight, this.BondWeight, this.DollarWeight);
     return aw;
 }