Closed kypanz closed 3 years ago
Hello @kypanz,
Is this an issue with Pandas TA rvgi implementation?
Kind Regards, KJ
hello ,thanks for answer , yes i dont know how to take the correct values , because y enter the series to rvgi and this returns only "NaN" in all 14 periodes, i dont know how to get the values , if you can giveme a example how to use correcly i really apreciate , sorry for my bad english
Hello @kypanz,
I see. What Pandas TA version are you running? Where are you getting your data? Do you have sample data you can share?
You should also upgrade to the Latest Version of Pandas TA:
$ pip install -U git+https://github.com/twopirllc/pandas-ta
Thanks, KJ
What Pandas TA version are you running?
Where are you getting your data ?
Do you have sample data you can share ?
defaultdict(<class 'dict'>, {1613131740: {'id': 2451059, 'from': 1613131740, 'at': 1613131770002146510, 'to': 1613131770, 'open': 105.027, 'close': 105.027, 'min': 105.026, 'max': 105.027, 'volume': 16}, 1613131770: {'id': 2451060, 'from': 1613131770, 'at': 1613131800018129113, 'to': 1613131800, 'open': 105.027, 'close': 105.027, 'min': 105.027, 'max': 105.028, 'volume': 11}, 1613131800: {'id': 2451061, 'from': 1613131800, 'at': 1613131830026267932, 'to': 1613131830, 'open': 105.027, 'close': 105.033, 'min': 105.027, 'max': 105.033, 'volume': 32}, 1613131830: {'id': 2451062, 'from': 1613131830, 'at': 1613131860014628690, 'to': 1613131860, 'open': 105.032, 'close': 105.033, 'min': 105.032, 'max': 105.033, 'volume': 2}, 1613131860: {'id': 2451063, 'from': 1613131860, 'at': 1613131890015790369, 'to': 1613131890, 'open': 105.033, 'close': 105.033, 'min': 105.033, 'max': 105.033, 'volume': 7}, 1613131890: {'id': 2451064, 'from': 1613131890, 'at': 1613131920026275303, 'to': 1613131920, 'open': 105.033, 'close': 105.029, 'min': 105.029, 'max': 105.033, 'volume': 19}, 1613131920: {'id': 2451065, 'from': 1613131920, 'at': 1613131950026262648, 'to': 1613131950, 'open': 105.029, 'close': 105.031, 'min': 105.028, 'max': 105.031, 'volume': 20}, 1613131950: {'id': 2451066, 'from': 1613131950, 'at': 1613131980016177934, 'to': 1613131980, 'open': 105.031, 'close': 105.03, 'min': 105.029, 'max': 105.031, 'volume': 7}, 1613131980: {'id': 2451067, 'from': 1613131980, 'at': 1613132010002298635, 'to': 1613132010, 'open': 105.03, 'close': 105.038, 'min': 105.03, 'max': 105.038, 'volume': 13}, 1613132010: {'id': 2451068, 'from': 1613132010, 'at': 1613132040000991819, 'to': 1613132040, 'open': 105.038, 'close': 105.037, 'min': 105.037, 'max': 105.038, 'volume': 2}, 1613132040: {'id': 2451069, 'from': 1613132040, 'at': 1613132070018338099, 'to': 1613132070, 'open': 105.037, 'close': 105.039, 'min': 105.037, 'max': 105.039, 'volume': 6}, 1613132070: {'id': 2451070, 'from': 1613132070, 'at': 1613132100007899342, 'to': 1613132100, 'open': 105.039, 'close': 105.033, 'min': 105.031, 'max': 105.039, 'volume': 12}, 1613132100: {'id': 2451071, 'from': 1613132100, 'at': 1613132130005581330, 'to': 1613132130, 'open': 105.033, 'close': 105.028, 'min': 105.028, 'max': 105.033, 'volume': 12}, 1613132130: {'id': 2451072, 'from': 1613132130, 'at': 1613132160002531932, 'to': 1613132160, 'open': 105.028, 'close': 105.039, 'min': 105.028, 'max': 105.039, 'volume': 27}, 1613132160: {'active_id': 6, 'size': 30, 'at': 1613132184419742234, 'from': 1613132160, 'to': 1613132190, 'id': 2451073, 'open': 105.038, 'close': 105.036, 'min': 105.036, 'max': 105.038, 'ask': 105.04, 'bid': 105.032, 'volume': 4, 'phase': 'T'}})
now i updated to pandas-ta version 0.2.42b0 , i have the same problem i still se "NaN" values
Hi @kypanz,
from iqoption api , this returns to me a dictionary with the candles information
IQOption returns exactly what you shared below, including the defaultdict(<class 'dict'>, ...
? Or are you creating your candles
variable as a defaultdict
? What is the actual data you get? Where is link to IQOption API data? I want to see the actual source they return.
Also, rvgi requires by default a minimum of 14 candles, but 15 candles to write it's first value. This goes for most indicators that have rolling windows. So with only 14 candles, the first 14 candles of rvgi will be NaN
. In short, trying using more data or shortening the lengths of your indicators.
When I strip the defaultdict(<class 'dict'>, ...)
that you have provided, convert it to a Pandas DataFrame and adjust the rvgi length to 12, I get data. Here is the code:
import pandas as pd
import pandas_ta as ta
candles = {1613131740: {'id': 2451059, 'from': 1613131740, 'at': 1613131770002146510, 'to': 1613131770, 'open': 105.027, 'close': 105.027, 'min': 105.026, 'max': 105.027, 'volume': 16}, 1613131770: {'id': 2451060, 'from': 1613131770, 'at': 1613131800018129113, 'to': 1613131800, 'open': 105.027, 'close': 105.027, 'min': 105.027, 'max': 105.028, 'volume': 11}, 1613131800: {'id': 2451061, 'from': 1613131800, 'at': 1613131830026267932, 'to': 1613131830, 'open': 105.027, 'close': 105.033, 'min': 105.027, 'max': 105.033, 'volume': 32}, 1613131830: {'id': 2451062, 'from': 1613131830, 'at': 1613131860014628690, 'to': 1613131860, 'open': 105.032, 'close': 105.033, 'min': 105.032, 'max': 105.033, 'volume': 2}, 1613131860: {'id': 2451063, 'from': 1613131860, 'at': 1613131890015790369, 'to': 1613131890, 'open': 105.033, 'close': 105.033, 'min': 105.033, 'max': 105.033, 'volume': 7}, 1613131890: {'id': 2451064, 'from': 1613131890, 'at': 1613131920026275303, 'to': 1613131920, 'open': 105.033, 'close': 105.029, 'min': 105.029, 'max': 105.033, 'volume': 19}, 1613131920: {'id': 2451065, 'from': 1613131920, 'at': 1613131950026262648, 'to': 1613131950, 'open': 105.029, 'close': 105.031, 'min': 105.028, 'max': 105.031, 'volume': 20}, 1613131950: {'id': 2451066, 'from': 1613131950, 'at': 1613131980016177934, 'to': 1613131980, 'open': 105.031, 'close': 105.03, 'min': 105.029, 'max': 105.031, 'volume': 7}, 1613131980: {'id': 2451067, 'from': 1613131980, 'at': 1613132010002298635, 'to': 1613132010, 'open': 105.03, 'close': 105.038, 'min': 105.03, 'max': 105.038, 'volume': 13}, 1613132010: {'id': 2451068, 'from': 1613132010, 'at': 1613132040000991819, 'to': 1613132040, 'open': 105.038, 'close': 105.037, 'min': 105.037, 'max': 105.038, 'volume': 2}, 1613132040: {'id': 2451069, 'from': 1613132040, 'at': 1613132070018338099, 'to': 1613132070, 'open': 105.037, 'close': 105.039, 'min': 105.037, 'max': 105.039, 'volume': 6}, 1613132070: {'id': 2451070, 'from': 1613132070, 'at': 1613132100007899342, 'to': 1613132100, 'open': 105.039, 'close': 105.033, 'min': 105.031, 'max': 105.039, 'volume': 12}, 1613132100: {'id': 2451071, 'from': 1613132100, 'at': 1613132130005581330, 'to': 1613132130, 'open': 105.033, 'close': 105.028, 'min': 105.028, 'max': 105.033, 'volume': 12}, 1613132130: {'id': 2451072, 'from': 1613132130, 'at': 1613132160002531932, 'to': 1613132160, 'open': 105.028, 'close': 105.039, 'min': 105.028, 'max': 105.039, 'volume': 27}, 1613132160: {'active_id': 6, 'size': 30, 'at': 1613132184419742234, 'from': 1613132160, 'to': 1613132190, 'id': 2451073, 'open': 105.038, 'close': 105.036, 'min': 105.036, 'max': 105.038, 'ask': 105.04, 'bid': 105.032, 'volume': 4, 'phase': 'T'}}
candlesdf = pd.DataFrame(candles).T
candlesdf.rename(columns={"max": "high", "min": "low"}, inplace=True)
candlesdf.ta.rvgi(length=12, append=True)
print(candlesdf.shape)
print(candlesdf)
Output
Also note, you will also need to convert your index into a DatetimeIndex if you want to use other indicators like vwap.
Let me know how it goes. Hope this helps!
Thanks, KJ
@twopirllc IQOption returns exactly what you shared below, including the defaultdict(<class 'dict'>, ...?
Or are you creating your candles variable as a defaultdict?
What is the actual data you get? Where is link to IQOption API data?
Also, rvgi requires by default a minimum of 14 candles, but 15 candles to write it's first value. This goes for most indicators that have rolling windows
This goes for most indicators that have rolling windows. So with only 14 candles, the first 14 candles of rvgi will be NaN
@kypanz,
I can not create an IQ Option account from the US and will not be able to test their output that you get. You will have to manage the data from that unofficial iqoption api yourself.
yes but the problem here is the rvgvi returns 2 values , value A = rvgi , value B = signal of rvgi , that is the reason when you print the result of rvgi you see "RVGI_12_4" and "RVGIs_12_4" , when rvgi has "s" is the signal
I know how rvgi works. The signal B is a lagged version of A and will not start calculating till A has started.
... , and that value is not the same with the graphics values, and the next index 16 have 2 values , the rvgi and the signal values , but that values are not correct value, this not happend with the RSI , RSI works fine , but with this indicator is not the values what i see, and i dont know if i doing wrong or the operations from the functions and returns are wrong
I can not access to how IQOptions calculates rvgi nor view it's source. So if there are differences in computation between their closed system (and graphics values) and this open source version, then that is beyond my control without insight into their source. It is not uncommon for different platforms to have slight variations in calculations. Even the de facto TA Lib in C they sometimes have different calculations by platform.
Unfortunately, I can not devote much time on a one off difference in computation without further evidence. There is clearly a lack of data to reasonably test this information both for one off differences and a test of correlation between IQOptions calculation and Pandas TA versions of rvgi. Somehow you need to be able to export both their candles and their rvgi data so that it can be more easily compared. Now it is possible that swma could be throwing the values off, but yet again you do not have data for comparison, just a "graphics value".
When you are able to give me more actionable data to work with, I can look into it.
Kind Regards, KJ
@twopirllc this week i go to calculate rvi my self to see what really happend , because is difficult to explain this things when the dictionary is not in real time to compare in graphics
in : https://github.com/twopirllc/pandas-ta/blob/master/pandas_ta/momentum/rvgi.py lines : 21 - 23
in line : 62
i use that link to see how to calculate , in that article what i understand is you need open-close values , and the next 2 variables multiply x2 ,
but i dont know , i wanna check to see what happend the easy method to see if this values of this functions are correctly is taken a X api to take values, not necessary iqoption api, only need compare that values with X api and compare the graphics values , not need be exactly the same result , but yes a little accuarcy, if the api returns a little accuarcy value i am using the function in wrong way , if the result are not the same of the graphics the functions has wrong calculation
i really appreciate you, to answer all my existential questions, have a good weekend
@kypanz
this week i go to calculate rvi my self to see what really happend , because is difficult to explain this things when the dictionary is not in real time to compare in graphics
Cool. I think rvgi's numerator/denominator swma values may be causing the Issue. But without their IQOption's raw data including their rvgi (graphics data) value it may take some time to isolate and fix.
but i dont know , i wanna check to see what happened
No worries. But I would fork, edit (keep the default as an option), and submit a PR if you find a fix. Also provide accurate data so I can independently verify results with you.
i really appreciate you, to answer all my existential questions, have a good weekend
No worries. Thanks. You too!
Kind Regards, KJ
Hello @kypanz,
How is this coming along?
I will be closing this Issue in the new few days if there is no continued activity. Feel free to reopen when you are ready to continue this Issue.
Kind Regards, KJ
Hello all , i have a question , i create the next code :
But when i print "resultRVI" i got this :
The question is why i recibe NaN values , i cant understand , some one can help me please 😭