bitshares / bsips

BitShares Improvement Proposals and Protocols. These technical documents describe the process of updating and improving the BitShares blockchain and technical ecosystem.
https://bitshares.github.io
63 stars 86 forks source link

BSIP-70 margin call mechanics needs to be adjusted wrt market fees #254

Open pmconrad opened 4 years ago

pmconrad commented 4 years ago

While discussing manual loan closure with @MichelSantos we noticed that the currently specified margin call process does not consider market fees. I. e. the margin call will try to buy back the missing debt, but even if it is filled, after paying market fees the remaining proceeds might not suffice to cover the gap.

This is particularly nasty because the market fee rate can change while the order is sitting on the book. It might be necessary to create/cancel the margin call order in each new block.