
    i                         S SK JrJrJrJr  S SKJrJrJr  S SK	J
r
JrJr  S SKJrJrJrJr     SS\S\S\S	\S
\S\
S\4S jjrg)    )arangearraypolyfitstd)	DataFrameDatetimeIndexSeries)DictLikeIntList)v_listv_lowerboundv_offsetv_seriesNcloselengthstdsddofoffsetkwargsreturnc           	         SnUc  U R                   nO$[        USS5      nU R                  U* S n U SU 3n[        U S5      n U c  g[	        U/ SQ5      n[        U5      S::  a  g[        S [        X"S	S 5       5       5      (       d  USSS
2   n[        U[        5      (       a  SUs=::  a  U:  a  O  O[        U5      OS	n[        U5      nU R                  =px[        U R                  [        5      (       a  [        U5      n[        U 5      n [        XpS	5      u  p[!        X-  U
-   US9n[#        XS9n[%        U S3U0US9nU HX  nXU-  -
  X SU 3'   XU-  -   X SU 3'   U =X SU 3   l        X SU 3   l        S=X SU 3   l        X SU 3   l        MZ     US:w  a  UR+                  U5      nSU;   a  UR-                  US   SS9  U Ul        SUl        U$ )a  TD Ameritrade's Think or Swim Standard Deviation All

This indicator returns the standard deviation(s) over all the bars or the
last ```n``` (length) bars.

Sources:
    * [thinkorswim](https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Statistical/StDevAll)

Parameters:
    close (Series): ```close``` Series
    length (int): Bars since current/last bar, Series[-1]. Default: ```None```
    stds (list): List of standard deviations in increasing order from the
        central Linear Regression line. Default: ```[1,2,3]```
    offset (int): Post shift. Default: ```0```

Other Parameters:
    fillna (value): ```pd.DataFrame.fillna(value)```

Returns:
    (DataFrame): 7+ columns

Note:
    * TA Lib does not have a ```ddof``` parameter.
    * The divisor used in calculations is: ```N - ddof```, where ```N```
        is the number of elements. To use ```ddof```, set ```talib=False```.

Danger:
    Possible Data Leak
TOS_STDEVALLN      _)   r      r   c              3   .   #    U  H  u  pX:  v   M     g 7f)N ).0ijs      \/var/www/html/trading/venv/lib/python3.13/site-packages/pandas_ta/statistics/tos_stdevall.py	<genexpr>tos_stdevall.<locals>.<genexpr>=   s     5!4qu!4s   r   )index)r   _LR_L__U_
statisticsfillnaT)inplace)sizer   ilocr   r   minallzip
isinstanceintr   r(   r   r   r   r   r	   r   r   namecategoryshiftr-   )r   r   r   r   r   r   _propsX	src_indexmblrstdevdfr"   s                  r$   tos_stdevallrA   	   s!   F F~fa,

F78$81VH%UAE}$	"D
4yA~5T8!4555DbDz"4--!t2Df2D3t9!DfF KKA%++}--6Ne1QDA			+B!E 
vhcNB'y	9B "YXS "YXSEKHMXS"R(#aS(9%:%?JVVXS&hc!,=)>)G	  {XXf 6
		&"D	1BGBKI    )NNNN)numpyr   r   r   r   pandasr   r   r	   pandas_ta._typingr
   r   r   pandas_ta.utilsr   r   r   r   rA   r    rB   r$   <module>rG      ss    - - 3 3 1 1 D D
 "&#'WWW
W W W #+W 	WrB   