
    ix                       d dl mZ d dlmZ d dlZd dlZd dlmZmZm	Z	m
Z
mZmZmZmZ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 d d	lmZ d d
l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e          Z%dS )    )Exchange)ImplicitAPIN)Balances
CurrenciesCurrencyIntMarketNumOrder	OrderBook	OrderSide	OrderTypeStrStringsTickerTickersTradeTransaction)List)ExchangeError)ArgumentsRequired)
BadRequest)InsufficientFunds)InvalidOrder)OrderNotFound)NotSupported)	TICK_SIZE)Precisec                   R    e Zd Z fdZi fdZi fdefdZi fdZd Zi fde	e
         fdZdi fd	ed
edefdZd9de
defdZdi fdedefdZi fd	edefdZdi fd	ed
efdZddi fd	eded
ede	e         fdZd9de
defdZdefdZi fdefdZdi fd	edededede f
dZ!di fded	e"fdZ#di fde	e         d	e"fdZ$d  Z%d9de
de&fd!Z'di fded	e"fd"Z(dddi fd	e"ded
ede	e&         fd#Z)dddi fd	e"ded
ede	e&         fd$Z*dddi fd	e"ded
efd%Z+dddi fd	e"ded
efd&Z,di fd'edefd(Z-dddi fd'e"ded
ede	e.         fd)Z/di fded'e"fd*Z0i fd'efd+Z1i fd'efd,Z2d9d-e3fd.Z4d/ Z5dddi fd'e"ded
ede	e.         fd0Z6di fded'e"fd1Z7d9d-e3de.fd2Z8d3 Z9d4 Z:d5d6i ddfd7Z;d8 Z< xZ=S ):kunac                 h   |                      t          t          |                                           dddg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dddd
dd
d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d%d
d&d
d'd
d(d
d)d
i d*d
d+d
d,d
d-d
d.dd/d
d0d
d1d
d2d
d3dd4d
d5dd6d7d8d
d9d
d:dd;di d<dd=dd>d
d?d
d@d
dAd
dBd
dCd
dDddEddFddGddHd
dId
dJd
dKd
dLd
ddd
d
d
d
d
d
d
d
d
ddMd dNdOdPdQdRdRdSdSdTdSdUdUdVdWdWdWdXdYdWidZi d[dWd\dWd]dWd^dWd_dWd`dWdadWdbdWdcdWdddWdedWdfdWdgdWdhdWdidWdjdWdkdWdWdWdWdldWdWdWdWdWdWdWdmdndWidodpdWdWdWdWdWdWdWdWdqidrdWdWdWdWdWdWdWdWdWdWdWdWdWdWdsdWdWdWdWdWdWdWdWdWdWdt
dZdudWidWdWdWdWdWdWdWdWdWdv	dWdWdwdoi dxdWdydWdzdWd{dWd|dWd}dWd~dWddWddWddWddWddWddWddWddWddWddWi ddWddWddWddWddWddWddWddWddWddWddWddWddWddWddWddWddWi ddWddWddWddWddWddWddWddWddWddWddWddWddWddWddWddWddWi ddWddWddWddWddWddWddWddWddWddWddWddWddWddWddWddWddWddWidWdWddWdWdWdWdWdWddddpg dig d¢g dâdZdĜd
d|                     dŦ          |                     dŦ          dƜdddddddd˜i d̜d͜ddit
          t          t          t          t          t          t          t          t          dМi dќ          S )Nr    KunaUAi  v4CORSspotTmarginFswapfutureoption	addMargincancelOrdercancelOrderscloseAllPositionsclosePositioncreateDepositAddresscreateOrdercreatePostOnlyOrdercreateReduceOnlyOrdercreateStopLimitOrdercreateStopMarketOrdercreateStopOrderfetchBalancefetchBorrowInterestfetchBorrowRateHistoriesfetchBorrowRateHistoryfetchClosedOrdersfetchCrossBorrowRatefetchCrossBorrowRatesfetchCurrenciesfetchDepositfetchDepositAddressfetchDepositsfetchDepositsWithdrawalsfetchFundingHistoryfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchIndexOHLCVfetchIsolatedBorrowRatefetchIsolatedBorrowRatesfetchIsolatedPositionsfetchL3OrderBookfetchLeveragefetchLeverageTiersfetchMarginModefetchMarketLeverageTiersfetchMarketsfetchMarkOHLCVfetchMyTrades
fetchOHLCVemulatedfetchOpenInterestfetchOpenInterestHistoryfetchOpenOrders
fetchOrderfetchOrderBookfetchOrdersByStatusfetchPositionfetchPositionModefetchPositionsfetchPositionsForSymbolfetchPositionsRiskfetchPremiumIndexOHLCVfetchTickerfetchTickers	fetchTimefetchTradesfetchTradingFeefetchTradingFeesfetchTransactionsfetchTransfersfetchWithdrawAddresses)fetchWithdrawalfetchWithdrawalsreduceMarginrepayCrossMarginrepayIsolatedMarginsetLeverage	setMarginsetMarginModesetPositionModesignIntransferwithdrawz.jsonz%https://kuna.io?r=kunaid-gvfihe8az7o4zdhttps://user-images.githubusercontent.com/51840849/87153927-f0578b80-c2c0-11ea-84b6-74612568e9e1.jpgzhttps://api.xreserve.fundzhttps://api.kuna.iozhttps://kuna.io)xreservev3r$   publicprivatezhttps://kuna.io/documents/api)	extensionreferrallogoapiwwwdocfees   )noncefeezdelegated-transactionszdelegate-transfer)getpostz
private/mezprivate/getBalancezorder/private/activezorder/private/historyzorder/private/{id}/tradeszorder/private/details/{id}ztrade/private/historyztransaction/private/{hash}zdeposit/private/preRequestzdeposit/private/crypto/addressz)deposit/private/crypto/getMerchantAddresszdeposit/private/historyz#deposit/private/details/{depositId}zwithdraw/private/preRequestzwithdraw/private/historyz%withdraw/private/details/{withdrawId}zkuna-code/{id})zkuna-code/{code}/checkzkuna-code/issued-by-mezkuna-code/redeemed-by-me)zorder/private/createzorder/private/cancelzorder/private/cancel/multiz&deposit/private/crypto/generateAddressz.deposit/private/crypto/generateMerchantAddresszwithdraw/private/createz	kuna-codezkuna-code/redeem)r   r   putr   )zpublic/timestampzpublic/feeszpublic/currencies?type={type}zpublic/currencieszmarkets/public/getAllz$markets/public/tickers?pairs={pairs}zorder/public/book/{pairs}ztrade/public/book/{pairs})ry   rx   )	timestamp
currenciesmarketstickersktrades_historyr   zexchange-rateszexchange-rates/currencyzbook/marketzkuna_codes/code/checklanding_page_statisticztranslations/localeztrades/market/hist)
	http_testdeposit_channelswithdraw_channelssubscription_planssend_toconfirm_tokenkunaidzwithdraw/prerequestzdeposit/prerequestzdeposit/exchange-ratesreset_password/token)	zsignup/googlezsignup/resend_confirmationsignupsigninzsignin/two_factorzsignin/resend_confirm_devicezsignin/confirm_devicereset_passwordzcool-signin)r   zsignup/code/confirmzauth/w/order/submitzauth/r/orderszauth/r/orders/marketzauth/r/orders/marketszauth/api_tokens/deletezauth/api_tokens/createzauth/api_tokenszauth/signin_history/uniqzauth/signin_historyz"auth/disable_withdraw_confirmationzauth/change_passwordzauth/deposit_addresszauth/announcements/acceptzauth/announcements/unacceptedzauth/otp/deactivatezauth/otp/activatezauth/otp/secretz$auth/r/order/market/:order_id/tradeszauth/r/orders/market/histzauth/r/orders/histzauth/r/orders/hist/marketszauth/r/orders/detailszauth/assets-historyzauth/assets-history/withdrawszauth/assets-history/depositszauth/r/walletsauth/markets/favoriteszauth/markets/favorites/listzauth/me/updatezauth/meauth/fund_sourceszauth/fund_sources/listz!auth/withdraw/resend_confirmationzauth/withdrawzauth/withdraw/detailszauth/withdraw/infozauth/payment_addresseszauth/deposit/prerequestzauth/deposit/exchange-rateszauth/depositzauth/deposit/detailszauth/deposit/infozauth/kuna_codes/countzauth/kuna_codes/detailszauth/kuna_codes/editzauth/kuna_codes/send-pdfzauth/kuna_codeszauth/kuna_codes/redeemed-by-mezauth/kuna_codes/issued-by-mezauth/payment_requests/invoicezauth/payment_requests/typez%auth/referral_program/weekly_earningszauth/referral_program/statszauth/merchant/payout_serviceszauth/merchant/withdrawzauth/merchant/payment_serviceszauth/merchant/depositzauth/verification/auth_tokenzauth/kunaid_purchase/createauth/devices/listauth/sessions/listzauth/subscriptions/reactivatezauth/subscriptions/cancelzauth/subscriptions/prolongzauth/subscriptions/createzauth/subscriptions/listzauth/kuna_ids/listzorder/cancel/multizorder/cancel)zauth/fund_sources/idzauth/kuna_codes/redeem)r   r   zauth/devicesr   r   zauth/sessions)r   r   delete)rx   signry   )depthk_with_pending_tradesr   r   
order_bookzorder_book/{market}r   ztickers/{market}r   tradesztrades/{market})	z
members/medepositsdepositdeposit_addressordersorderz	trades/my	withdrawsru   )r   zorders/multizorders/clearzorder/deleteru   )rv   r$   rw   rx   ry   z0.0025)	tierBased
percentagetakermakerz1%gMbP?g{Gz?g        )UAHBTCBCHETHWAVESGOLGBG)ru   r   )tradingfundingPLAPlair)ARGUMENT_VALIDATION_ERRORPAYMENT_METHOD_NOT_SUPPORTED	NOT_FOUNDzINVALID:ORDER_SIZEWrongRequestExceptionINSUFFICIENT_FUNDS20022003)idname	countries	rateLimitversionhas
timeframesurlsr}   r   commonCurrenciesprecisionMode
exceptionsoptions)
deep_extendsuperr    describeparse_numberr   r   r   r   r   )self	__class__s    ]/var/www/html/crypto-bot/backend/venv/lib/python3.11/site-packages/ccxt/async_support/kuna.pyr   zkuna.describe   s-   dD 1 1 : : < <QQQ %Q 	Q
 %Q %Q UQ tQ Q $UQ  Q 'Q tQ &uQ (Q  '!Q" (#Q Q$ "4%Q& 'Q( &u)Q* +E+Q, )%-Q. $T/Q0 '1Q2 (3Q4 "45Q6 7Q8 &t9Q:  ;Q< +E=Q> &u?Q@ #EAQB *5CQD $UEQ Q QF "5GQH *5IQJ +EKQL )%MQN #DOQP  QQR %eSQT "5UQV +EWQX YQZ !%[Q\  ]Q^ j_Q` $UaQb +EcQd "4eQf dgQ Q Qh !$iQj &tkQl  mQn $UoQp !%qQr *5sQt %euQv )%wQx tyQz {Q| T}Q~ tQ@ "5AQB #ECQD $UEQF !%GQH )%IQ QJ $($( %$)',$"!&#(! aQ Q Qd $C~ ;///0  )67 $ "# 23  ,Q	 	 (! 0!  3A  4Q	 
 8  9!  4Q  9!  9!  =a  H  6q  B1  :1  7   DQ! " -a# $ 786789)     . 5645:;FGNO78)*! ! / A#  # J 01+,=>1256DE9:9:	  	 K1 1j *+*+'('(!"./$%./78+,56673423   " *+011223'(-.&'342367! !# @ 3A  ./:;&'&'12<=56./+,
! 
! 5634    *F!11F!+QF! 3AF! 4Q	F!
 5aF! 5aF! .qF! 7F! 21F! A!F! 3AF! 3AF! 8F! <QF! 21F!  0!F!" .q#F! F!$ CA%F!& 8'F!( 1!)F!* 9!+F!, 4Q-F!. 21/F!0 <Q1F!2 ;A3F!4 -a5F!6 5a7F!8 :19F!: -a;F!< &q=F!> 0?F!@ 5aAF!B @CF!D ,QEF! F! F!F 4QGF!H 1!IF!J 5aKF!L 6qMF!N :1OF!P +AQF!R 3ASF!T 0UF!V 4QWF!X 6qYF!Z 3A[F!\ 7]F!^ .q_F!` =aaF!b ;AcF!d <QeF!f 9!gF! F! F!h DQiF!j :1kF!l <QmF!n 5aoF!p =aqF!r 4QsF!t ;AuF!v :1wF!x 0yF!z 1!{F!| <Q}F!~ 8F!@ 9!AF!B 8CF!D 6qEF!F 1!GF!H 1!IF! F!J +AKF! F!P 5667   
 7812,-1223-.# #YT  T gH HT     
 
 
   ki iX "'"&!..x88!..x88	   $$$#!%""! !   6 w! '-70:*&2)3&7)%	 	u}?
 }?
 } } }	    c                    K   |                      |           d{V }|                     |di           }|                     |d          S )aQ  
        fetches the current integer timestamp in milliseconds from the exchange server
        :see: https://docs.kuna.io/docs/get-time-on-the-server
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns int: the current integer timestamp in milliseconds from the exchange server
        Ndatatimestamp_miliseconds)v4PublicGetPublicTimestamp
safe_valuesafe_integerr   paramsresponser   s       r   
fetch_timezkuna.fetch_time  s[       88@@@@@@@@ x44  '>???r   returnc                    K   |                      |           d{V }|                     |dg           }|                     |          S )a(  
        fetches all available currencies on an exchange
        :see: https://docs.kuna.io/docs/get-information-about-available-currencies
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an associative dictionary of currencies
        Nr   )v4PublicGetPublicCurrenciesr   parse_currenciesr   s       r   fetch_currencieszkuna.fetch_currencies  sX       99&AAAAAAAA2 x44$$T***r   c                     |                      |          }i }t          dt          |                    D ](}|                     ||                   }|||d         <   )|S )Nr   code)to_arrayrangelenparse_currency)r   r   r   resulticurrencys         r   r   zkuna.parse_currencies  se    ]]:..
q#j//** 	0 	0A**:a=99H'/F8F#$$r   c                 ,   |                      |d          }|                      |d          }|                      |d          }|||                     |          d d |                      |d          d d d d t          j        ||          d d dd d ddi dS )Nr   	precisiontradePrecisionr   minmax)amountru   )infor   r   typer'   r   activer   ru   r   r   limitsnetworks)safe_stringsafe_currency_coder   
string_min)r   r   
currencyIdr   r   s        r   r   zkuna.parse_currency  s    * %%h77
$$X{;;	))(4DEE++J77$$Xv66 +I~FF   
   	 	 -
 
 	
r   c                   K   |                      |           d{V }|                     |dg           }g }t          dt          |                    D ]}||         }|                     |d          }|                     |d          }|                     |d          }	|                     |d          }
|                     |	d          }|                     |
          }|                     |          }|                     |d          }|                     |	d          }|                    i d	|d
|dz   |z   d|d|ddd|
d|dddddddddddddddddd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 )!a  
        retrieves data on all markets for kuna
        :see: https://docs.kuna.io/docs/get-all-traded-markets
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: an array of objects representing market data
        Nr   r   pair	baseAsset
quoteAssetr   r   r   symbol/basequotesettlebaseIdquoteIdsettleIdr   r&   Tr'   Fr(   r)   r*   r   contractlinear)r   pricer   )leverager   r	  cost)
inversecontractSizeexpiryexpiryDatetimestrike
optionTyper   r   createdr   )	v4PublicGetMarketsPublicGetAllr   r   r   r   r   appendr   parse_precision)r   r   r   r   r   r   itemmarketIdr   r   r  r  r  r  basePrecisionquotePrecisions                   r   fetch_marketszkuna.fetch_markets  s      <<VDDDDDDDD& x44q#d))$$ ;	 ;	A7D''f55Hk::I|<<J%%i88F&&z6::G**622D++G44E ,,YDDM!--j+FFNNN 0h0$*u,0 0 	0
 $0 &0 70 D0 0 0 %0 0 %0 %0 $0  E!0" $#0$   $"&""//0D0D]0S0STT!..t/C/CN/S/STT   $#! !
  $# 
  $# 
  $#  $  _0 0 0 0 0 0 0b r   Nr   limitc           	      T  K   |                                   d{V  |                     |          }d|d         i}|||d<   |                     |                     ||                     d{V }|                     |di           }|                     ||d         dddd	d
          S )a)  
        fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
        :see: https://docs.kuna.io/docs/get-public-orders-book
        :param str symbol: unified symbol of the market to fetch the order book for
        :param int [limit]: 5, 10, 20, 50, 100, 500, or 1000(default)
        :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
        Npairsr   levelr   r   bidsasksr   r   )load_marketsmarketv4PublicGetOrderPublicBookPairsextend	safe_dictparse_order_book)r   r   r  r   r"  requestr   r   s           r   fetch_order_bookzkuna.fetch_order_bookb  s       !!!!!!!!!V$$VD\
 $GG==dkk'SY>Z>Z[[[[[[[[6 ~~h33$$T6(+;T66STVWXXXr   r"  c                 X   |                      |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 d|                      |d          d|                      |d          dd d|                      |d          d|                      |d          i|          S )Nr   r   r   r   datetimehighlowbidbestBidPriceaskbestAskPricevwapopencloselastpreviousClosechangepriceChanger   percentagePriceChangeaverage
baseVolumequoteVolume)r   safe_tickersafe_symbol)r   tickerr"  r  s       r   parse_tickerzkuna.parse_ticker  s     ##FF33 !
F!
d&&x88!
 !
 	!

 D$$VV44!
 4##FE22!
 4##FN;;!
 4##FN;;!
 D!
 D$$VV44!
 T!
 D!
 T!
 d&&v}==!
 $**63JKK!
  t!!
" $**6<@@#!
$ 4++FMBB%!
 !
& '  	r   symbolsc                   K   |                                   d{V  |t          | j        dz             |                     |          }|                     |          }dd                    |          i}|                     |                     ||                     d{V }|                     |dg           }| 	                    |||          S )a|  
        fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market. The average is not returned in the response, but the median can be accessed via response['info']['price']
        :see: https://docs.kuna.io/docs/get-market-info-by-tickers
        :param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
        Nz+ fetchTickers() requires a symbols argumentr  ,r   )
r!  r   r   market_symbols
market_idsjoin)v4PublicGetMarketsPublicTickersPairsPairsr$  	safe_listparse_tickers)r   r@  r   	marketIdsr'  r   r   s          r   fetch_tickerszkuna.fetch_tickers  s       !!!!!!!!!?#DG.[$[\\\%%g..OOG,,	SXXi((
 GGT[]cHdHdeeeeeeee* ~~h33!!$888r   c                 \  K   |                                   d{V  |                     |          }d|d         i}|                     |                     ||                     d{V }|                     |dg           }|                     |d          }|                     ||          S )a  
        fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
        :see: https://docs.kuna.io/docs/get-market-info-by-tickers
        :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>`
        Nr  r   r   r   )r!  r"  rF  r$  r   r%  r?  )r   r   r   r"  r'  r   r   r>  s           r   fetch_tickerzkuna.fetch_ticker  s       !!!!!!!!!V$$VD\
 GGT[]cHdHdeeeeeeee* x44a((  000r   c                 @   K   |                      |||           d{V S )a  
         * TODO: double check
        fetches level 3 information on open orders with bid(buy) and ask(sell) prices, volumes and other data
        :param str symbol: unified market symbol
        :param int [limit]: max number of orders to return, default is None
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `order book structure <https://docs.ccxt.com/#/?id=order-book-structure>`
        N)r(  )r   r   r  r   s       r   fetch_l3_order_bookzkuna.fetch_l3_order_book  s2       **65&AAAAAAAAAr   sincec                 B  K   |                                   d{V  |                     |          }d|d         i}|||d<   |                     |                     ||                     d{V }|                     |dg           }|                     ||||          S )a  
        get the list of most recent trades for a particular symbol
        :see: https://docs.kuna.io/docs/get-public-trades-book
        :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]: between 1 and 100, 25 by default
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
        Nr  r   r  r   )r!  r"  v4PublicGetTradePublicBookPairsr$  rG  parse_trades	r   r   rO  r  r   r"  r'  r   r   s	            r   fetch_tradeszkuna.fetch_trades  s       !!!!!!!!!V$$VD\
 $GG==dkk'SY>Z>Z[[[[[[[[" ~~h33  vue<<<r   c                    |                      |d          }|                      |d          }|                     |d          }|                     |d          }||                     |d          }|rdnd}|                     ||                      |d          |                     ||          |                     |          |d ||                      |d	          |rd
nd|                     |dd          |                     |dd          |                      |d          |                      |d          |                     |                      |d                    d dd|          S )N	createdAtr   isMakersideisBuyerbuysellr   orderIdr   r   
matchPricer	  matchQuantityquantityquoteQuantityr   feeCurrency)r  r   rate)r   r   r   r   r*  r   rX  r   takerOrMakerr	  r   r  r   )r   r   safe_string_lower
safe_trader=  	parse8601safe_string_2r   )r   trader"  r*  r  isTakerrX  rY  s           r   parse_tradezkuna.parse_trade4  s   < ##E;77##E622//%33%%eV44<ooeY77G#/55D""5$//&&x8811 %%eY77'.;GGG''|WEE((LL$$UO<<((66 33D4D4DUM4Z4Z[[  
  
$ %  	r   c                 p   d|i}t          dt          |                    D ]}||         }|                     |d          }|                     |          }|                                 }|                     |d          |d<   |                     |d          |d<   |||<   |                     |          S )Nr   r   r   balancefreelockBalanceused)r   r   r   r   accountsafe_balance)r   r   r   r   rl  r   r   rp  s           r   parse_balancezkuna.parse_balancem  s     (#q#h--(( 	# 	#AqkG))':>>J**:66DllnnG"..w	BBGFO"..wFFGFO"F4LL  (((r   c                    K   |                                   d{V  |                     |           d{V }|                     |dg           }|                     |          S )a!  
        query for balance and get the amount of funds available for trading or funds locked in orders
        :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!  v4PrivateGetPrivateGetBalancer   rr  r   s       r   fetch_balancezkuna.fetch_balance  s|       !!!!!!!!!;;FCCCCCCCC x44!!$'''r   r   rX  r   r	  c                   K   |                                   d{V  |                     |          }|                     |dd          }|                     |ddg          }|                     |          }	|d         |dk    rdnd|                     |          |	d}
|	d	k    r|                     |d
         |          |
d<   |G|	dk    rt          | j        dz             |                     |d
         |          |
d<   |	dk    rd|
d<   | 	                    | 
                    |
|                     d{V }|                     |di           }|                     ||          S )a  
        create a trade order
        :see: https://docs.kuna.io/docs/create-a-new-order-private
        :param str symbol: unified symbol of the market to create an order in
        :param str type: 'market' or 'limit'
        :param str side: 'buy' or 'sell'
        :param float amount: how much of currency you want to trade in units of base currency
        :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param float [params.triggerPrice]: the price at which a trigger order is triggered at
         *
         * EXCHANGE SPECIFIC PARAMETERS
        :param str [params.id]: id must be a UUID format, if you do not specify id, it will be generated automatically.
        :param float [params.quoteQuantity]: the max quantity of the quote asset to use for selling/buying
        :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        NtriggerPrice	stopPricer   rZ  BidAsk)r   	orderSider_  r   Limitr   r	  r	   zC createOrder() cannot place trigger market orders, or trigger limitTakeProfitLimitStopLossLimitr   r   )r!  r"  rg  omit
capitalizenumber_to_stringprice_to_precisionr   r   v4PrivatePostOrderPrivateCreater$  r%  parse_order)r   r   r   rX  r   r	  r   r"  rw  capitalizedTyper'  r   r   s                r   create_orderzkuna.create_order  s     " !!!!!!!!!V$$))&.+NN6NK#@AA//$//4L#'5==u--f55#	
 
 g%%#66vh7GOOGG#(** +p!pqqq#'#:#:6(;K\#Z#ZGK "333"1==dkk'SY>Z>Z[[[[[[[[  ~~h33f---r   r   c                 :  K   |                                   d{V  d|i}|                     |                     ||                     d{V }|                     |di           }d}||                     |          }|                     ||          }||d<   |S )a'  
        cancels an open order
        :param str id: order id
        :param str symbol: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        Nr\  r   r   )r!  v4PrivatePostOrderPrivateCancelr$  r   r"  r  )	r   r   r   r   r'  r   r   r"  r   s	            r   cancel_orderzkuna.cancel_order  s       !!!!!!!!!r
 ==dkk'SY>Z>Z[[[[[[[[ x44[[((F  v..dr   idsc                    K   |                                   d{V  d|i}|                     |                     ||                     d{V }|                     |dg           }|                     |          S )a0  
        cancels an open order
        :param str ids: order ids
        :param str symbol: not used by kuna cancelOrder
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        NorderIdsr   )r!  $v4PrivatePostOrderPrivateCancelMultir$  rG  parse_orders)r   r  r   r   r'  r   r   s          r   cancel_orderszkuna.cancel_orders  s       !!!!!!!!!
 BB4;;wX^C_C_```````` ~~h33  &&&r   c                 D    dddddddd}|                      |||          S )Ncanceledfilledr2  closed)CanceledClosedPendingOpendonewaitcancelr   r   statusstatusess      r   parse_order_statuszkuna.parse_order_status  s=    " 
 
 &&999r   c           
         |                      |d          }|                      |d          }|                      |d          }|                      |d          }|dk    rd}n|dk    rd}|                     |d	g           }|                     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|d|                      |d          d|                      |d          d |                     |          |                      |d          d d d|          S )Nr   rV  rx  rX  ry  rZ  rz  r[  r   r   r   r\  clientOrderIdr   r   r*  lastTradeTimestamp	updatedAtr  r   timeInForcepostOnlyr	  rw  r   r_  r  executedQuantityr  )	remainingr   r  r9  r   )	r   r   
safe_orderrg  r=  rf  r  rd  rR  )r   r   r"  r  r*  rw  rX  r   s           r   r  zkuna.parse_order  s[   T ##E622##E;77''{;;v..5==DDU]]D"55  
E 
$$$UD)<< 
 T 
 d&&x88	 

 11 
  
 !$..1A1A%1U1U"V"V 
 d--d.>.>uh.O.OPP 
 D**5&99 
 4 
  
 D 
 T%%eW55 
  
 L 
  d&&uj99! 
" d&&u.@AA# 
$ ''//$$UF33- 
  
  
. /  	r   c                    K   |                                   d{V  |dd}|                     |                     ||                     d{V }|                     |di           }|                     |          S )a   
        fetches information on an order made by the user
        :see: https://docs.kuna.io/docs/get-order-details-by-id
        :param str symbol: not used by kuna fetchOrder
        :param dict [params]: extra parameters specific to the exchange API endpoint
         *
         * EXCHANGE SPECIFIC PARAMETERS
        :param boolean [params.withTrades]: default is True, specify if the response should include trades associated with the order
        :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        NT)r   
withTradesr   )r!  !v4PrivateGetOrderPrivateDetailsIdr$  r%  r  )r   r   r   r   r'  r   r   s          r   fetch_orderzkuna.fetch_order]  s       !!!!!!!!!
 
 ??GU[@\@\]]]]]]]]F ~~h33%%%r   c                   K   |                                   d{V  |                     |d          }|                     |dg          }d}i }| |                     |          }|d         |d<   ||                     |          |d<   |||d<   ||                     |          |d<   |                     |                     ||                     d{V }|                     |dg           }	|                     |	|||          S )	a  
        fetch all unfilled currently open orders
        :see: https://docs.kuna.io/docs/get-active-client-orders-private
        :param str symbol: unified market symbol
        :param int [since]: the earliest time in ms to fetch open orders for
        :param int [limit]: 1-100, the maximum number of open orders structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: the latest timestamp(ms) to fetch orders for
         *
         * EXCHANGE SPECIFIC PARAMETERS
        :param str [params.sort]: asc(oldest-on-top) or desc(newest-on-top)
        :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
        Nuntilr   r  startr  endr   )	r!  r   r  r"  iso8601v4PrivateGetOrderPrivateActiver$  rG  r  )
r   r   rO  r  r   r  r"  r'  r   r   s
             r   fetch_open_orderszkuna.fetch_open_orders  s3      !!!!!!!!!!!&'226G9--
[[((F%d|GG#||E22GG$GG!\\%00GEN<<T[[RX=Y=YZZZZZZZZ, ~~h33  vue<<<r   c                 D   K   |                      d||||           d{V S )a  
        fetches information on multiple closed orders made by the user
        :see: https://docs.kuna.io/docs/get-private-orders-history
        :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
        :param int [params.until]: the latest time in ms to fetch orders for
         *
         * EXCHANGE SPECIFIC PARAMETERS
        :param str [params.sort]: asc(oldest-on-top) or desc(newest-on-top)
        :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
        r  N)fetch_orders_by_status)r   r   rO  r  r   s        r   fetch_closed_orderszkuna.fetch_closed_orders  s7       0065%QWXXXXXXXXXr   c                 P  K   |                                   d{V  |dk    r|                     ||||          S |                     |d          }|                     |dg          }d}d|                     |          i}| |                     |          }|d         |d<   ||                     |          |d<   |||d<   ||                     |          |d	<   |                     |           d{V }	|                     |	d
g           }
| 	                    |
|||          S )aF  
        fetch a list of orders
        :see: https://docs.kuna.io/docs/get-private-orders-history
        :param str status: canceled, closed, expired, open, pending, rejected, or waitStop
        :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]: 1-100, the maximum number of open orders structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: the latest timestamp(ms) to fetch orders for
         *
         * EXCHANGE SPECIFIC PARAMETERS
        :param str [params.sort]: asc(oldest-on-top) or desc(newest-on-top)
        :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
        Nr2  r  r  r   r  r  r  r  r   )
r!  r  r   r  r  r"  r  v4PrivateGetOrderPrivateHistoryrG  r  )r   r  r   rO  r  r   r  r"  r'  r   r   s              r   r  zkuna.fetch_orders_by_status  s\      !!!!!!!!!V))&%GGG!!&'226G9--doof--
 [[((F%d|GG#||E22GG$GG!\\%00GEN==gFFFFFFFF. ~~h33  vue<<<r   c                 @  K   |                                   d{V  d}i }| |                     |          }|d         |d<   |                     |                     ||                     d{V }|                     |d          }|                     ||||          S )a  
        fetch all trades made by the user
        :see: https://docs.kuna.io/docs/get-private-trades-history
        :param str symbol: unified market symbol
        :param int [since]: not used by kuna fetchMyTrades
        :param int [limit]: not used by kuna fetchMyTrades
        :param dict [params]: extra parameters specific to the exchange API endpoint
         *
         * EXCHANGE SPECIFIC PARAMETERS
        :param str [params.orderId]: UUID of an order, to receive trades for self order only
        :param str [params.sort]: asc(oldest-on-top) or desc(newest-on-top)
        :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
        Nr   r   r   )r!  r"  v4PrivateGetTradePrivateHistoryr$  rG  rR  rS  s	            r   fetch_my_tradeszkuna.fetch_my_trades  s       !!!!!!!!![[((F$TlGFO==dkk'SY>Z>Z[[[[[[[[( ~~h//  vue<<<r   r   c                   K   |                      |           |                     |dd          }|                     |ddg          }|                                  d{V  |                     |          }|Y|d                             d          dk    r t          | j        dz   |d         z             |d                                         }| 	                    |          }||||d	}	|||	d
<   | 
                    |                     |	|                     d{V }
|                     |
di           }|                     ||          S )a  
        make a withdrawal
        :see: https://docs.kuna.io/docs/create-a-withdraw
        :param str code: unified currency code
        :param float amount: the amount to withdraw
        :param str address: the address to withdraw to
        :param str tag:
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.chain]: the chain to withdraw to
         *
         * EXCHANGE SPECIFIC PARAMETERS
        :param str [params.id]: id must be a uuid format, if you do not specify id, it will be generated automatically
        :param boolean [params.withdrawAll]: self field says that the amount should also include a fee
        :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
        chainnetworkNr   USDr   zF withdraw() requires an extra parameter params["network"] to withdraw r   )r   r   addresspaymentMethod	paymentIdr   )check_addressrg  r  r!  r   findr   r   uppernetwork_code_to_id"v4PrivatePostWithdrawPrivateCreater$  r%  parse_transaction)r   r   r   r  tagr   r  r   	networkIdr'  r   r   s               r   ru   zkuna.withdraw?  s       	7###""67I>>6GY#788!!!!!!!!!==&&=$$U++a//'2z(z  ~F  GM  ~N  )N  O  O  O ,,..++E22	!"	
 
 ?#&GK @@WV\A]A]^^^^^^^^ ~~h33%%dH555r   c                   K   |                                   d{V  |                     |d          }|                     |d          }d}||                     |          }i }|||d<   ||                     |          |d<   |||d<   ||                     |          |d<   |                     |                     ||                     d{V }|                     |dg           }	|                     |	|          S )aJ  
        fetch all withdrawals made to an account
        :see: https://docs.kuna.io/docs/get-withdraw-history
        :param str code: unified currency code
        :param int [since]: the earliest time in ms to fetch withdrawals for
        :param int [limit]: the maximum number of withdrawals structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: the latest time in ms to fetch deposits for
         *
         * EXCHANGE SPECIFIC PARAMETERS
        :param str [params.status]: Created, Canceled, PartiallyProcessed, Processing, Processed, WaitForConfirmation, Pending, AmlChecking
        :param str [params.sortField]: amount(sorting by time), createdAt(sorting by date)
        :param str [params.sortOrder]: asc(oldest-on-top), or desc(newest-on-top, default)
        :param int [params.skip]: 0 - ... Select the number of transactions to skip
        :param str [params.address]:
        :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
        Nr  r   dateFromtakedateTor   )	r!  r   r  r   r  "v4PrivateGetWithdrawPrivateHistoryr$  rG  parse_transactions
r   r   rO  r  r   r  r   r'  r   r   s
             r   fetch_withdrawalszkuna.fetch_withdrawalsn  s-     $ !!!!!!!!!!!&'2267++}}T**H"&GJ"&,,u"5"5GJ#GFO $U 3 3GH@@WV\A]A]^^^^^^^^2 ~~h33&&tX666r   c                    K   |                                   d{V  d|i}|                     |                     ||                     d{V }|                     |di           }|                     |          S )a  
        fetch data on a currency withdrawal via the withdrawal id
        :see: https://docs.kuna.io/docs/get-withdraw-details-by-id
        :param str id: withdrawal id
        :param str code: not used by kuna.fetchWithdrawal
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
        N
withdrawIdr   )r!  ,v4PrivateGetWithdrawPrivateDetailsWithdrawIdr$  r%  r  )r   r   r   r   r'  r   r   s          r   fetch_withdrawalzkuna.fetch_withdrawal  s       !!!!!!!!!"
 JJ4;;W^`fKgKghhhhhhhh, ~~h33%%d+++r   c                 0  K   |                                   d{V  |                     |          }d|d         i}|                     |                     ||                     d{V }|                     |di           }|                     ||          S )a  
        create a currency deposit address
        :see: https://docs.kuna.io/docs/generate-a-constant-crypto-address-for-deposit
        :param str code: unified currency code of the currency for the deposit address
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
        Nsourcer   r   )r!  r   0v4PrivatePostDepositPrivateCryptoGenerateAddressr$  r%  parse_deposit_addressr   r   r   r   r'  r   r   s          r   create_deposit_addresszkuna.create_deposit_address  s       !!!!!!!!!==&&htn
 NNt{{[bdjOkOkllllllll ~~h33))$999r   c                 T  K   |                                   d{V  |                     |          }d|d                                         i}|                     |                     ||                     d{V }|                     |di           }|                     ||          S )a  
        fetch the deposit address for a currency associated with self account
        :see: https://docs.kuna.io/docs/find-crypto-address-for-deposit
        :param str code: unified currency code
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
        Nr  r   r   )r!  r   r  'v4PrivateGetDepositPrivateCryptoAddressr$  r%  r  r  s          r   fetch_deposit_addresszkuna.fetch_deposit_address  s       !!!!!!!!!==&&htn**,,
 EEdkkRY[aFbFbcccccccc ~~h33))$999r   r   c                     |                      |d          }|                      |d          |                     ||          d |                      |d          d dS )Nr   r  )r   r   r  r  r  )r   r   )r   depositAddressr   r   s       r   r  zkuna.parse_deposit_address  sg     %%nh??
$$^R88//
HEE''	BB
 
 	
r   c           	      F    ddddddddd}|                      |||          S )Npendingr  ok)Createdr  PartiallyProcessed
Processing	ProcessedWaitForConfirmationr  AmlCheckingr  r  s      r   parse_transaction_statuszkuna.parse_transaction_status  s@     ""+##, $	
 	
 &&999r   c                   K   |                                   d{V  |                     |d          }|                     |d          }d}||                     |          }i }|||d<   ||                     |          |d<   |||d<   ||                     |          |d<   |                     |                     ||                     d{V }|                     |dg           }	|                     |	|          S )a@  
        fetch all deposits made to an account
        :see: https://docs.kuna.io/docs/get-deposit-history
        :param str code: unified currency code
        :param int [since]: the earliest time in ms to fetch deposits for
        :param int [limit]: the maximum number of deposits structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: the latest time in ms to fetch deposits for
         *
         * EXCHANGE SPECIFIC PARAMETERS
        :param str [params.status]: Created, Canceled, PartiallyProcessed, Processing, Processed, WaitForConfirmation, Pending, AmlChecking
        :param str [params.sortField]: amount(sorting by time), createdAt(sorting by date)
        :param str [params.sortOrder]: asc(oldest-on-top), or desc(newest-on-top, default)
        :param int [params.skip]: 0 - ... Select the number of transactions to skip
        :param str [params.address]:
        :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
        Nr  r   r  r  r  r   )	r!  r   r  r   r  !v4PrivateGetDepositPrivateHistoryr$  rG  r  r  s
             r   fetch_depositszkuna.fetch_deposits#  s-     $ !!!!!!!!!!!&'2267++}}T**H"&GJ"&,,u"5"5GJ#GFO $U 3 3GH??GU[@\@\]]]]]]]]2 ~~h33&&tX666r   c                 ,  K   |                                   d{V  d}||                     |          }d|i}|                     |                     ||                     d{V }|                     |di           }|                     ||          S )a  
        fetch data on a currency deposit via the deposit id
        :see: https://docs.kuna.io/docs/get-deposit-details-by-id
        :param str id: deposit id
        :param str code: filter by currency code
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
        N	depositIdr   )r!  r   *v4PrivateGetDepositPrivateDetailsDepositIdr$  r%  r  )r   r   r   r   r   r'  r   r   s           r   fetch_depositzkuna.fetch_deposit`  s       !!!!!!!!!}}T**H
 HHU\^dIeIeffffffff, ~~h33%%dH555r   c                 N   |                      |d          }|                      |d          }|                     ||          }|                      |d          }|                     |d          }|                      |d          }|dk    }	|	r|n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 dd |                      |d          d |                     |d          |ddS )NrV  assetpaymentCoder   r  r   
withdrawalr   r   txidtxIdr   r   r*  r  addressFrom	addressTor   r  updatedr  tagFromr  tagTomemor   )r  r   )commentinternalr   )r   r   rd  rf  network_id_to_codesafe_numberr  )r   transactionr   r*  r   r   r  r   r  	isDeposit
parsedTypes              r   r  zkuna.parse_transaction  s8   ( ##K==%%k7;;
&&z8<<$$[-@@	%%k6::"";	::Y&	&8TTL

K
$"";55
 D$$[&99
 	

 11
 
 t..y99
 4
 w
 
 d&&{H==
 J
 d33D4D4D[RZ4[4[\\
 t~~d&6&6{K&P&PQQ
 t
  4!
" T#
$ ''V<<((e<<  )
 
 
 	
r   c                 *    |                                  S N)milliseconds)r   s    r   r   z
kuna.nonce  s      """r   c                    d|v r|d         }|                      |                     |                     |d                              }t          dt	          |                    D ]v}||         }t          |                                          }t          dt	          |                    D ]-}||         }||         }	|d|z   dz   t          |	          z   z  }.w|S |                      |                     |                    S )Nr   r   z&orders%5B%5D%5Bz%5D=)	urlencodekeysortr  r   r   listkeysstr)
r   r   r   queryr   r   r  r   keyvalues
             r   encode_paramszkuna.encode_params  s   vH%FNN4<<		&(0K0K#L#LMME1c&kk** L Lq	EJJLL))q#d)),, L LAq'C!#JE/#5>UKKEEL L~~dll622333r   rx   GETc           
      L   d }t          |t                    rs|dk    }|                     |d          }	|                     |d          }
|	dk    r| j        d         |	         dz   |	z   dz   |                     ||          z   }|
dk    rH|r|r|d|                     |          z   z  }n^|d	k    s|d
k    rddi}|                     |          }n7|
dk    rt          | j        dz             n|	dk    r| 	                    |          }d|	z   dz   |                     ||          z   }| 
                    ||          }|rQt          |                                          }t          |          }|dk    r|d|                     |          z   z  }|
dk    rt          |                                           }||z   }|r||                     i           z   }n||                     |          z   }|}dd|| j        |                     |                     |          |                     | j                  t&          j        d          d}|                     | j        d          }|dk    rd|d<   | j        d         |	         |z   }n}d| j        z   dz   |                     ||          z   }d| j        v r|| j        d         z  }| 
                    || 	                    |                    }| j        d         |         |z   }|dk    r|r|d|                     |          z   z  }n|                                  t          |                                           }|                     |                     | j        |d|                    }|dz   |z   dz   |z   }|                     |                     |          |                     | j                  t&          j                  }|dz   |z   }|dk    r	|d|z   z  }n|}ddi}|t          j        |          }||||dS )Nr  r   r   rw   r}   r   rx   ?POSTPUTContent-Typezapplication/jsonry   z$ private v3 API is not supported yetr$   hex)r  acceptr   z
public-key	signaturerp  proz/api/rz   )
access_keytonce|z&signature=z!application/x-www-form-urlencoded)urlmethodbodyheaders)
isinstancer  r   r   implode_paramsr  jsonr   r   extract_paramsr  r  r   r  r   apiKeyhmacencodesecrethashlibsha384r   r   check_required_credentialsr  r$  sha256dumps)r   pathr}   r"  r   r$  r#  r!  isGetr   accessextractedParamsurlPath
paramsList	numParamsr   authrp  r'  r  
queryInnersignedsuffixs                          r   r   z	kuna.sign  sg   c4   B	TeOE&&sA..G%%c1--F$i&w/#5?#EH[H[\`bhHiHiiX%% 1! @3)?)?#??C F**%#13E"F#yy00y((&tw1W'WXXX )D"&"5"5d";";-#-0C0CD&0Q0QQ6?;; @!%fkkmm!4!4J #JI 1}}3)?)?#??Y&&

--E"U?D &#diimm3#dii&7&77%(:"4!&&*k%)YYt{{4/@/@$++dkBZBZ\c\jlq%r%r G #..t|YGGG%''-2	*i&w/'9,s2T5H5Hv5V5VVGdi''49[11IIfd&9&9$&?&?@@E)E"3''1Ch 73!6!666C//111DJJLL))!//"&+"= = 1 1  
 |g-3j@4;;t#4#4dkk$+6N6NPWP^__.7U??3<'CC!D-/RSG:d##DfdwOOOr   c
                 l   |                      |d          }
||
d S |
|dk    r|                      |
d          }||                      |d          }|                     |d          }| j        dz   |                     |          z   }|                     | j        ||           t          |          d S )Nerrorsi  r   errorr    )r   r   r   r'  throw_exactly_matched_exceptionr   r   )r   r   reasonr!  r"  r$  r#  r   requestHeadersrequestBodyr>  r?  	errorCodefeedbacks                 r   handle_errorszkuna.handle_errors  s     8446>4DCKKOOFA..E}'::((77Iw}tyy':'::H00)XVVV)))tr   r  )>__name__
__module____qualname__r   r   r   r   r   r   r   r	   r  r  r   r   r(  r   r?  r   r   rJ  rL  rN  r   rT  rj  r   rr  ru  r   r   floatr
   r  r   r  r  r  r   r  r  r  r  r  r  ru   r   r  r  r  r  r   r  r  r  r  r  r   r  r   rG  __classcell__)r   s   @r   r    r       s       ~ ~ ~ ~ ~@ ') @ @ @ @& -/ !+ !+: !+ !+ !+ !+F 35    /
 /
 /
b *, X XV X X X Xt @DB ,Y ,YS ,Y ,YS\ ,Y ,Y ,Y ,Y\$ $6 $V $ $ $ $L 6:" &9 &97 &9 &9 &9 &9 &9P 68 $1 $1 $1F $1 $1 $1 $1L CGr 	B 	B 	BC 	B 	B 	B 	B <@d[] #= #= #=S #= #=bfglbm #= #= #= #=J7 7 75 7 7 7 7r) ) ) ) ), *, ( ( ( ( ( (( mqy{ 5. 5. 5.I 5.Y 5.X] 5.fi 5. 5. 5. 5.n 9=R  S #    8 AER ' 'tCy '# ' ' ' '6
: 
: 
:J J J5 J J J JX 8<B 4& 4&C 4& 4& 4& 4& 4&l 59tZ^gi 4= 4=c 4= 4=TW 4=nrsxny 4= 4= 4= 4=l 7;\`ik Y Y Y3 YVY Yptuzp{ Y Y Y Y  BFTXgktv 9= 9=3 9=c 9=ad 9= 9= 9= 9=v 37TX\eg )= )=C )=s )=RU )= )= )= )=V EIQS -6 -63 -6 -6 -6 -6 -6^ 37TX\eg ;7 ;7C ;7s ;7RU ;7lpq|l} ;7 ;7 ;7 ;7z ;?r $, $, $,C $, $, $, $,L >@ : : : : : :4 =? : : : : : :4
 
h 
 
 
 
": : : 04$UYbd ;7 ;7 ;7C ;7s ;7imnyiz ;7 ;7 ;7 ;7z 8<B '6 '6c '6 '6 '6 '6 '6R4
 4
x 4
; 4
 4
 4
 4
l# # #4 4 4 &eBSW GP GP GP GPR      r   r    )& ccxt.async_support.base.exchanger   ccxt.abstract.kunar   r-  r'  ccxt.base.typesr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   typingr   ccxt.base.errorsr   r   r   r   r   r   r   ccxt.base.decimal_to_precisionr   ccxt.base.preciser   r     r   r   <module>rU     s	   6 5 5 5 5 5 * * * * * *   h  h  h  h  h  h  h  h  h  h  h  h  h  h  h  h  h  h  h  h  h  h  h  h  h  h  h  h  h  h  h  h  h  h  h  h       * * * * * * . . . . . . ' ' ' ' ' ' . . . . . . ) ) ) ) ) ) * * * * * * ) ) ) ) ) ) 4 4 4 4 4 4 % % % % % %Z Z Z Z Z8[ Z Z Z Z Zr   