本文整理汇总了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);
}