
    %j                        d dl mZ d dlmZ d dlmZ  ed           G d d                      Z ed           G d d	                      Z ed           G d
 d                      ZdS )    )annotations)	dataclass)DecimalT)frozenc                  x    e Zd ZU ded<   ded<   ded<   ded<    ed          Zded<    ed          Zded<   d	S )
TradeCostInputr   notional_usdexpected_move_pcthalf_spread_pctdepth_penalty_pct0
hold_hoursfunding_rate_hourly_pctN)__name__
__module____qualname____annotations__r   r   r        N/home/agent/projects/CryptoTradingBot/Crypto_Agent/src/execution/cost_model.pyr   r      su         !'#,,J&&&&'.ws||333333r   r   c                  j    e Zd ZU ded<   ded<   ded<   ded<   ded<   ded	<   ded
<   ded<   ded<   dS )TradeCostDecisionboolallowedstrreasonr   entry_fee_usdexit_fee_usdspread_cost_usdslippage_cost_usdfunding_cost_usdroundtrip_cost_usdroundtrip_cost_pctN)r   r   r   r   r   r   r   r   r      sx         MMMKKKr   r   c                  X    e Zd ZU  ed          Zded<    ed          Zded<   dd
ZdS )	CostModelz0.00045r   taker_fee_ratez0.02min_slippage_pctitemr   returnr   c                0   t          | j        |j        |j                  }|j        | j        z  }|j        | j        z  }|j        |j        z  t          d          z  }|j        |z  t          d          z  }|j        |j        z  t          d          z  |j        z  }||z   |z   |z   |z   }|j        dk    r||j        z  t          d          z  nt          d          }	|j	        |	t          d          z  k    }
t          |
|
rdnd|||||||		  	        S )N100r   9993ok%expected_move_below_3x_roundtrip_cost)	r   r   r   r   r   r    r!   r"   r#   )maxr'   r   r   r	   r&   r   r   r   r
   r   )selfr(   effective_slippage_pct	entry_feeexit_feespread_costslippage_costfunding_costtotalpctr   s              r   estimatezCostModel.estimate#   s9   !$T%:D<PRVRh!i!i%(;;	$t'::'$*>>O),BBWU^^S(4+GG'RW..X[_[jjH${2]B\Q<@<MPQ<Q<Qed'''%..88W^_dWeWe(S73<<-?@ "O44(O#!'+)$"

 

 

 
	
r   N)r(   r   r)   r   )r   r   r   r   r&   r   r'   r:   r   r   r   r%   r%      s_         %gi00N0000 '////
 
 
 
 
 
r   r%   N)	
__future__r   dataclassesr   decimalr   r   r   r%   r   r   r   <module>r>      s   " " " " " " ! ! ! ! ! !       $4 4 4 4 4 4 4 4 $	  	  	  	  	  	  	  	  $
 
 
 
 
 
 
 
 
 
r   