Instrument lookups, configuration, credentials, CSV entities, snapshots and the alert processing service are read and written asynchronously; the blocking synchronous forms are obsolete wrappers. IAsyncPersistable replaces IPersistable: every type that saves and loads its settings has LoadAsync and SaveAsync only, and nested objects are read with GetValueAsync, LoadEntireAsync and LoadAllAsync. The synchronous Load and Save are the obsolete Ecng extensions. The MultiConnect sample keeps IPersistable for two settings classes, because the settings window of the published StockSharp.Xaml package takes it. Copies that were made by saving and loading are made asynchronously. IMessageAdapter, IIndicator, the risk, commission, PnL, latency, slippage and position managers, IStorageBuffer, Strategy, DiagramElement, ICompositionModel and its nodes get CloneAsync and no longer implement ICloneable; Clone is an obsolete blocking wrapper. A strategy copy keeps every security and portfolio parameter the original holds. Messages, FieldMapping, BankDetails and WithdrawInfo are copied in memory. A CommissionRuleMessage shares its rule and the emulator takes a copy of it. Envelope gets a constructor that takes all three lines and CreateAsync. ToBruteForce and ToBruteForceRandom become ToBruteForceAsync and ToBruteForceRandomAsync and return IAsyncEnumerable; BruteForceOptimizer runs over it and takes the next strategy through an asynchronous delegate. Diagram elements keep their own state in SaveState, OnLoading and LoadState. Undo restores an in-memory snapshot; a chart element holds its series and axes in it by reference. An alert rule keeps its value in the form a message carries it. A diagram strategy applies composition settings that were loaded before the composition was set in SetCompositionAsync or at the start, and saves them while they wait. Strategies get an OnStartedAsync hook; diagram strategies resolve securities, underlyings and strikes before the start so value processing never looks up instruments. Paths.Serialize, SerializeInvariant, AppStartSettings.TrySave, ICredentialsProvider.Save, ISnapshotSerializer.Serialize and the composition registry gain async forms. ICredentialsProvider.Delete becomes DeleteAsync, so loading, saving and deleting the credentials wait for one another. Paths.InstalledVersion and AppNameWithVersion are obsolete in favour of GetInstalledVersionAsync and GetAppNameWithVersionAsync. A file is opened for writing only after the last cancellation check, because opening it empties it; a cancelled read reports the cancellation instead of an empty result. A snapshot flush that failed leaves what it took due for the next one. The indicator templates for C#, F# and Python override LoadAsync and SaveAsync.
StockSharp.Alerts.Interfaces
Overview
StockSharp.Alerts.Interfaces provides the common interfaces and data types required to implement alert systems within the StockSharp trading platform. The package defines a standard way for libraries or applications to create, configure, and deliver notifications when specific trading conditions occur.
This project only contains contracts and helper classes. Actual implementations of notification channels or alert processing engines are expected to be provided by other StockSharp components or by third‑party libraries.
Key Components
The library exposes several core types that can be used to build a fully featured alert system:
AlertNotifications– an enumeration describing possible notification channels such as sound, desktop popups, log files and Telegram.AlertServicesRegistry– static helpers that retrieve alert services from the current dependency injection container.IAlertNotificationService/IDesktopPopupService– interfaces used to send alerts through various channels.IAlertProcessingService– the main contract for managing alert schemas and evaluating incoming messages.AlertRuleField,AlertRuleandAlertSchema– classes used to describe alert conditions and related metadata.
These components are designed to work with StockSharp message types (ExecutionMessage, QuoteChangeMessage, etc.) and rely on other StockSharp assemblies such as StockSharp.BusinessEntities and StockSharp.Messages.
Installation
Alternatively, reference StockSharp.Alerts.Interfaces from your own project by adding the corresponding project or NuGet package reference.
Usage Example
Below is a simplified example illustrating how to create an alert schema and register it with an alert processing service:
using StockSharp.Alerts;
using StockSharp.Messages;
var schema = new AlertSchema(typeof(ExecutionMessage))
{
AlertType = AlertNotifications.Telegram,
Caption = "Large trade",
Message = "A trade larger than expected has appeared",
};
schema.Rules.Add(new AlertRule
{
Field = new AlertRuleField(typeof(ExecutionMessage).GetProperty(nameof(ExecutionMessage.TradePrice))),
Operator = ComparisonOperator.Greater,
Value = 1000m,
});
AlertServicesRegistry.ProcessingService.Register(schema);
When the IAlertProcessingService receives an ExecutionMessage that satisfies the rule, the configured notification service will deliver a message to the selected channel.