Lean  $LEAN_TAG$
QuantConnect.SeriesSampler Class Reference

A type capable of taking a chart and resampling using a linear interpolation strategy More...

Public Member Functions

 SeriesSampler (TimeSpan resolution)
 Creates a new SeriesSampler to sample Series data on the specified resolution More...
 
virtual BaseSeries Sample (BaseSeries series, DateTime start, DateTime stop, bool truncateValues=false)
 Samples the given series More...
 
Dictionary< string, ChartSampleCharts (IDictionary< string, Chart > charts, DateTime start, DateTime stop)
 Samples the given charts More...
 
Chart SampleChart (Chart chart, DateTime start, DateTime stop)
 Samples the given chart More...
 

Static Protected Member Functions

static ? decimal Interpolate (decimal x0, decimal? y0, decimal x1, decimal? y1, decimal xTarget, decimal step)
 Linear interpolation used for sampling More...
 
static T GetIdentitySeries< T > (T sampled, T series, DateTime start, DateTime stop, bool truncateValues)
 Gets the identity series, this is the series with no sampling applied. More...
 

Properties

TimeSpan Step [get, set]
 The desired sampling resolution More...
 
bool SubSample = true [get, set]
 True if sub sampling is enabled, if false only subsampling will happen More...
 

Detailed Description

A type capable of taking a chart and resampling using a linear interpolation strategy

Definition at line 27 of file SeriesSampler.cs.

Constructor & Destructor Documentation

◆ SeriesSampler()

QuantConnect.SeriesSampler.SeriesSampler ( TimeSpan  resolution)

Creates a new SeriesSampler to sample Series data on the specified resolution

Parameters
resolutionThe desired sampling resolution

Definition at line 43 of file SeriesSampler.cs.

Member Function Documentation

◆ Sample()

virtual BaseSeries QuantConnect.SeriesSampler.Sample ( BaseSeries  series,
DateTime  start,
DateTime  stop,
bool  truncateValues = false 
)
virtual

Samples the given series

Parameters
seriesThe series to be sampled
startThe date to start sampling, if before start of data then start of data will be used
stopThe date to stop sampling, if after stop of data, then stop of data will be used
truncateValuesTrue will truncate values to integers
Returns
The sampled series

Definition at line 56 of file SeriesSampler.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SampleCharts()

Dictionary<string, Chart> QuantConnect.SeriesSampler.SampleCharts ( IDictionary< string, Chart charts,
DateTime  start,
DateTime  stop 
)

Samples the given charts

Parameters
chartsThe charts to be sampled
startThe date to start sampling
stopThe date to stop sampling
Returns
The sampled charts

Definition at line 88 of file SeriesSampler.cs.

Here is the call graph for this function:

◆ SampleChart()

Chart QuantConnect.SeriesSampler.SampleChart ( Chart  chart,
DateTime  start,
DateTime  stop 
)

Samples the given chart

Parameters
chartThe chart to be sampled
startThe date to start sampling
stopThe date to stop sampling
Returns
The sampled chart

Definition at line 105 of file SeriesSampler.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Interpolate()

static ? decimal QuantConnect.SeriesSampler.Interpolate ( decimal  x0,
decimal?  y0,
decimal  x1,
decimal?  y1,
decimal  xTarget,
decimal  step 
)
staticprotected

Linear interpolation used for sampling

Definition at line 358 of file SeriesSampler.cs.

◆ GetIdentitySeries< T >()

static T QuantConnect.SeriesSampler.GetIdentitySeries< T > ( sampled,
series,
DateTime  start,
DateTime  stop,
bool  truncateValues 
)
staticprotected

Gets the identity series, this is the series with no sampling applied.

Type Constraints
T :BaseSeries 

Definition at line 454 of file SeriesSampler.cs.

Property Documentation

◆ Step

TimeSpan QuantConnect.SeriesSampler.Step
getsetprotected

The desired sampling resolution

Definition at line 32 of file SeriesSampler.cs.

◆ SubSample

bool QuantConnect.SeriesSampler.SubSample = true
getset

True if sub sampling is enabled, if false only subsampling will happen

Definition at line 37 of file SeriesSampler.cs.


The documentation for this class was generated from the following file: