Example #1
0
 public ScnearioGen(InterestRates intR, HullWhite hw, double eqSigma, int endMth)
 {
     Curves  = intR;
     HW      = hw;
     EqSigma = eqSigma;
     EndMth  = endMth;
 }
Example #2
0
        /// <summary>
        /// 랜덤 즉시 생성하여 실행
        /// </summary>
        /// <param name="scenCnt"></param>
        /// <param name="startScenNo"></param>
        public void SetScenDataFromRandomGen(int scenCnt)
        {
            var intRates = new InterestRates(ScenP.SourceCurve, ScenEndMth);
            var hw       = new HullWhite(ScenP.HW_a, ScenP.HW_sigma);
            var scen     = new ScnearioGen(intRates, hw, ScenP.EqSigma, ScenEndMth);

            ScenData = new Dictionary <int, Dictionary <ScenType, double[]> >();

            for (int i = 0; i <= scenCnt; i++)
            {
                double[] rdIR;
                double[] rdEQ;
                scen.GetRandom(out rdIR, out rdEQ);
                ScenData.Add(i, scen.GetScen(rdIR, rdEQ));
            }
        }
Example #3
0
        /// <summary>
        /// 랜덤을 파일에서 가져와 실행
        /// </summary>
        /// <param name="scenCnt"></param>
        /// <param name="startScenNo"></param>
        public void SetScenDataFromFile(int scenCnt)
        {
            var intRates = new InterestRates(ScenP.SourceCurve, ScenEndMth);
            var hw       = new HullWhite(ScenP.HW_a, ScenP.HW_sigma);
            var scen     = new ScnearioGen(intRates, hw, ScenP.EqSigma, ScenEndMth);

            var currentDir = Directory.GetCurrentDirectory();
            var rdIrList   = Tools.LibFile.ReadCSV(currentDir + @"\ScenarioGenerator\RandomSetIR.csv");
            var rdEqList   = Tools.LibFile.ReadCSV(currentDir + @"\ScenarioGenerator\RandomSetEQ.csv");

            ScenData = new Dictionary <int, Dictionary <ScenType, double[]> >();

            for (int i = 1; i <= scenCnt; i++)
            {
                var rdIR = Array.ConvertAll(rdIrList[i - 1], item => Convert.ToDouble(item));
                var rdEQ = Array.ConvertAll(rdEqList[i - 1], item => Convert.ToDouble(item));

                double a = rdIR.Sum() + rdEQ.Sum();

                ScenData.Add(i, scen.GetScen(rdIR, rdEQ));
            }
        }