Table of Contents

Interface IL2OrderBook<A, L>

Namespace
Virtufin.Core.Position
Assembly
Virtufin.Core.dll

A Level-2 (market-by-price) order book: aggregated price levels per side. A is the depth (size) amount type and L the level (price) amount type.

public interface IL2OrderBook<A, L> : IOrderBook where A : IFixedPointAmount where L : IFixedPointAmount

Type Parameters

A
L

Remarks

The two dimensions carry independent, fixed scales: LevelBase/LevelPrecision for prices and DepthBase/DepthPrecision for sizes. They need not match (a book quoted in ticks to 2 decimal places may size in lots to 6), and values are never compared across the two dimensions.

Enumeration is best-first: bids highest price first, asks lowest price first.

Properties

AsksAscending

Ask levels, lowest price first.

IReadOnlyList<(L Price, A Size)> AsksAscending { get; }

Property Value

IReadOnlyList<(L Price, A Size)>

BidsDescending

Bid levels, highest price first.

IReadOnlyList<(L Price, A Size)> BidsDescending { get; }

Property Value

IReadOnlyList<(L Price, A Size)>

DepthBase

Base of the size (depth) dimension.

int DepthBase { get; }

Property Value

int

DepthPrecision

Precision of the size (depth) dimension.

int DepthPrecision { get; }

Property Value

int

LevelBase

Base of the price (level) dimension.

int LevelBase { get; }

Property Value

int

LevelPrecision

Precision of the price (level) dimension.

int LevelPrecision { get; }

Property Value

int

Methods

TryGetAsk(L, out A)

Look up the aggregate size at an ask price.

bool TryGetAsk(L price, out A size)

Parameters

price L

Price at the book's level scale.

size A

The level's aggregate size when present.

Returns

bool

TryGetBid(L, out A)

Look up the aggregate size at a bid price.

bool TryGetBid(L price, out A size)

Parameters

price L

Price at the book's level scale.

size A

The level's aggregate size when present.

Returns

bool