+
    ^9j]  c                      ^ RI t^ RIHu Ht ^ RIt^ RIt^ RIt^ RI	t
^ RIHtHtHtHtHt ]P"                  P%                  ]P"                  P'                  ]P"                  P)                  ]4      R4      4      t]P"                  P'                  ]RRR4      t]P"                  P'                  ]RRR	4      tR
 tR tR tR tR tR tR tR# )    N)apply_pine_time_gatecheck_tv_entry_markersrun_python_strategystrategy_stemtv_score_columnz..datamlpzCOINBASE_BTCUSD, 1D.csvresultswinnersz>optimization_winner_strategy_mlp_scores_COINBASE_BTCUSD_1D.csvc                     R p \        V 4      pRq!V8H  q3'       g   \        P                  ! RV3RW34      RR\        P                  ! 4       9   g!   \        P
                  ! \         4      '       d   \        P                  ! \         4      MRR\        P                  ! V 4      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR	;p ;p;r2R
p \        V 4      pRq!V8H  q3'       g   \        P                  ! RV3RW34      RR\        P                  ! 4       9   g!   \        P
                  ! \         4      '       d   \        P                  ! \         4      MRR\        P                  ! V 4      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR	;p ;p;r2R	# )zstrategy_activation_scores.pyactivation_scorespy0r   py2py4py7assert %(py9)spy9Nstrategy_mlp_scores.py
mlp_scores==z0%(py4)s
{%(py4)s = %(py0)s(%(py2)s)
} == %(py7)s)	r   
@pytest_ar_call_reprcompare@py_builtinslocals_should_repr_global_name	_safereprAssertionError_format_explanation)@py_assert1@py_assert3@py_assert6@py_assert5@py_format8@py_format10s         G/Users/jameslopez/projects/TradingBot25/tests/test_tv_parity_tooling.py4test_strategy_stem_supports_activation_and_mlp_filesr'      s   8P=89P=PP=PPPPPP9PPPPPP=PPPP=PPP8PPP9PPP=PPPPPPPPP1B=12BlBlBBBBB2BBBBBB=BBBB=BBB1BBB2BBBlBBBBBBBB    c                  	   \         P                  p R R./q! V4      p\        V4      pR qCV8H  qU'       Egg   \        P                  ! RV3RW434      RR\
        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\
        P                  ! 4       9   g!   \        P                  ! \         4      '       d   \        P                  ! \         4      MRR\        P                  ! V 4      R\        P                  ! V4      R\        P                  ! V4      R	\        P                  ! V4      R
\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p ;p;p;p;rT\         P                  p RR./q! V4      p\        V4      pRqCV8H  qU'       Egg   \        P                  ! RV3RW434      RR\
        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\
        P                  ! 4       9   g!   \        P                  ! \         4      '       d   \        P                  ! \         4      MRR\        P                  ! V 4      R\        P                  ! V4      R\        P                  ! V4      R	\        P                  ! V4      R
\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p ;p;p;p;rT\         P                  p RR./q! V4      p\        V4      pRqCVJ qU'       Egg   \        P                  ! RV3RW434      RR\
        P                  ! 4       9   g!   \        P                  ! \        4      '       d   \        P                  ! \        4      MRRR\
        P                  ! 4       9   g!   \        P                  ! \         4      '       d   \        P                  ! \         4      MRR\        P                  ! V 4      R\        P                  ! V4      R\        P                  ! V4      R	\        P                  ! V4      R
\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p ;p;p;p;rTR# )activation_score_poc      ?r   r   py1pdpy3py5r   r   py12zassert %(py14)spy14N	mlp_scorecloser   )zn%(py9)s
{%(py9)s = %(py0)s(%(py7)s
{%(py7)s = %(py3)s
{%(py3)s = %(py1)s.DataFrame
}(%(py5)s)
})
} == %(py12)s)is)zn%(py9)s
{%(py9)s = %(py0)s(%(py7)s
{%(py7)s = %(py3)s
{%(py3)s = %(py1)s.DataFrame
}(%(py5)s)
})
} is %(py12)s)r-   	DataFramer   r   r   r   r   r   r   r   r   )@py_assert2@py_assert4r"   @py_assert8@py_assert11@py_assert10@py_format13@py_format15s           r&   3test_tv_score_column_prefers_available_export_scorer=      s   <<c)?#(Gc<(GHc?HIcMccMccccccIcccccc?cccc?ccccccc2cccc2ccc<ccc(GcccHcccIcccMcccccccccc<<Mse(<M<(<=M?=>M+M+MMMMM>MMMMMM?MMMM?MMMMMMM2MMMM2MMM<MMM(<MMM=MMM>MMM+MMMMMMMMM<<B3%(8B<(89B?9:BdBdBBBBB:BBBBBB?BBBB?BBBBBBB2BBBB2BBB<BBB(8BBB9BBB:BBBdBBBBBBBBBr(   c                     \         P                  ! R \         P                  ! . RO4      R. ROR. RO/4      p R^R\         P                  ! R4      RR/.p\	        VV R	\         P                  ! R4      \         P                  ! R4      4      pVR
,          p^ qCV8H  qU'       gy   \
        P                  ! RV3RW434      R\
        P                  ! V4      R\
        P                  ! V4      /,          pRRV/,          p\        \
        P                  ! V4      4      hR;p;rTVR,          p\        V4      p^qV	8H  q'       g   \
        P                  ! RV
3RWI34      RR\        P                  ! 4       9   g!   \
        P                  ! \        4      '       d   \
        P                  ! \        4      MRR\
        P                  ! V4      R\
        P                  ! V4      R\
        P                  ! V	4      /,          pRRV/,          p\        \
        P                  ! V4      4      hR;p;p;rVR,          p^qCV8H  qU'       gy   \
        P                  ! RV3RW434      R\
        P                  ! V4      R\
        P                  ! V4      /,          pRRV/,          p\        \
        P                  ! V4      4      hR;p;rTVR,          p\         P                  ! R4      .qCV8H  qU'       gy   \
        P                  ! RV3RW434      R\
        P                  ! V4      R\
        P                  ! V4      /,          pRRV/,          p\        \
        P                  ! V4      4      hR;p;rTR# )time2020-01-01 00:002020-01-01 12:00zentry (standard)zmissed entry	trade_numentry_dt	is_marginF6Htv_with_markerr,   r   zassert %(py6)spy6Ntv_without_markerr   lenr   r   r   r   chart_exec_countchart_without_tv)r@   z2020-01-01 06:00rA   )r+           r+   )rL   rL   r+   r   )z%(py1)s == %(py4)sr   )r-   r5   to_datetime	Timestampr   r   r   r   r   r   rI   r   r   r   )signals	tv_tradesresult@py_assert0r!   r6   @py_format5@py_format7r    r"   r#   r$   r%   s                r&   2test_tv_entry_marker_check_detects_export_mismatchrU   %   s$   ll  
 
 	O G 	QBLL!34U I $
'(
'(F "#(q(q(((((#(((#(((q(((((((()*03*+0q0q00000+000000300003000*000+000q00000000$%*******%***%***********$%K",,7I*J)KK)KKKKKK%KKK%KKK)KKKKKKKKKr(   c                  ,   \         P                  ! R \         P                  ! . RO4      R. ROR. ROR. RO/4      p \        V RRRRRRRR	R
RRR/\         P                  ! R4      4      pVR,          q"P
                  q3! 4       p. ROqTV8H  qf'       g   \        P                  ! RV3RWE34      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p;p;p;reVR,          q"P
                  q3! 4       p. R OqTV8H  qf'       g   \        P                  ! RV3RWE34      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p;p;p;reR# )!r?   activation_scorer3   high!i_long_entry_activation_threshold i_long_exit_activation_thresholdg      I@-i_long_exit_activation_confirmation_thresholdi_use_long_exit_confirmationTi_use_long_entry_confirmationFi_trailing_stop_thresholdrL   z
2017-12-01execute_entryr,   r.   r/   py8assert %(py10)spy10Nexecute_exit)z2017-11-29 00:00z2017-11-30 00:00z2017-12-01 00:00z2017-12-01 12:00z2017-12-02 00:00)      Y@     @ord   re   g     r)rd   g     V@rd   g     [@g      ^@g      ig     l)FFFTFr   zE%(py5)s
{%(py5)s = %(py3)s
{%(py3)s = %(py1)s.tolist
}()
} == %(py8)s)FFFFT)r-   r5   rM   r   rN   tolistr   r   r   r   r   	rO   replayedrR   r6   r7   @py_assert7r"   @py_format9@py_format11s	            r&   .test_pine_time_gate_starts_flat_at_score_startrm   C   s   ll  
  	B32 G $/.;V*D+U'	
 	\"H O$S++S+-S1SS1SSSSSS-SSS$SSS+SSS-SSS1SSSSSSSSSN#R**R*,R0RR0RRRRRR,RRR#RRR*RRR,RRR0RRRRRRRRRRr(   c                     \         P                  ! R \         P                  ! . RO4      R. ROR. ROR. ROR. R O/4      p RV P                  R	&   \	        V R
RRRRR!RRRRR^R^RR/\         P
                  ! R4      4      pVR,          q"P                  q3! 4       p. R"OqTV8H  qf'       g   \        P                  ! R#V3R$WE34      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          pRRV/,          p\        \        P                  ! V4      4      hR;p;p;p;reR# )%r?   2020-01-01 16:00rW   rL   r3   rd   rX   stoch_peak_normr   r   rY   rZ   g      @r[   r\   Tr]   Fi_entry_score_windowi_exit_score_windowr^   r_   r,   r.   r/   r`   ra   rb   N)r@   z2020-01-01 08:00ro   z2020-01-02 00:00)      i@rs   rL   rL   )rd   g     @Y@g     Y@g     Y@)rL   rL   rL   rL   g      )FFFTr   rf   )r-   r5   rM   attrsr   rN   rg   r   r   r   r   r   rh   s	            r&   1test_pine_time_gate_preserves_mlp_entry_smoothingru   b   s    ll  
  	4-,/ G &2GMM/"#/.;V*D+U"A!1'		
 	'(H O$L++L+-L1LL1LLLLLL-LLL$LLL+LLL-LLL1LLLLLLLLLLr(   c                     \         P                  ! \        4      P                  ^ ,          P	                  4       p \        \        V RR7      pRq!P                  q2V9   qD'       g   \        P                  ! RV3RW#34      R\        P                  ! V4      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      /,          pRR	V/,          p\        \        P                  ! V4      4      hR
;p;rCRq!P                  q2V9   qD'       g   \        P                  ! RV3RW#34      R\        P                  ! V4      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      /,          pRR	V/,          p\        \        P                  ! V4      4      hR
;p;rCRq!P                  q2V9   qD'       g   \        P                  ! RV3RW#34      R\        P                  ! V4      RR\        P                  ! 4       9   g   \        P                  ! V4      '       d   \        P                  ! V4      MRR\        P                  ! V4      /,          pRR	V/,          p\        \        P                  ! V4      4      hR
;p;rCVR,          q"P                   qD! 4       p^ qsV8  q'       g   \        P                  ! RV3RW734      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      R\        P                  ! V4      /,          p	RRV	/,          p
\        \        P                  ! V
4      4      hR
;p;p;p;rR
# )r   r   )strategy_filerW   r,   r.   rO   r/   assert %(py7)sr   Nr_   rc   r`   ra   rb   in)z/%(py1)s in %(py5)s
{%(py5)s = %(py3)s.columns
})>)zA%(py5)s
{%(py5)s = %(py3)s
{%(py3)s = %(py1)s.sum
}()
} > %(py8)s)r-   read_csvMLP_PARAMS_1Dilocto_dictr   DATA_1Dcolumnsr   r   r   r   r   r   r   r   sum)paramsrO   rR   r7   r6   @py_format6r$   rj   r"   rk   rl   s              r&   +test_compare_tv_trades_can_run_mlp_strategyr      s   [[',,Q/779F!.G 0000000000000000000000000000000-oo-o-----?---?------g----g---o--------,__,_,,,,,>,,,>,,,,,,W,,,,W,,,_,,,,,,,,?#-''-')-A-A-----)---#---'---)---A---------r(   c            
         \         P                  ! \        P                  R R\        RRR\
        .\        RR^xRR7      p V P                  p^ q!V8H  q3'       g   \        P                  ! RV3RW34      RR	\        P                  ! 4       9   g   \        P                  ! V 4      '       d   \        P                  ! V 4      MR	R
\        P                  ! V4      R\        P                  ! V4      /,          p\        P                  ! V P                  4      R,           RV/,          p\!        \        P"                  ! V4      4      hR;p;r2Rq`P$                  q&V9   qw'       g   \        P                  ! RV3RWb34      R\        P                  ! V4      RR	\        P                  ! 4       9   g   \        P                  ! V 4      '       d   \        P                  ! V 4      MR	R\        P                  ! V4      /,          pRRV/,          p\!        \        P"                  ! V4      4      hR;p;rrRq`P$                  q&V9   qw'       g   \        P                  ! RV3RWb34      R\        P                  ! V4      RR	\        P                  ! 4       9   g   \        P                  ! V 4      '       d   \        P                  ! V 4      MR	R\        P                  ! V4      /,          pRRV/,          p\!        \        P"                  ! V4      4      hR;p;rrRq`P$                  q&V9   qw'       g   \        P                  ! RV3RWb34      R\        P                  ! V4      RR	\        P                  ! 4       9   g   \        P                  ! V 4      '       d   \        P                  ! V 4      MR	R\        P                  ! V4      /,          pRRV/,          p\!        \        P"                  ! V4      4      hR;p;rrR# )zstrategies/validate_strategy.pyz--dataz--strategy_filer   z--params_fileTF)cwdcapture_outputtexttimeoutcheckr   rQ   r   r/   z
>assert %(py7)sr   NzTrade-walk diagnosticsr,   r.   rx   zCanonical optimizer metricsz<Source: strategy.calculate_metrics(signals, score_start=...)r   )z2%(py2)s
{%(py2)s = %(py0)s.returncode
} == %(py5)sry   )z.%(py1)s in %(py5)s
{%(py5)s = %(py3)s.stdout
})
subprocessrunsys
executabler   r}   REPO
returncoder   r   r   r   r   r   _format_assertmsgstderrr   r   stdout)rQ   r    r7   r!   r   r$   rR   r6   s           r&   7test_validate_strategy_prints_canonical_metrics_sectionr      s"   ^^NN-$		
 F$ 00!000000000060000600000000006==00000000#4}}4}44444#444#444444v4444v444}44444444(9MM9M99999(999(999999F9999F999M99999999IZ]]Z]ZZZZZIZZZIZZZZZZVZZZZVZZZ]ZZZZZZZZr(   ) builtinsr   _pytest.assertion.rewrite	assertionrewriter   osr   r   pandasr-   tools.compare_tv_tradesr   r   r   r   r   pathabspathjoindirname__file__r   r   r}   r'   r=   rU   rm   ru   r   r    r(   r&   <module>r      s      	  
   
wwrww||BGGOOH$=tDE
'',,tVU,E
FD	C
CL<S>MB.[r(   