本文整理汇总了C#中Market.GetAll方法的典型用法代码示例。如果您正苦于以下问题:C# Market.GetAll方法的具体用法?C# Market.GetAll怎么用?C# Market.GetAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Market
的用法示例。
在下文中一共展示了Market.GetAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleLines
static bool HandleLines(IList<string> lines, Market market, char[] seps, StringBuilder sb)
{
//Read First Line to fin Vol Surface and if its Rho or Nu
bool isRho = true;
InterestVolatility vol = null;
var firstLine = lines.FirstOrDefault();
if (string.IsNullOrEmpty(firstLine))
{
sb.Append("Cannot parse first line");
return false;
}
var ss = firstLine.Split(seps);
var sdate = ss[2];
var stype = ss[3];
var ticker = ss[4];
var date = SimpleDate.Parse(sdate);
isRho = stype.ToUpper().Contains("RHO");
var isBeta = stype.ToUpper().Contains("BETA");
ss = ticker.Split('.');
var name = ss[0];
var ccy = ss[1];
var time = date.ToDateTime(23, 59, 59);
market.Time = time;
market.ClearMarketDatas();
var vols = market.GetAll(true, false, false, true, false, false, false, false, false, false, false, false, false);
foreach (var im in vols)
{
var ivol = im as InterestVolatility;
if (ivol != null && ivol.Currency.Equals(ccy))
{
vol = ivol;
break;
}
}
if (vol == null)
{
sb.Append("Cannot Find Any Vol for " + ticker);
return false;
}
var output = vol.Output as InterestVolatilityOutput;
if (output == null)
{
sb.Append("Invalid Vol not built " + vol);
return false;
}
var data = new List<SabrData>();
foreach (var line in lines)
{
var d = new SabrData();
ss = line.Split(seps);
var tick = ss[4];
d.Date = SimpleDate.Parse(ss[2]).ToDateTime();
d.ComponentTicker = tick;
d.InstrumentType = ss[3];
d.Value = Convert.ToDouble(ss[5]);
data.Add(d);
}
return HandleData(vol, isRho, isBeta, data, market, sb);
}