
    i                         S SK Jr  S SKJrJrJr  S SKJrJrJ	r	J
r
  S SKJrJr  S SKJrJrJrJr   SS\S\S	\S
\S\S\4S jjrg)    )simplefilter)array_splitmeansum)	DataFrameSeriesconcatcut)DictLikeInt)signed_seriesv_boolv_pos_defaultv_seriesNclosevolumewidthsortkwargsreturnc           
      n  ^^^^^^^ [        US5      n[        X5      n [        X5      nU b  Uc  g[        US5      n[        U S5      nXUS:     -  nUR                  Ul        U* XUS:     -  nUR                  Ul        XUS:H     -   nUR                  Ul        [        XXx/SS9n	U	R                  S    mST 3mST 3mS	T 3mU	R                  S    n
S
U
 3mSU
 3mSU
 3mSU
 3nTTTT/U	l        [        S[        S9  U(       a  U	T   U	T'   U	R                  [        U	T   USSS9SS9R                  T[        T[        T[        T[        05      nUR                   Vs/ s H  oR                  PM     snUT'   UR                   Vs/ s H  oR                   PM     snUT'   UR#                  SS9nUTTTTTT/   nO1[%        X5      n['        UUUUUUU4S jU 5       5      n[)        U5      nUT   UT   -   X'   SU;   a  UR+                  US   SS9  SU 3Ul        SUl        U$ s  snf s  snf )ao  Volume Profile

This indicator attempts to quantify volume across binned price ranges of
certain width.

Sources:
    * [ranchodinero](http://www.ranchodinero.com/volume-tpo-essentials/)
    * [stockcharts](https://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:volume_by_price)
    * [tradingtechnologies](https://www.tradingtechnologies.com/blog/2013/05/15/volume-at-price/)
    * [tradingview](https://www.tradingview.com/wiki/Volume_Profile)

Parameters:
    close (Series): ```close``` Series
    volume (Series): ```volume``` Series
    width (int): Source distrubution count. Default: ```10```
    sort (value): Sort ```close``` before splitting into ranges.
        Default: ```False```

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

Returns:
    (DataFrame): 5 columns

Note:
    * By default, sorts by date index or chronological.
    * Value Area is not calculated.

Warning:
    **Volume Profile** not a Time ```Series```. It is a volume distribution
    snapshot for an arbitrary ```DateTime``` Index and thus can not be
    concatenated onto the existing ```DataFrame```.


   NF   r   )axishigh_low_mean_pos_neg_neut_total_ignore)actioncategoryT   )include_lowest	precision)observed)dropc              3     >#    U  Hy  nTUT   R                  5       TUT   R                  5       TUT   R                  5       TUT   R                  5       TUT   R                  5       TUT   R                  5       0v   M{     g 7f)N)minr   maxr   )	.0r	close_colhigh_price_collow_price_colmean_price_colneg_volume_colneut_volume_colpos_volume_cols	     N/var/www/html/trading/venv/lib/python3.13/site-packages/pandas_ta/volume/vp.py	<genexpr>vp.<locals>.<genexpr>k   s       a 1Y<++-AiL--/AiL,,.An-113An-113Q/335
 s   BBfillna)inplaceVP_r   )r   r   r   r   namer	   columnsr   FutureWarninggroupbyr
   aggr   r   indexleftrightreset_indexr   listr   r9   r$   )r   r   r   r   r   signed_price
pos_volume
neg_volumeneut_volumevp
volume_coltotal_volume_colvpdfx	vp_rangesresultr/   r0   r1   r2   r3   r4   r5   s                   @@@@@@@r6   rJ   rJ   
   s   P %$EU"Ef$F}$D !*L|a'788JkkJO<q(899JkkJO(9::K{{K	J<1	EB::a=/IYK(N9+&MYK(NJJqM?JJ<(NJ<(Nj\*O
|,^^_MBJ=9 	]>zz9uTQG  
 #DCCS	
  	 04zz:z!vvz:]15<A<^T*>>NO
 
  *	      !.1D4HHD 6F8$d3 eWDIDMK? ;<s   $H-H2)NN)warningsr   numpyr   r   r   pandasr   r   r	   r
   pandas_ta._typingr   r   pandas_ta.utilsr   r   r   r   boolrJ        r6   <module>rY      sb    ! ( ( 1 1 + J J %)vv!vv!v v 	vrX   