1

I am using MtGox's websocket api to construct an order book. The trouble I'm having is that every once in a while, the depth event will return an JSON object with negative volume and negatie 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"
} 

What does this mean? I'm wondering if it could perhaps be to indicate an order has been canceled

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

{ 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 conclude that negative volumes are in fact the result of a canceled trade

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.