BestBidAskChangeEvent

BestBidAskChangeEvent
public event Action<decimal, decimal> BestBidAskChangeEvent;

The BestBidAskChangeEvent event signals a change in the prices at the levels of the best bid and offer, in other words, the boundaries of the spread. The first argument passed in the event is the price of the best Bid level, and the second argument is the price of the best Ask level.

The event is especially suitable for market-making strategies.

Let's implement an example of such a strategy's logic.

1. Create a parameter to limit the minimum allowable spread size.

2. Create a parameter to limit the size of the total position on the tab.

3. Subscribe to the BestBidAskChangeEvent.

4. Initialize the parameter for the spread.

5. Initialize the parameter for the volume.

6. If the size of the spread is smaller than allowed, exit the method.

7. If there are no long positions and the total volume is less than the maximum permissible, place a limit order to buy at a price one step higher than the BestBid.

8. If there are no short positions and the total volume is more than the maximum permissible for selling, place a limit order to sell at a price one step lower than the BestAsk.

9. Variable to store the total volume for the tab.

10. Calculate the total position volume for the tab using the method described in the article about the MyTradeEvent event.

If you have any difficulties or questions, please write to the support chat. Link