are you sure the settle price is always the settlement price(feed price)?
if yes, then when one user settle, who is his counterparty?
It should take the highest bids first, down to the feed, and then the least collateralized short.
A side note, if there are bids higher than feed price already, why bitcny holders would use settle instead of sell?
If there are active settle orders already, why place bids higher than feed price?
By the way the fee for placing a settle order is 200BTS.
I would advice add a parameter for settle price rate: settle price = feed price * rate
the rate's range can adjust from 95% to 105%, mostly it should more than 100%
and need another logic to protect shorters, if a shorter's colla rate is more than 200%, no one can settle from him.
No need to set another parameter, just feed the settlement_price to what it should be, it's designed to should not be equal to (weighted) average exchange price.
bts's price is 0.021CNY/BTS at BTC38
but most witness give a feed price at 0.02 CNY/BTS, so the settle price is 0.02
The reason is the price feed script calculates price of bts/cny not only from btc38/yunbi, but also includes some weight by [average price of bts/btc on poloniex/bitfinex] * [average price of btc/usd on external exchanges(bitstamp and so)] * [usd/cny price from yahoo]. When prices of BTC on USD exchanges are lower than which on CNY exchanges, the bts/cny price feed will be lower than the price on btc38.
what will happen?
people sell BTS at BTC38 at price 0.021, get fiat CNY, then sell fiat CNY to transwiser, get bitCNY, then settle at the wallet, buy back BTS at price 0.02
who gets hurt? the shorters again! why we always hurt the shorters? they provide liquility, but we hurt them again and again
In this case Transwiser should charge more fees while selling bitCNY.
And Transwiser should consider it's collateral level seriously to avoid being forced settled.