Class BaseOptimizer
- Namespace
- StockSharp.Algo.Strategies.Optimization
- Assembly
- StockSharp.Algo.dll
The base optimizer of strategies.
public abstract class BaseOptimizer : BaseLogReceiver, IPersistable, ILogReceiver, ILogSource, IDisposable
- Inheritance
-
BaseOptimizer
- Implements
-
IPersistable
- Derived
- Inherited Members
- Extension Methods
Constructors
BaseOptimizer(ISecurityProvider, IPortfolioProvider, IExchangeInfoProvider, IStorageRegistry, StorageFormats, IMarketDataDrive)
Initializes a new instance of the BaseOptimizer.
protected BaseOptimizer(ISecurityProvider securityProvider, IPortfolioProvider portfolioProvider, IExchangeInfoProvider exchangeInfoProvider, IStorageRegistry storageRegistry, StorageFormats storageFormat, IMarketDataDrive drive)
Parameters
securityProvider
ISecurityProviderThe provider of information about instruments.
portfolioProvider
IPortfolioProviderThe portfolio to be used to register orders. If value is not given, the portfolio with default name Simulator will be created.
exchangeInfoProvider
IExchangeInfoProviderExchanges and trading boards provider.
storageRegistry
IStorageRegistryMarket data storage.
storageFormat
StorageFormatsThe format of market data. Binary is used by default.
drive
IMarketDataDriveThe storage which is used by default. By default, DefaultDrive is used.
Properties
AdapterCache
public MarketDataStorageCache AdapterCache { get; set; }
Property Value
EmulationSettings
Emulation settings.
public OptimizerSettings EmulationSettings { get; }
Property Value
ExchangeInfoProvider
public IExchangeInfoProvider ExchangeInfoProvider { get; }
Property Value
IsCancelled
Has the emulator ended its operation due to end of data, or it was interrupted through the Stop() method.
public bool IsCancelled { get; }
Property Value
PortfolioProvider
public IPortfolioProvider PortfolioProvider { get; }
Property Value
SecurityProvider
public ISecurityProvider SecurityProvider { get; }
Property Value
State
The emulator state.
public ChannelStates State { get; }
Property Value
StopOnSubscriptionError
public bool StopOnSubscriptionError { get; set; }
Property Value
StorageCache
public MarketDataStorageCache StorageCache { get; set; }
Property Value
StorageSettings
Storage settings.
public StorageCoreSettings StorageSettings { get; }
Property Value
Methods
AllocateAdapterCache()
Allocate AdapterCache.
protected MarketDataStorageCache AllocateAdapterCache()
Returns
AllocateStorageCache()
Allocate StorageCache.
protected MarketDataStorageCache AllocateStorageCache()
Returns
DisposeManaged()
protected override void DisposeManaged()
FreeAdapterCache(MarketDataStorageCache)
Free AdapterCache.
protected void FreeAdapterCache(MarketDataStorageCache cache)
Parameters
FreeStorageCache(MarketDataStorageCache)
Free StorageCache.
protected void FreeStorageCache(MarketDataStorageCache cache)
Parameters
GetProgress()
Get progress value.
protected abstract int GetProgress()
Returns
- int
Operation result.
OnStart()
Start optimization.
protected void OnStart()
RaiseStopped()
protected void RaiseStopped()
Resume()
To resume the optimization.
public virtual void Resume()
Stop()
To stop optimization.
public virtual void Stop()
Suspend()
To suspend the optimization.
public virtual void Suspend()
TryNextRun(DateTime, DateTime, Func<IPortfolioProvider, (Strategy strategy, IStrategyParam[] parameters)?>, MarketDataStorageCache, MarketDataStorageCache, Action)
Try start next iteration.
protected void TryNextRun(DateTime startTime, DateTime stopTime, Func<IPortfolioProvider, (Strategy strategy, IStrategyParam[] parameters)?> tryGetNext, MarketDataStorageCache adapterCache, MarketDataStorageCache storageCache, Action iterationFinished)
Parameters
startTime
DateTimeDate in history for starting the paper trading.
stopTime
DateTimeDate in history to stop the paper trading (date is included).
tryGetNext
Func<IPortfolioProvider, (Strategy strategy, IStrategyParam[] parameters)?>Handler to try to get next strategy object.
adapterCache
MarketDataStorageCachestorageCache
MarketDataStorageCacheiterationFinished
ActionCallback to notify the iteration was finished.
Events
ConnectorInitialized
public event Action<Connector> ConnectorInitialized
Event Type
SingleProgressChanged
The event of single progress change.
public event Action<Strategy, IStrategyParam[], int> SingleProgressChanged
Event Type
- Action<Strategy, IStrategyParam[], int>
StateChanged
The event on change of paper trade state.
public event Action<ChannelStates, ChannelStates> StateChanged
Event Type
StrategyInitialized
Strategy initialized event.
public event Action<Strategy, IStrategyParam[]> StrategyInitialized
Event Type
TotalProgressChanged
The event of total progress change.
public event Action<int, TimeSpan, TimeSpan> TotalProgressChanged