VwapAlgo
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
Constructores
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.
Propiedades
public bool IsFinished { get; }
value = vwapAlgo.IsFinished
Whether the algorithm has finished.
public decimal? LimitPrice { get; }
value = vwapAlgo.LimitPrice
Price limit, or when slices go out as market orders.
public decimal MinSliceVolume { get; }
value = vwapAlgo.MinSliceVolume
Smallest slice worth a round-trip.
public decimal ParticipationRate { get; }
value = vwapAlgo.ParticipationRate
Fraction of the live market volume the algo will take.
public decimal RemainingVolume { get; }
value = vwapAlgo.RemainingVolume
Remaining volume to execute.
public decimal TotalVolume { get; }
value = vwapAlgo.TotalVolume
Total volume to execute.
Métodos
public void Dispose()
vwapAlgo.Dispose()
Disposes of items in the pool that implement IDisposable.
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.
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.
public void OnOrderFailed()
vwapAlgo.OnOrderFailed()
Notify that an order failed. Nothing traded.
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.
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.
Devuelve: The sent-volume counter to carry on with.
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.
public void UpdateOrderBook(IOrderBookMessage depth)
vwapAlgo.UpdateOrderBook(depth)
Update order book data.
- depth
- Order book.