CommissionRule
StockSharp.Algo.Commissions
佣金计算规则。
继承自: NotifiableObject
实现: ICommissionRule, IAsyncPersistable
构造函数
CommissionRule
protected CommissionRule()
commissionRule = CommissionRule()
Initialize CommissionRule.
属性
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
标题。
Value
public Unit Value { get; set; }
value = commissionRule.Value
commissionRule.Value = value
参数值 。
方法
GetValue
protected decimal? GetValue(decimal? price, decimal? volume)
result = commissionRule.GetValue(price, volume)
使用价格和量获取佣金值。对于% 单位,使用营业额(价格 * 量) 。绝对单位返回绝对值。
- price
- 价格基础(订单或交易)。
- volume
- 量基(订单或交易).
返回值: 佣金价值或无法计算为无效。
LoadAsync
public virtual Task LoadAsync(SettingsStorage storage, CancellationToken cancellationToken)
result = commissionRule.LoadAsync(storage, cancellationToken)
Load settings.
- storage
- Settings storage.
- cancellationToken
- CancellationToken
返回值: 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
返回值: 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
返回值: The commission. If the commission cannot be calculated then will be returned.
SaveAsync
public virtual Task SaveAsync(SettingsStorage storage, CancellationToken cancellationToken)
result = commissionRule.SaveAsync(storage, cancellationToken)
Save settings.
- storage
- Settings storage.
- cancellationToken
- CancellationToken
返回值: Task