CommissionRule

StockSharp.Algo.Commissions

The commission calculating rule.

Inherits: NotifiableObject

Implements: ICommissionRule, IAsyncPersistable

Constructors

CommissionRule
protected CommissionRule()
commissionRule = CommissionRule()

Initialize CommissionRule.

Properties

Min
public decimal Min { get; set; }
value = commissionRule.Min
commissionRule.Min = value

Lower bound on a charge this rule produces. Zero means no bound.

Title
public string Title { get; private set; }
value = commissionRule.Title
commissionRule.Title = value

Title.

Value
public Unit Value { get; set; }
value = commissionRule.Value
commissionRule.Value = value

Commission value.

Methods

EnterScope
protected Scope EnterScope()
result = commissionRule.EnterScope()

Enter sync scope.

Returns: Scope

GetTitle
protected virtual string GetTitle()
result = commissionRule.GetTitle()

Get title.

GetValue
protected decimal? GetValue(decimal? price, decimal? volume)
result = commissionRule.GetValue(price, volume)

Get commission value using price and volume. For percent units, uses turnover (price * volume). Absolute units return the absolute value.

price
Price base (order or trade).
volume
Volume base (order or trade).

Returns: Commission value or null if cannot be calculated.

LoadAsync
public virtual Task LoadAsync(SettingsStorage storage, CancellationToken cancellationToken)
result = commissionRule.LoadAsync(storage, cancellationToken)

Load settings.

storage
Settings storage.
cancellationToken
CancellationToken

Returns: Task

OnProcessAsync
protected abstract ValueTask<decimal?> OnProcessAsync(ExecutionMessage message, CancellationToken cancellationToken)
result = commissionRule.OnProcessAsync(message, cancellationToken)

To calculate commission, before Min is applied.

message
The message containing the information about the order or own trade.
cancellationToken
CancellationToken

Returns: The commission. If the commission cannot be calculated then will be returned.

ProcessAsync
public ValueTask<decimal?> ProcessAsync(ExecutionMessage message, CancellationToken cancellationToken)
result = commissionRule.ProcessAsync(message, cancellationToken)

To calculate commission.

message
The message containing the information about the order or own trade.
cancellationToken
CancellationToken

Returns: The commission. If the commission cannot be calculated then will be returned.

Reset
public virtual void Reset()
commissionRule.Reset()

To reset the state.

SaveAsync
public virtual Task SaveAsync(SettingsStorage storage, CancellationToken cancellationToken)
result = commissionRule.SaveAsync(storage, cancellationToken)

Save settings.

storage
Settings storage.
cancellationToken
CancellationToken

Returns: Task

UpdateTitle
protected void UpdateTitle()
commissionRule.UpdateTitle()

Update title.