当前位置: 首页>>代码示例>>C#>>正文


C# ICurrency.getChangeToEuro方法代码示例

本文整理汇总了C#中ICurrency.getChangeToEuro方法的典型用法代码示例。如果您正苦于以下问题:C# ICurrency.getChangeToEuro方法的具体用法?C# ICurrency.getChangeToEuro怎么用?C# ICurrency.getChangeToEuro使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICurrency的用法示例。


在下文中一共展示了ICurrency.getChangeToEuro方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: computeCorrelationAndVol

        protected static Tuple<double[,], double[]> computeCorrelationAndVol(DateTime priceDate, IAsset underlying, ICurrency cur, int date_nb)
        {
            List<DateTime> dates_correl = new List<DateTime>();
            int total = 0, real = 0; // current number of date : total also have not taken dates cause week end
            while (real < date_nb)
            {
                DateTime curr_date = priceDate - TimeSpan.FromDays(total);
                if (!(curr_date.DayOfWeek == DayOfWeek.Saturday || curr_date.DayOfWeek == DayOfWeek.Sunday))
                {
                    dates_correl.Add(curr_date);
                    real++;
                }
                total++;
            }
            // get the prices from database
            Dictionary<DateTime, double> hist_correl = AccessDB.Get_Asset_Price(underlying.getName(), dates_correl);
            // transform the Tuple format to double[,] format
            double[,] hist_correl_double = new double[2, date_nb];
            int j = 0;
            foreach (DateTime d in dates_correl)
            {
                hist_correl_double[0, j] = hist_correl[d];
                j++;
            }
            j = 0;
            foreach (DateTime d in dates_correl)
            {
                hist_correl_double[1, j] = 1 / cur.getChangeToEuro(d);
                j++;
            }

            // compute correl and vol using C++ functions
            Wrapping.Tools tools = new Wrapping.Tools();
            double[,] correl = new double[2, 2];
            double[] vol = new double[2];
            tools.getCorrelAndVol(date_nb, 2, hist_correl_double, correl, vol);
            return new Tuple<double[,], double[]>(correl, vol);
        }
开发者ID:bonkoskk,项目名称:peps,代码行数:38,代码来源:AQuanto.cs


注:本文中的ICurrency.getChangeToEuro方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。