Tucsky / SignificantTrades

better than 1 min chart
https://aggr.trade
GNU General Public License v3.0
621 stars 211 forks source link

Feature Request: OKex liquations #45

Open joyser opened 5 years ago

joyser commented 5 years ago

I think it would be awesome to have OKex liquidations showing up similar to Bitmex.

Unfortunately, it doesn't look like there is a socket for liquidations on OKex, just a http: endpoint which contains the data: Eg. Filled liquidations: https://www.okex.com/api/futures/v3/instruments/ETH-USD-190927/liquidation?status=1&from=0&limit=50 Unfilled liquidations: https://www.okex.com/api/futures/v3/instruments/ETH-USD-190927/liquidation?status=0&from=0&limit=50

Tucsky commented 5 years ago

Dope! I was looking for thoses. But as you pointed out it is http endpoint and okex does not have any Access-Control-Allow-Origin header set.

I will implement it in the old version tho, just for fun 👍

joyser commented 5 years ago

Nice! And yeah, I think you're right, probably no one running their own instance! Maybe in future, if there was more demand, I could look at setting up a light weight node.js server to retrieve OKex liquidations, and serve them through a websocket to your app. What do you think? How many people do you think use your app at any one time?

Tucsky commented 5 years ago

It would work yeah, not a big fan of running a server just for that tho, and what if I want liquidations on LTCUSD, does the server track them as well ? idk Best solution would be to port aggr.trade into an electron app. C.O.R.S. free.

Another question, do you know what the "loss" part mean exactly ? From my understanding (and Im really not an expert) if a position get liquidated you lost everything yet https://www.okex.com/api/swap/v3/instruments/BTC-USD-SWAP/liquidation?status=1&from=1&limit=20 list all of them with 0 loss, I wonder why

joyser commented 5 years ago

That's a fair point.. I didn't think of the other coins.

The loss, as far as I know, is the margin the user attaches to the position. In fixed margin mode the user can attach 1BTC to a position without having to put everything they have in their account at risk. When their margin call price is reached, they will be liquidated and lose the 1BTC only. In cross margin mode the loss would be their whole account balance. The price, it seems to me, is the bankruptcy price. The margin call price (ie. the price the user gets liquidated) = bankruptcy price + minimum maintenance margin %. Note that the minimum maintenance margin is different depending on the size of the position, so the bigger the order the further you get liquidated from the bankruptcy price.

More here: https://www.okex.com/future/trade/position