-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
The results obtained by streaming and api are very different #600
Comments
Yes, for the indicators that have memory, giving them more past data points to look at result in a “more accurate” indicator. The streaming api looks at a minimal number to calculate, so it’s faster. I wonder if there is a way to tell it to use all available data points but only calculate one value, it was not able to do that when I looked at it before. On Jun 27, 2023, at 5:10 AM, gucasbrg ***@***.***> wrote:
import talib as ta
from talib import stream as ta_stream
close = np.random.random(100)
output = ta.RSI(close, timeperiod=period)
latest = ta_stream.RSI(close, timeperiod=period)
print(output)
print(latest)
print(output[-1] - latest)
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
In the simplest case (SMA) a (truly) streaming api keeps the intermediate value of the sum of the window. When a new value arrives, it subtracts the last element, and adds the new one and returns the mean. |
Once we start maintaining TA-Lib C library, this would be an interesting PR to work on.
… On Jul 10, 2023, at 11:46 PM, Francesco Giannelli ***@***.***> wrote:
In the simplest case (SMA) a (truly) streaming api keeps the intermediate value of the sum of the window. When a new value arrives, it subtracts the last element, and adds the new one and returns the mean. (PREV_SUM - tail + head) / length.
This is why you need the intermediate state like in https://github.com/trufanov-nok/ta-lib-rt
All the indicators that use some kind of recursion need an intermediate state from which to compute the latest value, and this is not generalizable into an api, it needs adhoc implementations for each indicators
—
Reply to this email directly, view it on GitHub <#600 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAAF5A6TOOBFHW43UA3WJELXPTZD3ANCNFSM6AAAAAAZVSTPLA>.
You are receiving this because you commented.
|
The text was updated successfully, but these errors were encountered: