-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
isFulfilledData should only consider value
and not open
#1526
Comments
It depends on the type of series that the data is intended for. The library expects one of the following:
As you can see there is no overlap of keys thus it is safe to check if the data is fulfilled by checking if either |
I see that and I may not be using the API as intended, but it does seem like an unintended side effect. As I start with my candles and I compute my signal and add that as a the value. Then I pass the new data array as the argument for my line. Psuedocode:
However, for the first values in the line series with undefined values (like sma_30) will error out saying "... series item data value of open must be a number ... " from here, since the validator will be true as (open OR value) is present. Specifically, I had to change my code as follows:
I ask, because it seems it's a bug for line series to tell me Edit: The assert is from the |
I guess I'm just asking if there could instead be a |
In principle it should be fine to add a different checker for each data type. It would probably only add a tiny bit to the bundle size and be easy to implement. So if you create a PR and the increase to the bundle size is tiny then we would consider merging it. Whether it is required is still debatable because the types for The suggested approach would be to modify your Additionally, we actually already have a code sample for an SMA indicator on candles data here: https://jsfiddle.net/TradingView/537kjtfg/ |
I guess I've already written the code to avoid the issue so it's solved for me in a way, but when doing something quick I keep running into it. I use TS but I didn't see a compiler error, I'll look into that too. I should have time soon to try out a PR and see how the build size changes, it'll give me a better understanding of that portion of the code too. Thanks. |
I've created a PR. Let me know what you think, thanks! |
Lightweight Charts™ Version: latest
Following up from my question in discussions I encounter this as a bug often.
As Whitespace is a data item without a value from here: https://tradingview.github.io/lightweight-charts/docs/api/interfaces/WhitespaceData. However the function which I believe is where this is checked considers if
open
is also present and will throw and error: https://github.com/tradingview/lightweight-charts/blob/master/src/model/data-consumer.ts#L188The text was updated successfully, but these errors were encountered: