PositionTargetManager
StockSharp.Algo.PositionManagement
Standalone manager that drives position to a target value using configurable algorithms.
继承自: BaseLogReceiver
构造函数
PositionTargetManager(ISubscriptionProvider, ITransactionProvider, IMarketRuleContainer, Func<Security, Portfolio, decimal?>, Func<Order>, Func<bool>, Func<Sides, decimal, IPositionModifyAlgo>)
Initializes a new instance of the PositionTargetManager.
- subProvider
- Subscription provider.
- transProvider
- Transaction provider.
- container
- Market rule container.
- getPosition
- Function to get current position for a security/portfolio pair.
- orderFactory
- Factory to create new orders with desired properties.
- canTrade
- Function that returns whether trading is allowed.
- algoFactory
- Factory to create position modify algorithms. Parameters: side, volume.
属性
MaxRetries : int
Maximum number of retries on order failure.
OrderType : OrderTypes
Order type to use. Default is Market.
PositionTolerance : decimal
Tolerance for considering position target reached.
方法
CancelTarget(Security, Portfolio)
Cancel target for a security/portfolio pair.
- security
- Security.
- portfolio
- Portfolio.
DisposeManaged()
Release resources.
GetTarget(Security, Portfolio) : decimal?
Get target position for a security/portfolio pair.
返回值: Target position, or null if not set.
IsTargetReached(Security, Portfolio) : bool
Check if target position is reached.
事件
Error : Action<Security, Portfolio, Exception>
Occurs when an error happens during target management.
OrderRegistered : Action<Order>
Occurs when an order is registered by the manager.
TargetReached : Action<Security, Portfolio>
Occurs when a target position is reached.