hitbtc-com / hitbtc-api

HitBTC API
GNU Lesser General Public License v3.0
322 stars 152 forks source link

WebSocket updateCandles method - open update vs closed candle? #236

Open tiagosiebler opened 5 years ago

tiagosiebler commented 5 years ago

I'm trying to integrate the hitbtc APIs with a framework. I noticed the websocket sends updateCandles for conflicting events:

How do I differentiate the two? They look exactly the same:

{"jsonrpc":"2.0","method":"updateCandles","params":{"data":[{"timestamp":"2019-05-10T10:11:00.000Z","open":"0.00990563","close":"0.00990563","min":"0.00990563","max":"0.00990563","volume":"1063","volumeQuote":"10.52968469"}],"symbol":"SMARTUSD","period":"M1"}}
{"jsonrpc":"2.0","method":"updateCandles","params":{"data":[{"timestamp":"2019-05-10T10:11:00.000Z","open":"0.00990563","close":"0.00990563","min":"0.00990563","max":"0.00990563","volume":"2115","volumeQuote":"20.95040745"}],"symbol":"SMARTUSD","period":"M1"}}
{"jsonrpc":"2.0","method":"updateCandles","params":{"data":[{"timestamp":"2019-05-10T10:11:00.000Z","open":"0.00990563","close":"0.00990564","min":"0.00990563","max":"0.00990564","volume":"3167","volumeQuote":"31.37114073"}],"symbol":"SMARTUSD","period":"M1"}}

These are clearly updates for a candle still building, but if there are no trades for a while, I won't get any further updates (even if the current candle has since closed). Has anyone challenged this scenario their own way? Would love hitbtc to just include "isClosed:true" just like binance does.