+
    ik                        ^ RI Ht ^ RIHt  ! R R]4      t ! R R]4      t ! R R]4      t ! R	 R
]4      t ! R R]4      t	 ! R R]4      t
 ! R R]4      tR# )    )annotations)Anyc                  *    ] tR t^t$ RtRtR]R&   RtR# )KalshiErrorz)Base exception for all Kalshi API errors.Fbool	retryable N)__name__
__module____qualname____firstlineno____doc__r   __annotations____static_attributes__r	       Z/home/wkmabra/.openclaw/workspace/venv/lib/python3.14/site-packages/pykalshi/exceptions.pyr   r      s    3Itr   r   c            	      Z   a  ] tR t^tRtRtRRRRRRRRR/R V 3R	 lllltR
 R ltRtV ;t	# )KalshiAPIErrora  Raised when the API returns a non-200 response.

Attributes:
    status_code: HTTP status code.
    message: Error message from the API.
    error_code: Kalshi-specific error code (e.g., "insufficient_balance").
    method: HTTP method of the failed request.
    endpoint: API endpoint path.
    request_body: Request payload (for POST/PUT), if available.
    response_body: Raw response body for debugging.
    retryable: Whether this error is safe to retry (e.g., 5xx, rate limits).
TNmethodendpointrequest_bodyresponse_bodyc               4    V ^8  d   QhRRRRRRRRRRR	R
RR/# )   status_codeintmessagestr
error_codez
str | Noner   r   r   zdict[str, Any] | Noner   zdict[str, Any] | str | Noner	   )formats   "r   __annotate__KalshiAPIError.__annotate__   sP     + ++ + 	+ + + ,+ 3+r   c               	$  < V R V 2.pV'       d   V R V RV R2V^ &   V'       d!   V'       d   VP                  RV RV R24       \        S	V `	  RP                  V4      4       Wn        W n        W0n        W@n        WPn        W`n	        Wpn
        R# )z: z ()[ ]N)appendsuper__init__joinr   r   r   r   r   r   r   )
selfr   r   r   r   r   r   r   parts	__class__s
   &&&&$$$$ r   r*   KalshiAPIError.__init__   s      =7),-%b	J<qAE!HhLL1VHAhZq12%)&$ (*r   c                   V ^8  d   QhRR/# )r   returnr   r	   )r    s   "r   r!   r"   8   s     
 
# 
r   c           
     	    V P                   P                   R V P                   RV P                  : RV P                  : RV P
                  : R2
# )z(status_code=z
, message=z, error_code=z, endpoint=r$   )r.   r
   r   r   r   r   )r,   s   &r   __repr__KalshiAPIError.__repr__8   s\    ~~&&' (++, -||& '//, -(	+	
r   )r   r   r   r   r   r   r   )N)
r
   r   r   r   r   r   r*   r3   r   __classcell__)r.   s   @r   r   r      sK     I+ "+  $+ /3+ 6:+ +8
 
r   r   c                      ] tR t^BtRtRtRtR# )AuthenticationErrorzRaised when authentication fails (401/403).

Common causes:
- Invalid or expired API key
- Malformed signature
- Clock skew (timestamp too old)
Fr	   Nr
   r   r   r   r   r   r   r	   r   r   r7   r7   B   s     Ir   r7   c                      ] tR t^NtRtRtRtR# )InsufficientFundsErrorzyRaised when the order cannot be placed due to insufficient funds.

Check `request_body` for the order that was rejected.
Fr	   Nr8   r	   r   r   r:   r:   N       
 Ir   r:   c                      ] tR t^WtRtRtRtR# )ResourceNotFoundErrorzrRaised when a resource (market, order) is not found (404).

Check `endpoint` to see which resource was not found.
Fr	   Nr8   r	   r   r   r=   r=   W   r;   r   r=   c                      ] tR t^`tRtRtRtR# )RateLimitErrorztRaised when rate limit retries are exhausted (429).

Consider using a RateLimiter to proactively throttle requests.
Tr	   Nr8   r	   r   r   r?   r?   `   s    
 Ir   r?   c                      ] tR t^itRtRtRtR# )OrderRejectedErrora  Raised when an order is rejected by the exchange.

Common causes:
- Market is closed or settled
- Invalid price (outside 1-99 range)
- Self-trade prevention triggered
- Post-only order would take liquidity

Check `request_body` for the rejected order details.
Fr	   Nr8   r	   r   r   rA   rA   i   s    	 Ir   rA   N)
__future__r   typingr   	Exceptionr   r   r7   r:   r=   r?   rA   r	   r   r   <module>rE      s`    " ) 3
[ 3
l	. 	^ N ^  r   