StockSharp.Algo
5.0.240
Prefix Reserved
See the version list below for details.
dotnet add package StockSharp.Algo --version 5.0.240
NuGet\Install-Package StockSharp.Algo -Version 5.0.240
<PackageReference Include="StockSharp.Algo" Version="5.0.240" />
<PackageVersion Include="StockSharp.Algo" Version="5.0.240" />
<PackageReference Include="StockSharp.Algo" />
paket add StockSharp.Algo --version 5.0.240
#r "nuget: StockSharp.Algo, 5.0.240"
#:package StockSharp.Algo@5.0.240
#addin nuget:?package=StockSharp.Algo&version=5.0.240
#tool nuget:?package=StockSharp.Algo&version=5.0.240
StockSharp Algo Library
Overview
StockSharp.Algo is the core algorithmic trading library used throughout the StockSharp platform. It provides the building blocks for creating trading bots, managing market data, handling order routing, and simulating strategies against historical data. The library targets .NET 6.0 and can be used in desktop, server, or cloud applications.
Features
- Connectors and Message Adapters – unified infrastructure for connecting to exchanges and data feeds. Includes offline adapters for simulation and adapters for incremental order books, snapshots, and extended order information.
- Strategy Framework – base classes for building algorithmic strategies with built‑in event model, parameter system, and rule management. Strategies can be composed and executed in parallel or as baskets.
- Market Data Storages – tools for storing quotes, trades, candles, and order books in various formats (binary, CSV) with caching and synchronization support.
- Risk and PnL – modules for risk management, slippage modeling, commission calculation, and real‑time profit‑and‑loss tracking.
- Testing and Emulation – historical emulation connectors and market data generators for backtesting strategies under conditions close to real trading.
- Services Registry – helper class to access common services (exchanges, securities, storages) across the application.
Getting Started
Prerequisites
- .NET SDK 6.0 or later.
- Visual Studio 2022 or any compatible IDE.
Basic Usage
The typical entry point for working with the library is the Connector class. Below is a very simplified example that demonstrates how to run a custom strategy using historical data:
using StockSharp.Algo;
using StockSharp.Algo.Strategies;
using StockSharp.Algo.Testing;
var connector = new HistoryEmulationConnector(securityProvider, portfolioProvider, storageRegistry);
var myStrategy = new MyStrategy { Connector = connector, Portfolio = myPortfolio, Security = mySecurity };
connector.NewStrategy += strategy => strategy.Start();
connector.Connect();
A full‑fledged application will include market data subscriptions, order registration, and more advanced strategy logic.
Documentation
Comprehensive documentation for the API and subsystems is available at the StockSharp documentation website.
Support
Questions and discussions are welcome in the community chat.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Ecng.Compilation (>= 1.0.341)
- Ecng.IO.Compression (>= 1.0.56)
- Ecng.Linq (>= 1.0.194)
- Ecng.Net (>= 1.0.551)
- Ecng.StringSearch (>= 1.0.270)
- MathNet.Numerics (>= 6.0.0-beta2)
- StockSharp.Charting.Interfaces (>= 5.0.111)
- StockSharp.Configuration (>= 5.0.231)
- StockSharp.Reporting (>= 5.0.10)
NuGet packages (11)
Showing the top 5 NuGet packages that depend on StockSharp.Algo:
| Package | Downloads |
|---|---|
|
StockSharp.Xaml.Diagram
Visual designer to create trading strategies. More info on web site https://stocksharp.com/store/ |
|
|
StockSharp.QuikLua
Trading and algorithmic trading platform (stock markets, forex, bitcoins and options). .NET API for InteractiveBrokers, GainCapital, OANDA, FIX/FAST, Binance etc. More info on web site https://stocksharp.com/products/api/ |
|
|
StockSharp.Algo.Import
Import data providers. More info on web site https://stocksharp.com/store/ |
|
|
StockSharp.Algo.Indicators
Technical indicators. More info on web site https://stocksharp.com/store/ |
|
|
StockSharp.Algo.Testing
Backtesting components. More info on web site https://stocksharp.com/store/ |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.0.241 | 161 | 10/25/2026 |
| 5.0.240 | 116 | 10/24/2026 |
| 5.0.239 | 684 | 9/13/2026 |
| 5.0.238 | 330 | 9/9/2026 |
| 5.0.237 | 316 | 8/26/2026 |
| 5.0.236 | 221 | 8/26/2026 |
| 5.0.235 | 309 | 8/20/2026 |
| 5.0.234 | 333 | 8/18/2026 |
| 5.0.233 | 295 | 8/15/2026 |
| 5.0.232 | 233 | 8/11/2026 |
| 5.0.231 | 292 | 7/30/2026 |
| 5.0.230 | 262 | 7/28/2026 |
| 5.0.229 | 6,181 | 9/11/2025 |
| 5.0.228 | 763 | 9/1/2025 |
| 5.0.227 | 607 | 8/30/2025 |
| 5.0.226 | 782 | 8/10/2025 |
| 5.0.225 | 1,180 | 7/23/2025 |
| 5.0.224 | 867 | 7/22/2025 |
| 5.0.223 | 745 | 7/20/2025 |
| 5.0.222 | 1,417 | 7/14/2025 |
Unit properties that refuse no value are marked required
Build requested candle series with calendar bounds and accurate source updates
Localize public core enum captions with Display resources
Read each day of a count-from-end window once, built candles too
Count a count-from-end window up to its end, by the days' headers
Take the storages' blocking readers back to ToBlockingEnumerable
Connector: a request for orders it already holds no longer puts an order back to an older state
Subscriptions: whoever joined a shared orders stream gets live orders once it is live
Connector: a subscription restored by a reconnect receives data again
Connector: a chain assigned as a whole shares the basket's id generator
CsvExtendedInfoStorage: make the directory that is read
Hand the remote storage client's transport one message at a time
Read storages from blocking callers without the caller's synchronization context
Fail a history request the lost connection took with it
Tell a second subscriber its hist+live subscription started
Connect the remote storage client once for requests made at once
Unwind the blocking waits left by the async rework and fix what it uncovered
Mark the blocking wrappers obsolete
Add walk-forward optimization, a market profile, three statistics and candle spread options
Move instrument lookups and persistence to async
Let a formula's assembly go with the block that compiled it
Keep a basket's pending unsubscribes apart from the requests it numbers itself
Keep sending the heartbeat on a link that only receives
Await security lookups instead of blocking on them
Report the emulated account to the connector, floating profit included
Answer an unsubscribe that arrives after the connection ended
Answer the unsubscribe of a candle series that finished on its own
Keep the storages of entities readable across runs and before the first write
Deliver every candle that opens at the same instant as a finished one
Check that values do something, not merely that they travel
Probe a connection only once it has gone quiet, and notice when it hangs up
Persist the period a local drive holds its data types for
Take the storage processor lock the way the codebase states it
Retire adapter subscription ids without stranding the next one
Bound and release what storage subscriptions remember
Remove dead extended security collection path
Correct derivatives and option calculations
Correct trading accounting risk and timing
Fix adapter routing and subscription lifecycles
Make candle and storage processing reliable
Updated Ecng.Compilation to 1.0.341.
Updated Ecng.IO.Compression to 1.0.56.
Updated Ecng.Linq to 1.0.194.
Updated Ecng.Net to 1.0.551.
Updated Ecng.StringSearch to 1.0.270.