HistoryEmulationConnector

StockSharp.Algo.Testing

The emulation connection. It uses historical data and/or occasionally generated.

Inherits: BaseEmulationConnector

Constructors

HistoryEmulationConnector
public HistoryEmulationConnector(IMessageAdapter innerAdapter, bool ownInnerAdapter, IMessageChannel inChannel, ISecurityProvider securityProvider, IPortfolioProvider portfolioProvider, IExchangeInfoProvider exchangeInfoProvider)
historyEmulationConnector = HistoryEmulationConnector(innerAdapter, ownInnerAdapter, inChannel, securityProvider, portfolioProvider, exchangeInfoProvider)

Initializes a new instance of the HistoryEmulationConnector.

innerAdapter
Underlying adapter.
ownInnerAdapter
Control lifetime.
inChannel
Incoming messages channel.
securityProvider
The provider of information about instruments.
portfolioProvider
The portfolio to be used to register orders. If value is not given, the portfolio with default name Simulator will be created.
exchangeInfoProvider
Exchanges and trading boards provider.
HistoryEmulationConnector
public HistoryEmulationConnector(ISecurityProvider securityProvider, IPortfolioProvider portfolioProvider, IExchangeInfoProvider exchangeInfoProvider, IStorageRegistry storageRegistry)
historyEmulationConnector = HistoryEmulationConnector(securityProvider, portfolioProvider, exchangeInfoProvider, storageRegistry)

Initializes a new instance of the HistoryEmulationConnector.

securityProvider
The provider of information about instruments.
portfolioProvider
The portfolio to be used to register orders. If value is not given, the portfolio with default name Simulator will be created.
storageRegistry
Market data storage.
exchangeInfoProvider
Exchanges and trading boards provider.
HistoryEmulationConnector
public HistoryEmulationConnector(ISecurityProvider securityProvider)
historyEmulationConnector = HistoryEmulationConnector(securityProvider)

Initializes a new instance of the HistoryEmulationConnector.

securityProvider
The provider of information about instruments.
HistoryEmulationConnector
public HistoryEmulationConnector(ISecurityProvider securityProvider, IEnumerable<Portfolio> portfolios)
historyEmulationConnector = HistoryEmulationConnector(securityProvider, portfolios)

Initializes a new instance of the HistoryEmulationConnector.

securityProvider
The provider of information about instruments.
portfolios
Portfolios, the operation will be performed with.
HistoryEmulationConnector
public HistoryEmulationConnector(IEnumerable<Security> securities, IEnumerable<Portfolio> portfolios, IStorageRegistry storageRegistry)
historyEmulationConnector = HistoryEmulationConnector(securities, portfolios, storageRegistry)

Initializes a new instance of the HistoryEmulationConnector.

securities
Instruments, the operation will be performed with.
portfolios
Portfolios, the operation will be performed with.
storageRegistry
Market data storage.
HistoryEmulationConnector
public HistoryEmulationConnector(IEnumerable<Security> securities, IEnumerable<Portfolio> portfolios)
historyEmulationConnector = HistoryEmulationConnector(securities, portfolios)

Initializes a new instance of the HistoryEmulationConnector.

securities
Instruments, which will be sent through the SecurityReceived event.
portfolios
Portfolios, which will be sent through the PortfolioReceived event.
HistoryEmulationConnector
public HistoryEmulationConnector(ISecurityProvider securityProvider, IPortfolioProvider portfolioProvider, IStorageRegistry storageRegistry)
historyEmulationConnector = HistoryEmulationConnector(securityProvider, portfolioProvider, storageRegistry)

Initializes a new instance of the HistoryEmulationConnector.

securityProvider
The provider of information about instruments.
portfolioProvider
The portfolio to be used to register orders. If value is not given, the portfolio with default name Simulator will be created.
storageRegistry
Market data storage.
HistoryEmulationConnector
public HistoryEmulationConnector(ISecurityProvider securityProvider, IPortfolioProvider portfolioProvider, IExchangeInfoProvider exchangeInfoProvider)
historyEmulationConnector = HistoryEmulationConnector(securityProvider, portfolioProvider, exchangeInfoProvider)

Initializes a new instance of the HistoryEmulationConnector.

securityProvider
The provider of information about instruments.
portfolioProvider
The portfolio to be used to register orders. If value is not given, the portfolio with default name Simulator will be created.
exchangeInfoProvider
Exchanges and trading boards provider.

Properties

CommissionRules
public IEnumerable<ICommissionRule> CommissionRules { get; set; }
value = historyEmulationConnector.CommissionRules
historyEmulationConnector.CommissionRules = value

Commission rules.

EmulationSettings
public MarketEmulatorSettings EmulationSettings { get; }
value = historyEmulationConnector.EmulationSettings

Settings

HistoryMessageAdapter
public HistoryMessageAdapter HistoryMessageAdapter { get; }
value = historyEmulationConnector.HistoryMessageAdapter

The adapter, receiving messages form the storage IStorageRegistry.

IsFinished
public bool IsFinished { get; private set; }
value = historyEmulationConnector.IsFinished
historyEmulationConnector.IsFinished = value

Has the emulator ended its operation due to end of data, or it was interrupted through the Disconnectmethod.

MarketTimeChangedInterval
public override TimeSpan MarketTimeChangedInterval { set; }
historyEmulationConnector.MarketTimeChangedInterval = value

The TimeMessage message generating Interval. The default is 10 milliseconds.

MaxMessageCount
public int MaxMessageCount { get; set; }
value = historyEmulationConnector.MaxMessageCount
historyEmulationConnector.MaxMessageCount = value

Maximum number of messages processed during backtesting. Negative value means the option is ignored.

RiskManager
public override IRiskManager RiskManager { get; }
value = historyEmulationConnector.RiskManager

Risk control manager.

State
public ChannelStates State { get; private set; }
value = historyEmulationConnector.State
historyEmulationConnector.State = value

The emulator state.

StopOnSubscriptionError
public bool StopOnSubscriptionError { get; set; }
value = historyEmulationConnector.StopOnSubscriptionError
historyEmulationConnector.StopOnSubscriptionError = value

Call Disconnect when any Subscription failed.

SupportSnapshots
public override bool SupportSnapshots { get; }
value = historyEmulationConnector.SupportSnapshots

Use SnapshotHolderMessageAdapter.

Methods

ClearCacheAsync
public override ValueTask ClearCacheAsync(CancellationToken cancellationToken)
result = historyEmulationConnector.ClearCacheAsync(cancellationToken)

Clear cache.

DisposeManaged
protected override void DisposeManaged()
historyEmulationConnector.DisposeManaged()

To release allocated resources. In particular, to disconnect from the trading system via Disconnect.

OnConnectAsync
protected override ValueTask OnConnectAsync(CancellationToken cancellationToken)
result = historyEmulationConnector.OnConnectAsync(cancellationToken)

Connect to trading system.

OnDisconnectAsync
protected override ValueTask OnDisconnectAsync(CancellationToken cancellationToken)
result = historyEmulationConnector.OnDisconnectAsync(cancellationToken)

Disconnect from trading system.

OnProcessMessage
protected override ValueTask OnProcessMessage(Message message, CancellationToken cancellationToken)
result = historyEmulationConnector.OnProcessMessage(message, cancellationToken)

Process message.

message
Message.
cancellationToken
CancellationToken
RaiseSubscriptionFailed
protected override void RaiseSubscriptionFailed(Subscription subscription, Exception error, bool isSubscribe)
historyEmulationConnector.RaiseSubscriptionFailed(subscription, error, isSubscribe)
StartAsync
public ValueTask StartAsync(CancellationToken cancellationToken)
result = historyEmulationConnector.StartAsync(cancellationToken)

To start the emulation.

SuspendAsync
public ValueTask SuspendAsync(CancellationToken cancellationToken)
result = historyEmulationConnector.SuspendAsync(cancellationToken)

To suspend the emulation.

Events

ProgressChanged
public event Action<int> ProgressChanged
historyEmulationConnector.ProgressChanged += handler

Progress changed event.

StateChanged
public event Action StateChanged
historyEmulationConnector.StateChanged += handler

The event on the emulator state change State.

StateChanged2
public event Action<ChannelStates> StateChanged2
historyEmulationConnector.StateChanged2 += handler

The event on the emulator state change State.