![]() |
VOOZH | about |
dotnet add package StockSharp.Configuration --version 5.0.220
NuGet\Install-Package StockSharp.Configuration -Version 5.0.220
<PackageReference Include="StockSharp.Configuration" Version="5.0.220" />
<PackageVersion Include="StockSharp.Configuration" Version="5.0.220" />Directory.Packages.props
<PackageReference Include="StockSharp.Configuration" />Project file
paket add StockSharp.Configuration --version 5.0.220
#r "nuget: StockSharp.Configuration, 5.0.220"
#:package StockSharp.Configuration@5.0.220
#addin nuget:?package=StockSharp.Configuration&version=5.0.220Install as a Cake Addin
#tool nuget:?package=StockSharp.Configuration&version=5.0.220Install as a Cake Tool
StockSharp.Configuration is a .NET Standard library that centralizes various configuration facilities used by the StockSharp trading platform. It provides classes for storing application paths, loading settings, managing user credentials, and constructing message adapters.
The assembly is titled S#.Configuration and described as "Configuration components."
Paths class defines all important directories and files used by StockSharp. Paths are initialized from PathsHolder and configuration files, as shown below:
var companyPath = PathsHolder.CompanyPath ?? ConfigManager.TryGet<string>("companyPath");
CompanyPath = companyPath.IsEmpty() ? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "StockSharp") : companyPath.ToFullPathIfNeed();
CredentialsFile = Path.Combine(CompanyPath, $"credentials{DefaultSettingsExt}");
PlatformConfigurationFile = Path.Combine(AppDataPath, $"platform_config{DefaultSettingsExt}");
【F:Configuration/Paths.cs†L14-L26】AppStartSettings stores language preference and online/offline mode and can be loaded or saved from the platform configuration file:
public class AppStartSettings : IPersistable
{
public string Language { get; set; } = LocalizedStrings.ActiveLanguage;
public bool Online { get; set; } = true;
public static AppStartSettings TryLoad()
{
var configFile = Paths.PlatformConfigurationFile;
if (configFile.IsEmptyOrWhiteSpace() || !configFile.IsConfigExists())
return null;
return configFile.Deserialize<SettingsStorage>()?.Load<AppStartSettings>();
}
}
【F:Configuration/AppStartSettings.cs†L4-L41】ICredentialsProvider interface allows loading, saving and deleting of ServerCredentials. The default implementation persists credentials in Paths.CredentialsFile:
public interface ICredentialsProvider
{
bool TryLoad(out ServerCredentials credentials);
void Save(ServerCredentials credentials, bool keepSecret);
void Delete();
}
【F:Configuration/ICredentialsProvider.cs†L4-L25】
class DefaultCredentialsProvider : ICredentialsProvider
{
private readonly Lock _lock = new();
private ServerCredentials _credentials;
bool ICredentialsProvider.TryLoad(out ServerCredentials credentials)
{
using (_lock.EnterScope())
{
if(_credentials != null)
{
credentials = _credentials.Clone();
return credentials.CanAutoLogin();
}
var file = Paths.CredentialsFile;
credentials = null;
if (file.IsConfigExists())
{
credentials = new ServerCredentials();
credentials.LoadIfNotNull(file.Deserialize<SettingsStorage>());
_credentials = credentials.Clone();
}
return credentials?.CanAutoLogin() == true;
}
}
}
【F:Configuration/DefaultCredentialsProvider.cs†L3-L38】
InvariantCultureSerializer saves configuration files using the invariant culture and UTF‑8 encoding, enabling culture‑independent settings:
public static class InvariantCultureSerializer
{
public static void SerializeInvariant(this SettingsStorage settings, string fileName, bool bom = true)
{
if (settings is null)
throw new ArgumentNullException(nameof(settings));
Do.Invariant(() => settings.Serialize(fileName, bom));
}
}
【F:Configuration/InvariantCultureSerializer.cs†L3-L23】InMemoryMessageAdapterProvider scans all local assemblies for IMessageAdapter implementations and can create adapters on demand:
public class InMemoryMessageAdapterProvider : IMessageAdapterProvider
{
public InMemoryMessageAdapterProvider(IEnumerable<IMessageAdapter> currentAdapters, Type transportAdapter = null)
{
CurrentAdapters = currentAdapters ?? throw new ArgumentNullException(nameof(currentAdapters));
var idGenerator = new IncrementalIdGenerator();
PossibleAdapters = [.. GetAdapters().Select(t =>
{
try
{
return t.CreateAdapter(idGenerator);
}
catch (Exception ex)
{
ex.LogError();
return null;
}
}).WhereNotNull()];
}
}
【F:Configuration/InMemoryMessageAdapterProvider.cs†L5-L51】Paths class also exposes methods for serialization, backup management and building links to StockSharp documentation and store pages.Paths by setting PathsHolder.CompanyPath and PathsHolder.AppDataPath if your application uses custom directories.AppStartSettings.TryLoad and save them using TrySave.ICredentialsProvider or use DefaultCredentialsProvider to persist server credentials securely.InvariantCultureSerializer when you need stable serialization irrespective of system locale.InMemoryMessageAdapterProvider to dynamically discover available message adapters.| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 5 NuGet packages that depend on StockSharp.Configuration:
| Package | Downloads |
|---|---|
|
StockSharp.Algo
Trading algorithms. More info on web site https://stocksharp.com/store/ |
|
|
StockSharp.Licensing
Licensing components. More info on web site https://stocksharp.com/store/ |
|
|
StockSharp.Server.Core
Core server components. More info on web site https://stocksharp.com/store/ |
|
|
StockSharp.UdpDumper.Console
UDP Dumper. Console version |
|
|
StockSharp.Algo.Compilation
Compilation components. More info on web site https://stocksharp.com/store/ |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.0.220 | 207 | 3/17/2026 |
| 5.0.219 | 137 | 3/6/2026 |
| 5.0.218 | 5,037 | 9/11/2025 |
| 5.0.217 | 906 | 9/1/2025 |
| 5.0.216 | 876 | 8/30/2025 |
| 5.0.215 | 994 | 8/10/2025 |
| 5.0.214 | 1,301 | 7/23/2025 |
| 5.0.213 | 1,286 | 7/20/2025 |
| 5.0.212 | 1,624 | 7/14/2025 |
| 5.0.211 | 829 | 7/8/2025 |
| 5.0.210 | 738 | 7/4/2025 |
| 5.0.209 | 781 | 6/30/2025 |
| 5.0.208 | 1,458 | 6/20/2025 |
| 5.0.207 | 796 | 6/18/2025 |
| 5.0.206 | 908 | 6/2/2025 |
| 5.0.205 | 1,035 | 5/14/2025 |
| 5.0.204 | 1,621 | 3/29/2025 |
| 5.0.203 | 763 | 3/27/2025 |
| 5.0.202 | 1,834 | 2/26/2025 |
| 5.0.201 | 1,783 | 2/14/2025 |