<p>Im currently trying to estimate the frequency of incoming market orders to MtGox order book.
Assume the following buy limit orders:</p>

<p>BID 2@150</p>

<p>BID 3@149</p>

<p>against which ONE market order to sell 5 btc is submitted. The transactions would be recorded for instance as:</p>

<p>Trade_ID   Unix_date   Price   Amount   Type   Properties</p>

<p>1          123456789   150     2        sell   market</p>

<p>2          123456789   149     3        sell   market</p>

<p>The key problem is that despite there was just one incoming order, it is recorded in two rows because it was matched against two outstanding limir orders.</p>

<p>Possible solutions:</p>

<p>1) If both trades have same TRADE_ID, it is possible to group the transactions. Does it really work that way? Do trades resulting from one order but matched against more orders same Trade_ID?</p>

<p>2) Grouping according to unix time stamp. I assume that these two transactions would have same time stamp? If yes, is is possible that any other market order arrives just at the same microsecond as the one above? Or is the microsecond so small time interval that it is not possible for two orders to have same unix time stamp?</p>

CC BY-SA 3.0
2013-09-04T19:25:54.467Z
just look at the websockets depth event. All new orders will be positive and executed orders will have negative volume. Orders will not appear redundantly
Loourr
CC BY-SA 3.0
2013-09-04T19:54:19.707Z
I'm afraid I don't understand. Can you elaborate a bit, please?
Steef Gregor
CC BY-SA 3.0
2013-09-04T19:56:42.183Z
How does websocket depth event look like? Can you give an exaample? thanks.
Steef Gregor
CC BY-SA 3.0
2013-09-04T23:07:46.663Z
here is the [api](https://en.bitcoin.it/wiki/MtGox/API/Streaming) that details how to use websockets and you can also get the data from [bitcoin charts](http://bitcoincharts.com/)
Loourr
CC BY-SA 3.0
2013-09-06T13:19:11.283Z
Well, I went through the API specs, namely the depth channel. However, it contains only following information: currency, item, price, total volume, price_int, type, type_str, volume, volume_int.  But it does not contain the information whether the order was limit order or market order. How can you know then what type of order it was?
Steef Gregor
CC BY-SA 3.0
2013-09-06T15:47:57.453Z
Well I guess it's impossible to know for certain (as far as I can tell) but I think it would be a safe assumption to make that if the the price of the depth event is equal to the inside price (or within depth - inside_price * order_volume) and it was immediately executed on (< 1 sec) then that is probably a market order.
Loourr
CC BY-SA 3.0
2013-09-06T17:12:30.383Z
OK, sounds like a reasonable assumption. So i guess the depth update of the market order above would be something like `-5BTC, price 149`??
Steef Gregor
CC BY-SA 3.0
2013-09-06T17:16:43.417Z
yeah, it was being executed, but you should also look for non negative ones going up in a close time frame
Loourr
CC BY-SA 3.0
2013-09-06T17:22:55.457Z
OK, sounds like a reasonable assumption. So i guess the depth update of the market order above would be something like `-5BTC, price 149`?? I understand that if the price is lower/higher (depends whether buying order or selling order) than the best bid/ask*order volume then it shoul be an market order. But how do you know how lond did it take to execute that order? DOes it have two times? Time of entry and time of execution? And what about the canceled orders? I guess they have negative volume as well. Maybe it will be youseful, if you can say how the log of order above would look like.Thanks!
Steef Gregor
<mtgox><trading><raw-data><live-data><exchange-order>
Frequency of MtGox market orders
Steef Gregor
# Frequency of MtGox market orders

(Asked by: username_0 on 2013-09-04)

Im currently trying to estimate the frequency of incoming market orders to MtGox order book.
Assume the following buy limit orders:

BID 2@150

BID 3@149

against which ONE market order to sell 5 btc is submitted. The transactions would be recorded for instance as:

Trade\_ID Unix\_date Price Amount Type Properties

1 123456789 150 2 sell market

2 123456789 149 3 sell market

The key problem is that despite there was just one incoming order, it is recorded in two rows because it was matched against two outstanding limir orders.

Possible solutions:

1) If both trades have same TRADE\_ID, it is possible to group the transactions. Does it really work that way? Do trades resulting from one order but matched against more orders same Trade\_ID?

2) Grouping according to unix time stamp. I assume that these two transactions would have same time stamp? If yes, is is possible that any other market order arrives just at the same microsecond as the one above? Or is the microsecond so small time interval that it is not possible for two orders to have same unix time stamp?

**Tags:** mtgox, trading, raw-data, live-data, exchange-order

> **Comments:**
> **username_1**: just look at the websockets depth event. All new orders will be positive and executed orders will have negative volume. Orders will not appear redundantly  
> **username_0**: I'm afraid I don't understand. Can you elaborate a bit, please?  
> **username_0**: How does websocket depth event look like? Can you give an exaample? thanks.  
> **username_1**: here is the [api](https://en.bitcoin.it/wiki/MtGox/API/Streaming) that details how to use websockets and you can also get the data from [bitcoin charts](http://bitcoincharts.com/)  
> **username_0**: Well, I went through the API specs, namely the depth channel. However, it contains only following information: currency, item, price, total volume, price_int, type, type_str, volume, volume_int.  But it does not contain the information whether the order was limit order or market order. How can you know then what type of order it was?  
> **username_1**: Well I guess it's impossible to know for certain (as far as I can tell) but I think it would be a safe assumption to make that if the the price of the depth event is equal to the inside price (or within depth - inside_price * order_volume) and it was immediately executed on (< 1 sec) then that is probably a market order.  
> **username_0**: OK, sounds like a reasonable assumption. So i guess the depth update of the market order above would be something like `-5BTC, price 149`??  
> **username_1**: yeah, it was being executed, but you should also look for non negative ones going up in a close time frame  
> **username_0**: OK, sounds like a reasonable assumption. So i guess the depth update of the market order above would be something like `-5BTC, price 149`?? I understand that if the price is lower/higher (depends whether buying order or selling order) than the best bid/ask*order volume then it shoul be an market order. But how do you know how lond did it take to execute that order? DOes it have two times? Time of entry and time of execution? And what about the canceled orders? I guess they have negative volume as well. Maybe it will be youseful, if you can say how the log of order above would look like.Thanks!  

---

## 0 answers

