
    Q-j                         d dl mZ d dlmZmZ d dlmZmZ d dlm	Z	 g dZ
e G d d             Z edd	d
      Z eddd dddddddddddddddddg      Zy
)    )	cpu_count)	dataclassfield)IntList)get_time)StudyAllStudyCommonStudyc                       e Zd ZU dZeed<    ee      Ze	ed<    e
       Zeed<   dZeed<    ed	      Zeed
<   d Zd Zd Zd Zy)r	   a  Study DataClass
    Class to name and group indicators for processing.

    Parameters:
        name (str): Name.
        ta (list of dicts): i.e [{"kind": "ema", "length", 50}]
        cores (int): The number cores to use for multiprocessing.
            Default: ```cpu_count()```
        description (str): Description of what the Study. Default: ```""```
        created (str): DateTime String at creation.
            Default: Automatically generated.

    Returns:
        (DataClass): The Study to be processed by ```df.ta.study()```

    Example: All or Common Study
        Run
        ```py
        # Run "All"
        df.ta.study(ta.AllStudy, **kwargs)

        # Run "Common"
        df.ta.study(ta.CommonStudy, **kwargs)
        ```

    Example: Custom Study
        Create
        ```py
        DemoStudy = ta.Study(
            name="Demo Study",
            description="Example Study Group",
            cores=0,  # Usually faster than multiprocessing
            ta = [
                {"kind": "sma", "length": 200},
                {"kind": "sma", "close": "volume", "length": 50},
                {"kind": "bbands", "length": 20},
                {"kind": "rsi"},
                {"kind": "macd", "fast": 8, "slow": 21},
                {"kind": "sma", "close": "volume", "length": 20, "prefix": "VOLUME"}
            ]
        ```

        Run
        ```py
        df.ta.study(DemoStudy, **kwargs)
        ```

    Note:
        * See [also](../getting-started/usage.md) the Pandas TA
          "Study" Examples
        * Case-insensitive "All" is reserved.

    Warning: Multiprocessing
        **Not recommended** for:

        * Small sets of indicators
        * Indicator chains
    name)default_factorytacores descriptionT)	to_stringcreatedc                    t        | j                  t              r@| j                  dk\  r1| j                  t               k  rt        | j                        | _        dg}| j	                         r|j                  d       | j                  d | _        n(| j                         sd}|dz  }|j                  |       t        |      dkD  r|D cg c]  }t        |       c} y y c c}w )Nr   z-[X] Study requires the following argument(s):zE - name. Must be a string. Example: "My TA". Note: "all" is reserved.zJ - ta. Format is a list of dicts. Example: [{'kind': 'sma', 'length': 10}]zP
       Check the indicator for the correct arguments if you receive this error.   )

isinstancer   intr   _is_nameappendr   _is_talenprint)selfreq_argss_s       d/Users/jameslopez/projects/TradingBot25/.venv/lib/python3.12/site-packages/pandas_ta/utils/_study.py__post_init__zStudy.__post_init__T   s    djj#&4::?tzzY[?XTZZDJCD==?OOWY 77?DG\AddAOOAx=1'(x!U1Xx( (s   C$c                 X    | j                   d u xs t        | j                   t               S )N)r   r   strr   s    r"   r   zStudy._is_namej   s$    yyD B
499c(B$BB    c           	         t        | j                  t              rb| j                         dkD  rOt	        | j                  D cg c]0  }t        |t
              xr t        |j                               dkD  2 c}      S yc c}w )Nr   F)r   r   listtotal_taalldictr   keys)r   r!   s     r"   r   zStudy._is_tan   sd    dggt$1)< 477S7a
1d+AAFFH0AA7STT Ts   5A>c                 H    | j                   t        | j                         S dS )Nr   )r   r   r&   s    r"   r*   zStudy.total_tax   s    #ww2s477|99r'   N)__name__
__module____qualname____doc__r%   __annotations__r   r)   r   r   r   r   r   r   r   r   r#   r   r   r*    r'   r"   r	   r	      sX    9t IT*B*+E3Kd+GS+,C:r'   r	   AllzBAll the indicators with their default settings. Pandas TA default.N)r   r   r   zCommon Price and Volume SMAsz6Common Price SMAs: 10, 20, 50, 200 and Volume SMA: 20.sma
   )kindlength   2      volumeVOL)r8   closer9   prefix)r   r   r   r   )multiprocessingr   dataclassesr   r   pandas_ta._typingr   r   pandas_ta.utils._timer   __all__r	   r
   r   r4   r'   r"   <module>rF      s    % ( ' * g: g: g:X 	T 	'H
"%"%"%#&R5I	r'   