Tiki in real time - page 23

 
Roman:

Just the opposite, every tick(event) which comes to the handler OnTick, should go to OnBook.
Look, there are three events in the OnTick handler, price change of the best bid, price change of the best ask, and trade(last).
If the bid or ask price changes without a trade, this will be the event, and these events will be sent to OnTick.
And OnBook also has to catch these events, but its own events, its handler, otherwise there will be a mismatch of bid and ask prices between handlers.

And if OnTick receives a last event, it means a trade has passed.
The trade generates the event in OnTick, because after the trade the price or the volume of bids and asks to change in the market.
It is a vicious circle.
In OnTick as well as in OnBook, there is an event Best Bid and Best Ask. They should always be the same.
And the event itself, and it generates an event in OnBook after the trade.
Therefore, any event that comes to OnTick handler should be synchronously reflected in OnBook.

Yes, there was an error in my code. An alternative method showed that everything was fine. Ticks are very rarely 3 in a row, a little more often 2. But there are definitely no such clusters.

 
Roman:


And if OnTick receives a last event, it means a trade has taken place.
The trade generates an event in OnBook, because after the trade, the price or the volume of the gang changes in the cup.
It is a vicious circle.


Question.
What happens if two counter orders are executed at market prices and the volumes and prices of those orders are the same?
When such an order is executed, what information should be reflected in the Exchange Order Book, Order Book and Transaction Tape?

 
Vladimir Mikhailov:


Question.
What happens if there are two counter bids executed at market prices and the volumes and prices of these bids are the same?
When such an order is executed, what information should be reflected in the exchange order book, order book and transaction tape?

By the way, yes, I also thought there might be a series of two or more ticks that only cause one OnBook. But those probably don't happen very often?

 
Aleksey Mavrin:

By the way, yes, I also thought there might be a series of tics that cause a single OnBook. But those probably don't happen very often, do they?

Any change in volume in the tick without a change in price is not handled by OnTick.
By answering my question, you will understand why notevery tick has to go through OnBook.

 
Vladimir Mikhailov:

Any change of volumes in the DOM without price changes is not handled by OnTick.
If you answer my question, you will understand why not every tick should necessarily pass through OnBook.

Yes, I see your point. I'm just learning stock trading. But the conclusion is clear - OnBook is only for monitoring the situation in the market. I have to use OnTick to perform a proper analysis of what's going on in the market. Thanks to all.

 
Vladimir Mikhailov:


Question.
What happens if two counter orders are executed at market prices and the volumes and prices of those orders are the same?
When such an order is executed, what information should be reflected in the Exchange Order Book, Order Book and Transaction Tape?

The counter-executed orders will go into the transaction feed.
And it seems to me that OnTick will also generate a last event.

 
Roman:

The counter-executed bids will go into the trades feed.
And it seems to me that OnTick will also generate a last event.

This is correct.
In this case, the requests will first go to the order log,
Then there will be an attempt to execute them, if the orders are executed, they will go into the trades feed. This is where the transaction tick comes in MT5.
If the requests are not executed, they are either rejected or go to the order book and wait for their execution. This is where the ticker is updated in MT5.

 
In MT5 there must have been an attempt to add a log of impersonal orders (it is broadcasted from the exchange as a separate stream).
Most likely, this is what theENUM_BOOK_TYPE

BOOK_TYPE_SELL_MARKET

Sell order at market price

BOOK_TYPE_BUY_MARKET

Buy order

at market price

But none of these events come from the exchange. Not finished...

 
Vladimir Mikhailov:


Question.
What will happen if two opposite bids are executed at market prices and the volumes and prices of these bids are the same?
When such an order is executed, what information should be reflected in the exchange order book, order book and transaction tape?

If the bid is a market bid, it has no price.

If there is no price, just two market bids, the first will be matched with what is in the cup, then the second will be matched with what is left in the cup. They cannot be matched with each other.

 
Ilya Baranov:

If the bid is a market bid, it has no price.

If there is no price, just two market bids, the first will be matched with what is in the cup, then the second will be matched with what is left in the cup. They cannot be matched with each other.

Yes, these applications do not have a price.
But to claim that these applications will converge to the order book, you need to see the order log, namely the order queue.
And if there are counter applications in the log, they will be executed, but if not, only then there will be a reference to the order book.

A market order has priority over a limit order.
Reason: