Table of Contents

Interface IL2OrderBookWriter<A, L>

Namespace
Virtufin.Base.OrderBooks
Assembly
Virtufin.Base.dll

Mutable surface of an IL2OrderBook<A, L>, used by Level2OrderBookUpdater<TBook, A, L, S, D>. Kept separate from the read-only Core trait so consumers of a book cannot mutate it by accident.

public interface IL2OrderBookWriter<A, L> where A : IFixedPointAmount where L : IFixedPointAmount

Type Parameters

A

Depth (size) amount type.

L

Level (price) amount type.

Properties

AppliedFinalUpdateId

Final update id of the most recently applied diff, or -1.

long AppliedFinalUpdateId { get; }

Property Value

long

AppliedFirstUpdateId

First update id of the most recently applied diff, or -1.

long AppliedFirstUpdateId { get; }

Property Value

long

LastUpdateId

The last applied update id (or the bootstrapping snapshot's id).

long LastUpdateId { get; }

Property Value

long

State

Current lifecycle state.

OrderBookState State { get; }

Property Value

OrderBookState

Methods

ApplyLevel(bool, L, A)

Apply one level mutation: a zero size removes the price, otherwise the size is assigned (absolute, not incremental).

void ApplyLevel(bool isBid, L price, A size)

Parameters

isBid bool

true for the bid side, false for asks.

price L

Level price.

size A

New aggregate size; zero removes the level.

Clear()

Remove every level.

void Clear()

ResetAppliedRange()

Clear the recorded applied id range (e.g. after a snapshot).

void ResetAppliedRange()

SetAppliedRange(long, long)

Record the id range of the most recently applied diff.

void SetAppliedRange(long firstUpdateId, long finalUpdateId)

Parameters

firstUpdateId long

Diff's first update id.

finalUpdateId long

Diff's final update id.

SetLastUpdateId(long)

Set the last applied update id.

void SetLastUpdateId(long lastUpdateId)

Parameters

lastUpdateId long

New update id.

SetState(OrderBookState)

Set the lifecycle state.

void SetState(OrderBookState state)

Parameters

state OrderBookState

New state.