Table of Contents

Class MarketRule<TToken, TArg>

Namespace
StockSharp.Algo
Assembly
StockSharp.Algo.dll

The rule, activating action at market condition occurrence.

public abstract class MarketRule<TToken, TArg> : Disposable, IMarketRule, IDisposable

Type Parameters

TToken

The type of token.

TArg

The type of accepted argument.

Inheritance
MarketRule<TToken, TArg>
Implements
Extension Methods

Constructors

MarketRule(TToken)

protected MarketRule(TToken token)

Parameters

token TToken

Token rules.

Properties

Container

The rules container.

public IMarketRuleContainer Container { get; set; }

Property Value

IMarketRuleContainer

ExclusiveRules

Rules, opposite to given rule. They are deleted automatically at activation of this rule.

public virtual ISynchronizedCollection<IMarketRule> ExclusiveRules { get; }

Property Value

ISynchronizedCollection<IMarketRule>

IsActive

Is the rule currently activated.

public bool IsActive { get; set; }

Property Value

bool

IsReady

Is the rule formed.

public bool IsReady { get; }

Property Value

bool

IsSuspended

Is the rule suspended.

public virtual bool IsSuspended { get; set; }

Property Value

bool

LogLevel

The level to perform this rule logging.

public virtual LogLevels LogLevel { get; set; }

Property Value

LogLevels

Name

The name of the rule.

public string Name { get; set; }

Property Value

string

Methods

Activate()

To activate the rule.

protected void Activate()

Activate(TArg)

To activate the rule.

protected virtual void Activate(TArg arg)

Parameters

arg TArg

The value, which will be sent to processor, registered through Do(Action<TArg>).

Activated(Action)

To add the processor, which will be called at action activation.

public MarketRule<TToken, TArg> Activated(Action handler)

Parameters

handler Action

The handler.

Returns

MarketRule<TToken, TArg>

Rule.

Activated<TResult>(Action<TResult>)

To add the processor, accepting argument from Do<TResult>(Func<TResult>), which will be called at action activation.

public MarketRule<TToken, TArg> Activated<TResult>(Action<TResult> handler)

Parameters

handler Action<TResult>

The handler.

Returns

MarketRule<TToken, TArg>

Rule.

Type Parameters

TResult

The type of result, returned from the processor.

CanFinish()

Can the rule be ended.

protected virtual bool CanFinish()

Returns

bool

true, if rule is not required any more. Otherwise, false.

DisposeManaged()

Release resources.

protected override void DisposeManaged()

Do(Action)

To add the action, activated at occurrence of condition.

public MarketRule<TToken, TArg> Do(Action action)

Parameters

action Action

Action.

Returns

MarketRule<TToken, TArg>

Rule.

Do(Action<MarketRule<TToken, TArg>, TArg>)

To add the action, activated at occurrence of condition.

public MarketRule<TToken, TArg> Do(Action<MarketRule<TToken, TArg>, TArg> action)

Parameters

action Action<MarketRule<TToken, TArg>, TArg>

Action.

Returns

MarketRule<TToken, TArg>

Rule.

Do(Action<TArg>)

To add the action, activated at occurrence of condition.

public MarketRule<TToken, TArg> Do(Action<TArg> action)

Parameters

action Action<TArg>

Action.

Returns

MarketRule<TToken, TArg>

Rule.

Do<TResult>(Func<MarketRule<TToken, TArg>, TArg, TResult>)

To add the action, returning result, activated at occurrence of condition.

public MarketRule<TToken, TArg> Do<TResult>(Func<MarketRule<TToken, TArg>, TArg, TResult> action)

Parameters

action Func<MarketRule<TToken, TArg>, TArg, TResult>

The action, returning a result.

Returns

MarketRule<TToken, TArg>

Rule.

Type Parameters

TResult

The type of returned result.

Do<TResult>(Func<TArg, TResult>)

To add the action, returning result, activated at occurrence of condition.

public MarketRule<TToken, TArg> Do<TResult>(Func<TArg, TResult> action)

Parameters

action Func<TArg, TResult>

The action, returning a result.

Returns

MarketRule<TToken, TArg>

Rule.

Type Parameters

TResult

The type of returned result.

Do<TResult>(Func<TResult>)

To add the action, returning result, activated at occurrence of condition.

public MarketRule<TToken, TArg> Do<TResult>(Func<TResult> action)

Parameters

action Func<TResult>

The action, returning a result.

Returns

MarketRule<TToken, TArg>

Rule.

Type Parameters

TResult

The type of returned result.

ToString()

public override string ToString()

Returns

string

Until(Func<bool>)

To make the rule periodical (will be called until canFinish returns true).

public MarketRule<TToken, TArg> Until(Func<bool> canFinish)

Parameters

canFinish Func<bool>

The criteria for end of periodicity.

Returns

MarketRule<TToken, TArg>

Rule.