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> : BaseLogReceiver, IPersistable, ILogReceiver, ILogSource, IMarketRule, IDisposable
Type Parameters
TTokenThe type of token.
TArgThe type of accepted argument.
- Inheritance
-
MarketRule<TToken, TArg>
- Implements
- Inherited Members
- Extension Methods
Constructors
MarketRule(TToken)
Initialize MarketRule<TToken, TArg>.
protected MarketRule(TToken token)
Parameters
tokenTTokenToken rules.
Properties
Container
The rules container.
public IMarketRuleContainer Container { get; set; }
Property Value
ExclusiveRules
Rules, opposite to given rule. They are deleted automatically at activation of this rule.
public virtual ISynchronizedCollection<IMarketRule> ExclusiveRules { get; }
Property Value
IsActive
Is the rule currently activated.
public bool IsActive { get; set; }
Property Value
IsReady
Is the rule formed.
public bool IsReady { get; }
Property Value
IsSuspended
Is the rule suspended.
public virtual bool IsSuspended { get; set; }
Property Value
Methods
Activate()
To activate the rule.
protected void Activate()
Activate(TArg)
To activate the rule.
protected virtual void Activate(TArg arg)
Parameters
argTArgThe 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
handlerActionThe 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
handlerAction<TResult>The handler.
Returns
- MarketRule<TToken, TArg>
Rule.
Type Parameters
TResultThe type of result, returned from the processor.
CanFinish()
Can the rule be ended.
protected virtual bool CanFinish()
Returns
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
actionActionAction.
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
actionAction<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
actionAction<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
actionFunc<MarketRule<TToken, TArg>, TArg, TResult>The action, returning a result.
Returns
- MarketRule<TToken, TArg>
Rule.
Type Parameters
TResultThe 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
actionFunc<TArg, TResult>The action, returning a result.
Returns
- MarketRule<TToken, TArg>
Rule.
Type Parameters
TResultThe 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
actionFunc<TResult>The action, returning a result.
Returns
- MarketRule<TToken, TArg>
Rule.
Type Parameters
TResultThe type of returned result.
ToString()
public override string ToString()
Returns
Until(Func<bool>)
To make the rule periodical (will be called until canFinish returns true).
public MarketRule<TToken, TArg> Until(Func<bool> canFinish)
Parameters
Returns
- MarketRule<TToken, TArg>
Rule.