o
    1Þj{  ã                   @   s:   d Z ddddddddddd	d
ddœZdd„ Zddd„ZdS )a±  
r10_setup.py -- [2026-10-25] The user's setup R10 "GAP-DOWN RECOVERY RECLAIMS VWAP" (from the Star bot's live winners 10/5-10/23
that EV3 missed: CORZ +6.0% 10/15, DNA +3.5% 10/7, AVO +3.3%, RIOT +2.6%, UUUU +2.4%, PUMP +1.9%, BKKT, NAVI, MUX, QXO, BLMN,
QUBT: gapped down or fell after the open, then climbed back ABOVE VWAP with buyers; most 10:00-11:00).
  1 DOWN FIRST   the open gapped down >= gap_min (1%) under the previous close, OR the day's low so far is >= drop_min (2%)
                 under the open
  2 RECLAIM      the close is 0.3%..reclaim_max (1.5%) over the session VWAP, and fresh: a close under VWAP within the last
                 fresh_n (10) bars
  3 CLIMBING     up >= ch15_min (1%) over the last 15 bars
  4 BUYERS       15-min buy share >= bs15_min (50%)
  5 VOLUME       RVOL so far >= rvol_min (1.5x the 14-day volume by minute)
  safety         9:50-11:30 (first_m 20, last_m 120); >= min_spm shares/min over 5 bars; one trigger per reclaim (cool-down)
STOP = the lowest low of the last stop_n (15) bars (clamped 0.5-4% by EV3). Note: R10 buys gap-downs on purpose -- the A20 gate must
not be applied to it. Untested on 2 years when written. Pure function, no orders.
g      ð?g       @g333333Ó?g      ø?é
   g      à?é   éx   iÐ  é   é   )Úgap_minÚdrop_minÚreclaim_minÚreclaim_maxÚfresh_nÚch15_minÚbs15_minÚrvol_minÚfirst_mÚlast_mÚmin_spmÚstop_nÚcooldownc                 C   sZ   ddl m }m} ddlm} t| |ƒs| | |j¡} |  |dƒ¡} | jd d | j	 d S )Né    )ÚdatetimeÚtimezone)ÚZoneInfozAmerica/New_Yorké	   é<   r   )
r   r   Úzoneinfor   Ú
isinstanceÚfromtimestampÚutcÚ
astimezoneÚhourÚminute)Útr   r   r   © r!   ú../../r10_setup.pyÚ_minute   s   
r#   Nc              
      s¶  i t ¥|pi ¥}|pi }tˆ ƒ}||d k s%||d ks%|dk s%| d¡s)di fS ˆ d d }ˆ d d	 }||d  d
 d }tdd„ ˆ D ƒƒ}	||d  ksq|	| d
 d |d  ksqddd|d›d|	| d
 d d›d�ifS d }
}g ‰ˆ D ])}|
|d |d  |d	  d |d  7 }
||d 7 }ˆ |r�|
| n|d	 ¡ qy|ˆd  d
 d }|d |  kr»|d ksÇn ddd|d›d�ifS t‡ ‡fdd„ttd|d
 |d   ƒ|d
 ƒD ƒƒsçddd!ifS |ˆ d" d	  d
 d }||d# k �rddd$|d›d%�ifS |d& |d' }}t|td|d( ƒ|d
 … ƒ}t|td|d( ƒ|d
 … ƒ}|| �r7|||  nd}||d) k �rJddd*|d+›�ifS | d,¡�pQg }t|ƒ|k�rct|d |d
 … ƒnd}|�rl|| nd }|d u�r…||d- k �r…ddd.|d/›d0�ifS td1d„ ˆ d2d … D ƒƒd3 |d4 k �rŸddd5ifS td6d„ ˆ |d7  d … D ƒƒ}d8|t	ˆ |d7   d9 ƒt
|d:ƒt
|d:ƒt
|d:ƒt
|dƒ|�rÖt
|d:ƒd;œfS d d;œfS )<Nr   r   é   Ú
prev_closeFr   ÚoéÿÿÿÿÚcé   éd   c                 s   ó   � | ]}|d  V  qdS ©ÚlNr!   ©Ú.0Úxr!   r!   r"   Ú	<genexpr>$   ó   € zcheck.<locals>.<genexpr>r   r   Úwhy_notz1 not down first (gap z+.1fz%, low z% under the open)g        Úhr-   é   Úvr   r	   z2 z+.2fz	% vs VWAPc                 3   s$   � | ]}ˆ | d  ˆ| k V  qdS )r(   Nr!   )r/   Úi©ÚdoneÚvwr!   r"   r1   -   s   €" r
   z2 not a fresh reclaimiðÿÿÿr   z3 15-bar change ú%ÚbuyÚsellé   r   z4 15-min buy share z.0%Úvol_per_minr   z5 RVOL z.2fr0   c                 s   r+   )r6   Nr!   r.   r!   r!   r"   r1   <   r2   éûÿÿÿé   r   Úthinc                 s   r+   r,   r!   r.   r!   r!   r"   r1   >   r2   r   Tr    é   )ÚsupportÚ	support_mÚgapÚvs_vwapÚch15Úbs15Úrvol)ÚDEFAULTSÚlenÚgetÚminÚappendÚanyÚrangeÚmaxÚsumr#   Úround)r9   ÚflowÚrefÚmr(   ÚnÚOÚPrF   ÚloÚpvÚcvr0   ÚoverÚchÚfbÚfsÚBÚSrI   ÚvpmÚnormÚrvÚsupr!   r8   r"   Úcheck   sL   *&(*P4<&( (ÿÿrh   )N)Ú__doc__rK   r#   rh   r!   r!   r!   r"   Ú<module>   s    ÿ	