Class SamplingUtils
Inheritance
Inherited Members
Namespace: Azos.Financial.Market
Assembly: Azos.dll
Syntax
public static class SamplingUtils
Methods
AggregateHomogeneousSamples(IEnumerable<ITimeSeriesSample>, UInt32, Single)
Aggregates source stream of the normally equidistant samples of the same type by the specified factor
Declaration
public static IEnumerable<ITimeSeriesSample> AggregateHomogeneousSamples(this IEnumerable<ITimeSeriesSample> source, uint times, float samplingRateVariationPct = 1F)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<ITimeSeriesSample> | source | Source stream |
System.UInt32 | times | Factor of aggergation, i.e. 4x means aggregate 4 samples into one |
System.Single | samplingRateVariationPct | The allowed variation in timing between samples, once this variation is exceeded the system emits new aggregate |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ITimeSeriesSample> | Aggregated sample stream |
SynthesizeCandles(IEnumerable<ITimeSeriesSample>, UInt32, Action<CandleSample, SecDBFileReader.QuoteSample, Int32>, Action<CandleSample, SecDBFileReader.TradeSample, Int32>)
Synthesizes a stream of candle samples from Quote and Trade samples coming from the market (i.e SecDB file)
Declaration
public static IEnumerable<CandleSample> SynthesizeCandles(this IEnumerable<ITimeSeriesSample> source, uint secSamplingPeriod, Action<CandleSample, SecDBFileReader.QuoteSample, int> funcQuote = null, Action<CandleSample, SecDBFileReader.TradeSample, int> funcTrade = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<ITimeSeriesSample> | source | Source of market data |
System.UInt32 | secSamplingPeriod | The output sampling period |
System.Action<CandleSample, SecDBFileReader.QuoteSample, System.Int32> | funcQuote | Aggregation func for Quote, if null default is used which aggregates best bid |
System.Action<CandleSample, SecDBFileReader.TradeSample, System.Int32> | funcTrade | Aggregation func for Quote, if null default is used which aggregates buy and sell volumes |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<CandleSample> | Synthesized candle stream |
SynthesizeCandles<T>(IEnumerable<ITimeSeriesSample>, UInt32, Action<T, SecDBFileReader.QuoteSample, Int32>, Action<T, SecDBFileReader.TradeSample, Int32>)
Synthesizes a stream of candle samples from Quote and Trade samples coming from a market data source (i.e SecDB file)
Declaration
public static IEnumerable<T> SynthesizeCandles<T>(this IEnumerable<ITimeSeriesSample> source, uint secSamplingPeriod, Action<T, SecDBFileReader.QuoteSample, int> funcQuote, Action<T, SecDBFileReader.TradeSample, int> funcTrade)
where T : ITimedSample
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<ITimeSeriesSample> | source | Source of market data |
System.UInt32 | secSamplingPeriod | The output sampling period |
System.Action<T, SecDBFileReader.QuoteSample, System.Int32> | funcQuote | Aggregation func for Quote, if null default is used which aggregates best bid |
System.Action<T, SecDBFileReader.TradeSample, System.Int32> | funcTrade | Aggregation func for Quote, if null default is used which aggregates buy and sell volumes |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | Synthesized candle stream |
Type Parameters
Name | Description |
---|---|
T |