Table of Contents

Class CandleBuilder<TCandleMessage>

Namespace
StockSharp.Algo.Candles.Compression
Assembly
StockSharp.Algo.dll

Candles builder.

public abstract class CandleBuilder<TCandleMessage> : BaseLogReceiver, IPersistable, ILogReceiver, ILogSource, ICandleBuilder, IDisposable where TCandleMessage : CandleMessage

Type Parameters

TCandleMessage

The type of candle which the builder will create.

Inheritance
CandleBuilder<TCandleMessage>
Implements
IPersistable
Derived
Inherited Members
Extension Methods

Constructors

CandleBuilder(IExchangeInfoProvider)

protected CandleBuilder(IExchangeInfoProvider exchangeInfoProvider)

Parameters

exchangeInfoProvider IExchangeInfoProvider

The exchange boards provider.

Properties

CandleType

The candle type.

public virtual Type CandleType { get; }

Property Value

Type

ExchangeInfoProvider

The exchange boards provider.

protected IExchangeInfoProvider ExchangeInfoProvider { get; }

Property Value

IExchangeInfoProvider

Methods

AddVolume(TCandleMessage, decimal?, Sides?)

protected static void AddVolume(TCandleMessage candle, decimal? volume, Sides? volSide)

Parameters

candle TCandleMessage
volume decimal?
volSide Sides?

CreateCandle(ICandleBuilderSubscription, ICandleBuilderValueTransform)

To create a new candle.

protected virtual TCandleMessage CreateCandle(ICandleBuilderSubscription subscription, ICandleBuilderValueTransform transform)

Parameters

subscription ICandleBuilderSubscription

Subscription.

transform ICandleBuilderValueTransform

The data source transformation.

Returns

TCandleMessage

Created candle.

FirstInitCandle(ICandleBuilderSubscription, TCandleMessage, ICandleBuilderValueTransform)

To fill in the initial candle settings.

protected virtual TCandleMessage FirstInitCandle(ICandleBuilderSubscription subscription, TCandleMessage candle, ICandleBuilderValueTransform transform)

Parameters

subscription ICandleBuilderSubscription

Subscription.

candle TCandleMessage

Candle.

transform ICandleBuilderValueTransform

The data source transformation.

Returns

TCandleMessage

Candle.

GetTimeZone(ICandleBuilderSubscription)

Get time zone info.

protected (TimeZoneInfo zone, WorkingTime time) GetTimeZone(ICandleBuilderSubscription subscription)

Parameters

subscription ICandleBuilderSubscription

ICandleBuilderSubscription

Returns

(TimeZoneInfo zone, WorkingTime time)

Info.

IsCandleFinishedBeforeChange(ICandleBuilderSubscription, TCandleMessage, ICandleBuilderValueTransform)

Whether the candle is created before data adding.

protected virtual bool IsCandleFinishedBeforeChange(ICandleBuilderSubscription subscription, TCandleMessage candle, ICandleBuilderValueTransform transform)

Parameters

subscription ICandleBuilderSubscription

Subscription.

candle TCandleMessage

Candle.

transform ICandleBuilderValueTransform

The data source transformation.

Returns

bool

true if the candle should be finished. Otherwise, false.

OnProcess(ICandleBuilderSubscription, ICandleBuilderValueTransform)

To process the new data.

protected virtual IEnumerable<TCandleMessage> OnProcess(ICandleBuilderSubscription subscription, ICandleBuilderValueTransform transform)

Parameters

subscription ICandleBuilderSubscription

Subscription.

transform ICandleBuilderValueTransform

The data source transformation.

Returns

IEnumerable<TCandleMessage>

A new candles changes.

Process(ICandleBuilderSubscription, ICandleBuilderValueTransform)

To process the new data.

public IEnumerable<CandleMessage> Process(ICandleBuilderSubscription subscription, ICandleBuilderValueTransform transform)

Parameters

subscription ICandleBuilderSubscription

Subscription.

transform ICandleBuilderValueTransform

The data source transformation.

Returns

IEnumerable<CandleMessage>

A new candles changes.

ProcessValue(ICandleBuilderSubscription, ICandleBuilderValueTransform)

To process the new data.

protected virtual TCandleMessage ProcessValue(ICandleBuilderSubscription subscription, ICandleBuilderValueTransform transform)

Parameters

subscription ICandleBuilderSubscription

Subscription.

transform ICandleBuilderValueTransform

The data source transformation.

Returns

TCandleMessage

A new candle. If there is not necessary to create a new candle, then CurrentCandle is returned. If it is impossible to create a new candle (transform cannot be applied to candles), then null is returned.

Round(decimal, Unit)

Round the price to the specified step.

protected decimal Round(decimal price, Unit step)

Parameters

price decimal

Price.

step Unit

Step.

Returns

decimal

Rounded value.

ShrinkPrice(Unit, ICandleBuilderSubscription)

To cut the price, to make it multiple of minimal step, also to limit number of signs after the comma.

protected decimal ShrinkPrice(Unit price, ICandleBuilderSubscription subscription)

Parameters

price Unit

The price to be made multiple.

subscription ICandleBuilderSubscription

ICandleBuilderSubscription

Returns

decimal

The multiple price.

ShrinkPrice(decimal, ICandleBuilderSubscription)

To cut the price, to make it multiple of minimal step, also to limit number of signs after the comma.

protected decimal ShrinkPrice(decimal price, ICandleBuilderSubscription subscription)

Parameters

price decimal

The price to be made multiple.

subscription ICandleBuilderSubscription

ICandleBuilderSubscription

Returns

decimal

The multiple price.

UpdateCandle(ICandleBuilderSubscription, TCandleMessage, ICandleBuilderValueTransform)

To update the candle data.

protected virtual void UpdateCandle(ICandleBuilderSubscription subscription, TCandleMessage candle, ICandleBuilderValueTransform transform)

Parameters

subscription ICandleBuilderSubscription

Subscription.

candle TCandleMessage

Candle.

transform ICandleBuilderValueTransform

The data source transformation.