
    ei                         d dl Zd dlmZmZmZ d dlZd dlmZm	Z	m
Z
mZmZmZmZmZ d dlmZ d dlmZ d dlmZ d dlmZ  G d d	ej        j                  ZdS )
    N)
ArrayCacheArrayCacheBySymbolByIdArrayCacheByTimestamp)AnyBalancesBoolIntOrder	OrderBookStrTrade)Client)List)AuthenticationError)NetworkErrorc                        e Zd Zdef fdZi fdZi fdZi fdZdddi fded	ed
e	de	de
e         f
dZdefdZddi fded
e	de	de
e         fdZddi fde
e         d
e	de	de
e         fdZdefdZdi fdede	defdZdi fdede	fdZdi fdede	fdZdefdZdefdZd Zd ZdefdZi fdefdZdefdZdddi fded
e	de	de
e          fdZ!defdZ"d(dZ#dede$fd Z%defd!Z&defd"Z'defd#Z(defd$Z)d% Z*defd&Z+i fd'Z, xZ-S ))ascendexreturnc                     |                      t          t          |                                           dddddddddddddiddd	did
ddddddddd          S )NTF)wswatchBalance
watchOHLCVwatchOrderBookwatchOrderswatchTickerwatchTradeswatchTradesForSymbolsr   z(wss://ascendex.com:443/api/pro/v2/streamz7wss://ascendex.com:443/{accountGroup}/api/pro/v2/stream)publicprivatez9wss://api-test.ascendex-sandbox.com:443/api/pro/v2/streamzHwss://api-test.ascendex-sandbox.com:443/{accountGroup}/api/pro/v2/stream)apitest  spotswapmargin)cashfuturesr%   )tradesLimitordersLimit
OHLCVLimitcategoriesAccount)hasurlsoptions)deep_extendsuperr   describe)self	__class__s    O/var/www/html/volatility/venv/lib/python3.11/site-packages/ccxt/pro/ascendex.pyr1   zascendex.describe   s    h 5 5 > > @ @ $""&#$#)-	 	 "L#\  "]#m    $#""%&& &		 	3#C
 #C
 # # #	    c                    K   | j         d         d         d         }|                                 }t          |          dd}|                     ||          }|                     ||||           d {V S Nr    r   r   sub)idop)r-   noncestrextendwatch)r2   messageHashparamsurlr9   requestmessages          r4   watch_publiczascendex.watch_public8   s      it$X.ZZ\\b''
 
 ++gv..ZZ[';GGGGGGGGGr5   c                    K   | j         d         d         d         }|                                 }t          |          dd}|                     ||          }|                     ||||           d {V S r7   )r-   r;   r<   r=   watch_multiple)r2   messageHashesr@   rA   r9   rB   rC   s          r4   watch_public_multiplezascendex.watch_public_multipleB   s      it$X.ZZ\\b''
 
 ++gv..((mWmTTTTTTTTTr5   c                   K   |                                   d {V  |                     | j        d          }| j        d         d         d         }|                     |d|i          }|                                 }t          |          d|d}|                     ||          }|                     ||           d {V  | 	                    ||||           d {V S )Nzaccount-groupr    r   r   accountGroupr8   )r9   r:   ch)
load_accountssafe_stringr.   r-   implode_paramsr;   r<   r=   authenticater>   )	r2   channelr?   r@   rJ   rA   r9   rB   rC   s	            r4   watch_privatezascendex.watch_privateL   s        """""""""''oFFit$Y/!!#'EFFZZ\\b''
 

 ++gv..V,,,,,,,,,ZZ['7CCCCCCCCCr5   1mNsymbol	timeframesincelimitc                   K   |                                   d{V  |                     |          }|d         }||dk    rd}|                     | j        ||          }d|z   dz   |d         z   }d|i}|                     ||           d{V }	| j        r|	                    ||          }|                     |	||d	d
          S )a  
        watches historical candlestick data containing the open, high, low, and close price, and the volume of a market

        https://ascendex.github.io/ascendex-pro-api/#channel-bar-data

        :param str symbol: unified symbol of the market to fetch OHLCV data for
        :param str timeframe: the length of time each candle represents
        :param int [since]: timestamp in ms of the earliest candle to fetch
        :param int [limit]: the maximum amount of candles to fetch
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns int[][]: A list of candles ordered, open, high, low, close, volume
        NrS   i  d   zbar::r9   rK   r   T)load_marketsmarketrM   
timeframesrD   
newUpdatesgetLimitfilter_by_since_limit)
r2   rS   rT   rU   rV   r@   r[   intervalrP   ohlcvs
             r4   watch_ohlcvzascendex.watch_ohlcv[   s       !!!!!!!!!V$$!Mut||E##DOY	JJ(3.='
 ''88888888? 	2NN6511E))%q$GGGr5   clientc                    |                      |d          }|                     |          }|                      |d          }|                     |di           }|                      |d          }|dz   |z   dz   |z   }|                     |          }	|                     |          }
|                     ||
          }|                     | j        |i           | j        |<   |                     | j        |         |	          }|;|                     | j        dd          }t          |          }|| j        |         |	<   |
                    |           |                    ||           |S )NsmdatairY   r*   r"   )rM   safe_symbol
safe_valuefind_timeframer[   parse_ohlcvohlcvssafe_integerr.   r   appendresolve)r2   rc   rC   marketIdrS   rP   rg   r`   r?   rT   r[   parsedstoredrV   s                 r4   handle_ohlcvzascendex.handle_ohlcvw   s[     ##GS11!!(++""7C00w33##D#..mh.4x?''11	V$$!!'622"oodk62FFFV!4i@@>%%dlL$GGE*511F-3DK	*fv{+++r5   c                 D   K   |                      |g|||           d{V S )a'  
        get the list of most recent trades for a particular symbol

        https://ascendex.github.io/ascendex-pro-api/#channel-market-trades

        :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)watch_trades_for_symbols)r2   rS   rU   rV   r@   s        r4   watch_tradeszascendex.watch_trades   s6       22F8UE6RRRRRRRRRr5   symbolsc                   K   |                                   d{V  |                     |dddd          }g }g }|tt          dt          |                    D ]V}|                     ||                   }|                    |d                    |                    d|d         z              Wdd                    |          z   }	|                     |d|	i          }|                     ||           d{V }
| j	        rB| 
                    |
d          }|                     |d	          }|
                    ||          }|                     |
||d
d          S )a  
        get the list of most recent trades for a list of symbols

        https://ascendex.github.io/ascendex-pro-api/#channel-market-trades

        :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
        :param str [params.name]: the name of the method to call, 'trade' or 'aggTrade', default is 'trade'
        :returns dict[]: a list of `trade structures <https://docs.ccxt.com/?id=public-trades>`
        NFTr   r9   ztrades:,rK   rS   	timestamp)rZ   market_symbolsrangelenr[   ro   joinr=   rH   r]   rj   rM   r^   r_   )r2   rx   rU   rV   r@   	marketIdsrG   rh   r[   rP   tradesfirsttradeSymbols                r4   rv   z!ascendex.watch_trades_for_symbols   s      !!!!!!!!!%%gtUD$GG	1c'll++ ? ?WQZ00  ...$$Y%=>>>>chhy111V'&
   11-HHHHHHHH? 	8OOFA..E**5(;;KOOK77E))&%TRRRr5   c                 h   |                      |d          }|                     |          }|                      |d          }|dz   |z   }|                     |          }|                     |d          }|g }|                     ||          }	|                     | j        |          }
|
+|                     | j        dd          }t          |          }
t          dt          |	                    D ]}|
                    |	|                    |
| j        |<   |                    |
|           d S )NrS   rf   rY   rg   r(   r"   r   )rM   ri   r[   rj   parse_tradesr   rn   r.   r   r}   r~   ro   rp   )r2   rc   rC   rq   rS   rP   r?   r[   rawDatar   tradesArrayrV   rh   s                r4   handle_tradeszascendex.handle_trades   s3     ##GX66!!(++""7C00mh.V$$//'622?G""7F33oodk6::%%dlM4HHE$U++Kq#f++&& 	* 	*Avay)))))F{K00000r5   c                 
  K   |                                   d{V  |                     |          }d|d         z   }|                     |d|i          }|                     ||           d{V }|                                S )aK  
        watches information on open orders with bid(buy) and ask(sell) prices, volumes and other data

        https://ascendex.github.io/ascendex-pro-api/#channel-level-2-order-book-updates

        :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
        Nzdepth:r9   rK   rZ   r[   r=   rD   rV   )r2   rS   rV   r@   r[   rP   	orderbooks          r4   watch_order_bookzascendex.watch_order_book   s       !!!!!!!!!V$$&,.V'&
   ++GV<<<<<<<<	   r5   c                 (  K   |                                   d {V  |                     |          }d}|dz   |d         z   }|                     ||d|d         idd          }|                     ||           d {V }|                                S )Ndepth-snapshotrY   r9   rS   req)actionargsr:   r   )r2   rS   rV   r@   r[   r   rP   r   s           r4   watch_order_book_snapshotz"ascendex.watch_order_book_snapshot   s      !!!!!!!!!V$$!3,-V&, &
 &
   ++GV<<<<<<<<	   r5   c                    K   |                      |||           d {V }|| j        vr|                                 | j        |<   | j        |         }|                    |           |S N)fetch_rest_order_book_safe
orderbooks
order_bookreset)r2   rS   rV   r@   restOrderBookr   s         r4    fetch_order_book_snapshot_customz)ascendex.fetch_order_book_snapshot_custom  sv      "==feVTTTTTTTT$/))&*oo&7&7DOF#OF+	&&&r5   c                 2   |                      |d          }|                     |          }|                      |d          }|dz   |z   }| j        |         }|                     |d          }|                     ||          }	|                     |d          |	d<   |                    |	           |j        }
t          dt          |
                    D ]!}|
|         }| 
                    |||           "|| j        |<   |                    ||           d S )NrS   rf   rY   rg   seqnumr;   r   )rM   ri   r   rj   parse_order_bookrn   r   cacher}   r~   handle_order_book_messagerp   )r2   rc   rC   rq   rS   rP   r?   r   rg   snapshotmessagesrh   messageItems                r4   handle_order_book_snapshotz#ascendex.handle_order_book_snapshot  s!   & ##GX66!!(++""7C00mf,OF+	w//((v66 --dH==!!!?q#h--(( 	K 	KA"1+K**6;	JJJJ"+y+.....r5   c                    |                      |d          }|                      |d          }|                     |          }|dz   |z   }|| j        vr|                     i           | j        |<   | j        |         }|d         |j                            |           d S |                     |||           |                    ||           d S )Nrf   rS   rY   r;   )rM   ri   r   r   r   ro   r   rp   )r2   rc   rC   rP   rq   rS   r?   r   s           r4   handle_order_bookzascendex.handle_order_book:  s     ""7C00##GX66!!(++mh.$/))&*oob&9&9DOF#OF+	W%O""7+++++**67IFFFNN9k22222r5   c                     |                      |d          }|                      |d          }|                    ||           d S )Nr      )
safe_floatstore)r2   booksidedeltapriceamounts        r4   handle_deltazascendex.handle_deltaT  sD     q))**uf%%%%%r5   c                 ~    t          dt          |                    D ]}|                     |||                    d S )Nr   )r}   r~   r   )r2   r   deltasrh   s       r4   handle_deltaszascendex.handle_deltas\  sH    q#f++&& 	3 	3Ahq	2222	3 	3r5   c                    |                      |di           }|                     |d          }||d         k    r|                      |dg           }|                      |dg           }|                     |d         |           |                     |d         |           ||d<   |                     |d          }||d<   |                     |          |d<   |S )	Nrg   r   r;   asksbidstsr{   datetime)rj   rn   r   iso8601)	r2   rc   rC   r   rg   seqNumr   r   r{   s	            r4   r   z"ascendex.handle_order_book_message`  s    ( w33""422Ig&&&??444D??444Dy0$777y0$777!'Ig))$55I%.Ik"$(LL$;$;Ij!r5   c                 t  K   |                                   d{V  |                     dd|          \  }}d}d}|dk    s|dk    rR|                     | j        di           }|                     ||d          }|                                }d|z   }d|z   }nd	}d
}|                     |||           d{V S )al  
        watch balance and get the amount of funds available for trading or funds locked in orders

        https://ascendex.github.io/ascendex-pro-api/#channel-order-and-balance

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `balance structure <https://docs.ccxt.com/?id=balance-structure>`
        Nr   r#   r%   accountCategoriesr&   order:balance:futures-account-updatezbalance:swap)rZ   handle_market_type_and_paramsrj   r.   rM   upperrQ   )r2   r@   typequeryrP   r?   r   accountCategorys           r4   watch_balancezascendex.watch_balance  s       !!!!!!!!!88vVVeFNN 0 0 $>QSU V V"../@$OOO-3355O0G$t+KK.G(K''eDDDDDDDDDr5   c                 |   |                      |d          }d }d }|dk    s|dk    r0|                     |d          }|                      |d          }|                     |          }|                                 }	|                      |d          |	d<   |                      |d          |	d	<   |                                 }
|                      |d
          |
d<   |                      |d          |
d	<   |d         rd}|                     | j        |i           }n$|d         }|                     | j        |i           }|	||d         <   |
||d         <   n6|                     |dd          }|                     | j        d          }|                      ||d          }|                     | j        |i           }|                     |d          }d }||                     |d          }n|g}t          dt          |                    D ]}||         }| 	                    |                      |d                    }|                                 }|                      |d          |d<   | 
                    |dd          |d	<   |||<   d|z   }|                    |                     |          |           d S )Nrf   orderfutures-orderrg   re   babfreebtbtotalqabqtbcontractr$   r   basequoteacatr+   r#   colr   aabtbbr   )rM   rj   safe_marketaccountbalancesafe_string_lower_2r.   r}   r~   safe_currency_codesafe_string_2rp   safe_balance)r2   rc   rC   rP   resultr   rg   rq   r[   baseAccountquoteAccountaccountTypecategoriesAccountsbalancesrh   r   coder   r?   s                      r4   handle_balancezascendex.handle_balance  s   d ""7C00wG$>$>??7F33D''c22H%%h//F,,..K"&"2"24"?"?K#'#3#3D%#@#@K <<>>L#'#3#3D%#@#@L $($4$4T5$A$AL!j! AtR@@f~tR@@%0F6&>"&2F6'?##227D$GGK!%?R!S!S##$6VLLD__T\4<<F??7F33DH|??7E:: 61c(mm,, ' '"1+..t/?/?/M/MNN,,.."&"2"27D"A"A#'#5#5gtS#I#I &t%,t((00+>>>>>r5   c                 0  K   |                                   d{V  d}||                     |          }|d         }|                     d||          \  }}d}d}	|dk    r|dk    rd}	d}nN|                     | j        di           }
|                     |
|d	          }|                                }d
|z   }|}	||dz   |z   }|                     |	||           d{V }| j        r|	                    ||          }| 
                    ||||d          S )a;  

        https://ascendex.github.io/ascendex-pro-api/#channel-order-and-balance

        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>`
        NrS   r   r#   r%   r   zorder:FUTURESr   r&   r   rY   T)rZ   r[   r   rj   r.   rM   r   rQ   r]   r^   filter_by_symbol_since_limit)r2   rS   rU   rV   r@   r[   r   r   r?   rP   r   r   orderss                r4   watch_orderszascendex.watch_orders  s`      !!!!!!!!![[((FH%F88PVWWe6>>dh..%G)KK $>QSU V V"../@$OOO-3355O'/9K!G%+f4K))';FFFFFFFF? 	3OOFE22E00tTTTr5   c                    |                      |d          }d|z   }|                     |d|          }|                     |          }| j        0|                     | j        dd          }t          |          | _        | j        }|                    |           |dz   |d         z   }	|                    ||	           |                    ||           d S )Nr   r   rg   r)   r"   rY   rS   )	rM   rj   parse_ws_orderr   rn   r.   r   ro   rp   )
r2   rc   rC   r   r?   rg   r   rV   r   symbolMessageHashs
             r4   handle_orderzascendex.handle_order  s    T &&w55,w88##D));%%dlM4HHE077DKe'#-h?v0111v{+++++r5   c           	         |                      |                     |d                    }|                     |d          }|                     |d          }|                     ||d          }|                     |d          }|                     |d          }|                     |d          }	|                     |d          }
|                     |d          }|                     |d	          }|                     |d
          }|                     |d          }|                     |d          }d }|0|                     |d          }|                     |          }||d}|                     |                     |                     |d                              }| 	                    i d|d|dd d|d| 
                    |          d|d|d|dd dd d|d|d|d|d|	dd d |
|d ||d d!|          S )"Nstre   t/pqapcfqorderIdotsdcffa)costcurrencyspinfor9   clientOrderIdr{   r   lastTradeTimestamprS   r   timeInForcepostOnlysider   	stopPricetriggerPricer   r   average)filled	remainingstatusfeer   )parse_order_statusrM   rn   ri   safe_string_lowersafe_numberr   parse_number	omit_zero
safe_orderr   )r2   r   r[   r	  rq   r{   rS   r   r   r   r  r  r9   r   r  feeCostr
  feeCurrencyIdfeeCurrencyCoder  s                       r4   r   zascendex.parse_ws_orderP  s   v (()9)9%)F)FGG##E3//%%eS11	!!(FC88!..uc::  ,,!!%--""5$//!!%//eY//%%eT22%%eT22""5$// ,,UD99M"55mDDO+ C %%dnnT5E5EeT5R5R&S&STT	  
E 
" 
 T 
 	 

 Y// 
 !"4 
 f 
 D 
 4 
  
 D 
 U 
  
 I 
 f 
  D! 
" w# 
$ - 
  
  
. /  	r5   c                    |                      |d          }	 ||| j        dz   |                     |          z   }|                     | j        d         ||           |                     |d          }|"|                     | j        d         ||           dS # t          $ r_}t          |t                    r*d}|
                    ||           ||j        v r|j        |= n|
                    |           Y d }~dS d }~ww xY w)	Nr    exactrC   broadFauthenticatedT)rn   r9   jsonthrow_exactly_matched_exception
exceptionsrj   throw_broadly_matched_exception	Exception
isinstancer   rejectsubscriptions)r2   rc   rC   	errorCodefeedbackmessageStringer?   s           r4   handle_error_messagezascendex.handle_error_message  s#    %%gv66		$7S=499W+=+==44T_W5MyZbccc $ C C ,889QS`bjkkk5 	 	 	!011 !-a---&"666,[9a   44444	s   A>B 
D"AC<<Dc                 6    d}|                     ||           d S )Nr  )rp   )r2   rc   rC   r?   s       r4   handle_authenticatezascendex.handle_authenticate  s#     &w,,,,,r5   c           
         |                      ||          rd S |                     |d          }| j        | j        | j        | j        | j        | j        | j        | j	        | j	        d	}| 
                    ||          }| |||           |dk    s|dk    r6|                     ||           |dk    r| 	                    ||           d S d S d S )Nrf   )	pingauthr8   depthr   r   barr   r   r   r   )r%  rM   handle_pingr'  handle_subscription_statusr   r   r   rt   r   rj   r   )r2   rc   rC   subjectmethodsmethods         r4   handle_messagezascendex.handle_message  s
   $$VW55 	Fb ""7C00$,2+"=($*&*&9

 

 '22F67###wG$>$> fg...'!!##FG44444 "! %?$>r5   c                     |                      |dd          }|                    d          dk    r/|                    d          dk    s|                     ||           |S )NrK    r+  r   )rM   findhandle_order_book_subscription)r2   rc   rC   rP   s       r4   r.  z#ascendex.handle_subscription_status  se     ""7D"55<<  2%%w||<L/M/MPR/R/R//@@@r5   c                    |                      |d          }|                    d          }|d         }|                     |          }|d         }|| j        v r| j        |= |                     i           | j        |<   | j        d         dk    s|d         r|                     | j        |           d S |                     | j        |           d S )NrK   rY   r   rS   defaultTyper$   r   )	rM   splitr   r   r   r.   spawnr   r   )r2   rc   rC   rP   partsrq   r[   rS   s           r4   r7  z'ascendex.handle_order_book_subscription  s    ""7D11c""8!!(++!T_$$'"&//""5"5<&&00F:4F0JJt<fEEEEEJJt5v>>>>>r5   c                 $  K   	 |                     d|                     |d          d           d {V  d S # t          $ rM}t          | j        dz   |                     |          z             }|                    |           Y d }~d S d }~ww xY w)Nponghp)r:   r?  z handlePing failed with error )sendrn   r  r   r9   exception_messager   )r2   rc   rC   r$  errors        r4   r>  zascendex.pong  s      	 ++V43D3DWd3S3STTUUUUUUUUUUU 	  	  	  +K!KdNdNdefNgNg!ghhELL	 s   28 
BAB

Bc                 >    |                      | j        ||           d S r   )r;  r>  )r2   rc   rC   s      r4   r-  zascendex.handle_ping  s     

49fg.....r5   c                   K   |                                   d}|                     |          }|                     |j        |          }|<t	          |                                           }|                    d          }t          |          }|                     ||dz
            }	|                     ||dz
            }
|dz   |
z   dz   |	z   }| 	                    | j
                  }|                     |                     |          |t          j        d          }dt	          |                                           || j        |d}|                     |||                     ||          |           d {V }||j        |<   |S )	Nr  r   r      +base64r*  )r:   r9   r   keysig)check_required_credentialsrc   rj   r   r<   millisecondsr:  r~   rM   base64_to_binarysecrethmacencodehashlibsha256r;   apiKeyr>   r=   )r2   rA   r@   r?   rc   futurer{   urlPartspartsLengthpathversionr*  rM  	signaturerB   s                  r4   rO   zascendex.authenticate  sy     '')))%S!!!5{CC>D--//00Iyy~~Hh--K##HkAo>>D&&xqAAGs?W,s2T9D**4;77F		$++d"3"3VW^XVVI$**,,''{  G  ::c;GV8T8TVabbbbbbbbF06F -r5   r   ).__name__
__module____qualname__r   r1   rD   rH   rQ   r<   r	   r   listrb   r   rt   r   rw   rv   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r
   r   r   r   r   r%  r'  r2  r.  r7  r>  r-  rO   __classcell__)r3   s   @r4   r   r      s       $# $ $ $ $ $ $L 68 H H H H AC U U U U @B D D D D ?CQUdhqs H H H H3 H^a Hx|  ~B  yC H H H H8!6 ! ! ! !F <@d[] S S SS S Sbfglbm S S S S OSaenp S Sd3i S S[^ Suyz  vA S S S SB 1F  1  1  1  1D @DB ! !S ! !S\ ! ! ! !( IMUW ! !c !# ! ! ! ! PT\^  S     "/ "/ "/ "/ "/H3 3 3 3 34& & &3 3 3    B *, E E E E E E0Z?V Z? Z? Z? Z?x 04$UYbd "U "U "UC "Us "Uimnsit "U "U "U "UH5,6 5, 5, 5, 5,nh h h hT6 t    8-& - - - -h5V h5 h5 h5 h5T	 	 	 	 	?V ? ? ? ?     /& / / / / .0        r5   r   )ccxt.async_supportccxt ccxt.async_support.base.ws.cacher   r   r   rP  ccxt.base.typesr   r   r   r	   r
   r   r   r   !ccxt.async_support.base.ws.clientr   typingr   ccxt.base.errorsr   r   async_supportr    r5   r4   <module>rg     s       f f f f f f f f f f  R R R R R R R R R R R R R R R R R R R R 4 4 4 4 4 4       0 0 0 0 0 0 ) ) ) ) ) )t t t t tt!* t t t t tr5   