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; }
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); }
public AssetRateDatum CalculateAndGetAssetRateDatum(DateTime targetDate, MarketDataSet data) { AssetRateDatum aw = new AssetRateDatum(this.KospiWeight, this.BondWeight, this.DollarWeight); return aw; }