Click or drag to resize

Order book

GUI MarketDepthControl

MarketDepthControl - is a graphical component for displaying an order book. The component allows you to display quotes and own orders.

Main properties and methods

  • MaxDepth - the depth of an order book.

  • IsBidsOnTop - to display purchases on top.

  • UpdateFormat(Security) - to update the format for displaying prices and volumes using the instrument.

  • ProcessOrder(Order, Decimal, OrderStates) - to process an order.

  • UpdateDepth(MarketDepth) - to refresh an order book.

  • UpdateDepth(QuoteChangeMessage) - to refresh an order book with a message.

Below is the code snippet with its use. The code example is taken from Samples/BarChart/SampleBarChart.

XAML
<Window x:Class="SampleBarChart.QuotesWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:xaml="http://schemas.stocksharp.com/xaml"
    Title="QuotesWindow" Height="600" Width="280">
  <xaml:MarketDepthControl x:Name="DepthCtrl" x:FieldModifier="public" />
</Window>
C#
private void ConnectorOnMarketDepthsChanged(IEnumerable<MarketDepth> depths)
{
    foreach (var depth in depths)
    {
        var wnd = _quotesWindows.TryGetValue(depth.Security);

        if (wnd != null)
            wnd.DepthCtrl.UpdateDepth(depth);
    }
}