-
Notifications
You must be signed in to change notification settings - Fork 765
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
Streaming Issue in Intraday #359
Comments
following |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I Have implemented streaming using web socket data based on the
[https://www.tradingview.com/charting-library-docs/latest/tutorials/implement_datafeed_tutorial/Streaming-Implementation/] but it suits only historical data, not working for Intraday.
Actual Scenario: Assume have refresh the charts at 12:48pm, with 30m interval, got data upto 12:45pm from getBars and streaming subscribed then upto 12:59:59pm data updates on 12:45 candle.
when time reaches to 01:00 pm new candle plots here instead of 01:15pm. Observed it happens only at when Heikin Ashi selects.
** Expected**
How to implement streaming for Intraday(Minute data) and Historical data?
Note: We are not found any relevant example from official documentation. So, we are taken reference as [https://medium.com/@jonchurch/tv-part-2-b8c2d4211f90]
The below code is core logic for candle update
`function updateBar(streamResponse, sub) {
var lastBar = sub.lastBar;
let resolution = sub.resolution;
if (resolution.includes('D')) {
// 1 day in minutes === 1440
resolution = 1440
} else if (resolution.includes('W')) {
// 1 week in minutes === 10080
resolution = 10080
}
var coeff = resolution * 60 * 1000;
// console.log({coeff})
var rounded = Math.floor(streamResponse.tradeTime / coeff) * coeff;
var lastBarSec = lastBar.time;
var _lastBar;
}`
The text was updated successfully, but these errors were encountered: