NbboAlgo
NBBO peg - keep one resting limit order at the National Best Bid (for buys) or National Best Ask (for sells). On every top-of-book move the algo cancels the working order and re-pegs at the new best. Used to provide passive liquidity at the touch without crossing the spread. The slice size SliceVolume is constant per round-trip; after a fill (or partial fill on cancel) the algo resumes with whatever volume is left until it reaches TotalVolume. "NBBO" historically refers to the consolidated SIP feed in US markets; here it is the best price the configured market-data feed reports, so the caller is responsible for pointing the feed at the right consolidator (or single venue for non-US instruments). A crossed book (best bid above best ask) is quoted like any other: the slice goes to the best price on the side the algo works, which is the only touch it has. While the side it works carries no quote at all no new slice is sent, and an order already resting keeps its place until a best shows up again.
实现: IPositionModifyAlgo, IDisposable
构造函数
public NbboAlgo(Sides side, decimal totalVolume, decimal sliceVolume)
nbboAlgo = NbboAlgo(side, totalVolume, sliceVolume)
Initializes a new instance of the NbboAlgo.
- side
- Order side.
- totalVolume
- Total volume to execute.
- sliceVolume
- Size of a single resting slice.
属性
public decimal? CurrentBestPrice { get; }
value = nbboAlgo.CurrentBestPrice
Best price last seen on the side the algo pegs to, or before any book arrived.
public bool IsFinished { get; }
value = nbboAlgo.IsFinished
Whether the algorithm has finished.
public decimal RemainingVolume { get; }
value = nbboAlgo.RemainingVolume
Remaining volume to execute.
public decimal SliceVolume { get; }
value = nbboAlgo.SliceVolume
Size of a single resting slice.
public decimal TotalVolume { get; }
value = nbboAlgo.TotalVolume
Total volume to execute.
方法
public void Dispose()
nbboAlgo.Dispose()
Disposes of items in the pool that implement IDisposable.
public PositionModifyAction GetNextAction()
result = nbboAlgo.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)
nbboAlgo.OnOrderCanceled(matchedVolume)
Notify that an order was canceled.
- matchedVolume
- Volume that traded since the previous notification and before cancellation.
public void OnOrderFailed()
nbboAlgo.OnOrderFailed()
Notify that an order failed. Nothing traded.
public void OnOrderMatched(decimal matchedVolume)
nbboAlgo.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 void UpdateMarketData(DateTime time, decimal? price, decimal? volume)
nbboAlgo.UpdateMarketData(time, price, volume)
Update market data.
- time
- Current time.
- price
- Last trade price.
- volume
- Last trade volume.
public void UpdateOrderBook(IOrderBookMessage depth)
nbboAlgo.UpdateOrderBook(depth)
Update order book data.
- depth
- Order book.