0

I encountered unusual behavior of libraries for technical analysis. Talib and pandas_ta accepts no more than 114130 lines of data.

pandas_ta.stdev(closes[:114133], 3)

Open time
2021-02-04 16:33:00+00:00          NaN
2021-02-04 16:34:00+00:00          NaN
2021-02-04 16:35:00+00:00    28.750097
2021-02-04 16:36:00+00:00     2.780675
2021-02-04 16:37:00+00:00     7.548603
                               ...    
2021-04-25 04:00:00+00:00    32.036358
2021-04-25 04:01:00+00:00          NaN
2021-04-25 08:45:00+00:00          NaN
2021-04-25 08:46:00+00:00          NaN
2021-04-25 08:47:00+00:00          NaN
Name: STDEV_3, Length: 114133, dtype: float64

If you pass a dataframe with a large number of lines in any of the indicators of these libraries, all values ​​after 114130 will be equal to NaN. I need to process more than 1 million lines. Is there an easy way to get around this limitation?

I found a solution using the df.rolling function.

pd.DataFrame(closes).rolling(4).std()

Open time   
2021-02-04 16:33:00+00:00   NaN
2021-02-04 16:34:00+00:00   NaN
2021-02-04 16:35:00+00:00   NaN
2021-02-04 16:36:00+00:00   31.536164
2021-02-04 16:37:00+00:00   8.940106

2023-03-23 16:28:00+00:00   36.785568
2023-03-23 16:29:00+00:00   11.671006
2023-03-23 16:30:00+00:00   20.051231
2023-03-23 16:31:00+00:00   17.322779
2023-03-23 16:32:00+00:00   23.526981
1117888 rows × 1 columns

But this method does not suit me because pandas does not have many indicators that I need to solve tasks

MidPers
  • 1
  • 2

0 Answers0