Bitcoin Forum
December 13, 2024, 07:52:16 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: negative volumes in MtGox depth event  (Read 371 times)
loourr (OP)
Newbie
*
Offline Offline

Activity: 21
Merit: 0


View Profile
June 06, 2013, 06:41:26 PM
 #1

I am using MtGox's websockets api, and on the depth events it sometimes returns negative values for volume and volume_int

{
  "channel":"24e67e0d-1cad-4cc0-9e7a-f8523ef460fe",
  "depth":{
    "currency":"USD",
    "item":"BTC",
    "now":"1323644358437819",
    "price":"14.43",
    "price_int":"1443000",
    "total_volume_int":"849766000",
    "type":1,
    "type_str":"ask",
    "volume":"-2.71",
    "volume_int":"-271000000"
  },
  "op":"private",
  "origin":"broadcast",
  "private":"depth"
}

Why is this? Another problem I've encountered when constructing an order book is accounting for canceled trades. I'm wondering if perhaps negative values are used to indicate when a trade has been canceled?
loourr (OP)
Newbie
*
Offline Offline

Activity: 21
Merit: 0


View Profile
June 06, 2013, 08:04:34 PM
 #2

So I ran a test where I placed an order that I knew would be unique and then promptly canceled it, the whole time logging all depth objects to my terminal

The result was

{ price: '66',
  type: 2,
  type_str: 'bid',
  volume: '6.66',
  price_int: '6600000',
  volume_int: '666000000',
  item: 'BTC',
  currency: 'USD',
  now: '1370548662105838',
  total_volume_int: '37301280846' }

and shortly after

{ price: '66',
  type: 2,
  type_str: 'bid',
  volume: '-6.66',
  price_int: '6600000',
  volume_int: '-666000000',
  item: 'BTC',
  currency: 'USD',
  now: '1370548667379328',
  total_volume_int: '36635280846' }

Which leads me to conclue that negative volumes are in fact the result of a canceled trade
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!