Tucsky / SignificantTrades

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

OKex Future volumes not showing correctly. #42

Closed joyser closed 5 years ago

joyser commented 5 years ago

When trying to get OKex futures, the volumes are showing as Bitcoin/Ether amounts, and the volume values of the trades aren't matching with the live trade stream from OKex. Each contract on OKex is worth 100$ for BTC and 10$ for all the other contracts. Maybe we need to load this data, or have a setting to override the quote/base currency as I think its presuming those currencies wrong at the moment.

PS awesome tool, using it all the time.

joyser commented 5 years ago

Example would be EOS0628 as the pair which is OKex EOS futures expiring end of June 2019

Tucsky commented 5 years ago

Thanks, the number of contract wasn't calculated correctly, what I did here https://github.com/Tucsky/SignificantTrades/commit/72c44ff6683822290666682e1ce5e88962d88fe4 is obviously not working anymore. I can't remember why I did that tho, something must have changed on the api?? Just passing reported volume is enough now

Then to have the exact same results as this trade feed from okex https://www.okex.com/futureTrade/futureMarket.do?currencyId=20&contractType=4 I had to disable trade grouping. Its the default behavior of this app, actually not an option, trades with the same timestamp (millisecond) & same side are merged into one.

For the base/quote currency symbol thing, yup, overriding them in the settings would be great 👍 I changed the quote currency to bitcoin a few months ago, and "EOS0628" doesn't give any hint on the quote currency 😡

joyser commented 5 years ago

There's three issues it seems which are kind of intertwined here. 1) The app presumes reported volume is in the Base currency, whereas OKex futures are reported in the quote currency. Hence why you inverted it, I guess, in 72c44ff. 2) Okex futures are worth a multiplier of USD value. The bitcoin contract is worth 100$, which is what you have done in 72c44ff. However all the other futures are 10$ 3) Because the app has not detected that EOS and ETH futures use USD as quote, it shows the base volume in the trade view, which is the correct contract value, but the incorrect number of ETH/EOS.

So in summary the latest update appears to work some what for EOS and ETH futures now, but maybe broke the functionality of the BTC futures. I think its better as it is now for the time being !

I can try and work on a solution a bit later in the week probably!

Tucsky commented 5 years ago

OK .. so I didn't knew, but Okex released v3 api in october last year! Ive looked into the doc and its actually pretty great, common/similar rest/ws endpoint for spot/margin/future/perps We can't even acces perps or margin as of today using the current implementation ! This should fix everything.

I will try to push the update tomorrow 🙏

Tucsky commented 5 years ago

Api update

Contract value is hard coded (100 for btc, 10 for everything else)

joyser commented 5 years ago

wow, great job! that's amazing dude!

joyser commented 5 years ago

could we change the counters so it reflects the quote currency volume instead of base currency volume? This way it would match the stats values. I forked your Repo and changed what I think would do it, but there might be other things I'm missing for it to function correctly; like to add a dollar sign somewhere / quote currency symbol in there too.

joyser commented 5 years ago

Also, the '-' character in the URL: https://EOSUSD-quarter.aggr.trade seems to flag an SSL security warning. All the other pairs work fine.

Tucsky commented 5 years ago

I think this particular issue is resolved now? Let me know if this switch image did the job

joyser commented 5 years ago

yeah perfect mate, all good