[0:12]In this section is about basic orders processing in stock exchanges with the example of course of Casablanca Stock Exchange. Basic orders are so simple: market order and limit order. Let's start with limit order. Limit order is communicated with a price, with quantity, direction and price limit. So we have three characteristics of a basic order that is limit order, limit order. Limit order specifies the direction buy or sell. Quantity is simply the volume that you are you are attempting to buy or sell. And the limit price or the price limit is simply your bid if you are buyer, your ask if you are seller. In any exercise at that more in this module, we have the electronic order book with a list of order which have been already introduced in the electronic order book. We call them the resting orders or the pre-existing order. And we have an arriving order. The goal of such kind of exercises is to process that arriving order in light of what we have already in our electronic order book. So an arriving buy order, an arriving buy limit order, is executed when its limit price is greater than or equal to the price of a resting (pre-existing) sell order. So an arriving sell order. Excuse me. So an arriving buy order is executed when its price is greater than or equal to the price of a resting sell order. We have, of course, this opposition between the direction. We cannot execute the order if there is no the order that come from the opposite direction. That's why when we have an arriving order, we are interested in the sell orders. And in order to execute that order, we simply add that order to the electronic order book, we need to compare the prices. This is about prices comparison. We compare between the limit price of the arriving buy order and the limit price of the existing sell order orders in the opposite direction. The rule, an arriving that buy order, is executed when its price is greater than or equal to the price of a resting, the limit price of a resting sell order. Conversely, an arriving sell order is executed when its price, when its limit price is less than or equal to the price of a resting (pre-existing) buy order. An arriving sell order is executed when its price is less than or equal to the price of a resting buy order. So we compare the prices when you have a buy order, that order is executed when its price is greater than or equal to the price of a resting sell order. When you have a sell order, that order can be executed if its price is less than or equal to the price of a resting buy order. In case, because don't forget that we are interested, first of all we are interested in prices, but also in a quantity because in the continuous trading system, called the electronic, the limit order market, the order can be executed immediately, as soon as possible, without any problem because this is you can introduce your order at any time and execute that order immediately. Provided that there is a match in terms of prices and quantities. We compare the prices and after that, we need or the system, because we are talking here about an automated trading system, chasing into account the quantities. In case of non-execution or partial execution, the limit order or its remainder is added to the order book with its price limit. So suppose that you have a buy price, just a part, a portion of that order has been executed. The rest or the remainder will be added to the electronic order book at the buy side with its limit price. Also, if you have a sell order, but only a portion of that sell order has been executed. The rest, the remainder, is added to the electronic order book at the sell price with the limit price, with its limit price, of course, initially specified by the trader. In order to understand those rules, let's have two examples. First of all, this is your electronic order book. There, for example here, this is an electronic order book for the stock A. So all the orders concerning the stock A are introduced into the electronic order book, centralized in the electronic order book. Buy orders are classified in the buy side, at the in the buy side, uh, in a ascending order, decreasing order, starting from the highest price to the lowest price. Sell orders are also arranged, ordered or classified at the sell side with their limit prices, but, of course, in terms of classification, we have a descend, an ascending order starting from the lowest price to the highest price. So this is your buy order. The stock buy the stock buy, this is your limit order, the electronic order book, excuse me, this is an electronic order book and, of course, the electronic order book for the stock A where the buy orders are centralized at the buy side and the sell orders are centralized at the sell side. Buy orders are classified in an descending or decreasing order starting from the highest price to the lowest price. Sell order are arranged in an ascending order starting from the lowest price to the highest price. All those all of the orders that we have here, in that table, in that electronic order book are called the resting orders or the pre-existing orders. At 11:02, trader Bx enters an order, "buy 450 shares, limit Dh108". So you have the direction, this is a limit order. Buy. We have the quantity or the volume 450 shares. We have the limit 108 dirhams. You should answer three questions. What executions occurred? What are the new bid and offer quotes? What does the new electronic order book look like? So, we need to specify the transaction executed transaction, trader A executed against trader B, and so on. We need to determine the new bid and ask quote, that is the best available bid and the best available ask in the table after the execution of arriving order. And finally, you need to build the new electronic order book in light of the available data. Available data, the pre-existing orders at the initial table, at the initial order book, as well as the features of the arriving order. Bx enters an order, buy 450 shares, limit Dh108. So here, we have a buy order, and we are interested in the opposite direction. The system, when we say we are, you are, it means simply that all of this process we are trying to understand that process, but please keep in your mind that all the process is an automated process. Based on a computerized trading system managed by the Casablanca stock exchange. So, since we have here a buy order, we are interested in the opposite direction, which includes the sell orders. So, an arriving buy order is executed when its price is greater than or equal to the price of a resting order, resting sell orders. Dh108 is greater than Dh100, greater than Dh104, greater than Dh105. So, an arriving buy order is executed when its price is greater than or equal to the price of a resting sell order, which means simply that in light of that rule, we can execute 450 shares against the traders.
[9:56]SF, Sd, Sa. Those orders are simply marketable order because they meet the price condition of processing the buy orders. Since 108 is greater than all the asks proposed by the three first trader. We cannot execute against the trader Sc simply because 108 is less than the price specified by Sc. So, potential executed cannot occurred. Execute the order of Bx against Sf, Sd and Sc. Sd and Sa. So Sf, Sd and Sa. Let's start the execution. Bx buy 150 shares from Sf at Dh100. Also, Bx buy 135 shares from Sd at Dh104.
[11:17]And finally, Bx buys 115 shares from Sa at Dh105. Is there any remainder? So, we can execute against the three traders and the question is, is there any remainder on Bx order?
[11:39]Yeah, we have 50 remaining shares. How can I determine the 50 remaining shares? Simply, 450 - 150 - 135 - 115 equals 15, 50. So, 50 portion, the portion, the non-executed portion corresponds to 50 shares. Those 50 shares will be added to the electronic order book at the buy side with price equals to the limit price of the initial order. So we have 50 shares remaining on Bx order. That portion of its order which which simply hasn't been executed, that portion will be added to the electronic order book at the buy side. 50 shares with 108, which is simply the limit order of Bx, and also we mention the time of entry, which is 11:02. So here we apply those rules. An arriving by order is executed when its price is greater than or or equal to the price of a resting sell order. And if there is any remainder, the remaining option, the portion, excuse me, is added to the electronic order book at the buy side with the limit price equals to the initial limit price specified by the trader Bx. Don't forget here that the remaining quantity has been added at the buy side of the electronic order book and the three first order, which which have been executed against Bx, simply disappear from our table. This is how the table, what the table looks like after the execution of Bx order. Now, let's imagine the same transaction but at the in the opposite direction, instead of having an arriving by order, we have an arriving sell order. At 11:10, trader Sx enters an order, "sell 300 shares, limit Dh92". Also here, you should specify or identify the executions, identify the new bid and offer quotes and build the new electronic order book. Please, after the execution, the best bid and ask quotes are so simple. Here, after the execution of Bx order, the best bid is 108 dirhams and the best ask is 110 dirhams. So in order to determine the best bid and ask for a market in an electronic order book, you will simply try to focus, to spot the best available bid and the best available, the best available ask in the electronic order book, which corresponds, of course, to the first, the first line here or the first row in my electronic order book. At 11:10, trader Sx enters an order, "sell 300 shares, limit Dh92". Okay. So an arriving sell order will simply here we are interested in the opposite direction, in the opposite side, which are simply the buy orders. An arriving sell order is executed when its price is less than or equal to the price of a resting buy order. 92 dirhams is less than 95, less than 95. And 92 dirhams, this amount, of course, this price is greater than 90. So, we have only two marketable orders at the buy side. We can execute SSx order against double B, since 92 is less than 95. We can also execute that order against Bg, since 92 is less than 95. Okay. Let's execute now. Sx sells 160 shares to Bb at Dh95. Also, Sx sells 110 shares to Bg at Dh95.
[16:30]Is there any remainder, any remaining quantity? The answer is yes. Why? Simply because 300 shares - 160 - 110 equals 30. So, the remainder or the non-executed portion of that order corresponds to 30 shares.
[16:53]30 shares are added to the electronic order book. Since we have initially a sell order, so we will add that remaining quantity at the sell side of the electronic order book with limit price equal to the price of the initial order, which is 92 dirhams. So here, after the execution of that order, we have the new best bid and ask, of course, 90. So we if we want to use the technical phrases, the technical sentences, technical wording, we will say, market in stock, we can say market in stock A is 90 dirhams bid for 120 shares and 30 shares offered at 92 dirhams.



