Jan. 12, 2016, 10:23 a.m.
(Last edited by Judicious Use Of Deadly Force on Jan. 12, 2016, 11:46 a.m.)
The Refined Metal market page is rejecting a bid order with the same price as the highest standing bid order.
It gives the 1% error.
http://i.imgur.com/nhKctZW.pnghttp://i.imgur.com/EmFlBcb.pngThe correct behavior would be accepting the order.
The logic for dealing with this must test, before rejecting the order, if the new order matches another order in the opposite side of the book (which means it can be executed immediately and should always be accepted) and also if it is equal to the current best standing order on the same side of the book (in which case it should be always accepted). Only then should it be tested for 1% distance from the best current standing order.
In pseudo-code:
is_order_valid (order) [
.......if(order matches opposite order)[
..............return TRUE
.......] else if(order is equal or worse than same-side best standing order)[
..............return TRUE
.......] else if(order is 1% or more better than best same-side standing order)[
..............return TRUE
.......] else[
..............return FALSE
.......]
]
Obs.: extra whitespace and curly braces not allowed in the post; couldn't figure a better workaround; check
http://pastebin.com/raw/N5GgFXEq for proper version.
In the above:
- Being 'worse' means 'less than' for buy orders, and 'greater than' for sell orders;
- Being 'better' means 'greater than' for buy orders, and 'less than' for sell orders.
Note that the first condition, matching an order on the opposite side, does NOT mean having equal price to the best opposite order. ANY price that is better than the best opposite order price is a match and can be executed immediately satisfying both orders' conditions.
For instance, if the newly issued buy order being tested for validity before being accepted is offering to buy at 27 and best sell order already standing is offering to sell at 15, that is a match (should trigger the first 'if,' above) and the executed price should be 15. (Executing this order at 27, which is wrong, is the still persisting SCM market bug, but you are already aware of that.)
Note as well that taking the inverse approach and merely testing (without extra conditionals) for the new order being in the interval [0%, 1%] as a condition for rejection will not suffice, because it will potentially reject valid orders.
--
Please consider removing this 1% pricing rule at least for fungible items (commodity items, items which are effectively identical) such as metal, keys, and gems; it makes no sense, has no parallels, cannot be justified on a moral basis, and increases friction in trading--whereas the whole point of creating automated trading venues is to decrease friction.
The only people who think this is good are sellers who mistakenly think this will prevent the natural lowering of prices that comes about when a more efficient marketplace comes into function. By not realizing that prices are ultimately determined by supply and demand and not by petty numerical price bickering among sellers, they fail to understand that artificial price coarsening has nothing but a transient effect on price levels.
Cheers~