Bitcoin Forum
April 19, 2024, 04:33:39 AM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: MtGox and Bitstamp timestamps for each trade and depth item - how do they work?  (Read 1756 times)
cliffhanger (OP)
Newbie
*
Offline Offline

Activity: 47
Merit: 0


View Profile WWW
January 25, 2014, 02:58:49 PM
 #1

(I hope this question belongs here, if not - advise me which subforum it should go)

I'm building a trading app and one issue I faced is timestamps for trades on the exchanges. I'm not sure I understand how they work.
Here's the way I tried to use them in the app which seems to produce odd results:

1. I connect to the streaming API for both trades and depth and start receiving data. At this point the orderbook in my app is empty, so I don't update anything, I just put the updates from the stream into a queue.
2. Load the full depth orderbook, remember the timestamp.
3. Release the queue of trades and orderbook changes, update the app orderbook. For each update, check if the timestamp is smaller (that is older) than the timestamp of the full depth orderbook I just downloaded. If it is, do not allow this item to update the orderbook, since it already has it.

In fact, the check in #3 keeps checking even later, when the queue is empty and only new data comes in from the stream. Problem is, it looks like both MtGox and Bitstamp keep sending "old" items into the stream many minutes after I downloaded the full depth order book. Even more odd is that when I do not allow those allegedly older updates from updating the orderbook of my app, it starts to look different from what I see on, say, Bitcoinwisdom. If I turn off this timestamps check, Bitstamp starts to look fine and orderbook is exactly the same as it is displayed on Bitcoinwisdom. Gox looks weird in both cases (with or without timestamp check) but I suspect this is due to some other issue.

Any ideas?
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!