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)
Initialize CandleBuilder<TCandleMessage>.
protected CandleBuilder(IExchangeInfoProvider exchangeInfoProvider)
Parameters
exchangeInfoProvider
IExchangeInfoProviderThe exchange boards provider.
Properties
CandleType
The candle type.
public virtual Type CandleType { get; }
Property Value
ExchangeInfoProvider
The exchange boards provider.
protected IExchangeInfoProvider ExchangeInfoProvider { get; }
Property Value
Methods
AddVolume(TCandleMessage, decimal?, Sides?)
Add volume to TotalVolume, BuyVolume, SellVolume, RelativeVolume.
protected static void AddVolume(TCandleMessage candle, decimal? volume, Sides? volSide)
Parameters
CreateCandle(ICandleBuilderSubscription, ICandleBuilderValueTransform)
To create a new candle.
protected virtual TCandleMessage CreateCandle(ICandleBuilderSubscription subscription, ICandleBuilderValueTransform transform)
Parameters
subscription
ICandleBuilderSubscriptionSubscription.
transform
ICandleBuilderValueTransformThe 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
ICandleBuilderSubscriptionSubscription.
candle
TCandleMessageCandle.
transform
ICandleBuilderValueTransformThe data source transformation.
Returns
- TCandleMessage
Candle.
GetTimeZone(ICandleBuilderSubscription)
Get time zone info.
protected (TimeZoneInfo zone, WorkingTime time) GetTimeZone(ICandleBuilderSubscription subscription)
Parameters
subscription
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
ICandleBuilderSubscriptionSubscription.
candle
TCandleMessageCandle.
transform
ICandleBuilderValueTransformThe data source transformation.
Returns
OnProcess(ICandleBuilderSubscription, ICandleBuilderValueTransform)
To process the new data.
protected virtual IEnumerable<TCandleMessage> OnProcess(ICandleBuilderSubscription subscription, ICandleBuilderValueTransform transform)
Parameters
subscription
ICandleBuilderSubscriptionSubscription.
transform
ICandleBuilderValueTransformThe 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
ICandleBuilderSubscriptionSubscription.
transform
ICandleBuilderValueTransformThe 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
ICandleBuilderSubscriptionSubscription.
transform
ICandleBuilderValueTransformThe 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
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
UnitThe price to be made multiple.
subscription
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
decimalThe price to be made multiple.
subscription
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
ICandleBuilderSubscriptionSubscription.
candle
TCandleMessageCandle.
transform
ICandleBuilderValueTransformThe data source transformation.