Websocket stream spot, chronological order of data? #270
CharlyEmpereurmot
started this conversation in
General
Replies: 1 comment 12 replies
-
Hi Charly! if you use historical data, you have only full candle sticks. (the closing one of each interval you used) if you subscribe to websocket you get an opening candle with 0 vol i think and then you receive updates if there are trades. so this is different from trainging data. you need to record this data to a database and train your network to it if it should be able to use data between two closing candles. the last kline should have is_closed = True Between 2 closing candles is minimum 1 minute, for me i think this never happend to be in the wrong order.... did you try to log your received candles and controll it? |
Beta Was this translation helpful? Give feedback.
12 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi! So I have been using this package for a while, thanks again for this Oliver :)
I'm applying some machine learning models to predict the next price action for a given period, just UP or DOWN. My models are calibrated according to historical data, then I stream (spot) data from Binance and make predictions, act accordingly. The predictions yield a continuous value within
[0, 1]
and I have a hard threshold that says for exampleif prediction > 0.55, then next_price_action = UP
.What is puzzling me is that I see some discrepencies in the predictions my models are making, when it's using historical data VS the live streamed data. Sometimes I will get
prediction = 0.56
using historical data and from the live streamed data I will getprediction = 0.54
. After investigating quite a lot, I don't think the problem comes from my code, but rather from the underlying data the models are fed. I'm NOT using a callback, but ratherstream_payload = binance_websocket_api_manager.pop_stream_data_from_stream_buffer()
. And I trigger a new predicton as soon as I see a new timestamp for a candle opening, on a given pair I want to trade.So I'm thinking now, the problem is that Binance does NOT send the candle information in the exact chronological order and/or these data do NOT come to my server in the correct chronological order, for whatever else reason.
Have you guys experienced similar behavior of the websocket streamed data? I have seen around that this is to be expected, but I did not think this would be so frequent. I had understood this could happen only "under Binance servers heavy load periods". What are you guys doing to handle this kind of problem?
Thank you very much for any advices you may provide!
Beta Was this translation helpful? Give feedback.
All reactions