Skip to content

Commit

Permalink
Hook up new consolidators in ResolveConsolidator method
Browse files Browse the repository at this point in the history
  • Loading branch information
mchandschuh committed Mar 14, 2015
1 parent cb7094f commit 721ecf3
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Algorithm/QCAlgorithm.Indicators.cs
Original file line number Diff line number Diff line change
Expand Up @@ -393,12 +393,20 @@ protected IDataConsolidator ResolveConsolidator(string symbol, Resolution? resol
return TradeBarConsolidator.FromResolution(resolution.Value);
}

// TODO : Add default IDataConsolidator for Tick
// if it is tick data we would need a different consolidator, what should the default consolidator of tick data be?
// I imagine it would be something that produces a TradeBar from ticks!
//if our type can be used as a tick then we'll use the tick consolidator
// we use IsAssignableFrom instead of IsSubclassOf so that we can account for types that are able to be cast to TradeBar
if (typeof (Tick).IsAssignableFrom(subscription.Type))
{
return TickConsolidator.FromResolution(resolution.Value);
}

// no matter what we can always consolidate based on the time-value pair of BaseData, later we'll need a check
// to see if it's custom code and derives from 'DynamicData' and if so, we'll make the DynamicDataConsolidator (future work)
return BaseDataConsolidator.FromResolution(resolution.Value);

// if it is custom data I don't think we can resolve a default consolidator for the type unless it was assignable to trade bar
// TODO : Implement DynamicDataConsolidator, first try trade bar, then fall back on time-value pair data
// Maybe allow for configuration to specify your 'value' propery?
}
catch (InvalidOperationException)
{
Expand Down

0 comments on commit 721ecf3

Please sign in to comment.