OrderBook

StockSharp.MatchingEngine

Order book implementation.

Реализует: IOrderBook

Конструкторы

OrderBook(SecurityId)

Order book implementation.

Свойства

AskLevels : int

Number of ask levels.

BestAsk : ValueTuple?<decimal, decimal>

Get best ask price and volume.

BestBid : ValueTuple?<decimal, decimal>

Get best bid price and volume.

BidLevels : int

Number of bid levels.

SecurityId : SecurityId

SecurityId

TotalAskVolume : decimal

Total volume of all asks.

TotalBidVolume : decimal

Total volume of all bids.

Методы

AddQuote(EmulatorOrder)

Add a quote to the order book.

order
Order or market quote to add. If TransactionId is default, it is treated as a market quote.
Clear(Sides)

Clear all quotes for a specific side.

side
Side to clear.
Clear()

Clears all adapter states and resets current state to Disconnected.

ConsumeVolume(Sides, decimal?, decimal) : IEnumerable<ValueTuple<decimal, decimal, IReadOnlyList<EmulatorOrder>>>

Consume volume from best levels (for matching).

side
Side to consume from (opposite to order side).
maxPrice
Maximum price for buy / minimum for sell.
volume
Volume to consume.

Возвращает: Executions (price, volume, affected orders).

GetLevels(Sides) : IEnumerable<OrderBookLevel>

Get quotes for a side, ordered by price (best first).

side
Side to retrieve levels for.
GetOrdersAtPrice(Sides, decimal) : IEnumerable<EmulatorOrder>

Get all user orders at a specific price level.

side
Side to query.
price
Price level to query.
GetTotalVolume(Sides) : decimal

Get total volume for a side.

side
Side to get total volume for.
GetVolumeAtPrice(Sides, decimal) : decimal

Get volume at a specific price level.

side
Side to query.
price
Price level to query.
GetWorstAsk() : ValueTuple?<decimal, decimal>

Get worst (highest) ask level.

GetWorstBid() : ValueTuple?<decimal, decimal>

Get worst (lowest) bid level.

HasLevel(Sides, decimal) : bool

Check if there's a quote at the specified price.

side
Side to check.
price
Price level to check.
RemoveLevel(Sides, decimal) : IEnumerable<EmulatorOrder>

Remove entire level at price.

side
Side to remove level from.
price
Price level to remove.

Возвращает: Removed orders that were present at that level.

RemoveQuote(long, Sides, decimal) : bool

Remove a quote from the order book.

transactionId
Transaction id of the order to remove.
side
Side (buy/sell) where the order is placed.
price
Price level of the order.

Возвращает: True if removed, false if not found.

SetSnapshot(IEnumerable<QuoteChange>, IEnumerable<QuoteChange>)

Set the order book from a snapshot (replaces all non-user quotes).

bids
Sequence of bid quote changes to set.
asks
Sequence of ask quote changes to set.
ToMessage(DateTime, DateTime) : QuoteChangeMessage

Create a QuoteChangeMessage from current state.

localTime
Local time to set on the generated message.
serverTime
Server time to set on the generated message.
TrimToDepth(Sides, int) : IEnumerable<EmulatorOrder>

Remove worst levels that exceed max depth.

side
Side to trim.
maxDepth
Maximum allowed depth to keep.

Возвращает: Removed orders from trimmed levels.

TryRemoveOrder(long, Sides, EmulatorOrder) : bool

Find and remove order by transaction ID from any level.

UpdateLevel(Sides, decimal, decimal)

Update volume at a price level (for market quotes).

side
Side to update.
price
Price level to update.
volume
New market volume at the level.