Table of Contents

Class BaseHydraTask

Namespace
StockSharp.Hydra.Core
Assembly
StockSharp.Hydra.Core.dll

Базовая класс для задачи.

public abstract class BaseHydraTask : BaseLogReceiver, IHydraTask, ILogReceiver, ILogSource, IDisposable, ICloneable<IHydraTask>, ICloneable, IPersistable, INotifyPropertyChanged, IScheduledTask
Inheritance
BaseHydraTask
Implements
ICloneable<IHydraTask>
IPersistable
Derived
Inherited Members
Extension Methods

Constructors

BaseHydraTask(Hydra)

Инициализировать BaseHydraTask.

protected BaseHydraTask(Hydra hydra)

Parameters

hydra Hydra

Hydra

Properties

AllSecurity

Инструмент "Все инструменты".

[Browsable(false)]
public HydraTaskSecurity AllSecurity { get; }

Property Value

HydraTaskSecurity

CanTestConnect

Можно ли вызвать метод TestConnect(Action<Exception>).

[Browsable(false)]
public virtual bool CanTestConnect { get; }

Property Value

bool

CandlesBuildFrom

Поддерживаемые источники данных построения свечей.

[Browsable(false)]
public virtual IEnumerable<Level1Fields> CandlesBuildFrom { get; }

Property Value

IEnumerable<Level1Fields>

DependFrom

Задача, которая должна быть выполнена перед запуском текущей.

[Display(ResourceType = typeof(LocalizedStrings), Name = "Dependency", Description = "DependencyDesc", GroupName = "General", Order = 105)]
public IHydraTask DependFrom { get; set; }

Property Value

IHydraTask

Drive

Директория с данными, куда будут сохраняться конечные файлы в формате StockSharp.

[Display(ResourceType = typeof(LocalizedStrings), Name = "DataDirectory", Description = "DataDirectoryDesc", GroupName = "General", Order = 103)]
public IMarketDataDrive Drive { get; set; }

Property Value

IMarketDataDrive

EntityRegistry

Хранилище торговых объектов.

protected IEntityRegistry EntityRegistry { get; }

Property Value

IEntityRegistry

ExchangeInfoProvider

Провайдер бирж и торговых площадок.

protected IExchangeInfoProvider ExchangeInfoProvider { get; }

Property Value

IExchangeInfoProvider

Hydra

[Browsable(false)]
protected Hydra Hydra { get; }

Property Value

Hydra

Icon

Адрес иконки, для визуального обозначения.

[Browsable(false)]
public Uri Icon { get; }

Property Value

Uri

InStopMode

State in stop mode.

protected bool InStopMode { get; }

Property Value

bool

Interval

Интервал работы.

[Display(ResourceType = typeof(LocalizedStrings), Name = "WorkInterval", Description = "WorkIntervalDot", GroupName = "General", Order = 102)]
public TimeSpan Interval { get; set; }

Property Value

TimeSpan

IsDefault

Настройки содержат значений, заданные по-умолчанию.

[Browsable(false)]
public bool IsDefault { get; set; }

Property Value

bool

IsEnabled

Включена ли задача.

[Display(ResourceType = typeof(LocalizedStrings), Name = "Active", Description = "TaskOn", GroupName = "General", Order = 100)]
[Browsable(false)]
public bool IsEnabled { get; set; }

Property Value

bool

IsStub

Determines the source is stub.

[Browsable(false)]
public virtual bool IsStub { get; }

Property Value

bool

MaxErrorCount

Максимальное количество ошибок, после которого задача будет остановлена. По-умолчанию равно 0, что означает игнорирование количества ошибок.

[Display(ResourceType = typeof(LocalizedStrings), Name = "MaxErrors", Description = "MaxErrorsDesc", GroupName = "General", Order = 106)]
public int MaxErrorCount { get; set; }

Property Value

int

Name

The source name.

[Browsable(false)]
public override string Name { get; }

Property Value

string

NativeIdStorage

Хранилище системных идентификаторов.

protected INativeIdStorage NativeIdStorage { get; }

Property Value

INativeIdStorage

RemoteChannel

Remote channel in where notifications will be output.

[Display(ResourceType = typeof(LocalizedStrings), Name = "Notification", Description = "NotificationChannel", GroupName = "Remotely", Order = 1001)]
public ClientSocial RemoteChannel { get; set; }

Property Value

ClientSocial

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

bool

RemoteLogLevel

Remote log levels translates into RemoteChannel.

[Display(ResourceType = typeof(LocalizedStrings), Name = "LogLevel", Description = "LogLevelDot", GroupName = "Remotely", Order = 1002)]
public LogLevels RemoteLogLevel { get; set; }

Property Value

LogLevels

Resume

Resume.

[Display(ResourceType = typeof(LocalizedStrings), Name = "Continue", Description = "ResumeFromLastDate", GroupName = "General", Order = 100)]
public bool Resume { get; set; }

Property Value

bool

Securities

Инструменты, связанные с задачей.

[Browsable(false)]
public HydraTaskSecurity[] Securities { get; set; }

Property Value

HydraTaskSecurity[]

SecurityLookupSupportType

Тип поиска инструмента.

[Browsable(false)]
public virtual SecurityLookupSupportTypes SecurityLookupSupportType { get; }

Property Value

SecurityLookupSupportTypes

State

Текущее состояние задачи.

[Browsable(false)]
public TaskStates State { get; }

Property Value

TaskStates

StorageFormat

Формат данных.

[Display(ResourceType = typeof(LocalizedStrings), Name = "Format", Description = "DataFormat", GroupName = "General", Order = 104)]
public StorageFormats StorageFormat { get; set; }

Property Value

StorageFormats

StorageRegistry

Хранилище маркет-данных.

protected IStorageRegistry StorageRegistry { get; }

Property Value

IStorageRegistry

SupportedDataTypes

Поддерживаемые типы данных.

[Browsable(false)]
public abstract IEnumerable<DataType> SupportedDataTypes { get; }

Property Value

IEnumerable<DataType>

SupportedDepths

Supported depths.

[Browsable(false)]
public virtual IEnumerable<int> SupportedDepths { get; }

Property Value

IEnumerable<int>

SupportedLevel1Fields

Поддерживаемые поля маркет-данных первого уровня.

[Browsable(false)]
[Display(ResourceType = typeof(LocalizedStrings), Name = "Level1", Description = "Level1FieldsDesc", GroupName = "General", Order = 107)]
public virtual IEnumerable<Level1Fields> SupportedLevel1Fields { get; set; }

Property Value

IEnumerable<Level1Fields>

Title

Заголовок задачи.

[Display(ResourceType = typeof(LocalizedStrings), Name = "Header", Description = "TeskHeader", GroupName = "General", Order = 108)]
public string Title { get; set; }

Property Value

string

Validation

Validation.

[Display(ResourceType = typeof(LocalizedStrings), Name = "Validation", Description = "Validation", GroupName = "General", Order = 110)]
public TaskValidations Validation { get; set; }

Property Value

TaskValidations

WorkingTime

Working schedule.

[Display(ResourceType = typeof(LocalizedStrings), Name = "WorkingTime", Description = "WorkingHours", GroupName = "General", Order = 110)]
public WorkingTime WorkingTime { get; set; }

Property Value

WorkingTime

Methods

CanProcess()

Можно ли продолжить работу задачи в методе OnProcess().

protected bool CanProcess()

Returns

bool

true, если работу продолжить возможно, иначе, работу метода необходимо прервать.

Clone()

Создать копию.

public IHydraTask Clone()

Returns

IHydraTask

Копия.

FinalizeTask()

Обработка окончания работы задачи.

protected virtual void FinalizeTask()

GetSecurity(SecurityId)

Получить инструмент по идентификатору.

protected Security GetSecurity(SecurityId securityId)

Parameters

securityId SecurityId

Идентификатор инструмента.

Returns

Security

Инструмент.

GetWorkingSecurities(IMarketDataDrive)

Получить список инструментов, с которыми будет работать данный источник.

protected IEnumerable<HydraTaskSecurity> GetWorkingSecurities(IMarketDataDrive drive)

Parameters

drive IMarketDataDrive

Returns

IEnumerable<HydraTaskSecurity>

Инструменты.

HandleError(Exception)

Обработать ошибку.

protected void HandleError(Exception error)

Parameters

error Exception

Ошибка.

Init(Guid)

Инициализировать задачу.

public void Init(Guid id)

Parameters

id Guid

Идентификатор задачи.

IsAllDownloadingSupported(DataType)

Is for the specified dataType all securities downloading enabled.

public virtual bool IsAllDownloadingSupported(DataType dataType)

Parameters

dataType DataType

Data type info.

Returns

bool

Check result.

Load(SettingsStorage)

Load settings.

public override void Load(SettingsStorage storage)

Parameters

storage SettingsStorage

Settings storage.

NotifyPropertyChanged(string)

Invoke PropertyChanged event.

protected void NotifyPropertyChanged(string name = null)

Parameters

name string

Property name/

OnProcess()

Выполнить задачу.

protected virtual TimeSpan OnProcess()

Returns

TimeSpan

Минимальный интервал, после окончания которого необходимо снова выполнить задачу.

OnStarting()

Действие при запуске загрузки данных.

protected virtual void OnStarting()

OnStopped()

Действие при остановке загрузки данных.

protected virtual void OnStopped()

RaiseDataLoaded(HydraTaskSecurity, DataType, DateTimeOffset?, int)

Вызывать событие DataLoaded.

protected void RaiseDataLoaded(HydraTaskSecurity security, DataType dataType, DateTimeOffset? time, int count)

Parameters

security HydraTaskSecurity

Инструмент.

dataType DataType

Тип данных.

time DateTimeOffset?

Время последних данных.

count int

Количество последних данных.

RaiseStarted()

Вызвать событие Started.

protected void RaiseStarted()

RaiseStopped()

Вызвать событие Stopped.

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 ISecurityStorage

Securities meta info storage.

criteria SecurityLookupMessage

Message 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 which returns an attribute of search cancel.

Save(SettingsStorage)

Save settings.

public override void Save(SettingsStorage storage)

Parameters

storage SettingsStorage

Settings storage.

SaveBoardStates(IEnumerable<BoardStateMessage>)

Сохранить состояние площадок в хранилище.

protected void SaveBoardStates(IEnumerable<BoardStateMessage> states)

Parameters

states IEnumerable<BoardStateMessage>

Состояние площадок.

SaveCandles(Security, IEnumerable<CandleMessage>)

Сохранить свечи по инструменту в хранилище.

protected void SaveCandles(Security security, IEnumerable<CandleMessage> candles)

Parameters

security Security

Инструмент.

candles IEnumerable<CandleMessage>

Свечи.

SaveDepths(Security, IEnumerable<QuoteChangeMessage>)

Сохранить стаканы в хранилище.

protected void SaveDepths(Security security, IEnumerable<QuoteChangeMessage> depths)

Parameters

security Security

Инструмент.

depths IEnumerable<QuoteChangeMessage>

Стаканы.

SaveLevel1Changes(Security, IEnumerable<Level1ChangeMessage>)

Сохранить изменения по инструменту в хранилище.

protected void SaveLevel1Changes(Security security, IEnumerable<Level1ChangeMessage> messages)

Parameters

security Security

Инструмент.

messages IEnumerable<Level1ChangeMessage>

Изменения.

SaveNews(IEnumerable<NewsMessage>)

Сохранить новости в хранилище.

protected void SaveNews(IEnumerable<NewsMessage> news)

Parameters

news IEnumerable<NewsMessage>

Новости.

SaveOrderLog(Security, IEnumerable<ExecutionMessage>)

Сохранить лог заявок по инструменту в хранилище.

protected void SaveOrderLog(Security security, IEnumerable<ExecutionMessage> items)

Parameters

security Security

Инструмент.

items IEnumerable<ExecutionMessage>

Лог заявок.

SavePositionChanges(Security, IEnumerable<PositionChangeMessage>)

Сохранить изменения по позиции в хранилище.

protected void SavePositionChanges(Security security, IEnumerable<PositionChangeMessage> messages)

Parameters

security Security

Инструмент.

messages IEnumerable<PositionChangeMessage>

Изменения.

SaveSecurity(Security)

Сохранить инструмент если он отсутствует в Securities.

protected void SaveSecurity(Security security)

Parameters

security Security

Инструмент.

SaveTicks(Security, IEnumerable<ExecutionMessage>)

Сохранить тиковые сделки в хранилище.

protected void SaveTicks(Security security, IEnumerable<ExecutionMessage> ticks)

Parameters

security Security

Инструмент.

ticks IEnumerable<ExecutionMessage>

Тиковые сделки.

SaveTransactions(Security, IEnumerable<ExecutionMessage>)

Сохранить транзакции в хранилище.

protected void SaveTransactions(Security security, IEnumerable<ExecutionMessage> transactions)

Parameters

security Security

Инструмент.

transactions IEnumerable<ExecutionMessage>

Транзакции.

Start()

Запустить.

public void Start()

Stop()

Остановить.

public void Stop()

StopSubscription(Security, DataType)

Stop subscription for the specified Security and DataType.

protected virtual void StopSubscription(Security security, DataType dataType)

Parameters

security Security

Security

dataType DataType

DataType

TestConnect(Action<Exception>)

Verify connection.

public virtual void TestConnect(Action<Exception> connectionChanged)

Parameters

connectionChanged Action<Exception>

Connection changed callback.

Events

DataLoaded

Событие о загрузке маркет-данных.

public event Action<HydraTaskSecurity, DataType, DateTimeOffset?, int, IEnumerable<Message>> DataLoaded

Event Type

Action<HydraTaskSecurity, DataType, DateTimeOffset?, int, IEnumerable<Message>>

PropertyChanged

public event PropertyChangedEventHandler PropertyChanged

Event Type

PropertyChangedEventHandler

SecuritySaved

Security saved.

public event Action<Security> SecuritySaved

Event Type

Action<Security>

Started

Событие запуска.

public event Action<IHydraTask> Started

Event Type

Action<IHydraTask>

Stopped

Событие остановки.

public event Action<IHydraTask> Stopped

Event Type

Action<IHydraTask>