VwapAlgo

StockSharp.Algo.PositionManagement

Volume-Weighted Average Price (VWAP). Tries to keep cumulative child-order participation in proportion to the cumulative market traded volume - when the market trades X% of its expected day volume, the algo aims to have sent X% of TotalVolume. Without an a-priori intraday volume profile the algo uses the live volume observed since StartAt. Two policy parameters shape the behaviour: - ParticipationRate caps the fraction of the live market volume the algo will take (0.10 = 10%). Even when behind schedule the algo will not exceed this share. - MinSliceVolume sets a floor - fragments smaller than this aren't worth a round-trip and accumulate until they cross the threshold.

Implementa: IPositionModifyAlgo, IDisposable

Construtores

VwapAlgo
public VwapAlgo(Sides side, decimal totalVolume, DateTime startAt, DateTime endAt, decimal participationRate, decimal minSliceVolume, decimal? limitPrice)
vwapAlgo = VwapAlgo(side, totalVolume, startAt, endAt, participationRate, minSliceVolume, limitPrice)

Initializes a new instance of the VwapAlgo.

side
Order side.
totalVolume
Total volume to execute.
startAt
When the algo may start.
endAt
When the algo must be done.
participationRate
Fraction of the live market volume the algo will take, within (0, 1].
minSliceVolume
Smallest slice worth a round-trip.
limitPrice
Price limit, or to send market orders.

Propriedades

EndAt
public DateTime EndAt { get; }
value = vwapAlgo.EndAt

When the algo must be done.

IsFinished
public bool IsFinished { get; }
value = vwapAlgo.IsFinished

Whether the algorithm has finished.

LimitPrice
public decimal? LimitPrice { get; }
value = vwapAlgo.LimitPrice

Price limit, or when slices go out as market orders.

MinSliceVolume
public decimal MinSliceVolume { get; }
value = vwapAlgo.MinSliceVolume

Smallest slice worth a round-trip.

ParticipationRate
public decimal ParticipationRate { get; }
value = vwapAlgo.ParticipationRate

Fraction of the live market volume the algo will take.

RemainingVolume
public decimal RemainingVolume { get; }
value = vwapAlgo.RemainingVolume

Remaining volume to execute.

Side
public Sides Side { get; }
value = vwapAlgo.Side

Order side.

StartAt
public DateTime StartAt { get; }
value = vwapAlgo.StartAt

When the algo may start.

TotalVolume
public decimal TotalVolume { get; }
value = vwapAlgo.TotalVolume

Total volume to execute.

Métodos

Cancel
public void Cancel()
vwapAlgo.Cancel()

Cancel the current algo execution.

Dispose
public void Dispose()
vwapAlgo.Dispose()

Disposes of items in the pool that implement IDisposable.

GetNextAction
public PositionModifyAction GetNextAction()
result = vwapAlgo.GetNextAction()

Get the next action to take. The call advances the algorithm: a returned Register counts as dispatched, so the caller places it and reports back through Decimal), OnOrderFailed or Decimal). An action that is discarded leaves the algorithm waiting for a report that never comes.

OnOrderCanceled
public void OnOrderCanceled(decimal matchedVolume)
vwapAlgo.OnOrderCanceled(matchedVolume)

Notify that an order was canceled.

matchedVolume
Volume that traded since the previous notification and before cancellation.
OnOrderFailed
public void OnOrderFailed()
vwapAlgo.OnOrderFailed()

Notify that an order failed. Nothing traded.

OnOrderMatched
public void OnOrderMatched(decimal matchedVolume)
vwapAlgo.OnOrderMatched(matchedVolume)

Notify that an order was matched.

matchedVolume
Volume that traded since the previous notification for this order: a caller reporting every partial fill passes the increment, one reporting only the end passes the whole traded volume. The same volume is never reported twice.
SentVolumeAfterFailedSlice
public static decimal SentVolumeAfterFailedSlice(decimal sentVolume, decimal filledVolume)
result = VwapAlgo.SentVolumeAfterFailedSlice(sentVolume, filledVolume)

The sent-volume counter after the current in-flight slice fails. Only the in-flight slice (sent minus filled) is rolled back - subtracting the whole remaining order would erase earlier sends and make the algorithm re-send them, breaching the participation cap.

sentVolume
Volume sent so far.
filledVolume
Volume filled so far.

Retorna: The sent-volume counter to carry on with.

UpdateMarketData
public void UpdateMarketData(DateTime time, decimal? price, decimal? volume)
vwapAlgo.UpdateMarketData(time, price, volume)

Update market data.

time
Current time.
price
Last trade price.
volume
Last trade volume.
UpdateOrderBook
public void UpdateOrderBook(IOrderBookMessage depth)
vwapAlgo.UpdateOrderBook(depth)

Update order book data.

depth
Order book.