Class BaseHydraTask
- Namespace
- StockSharp.Hydra.Core
- Assembly
- StockSharp.Hydra.Core.dll
Base class for a Hydra task.
public abstract class BaseHydraTask : BaseLogReceiver, IHydraTask, ILogReceiver, ILogSource, IDisposable, ICloneable<IHydraTask>, ICloneable, IPersistable, INotifyPropertyChanged, IScheduledTask
- Inheritance
-
BaseHydraTask
- Implements
- Derived
- Inherited Members
- Extension Methods
Remarks
Initializes BaseHydraTask.
Constructors
BaseHydraTask(Hydra)
Base class for a Hydra task.
protected BaseHydraTask(Hydra hydra)
Parameters
hydra
HydraHydra instance.
Remarks
Initializes BaseHydraTask.
Properties
AllSecurity
Special "All securities" entry.
[Browsable(false)]
public HydraTaskSecurity AllSecurity { get; }
Property Value
CanTestConnect
Can TestConnect(Action<Exception>) be called.
[Browsable(false)]
public virtual bool CanTestConnect { get; }
Property Value
CandlesBuildFrom
Supported Level1 fields that can be used as candles build source.
[Browsable(false)]
public virtual IEnumerable<Level1Fields> CandlesBuildFrom { get; }
Property Value
DependFrom
Task that must be executed before the current one starts.
[Display(ResourceType = typeof(LocalizedStrings), Name = "Dependency", Description = "DependencyDesc", GroupName = "General", Order = 105)]
[Browsable(false)]
public IHydraTask DependFrom { get; set; }
Property Value
Drive
Market data drive where final files in StockSharp format will be stored.
[Display(ResourceType = typeof(LocalizedStrings), Name = "DataDirectory", Description = "DataDirectoryDesc", GroupName = "General", Order = 103)]
public IMarketDataDrive Drive { get; set; }
Property Value
EntityRegistry
Trading objects storage.
protected static IEntityRegistry EntityRegistry { get; }
Property Value
ExchangeInfoProvider
Exchanges and boards provider.
protected static IExchangeInfoProvider ExchangeInfoProvider { get; }
Property Value
Hydra
Hydra instance.
[Browsable(false)]
protected Hydra Hydra { get; }
Property Value
Icon
Icon URI for visual representation.
[Browsable(false)]
public Uri Icon { get; }
Property Value
InStopMode
State in stop mode.
protected bool InStopMode { get; }
Property Value
Interval
Work interval.
[Display(ResourceType = typeof(LocalizedStrings), Name = "WorkInterval", Description = "WorkIntervalDot", GroupName = "General", Order = 102)]
[TimeSpanEditor(Mask = TimeSpanEditorMask.Days|TimeSpanEditorMask.Hours|TimeSpanEditorMask.Minutes|TimeSpanEditorMask.Seconds)]
[BasicSetting]
public TimeSpan Interval { get; set; }
Property Value
IsDefault
Does settings contain default values.
[Browsable(false)]
public bool IsDefault { get; set; }
Property Value
IsEnabled
Is task enabled.
[Display(ResourceType = typeof(LocalizedStrings), Name = "Active", Description = "TaskOn", GroupName = "General", Order = 100)]
[Browsable(false)]
public bool IsEnabled { get; set; }
Property Value
MaxErrorCount
Maximum number of errors after which the task will be stopped. By default equals 0 meaning the count is ignored.
[Display(ResourceType = typeof(LocalizedStrings), Name = "MaxErrors", Description = "MaxErrorsDesc", GroupName = "General", Order = 106)]
public int MaxErrorCount { get; set; }
Property Value
Name
The source name.
[Browsable(false)]
public override string Name { get; }
Property Value
NativeIdStorage
System identifiers storage.
protected static INativeIdStorage NativeIdStorage { get; }
Property Value
RemoteChannel
Remote channel where notifications will be sent.
[Display(ResourceType = typeof(LocalizedStrings), Name = "Notification", Description = "NotificationChannel", GroupName = "Remotely", Order = 1001)]
public ITelegramChannel RemoteChannel { get; set; }
Property Value
RemoteControl
Allow remote control for the task.
[Display(ResourceType = typeof(LocalizedStrings), Name = "Enabled", Description = "RemoteControl", GroupName = "Remotely", Order = 1000)]
public bool RemoteControl { get; set; }
Property Value
RemoteLogLevel
Remote log levels translated into RemoteChannel.
[Display(ResourceType = typeof(LocalizedStrings), Name = "LogLevel", Description = "LogLevelDot", GroupName = "Remotely", Order = 1002)]
public LogLevels RemoteLogLevel { get; set; }
Property Value
Resume
Resume from last timestamp.
[Display(ResourceType = typeof(LocalizedStrings), Name = "Continue", Description = "ResumeFromLastDate", GroupName = "General", Order = 100)]
[BasicSetting]
public bool Resume { get; set; }
Property Value
Securities
Securities associated with the task.
[Browsable(false)]
public HydraTaskSecurity[] Securities { get; set; }
Property Value
SecurityLookupSupportType
Security lookup support type.
[Browsable(false)]
public virtual SecurityLookupSupportTypes SecurityLookupSupportType { get; }
Property Value
State
Current task state.
[Browsable(false)]
public TaskStates State { get; }
Property Value
StorageFormat
Storage format.
[Display(ResourceType = typeof(LocalizedStrings), Name = "Format", Description = "DataFormat", GroupName = "General", Order = 104)]
public StorageFormats StorageFormat { get; set; }
Property Value
StorageRegistry
Market data storage.
protected static IStorageRegistry StorageRegistry { get; }
Property Value
SupportedDataTypes
Supported data types.
[Browsable(false)]
public abstract IEnumerable<DataType> SupportedDataTypes { get; }
Property Value
SupportedDepths
Supported order book depths.
[Browsable(false)]
public virtual IEnumerable<int> SupportedDepths { get; }
Property Value
SupportedLevel1Fields
Supported Level1 fields.
[Browsable(false)]
[Display(ResourceType = typeof(LocalizedStrings), Name = "Level1", Description = "Level1FieldsDesc", GroupName = "General", Order = 107)]
[ItemsSource(typeof(Level1Fields))]
[EditorExtension(ShowSelectedItemsCount = true)]
public virtual IEnumerable<Level1Fields> SupportedLevel1Fields { get; set; }
Property Value
Title
Task title.
[Display(ResourceType = typeof(LocalizedStrings), Name = "Header", Description = "TeskHeader", GroupName = "General", Order = 108)]
[BasicSetting]
public string Title { get; set; }
Property Value
Validation
Validation behavior.
[Display(ResourceType = typeof(LocalizedStrings), Name = "Validation", Description = "Validation", GroupName = "General", Order = 110)]
public TaskValidations Validation { get; set; }
Property Value
WorkingTime
Working schedule.
[Display(ResourceType = typeof(LocalizedStrings), Name = "WorkingTime", Description = "WorkingHours", GroupName = "General", Order = 110)]
public WorkingTime WorkingTime { get; set; }
Property Value
Methods
CanProcess()
Determines whether task can continue in OnProcess().
protected bool CanProcess()
Returns
- bool
True if continue; otherwise false.
Clone()
Create a copy.
public IHydraTask Clone()
Returns
- IHydraTask
Copy.
FinalizeTask()
Handle task finalization.
protected virtual void FinalizeTask()
GetSecurity(SecurityId)
Get security by identifier.
protected Security GetSecurity(SecurityId securityId)
Parameters
securityId
SecurityIdSecurity identifier.
Returns
- Security
Security.
GetWorkingSecurities(IMarketDataDrive)
Get the list of securities that the source will work with.
protected IEnumerable<HydraTaskSecurity> GetWorkingSecurities(IMarketDataDrive drive)
Parameters
drive
IMarketDataDrive
Returns
- IEnumerable<HydraTaskSecurity>
Securities.
HandleError(Exception)
Handle error.
protected void HandleError(Exception error)
Parameters
error
ExceptionError.
Init(Guid)
Initialize task.
public void Init(Guid id)
Parameters
id
GuidTask identifier.
IsAllDownloadingSupported(DataType)
Determines whether downloading for all securities is supported for the specified dataType
.
public virtual bool IsAllDownloadingSupported(DataType dataType)
Parameters
dataType
DataTypeData type info.
Returns
- bool
Check result.
Load(SettingsStorage)
Load settings.
public override void Load(SettingsStorage storage)
Parameters
storage
SettingsStorageSettings storage.
NotifyPropertyChanged(string)
Invoke PropertyChanged event.
protected void NotifyPropertyChanged(string name = null)
Parameters
name
stringProperty name
OnProcess()
Perform task work.
protected virtual TimeSpan OnProcess()
Returns
- TimeSpan
The minimum interval after which the task should run again.
OnStarting()
Action on starting the data loading.
protected virtual void OnStarting()
OnStopped()
Action on stopping the data loading.
protected virtual void OnStopped()
RaiseDataLoaded(HydraTaskSecurity, DataType, DateTimeOffset?, int)
Raise DataLoaded with one timestamp and count.
protected void RaiseDataLoaded(HydraTaskSecurity security, DataType dataType, DateTimeOffset? time, int count)
Parameters
security
HydraTaskSecuritySecurity.
dataType
DataTypeData type.
time
DateTimeOffset?Last data time.
count
intItems count.
RaiseStarted()
Raise Started event.
protected void RaiseStarted()
RaiseStopped()
Raise Stopped event.
protected void RaiseStopped()
Refresh(ISecurityStorage, SecurityLookupMessage, Action<Security>, Action<Exception>, Func<bool>)
Download new securities.
public virtual void Refresh(ISecurityStorage securityStorage, SecurityLookupMessage criteria, Action<Security> newSecurity, Action<Exception> lookupError, Func<bool> isCancelled)
Parameters
securityStorage
ISecurityStorageSecurities meta info storage.
criteria
SecurityLookupMessageMessage security lookup for specified criteria.
newSecurity
Action<Security>The handler through which a new instrument will be passed.
lookupError
Action<Exception>Lookup error handler.
isCancelled
Func<bool>The handler returning whether to cancel the search.
Save(SettingsStorage)
Save settings.
public override void Save(SettingsStorage storage)
Parameters
storage
SettingsStorageSettings storage.
SaveBoardStates(IEnumerable<BoardStateMessage>)
Save boards state to storage.
protected void SaveBoardStates(IEnumerable<BoardStateMessage> states)
Parameters
states
IEnumerable<BoardStateMessage>Boards state.
SaveCandles(Security, IEnumerable<CandleMessage>)
Save candles to storage.
protected void SaveCandles(Security security, IEnumerable<CandleMessage> candles)
Parameters
security
SecuritySecurity.
candles
IEnumerable<CandleMessage>Candles.
SaveDepths(Security, IEnumerable<QuoteChangeMessage>)
Save order books to storage.
protected void SaveDepths(Security security, IEnumerable<QuoteChangeMessage> depths)
Parameters
security
SecuritySecurity.
depths
IEnumerable<QuoteChangeMessage>Order books.
SaveLevel1Changes(Security, IEnumerable<Level1ChangeMessage>)
Save Level1 changes to storage.
protected void SaveLevel1Changes(Security security, IEnumerable<Level1ChangeMessage> messages)
Parameters
security
SecuritySecurity.
messages
IEnumerable<Level1ChangeMessage>Changes.
SaveNews(IEnumerable<NewsMessage>)
Save news to storage.
protected void SaveNews(IEnumerable<NewsMessage> news)
Parameters
news
IEnumerable<NewsMessage>News messages.
SaveOrderLog(Security, IEnumerable<ExecutionMessage>)
Save order log to storage.
protected void SaveOrderLog(Security security, IEnumerable<ExecutionMessage> items)
Parameters
security
SecuritySecurity.
items
IEnumerable<ExecutionMessage>Order log.
SavePositionChanges(Security, IEnumerable<PositionChangeMessage>)
Save position changes to storage.
protected void SavePositionChanges(Security security, IEnumerable<PositionChangeMessage> messages)
Parameters
security
SecuritySecurity.
messages
IEnumerable<PositionChangeMessage>Changes.
SaveSecurity(Security)
Save security if it is absent in Securities.
protected void SaveSecurity(Security security)
Parameters
security
SecuritySecurity.
SaveTicks(Security, IEnumerable<ExecutionMessage>)
Save tick trades to storage.
protected void SaveTicks(Security security, IEnumerable<ExecutionMessage> ticks)
Parameters
security
SecuritySecurity.
ticks
IEnumerable<ExecutionMessage>Tick trades.
SaveTransactions(Security, IEnumerable<ExecutionMessage>)
Save transactions to storage.
protected void SaveTransactions(Security security, IEnumerable<ExecutionMessage> transactions)
Parameters
security
SecuritySecurity.
transactions
IEnumerable<ExecutionMessage>Transactions.
Start()
Start.
public void Start()
Stop()
Stop.
public void Stop()
StopSubscription(Security, DataType)
protected virtual void StopSubscription(Security security, DataType dataType)
Parameters
TestConnect(Action<Exception>)
Verify connection.
public virtual void TestConnect(Action<Exception> connectionChanged)
Parameters
Events
DataLoaded
Raised when market data has been loaded.
public event Action<HydraTaskSecurity, DataType, DateTimeOffset?, int, IEnumerable<Message>> DataLoaded
Event Type
PropertyChanged
public event PropertyChangedEventHandler PropertyChanged
Event Type
SecuritySaved
Raised when a Security is saved.
public event Action<Security> SecuritySaved
Event Type
Started
Raised when the task is started.
public event Action<IHydraTask> Started
Event Type
Stopped
Raised when the task is stopped.
public event Action<IHydraTask> Stopped