本文整理匯總了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;
}
}