本文整理汇总了C#中QuantConnect.Data.BaseData.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# BaseData.GetType方法的具体用法?C# BaseData.GetType怎么用?C# BaseData.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QuantConnect.Data.BaseData
的用法示例。
在下文中一共展示了BaseData.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculateNextFactorFileRow
/// <summary>
/// Calculates the next <see cref="FactorFileRow"/>
/// </summary>
/// <param name="factorFileRows">The current list of factorFileRows</param>
/// <param name="nextEvent">The next dividend, split or intradayDividendSplit</param>
/// <returns>A single factor file row</returns>
private FactorFileRow CalculateNextFactorFileRow(List<FactorFileRow> factorFileRows, BaseData nextEvent)
{
FactorFileRow nextFactorFileRow;
var t = nextEvent.GetType();
switch (t.Name)
{
case "Dividend":
nextFactorFileRow = CalculateNextDividendFactor(nextEvent, factorFileRows.Last());
break;
case "Split":
nextFactorFileRow = CalculateNextSplitFactor(nextEvent, factorFileRows.Last());
break;
case "IntraDayDividendSplit":
nextFactorFileRow = CalculateIntradayDividendSplit((IntraDayDividendSplit)nextEvent, factorFileRows.Last());
break;
default:
throw new ArgumentException("Unhandled BaseData type for FactorFileGenerator.");
}
return nextFactorFileRow;
}
示例2: LeanDataLineTestParameters
public LeanDataLineTestParameters(BaseData data, SecurityType securityType, Resolution resolution, string expectedLine)
{
Data = data;
SecurityType = securityType;
Resolution = resolution;
ExpectedLine = expectedLine;
if (data is Tick)
{
var tick = (Tick) data;
TickType = tick.TickType;
}
else if (data is TradeBar)
{
TickType = TickType.Trade;
}
else if (data is QuoteBar)
{
TickType = TickType.Quote;
}
else
{
throw new NotImplementedException();
}
// override for forex/cfd
if (data.Symbol.ID.SecurityType == SecurityType.Forex || data.Symbol.ID.SecurityType == SecurityType.Cfd)
{
TickType = TickType.Quote;
}
Config = new SubscriptionDataConfig(Data.GetType(), Data.Symbol, Resolution, TimeZones.Utc, TimeZones.Utc, false, true, false, false, TickType);
Name = SecurityType + "_" + data.GetType().Name;
if (data.GetType() != typeof (Tick) || Resolution != Resolution.Tick)
{
Name += "_" + Resolution;
}
if (data is Tick)
{
Name += "_" + ((Tick) data).TickType;
}
}