The applications moved every host into a folder of its own, so the projects the from-source samples reference are under Xaml\Avalonia and Xaml\Wpf now, and the FIX connector they named lives in the public connectors repository. Nine WPF samples still named Xaml and Xaml.Charting where they were before: a missing project reference is only a warning, so they failed later, at the first DevExpress or StockSharp tag of their markup. The MultiConnect samples sign in through the window the WPF head has. That head keeps the credentials window in Studio.WebApi.UI, taking the site's client service; the samples asked StockSharp.Xaml for one taking a fetcher, which the head does not have, and did not compile from sources. The published UI packages are far behind the sources and are not what the samples are kept in step with: the package-based projects of these samples compile once the WPF packages built from that head are published. The WPF samples await the connector's settings window, which the WPF library offers as ConfigureAsync only, and the active-orders sample awaits the chart's save instead of the obsolete blocking wrapper. The package-based projects of the same samples compile once a StockSharp.Xaml package that has ConfigureAsync is published. The Avalonia samples keep the connection settings through the awaited store: IConnectorSettingsStore reads and writes through awaited members now, so the sample store reads or writes its file when it is asked instead of reading both files up front and queueing its writes. The chart sample saves and loads its chart the same way. Eight Avalonia samples put the wheel date picker into columns of 150-170 pixels. It does not get narrower than about three hundred, so the two of them ran over each other and over the Start and Stop buttons. They take the compact calendar editor now, which the history testing sample already had.
StockSharp Trading Connection
Overview
This repository contains a .NET application using the StockSharp trading framework to connect, configure, and interact with trading securities. It provides UI logic through the MainWindow.xaml interface.
Features
- Connection Management: Establish and manage connections with trading services.
- Settings Configuration: Load and save connection settings from a JSON configuration file.
- Security Interaction: Select and subscribe to securities to receive updates.
Getting Started
Installation
- Clone the repository.
- Open the solution in Visual Studio.
- Find and add required connector via NuGet package
- Build and run the application.
Usage
- Launch the application.
- Use the "Settings" button to configure the connection settings.
- Connect to the trading service using the "Connect" button.
- Select a security from the dropdown to start receiving updates.
Configuration
The application uses a JSON file (ConnectorFile.json) for loading and saving configuration settings related to the trading connection.
private const string _connectorFile = "ConnectorFile.json";
This variable holds the path to the configuration file.
Code Explanation
Constructor
The constructor initializes the component and loads settings if the configuration file exists.
public MainWindow()
{
InitializeComponent();
if (File.Exists(_connectorFile))
{
_connector.Load(_connectorFile.Deserialize<SettingsStorage>());
}
}
Setting_Click Event Handler
This method is triggered when the "Settings" button is clicked. It opens a configuration dialog and saves the settings if the user confirms them.
private void Setting_Click(object sender, RoutedEventArgs e)
{
if (_connector.Configure(this))
{
_connector.Save().Serialize(_connectorFile);
}
}
Connect_Click Event Handler
This method is responsible for starting the connection process. It assigns providers to the SecurityPicker and initiates the connection.
private void Connect_Click(object sender, RoutedEventArgs e)
{
SecurityPicker.SecurityProvider = _connector;
SecurityPicker.MarketDataProvider = _connector;
_connector.Connected += Connector_Connected;
_connector.Connect();
}
Connector_Connected Event Handler
Triggered when the connection is successfully established. It performs an initial lookup of securities.
private void Connector_Connected()
{
// try lookup all securities
_connector.Subscribe(new(StockSharp.Messages.Extensions.LookupAllCriteriaMessage));
}
SecurityPicker_SecuritySelected Event Handler
Handles the event when a security is selected from the security picker. It subscribes to Level 1 data for the selected security.
private void SecurityPicker_SecuritySelected(Security security)
{
if (security == null) return;
_connector.Subscribe(new(DataType.Level1, security));
}