CandleBuilder

StockSharp.Algo.Candles.Compression

Candles builder.

Inherits: BaseLogReceiver

Implements: ICandleBuilder, IDisposable

Constructors

CandleBuilder
protected CandleBuilder(IExchangeInfoProvider exchangeInfoProvider)
candleBuilder = CandleBuilder(exchangeInfoProvider)

Candles builder.

exchangeInfoProvider
The exchange boards provider.

Properties

CandleType
public virtual Type CandleType { get; }
value = candleBuilder.CandleType

The candle type.

ExchangeInfoProvider
protected IExchangeInfoProvider ExchangeInfoProvider { get; }
value = candleBuilder.ExchangeInfoProvider

The exchange boards provider.

Methods

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

Add volume to TotalVolume, BuyVolume, SellVolume, RelativeVolume.

candle
CandleMessage
volume
The volume to be added to the candle.
volSide
The side of the volume to be added to the candle.
CreateCandle
protected virtual TCandleMessage CreateCandle(ICandleBuilderSubscription subscription, ICandleBuilderValueTransform transform)
result = candleBuilder.CreateCandle(subscription, transform)

To create a new candle.

subscription
Subscription.
transform
The data source transformation.

Returns: Created candle.

FirstInitCandle
protected virtual TCandleMessage FirstInitCandle(ICandleBuilderSubscription subscription, TCandleMessage candle, ICandleBuilderValueTransform transform)
result = candleBuilder.FirstInitCandle(subscription, candle, transform)

To fill in the initial candle settings.

subscription
Subscription.
candle
Candle.
transform
The data source transformation.

Returns: Candle.

GetTimeZone
protected ValueTuple<TimeZoneInfo, WorkingTime> GetTimeZone(ICandleBuilderSubscription subscription)
result = candleBuilder.GetTimeZone(subscription)

Get time zone info.

subscription
ICandleBuilderSubscription

Returns: Info.

IncrementTicks
protected void IncrementTicks(CandleMessage candle)
candleBuilder.IncrementTicks(candle)

Increment the number of ticks in the candle.

candle
CandleMessage
IsCandleFinishedBeforeChange
protected virtual bool IsCandleFinishedBeforeChange(ICandleBuilderSubscription subscription, TCandleMessage candle, ICandleBuilderValueTransform transform)
result = candleBuilder.IsCandleFinishedBeforeChange(subscription, candle, transform)

Whether the candle is created before data adding.

subscription
Subscription.
candle
Candle.
transform
The data source transformation.

Returns: if the candle should be finished. Otherwise, .

OnProcess
protected virtual IEnumerable<TCandleMessage> OnProcess(ICandleBuilderSubscription subscription, ICandleBuilderValueTransform transform)
result = candleBuilder.OnProcess(subscription, transform)

To process the new data.

subscription
Subscription.
transform
The data source transformation.

Returns: A new candles changes.

Process
public IEnumerable<CandleMessage> Process(ICandleBuilderSubscription subscription, ICandleBuilderValueTransform transform)
result = candleBuilder.Process(subscription, transform)

To process the new data.

subscription
Subscription.
transform
The data source transformation.

Returns: A new candles changes.

ProcessValue
protected virtual TCandleMessage ProcessValue(ICandleBuilderSubscription subscription, ICandleBuilderValueTransform transform)
result = candleBuilder.ProcessValue(subscription, transform)

To process the new data.

subscription
Subscription.
transform
The data source transformation.

Returns: 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 ( cannot be applied to candles), then is returned.

Round
protected decimal Round(decimal price, Unit step)
result = candleBuilder.Round(price, step)

Round the price to the specified step.

price
Price.
step
Step.

Returns: Rounded value.

ShrinkPrice
protected decimal ShrinkPrice(Unit price, ICandleBuilderSubscription subscription)
result = candleBuilder.ShrinkPrice(price, subscription)

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

price
The price to be made multiple.
subscription
ICandleBuilderSubscription

Returns: The multiple price.

ShrinkPrice
protected decimal ShrinkPrice(decimal price, ICandleBuilderSubscription subscription)
result = candleBuilder.ShrinkPrice(price, subscription)

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

price
The price to be made multiple.
subscription
ICandleBuilderSubscription

Returns: The multiple price.

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

To update the candle data.

subscription
Subscription.
candle
Candle.
transform
The data source transformation.