|
Title: negative volumes in MtGox depth event Post by: loourr on June 06, 2013, 06:41:26 PM 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? Title: Re: negative volumes in MtGox depth event Post by: loourr on June 06, 2013, 08:04:34 PM 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 |