
    G~%j                     x    d dl Zd dlmc mZ d dlmZ d dlZd dl	m
Z
 d dlmZ d Z G d d          Zd Zd	 ZdS )
    N)Decimal)HyperliquidLiveExecutor)OrderIntentc                      t          di ddddddddd	d
dddddt          d          dd dd dt          d          dd dddddt          d          dt          d          S )Nstrategy_id)candidate_v76_hl_confirmed_squeeze_hybridsymbolzBTC/USDC:USDCcoinBTCsidebuyreduce_onlyF
order_typemarkettifIocsizez0.01pricetrigger_price	stop_loss99000take_profitclient_order_idz	v76-BTC-1reasonconfirmed_squeeze_breakoutrisk_usdz1.25estimated_notional_usd100 )r   r   r       \/home/agent/projects/CryptoTradingBot/Crypto_Agent/tests/test_hyperliquid_executor_dryrun.py_intentr"   	   s       ?? U U	
 E 8 E V___ d d '""" D $ ,+    'u~~~! r    c                       e Zd Zd Zd ZdS )FakeExchangec                     g | _         d S )N)calls)selfs    r!   __init__zFakeExchange.__init__   s    


r    c                 B    | j                             ||f           ddiS )Nstatusok)r&   append)r'   argskwargss      r!   market_openzFakeExchange.market_open"   s'    
4.)))$r    N)__name__
__module____qualname__r(   r/   r   r    r!   r$   r$      s2                   r    r$   c                    |                      dd           |                      dd           t                      }t          |d          }t          j        t
          d          5  |                    t                                 d d d            n# 1 swxY w Y   |j        }g }||k    }|st          j
        d|fd	||f          d
t          j                    v st          j        |          rt          j        |          nd
t          j        |          t          j        |          dz  }dd|iz  }t          t          j        |                    d x}x}}d S )NCTB_LIVE_TRADING_ALLOWEDFraisingCTB_LIVE_CONFIRMATIONLIVE PREVIEW BTC)exchangeexpected_confirmation)match==z-%(py2)s
{%(py2)s = %(py0)s.calls
} == %(py5)sfakepy0py2py5assert %(py7)spy7)delenvr$   r   pytestraisesPermissionErrorexecuter"   r&   
@pytest_ar_call_reprcompare@py_builtinslocals_should_repr_global_name	_safereprAssertionError_format_explanation)monkeypatchr?   executor@py_assert1@py_assert4@py_assert3@py_format6@py_format8s           r!   +test_live_executor_blocks_without_env_gatesrZ   '   s   15AAA.>>>>>D&L^___H	.H	I	I	I $ $###$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ :::44:s   )"BBBc                 <   |                      dd           t                      }t          |dd          }|                    t	                                }|j        }d}||k    }|st          j        d|fd	||f          d
t          j	                    v st          j
        |          rt          j        |          nd
t          j        |          t          j        |          dz  }dd|iz  }t          t          j        |                    d x}x}}|j        }d}||k    }|st          j        d|fd||f          d
t          j	                    v st          j
        |          rt          j        |          nd
t          j        |          t          j        |          dz  }dd|iz  }t          t          j        |                    d x}x}}|j        }g }||k    }|st          j        d|fd||f          dt          j	                    v st          j
        |          rt          j        |          ndt          j        |          t          j        |          dz  }dd|iz  }t          t          j        |                    d x}x}}d S )Nr4   Fr5   r8   T)r9   r:   dry_runr\   r<   )z.%(py2)s
{%(py2)s = %(py0)s.status
} == %(py5)sresultr@   rD   rE   r   )z4%(py2)s
{%(py2)s = %(py0)s.side_effects
} == %(py5)sr>   r?   )rF   r$   r   rJ   r"   r*   rK   rL   rM   rN   rO   rP   rQ   rR   side_effectsr&   )	rS   r?   rT   r]   rU   rV   rW   rX   rY   s	            r!   =test_live_executor_dry_run_returns_plan_without_exchange_callr_   3   s   15AAA>>D&L^hlmmmHgii((F=%I%=I%%%%%%%%%%=I%%%%%%%%%%%%6%%%%%6%%%%%%=%%%%I%%%%%%%%%%%%%%%%%%%%%%%%%%%$"$"$$$$$$$$$$"$$$$$$$$$$$$6$$$$$6$$$$$$$$$$"$$$$$$$$$$$$$$$$$$$$$$$$$$$:::44:r    )builtinsrM   _pytest.assertion.rewrite	assertionrewriterK   decimalr   rG   'src.execution.hyperliquid_live_executorr   src.execution.order_intentr   r"   r$   rZ   r_   r   r    r!   <module>rg      s                         K K K K K K 2 2 2 2 2 2  *               	 	 		 	 	 	 	r    