
    E#i                         S SK rS SKJrJr  S SKrS SKJrJrJ	r	J
r
JrJrJrJrJrJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S S	KJr  S S
KJr   " S S\R6                  R8                  5      rg)    N)
ArrayCacheArrayCacheBySymbolById)
AnyBoolIntOrder	OrderBookStrStringsTickerTickersTrade)Client)List)ExchangeError)AuthenticationError)ArgumentsRequired)
BadRequest)	BadSymbolc            
         ^  \ rS rSrS\4U 4S jjrS rSS0 4S jr/ S0 4S jr0 4S\	S\
4S	 jjrS0 4S
\S\4S jjrSS0 4S\	S\S\S\\   4S jjrSS0 4S
\\	   S\S\S\\   4S jjrSSS0 4S\S\S\S\\   4S jjrSS0 4S
\\	   S\S\S\\   4S jjrSS0 4S
\\	   S\S\S\\   4S jjrSSS0 4S\S\S\S\\   4S jjrS0 4S
\\	   S\S\4S jjrS0 4S\	S\S\4S jjrS\4S jrS\4S jrS&U 4S jjr S r!S\4S jr"S&S jr#S\4S jr$S&S\
4U 4S jjjr%S r&S  r'S\4S! jr(S\4S" jr)S\S\*4S# jr+S\4S$ jr,S%r-U =r.$ )'coinbaseexchange   returnc                    > U R                  [        [        U ]  5       SSSSSSSSSSSSSSS.SS0SS0S.SSSS	.S
.5      $ )NTF)ws
watchOHLCVwatchOrderBookwatchOrderBookForSymbolswatchTickerwatchTickerswatchTradeswatchTradesForSymbolswatchMyTradesForSymbolswatchBalancewatchStatuswatchOrderswatchOrdersForSymbolswatchMyTradesr   z#wss://ws-feed.exchange.coinbase.comz2wss://ws-feed-public.sandbox.exchange.coinbase.com)apitest  )tradesLimitordersLimitmyTradesLimit)hasurlsoptions)deep_extendsuperr   describe)self	__class__s    S/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/pro/coinbaseexchange.pyr4   coinbaseexchange.describe   s    &6 F H#"&,0# $#)-+/ %$#)-!%$ ? N	  $#!%3K
  	    c                 2   U R                  5         SnU R                  5       n[        U5      S-   U-   nU R                  U R	                  U5      U R                  U R                  5      [        R                  S5      nUU R                  UU R                  S.$ )Nz/users/self/verifyGETbase64)	timestampkey	signature
passphrase)check_required_credentialsnoncestrhmacencodebase64_to_binarysecrethashlibsha256apiKeypassword)r5   pathrB   payloadr?   s        r7   authenticatecoinbaseexchange.authenticate6   s    '')#

e*u$t+IIdkk'2D4I4I$++4VX_XfXfhpq	;;"--	
 	
r9   Nc                 R  #    U R                  5       I S h  vN   S nUn/ nUb0  U R                  U5      nUSUS   -   -  nUR                  US   5        U R                  S   S   nSU;   a  US-   nSUU/S.n	U R	                  X5      n
U R                  XX5      I S h  vN $  N N7f)	N:idr)   r   r?   ?	subscribetypeproduct_idschannels)load_marketsmarketappendr0   extendwatch)r5   namesymbolmessageHashStartparamsrZ   messageHash
productIdsurlrT   requests              r7   rT   coinbaseexchange.subscribeC   s     !!!&
[[(F3--KfTl+iit$& )C%
	 ++i0ZZ'GGG) 	"( Hs"   B'B#BB'B%B'%B'c                   #    U R                  5       I S h  vN   S nU R                  U5      n/ n/ n[        S[        U5      5       HF  nX(   n	U R	                  U	5      nUR                  US   5        UR                  US-   US   -   5        MH     U R                  S   S   n
SU;   a  U
S-   n
S	UU/S
.nU R                  X5      nU R                  XX5      I S h  vN $  N N7f)Nr   rR   rQ   r_   r)   r   r?   rS   rT   rU   )	rY   market_symbolsrangelenrZ   r[   r0   r\   watch_multiple)r5   r^   symbolsr`   ra   rZ   messageHashesrc   ir_   rd   rT   re   s                r7   subscribe_multiple#coinbaseexchange.subscribe_multipleZ   s     !!!%%g.
q#g,'AZF[[(FfTl+  !1C!7&:J!JK	 (
 iit$& )C%
	 ++i0((WTTT- 	", Us"   C$C CC$C"C$"C$r_   c                 F   #    SnU R                  X1X25      I Sh  vN $  N7f)ah  
watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
:param str symbol: unified symbol of the market to fetch the ticker for
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
tickerN)rT   )r5   r_   ra   r^   s       r7   watch_tickercoinbaseexchange.watch_tickers   s#      ^^D$????s   !!rl   c                 B  #    U R                  5       I Sh  vN   [        U5      nUS:X  a  [        U R                  S-   5      eSnSnU R	                  XAXR5      I Sh  vN nU R
                  (       a  0 nXgUS   '   U$ U R                  U R                  SU5      $  N N?7f)a  
watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
:param str[] [symbols]: unified symbol of the market to fetch the ticker for
:param dict [params]: extra parameters specific to the exchange API endpoint
:param str [params.channel]: the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
Nr   z0 watchTickers requires a non-empty symbols arrayrr   r_   )rY   rj   r   rR   ro   
newUpdatesfilter_by_arraytickers)r5   rl   ra   symbolsLengthchannelrb   rr   results           r7   watch_tickerscoinbaseexchange.watch_tickers}   s      !!!GADGG&XXYY..wUU??F'-6(#$M##DLL(GDD 	" Vs"   BBABB>BBsincelimitc                   #    U R                  5       I Sh  vN   U R                  U5      nSnU R                  XQXT5      I Sh  vN nU R                  (       a  UR	                  X5      nU R                  XbUSS5      $  Ng N<7f)a  
get the list of most recent trades for a particular symbol
:param str symbol: unified symbol of the market to fetch trades for
:param int [since]: timestamp in ms of the earliest trade to fetch
:param int [limit]: the maximum amount of trades to fetch
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
Nmatchesr=   T)rY   r_   rT   rv   getLimitfilter_by_since_limit)r5   r_   r~   r   ra   r^   tradess          r7   watch_tradescoinbaseexchange.watch_trades   sv      !!!V$~~dDAA??OOF2E))&TRR 	" Bs!   BA>,BB ;B Bc                   #    [        U5      nUS:X  a  [        U R                  S-   5      eU R                  5       I Sh  vN   U R	                  U5      nSnU R                  XaXd5      I Sh  vN nU R                  (       a5  U R                  US5      nU R                  US5      n	UR                  X5      nU R                  XrUSS5      $  N N`7f)a  
get the list of most recent trades for a particular symbol
:param str[] symbols: unified symbol of the market to fetch trades for
:param int [since]: timestamp in ms of the earliest trade to fetch
:param int [limit]: the maximum amount of trades to fetch
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
r   z> watchTradesForSymbols() requires a non-empty array of symbolsNr   r_   r=   T)rj   r   rR   rY   rh   ro   rv   
safe_valuesafe_stringr   r   )
r5   rl   r~   r   ra   ry   r^   r   firsttradeSymbols
             r7   watch_trades_for_symbols)coinbaseexchange.watch_trades_for_symbols   s      GATWW'gghh!!!%%g...tdKK??OOFA.E**5(;KOOK7E))&TRR 	" Ls#   =CC ,C,C-ACCc           	        #    Uc  [        U R                  S-   5      eU R                  5       I Sh  vN   U R                  U5      nSnSnU R	                  5       nU R                  XQX`R                  XG5      5      I Sh  vN nU R                  (       a  UR                  X5      nU R                  XUSS5      $  N N<7f)a  
watches information on multiple trades made by the user
:param str symbol: unified market symbol of the market trades were made in
:param int [since]: the earliest time in ms to fetch trades for
:param int [limit]: the maximum number of trade structures to retrieve
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
Nz+ watchMyTrades() requires a symbol argumentusermyTradesr=   T)
r   rR   rY   r_   rN   rT   r\   rv   r   r   )	r5   r_   r~   r   ra   r^   rb   authenticationr   s	            r7   watch_my_trades coinbaseexchange.watch_my_trades   s      >#DGG.[$[\\!!!V$ **,~~dKVAdee??OOF2E))&TRR 	"
 f"   /B>B:AB>?B< ;B><B>c           	        #    U R                  USS5      nU R                  5       I Sh  vN   SnSnU R                  5       nU R                  XQX`R	                  XG5      5      I Sh  vN nU R
                  (       a5  U R                  US5      n	U R                  U	S5      n
UR                  X5      nU R                  XUSS5      $  N N`7f)	a  
watches information on multiple trades made by the user
:param str[] symbols: unified symbol of the market to fetch trades for
:param int [since]: the earliest time in ms to fetch trades for
:param int [limit]: the maximum number of trade structures to retrieve
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
NFr   r   r   r_   r=   T)
rh   rY   rN   ro   r\   rv   r   r   r   r   )r5   rl   r~   r   ra   r^   rb   r   r   r   r   s              r7   watch_my_trades_for_symbols,coinbaseexchange.watch_my_trades_for_symbols   s      %%gtU;!!! **,..tk;;W]Knoo??OOFA.E**5(;KOOK7E))&TRR 	" ps"   'C	C<C	&C'AC	C	c           	        #    U R                  5       I Sh  vN   U R                  USS5      nSnSnU R                  5       nU R                  XQX`R	                  XG5      5      I Sh  vN nU R
                  (       a5  U R                  US5      n	U R                  U	S5      n
UR                  X5      nU R                  XUSS5      $  N N`7f)	a  
watches information on multiple orders made by the user
:param str[] symbols: unified symbol of the market to fetch orders for
:param int [since]: the earliest time in ms to fetch orders for
:param int [limit]: the maximum number of trade structures to retrieve
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
NFr   ordersr   r_   r=   T)
rY   rh   rN   ro   r\   rv   r   r   r   r   )r5   rl   r~   r   ra   r^   rb   r   r   r   r   s              r7   watch_orders_for_symbols)coinbaseexchange.watch_orders_for_symbols   s      !!!%%gtU;**,..tk;;W]Knoo??OOFA.E**5(;KOOK7E))&TRR 	"
 ps#   C	CAC	&C'AC	C	c           	        #    Uc  [        U R                  S-   5      eU R                  5       I Sh  vN   U R                  U5      nSnSnU R	                  5       nU R                  XQX`R                  XG5      5      I Sh  vN nU R                  (       a  UR                  X5      nU R                  XUSS5      $  N N<7f)a  
watches information on multiple orders made by the user
:param str symbol: unified market symbol of the market orders were made in
:param int [since]: the earliest time in ms to fetch orders for
:param int [limit]: the maximum number of order structures to retrieve
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
Nz  watchMyTrades requires a symbolr   r   r=   T)
r   rR   rY   r_   rN   rT   r\   rv   r   r   )	r5   r_   r~   r   ra   r^   rb   r   r   s	            r7   watch_orderscoinbaseexchange.watch_orders   s      >DGG&HHII!!!V$**,~~dKVAdee??OOF2E))&TRR 	"
 fr   c                 2  #    [        U5      nUS:X  a  [        U R                  S-   5      eSnU R                  5       I Sh  vN   U R	                  U5      nU R                  U5      n/ n[        SU5       H  nXh   n	UR                  US-   U	-   5        M      U R                  S   S   n
SUU/S	.nU R                  X5      nUUUUS
.nU R                  5       nU R                  XU R                  X5      X}5      I Sh  vN nUR                  5       $  N N7f)a  
watches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
:param str[] symbols: unified array of symbols
:param int [limit]: the maximum amount of order book entries to return
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
r   zA watchOrderBookForSymbols() requires a non-empty array of symbolslevel2NrQ   r)   r   rT   rU   )rb   rl   	marketIdsr   )rj   r   rR   rY   rh   
market_idsri   r[   r0   r\   rN   rk   r   )r5   rl   r   ra   ry   r^   r   rm   rn   marketIdrd   rT   re   subscriptionr   	orderbooks                   r7   watch_order_book_for_symbols-coinbaseexchange.watch_order_book_for_symbols  s2     GATWW'jjkk!!!%%g.OOG,	q-(A |H  h!67 ) iit$$
	 ++i0"	
 **,--c$++gBfhu  E  E	  1 	". Es$   ?DDB<D>D?DDc                   #    SnU R                  5       I Sh  vN   U R                  U5      nUS   nUS-   US   -   nU R                  S   S   nSUS   /U/S	.nU R                  X5      n	UUUS   US
.n
U R	                  5       nU R                  XvU R                  X5      Xj5      I Sh  vN nUR                  5       $  N N7f)a  
watches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
:param str symbol: unified symbol of the market to fetch the order book for
:param int [limit]: the maximum amount of order book entries to return
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
r   Nr_   rQ   rR   r)   r   rT   rU   )rb   r_   r   r   )rY   rZ   r0   r\   rN   r]   r   )r5   r_   r   ra   r^   rZ   rb   rd   rT   re   r   r   r   s                r7   watch_order_book!coinbaseexchange.watch_order_book3  s      !!!V$!Sj6$</iit$t 
	 ++i0&t	
 **,**St{{77[]hww	  / 	", xs"   CC BC+C,CCclientc                 ^   U R                  US5      nUb  U R                  U5      nUS   nSnUS-   U-   nU R                  U R                  U5      nUc6  U R	                  U R
                  SS5      n	[        U	5      nXR                  U'   UR                  U5        UR                  X5        U$ )N
product_idr_   r   rQ   r,   r+   )	r   parse_ws_trader   r   safe_integerr1   r   r[   resolve)
r5   r   messager   trader_   rV   rb   tradesArrayr,   s
             r7   handle_tradecoinbaseexchange.handle_tradeU  s     ##G\:''0E8_F D*x/K//$++v>K""//mTR(5&1F#u%NN;4r9   c                 $   U R                  US5      nUbz  U R                  U5      nSnUS-   U-   nU R                  nUc.  U R                  U R                  SS5      n[        U5      nXpl        UR                  U5        UR                  Xv5        U$ )Nr   r   rQ   r.   r+   )r   r   r   r   r1   r   r[   r   )	r5   r   r   r   r   rV   rb   r   r   s	            r7   handle_my_trade coinbaseexchange.handle_my_tradev  s    ##G\:''0ED*x/K--K"))$,,N4U; +u%NN;4r9   c                   > [         [        U ]  U5      nS nSnSU;   a  SnSUS'   U R                  US5      nO4SUS'   U R                  US5      nUS   nU R	                  S	S
S.Xf5      US'   U(       a  SOSnU R	                  X5      US'   U R                  US   5      nUS   nS n	US   b  Ub  U R                  US5      n
X-  n	UU	US.US'   U$ )NFmaker_fee_rateTmakertakerOrMakertakertaker_fee_ratesidesellbuy)r   r   maker_order_idtaker_order_idorderr_   quotecost)rater   currencyfee)r3   r   parse_tradesafe_numberr   rZ   )r5   r   rZ   parsedfeeRateisMakercurrentSideidKeyfeeCurrencyfeeCostr   r6   s              r7   r   coinbaseexchange.parse_ws_trade  s   f ':5Au$G%,F>"&&u.>?G%,F>"&&u.>?G !.K!--/ )F6N %, 1A**58wVH-.Wo6N&W-@##FF3DnG#
u
 r9   c                 0    SSS.nU R                  X!S5      $ )Nclosedcanceled)filledr   open)r   )r5   statusstatusess      r7   parse_ws_order_status&coinbaseexchange.parse_ws_order_status  s$    "
 &99r9   c                    U R                   nUc.  U R                  U R                  SS5      n[        U5      nX0l         U R	                  US5      nU R	                  US5      nUGb  SU-   nU R                  U5      nU R	                  US5      n	U R	                  US5      n
U R	                  US5      nU R                   nU R                  UR                  U0 5      nU R                  X5      nUc  U R                  XU5      nUc4  U R                  U5      nUR                  U5        UR                  X5        g U R                  US	5      nU R                  US
0 5      nU R                  US	5      nUb  UU:  Ga  US:X  Ga6  U R                  U5      nUS   c  / US'   US   R                  U5        US   US'   SnSnUS   n[        S[        U5      5       H2  nUU   nU R                  UUS   5      nU R                  UUS   5      nM4     US:  a  UU-  US'   UUS'   US   b$  US==   US   -  ss'   US   b  US   US   -
  US'   US   c  SUS   S   S.US'   US   S   b-  US   S   b$  U R                  US   S   US   S   5      US   S'   UR                  U5        UR                  X5        g US:X  d  US:X  a  U R!                  US
   U5      nU R                  U5      n[#        UR%                  5       5      n[        S[        U5      5       H  nUU   nUU   c  M  UU   UU'   M     UR                  U5        UR                  X5        g g g g )Nr-   r+   rV   r   zorders:order_idr   r   sequenceinfomatchr   r=   lastTradeTimestampr   r   amountaverager   	remainingr   r   )r   r   receiveddone)r   r   r1   r   r   safe_symbolr   hashmapsafe_value_2parse_ws_orderr[   r   r   ri   rj   sumr\   listkeys)r5   r   r   currentOrdersr   rV   r   rb   r_   orderIdmakerOrderIdtakerOrderIdr   previousOrderspreviousOrderr   r   previousInfopreviousSequencer   	totalCosttotalAmountr   rn   
tradeEntryr   r   r   r>   s                                r7   handle_ordercoinbaseexchange.handle_order  s   ^  %%dllM4HE259M'K0##G\:#h.K%%h/F&&w
;G++G5EFL++G5EFL[[F!__V^^VRHN OONDM$ $ 1 1.P\ ]$,,W5f%v3,,WjA#}fbI#'#4#4\:#N $,(=M2Mw $ 3 3G <(2:68M(3%h/66u=>CK>P&:;$%	&'!.x!8!&q#f+!6A)/J(,Jv<N(OI*.((;
8@T*UK "7 '?7@;7NM)409f-(2>)(3uXF3,X6B=J8=TWdemWn=nk :(/7(),1%L,D4M%0 *%08D5QV<X^K_Kk;?88MRWDXY_D`bghmbnoubv;wM%08m4v;*,$&.#{{=+@'J $ 3 3D 9#EJJL1!&q#d)!4A"&q'C$Sz55:3Zc 2 "5
 m4v; 3A? 3N'  r9   c           	         U R                  US5      nU R                  US5      nU R                  US5      nU R                  U5      nU R                  US5      nU R                  US5      nU R                  USS5      n	U R                  US5      n
U R	                  U
5      nU R                  US	5      nU R                  U5      nU R                  US
5      nU R                  US5      nU R                  US5      nS nU	b  Ub  X-
  nOUS:X  a
  SnU	b  U	U-
  nU R                  0 SU_SU_SU_SU_SU_SU R                  U5      _SS _SU_SS _SS _SU_SU_SS _SS _SU	_SS _SS _UUUS S S.E5      $ )Nr   
client_oidr   r   pricesizefundstimereason
order_typeremaining_sizerV   r   r   r   r_   rR   clientOrderIdr=   datetimer   timeInForcepostOnly	stopPricetriggerPricer   r   r   )r   r   r   r   r   )r   r   r   safe_number_2	parse8601r   
safe_orderiso8601)r5   r   rZ   rR   r  r   r_   r   r   r   r  r=   r  r   	orderTyper   rV   r   s                     r7   r   coinbaseexchange.parse_ws_ordert  s*   eZ0((=##E<8!!(+v.  0##E67;v.NN4(	!!%2++F3$$UL9	$$U,<=	v.Y%:'FZF!"VO	  
E 
f 
 " 
 ]	 

  
 Y/ 
 !$ 
 I 
 4 
  
 D 
 U 
  
 D 
 f 
  D! 
" t# 
$ "- 
  	r9   c                     U R                  US5      nUbP  U R                  U5      nUS   nX@R                  U'   SU-   nSU-   nUR                  XF5        UR                  XG5        U$ )Nr   r_   zticker:)r   parse_tickerrx   r   )r5   r   r   r   rr   r_   rb   idMessageHashs           r7   handle_tickercoinbaseexchange.handle_ticker  ss    ( ##G\:&&w/FH%F#)LL #f,K%0MNN6/NN61r9   c                   > U R                  US5      nUc  [        [        U ]  X5      $ U R                  US5      nU R	                  XBS5      nU R                  U R                  US5      5      nU R                  US5      nU R                  0 SU_SU_SU R                  U5      _S	U R                  US
5      _SU R                  US5      _SU R                  US5      _SU R                  US5      _SU R                  US5      _SU R                  US5      _SS _SU R                  US5      _SU_SU_SS _SS _SS _SS _U R                  US5      S US.E5      $ ) NrV   r   -r  r   r_   r=   r  highhigh_24hlowlow_24hbidbest_bid	bidVolumebest_bid_sizeaskbest_ask	askVolumebest_ask_sizevwapr   open_24hcloselastpreviousClosechange
percentager   
volume_24h)
baseVolumequoteVolumer   )r   r3   r   r  r   r  safe_tickerr  )	r5   rr   rZ   rV   r   r_   r=   r'  r6   s	           r7   r  coinbaseexchange.parse_ticker  s   , /<)4=fMM##FL9!!(C8NN4#3#3FF#CD	0 !
f!
!
 Y/!
 D$$VZ8	!

 4##FI6!
 4##FJ7!
 ))&/B!
 4##FJ7!
 ))&/B!
 D!
 D$$VZ8!
 T!
 D!
 T!
 d!
  $!!
" t#!
$ **6<@)!
  	r9   c                 n    U R                  US5      nU R                  US5      nUR                  X45        g )Nr      )r   store)r5   booksidedeltar   r   s        r7   handle_deltacoinbaseexchange.handle_delta  s2      *!!%+u%r9   c                 d    [        S[        U5      5       H  nU R                  XU   5        M     g )Nr   )ri   rj   r5  )r5   r3  deltasrn   s       r7   handle_deltascoinbaseexchange.handle_deltas  s)    q#f+&Ahq	2 'r9   c                    U R                  US5      nU R                  US5      nU R                  US S5      nUS   nSnUS-   U-   nU R                  UR                  U0 5      n	U R	                  U	S5      n
US:X  a  U R                  0 U
5      U R                  U'   U R                  U   nU R                  US	   U R                  US	/ 5      5        U R                  US
   U R                  US
/ 5      5        S US'   S US'   XkS'   UR                  X5        g US:X  a  U R                  U   nU R                  U R                  US5      5      nU R                  US/ 5      nS	S
S.n[        S[        U5      5       Hf  nX   nU R                  US5      nU R                  UU5      nU R                  US5      nU R                  US5      nUU   nUR                  UU5        Mh     XS'   U R                  U5      US'   UR                  X5        g g )NrV   r   r  r_   r   rQ   r   snapshotasksbidsr=   r  l2updater  changes)r   r   r   r1     )r   safe_marketr   subscriptionsr   
order_book
orderbooksr9  r   r  ri   rj   r   r2  r  )r5   r   r   rV   r   rZ   r_   r^   rb   r   r   r   r=   r@  sidesrn   r)  r>   r   r   r   r3  s                         r7   handle_order_book"coinbaseexchange.handle_order_book  s   4 0##G\:!!(D#6!Sj8+v';';["M!!,8:&*oob%&@DOOF#/Iy0$//'6SU2VWy0$//'6SU2VW%)Ik"$(Ij!"(hNN92Z/It'7'7'HIIoogy"=GE 1c'l+ &&vq1''s3((3))&!4$T?uf- , &/k"$(LL$;Ij!NN92%  r9   c                     U$ N )r5   r   r   s      r7   handle_subscription_status+coinbaseexchange.handle_subscription_status>  s	     r9   c                     U R                  US5      nU R                  US5      n US:X  a  [        SU-   5      e[        U R                  S-   U-   5      e! [         a  nUR                  U5         S nAgS nAff = f)Nr   r  zAuthentication FailedzAuthentication failed:  T)r   r   r   rR   	Exceptionreject)r5   r   r   errMsgr  errors         r7   handle_error_message%coinbaseexchange.handle_error_messageL  s~      !!'95!!'84	00)*Cf*LMM#DGGcMF$:;; 	MM% 	s   /A 
A:A55A:c           
         U R                  US5      nU R                  U R                  U R                  U R                  U R                  U R                  U R                  U R                  U R
                  S.	n[        UR                  5      S-
  nUR                  US-
     S:H  nU R                  XC5      nUcC  US:X  a<  U(       a#  U R                  X5        U R	                  X5        g U R                  X5        g g U" X5        g )NrV   )	r<  r?  rT   rr   r   r   r)  r   rS  r   r1  rS   r   )r   rG  rL  r  r   rT  rj   rd   r   r   r   )r5   r   r   rV   methodslengthauthenticatedmethods           r7   handle_messagecoinbaseexchange.handle_messageg  s    0....88(())%%''%%..

 VZZ1$

6A:.#5/>w ((9%%f6%%f6  6#r9   )r   r   rJ  )/__name__
__module____qualname____firstlineno__r   r4   rN   rT   ro   rC   r   rs   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  r5  r9  rG  rL  r   rT  r[  __static_attributes____classcell__)r6   s   @r7   r   r      s   # B
 ,0$r H. 68$WY U2 68 @ @F @ 6:" E7 E E* <@d[] S SS S Sbfglbm S" OSaenp Sd3i S S[^ Suyz  vA S, 37TX\eg SC Ss SRU Slpqvlw S* RVdhqs Sc S3 S^a Sx|  ~C  yD S* OSaenp Sd3i S S[^ Suyz  vA S* 04$UYbd S SC Ss Simnsit S* SW_a $!$s) $!C $!fo $!L @DB  !S  !  !S\  !D6 Bf Qf:S<6 S<j-^F >26 2 2h&
3=3 =3~ 6 t 6$V $ $r9   r   )ccxt.async_supportccxt ccxt.async_support.base.ws.cacher   r   rH   ccxt.base.typesr   r   r   r   r	   r
   r   r   r   r   !ccxt.async_support.base.ws.clientr   typingr   ccxt.base.errorsr   r   r   r   r   async_supportr   rK  r9   r7   <module>rk     sH     O  b b b 4  * 0 . ' &l$t)):: l$r9   