Class PositionUpdater
- Namespace
- ATAS.DataFeedsCore
- Assembly
- ATAS.DataFeedsCore.dll
The writer of the broker values of a position. It does no calculation: the volume, the average price and the PnL that depend on the trades and the prices are calculated by the trading core.
Not in ATAS 8.0.15 yet: available from the next version.
public sealed class PositionUpdater : IPositionUpdater
- Inheritance
-
objectPositionUpdater
- Implements
- Extension Methods
Constructors
PositionUpdater(ILoggerSource, Position, Func<PositionCalculationPolicy>)
Creates the updater of a position.
public PositionUpdater(ILoggerSource logger, Position position, Func<PositionCalculationPolicy> policyProvider)
Parameters
loggerILoggerSourceThe source the changes of the volume and the average price are logged with.
positionPositionThe position to write to.
policyProviderFunc<PositionCalculationPolicy>Returns the current calculation policy of the position, read on every Update(decimal?, decimal?, decimal?, decimal?, decimal?, decimal?, RiskInfo?): the values the policy leaves to the trading core are not written.
Properties
IsPositionInitialized
Whether Update(decimal?, decimal?, decimal?, decimal?, decimal?, decimal?, RiskInfo?) has been called at least once, so the position holds what the broker reported.
public bool IsPositionInitialized { get; }
Property Value
- bool
Position
The position of the connector this updater writes to.
public Position Position { get; }
Property Value
Methods
Clear()
The connection is started anew: the risk of the broker is not valid any more.
public void Clear()
GetIsChanged()
Whether the volume or the average price differ from the ones the previous call saw (for the log only).
public bool GetIsChanged()
Returns
- bool
Update(decimal?, decimal?, decimal?, decimal?, decimal?, decimal?, RiskInfo?)
Writes the broker values. The values the trading core calculates for the connector (see PositionCalculationPolicy) are not written: the core owns them.
public bool Update(decimal? volume = null, decimal? averagePrice = null, decimal? openedPnL = null, decimal? closedPnL = null, decimal? commission = null, decimal? openVolume = null, RiskInfo? risk = null)
Parameters
volumedecimal?averagePricedecimal?openedPnLdecimal?closedPnLdecimal?commissiondecimal?openVolumedecimal?riskRiskInfo
Returns
- bool
true if the position was changed, always on the first call.