altangent / ccxws

WebSocket client for 38 cryptocurrency exchanges
MIT License
619 stars 187 forks source link

Candle is final option ? #251

Open gelinger777 opened 3 years ago

gelinger777 commented 3 years ago

I wonder if there is option like in binance to check on candles if they are finite or no. Because when I subscribe to candles I am getting only the last one and that one dynamically is changing, but I need the last finalized one when it closes. Is that possible?

bmancini55 commented 3 years ago

Hi, thanks for submitting an issue!

I'm not entirely sure what you are asking though. Are you asking to include the "is kline closed" field for Binance candles or are you asking more generally if this functionality can be applied to other exchanges?

gelinger777 commented 3 years ago

@bmancini55 yes, both. See what is the problem. Let's say I am developing a bot. I want to achive following. I want to subscribe to OHLCV candles of given period. Let's assume it's 1h. So when I susbscribe , exchange each 2 second is sending me candle update. But the candle is not finite. In most of strategies we tend to use the close price of the given period candle. So it would be avesome in general to have a field in subscribeCandles , which says "isFinal":true or "isFinal":false . If you would look on https://github.com/jaggedsoft/node-binance-api#readme you can see that binance.websockets.candlesticks has a field in it , which says isFinal true/false. If you could make it so that your candlstick updates would include or would calculate somehow that and populate it, it would be enormous help for algo developers . Yes, for sure I can somehow catch the moment where one timestamp changes to other. But in general it would be great to be able to have to methods , to subscribe to candlestick updates of the current candle or to only finalized ones.