vegaprotocol / vega

A Go implementation of the Vega Protocol, a protocol for creating and trading derivatives on a fully decentralised network.
https://vega.xyz
GNU Affero General Public License v3.0
38 stars 22 forks source link

IOC orders that are close have the wrong status #620

Closed ashleyvega closed 4 years ago

ashleyvega commented 4 years ago

In GitLab by @edd on Jan 6, 2020, 16:51

If an IOC order is partially filled or not at all filled, the order status should be CANCELLED. It is currently STOPPED.

Size Filled Status
100 0 CANCELLED
100 50 CANCELLED
100 100 FILLED
ashleyvega commented 4 years ago

In GitLab by @jeremyletang on Jan 6, 2020, 17:08

It’s always Been like that, there may be an historical reason for that? @barnabee may know?

ashleyvega commented 4 years ago

In GitLab by @cdm on Jan 6, 2020, 18:09

I can fix this in !514 if @barnabee or @tamlyn10 are happy with it being cancelled rather than STOPPED

ashleyvega commented 4 years ago

In GitLab by @cdm on Jan 7, 2020, 11:23

Fixed in #618

ashleyvega commented 4 years ago

In GitLab by @cdm on Jan 7, 2020, 11:24

SO We're moving this to Cancelled for IOC status, Stopped will still be a status on FOK

ashleyvega commented 4 years ago

In GitLab by @tamlyn10 on Jan 7, 2020, 12:57

Hi all, this is an interesting one.. my gut response is that I'm not sure I agree with a cancelled status for an IOC order when partially or fully unfilled. To me cancelled status is something that should indicate that the trader cancelled it or the protocol cancelled it as part of position resolution. i.e. it was a valid order but was cancelled and removed from the order book.

When unfilled or partially filled IOC occurs, the order is actually "executed" or "completed" regardless of how much was actually filled, if the matching engine has processed that order according to the embedded rules of the matching engine for an order of that type.

I appreciate that the order reaches a point where it is no longer valid for any of the remaining volume.. I would prefer that had a different status to cancelled but the intricacies of matching engine data structures are not my specialty...

@barnabee ?

ashleyvega commented 4 years ago

In GitLab by @pand-dev on Jan 7, 2020, 14:33

If that helps at all, NYSE Arca docs suggest cancellation ( https://www.nyse.com/publicdocs/nyse/markets/nyse-arca/NYSE_Arca_Order_Suite.xlsx ):

A Limit Order designated IOC is to be traded in whole or in part on the NYSE Arca Marketplace as soon as such order is received, and the quantity not so traded is cancelled. A Limit IOC Order does not route. A Limit IOC Order to buy (sell) may be designated with a minimum trade size ("MTS"), which will trade against sell (buy) orders in the NYSE Arca Book that in the aggregate, meets its MTS. On entry, a Limit IOC Order with an MTS must have a minimum of one round lot and will be rejected on arrival if the MTS is larger than the size of the Limit IOC Order. A Limit IOC Order with an MTS that cannot be immediately traded at its minimum size will be cancelled in its entirety.

On the other hand LSE, seems to "expire" them ( https://www.londonstockexchange.com/products-and-services/trading-services/guide-to-new-trading-system.pdf ):

Immediate or Cancel. Executed on entry, with any remaining unexecuted volume expired

Xetra (Deutsche Borse, https://www.xetra.com/xetra-en/trading/order-types/execution-conditions ):

An immediate-or-cancel order (IOC order) is one which has to be executed immediately and fully, or as fully as possible. Non-executed parts of an IOC order are deleted without entry in the order book.

ashleyvega commented 4 years ago

In GitLab by @jeremyletang on Jan 14, 2020, 12:07

Closing this. A new ticket will be created once the specs for order status is merged, approved, etc (https://gitlab.com/vega-protocol/product/merge_requests/42/diffs), so we can have a pass over all Orders status, not just the IOC ones.

ashleyvega commented 4 years ago

In GitLab by @jeremyletang on Jan 14, 2020, 12:07

closed