DiagramStrategy
The strategy whose algorithm is presented in the form of a diagram.
Inherits: Strategy
Implements: INotifyPropertiesChanged
Constructors
public DiagramStrategy()
diagramStrategy = DiagramStrategy()
Initializes a new instance of the DiagramStrategy.
Properties
public CompositionDiagramElement Composition { get; set; }
value = diagramStrategy.Composition
diagramStrategy.Composition = value
The strategy diagram. Settings loaded before a diagram was set are applied by CancellationToken), or at the start of the strategy.
protected override TimeSpan? HistoryCalculated { get; }
value = diagramStrategy.HistoryCalculated
The history period required before the strategy can start, or .
public override IEnumerable<IOrderBookSource> OrderBookSources { get; }
value = diagramStrategy.OrderBookSources
Order book sources used by the strategy.
public int OverflowLimit { get; set; }
value = diagramStrategy.OverflowLimit
diagramStrategy.OverflowLimit = value
Max allowed elements per iteration to prevent stack overflow.
internal IReadOnlyList<Security> StartSecurities { get; }
value = diagramStrategy.StartSecurities
Securities the diagram refers to at the start: Security and the security values of the elements' parameters, resolved through the security provider. Available to the elements from CancellationToken).
Methods
protected override ValueTask CopyToAsync(Strategy copy, CancellationToken cancellationToken)
result = diagramStrategy.CopyToAsync(copy, cancellationToken)
Copy settings into .
- copy
- Strategy
- cancellationToken
- CancellationToken
Returns: ValueTask
protected override void DisposeManaged()
diagramStrategy.DisposeManaged()
Disposes the managed resources. Override this method to add custom clean up of managed resources.
public void Flush(DateTime time)
diagramStrategy.Flush(time)
Flush non trigger (root) elements.
public void Flush<TMessage>(TMessage message)
diagramStrategy.Flush(message)
Flush non trigger (root) elements.
public override IEnumerable<Portfolio> GetWorkingPortfolios()
result = diagramStrategy.GetWorkingPortfolios()
Get all portfolios required for strategy.
Returns: Portfolios.
public override Task LoadAsync(SettingsStorage storage, CancellationToken cancellationToken)
result = diagramStrategy.LoadAsync(storage, cancellationToken)
Load settings.
- storage
- SettingsStorage
- cancellationToken
- CancellationToken
Returns: Task
protected override void OnReseted()
diagramStrategy.OnReseted()
The method is called at the strategy reset.
protected override void OnStarted2(DateTime time)
diagramStrategy.OnStarted2(time)
The method is called when the strategy has entered the started state.
- time
- The strategy start time.
protected override ValueTask OnStartedAsync(DateTime time, CancellationToken cancellationToken)
result = diagramStrategy.OnStartedAsync(time, cancellationToken)
The method is called when the strategy has entered the started state, before DateTime). An exception stops the strategy the same way as one thrown from DateTime).
- time
- The strategy start time.
- cancellationToken
- Cancellation token.
Returns: ValueTask
protected override void OnStopped()
diagramStrategy.OnStopped()
The method is called when the strategy has entered the stopped state.
protected virtual void RaisePropertiesChanged()
diagramStrategy.RaisePropertiesChanged()
To call the available properties change event.
public override Task SaveAsync(SettingsStorage storage, CancellationToken cancellationToken)
result = diagramStrategy.SaveAsync(storage, cancellationToken)
Save settings.
- storage
- SettingsStorage
- cancellationToken
- CancellationToken
Returns: Task
public ValueTask SetCompositionAsync(CompositionDiagramElement composition, CancellationToken cancellationToken)
result = diagramStrategy.SetCompositionAsync(composition, cancellationToken)
Set Composition and apply to it the settings loaded before it was set.
- composition
- The strategy diagram.
- cancellationToken
- CancellationToken
Returns: ValueTask
Events
public event Action<CompositionDiagramElement> CompositionChanged
diagramStrategy.CompositionChanged += handler
The strategy diagram change event.
public event Action PropertiesChanged
diagramStrategy.PropertiesChanged += handler
The available properties change event.