
    %j0                    h    d dl mZ d dlmZ d dlZd dlmZ dZddZe G d	 d
                      Z	dS )    )annotations)	dataclassN)AnyzMLegacy TradingExecutor disabled; use src/tools/preflight.py and v76 executorsreturnNonec                     t          j        dd                                          dk    rt          t                    d S )NCTB_ALLOW_LEGACY_EXECUTION true)osgetenvlowerPermissionError!LEGACY_EXECUTION_DISABLED_MESSAGE     ?/home/agent/projects/CryptoTradingBot/Crypto_Agent/execution.py require_legacy_execution_enabledr   
   s>    	y-r2288::fDD?@@@ EDr   c                  B    e Zd ZU dZded<   dZded<   ddZ	 	 dddZdS )TradingExecutorzLSmall execution boundary that makes dry-run behaviour explicit and testable.r   exchangeTbooldry_runleverageint | floatsymbolstrr   c                p    | j         rdd||dS t                       | j                            ||          S )NTset_leverage)r   actionr   r   )r   r   r   r   )selfr   r   s      r   r   zTradingExecutor.set_leverage   sD    < 	g#~8_efff(***}))(F;;;r   N
order_typesideamountfloatpricefloat | Noneparamsdict[str, Any] | Nonec           	         | j         rdd||||||pi dS t                       | j                            ||||||pi           S )NTcreate_order)r   r    r   typer#   r$   r&   r(   )r(   )r   r   r   r+   )r!   r   r"   r#   r$   r&   r(   s          r   r+   zTradingExecutor.create_order   sq     < 
	( "  ,B	 	 	 	)***}))&*dFEZ`Zfdf)gggr   )r   r   r   r   r   r   )NN)r   r   r"   r   r#   r   r$   r%   r&   r'   r(   r)   r   r   )__name__
__module____qualname____doc____annotations__r   r   r+   r   r   r   r   r      sr         VVMMMG< < < < #(,h h h h h h hr   r   )r   r   )

__future__r   dataclassesr   r   typingr   r   r   r   r   r   r   <module>r5      s    " " " " " " ! ! ! ! ! ! 				      $s !A A A A
 !h !h !h !h !h !h !h !h !h !hr   