
    uYfA                     &    d dl mZ  G d de      Zy)    )divisionc                   &    e Zd ZdZdZd Zd Zd Zy)SimpleMovingAveragez/
    Simple Moving Average implementation.
    )sizeindexcountstotals	sum_count	sum_totalc                     |dk  rt         d| _        || _        d| _        d| _        dg| j                  z  | _        dg| j                  z  | _        y)z
        Constructor for SimpleMovingAverage.

        :param size: The size of the window to calculate the moving average.
        :type size: :obj:`int`
           r   N)
ValueErrorr   r   r
   r   r   r	   )selfr   s     T/var/www/highfloat_scraper/venv/lib/python3.12/site-packages/ddtrace/internal/sma.py__init__zSimpleMovingAverage.__init__   sO     !8
	cDIIocDIIo    c                 f    | j                   dk(  ryt        | j                        | j                   z  S )z,
        Get the current SMA value.
        r   g        )r   floatr
   )r   s    r   getzSimpleMovingAverage.get&   s+    
 >>QT^^$t~~55r   c                 |   ||kD  rt         | xj                  || j                  | j                     z
  z  c_        | xj                  || j
                  | j                     z
  z  c_        || j                  | j                  <   || j
                  | j                  <   | j                  dz   | j                  z  | _        y)a  
        Set the value of the next bucket and update the SMA value.

        :param count: The valid quantity of the next bucket.
        :type count: :obj:`int`
        :param total: The total quantity of the next bucket.
        :type total: :obj:`int`
        r   N)r   r
   r   r   r   r	   r   )r   counttotals      r   setzSimpleMovingAverage.set0   s     5=%$++djj"999%$++djj"999"'DJJ"'DJJjj1n		1
r   N)__name__
__module____qualname____doc__	__slots__r   r   r    r   r   r   r      s    I&(62r   r   N)
__future__r   objectr   r   r   r   <module>r"      s    ?2& ?2r   