Table of Contents

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
object
PositionUpdater
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

logger ILoggerSource

The source the changes of the volume and the average price are logged with.

position Position

The position to write to.

policyProvider Func<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

Position

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

volume decimal?
averagePrice decimal?
openedPnL decimal?
closedPnL decimal?
commission decimal?
openVolume decimal?
risk RiskInfo

Returns

bool

true if the position was changed, always on the first call.