Table of Contents

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 ISecurityProvider

The provider of information about instruments.

portfolioProvider IPortfolioProvider

The portfolio to be used to register orders. If value is not given, the portfolio with default name Simulator will be created.

exchangeInfoProvider IExchangeInfoProvider

Exchanges and trading boards provider.

storageRegistry IStorageRegistry

Market data storage.

storageFormat StorageFormats

The format of market data. Binary is used by default.

drive IMarketDataDrive

The storage which is used by default. By default, DefaultDrive is used.

Properties

AdapterCache

public MarketDataStorageCache AdapterCache { get; set; }

Property Value

MarketDataStorageCache

EmulationSettings

Emulation settings.

public OptimizerSettings EmulationSettings { get; }

Property Value

OptimizerSettings

ExchangeInfoProvider

public IExchangeInfoProvider ExchangeInfoProvider { get; }

Property Value

IExchangeInfoProvider

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

bool

PortfolioProvider

public IPortfolioProvider PortfolioProvider { get; }

Property Value

IPortfolioProvider

SecurityProvider

public ISecurityProvider SecurityProvider { get; }

Property Value

ISecurityProvider

State

The emulator state.

public ChannelStates State { get; }

Property Value

ChannelStates

StopOnSubscriptionError

public bool StopOnSubscriptionError { get; set; }

Property Value

bool

StorageCache

public MarketDataStorageCache StorageCache { get; set; }

Property Value

MarketDataStorageCache

StorageSettings

Storage settings.

public StorageCoreSettings StorageSettings { get; }

Property Value

StorageCoreSettings

Methods

AllocateAdapterCache()

Allocate AdapterCache.

protected MarketDataStorageCache AllocateAdapterCache()

Returns

MarketDataStorageCache

AdapterCache

AllocateStorageCache()

Allocate StorageCache.

protected MarketDataStorageCache AllocateStorageCache()

Returns

MarketDataStorageCache

StorageCache

DisposeManaged()

protected override void DisposeManaged()

FreeAdapterCache(MarketDataStorageCache)

protected void FreeAdapterCache(MarketDataStorageCache cache)

Parameters

cache MarketDataStorageCache

AdapterCache

FreeStorageCache(MarketDataStorageCache)

protected void FreeStorageCache(MarketDataStorageCache cache)

Parameters

cache MarketDataStorageCache

StorageCache

GetProgress()

Get progress value.

protected abstract int GetProgress()

Returns

int

Operation result.

OnStart()

Start optimization.

protected void OnStart()

RaiseStopped()

Set State to Stopped.

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 DateTime

Date in history for starting the paper trading.

stopTime DateTime

Date 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 MarketDataStorageCache

AdapterCache

storageCache MarketDataStorageCache

StorageCache

iterationFinished Action

Callback to notify the iteration was finished.

Events

ConnectorInitialized

Init Connector. Called before Connect().

public event Action<Connector> ConnectorInitialized

Event Type

Action<Connector>

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

Action<ChannelStates, ChannelStates>

StrategyInitialized

Strategy initialized event.

public event Action<Strategy, IStrategyParam[]> StrategyInitialized

Event Type

Action<Strategy, IStrategyParam[]>

TotalProgressChanged

The event of total progress change.

public event Action<int, TimeSpan, TimeSpan> TotalProgressChanged

Event Type

Action<int, TimeSpan, TimeSpan>