OrderBookSpreadWidener

StockSharp.Algo

Symmetric spread widener for QuoteChangeMessage. Collapses every raw level inside the new (wider) spread onto the new visible best; outer levels pass through. Reads current raw book state from an OrderBookSnapshotHolder the caller maintains and emits Increment frames after the initial SnapshotComplete.

Constructors

OrderBookSpreadWidener
public OrderBookSpreadWidener(decimal percent)
orderBookSpreadWidener = OrderBookSpreadWidener(percent)

Initializes a new instance of the OrderBookSpreadWidener class.

percent
Half-spread widening, in percent. Non-positive disables widening.

Properties

IsEnabled
public bool IsEnabled { get; }
value = orderBookSpreadWidener.IsEnabled

if Percent is positive and widening is applied.

Percent
public decimal Percent { get; }
value = orderBookSpreadWidener.Percent

Half-spread widening, in percent.

Methods

Apply
public QuoteChangeMessage Apply(QuoteChangeMessage msg, OrderBookSnapshotHolder holder)
result = orderBookSpreadWidener.Apply(msg, holder)

Reads the current raw book from (the caller must have applied to the holder first) and rewrites it as either a full SnapshotComplete (first call for this security) or an Increment carrying only the changes against the previously-emitted collapsed view.

msg
Incoming order book change message.
holder
Holder of the current raw order book state.

Returns: Collapsed message; the original message when widening is disabled or no raw snapshot is available; or if is .

Collapse
public QuoteChangeMessage Collapse(SecurityId securityId, OrderBookSnapshotHolder holder)
result = orderBookSpreadWidener.Collapse(securityId, holder)

Returns the current collapsed view of as a fresh SnapshotComplete. Pure read — does not touch the diff-state used by OrderBookSnapshotHolder). Useful for replying to a new subscriber without re-emitting deltas from before their subscription.

securityId
Security to build the collapsed snapshot for.
holder
Holder of the current raw order book state.

Returns: Collapsed snapshot, or when widening is disabled or no raw snapshot is available for .

ResetSnapshot
public void ResetSnapshot(SecurityId securityId)
orderBookSpreadWidener.ResetSnapshot(securityId)

Drops the diff-state used to emit increments, forcing the next OrderBookSnapshotHolder) to emit a fresh SnapshotComplete.

securityId
Security to reset, or to reset all securities.