Bitcoin Forum
November 01, 2024, 11:45:20 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Mtgox trades per second  (Read 4042 times)
romkyns (OP)
Newbie
*
Offline Offline

Activity: 19
Merit: 0


View Profile
April 12, 2013, 11:43:48 AM
Last edit: April 12, 2013, 12:49:27 PM by romkyns
 #1

I've downloaded the list of all trades executed on Mtgox over the past 24 hours (there's an API URL for that), and wrote a tiny script to count the number of trades during every 1-minute interval.

Turns out, the single worst minute saw SIX trades per second. The top 15 worst 1-minute intervals saw an average of 3.8 trades per second.

Let's try to estimate how many trades per second their engine is capable of. The worst lag I saw over the past 24 hours was about 500 seconds, i.e. 8 minutes. Let's simplify this a lot, and assume that this lag was created after the worst 1-minute interval, when Mtgox saw 370 trades. In the most conservative scenario, a lag of 8 minutes would mean that these 370 trades took 7 minutes to execute (this is a bit of an approximation, but I think it's close enough).

That places the Mtgox trading engine speed at just 0.9 trades per second.

This is so ridiculous that I have to wonder if I made a mistake somewhere. But if I didn't, their trading engine was written by monkeys (something that everyone seems to agree on anyway).

EDIT: I've had someone question the approximation, so I wrote a better script. This one iterates 1 second at a time, queues the trades arriving in that second for execution, then executes trades from the queue at a specified speed (seconds per trade). It then measures the lag directly. Using this code, to get the worst lag of 500 seconds, "seconds per trade" is 0.65, i.e. approximately 1.5 trades per second. But I doubt 500 seconds was the worst lag during these 24 hours...

EDIT: if the worst lag during these trades was 50 minutes as suggested by 2weiX, that places the speed at pretty much exactly 1 trade per second. Hm... how suspicious... (might be an accident though)
dawn
Full Member
***
Offline Offline

Activity: 121
Merit: 100


View Profile
April 12, 2013, 11:48:00 AM
 #2

And they earn shitloads because people get in panic and trade and trande and trade...  Mt.Gox is the most unprofessional player with that much power, related to IT I ever saw. If they don't have enough manpower, they should be able to recruit 100s of IT professionals. It's again only the damn greed which makes it worse for everyone.

0.011BTC/GH contract for 5 years !!!!!: >>Get it now! (weekly payouts)<< Got my 5th weekly payout
tdahsu
Newbie
*
Offline Offline

Activity: 27
Merit: 0



View Profile
April 12, 2013, 11:50:23 AM
 #3

My guess is they're still using the old "Magic the Gathering" trading engine, which would work just fine if people traded 1 card per second.   Grin   Wink Wink
kiko
Sr. Member
****
Offline Offline

Activity: 453
Merit: 250


View Profile
April 12, 2013, 12:14:49 PM
 #4

I've downloaded the list of all trades executed on Mtgox over the past 24 hours (there's an API URL for that), and wrote a tiny script to count the number of trades during every 1-minute interval.

Turns out, the single worst minute saw SIX trades per second. The top 15 worst 1-minute intervals saw an average of 3.8 trades per second.

Let's try to estimate how many trades per second their engine is capable of. The worst lag I saw over the past 24 hours was about 500 seconds, i.e. 8 minutes. Let's simplify this a lot, and assume that this lag was created after the worst 1-minute interval, when Mtgox saw 370 trades. In the most conservative scenario, a lag of 8 minutes would mean that these 370 trades took 7 minutes to execute (this is a bit of an approximation, but I think it's close enough).

That gives us an upper bound on Mtgox trading engine speed of just 0.9 trades per second.

This is so ridiculous that I have to wonder if I made a mistake somewhere. But if I didn't, their trading engine was written by monkeys (something that everyone seems to agree on anyway).

No, you are correct. I've been thinking the same thing for months. I just can't get my head around how it could be that slow. It must be re-sorting the entire order book on every order, added or removed. Not just re-arranging pointers. but actually copying the data on disk, every time. I just can't think of another way it could be slower.

[BTW. this kind of thread really belongs in Service Discussion for future reference.]
2weiX
Legendary
*
Offline Offline

Activity: 2058
Merit: 1005

this space intentionally left blank


View Profile
April 12, 2013, 12:17:33 PM
 #5

worst lag i witnessed was >50 minutes.
WiseOldOwl
Full Member
***
Offline Offline

Activity: 238
Merit: 100



View Profile
April 12, 2013, 12:27:44 PM
 #6

So it points to manipulation on purpose, because they just cant be that slow after all these years.
shep80
Full Member
***
Offline Offline

Activity: 139
Merit: 100


View Profile
April 12, 2013, 12:48:54 PM
 #7


At that rate, their trading engine may be a bunch of folks watching monitors matching up buy/sell orders.

That's a total joke.

ragmondo
Member
**
Offline Offline

Activity: 106
Merit: 10



View Profile WWW
April 12, 2013, 01:00:27 PM
 #8

I did a quick websearch. Here is one guys trading system that does (easily) 100 trades per second on a 400Mhz machine 3 years ago.

video here : http://vimeo.com/18232653

code here : https://code.google.com/p/emte-trading/

In fact, I think it would actually be difficult to write a trading / matching engine that performed as slowly as mtgox. Seriously.
TTBit
Legendary
*
Offline Offline

Activity: 1136
Merit: 1001


View Profile
April 12, 2013, 01:00:45 PM
 #9

MtGox will suspend all trading, but they should suspend orders not on 0.05 price increments. Or, accept order prices down to 0.0001, but charge for them, which would be fine for larger orders.

good judgment comes from experience, and experience comes from bad judgment
romkyns (OP)
Newbie
*
Offline Offline

Activity: 19
Merit: 0


View Profile
April 12, 2013, 01:29:44 PM
 #10

In fact, I think it would actually be difficult to write a trading / matching engine that performed as slowly as mtgox. Seriously.

I think it's quite easy; store all orders in an unindexed table in MySQL and run a badly written SQL query to find the next match. I've seen enough awful code to suspect sheer incompetence way before suspecting malice, aka Hanlon/Heinlein's Razor...
SlipperySlope
Hero Member
*****
Offline Offline

Activity: 686
Merit: 501

Stephen Reed


View Profile
April 12, 2013, 01:51:47 PM
 #11

Thanks for this analysis.

One possible root cause of Mt.Gox trading engine bad performance is the very liberal policy of allowing traders to issue limit orders without the corresponding dollars or bitcoins. Thus the matching engine must verify that the account has the actual dollars on hand to make a purchase, and must likewise verify the actual bitcoins on hand to make a sale.

The entire trading engine is subject to locks to prevent corruption of data by simultaneous processes. The matching engine must lock each account as it verifies account balances of candidate matched orders. High performance trading engines are designed around the notion of reducing lock contention. See http://lmax-exchange.github.io/disruptor/ .

Bitcoin needs a robust, high performance exchange - as well as security against hackers.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!