New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating DataCube on real-time data #136
Comments
On the way to solve this, it could be a reasonable workaround ignore the last candle retrieved, creating a candle by myself using the ignored candle's data and updating it using the new values until finish the timestamp and then let the the library works as default? |
From what it sounds like, you are trying to have the latest candle shown when it is not yet saved to your OHLC data? What I do -- since I collect all the ticks happening -- is when the page is loading I create a |
@smcgovern ok but when do you get the old candles, do you ignore the last one (which is not completed yet)? On my chart, I make a XHR request to retrieve all candles of 5 minutes duration, and shows. Then start a WebSocket connection to handle price/volume data which by definition creates a new candle from the first chart update call, but the last candle of XHR request doesn't have closed yet and the first WebSocket data should be added on it (until the 5min time-step gets reached), which is not working |
Correct me if I am wrong but the new websocket information should only create a new candle if its time is greater than the last candles + the timeframe interval you are watching. I'd have to see the code to really get whats going on, some exchanges share OHLCV data with the currently drawn candle coming, others don't. I personally manage all the ticks and OHLC creation and fetch them from my local database, so when I'm fetching 5 minute data and the latest candle is 3 minutes away from being created, it gets appended as |
Yes, you're right. If all candles have 5min difference between themselves and the WS data (price/volume) is fetched before the next timeframe (5min) the last candle should be updated before, instead of the library creates a new one automatically
I think you done similar what I asked: Fetch only the closed candles, retrieve the the information needed for create a new candle (latestCandle), updating this candle using WSS info until close and just after that let the library does its job. If I'm correct I don't know how to stop updating the latestCandle and let the library creating new ones by itself. The method I used was the fully-auto one: // WSS onmessage method returning price-volume |
Just append the latestCandle to the OHLC data, the system should automatically know it isn't closed yet. Insert the unclosed candle into the OHLCV array before even feeding it into tvjs. |
@smcgovern what the difference between doing that and fetch all 5min candles from XHR including last one which doesn't have closed yet, and just append WSS data (price/volume) through chart.update? This it should the correct behavior by system, shouldn't? |
There should be no difference, if the OHLC data is coming with an unclosed candle and you use |
That's what I expected, but is not happening so I opened this issue due
this behavior.
Is your app working fine by this idea?
On Thu, 3 Sep 2020 at 19:51 smcgovern ***@***.***> wrote:
There should be no difference, if the OHLC data is coming with an unclosed
candle and you use chart.update() it should just append to the unclosed
candle.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#136 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADRAKW7HVLKAUOBRRMOMHTTSEAMVVANCNFSM4QSK4U2A>
.
--
Atenciosamente,
Adson Damasceno
|
It is working for me, if you could recreate the problem using https://tvjs.io/play/ I'd def take a look at it. |
I will try to simulate the xhr and wss process. By the way are you using
UTC+0 timezone? I had to change to mine as suggested by the author of
library
On Thu, 3 Sep 2020 at 19:57 smcgovern ***@***.***> wrote:
It is working for me, if you could recreate the problem using
https://tvjs.io/play/ I'd def take a look at it.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#136 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADRAKW4HV56SNU2F3STFIBDSEANLXANCNFSM4QSK4U2A>
.
--
Atenciosamente,
Adson Damasceno
|
Yes I convert everything to UTC when I save OHLC data to my local db, its actually a preference I use before finding this project so I really think nothing of it. Timezones be cool though. |
I see, in my case I save everything in my current timezone and changed 2
library functions to show the botbar on my timezone. I don't know if this
change could be causing this problem
On Fri, 4 Sep 2020 at 01:44 smcgovern ***@***.***> wrote:
Yes I convert everything to UTC when I save OHLC data to my local db, its
actually a preference I use before finding this project so I really think
nothing of it. Timezones be cool though.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#136 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADRAKWZFQVQWF3Z2RPGXLKDSEBWERANCNFSM4QSK4U2A>
.
--
Atenciosamente,
Adson Damasceno
|
This shouldn't be closed. I'm still facing this problem |
@adsonvinicius I think @smcgovern did a great job of answering your question. This part will likely be improved. |
@C451, Sure he helped me, but I let the timestamps as UTC+0 on fetched candles and removed the "t += new Date(t).getTimezoneOffset() * MINUTE" from botbar.js functions and the system still creates a new candle when it shouldn't. But if the auto-create candle checks whether the actual time still belongs to a created candle preventing create a new one, it's my bad then. |
@adsonvinicius if you believe that there is a bug, create an issue using the template. That means I should be able to just copy paste the code/data and see the problem. If you don't value my time, why should I value your problems? |
@C451 I think you misunderstood. You labelled as a question which it really was one. I could not reproduce because the data I fetch to simulate is real, and the market was closed on last 3 days, so I had to wait and see to provide what @smcgovern asked me to do. I really don't get it why is this related to value time of anyone. I post here because someone can help me pointing what I couldn't see. just this. Despite all of this, I really appreciate your job. |
A workaround i did for this: Just changed the now function on util.js
I guess if you consider all date on your current timezone, it should works. At least for my issue. |
Checking docs I could see 3 possibilites of updating chart, using real-time data changes. The auto-timestamp idea behind price/volume updates considering open a new candle at moment of chart update call. However when retrieving previous (from now) candles sometimes the last candle isn't closed yet (depending of timeframe used). So is there a way to update the current candle when the now-timestamp still belongs to an opened candle?
The text was updated successfully, but these errors were encountered: