66 Commits
Author SHA1 Message Date
mika@stocksharp.com 9db6c0b9f9 Report cleanup failures and release Avalonia sample resources in order 2026-12-05 18:45:37 +03:00
mika@stocksharp.com 3b814d26d2 Samples: build from the applications' sources again and follow the awaited API
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.
2026-10-15 23:02:33 +03:00
mika@stocksharp.com 6e7a7dae22 Move instrument lookups and persistence to async
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.
2026-10-04 11:28:17 +03:00
mika@stocksharp.com c2e9365fac Give three Avalonia samples the namespaces they compile against
Two of them call CancellationToken.None without importing System.Threading. The third names EventSubscription without importing StockSharp.Xaml, and inside a window that name then binds to the nested type a window inherits from Avalonia Interactive, which is not accessible; every other sample that uses it imports the namespace. None of the three built.
2026-09-15 00:11:49 +03:00
mika@stocksharp.com 1915a2ecb3 Put every sample on the library, and both heads in one place
The Avalonia samples were written before the shared Avalonia stack existed and
had grown their own copies of what it already does: connector setup, event
routing to the UI thread, dispatcher plumbing. Each copy was a second answer to
a question the library had answered, and the two drifted. They use the library
now, and where a sample needed something the library did not expose - a
UI-thread event subscription, a connector-settings store - that piece moved into
the shared layer rather than staying a sample's private helper, so an
application gets it too.

They also lived in a tree of their own, SamplesAvalonia, mirroring the folder
names of Samples exactly. A reader who wanted to compare the two versions of one
example had to know that the trees mirrored each other and navigate both, and
nothing in either tree said the other existed. It is one tree now: each example's
Avalonia version sits in the same area folder as its WPF version, next to it.

The WPF samples keep the names and folders they have always had, so every link
and path that points at them still resolves. It is the Avalonia version that
says which head it is - 01_HistorySMA_Avalonia beside 01_HistorySMA, and
01_Strategies.HistorySMA_Avalonia beside 01_Strategies.HistorySMA, with the
source-built twins following as _Avalonia_fromsrc.

That suffix reaches the assembly name, which is what makes the two builds
distinguishable, but not the root namespace: the sources and their x:Class
declarations keep the namespace they have, so nothing inside the samples had to
change. The namespaces do follow the rename that separated assembly names from
namespaces, and the history samples ask for a UTC day instead of the machine's,
which is what the storage is keyed by - a sample run west of UTC asked for the
wrong day.

All 63 examples - 35 WPF and 28 Avalonia - are now in Samples.slnx and in
StockSharp.slnx, and in StockSharp_CI.slnx, which is the solution the Windows CI
job builds: the Avalonia samples were in no solution at all, so nothing ever
checked that they still compiled.

The tests that read the sample sources - counting files, matching strings in
markup, asserting a project reference exists - are gone. They restated the tree
rather than running anything in it, so they passed for samples that could not
start and failed for edits that changed nothing.
2026-09-07 01:29:21 +03:00
mika@stocksharp.com ebdb3b6c0b Update sample source paths for nested Xaml projects 2026-08-28 18:16:38 +03:00
mika@stocksharp.com fba1415c37 Clear the compiler warnings in the samples
Strategy.Start/Stop are obsolete in favour of StartAsync/StopAsync. Where the
caller was already async it now awaits. Where it is a click handler or a
void-returning event delegate it cannot await, so the call follows the pattern
BaseOptimizer already uses for the same situation: launch the task and report
only its failure, rather than blocking the caller or turning it into async void.

SmaServerStopStrategy declared a private OnOrderChanged that hid the virtual hook
of the same name, then subscribed to OrderReceived by hand to reach it - so the
framework hook sat dead. It is an override now and the manual subscription is
gone. The Designer template copy had the same defect.

MarketQuotingStrategy is obsolete in favour of QuotingProcessor, which is not a
Strategy and so cannot be handed to the sample's strategy editor. The terminal
sample gets a small strategy of its own that drives the processor.
2026-07-31 18:35:55 +03:00
mika@stocksharp.com 9be8fc871a Optimization sample: suspend running backtests on Pause, give the Pause button visible feedback, and enable Server GC. 2026-06-03 19:47:31 +03:00
mika@stocksharp.com 712fa5747a Optimization sample: enable the Pause button during a run
When starting the optimization SetIsEnabled was called with canSuspend=false, so
the Pause button stayed disabled for the whole run even though BaseOptimizer
supports Pause/Resume (the click handler was already wired). Pass canSuspend=true
so the button is active while the optimization is running.
2026-06-01 23:13:46 +03:00
mika@stocksharp.com beb2f31489 Optimization sample: fill Progress and P&L columns in the results grid
The result panel was driven in the wrong order: AddStrategy was called only at
100% (end of each iteration) while UpdateProgress was called for 1..99%.
StrategiesStatisticsPanel both registers the strategy in its lookup map and
subscribes to the strategy PnL feed inside AddStrategy. Calling it last meant
UpdateProgress had no row to update (so Progress stayed 0) and the PnL
subscription was attached only after the backtest had already finished (so the
equity sparkline stayed empty).

Register the strategy on its first progress event (deduped by Strategy.Id) and
only update progress afterwards, matching how the Designer optimizer panel uses
the control. Now the Progress column climbs to 100% and the P&L chart is filled
while the run is in progress.
2026-06-01 23:13:35 +03:00
mika@stocksharp.com 0bcf594d25 Use Ecng Common extensions across codebase
Replace standard .NET APIs with Ecng.Common equivalents:
- Math.Min/Max/Abs/Round → .Min()/.Max()/.Abs()/.Round()
- string.IsNullOrEmpty → .IsEmpty()
- string.Format → .Put()
- Encoding.UTF8 → .UTF8()
- Enum.GetValues → Enumerator.GetValues<T>()
2026-03-29 17:04:00 +03:00
mika@stocksharp.com def2fb9c31 Update history testing sample: extract message variable for readability 2026-03-17 10:06:49 +03:00
mika@stocksharp.com 3ea2a3866a Add stop order Replace support and SmaServerStopStrategy 2026-03-05 17:56:13 +03:00
mikasoukhov c512b26107 build fix. 2026-02-09 01:37:16 +03:00
mikasoukhov cad197bfe5 Code cleanup. 2026-02-09 01:36:59 +03:00
mikasoukhov 972d6eb545 Code cleanup. 2026-01-12 02:34:19 +03:00
mikasoukhov b7ac390a6f Report generation 2026-01-11 22:12:37 +03:00
mikasoukhov 689f66bf79 Code cleanup. 2026-01-11 21:37:02 +03:00
mikasoukhov a7e808991e Add _fromsrc.csproj for console history sample 2026-01-10 01:58:35 +03:00
mikasoukhov 514047032c Add console history backtesting sample (04_Testing.HistoryConsole) 2026-01-10 01:46:35 +03:00
mikasoukhov 798f10c6e2 build fix 2026-01-07 13:49:44 +03:00
mikasoukhov b9996dcc37 StrategyParamHelper. Optimization values generation. 2026-01-04 02:08:21 +03:00
mikasoukhov ca6d4de17c build fix. 2025-12-30 23:55:07 +03:00
mikasoukhov 450fe68a0e Updated samples and tests for IFileSystem API. 2025-12-26 03:31:29 +03:00
mikasoukhov f6d48aef4d IMessageAdapter. SendInMessage fully replaced by SendInMessageAsync 2025-12-11 01:30:01 +03:00
mikasoukhov 260cc53015 Themes fixes. 2025-12-01 09:20:08 +03:00
mikasoukhov 25e621a4cf DateTimeOffset -> DateTime UTC 2025-11-02 18:40:36 +03:00
mikasoukhov 88d767b9b3 Code cleanup. 2025-10-10 00:11:55 +03:00
mikasoukhov f4e8367eec Sample optimization. Random search supported. 2025-10-10 00:03:23 +03:00
mikasoukhov 646b7f2ca0 Fix commit d3b53a9ddb 2025-10-05 13:14:38 +03:00
mikasoukhov d3b53a9ddb Code cleanup. 2025-10-04 22:37:48 +03:00
mikasoukhov 89f80f060e Code cleanup. 2025-10-04 15:29:29 +03:00
mikasoukhov 11ba75d47e Fix commit 8b751cda4d 2025-07-05 19:57:17 +03:00
mikasoukhov 8b751cda4d Strategy. Bind is decimal? 2025-07-05 01:08:02 +03:00
mikasoukhov e91af1f612 Code cleanup. 2025-06-26 00:52:11 +03:00
mikasoukhov 5a8d6cef03 Code cleanup. 2025-05-20 06:38:07 +03:00
mikasoukhov ee446ed1ea Fix commit 3c5760f0f7 2025-03-29 17:06:23 +03:00
mikasoukhov d36a9f5394 Fix commit 5f87bb1ae1 2025-03-25 19:33:15 +03:00
mikasoukhov b856fb4987 Use Subscribe method directly. 2025-03-22 11:00:23 +03:00
mikasoukhov 176560af66 Candles as primary option. 2025-03-15 17:40:29 +03:00
mikasoukhov 206ae52b46 Paths. HistoryDefaultSecurity 2025-03-15 17:36:57 +03:00
mikasoukhov 806dff7095 CandleDataTypeEdit 2025-03-12 20:16:02 +03:00
mikasoukhov b2f2bab7bc Fix commit 39ad42ec56 2025-03-08 18:14:25 +03:00
mikasoukhov e2d7648281 Fix commit 44282d0c50 2025-03-08 15:48:43 +03:00
mikasoukhov f5aeb8e886 Small changes. 2025-03-06 17:58:20 +03:00
mikasoukhov 44282d0c50 Reduced usage ITransactionProvider obsolete events. 2025-03-06 15:45:05 +03:00
mikasoukhov a461ff4c5e StrategyParam. Validator replaced by Attributes property. 2025-02-05 10:33:36 +03:00
mikasoukhov 1c5e8a63ef Logging moved to Ecng. 2025-02-04 18:00:35 +03:00
mikasoukhov 31595e9afa StrategyParam. Name, Description, Category replaced by DisplayAttribute. 2025-02-02 19:06:08 +03:00
mikasoukhov 6a95122ae9 ILogReceiver. LogDebug, LogError, LogInfo, LogWarning, LogVerbose methods. 2025-01-22 18:01:19 +03:00