fluidex/dingir-exchange

feature: prevent self trade

Closed this issue · 1 comments

lispc commented

Motivation:

Many exchanges prevent self trade. Example:

https://support.kraken.com/hc/en-us/articles/360042529892-Self-trading-prevention

If two orders of the same quantity would result in self-execution, the maker (limit) order would stay on the order book and the taker (market) order would be cancelled (regardless of the size of the order).
In the case that an order can be partially filled from the order book, the remaining volume that would result in a self match would be cancelled.

In short, whenever self trade occurs, the taker will be cancelled.

Enabling self trade can trigger some subtle bugs more easily...

TODO:

add a config flag: enable_self_trade: bool, default false. When this flag is set, self trade is disabled like above

lispc commented

#103

done