+
    irG                       ^ RI Ht ^ RIHt ^ RIHtHtHtHt ^RI	H
t
HtHtHt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 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! 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/ R0]4      t$ ! R1 R2]4      t% ! R3 R4]4      t& ! R5 R6]4      t' ! R7 R8]4      t( ! R9 R:]4      t) ! R; R<]4      t* ! R= R>]4      t+ ! R? R@]4      t,RA# )B    )annotations)cached_property)AliasChoices	BaseModel
ConfigDictField)OrderStatusSideAction	OrderTypeMarketStatusc                  "   ] tR t^t$ RtR]R&   RtR]R&   RtR]R&   RtR]R&   Rt	R]R	&   Rt
R]R
&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R &   RtR]R!&   Rt R]R"&   Rt!R]R#&   Rt"R]R$&   Rt#R]R%&   Rt$R]R&&   Rt%R]R'&   Rt&R(]R)&   Rt'R]R*&   Rt(R]R+&   ])! R,R-7      t*R.t+R# )/MarketModelzPydantic model for Market data.strtickerN
str | Noneevent_tickerseries_tickermarket_typetitlesubtitleyes_sub_titleno_sub_title	open_time
close_timeexpiration_timeexpected_expiration_timelatest_expiration_timecreated_timeupdated_timezMarketStatus | Nonestatusresult
int | Nonesettlement_valueyes_bidyes_askno_bidno_ask
last_priceprevious_yes_bidprevious_yes_askprevious_pricenotional_valuevolume
volume_24hopen_interest	liquidity	tick_sizestrike_typebool | Nonecan_close_earlyrules_primaryrules_secondaryignoreextra ),__name__
__module____qualname____firstlineno____doc____annotations__r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r5   r6   r7   r   model_config__static_attributes__r;       V/home/wkmabra/.openclaw/workspace/venv/lib/python3.14/site-packages/pykalshi/models.pyr   r      s   )K#L*# $M:$"K"E:Hj $M:$#L*# !Iz !J
!"&OZ&+/j/)-J-#L*##L*# #'F&FJ#'j' GZGZFJFJ!J
!#'j'#'j'!%NJ%!%NJ% FJ!J
! $M:$ Iz  !Iz "K"#'O[' $M:$"&OZ&H-LrD   r   c                      ] tR t^<t$ RtR]R&   R]R&   RtR]R&   RtR]R&   RtR]R	&   R
t	R]R&   Rt
R]R&   RtR]R&   RtR]R&   R
tR]R&   ]! RR7      tRtR# )
EventModelzPydantic model for Event data.r   r   r   Nr   r   	sub_titlecategoryFboolmutually_exclusivecollateral_return_typestrike_datestrike_periodavailable_on_brokersr8   r9   r;   )r<   r=   r>   r?   r@   rA   r   rH   rI   rK   rL   rM   rN   rO   r   rB   rC   r;   rD   rE   rG   rG   <   st    (E: Iz Hj  %$)-J- #K" $M:$ "'$&H-LrD   rG   c                  :   ] tR t^St$ RtR]R&   R]R&   R]R&   RtR]R	&   RtR
]R&   RtR]R&   Rt	R]R&   Rt
R]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   ]! RR7      tR tR# )!
OrderModelzPydantic model for Order data.r   order_idr   r	   r!   NzAction | NoneactionzSide | NonesidezOrderType | Nonetyper#   	yes_priceno_priceinitial_count
fill_countremaining_count
taker_fees
maker_feestaker_fill_costmaker_fill_costr   user_idclient_order_idr   last_update_timer   r8   r9   r;   )r<   r=   r>   r?   r@   rA   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   r   ra   r   r   rB   rC   r;   rD   rE   rQ   rQ   S   s    (MK FM D+!D
! !Iz Hj !%M:$!J
!"&OZ& "J
!!J
!"&OZ&"&OZ& GZ"&OZ&#L*##'j'"&OZ&H-LrD   rQ   c                  \    ] tR t^vt$ RtR]R&   R]R&   RtR]R&   ]! RR	7      tR
 R lt	Rt
R# )BalanceModelz5Pydantic model for Balance data. Values are in cents.intbalanceportfolio_valueNr#   
updated_tsr8   r9   c                   V ^8  d   QhRR/#    returnr   r;   )formats   "rE   __annotate__BalanceModel.__annotate__        " "S "rD   c                	    ^RI Hp V! V 4      # )   )balance_html)_reprrr   )selfrr   s   & rE   _repr_html_BalanceModel._repr_html_       'D!!rD   r;   )r<   r=   r>   r?   r@   rA   rg   r   rB   ru   rC   r;   rD   rE   rc   rc   v   s.    ?L!J
!H-L" "rD   rc   c                      ] tR t^t$ RtR]R&   R]R&   RtR]R&   RtR]R	&   RtR]R
&   Rt	R]R&   Rt
R]R&   RtR]R&   ]! RR7      tR R ltRtR# )PositionModelz(Pydantic model for a portfolio position.r   r   rd   positionNr#   market_exposuretotal_tradedresting_orders_count	fees_paidrealized_pnlr   last_updated_tsr8   r9   c                   V ^8  d   QhRR/# ri   r;   )rl   s   "rE   rm   PositionModel.__annotate__   s     # #S #rD   c                	    ^RI Hp V! V 4      # )rq   )position_html)rs   r   )rt   r   s   & rE   ru   PositionModel._repr_html_   s    (T""rD   r;   )r<   r=   r>   r?   r@   rA   r{   r|   r}   r~   r   r   r   rB   ru   rC   r;   rD   rE   ry   ry      s`    2KM"&OZ&#L*#'+*+ Iz #L*#"&OZ&H-L# #rD   ry   c                      ] tR t^t$ RtR]R&   R]R&   R]R&   R]R&   R]R	&   R
]R&   R
]R&   R
]R&   RtR]R&   RtR]R&   RtR]R&   Rt	R]R&   Rt
R]R&   RtR]R&   ]! RR7      tR R ltRtR# )	FillModelz*Pydantic model for a trade fill/execution.r   trade_idr   rR   r
   rT   r   rS   rd   countrV   rW   Nr4   is_takerr   fill_idmarket_tickerfee_costr   r#   tsr8   r9   c                   V ^8  d   QhRR/# ri   r;   )rl   s   "rE   rm   FillModel.__annotate__   s      S rD   c                	    ^RI Hp V! V 4      # )rq   )	fill_html)rs   r   )rt   r   s   & rE   ru   FillModel._repr_html_   s    $rD   r;   )r<   r=   r>   r?   r@   rA   r   r   r   r   r   r   r   rB   ru   rC   r;   rD   rE   r   r      s}    4MKM
JNJNM Hk GZ $M:$Hj#L*#B
H-L rD   r   c                      ] tR t^t$ RtRtR]R&   RtR]R&   RtR]R&   Rt	R]R&   Rt
R]R	&   RtR]R
&   RtR]R&   RtR]R&   ]! RR7      tRtR# )OHLCDatazOHLC price data.Nr#   openhighlowcloser   open_dollarshigh_dollarslow_dollarsclose_dollarsr8   r9   r;   )r<   r=   r>   r?   r@   r   rA   r   r   r   r   r   r   r   r   rB   rC   r;   rD   rE   r   r      s_    D*D*CE:#L*##L*#"K" $M:$H-LrD   r   c                      ] tR t^t$ RtRtR]R&   RtR]R&   RtR]R&   Rt	R]R&   Rt
R]R&   RtR]R	&   RtR]R
&   RtR]R&   ]! RR7      tRtR# )	PriceDataz"Price data with additional fields.Nr#   r   r   r   r   maxminmeanpreviousr8   r9   r;   )r<   r=   r>   r?   r@   r   rA   r   r   r   r   r   r   r   r   rB   rC   r;   rD   rE   r   r      s_    ,D*D*CE:CCD*HjH-LrD   r   c                  r    ] tR t^t$ RtR]R&   R]R&   R]R&   R]R&   RtR	]R
&   RtR	]R&   ]! RR7      t	Rt
R# )Candlestickz(Pydantic model for a single Candlestick.rd   end_period_tsr.   r0   r   priceNzOHLCData | Noner%   r&   r8   r9   r;   )r<   r=   r>   r?   r@   rA   r%   r&   r   rB   rC   r;   rD   rE   r   r      s:    2K#G_##G_#H-LrD   r   c                  \    ] tR t^t$ RtR]R&   ]! RR7      tR]R&   ]! RR	R
7      t	R t
RtR# )CandlestickResponsez,Pydantic model for Candlestick API response.zlist[Candlestick]candlesticksr   validation_aliasr   r   r8   Tr:   populate_by_namec                    ^RI Hp V! V 4      # )zConvert candlesticks to a pandas DataFrame.

Requires pandas: pip install pykalshi[dataframe]

Returns:
    DataFrame with columns: ticker, end_period_ts, timestamp,
    volume, open_interest, open, high, low, close, mean.
to_dataframe	dataframer   rt   r   s   & rE   r    CandlestickResponse.to_dataframe        	,D!!rD   r;   N)r<   r=   r>   r?   r@   rA   r   r   r   rB   r   rC   r;   rD   rE   r   r      s+    6##9FC9HtDL
"rD   r   c                  B    ] tR t^t$ RtR]R&   R]R&   ]! RR7      tRtR# )	OrderbookLevelz8A single price level in the orderbook (price, quantity).rd   r   quantityr8   r9   r;   N	r<   r=   r>   r?   r@   rA   r   rB   rC   r;   rD   rE   r   r      s    BJMH-LrD   r   c                  f    ] tR t^t$ RtRtR]R&   RtR]R&   RtR]R&   Rt	R]R&   ]
! R	R
7      tRtR# )	Orderbookz#Orderbook with yes/no price levels.Nzlist[tuple[int, int]] | Noneyesnolist[tuple[str, int]] | Noneyes_dollars
no_dollarsr8   r9   r;   )r<   r=   r>   r?   r@   r   rA   r   r   r   r   rB   rC   r;   rD   rE   r   r      s;    -(,C	%,'+B$+04K-4/3J,3H-LrD   r   c                  J    ] tR tRt$ RtRtR]R&   RtR]R&   ]! RR7      t	R	t
R# )
OrderbookFpi  zFixed-point orderbook data.Nr   r   r   r8   r9   r;   )r<   r=   r>   r?   r@   r   rA   r   r   rB   rC   r;   rD   rE   r   r     s%    %04K-4/3J,3H-LrD   r   c                  B   ] tR tRt$ RtR]R&   RtR]R&   ]! RR	7      t]	R
 R l4       t
]	R R l4       t]	R R l4       t]	R R l4       t]	R R l4       t]	R R l4       t]	R R l4       t]	R R l4       tR R ltR R lt]	R R l4       tR  R! ltR" tR# R$ ltR%tR# )&OrderbookResponsei  z.Pydantic model for the orderbook API response.r   	orderbookNzOrderbookFp | Noneorderbook_fpr8   r9   c                   V ^8  d   QhRR/# rj   rk   zlist[OrderbookLevel]r;   )rl   s   "rE   rm   OrderbookResponse.__annotate__  s     W W0 WrD   c                    V P                   P                  '       g   . # V P                   P                   Uu. uF  p\        V^ ,          V^,          R7      NK   	  up# u upi )z&Get YES price levels as typed objects.r   r   )r   r   r   rt   ps   & rE   
yes_levelsOrderbookResponse.yes_levels  sL     ~~!!!ICG>>CUCUVCUaQqTAaD9CUVVV   $Ac                   V ^8  d   QhRR/# r   r;   )rl   s   "rE   rm   r     s     V V/ VrD   c                    V P                   P                  '       g   . # V P                   P                   Uu. uF  p\        V^ ,          V^,          R7      NK   	  up# u upi )z%Get NO price levels as typed objects.r   )r   r   r   r   s   & rE   	no_levelsOrderbookResponse.no_levels  sL     ~~   ICG>>CTCTUCTaQqTAaD9CTUUUr   c                   V ^8  d   QhRR/# rj   rk   r#   r;   )rl   s   "rE   rm   r   %  s     5 5j 5rD   c                    V P                   P                  '       g   R# \        R V P                   P                   4       4      # )z*Highest YES bid price, or None if no bids.Nc              3  2   "   T F  q^ ,          x  K  	  R# 5ir   Nr;   .0r   s   & rE   	<genexpr>1OrderbookResponse.best_yes_bid.<locals>.<genexpr>)  s     4!3AQ44!3   )r   r   r   rt   s   &rE   best_yes_bidOrderbookResponse.best_yes_bid$  s2     ~~!!!4!3!3444rD   c                   V ^8  d   QhRR/# r   r;   )rl   s   "rE   rm   r   ,  s     4 4Z 4rD   c                    V P                   P                  '       g   R# \        R V P                   P                   4       4      # )z)Highest NO bid price, or None if no bids.Nc              3  2   "   T F  q^ ,          x  K  	  R# 5ir   r;   r   s   & rE   r   0OrderbookResponse.best_no_bid.<locals>.<genexpr>0  s     3!2AQ44!2r   )r   r   r   r   s   &rE   best_no_bidOrderbookResponse.best_no_bid+  s2     ~~   3!2!2333rD   c                   V ^8  d   QhRR/# r   r;   )rl   s   "rE   rm   r   3  s     & &j &rD   c                H    V P                   f   R# ^dV P                   ,
          # )z%Lowest YES ask (= 100 - best NO bid).N)r   r   s   &rE   best_yes_askOrderbookResponse.best_yes_ask2  s$     #T%%%%rD   c                   V ^8  d   QhRR/# r   r;   )rl   s   "rE   rm   r   :  s     5 5
 5rD   c                x    V P                   e   V P                  f   R# V P                  V P                   ,
          # )z5Bid-ask spread in cents. None if no two-sided market.Nr   r   r   s   &rE   spreadOrderbookResponse.spread9  s5     $(9(9(A  4#4#444rD   c                   V ^8  d   QhRR/# rj   rk   float | Noner;   )rl   s   "rE   rm   r   A  s     ; ;\ ;rD   c                    V P                   e   V P                  f   R# V P                   V P                  ,           ^,          # )z'Mid price. None if no two-sided market.Nr   r   s   &rE   midOrderbookResponse.mid@  s:     $(9(9(A!!D$5$55::rD   c                   V ^8  d   QhRR/# r   r;   )rl   s   "rE   rm   r   H  s     0 0L 0rD   c                    V P                   e    V P                  e   V P                  ^ 8X  d   R# V P                   V P                  ,          R,          # )z;Spread as basis points of mid. None if no two-sided market.Ni'  )r   r   r   s   &rE   
spread_bpsOrderbookResponse.spread_bpsG  s<     ;;$(("2dhh!mdhh&%//rD   c                    V ^8  d   QhRRRR/# rj   through_pricerd   rk   r;   )rl   s   "rE   rm   r   N  s     K Ks Ks KrD   c                   a V P                   P                  '       g   ^ # \        V3R lV P                   P                   4       4      # )z3Total YES bid quantity at or above `through_price`.c              3  >   <"   T F  w  rVS8  g   K  Vx  K  	  R # 5iNr;   r   r   qr   s   &  rE   r   .OrderbookResponse.yes_depth.<locals>.<genexpr>R  s     J!3qM7I11!3   
)r   r   sumrt   r   s   &frE   	yes_depthOrderbookResponse.yes_depthN  s1    ~~!!!J!3!3JJJrD   c                    V ^8  d   QhRRRR/# r   r;   )rl   s   "rE   rm   r   T  s     J Jc Jc JrD   c                   a V P                   P                  '       g   ^ # \        V3R lV P                   P                   4       4      # )z2Total NO bid quantity at or above `through_price`.c              3  >   <"   T F  w  rVS8  g   K  Vx  K  	  R # 5ir  r;   r  s   &  rE   r   -OrderbookResponse.no_depth.<locals>.<genexpr>X  s     I!2a=6H11!2r  )r   r   r  r  s   &frE   no_depthOrderbookResponse.no_depthT  s1    ~~   I!2!2IIIrD   c                   V ^8  d   QhRR/# r   r;   )rl   s   "rE   rm   r   [  s     . .< .rD   c                R   V P                   P                  '       d'   \        R V P                   P                   4       4      M^ pV P                   P                  '       d'   \        R V P                   P                   4       4      M^ pW,           pV^ 8X  d   R# W,
          V,          # )zPOrder imbalance: (yes_depth - no_depth) / (yes_depth + no_depth). Range [-1, 1].c              3  *   "   T F	  w  rVx  K  	  R # 5ir  r;   r   _r  s   &  rE   r   .OrderbookResponse.imbalance.<locals>.<genexpr>]  s     9&8da&8   c              3  *   "   T F	  w  rVx  K  	  R # 5ir  r;   r  s   &  rE   r   r  ^  s     7%6TQq%6r  N)r   r   r  r   )rt   	yes_totalno_totaltotals   &   rE   	imbalanceOrderbookResponse.imbalanceZ  s}     >B^^=O=O=OC9dnn&8&899UV	;?>>;L;L;L37T^^%6%677RS$A:$--rD   c               $    V ^8  d   QhRRRRRR/# )rj   rT   r   sizerd   rk   r   r;   )rl   s   "rE   rm   r   d  s!     ! ! !C !L !rD   c                B   VR8X  d   V P                   P                  MV P                   P                  pV'       g   R# \        VR RR7      pTp^ pV F9  w  rx\	        WX4      p	^dV,
          p
WiV
,          ,          pWY,          pV^ 8:  g   K9   M	  V^ 8  d   R# Wb,          # )zVolume-weighted average price to fill `size` contracts.

Args:
    side: "yes" or "no" - the side you're buying
    size: Number of contracts to fill

Returns:
    VWAP in cents, or None if insufficient liquidity.
r   Nc                    V ^ ,          # )r   r;   )xs   &rE   <lambda>0OrderbookResponse.vwap_to_fill.<locals>.<lambda>u  s    QqTrD   T)keyreverse)r   r   r   sortedr   )rt   rT   r  levelssorted_levels	remainingcostr   qtytake
fill_prices   &&&        rE   vwap_to_fillOrderbookResponse.vwap_to_filld  s     '+em""9K9K v>4H	'JEy&D uJ:%%DIA~ ( q={rD   c                    ^RI Hp V! V 4      # )zConvert orderbook to a pandas DataFrame with price levels.

Requires pandas: pip install pykalshi[dataframe]

Returns:
    DataFrame with columns: side, price, quantity.
    Sorted by side (yes first), then price descending.
r   r   r   s   & rE   r   OrderbookResponse.to_dataframe  r   rD   c                   V ^8  d   QhRR/# ri   r;   )rl   s   "rE   rm   r     s     $ $S $rD   c                	    ^RI Hp V! V 4      # )rq   )orderbook_html)rs   r4  )rt   r4  s   & rE   ru   OrderbookResponse._repr_html_  s    )d##rD   r;   )r<   r=   r>   r?   r@   rA   r   r   rB   r   r   r   r   r   r   r   r   r   r  r  r  r.  r   ru   rC   r;   rD   rE   r   r     s    8'+L$+H-LW W V V 5 5 4 4 & & 5 5 ; ; 0 0KJ . .!F
"$ $rD   r   c                  N    ] tR tRt$ RtR]R&   R]R&   ]! RR7      tR R	 ltR
t	R# )ExchangeStatusi  zExchange operational status.rJ   exchange_activetrading_activer8   r9   c                   V ^8  d   QhRR/# ri   r;   )rl   s   "rE   rm   ExchangeStatus.__annotate__  s     * *S *rD   c                	    ^RI Hp V! V 4      # )rq   )exchange_status_html)rs   r=  )rt   r=  s   & rE   ru   ExchangeStatus._repr_html_  s    /#D))rD   r;   N
r<   r=   r>   r?   r@   rA   r   rB   ru   rC   r;   rD   rE   r7  r7    s%    &H-L* *rD   r7  c                      ] tR tRt$ RtRtR]R&   R]R&   RtR]R&   RtR]R	&   Rt	R]R
&   Rt
R]R&   RtR]R&   ]! RR7      tR R ltRtR# )Announcementi  zExchange announcement.Nr   idr   r   bodyrU   r   delivery_timer!   r8   r9   c                   V ^8  d   QhRR/# ri   r;   )rl   s   "rE   rm   Announcement.__annotate__  s     ' 'S 'rD   c                	    ^RI Hp V! V 4      # )rq   )announcement_html)rs   rH  )rt   rH  s   & rE   ru   Announcement._repr_html_  s    , &&rD   r;   )r<   r=   r>   r?   r@   rB  rA   rC  rU   r   rD  r!   r   rB   ru   rC   r;   rD   rE   rA  rA    sZ     B
JD*D*#L*# $M:$FJH-L' 'rD   rA  c                  B    ] tR tRt$ RtR]R&   R]R&   ]! RR7      tRtR	# )
RateLimitTieri  zRate limit for a specific tier.rd   max_requestsperiod_secondsr8   r9   r;   Nr   r;   rD   rE   rK  rK    s    )H-LrD   rK  c                  d    ] tR tRt$ RtRtR]R&   RtR]R&   RtR]R&   ]	! R	R
7      t
R R ltRtR# )	APILimitsi  z+API rate limits for the authenticated user.Nr   
usage_tierr#   
read_limitwrite_limitr8   r9   c                   V ^8  d   QhRR/# ri   r;   )rl   s   "rE   rm   APILimits.__annotate__       % %S %rD   c                	    ^RI Hp V! V 4      # )rq   )api_limits_html)rs   rW  )rt   rW  s   & rE   ru   APILimits._repr_html_      *t$$rD   r;   )r<   r=   r>   r?   r@   rP  rA   rQ  rR  r   rB   ru   rC   r;   rD   rE   rO  rO    s7    5!J
!!J
!"K"H-L% %rD   rO  c                      ] tR tRt$ Rt]! RR7      tR]R&   RtR]R	&   Rt	R]R
&   Rt
R]R&   RtR]R&   ]! RRR7      tR R ltRtR# )APIKeyi  zAPI key information.
api_key_idr   r   rB  Nr   namer   	last_usedlist[str] | Nonescopesr8   Tr   c                   V ^8  d   QhRR/# ri   r;   )rl   s   "rE   rm   APIKey.__annotate__  ro   rD   c                	    ^RI Hp V! V 4      # )rq   )api_key_html)rs   rd  )rt   rd  s   & rE   ru   APIKey._repr_html_  rw   rD   r;   )r<   r=   r>   r?   r@   r   rB  rA   r]  r   r^  r`  r   rB   ru   rC   r;   rD   rE   r[  r[    sS    \2B2D*#L*# Iz #F#HtDL" "rD   r[  c                  d    ] tR tRt$ Rt]! RR7      tR]R&   R]R&   RtR	]R
&   ]	! RRR7      t
RtR# )GeneratedAPIKeyi  z>Newly generated API key with private key (only returned once).r\  r   r   rB  private_keyNr   r]  r8   Tr   r;   )r<   r=   r>   r?   r@   r   rB  rA   r]  r   rB   rC   r;   rD   rE   rg  rg    s0    H\2B2D*HtDLrD   rg  c                  ~    ] tR tRt$ RtR]R&   RtR]R&   RtR]R&   RtR	]R
&   Rt	R]R&   Rt
R]R&   ]! RR7      tRtR# )SeriesModeli  zPydantic model for Series data.r   r   Nr   r   rI   r_  tagsr#   settlement_timer_seconds	frequencyr8   r9   r;   )r<   r=   r>   r?   r@   rA   r   rI   rk  rl  rm  r   rB   rC   r;   rD   rE   rj  rj    sH    )KE:Hj!D
!+/j/ Iz H-LrD   rj  c                      ] tR tRt$ RtR]R&   R]R&   R]R&   R]R&   R]R	&   R
tR]R&   R
tR]R&   R
tR]R&   ]	! RR7      t
R R ltRtR
# )
TradeModeli  zPublic trade execution record.r   r   r   rd   r   rV   rW   Nr   
taker_sider   r#   r   r8   r9   c                   V ^8  d   QhRR/# ri   r;   )rl   s   "rE   rm   TradeModel.__annotate__  s        S  rD   c                	    ^RI Hp V! V 4      # )rq   )
trade_html)rs   rt  )rt   rt  s   & rE   ru   TradeModel._repr_html_  s    %$rD   r;   )r<   r=   r>   r?   r@   rA   rp  r   r   r   rB   ru   rC   r;   rD   rE   ro  ro    sP    (MKJNM!J
!#L*#B
H-L   rD   ro  c                      ] tR tRt$ RtR]R&   RtR]R&   RtR]R&   ^ tR	]R
&   ^ t	R	]R&   ^ t
R	]R&   ^ tR	]R&   ^ tR	]R&   ^ tR	]R&   RtR]R&   RtR]R&   ]! RR7      t]R R l4       t]R R l4       tR R ltRtR# )SettlementModeli  z*Settlement record for a resolved position.r   r   Nr   r   market_resultrd   	yes_countno_countyes_total_costno_total_costrevenuevaluer   settled_timer8   r9   c                   V ^8  d   QhRR/# rj   rk   rd   r;   )rl   s   "rE   rm   SettlementModel.__annotate__  s     . .c .rD   c                <    V P                   V P                  ,
          # )z,Net position: positive = yes, negative = no.)ry  rz  r   s   &rE   net_positionSettlementModel.net_position  s     ~~--rD   c                   V ^8  d   QhRR/# r  r;   )rl   s   "rE   rm   r    s     S SS SrD   c                    \        \        V P                  ;'       g    ^ 4      ^d,          4      pV P                  V P                  ,
          V P
                  ,
          V,
          # )z*Net P&L in cents (revenue - costs - fees).)roundfloatr   r}  r{  r|  )rt   	fee_centss   & rE   pnlSettlementModel.pnl  sI     % 2 23c9:	||d111D4F4FFRRrD   c                   V ^8  d   QhRR/# ri   r;   )rl   s   "rE   rm   r  #  rU  rD   c                	    ^RI Hp V! V 4      # )rq   )settlement_html)rs   r  )rt   r  s   & rE   ru   SettlementModel._repr_html_#  rY  rD   r;   )r<   r=   r>   r?   r@   rA   r   rx  ry  rz  r{  r|  r}  r~  r   r  r   rB   propertyr  r  ru   rC   r;   rD   rE   rw  rw    s    4K#L*# $M:$IsHcNCM3GSE3NHj#L*#H-L. . S S
% %rD   rw  c                  N    ] tR tRt$ RtR]R&   R]R&   ]! RR7      tR	 R
 ltRt	R# )QueuePositionModeli(  z1Order's position in the queue at its price level.r   rR   rd   queue_positionr8   r9   c                   V ^8  d   QhRR/# ri   r;   )rl   s   "rE   rm   QueuePositionModel.__annotate__/  s     ) )S )rD   c                	    ^RI Hp V! V 4      # )rq   )queue_position_html)rs   r  )rt   r  s   & rE   ru   QueuePositionModel._repr_html_/  s    ."4((rD   r;   Nr?  r;   rD   rE   r  r  (  s$    ;MH-L) )rD   r  c                      ] tR tRt$ Rt]! ]! RR4      R7      tR]R&   Rt	R]R	&   Rt
R
]R&   RtR]R&   RtR]R&   ]! RRR7      tR R ltRtR# )OrderGroupModeli4  zOrder group for rate-limiting contract matches.

Order groups limit total contracts matched across all orders in the group
over a rolling 15-second window. When the limit is hit, all orders in the
group are cancelled.
rB  order_group_idr   r   Nr4   is_auto_cancel_enabledr#   contracts_limitr   contracts_limit_fpr_  ordersr8   Tr   c                   V ^8  d   QhRR/# ri   r;   )rl   s   "rE   rm   OrderGroupModel.__annotate__E  s     & &S &rD   c                	    ^RI Hp V! V 4      # )rq   )order_group_html)rs   r  )rt   r  s   & rE   ru   OrderGroupModel._repr_html_E  s    +%%rD   r;   )r<   r=   r>   r?   r@   r   r   rB  rA   r  r  r  r  r   rB   ru   rC   r;   rD   rE   r  r  4  sa     \$8H%IJBJ*.K."&OZ&%)
)#F#HtDL& &rD   r  c                  P    ] tR tRt$ RtR]R&   R]R&   RtR]R	&   ]! R
R7      tRt	R# )SubaccountModeliL  zSubaccount info.r   subaccount_idrd   subaccount_numberNr   r   r8   r9   r;   
r<   r=   r>   r?   r@   rA   r   r   rB   rC   r;   rD   rE   r  r  L  s%    #L*#H-LrD   r  c                  P    ] tR tRt$ RtR]R&   R]R&   RtR]R	&   ]! R
R7      tRt	R# )SubaccountBalanceModeliU  z Balance for a single subaccount.r   r  rd   re   Nr#   rf   r8   r9   r;   )
r<   r=   r>   r?   r@   rA   rf   r   rB   rC   r;   rD   rE   r  r  U  s$    *L"&OZ&H-LrD   r  c                  d    ] tR tRt$ RtR]R&   R]R&   R]R&   R]R&   R	tR
]R&   ]! RR7      tRt	R	# )SubaccountTransferModeli^  z)Record of a transfer between subaccounts.r   transfer_idfrom_subaccount_idto_subaccount_idrd   amountNr   r   r8   r9   r;   r  r;   rD   rE   r  r  ^  s0    3K#L*#H-LrD   r  c                  B    ] tR tRt$ RtR]R&   R]R&   ]! RR7      tRtR	# )
ForecastPointii  z.A single point in forecast percentile history.rd   r   r~  r8   r9   r;   Nr   r;   rD   rE   r  r  i  s    8GJH-LrD   r  c                  B    ] tR tRt$ RtR]R&   R]R&   ]! RR7      tR	tR
# )ForecastPercentileHistoryiq  z=Historical forecast data at various percentiles for an event.r   r   zdict[str, list[ForecastPoint]]percentilesr8   r9   r;   Nr   r;   rD   rE   r  r  q  s    G//H-LrD   r  N)-
__future__r   	functoolsr   pydanticr   r   r   r   enumsr	   r
   r   r   r   r   rG   rQ   rc   ry   r   r   r   r   r   r   r   r   r   r7  rA  rK  rO  r[  rg  rj  ro  rw  r  r  r  r  r  r  r  r;   rD   rE   <module>r     s   " % ? ? E E2.) 2.j. .. .  .F"9 "#I #&	 2.y ..	 .
.) 
.") ",.Y ..	 ..) .G$	 G$X	*Y 	*'9 '&.I .
%	 
%"Y "Ei E	.) 	.   $%i %@	) 	)&i &0.i ..Y ..i ..I ..	 .rD   