Click or drag to resize

Ticks

TradeGrid - trade table.

Main properties

Below is the appearance of the component, as well as code snippets with its use. The code example is taken from Samples/SampleOEC.

GUI Trade Grid
XAML
<Window x:Class="SampleOEC.MyTradesWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:loc="clr-namespace:StockSharp.Localization;assembly=StockSharp.Localization"
    xmlns:xaml="http://schemas.stocksharp.com/xaml"
    Title="{x:Static loc:LocalizedStrings.MyTrades}" Height="284" Width="644">
  <xaml:MyTradeGrid x:Name="TradeGrid" x:FieldModifier="public" />
</Window>
C#
.......................................

        // create connector
Trader = new OpenECryTrader
{
    //UseNativeReconnect = false,
    EnableOECLogging = true
};

Trader.Restored += () => this.GuiAsync(() =>
{
    // update gui labes
    ChangeConnectStatus(true);
    MessageBox.Show(this, LocalizedStrings.Str2958);
});

// subscribe on connection successfully event
Trader.Connected += () =>
{
    // set flag (connection is established)
    _isConnected = true;

    // update gui labes
    this.GuiAsync(() => ChangeConnectStatus(true));

    // subscribe on news
    Trader.RegisterNews();
};

// subscribe on connection error event
Trader.ConnectionError += error => this.GuiAsync(() =>
{
    // update gui labes
    ChangeConnectStatus(false);

    MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2959);    
});

Trader.Disconnected += () => this.GuiAsync(() => ChangeConnectStatus(false));

// subscribe on error event
Trader.Error += error => this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str2955));

Trader.NewSecurity += security => _securitiesWindow.SecurityPicker.Securities.Add(security);
Trader.NewMyTrade += trade => _myTradesWindow.TradeGrid.Trades.Add(trade);
Trader.NewTrade += trade => _tradesWindow.TradeGrid.Trades.Add(trade);
Trader.NewOrder += order => _ordersWindow.OrderGrid.Orders.Add(order);
Trader.NewStopOrder += order => _stopOrdersWindow.OrderGrid.Orders.Add(order);
Trader.NewPortfolio += portfolio =>
{
    _portfoliosWindow.PortfolioGrid.Portfolios.Add(portfolio);

    // subscribe on portfolio updates
    Trader.RegisterPortfolio(portfolio);
};
Trader.NewPosition += position => _portfoliosWindow.PortfolioGrid.Positions.Add(position);

// subscribe on error of order registration event
Trader.OrderRegisterFailed += _ordersWindow.OrderGrid.AddRegistrationFail;
// subscribe on error of order cancelling event
Trader.OrderCancelFailed += OrderFailed;

// subscribe on error of stop-order registration event
Trader.StopOrderRegisterFailed += _stopOrdersWindow.OrderGrid.AddRegistrationFail;
// subscribe on error of stop-order cancelling event
Trader.StopOrderCancelFailed += OrderFailed;

Trader.MassOrderCancelFailed += (transId, error) =>
    this.GuiAsync(() => MessageBox.Show(this, error.ToString(), LocalizedStrings.Str716));

Trader.NewNews += news => _newsWindow.NewsPanel.NewsGrid.News.Add(news);
.......................................
}