Class BaseHydraTask
Базовая класс для задачи.
Inherited Members
Namespace: StockSharp.Hydra.Core
Assembly: StockSharp.Hydra.Core.dll
Syntax
public abstract class BaseHydraTask : BaseLogReceiver, IHydraTask, ILogReceiver, ILogSource, IDisposable, ICloneable<IHydraTask>, ICloneable, IPersistable, INotifyPropertyChanged, IScheduledTask
Constructors
BaseHydraTask()
Инициализировать BaseHydraTask.
Declaration
protected BaseHydraTask()
Properties
CandlesBuildFrom
Поддерживаемые источники данных построения свечей.
Declaration
public virtual IEnumerable<Level1Fields> CandlesBuildFrom { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Level1Fields> |
CanTestConnect
Можно ли вызвать метод TestConnect(Action<Exception>).
Declaration
public virtual bool CanTestConnect { get; }
Property Value
Type | Description |
---|---|
Boolean |
DependFrom
Задача, которая должна быть выполнена перед запуском текущей.
Declaration
public IHydraTask DependFrom { get; set; }
Property Value
Type | Description |
---|---|
IHydraTask |
Drive
Директория с данными, куда будут сохраняться конечные файлы в формате StockSharp.
Declaration
public IMarketDataDrive Drive { get; set; }
Property Value
Type | Description |
---|---|
IMarketDataDrive |
EntityRegistry
Хранилище торговых объектов.
Declaration
protected IEntityRegistry EntityRegistry { get; }
Property Value
Type | Description |
---|---|
IEntityRegistry |
ExchangeInfoProvider
Провайдер бирж и торговых площадок.
Declaration
protected IExchangeInfoProvider ExchangeInfoProvider { get; }
Property Value
Type | Description |
---|---|
IExchangeInfoProvider |
Icon
Адрес иконки, для визуального обозначения.
Declaration
public Uri Icon { get; }
Property Value
Type | Description |
---|---|
Uri |
Interval
Интервал работы.
Declaration
public TimeSpan Interval { get; set; }
Property Value
Type | Description |
---|---|
TimeSpan |
IsDefault
Настройки содержат значений, заданные по-умолчанию.
Declaration
public bool IsDefault { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
IsEnabled
Включена ли задача.
Declaration
public bool IsEnabled { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
MaxErrorCount
Максимальное количество ошибок, после которого задача будет остановлена. По-умолчанию равно 0, что означает игнорирование количества ошибок.
Declaration
public int MaxErrorCount { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Name
Имя источника.
Declaration
public override string Name { get; }
Property Value
Type | Description |
---|---|
String |
Overrides
NativeIdStorage
Хранилище системных идентификаторов.
Declaration
protected INativeIdStorage NativeIdStorage { get; }
Property Value
Type | Description |
---|---|
INativeIdStorage |
Securities
Инструменты, связанные с задачей.
Declaration
public IEnumerable<HydraTaskSecurity> Securities { get; set; }
Property Value
Type | Description |
---|---|
IEnumerable<HydraTaskSecurity> |
SecurityLookupSupportType
Тип поиска инструмента.
Declaration
public virtual SecurityLookupSupportTypes SecurityLookupSupportType { get; }
Property Value
Type | Description |
---|---|
SecurityLookupSupportTypes |
State
Текущее состояние задачи.
Declaration
public TaskStates State { get; }
Property Value
Type | Description |
---|---|
TaskStates |
StorageFormat
Формат данных.
Declaration
public StorageFormats StorageFormat { get; set; }
Property Value
Type | Description |
---|---|
StorageFormats |
StorageRegistry
Хранилище маркет-данных.
Declaration
protected IStorageRegistry StorageRegistry { get; }
Property Value
Type | Description |
---|---|
IStorageRegistry |
SupportedDataTypes
Поддерживаемые типы данных.
Declaration
public abstract IEnumerable<DataType> SupportedDataTypes { get; }
Property Value
Type | Description |
---|---|
IEnumerable<DataType> |
SupportedDepths
Supported depths.
Declaration
public virtual IEnumerable<int> SupportedDepths { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Int32> |
SupportedLevel1Fields
Поддерживаемые поля маркет-данных первого уровня.
Declaration
public virtual IEnumerable<Level1Fields> SupportedLevel1Fields { get; set; }
Property Value
Type | Description |
---|---|
IEnumerable<Level1Fields> |
Title
Заголовок задачи.
Declaration
public string Title { get; set; }
Property Value
Type | Description |
---|---|
String |
WorkingTime
Working schedule.
Declaration
public WorkingTime WorkingTime { get; set; }
Property Value
Type | Description |
---|---|
WorkingTime |
Methods
CanProcess()
Можно ли продолжить работу задачи в методе OnProcess().
Declaration
protected bool CanProcess()
Returns
Type | Description |
---|---|
Boolean | true, если работу продолжить возможно, иначе, работу метода необходимо прервать. |
Clone()
Создать копию.
Declaration
public IHydraTask Clone()
Returns
Type | Description |
---|---|
IHydraTask | Копия. |
FinalizeTask()
Обработка окончания работы задачи.
Declaration
protected virtual void FinalizeTask()
GetSecurity(SecurityId)
Получить инструмент по идентификатору.
Declaration
protected Security GetSecurity(SecurityId securityId)
Parameters
Type | Name | Description |
---|---|---|
SecurityId | securityId | Идентификатор инструмента. |
Returns
Type | Description |
---|---|
Security | Инструмент. |
GetWorkingSecurities()
Получить список инструментов, с которыми будет работать данный источник.
Declaration
protected IEnumerable<HydraTaskSecurity> GetWorkingSecurities()
Returns
Type | Description |
---|---|
IEnumerable<HydraTaskSecurity> | Инструменты. |
HandleError(Exception)
Обработать ошибку.
Declaration
protected void HandleError(Exception error)
Parameters
Type | Name | Description |
---|---|---|
Exception | error | Ошибка. |
Init(Guid)
Инициализировать задачу.
Declaration
public void Init(Guid id)
Parameters
Type | Name | Description |
---|---|---|
Guid | id | Идентификатор задачи. |
IsAllDownloadingSupported(DataType)
Доступно ли для указанного dataType
загрузка всех инструментов.
Declaration
public virtual bool IsAllDownloadingSupported(DataType dataType)
Parameters
Type | Name | Description |
---|---|---|
DataType | dataType | Тип данных. |
Returns
Type | Description |
---|---|
Boolean | Результат проверки. |
Load(SettingsStorage)
Загрузить настройки.
Declaration
public override void Load(SettingsStorage storage)
Parameters
Type | Name | Description |
---|---|---|
Ecng.Serialization.SettingsStorage | storage | Хранилище настроек. |
Overrides
NotifyPropertyChanged(String)
Вызвать событие PropertyChanged.
Declaration
protected void NotifyPropertyChanged(string name = null)
Parameters
Type | Name | Description |
---|---|---|
String | name | Property name/ |
OnProcess()
Выполнить задачу.
Declaration
protected virtual TimeSpan OnProcess()
Returns
Type | Description |
---|---|
TimeSpan | Минимальный интервал, после окончания которого необходимо снова выполнить задачу. |
OnStarting()
Действие при запуске загрузки данных.
Declaration
protected virtual void OnStarting()
OnStopped()
Действие при остановке загрузки данных.
Declaration
protected virtual void OnStopped()
RaiseDataLoaded(Security, DataType, Nullable<DateTimeOffset>, Int32)
Вызывать событие DataLoaded.
Declaration
protected void RaiseDataLoaded(Security security, DataType dataType, Nullable<DateTimeOffset> time, int count)
Parameters
Type | Name | Description |
---|---|---|
Security | security | Инструмент. |
DataType | dataType | Тип данных. |
Nullable<DateTimeOffset> | time | Время последних данных. |
Int32 | count | Количество последних данных. |
RaiseStarted()
Вызвать событие Started.
Declaration
protected void RaiseStarted()
RaiseStopped()
Вызвать событие Stopped.
Declaration
protected void RaiseStopped()
Refresh(ISecurityStorage, SecurityLookupMessage, Action<Security>, Func<Boolean>)
Закачать новые инструменты.
Declaration
public virtual void Refresh(ISecurityStorage securityStorage, SecurityLookupMessage criteria, Action<Security> newSecurity, Func<bool> isCancelled)
Parameters
Type | Name | Description |
---|---|---|
ISecurityStorage | securityStorage | Хранилище информации об инструментах. |
SecurityLookupMessage | criteria | Сообщение поиска инструментов по заданному критерию. |
Action<Security> | newSecurity | Обработчик, через который будет передан новый инструмент. |
Func<Boolean> | isCancelled | Обработчик, возвращающий признак отмены поиска. |
Save(SettingsStorage)
Сохранить настройки.
Declaration
public override void Save(SettingsStorage storage)
Parameters
Type | Name | Description |
---|---|---|
Ecng.Serialization.SettingsStorage | storage | Хранилище настроек. |
Overrides
SaveBoardStates(IEnumerable<BoardStateMessage>)
Сохранить состояние площадок в хранилище.
Declaration
protected void SaveBoardStates(IEnumerable<BoardStateMessage> states)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<BoardStateMessage> | states | Состояние площадок. |
SaveCandles(Security, IEnumerable<CandleMessage>)
Сохранить свечи по инструменту в хранилище.
Declaration
protected void SaveCandles(Security security, IEnumerable<CandleMessage> candles)
Parameters
Type | Name | Description |
---|---|---|
Security | security | Инструмент. |
IEnumerable<CandleMessage> | candles | Свечи. |
SaveCandles(HydraTaskSecurity, IEnumerable<CandleMessage>)
Сохранить свечи по инструменту в хранилище.
Declaration
protected void SaveCandles(HydraTaskSecurity security, IEnumerable<CandleMessage> candles)
Parameters
Type | Name | Description |
---|---|---|
HydraTaskSecurity | security | Инструмент. |
IEnumerable<CandleMessage> | candles | Свечи. |
SaveDepths(Security, IEnumerable<QuoteChangeMessage>)
Сохранить стаканы в хранилище.
Declaration
protected void SaveDepths(Security security, IEnumerable<QuoteChangeMessage> depths)
Parameters
Type | Name | Description |
---|---|---|
Security | security | Инструмент. |
IEnumerable<QuoteChangeMessage> | depths | Стаканы. |
SaveDepths(HydraTaskSecurity, IEnumerable<QuoteChangeMessage>)
Сохранить стаканы в хранилище.
Declaration
protected void SaveDepths(HydraTaskSecurity security, IEnumerable<QuoteChangeMessage> depths)
Parameters
Type | Name | Description |
---|---|---|
HydraTaskSecurity | security | Инструмент. |
IEnumerable<QuoteChangeMessage> | depths | Стаканы. |
SaveLevel1Changes(Security, IEnumerable<Level1ChangeMessage>)
Сохранить изменения по инструменту в хранилище.
Declaration
protected void SaveLevel1Changes(Security security, IEnumerable<Level1ChangeMessage> messages)
Parameters
Type | Name | Description |
---|---|---|
Security | security | Инструмент. |
IEnumerable<Level1ChangeMessage> | messages | Изменения. |
SaveLevel1Changes(HydraTaskSecurity, IEnumerable<Level1ChangeMessage>)
Сохранить изменения по инструменту в хранилище.
Declaration
protected void SaveLevel1Changes(HydraTaskSecurity security, IEnumerable<Level1ChangeMessage> messages)
Parameters
Type | Name | Description |
---|---|---|
HydraTaskSecurity | security | Инструмент. |
IEnumerable<Level1ChangeMessage> | messages | Изменения. |
SaveNews(IEnumerable<NewsMessage>)
Сохранить новости в хранилище.
Declaration
protected void SaveNews(IEnumerable<NewsMessage> news)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<NewsMessage> | news | Новости. |
SaveOrderLog(Security, IEnumerable<ExecutionMessage>)
Сохранить лог заявок по инструменту в хранилище.
Declaration
protected void SaveOrderLog(Security security, IEnumerable<ExecutionMessage> items)
Parameters
Type | Name | Description |
---|---|---|
Security | security | Инструмент. |
IEnumerable<ExecutionMessage> | items | Лог заявок. |
SaveOrderLog(HydraTaskSecurity, IEnumerable<ExecutionMessage>)
Сохранить лог заявок по инструменту в хранилище.
Declaration
protected void SaveOrderLog(HydraTaskSecurity security, IEnumerable<ExecutionMessage> items)
Parameters
Type | Name | Description |
---|---|---|
HydraTaskSecurity | security | Инструмент. |
IEnumerable<ExecutionMessage> | items | Лог заявок. |
SavePositionChanges(Security, IEnumerable<PositionChangeMessage>)
Сохранить изменения по позиции в хранилище.
Declaration
protected void SavePositionChanges(Security security, IEnumerable<PositionChangeMessage> messages)
Parameters
Type | Name | Description |
---|---|---|
Security | security | Инструмент. |
IEnumerable<PositionChangeMessage> | messages | Изменения. |
SaveSecurity(Security)
Сохранить инструмент если он отсутствует в Securities.
Declaration
protected void SaveSecurity(Security security)
Parameters
Type | Name | Description |
---|---|---|
Security | security | Инструмент. |
SaveTicks(Security, IEnumerable<ExecutionMessage>)
Сохранить тиковые сделки в хранилище.
Declaration
protected void SaveTicks(Security security, IEnumerable<ExecutionMessage> ticks)
Parameters
Type | Name | Description |
---|---|---|
Security | security | Инструмент. |
IEnumerable<ExecutionMessage> | ticks | Тиковые сделки. |
SaveTicks(HydraTaskSecurity, IEnumerable<ExecutionMessage>)
Сохранить тиковые сделки в хранилище.
Declaration
protected void SaveTicks(HydraTaskSecurity security, IEnumerable<ExecutionMessage> ticks)
Parameters
Type | Name | Description |
---|---|---|
HydraTaskSecurity | security | Инструмент. |
IEnumerable<ExecutionMessage> | ticks | Тиковые сделки. |
SaveTransactions(Security, IEnumerable<ExecutionMessage>)
Сохранить транзакции в хранилище.
Declaration
protected void SaveTransactions(Security security, IEnumerable<ExecutionMessage> transactions)
Parameters
Type | Name | Description |
---|---|---|
Security | security | Инструмент. |
IEnumerable<ExecutionMessage> | transactions | Транзакции. |
Start()
Запустить.
Declaration
public void Start()
Stop()
Остановить.
Declaration
public void Stop()
TestConnect(Action<Exception>)
Произвести тестовое подключение.
Declaration
public virtual void TestConnect(Action<Exception> connectionChanged)
Parameters
Type | Name | Description |
---|---|---|
Action<Exception> | connectionChanged | Обработчик изменения состояния подключения. |
Events
DataLoaded
Событие о загрузке маркет-данных.
Declaration
public event Action<Security, DataType, Nullable<DateTimeOffset>, int, IEnumerable<Message>> DataLoaded
Event Type
Type | Description |
---|---|
Action<Security, DataType, Nullable<DateTimeOffset>, Int32, IEnumerable<Message>> |
PropertyChanged
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type | Description |
---|---|
PropertyChangedEventHandler |
Started
Событие запуска.
Declaration
public event Action<IHydraTask> Started
Event Type
Type | Description |
---|---|
Action<IHydraTask> |
Stopped
Событие остановки.
Declaration
public event Action<IHydraTask> Stopped
Event Type
Type | Description |
---|---|
Action<IHydraTask> |
Explicit Interface Implementations
IScheduledTask.CanStart
Declaration
bool IScheduledTask.CanStart { get; }
Returns
Type | Description |
---|---|
Boolean |
IScheduledTask.CanStop
Declaration
bool IScheduledTask.CanStop { get; }
Returns
Type | Description |
---|---|
Boolean |