HistoryEmulationConnector
The emulation connection. It uses historical data and/or occasionally generated.
Inherits: BaseEmulationConnector
Constructors
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.
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.
public HistoryEmulationConnector(ISecurityProvider securityProvider)
historyEmulationConnector = HistoryEmulationConnector(securityProvider)
Initializes a new instance of the HistoryEmulationConnector.
- securityProvider
- The provider of information about instruments.
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.
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.
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.
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.
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
public IEnumerable<ICommissionRule> CommissionRules { get; set; }
value = historyEmulationConnector.CommissionRules
historyEmulationConnector.CommissionRules = value
Commission rules.
public MarketEmulatorSettings EmulationSettings { get; }
value = historyEmulationConnector.EmulationSettings
Settings
public HistoryMessageAdapter HistoryMessageAdapter { get; }
value = historyEmulationConnector.HistoryMessageAdapter
The adapter, receiving messages form the storage IStorageRegistry.
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.
public override TimeSpan MarketTimeChangedInterval { set; }
historyEmulationConnector.MarketTimeChangedInterval = value
The TimeMessage message generating Interval. The default is 10 milliseconds.
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.
public override IRiskManager RiskManager { get; }
value = historyEmulationConnector.RiskManager
Risk control manager.
public ChannelStates State { get; private set; }
value = historyEmulationConnector.State
historyEmulationConnector.State = value
The emulator state.
public bool StopOnSubscriptionError { get; set; }
value = historyEmulationConnector.StopOnSubscriptionError
historyEmulationConnector.StopOnSubscriptionError = value
Call Disconnect when any Subscription failed.
public override bool SupportSnapshots { get; }
value = historyEmulationConnector.SupportSnapshots
Use SnapshotHolderMessageAdapter.
Methods
public override ValueTask ClearCacheAsync(CancellationToken cancellationToken)
result = historyEmulationConnector.ClearCacheAsync(cancellationToken)
Clear cache.
protected override void DisposeManaged()
historyEmulationConnector.DisposeManaged()
To release allocated resources. In particular, to disconnect from the trading system via Disconnect.
protected override ValueTask OnConnectAsync(CancellationToken cancellationToken)
result = historyEmulationConnector.OnConnectAsync(cancellationToken)
Connect to trading system.
protected override ValueTask OnDisconnectAsync(CancellationToken cancellationToken)
result = historyEmulationConnector.OnDisconnectAsync(cancellationToken)
Disconnect from trading system.
protected override ValueTask OnProcessMessage(Message message, CancellationToken cancellationToken)
result = historyEmulationConnector.OnProcessMessage(message, cancellationToken)
Process message.
- message
- Message.
- cancellationToken
- CancellationToken
protected override void RaiseSubscriptionFailed(Subscription subscription, Exception error, bool isSubscribe)
historyEmulationConnector.RaiseSubscriptionFailed(subscription, error, isSubscribe)
public ValueTask StartAsync(CancellationToken cancellationToken)
result = historyEmulationConnector.StartAsync(cancellationToken)
To start the emulation.
public ValueTask SuspendAsync(CancellationToken cancellationToken)
result = historyEmulationConnector.SuspendAsync(cancellationToken)
To suspend the emulation.
Events
public event Action<int> ProgressChanged
historyEmulationConnector.ProgressChanged += handler
Progress changed event.
public event Action StateChanged
historyEmulationConnector.StateChanged += handler
The event on the emulator state change State.
public event Action<ChannelStates> StateChanged2
historyEmulationConnector.StateChanged2 += handler
The event on the emulator state change State.