Ejemplo n.º 1
0
        public void build_testInput()
        {
            InputKeyValue vi1 = new InputKeyValue() { KeyName_ = "NAME", Value_ = "KOSPI200" };
            InputKeyValue vi2 = new InputKeyValue() { KeyName_ = "MODEL_TYPE", Value_ = "GBM" };
            InputKeyValue vi3 = new InputKeyValue() { KeyName_ = "MUE_CURVE_VALUE", Value_ = "0.03|0.031|0.032|0.033|0.034|0.035|0.036|0.037|0.038|0.039" };
            InputKeyValue vi4 = new InputKeyValue() { KeyName_ = "MUE_CURVE_TENOR", Value_ = "3M|6M|9M|12M|24M|36M|48M|60M|120M|240M" };

            this.KeyList_.Add(vi1);
            this.KeyList_.Add(vi2);
            this.KeyList_.Add(vi3);
            this.KeyList_.Add(vi4);
        }
Ejemplo n.º 2
0
        public void build_testInput()
        {
            InputKeyValue vi1 = new InputKeyValue() 
                { KeyName_ = "NAME", Value_ = "CD91" };
            InputKeyValue vi2 = new InputKeyValue() 
                { KeyName_ = "MODEL_TYPE", Value_ = "HULLWHITE" };
            InputKeyValue vi3 = new InputKeyValue() 
                { KeyName_ = "FITTING_CURVE_VALUE", Value_ = "0.03|0.031|0.032|0.033|0.034|0.035|0.036|0.037|0.038|0.039" };
            InputKeyValue vi4 = new InputKeyValue() 
                { KeyName_ = "ALPHA", Value_ = "" };
            InputKeyValue vi5 = new InputKeyValue() 
                { KeyName_ = "SIGMA", Value_ = "" };

            this.KeyList_.Add(vi1);
            this.KeyList_.Add(vi2);
            this.KeyList_.Add(vi3);
            this.KeyList_.Add(vi4);
            this.KeyList_.Add(vi5);
        }
Ejemplo n.º 3
0
        public void read_input(string section_content)
        {
            this.KeyList_ = new List<InputKeyValue>();

            char variable_delimiter = ';';
			char variable_assign = '=';
            //string array_delimiter = "|";
            //string matrix_parenthesis = "(";
            //string matrix_column_delimiter = ",";

			string[] key_variable;
			string[] tokens = section_content.Split(variable_delimiter);
            
			foreach (var s in tokens)
			{
				if (s == "")
					break;

				key_variable = s.Split(variable_assign);

                InputKeyValue inputKeyValue = new InputKeyValue();
                
                inputKeyValue.KeyName_ = key_variable[0];
                inputKeyValue.Value_ = key_variable[1];

                this.KeyList_.Add(inputKeyValue);

                //// matrix
                //if (value.find(matrix_parenthesis) != std::string::npos)
                //{
                //    //std::remove(value.begin(), value.end(), ')');
                //    //std::remove(value.begin(), value.end(), '(');
                //    value.erase(std::remove(value.begin(), value.end(), '('), value.end());
                //    value.erase(std::remove(value.begin(), value.end(), ')'), value.end());

                //    List<string> row_values;
                //    List<string> col_values;

                //    split(row_values, value, is_any_of(matrix_column_delimiter));
                //    size_t row_size = row_values.size();

                //    split(col_values, row_values[0], is_any_of(array_delimiter));
                //    size_t col_size = col_values.size();

                //    Matrix m = Matrix(row_size, col_size);

                //    col_values.clear();

                //    for (size_t row = 0; row < row_size; row++)
                //    {
                //        split(col_values, row_values[row], is_any_of(array_delimiter));

                //        for (size_t col = 0; col < col_size; col++)
                //        {
                //            QL_REQUIRE(col_values[col] != "","null value" );
                //            m[row][col] = std::stod(col_values[col]);
                //        }

                //        col_values.clear();
                //    }


                //    this->variable_matrix_map_[key] = m;
                //}
                //// array
                //else if(value.find(array_delimiter) != std::string::npos)
                //{
                //    List<string> arr;
                //    split(arr, value, is_any_of(array_delimiter));
                //    this->variable_array_map_[key] = arr;
                //}
                //else
                //{
                //    this->variable_map_[key] = value;
                //}
			} // for end

        }