Class HistoryEmulationConnector
- Namespace
- StockSharp.Algo.Testing
- Assembly
- StockSharp.Algo.dll
The emulation connection. It uses historical data and/or occasionally generated.
public class HistoryEmulationConnector : BaseEmulationConnector, IConnector, IMessageChannel, ICloneable<IMessageChannel>, ICloneable, IPersistable, ILogReceiver, ILogSource, IDisposable, IMarketDataProvider, ITransactionProvider, ISecurityProvider, ISecurityMessageProvider, ISubscriptionProvider, ITimeProvider, IPortfolioProvider, IPositionProvider
- Inheritance
-
HistoryEmulationConnector
- Implements
- Inherited Members
- Extension Methods
-
MarketRuleHelper.WhenPartiallyFinishedCandles<TCandle>(ISubscriptionProvider, Subscription, decimal)
Constructors
HistoryEmulationConnector(ISecurityProvider)
Initializes a new instance of the HistoryEmulationConnector.
public HistoryEmulationConnector(ISecurityProvider securityProvider)
Parameters
securityProviderISecurityProviderThe provider of information about instruments.
HistoryEmulationConnector(ISecurityProvider, IPortfolioProvider, IStorageRegistry)
Initializes a new instance of the HistoryEmulationConnector.
public HistoryEmulationConnector(ISecurityProvider securityProvider, IPortfolioProvider portfolioProvider, IStorageRegistry storageRegistry)
Parameters
securityProviderISecurityProviderThe provider of information about instruments.
portfolioProviderIPortfolioProviderThe portfolio to be used to register orders. If value is not given, the portfolio with default name Simulator will be created.
storageRegistryIStorageRegistryMarket data storage.
HistoryEmulationConnector(ISecurityProvider, IPortfolioProvider, IExchangeInfoProvider)
Initializes a new instance of the HistoryEmulationConnector.
public HistoryEmulationConnector(ISecurityProvider securityProvider, IPortfolioProvider portfolioProvider, IExchangeInfoProvider exchangeInfoProvider)
Parameters
securityProviderISecurityProviderThe provider of information about instruments.
portfolioProviderIPortfolioProviderThe portfolio to be used to register orders. If value is not given, the portfolio with default name Simulator will be created.
exchangeInfoProviderIExchangeInfoProviderExchanges and trading boards provider.
HistoryEmulationConnector(ISecurityProvider, IPortfolioProvider, IExchangeInfoProvider, IStorageRegistry)
Initializes a new instance of the HistoryEmulationConnector.
public HistoryEmulationConnector(ISecurityProvider securityProvider, IPortfolioProvider portfolioProvider, IExchangeInfoProvider exchangeInfoProvider, IStorageRegistry storageRegistry)
Parameters
securityProviderISecurityProviderThe provider of information about instruments.
portfolioProviderIPortfolioProviderThe portfolio to be used to register orders. If value is not given, the portfolio with default name Simulator will be created.
exchangeInfoProviderIExchangeInfoProviderExchanges and trading boards provider.
storageRegistryIStorageRegistryMarket data storage.
HistoryEmulationConnector(ISecurityProvider, IEnumerable<Portfolio>)
Initializes a new instance of the HistoryEmulationConnector.
public HistoryEmulationConnector(ISecurityProvider securityProvider, IEnumerable<Portfolio> portfolios)
Parameters
securityProviderISecurityProviderThe provider of information about instruments.
portfoliosIEnumerable<Portfolio>Portfolios, the operation will be performed with.
HistoryEmulationConnector(IMessageAdapter, bool, IMessageChannel, ISecurityProvider, IPortfolioProvider, IExchangeInfoProvider)
Initializes a new instance of the HistoryEmulationConnector.
public HistoryEmulationConnector(IMessageAdapter innerAdapter, bool ownInnerAdapter, IMessageChannel inChannel, ISecurityProvider securityProvider, IPortfolioProvider portfolioProvider, IExchangeInfoProvider exchangeInfoProvider)
Parameters
innerAdapterIMessageAdapterUnderlying adapter.
ownInnerAdapterboolControl
innerAdapterlifetime.inChannelIMessageChannelIncoming messages channel.
securityProviderISecurityProviderThe provider of information about instruments.
portfolioProviderIPortfolioProviderThe portfolio to be used to register orders. If value is not given, the portfolio with default name Simulator will be created.
exchangeInfoProviderIExchangeInfoProviderExchanges and trading boards provider.
HistoryEmulationConnector(IEnumerable<Security>, IEnumerable<Portfolio>)
Initializes a new instance of the HistoryEmulationConnector.
public HistoryEmulationConnector(IEnumerable<Security> securities, IEnumerable<Portfolio> portfolios)
Parameters
securitiesIEnumerable<Security>Instruments, which will be sent through the SecurityReceived event.
portfoliosIEnumerable<Portfolio>Portfolios, which will be sent through the PortfolioReceived event.
HistoryEmulationConnector(IEnumerable<Security>, IEnumerable<Portfolio>, IStorageRegistry)
Initializes a new instance of the HistoryEmulationConnector.
public HistoryEmulationConnector(IEnumerable<Security> securities, IEnumerable<Portfolio> portfolios, IStorageRegistry storageRegistry)
Parameters
securitiesIEnumerable<Security>Instruments, the operation will be performed with.
portfoliosIEnumerable<Portfolio>Portfolios, the operation will be performed with.
storageRegistryIStorageRegistryMarket data storage.
Properties
CommissionRules
Commission rules.
[Obsolete("Use EmulationSettings.CommissionRules property.")]
public IEnumerable<ICommissionRule> CommissionRules { get; set; }
Property Value
EmulationSettings
public MarketEmulatorSettings EmulationSettings { get; }
Property Value
HistoryMessageAdapter
The adapter, receiving messages form the storage IStorageRegistry.
public HistoryMessageAdapter HistoryMessageAdapter { get; }
Property Value
IsFinished
Has the emulator ended its operation due to end of data, or it was interrupted through the Disconnect()method.
public bool IsFinished { get; }
Property Value
MarketTimeChangedInterval
The TimeMessage message generating Interval. The default is 10 milliseconds.
public override TimeSpan MarketTimeChangedInterval { set; }
Property Value
MaxMessageCount
public int MaxMessageCount { get; set; }
Property Value
RiskManager
Risk control manager.
public override IRiskManager RiskManager { get; }
Property Value
State
The emulator state.
public ChannelStates State { get; }
Property Value
StopOnSubscriptionError
Call Disconnect() when any Subscription failed.
public bool StopOnSubscriptionError { get; set; }
Property Value
SupportSnapshots
public override bool SupportSnapshots { get; }
Property Value
Methods
ClearCache()
Clear cache.
public override void ClearCache()
DisposeManaged()
To release allocated resources. In particular, to disconnect from the trading system via Disconnect().
protected override void DisposeManaged()
OnConnect()
Connect to trading system.
protected override void OnConnect()
OnDisconnect()
Disconnect from trading system.
protected override void OnDisconnect()
OnProcessMessage(Message)
Process message.
protected override void OnProcessMessage(Message message)
Parameters
messageMessageMessage.
RaiseSubscriptionFailed(Subscription, Exception, bool)
protected override void RaiseSubscriptionFailed(Subscription subscription, Exception error, bool isSubscribe)
Parameters
subscriptionSubscriptionerrorExceptionisSubscribebool
RegisterHistorySource(Security, DataType, Func<DateTimeOffset, IEnumerable<Message>>)
Register historical data source.
[Obsolete("Uses custom adapter implementation.")]
public Subscription RegisterHistorySource(Security security, DataType dataType, Func<DateTimeOffset, IEnumerable<Message>> getMessages)
Parameters
securitySecurityInstrument. If passed null the source will be applied for all subscriptions.
dataTypeDataTypeData type.
getMessagesFunc<DateTimeOffset, IEnumerable<Message>>Historical data source.
Returns
- Subscription
Subscription.
Start()
To start the emulation.
public void Start()
Suspend()
To suspend the emulation.
public void Suspend()
UnRegisterHistorySource(Security, DataType)
Unregister historical data source, previously registered by RegisterHistorySource(Security, DataType, Func<DateTimeOffset, IEnumerable<Message>>).
[Obsolete("Uses UnSubscribe method.")]
public void UnRegisterHistorySource(Security security, DataType dataType)
Parameters
securitySecurityInstrument. If passed null the source will be removed for all subscriptions.
dataTypeDataTypeData type.
Events
ProgressChanged
Progress changed event.
public event Action<int> ProgressChanged
Event Type
StateChanged
The event on the emulator state change State.
[Obsolete("Use StateChanged2 event.")]
public event Action StateChanged
Event Type
StateChanged2
The event on the emulator state change State.
public event Action<ChannelStates> StateChanged2