
    ei=(                    4   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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* d dl+m,Z,  G d dee          Z-dS )    )Exchange)ImplicitAPIN)AccountAnyBalances
CurrenciesCurrencyDepositAddressIntLedgerEntryMarketNumOrder	OrderBook	OrderSide	OrderTypeStrStringsTickerTickersTradeTradingFeeInterfaceTradingFeesTransactionTransferEntry)List)ExchangeError)AuthenticationError)PermissionDenied)ArgumentsRequired)
BadRequest)InsufficientFunds)RateLimitExceeded)NullResponse)	TICK_SIZE)Precisec                   J    e Zd Zdef fdZi fdefdZdedefdZ	i fde
e         fdZdedefdZi fdefd	Zi fd
edefdZdi fdedefdZdRdededefdZddi fd
ededede
e         fdZdRdededefdZdi fd
ededefdZdddi fd
edededede
e         f
dZdRdedefdZi fdefdZ dSdefdZ!dRdedede"fdZ#i fde
e$         fd Z%d!e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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i fd)ed
e*fd+Z0d%e*fd,Z1dRd-edede+fd.Z2di fd
ed/e3d0e4d1e5d2e6f
d3Z7di fd)ed
e*fd4Z8di fd
e*fd5Z9dddi fd6e*dedede
e:         fd7Z;dRd8ed9ede:fd:Z<d; Z=dddi fd6e*dedede
e>         fd<Z?dRd=ed9ede>fd>Z@d%e*fd?ZAi fd6ed1e5d@edAedeBf
dBZCi fd6ed1e5d@edAedeBf
dCZDi fd6ed1e5d@edAedeBf
dDZEdRdEed9edeBfdFZFi fd6edeGfdGZHdRd9edeGfdHZIdIdJi ddfdKZJd6eKdLedMedNedOedPefdQZL xZMS )Tcexreturnc                 \   |                      t          t          |                                           ddg 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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	d0d	d1d	d2d	d3d	d4d	d5d	d6dd7d	d8d	d9d	i d:d	d;d	d<d	d=d	d>d	d?d	d@d	dAddBd	dCd	dDd	dEd	dFddGd	dHd	dId	dJdi dKddLd	dMd	dNddOd	dPd	dQd	dRd	dSd	dTd	dUd	dVd	dWd	dXddYddZdd[ddd	d	d	d	d	d	d	d	d	dd\d]d^d_d`dadbdcddgdedfi dgdgdgdhdgdgdgdgdidji i dkdldmdgdndldodgdpdldqdldrdldsdgdtdgdudldvdgdwdgdxdgdydgdzdld{dgd|dhdldgdgd}dj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	dd	d	d	dd d	dddgdd	d	d	dddid	d d dd d ddt          i t
          t          t          t          t
          t          t          t          t          d	dddddddddddi ddddddddddddddddddddddddddddddddddi ddddddddddddddddēddƓddȓddʓdd̓ddΓddГddғddԓdd֓dddddddݜidޜ          S )Nr(   zCEX.IO)GBEUCYRUi,  TCORSspotmarginFswapfutureoption	addMarginborrowCrossMarginborrowIsolatedMarginborrowMargincancelAllOrderscancelOrdercloseAllPositionsclosePositioncreateOrder$createOrderWithTakeProfitAndStopLoss&createOrderWithTakeProfitAndStopLossWscreatePostOnlyOrdercreateReduceOnlyOrdercreateStopOrdercreateTriggerOrderfetchAccountsfetchBalancefetchBorrowInterestfetchBorrowRatefetchBorrowRateHistoriesfetchBorrowRateHistoryfetchBorrowRatesfetchBorrowRatesPerSymbolfetchClosedOrderfetchClosedOrdersfetchCrossBorrowRatefetchCrossBorrowRatesfetchCurrenciesfetchDepositAddressfetchDepositsWithdrawalsfetchFundingHistoryfetchFundingIntervalfetchFundingIntervalsfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchGreeksfetchIndexOHLCVfetchIsolatedBorrowRatefetchIsolatedBorrowRatesfetchIsolatedPositionsfetchLedgerfetchLeveragefetchLeveragesfetchLeverageTiersfetchLiquidationsfetchLongShortRatiofetchLongShortRatioHistoryfetchMarginAdjustmentHistoryfetchMarginModefetchMarginModesfetchMarketLeverageTiersfetchMarketsfetchMarkOHLCVfetchMarkPricesfetchMyLiquidationsfetchMySettlementHistory
fetchOHLCVfetchOpenInterestfetchOpenInterestHistoryfetchOpenInterestsfetchOpenOrderfetchOpenOrdersfetchOptionfetchOptionChainfetchOrderBookfetchPositionfetchPositionHistoryfetchPositionModefetchPositionsfetchPositionsForSymbolfetchPositionsHistoryfetchPositionsRiskfetchPremiumIndexOHLCVfetchSettlementHistoryfetchTickerfetchTickers	fetchTimefetchTrades)fetchTradingFeesfetchVolatilityHistoryreduceMarginrepayCrossMarginrepayIsolatedMarginrepayMarginsetLeverage	setMarginsetMarginModesetPositionModetransferzchttps://user-images.githubusercontent.com/1294454/27766442-8ddc33b0-5ed8-11e7-8b98-f786aef0f3c9.jpgz)https://trade.cex.io/api/spot/rest-publicz"https://trade.cex.io/api/spot/rest)publicprivatezhttps://cex.iozhttps://trade.cex.io/docs/zhttps://cex.io/fee-schedulez!https://cex.io/limits-commissionsz!https://cex.io/r/0/up105393824/0/)logoapiwwwdocfeesreferral   
   )get_server_timeget_pairs_infoget_currencies_infoget_processing_info
get_tickerget_trade_historyget_order_bookget_candles)getpostget_my_current_fee   get_fee_strategyget_my_volumedo_create_accountget_my_account_status_v3get_my_wallet_balanceget_my_ordersdo_my_new_orderdo_cancel_my_orderdo_cancel_all_ordersr   r   r   get_my_transaction_historyget_my_funding_historydo_my_internal_transferr   )get_deposit_addressdo_deposit_funds_from_walletdo_withdrawal_funds_to_wallet)IOCFOKPOGTD)
marginModetriggerPricetriggerPriceTypetriggerDirectionstopLossPricetakeProfitPriceattachedStopLossTakeProfittimeInForcehedgedleveragemarketBuyRequiresPricemarketBuyByCostselfTradePreventiontrailingicebergi  )r   limittriggerr   symbolRequiredi )r   r   daysBackdaysBackCanceled	untilDaysr   r   r   r   )	sandboxr=   createOrdersfetchMyTrades
fetchOrderrs   fetchOrdersrM   rn   )linearinverse)r0   r2   r3   )	z/You have negative balance on following accountsz2Mandatory parameter side should be one of BUY,SELLz,API orders from Main account are not allowedzcheck failedzInsufficient fundsz3Get deposit address for main account is not allowedz%Market Trigger orders are not allowedzkey not passed or incorrectzAPI rate limit reached)exactbroad1m5m15m30m1h2h4h1d)r   r   r   r   r   r   r   r   networksBTCbitcoinERC20BSC20binancesmartchainDOGEdogecoinALGOalgorandXLMstellarATOMcosmosLTClitecoinXRPrippleFTMfantomMINAminaTHETAthetaXTZtezosTIAcelestiaCRONOScronosMATICpolygonTONtonTRC20tronSOLANAsolanaSGBsongbirdDYDXdydxDASHdashZILzilliqaEOSeos
AVALANCHEC	avalancheETHPOWethereumpowNEARnearARBarbitrumDOTpolkadotOPToptimismINJ	injectiveADAcardanoONTontologyICPicpkavakusamaseineoneo3xdc)KAVAKSMSEINEONEO3XDC)idname	countries	rateLimitprohasurlsr   featuresprecisionMode
exceptions
timeframesoptions)
deep_extendsuperr(   describer%   r"   r!   r   r   r#   )self	__class__s    T/var/www/html/volatility/venv/lib/python3.11/site-packages/ccxt/async_support/cex.pyr<  zcex.describe   s
   c4 0 0 9 9 ; ;111aaa %a 	a
 %a %a Ua $Ua 'a a "4a ta $Ua  a ta  7!a" 9%#a a$ &u%a& ('a( "4)a* %d+a,  -a. /a0 &u1a2 "53a4 +E5a6 )%7a8 #E9a: ,U;a< #D=a> $T?a@ 'AaB (CaD "4Ea a aF &tGaH +DIaJ &uKaL 'MaN (OaP #EQaR *5SaT $UUaV uWaX "5YaZ *5[a\ +E]a^ )%_a` taab  cad !%eaf %ega a ah $Uiaj &ukal -eman /oap "5qar #Esat +Euav wax !%yaz "5{a| &u}a~ +Ea@ dAaB $UCaD +EEaF %eGaH !$Ia a aJ "4KaL uMaN #EOaP !$QaR  SaT 'UaV $UWaX !%YaZ *5[a\ (]a^ %e_a` )%aab )%cad teaf gah Tiaj tka al %)*/ %$)',$$"!&#( Aa a aF ~IC  (317 @   +,*+/0/1&'-.*+'(	 	  ,a*A ( ,Q	
 3A 0 ( *1 -a / )! &q ,Q 5a 1!  21!" .r#$ 01899:)   ' 'T  %&+(,,0,1).+06:#'#'"'#'	( ( #($)27+//4$)#()$ $, %)%)"&&+!%#($)*/( ( $(&+!%$*,-%+#($)*/	* 	*  #[0 0d ## 
 ## m: :v 'GXJTDN$.*;K[=G3F.?
 
  	 	  -9-W- 0- J	-
 J- 9- H- :- 8- 8- F- W- 7- :- h-  Y!-" 5#- -$ V%-& h'-( :)-* F+-, F--. 9/-0 51-2 !+3-4 m5-6 F7-8 :9-: :;-< :=-> ;?-@ 9A-B :C-D 5E- -F ##  " !Y- - -/eb>
 b>
 b b b	    c                   K   g }|                     |                     |                     |                     |                     |                     t          j        |  d{V }|                     |d         dg           }|                     |d         di           }|                     |d          }|                     ||          }| 	                    | 
                    |                    S )a   
        fetches all available currencies on an exchange

        https://trade.cex.io/docs/#rest-public-api-calls-currencies-info

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an associative dictionary of currencies
        Nr   datar   currency)appendpublicPostGetCurrenciesInfopublicPostGetProcessingInfoasynciogather	safe_list	safe_dictindex_byr:  parse_currenciesto_array)r=  paramspromises	responsesdataCurrenciesdataNetworkscurrenciesIndexedrB  s           r?  fetch_currencieszcex.fetch_currencies?  s       88@@AAA 	88@@AAA, ".(3333333		!fbAA~~ilFB?? MM.*EE 1<@@$$T]]4%8%8999r@  rawCurrencyc                    |                      |d          }|                     |          }|                     |d          rdnd}|                     |                     |                      |d                              }i }|                     |di           }t          |                                          }t          dt          |                    D ]}	||	         }
||
         }| 
                    |
          }|                      |d          dk    }|                      |d	          dk    }|
|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 )NrC  fiatcrypto	precisionblockchainsr   depositenabled
withdrawalwithdrawalFee
minDepositminmaxminWithdrawal)r[  withdraw)
r.  networkr1   r[  rd  activefeerY  limitsinfowalletDepositwalletWithdrawal)amountrd  )r.  coder/  typerf  r[  rd  rg  rY  rh  r   ri  )safe_stringsafe_currency_code	safe_boolparse_numberparse_precisionrJ  listkeysrangelennetwork_id_to_codesafe_numbersafe_currency_structure)r=  rU  r.  rm  rn  currencyPrecisionr   rawNetworksru  j	networkId
rawNetworknetworkCoder[  rd  s                  r?  parse_currencyzcex.parse_currencyu  sG   k:66&&r**V<<Jvv( --d.B.B4CSCST_alCmCm.n.noonn[-DDK$$&&''q#d))$$ 	 	AQI$Y/J11)<<K&&z9==JG''
LAAYNH&"$''
ODD.  $//
LII#   
  $//
OLL#! !	 	 #'% %H[!!* ++~~k?CC{4FGG*   
   	 	 !+-
 -
   	r@  c                    K   |                      |           d{V }|                     |dg           }|                     |          S )a  
        retrieves data on all markets for ace

        https://trade.cex.io/docs/#rest-public-api-calls-pairs-info

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: an array of objects representing market data
        NrB  )publicPostGetPairsInforI  parse_markets)r=  rN  responserB  s       r?  fetch_marketszcex.fetch_markets  sX       44V<<<<<<<<, ~~h33!!$'''r@  marketc                    |                      |d          }|                     |          }|                      |d          }|                     |          }|dz   |z   }|dz   |z   }|                     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          |                     |d          d|                     |d          |                     |d          d|                     |d          |                     |d          dd d dd|                      |d          |                     |                     |                      |d                              |                     |                     |                      |d                               |                     |                     |                      |d!                              d"d d |d#
          S )$Nbasequote-/r.  symbolbaseIdquoteIdsettlesettleIdrn  r0   Tr1   Fr2   r3   r4   contractr   r   baseMinbaseMaxr`  minPricemaxPricequoteMinquoteMax)rl  pricecostr   baseLotSizepricePrecisionbasePrecisionquotePrecision)rl  r  r  r  )
contractSizeexpiryexpiryDatetimestrike
optionTyperh  rY  rf  createdri  )ro  rp  safe_market_structurery  rr  rs  )r=  r  r  r  r  r  r.  r  s           r?  parse_marketzcex.parse_market  s   !!&&11&&v..""6733''00CZ%e#)) 3+
"3+
f3+
 D3+
 f	3+

 U3+
 w3+
 d3+
 3+
 F3+
 D3+
 e3+
 E3+
 e3+
 e3+
 3+
  d!3+
" t#3+
$ !"  ++FI>>++FI>> 
  ++FJ??++FJ?? 
  ++FJ??++FJ?? 
    & **6=AA**4+?+?@P@PQWYi@j@j+k+kll))$*>*>t?O?OPVXg?h?h*i*ijj**4+?+?@P@PQWYi@j@j+k+kll  e3+
 3+
 3+
 3 3 3	r@  c                    K   |                      |           d{V }|                     |d          }|                     |d          }|S )a  
        fetches the current integer timestamp in milliseconds from the exchange server
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns int: the current integer timestamp in milliseconds from the exchange server
        NrB  	timestamp)publicPostGetServerTimerJ  safe_integer)r=  rN  r  rB  r  s        r?  
fetch_timezcex.fetch_time  s]       55f======== ~~h//%%dK88	r@  r  c                    K   |                                   d{V  |                     |g|           d{V }|                     ||i           S )a  
        fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market

        https://trade.cex.io/docs/#rest-public-api-calls-ticker

        :param str symbol:
        :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>`
        N)load_marketsfetch_tickersrJ  )r=  r  rN  r  s       r?  fetch_tickerzcex.fetch_ticker"  sk       !!!!!!!!!++VHf========~~h333r@  Nsymbolsc                 *  K   |                                   d{V  i }||                     |          |d<   |                     |                     ||                     d{V }|                     |di           }|                     ||          S )a  
        fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market

        https://trade.cex.io/docs/#rest-public-api-calls-ticker

        :param str[]|None 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>`
        NpairsrB  )r  
market_idspublicPostGetTickerextendrJ  parse_tickers)r=  r  rN  requestr  rB  s         r?  r  zcex.fetch_tickers0  s       !!!!!!!!!#w77GG11$++gv2N2NOOOOOOOO6 ~~h33!!$000r@  tickerc                 ^   |                      |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          |d|          S )Nr.  r  r  datetimehighlowbidbestBid	bidVolumeaskbestAsk	askVolumevwapopencloselastpreviousClosechangepriceChange
percentagepriceChangePercentageaverage
baseVolumevolumequoteVolume)r  ri  )ro  safe_symbolsafe_tickerry  )r=  r  r  marketIdr  s        r?  parse_tickerzcex.parse_ticker\  s   ##FD11!!(F33 !
f!
!
 !
 D$$VV44	!

 4##FE22!
 4##FI66!
 !
 4##FI66!
 !
 D!
 D!
 T%%ff55!
 T!
 d&&v}==!
 $**63JKK!
  t!!
" $**68<<#!
$  ++FMBB'!
 !
 !
( )  	r@  sincer   c                 ,  K   |                                   d{V  |                     |          }d|d         i}||                     |          |d<   d}|                     |dd          \  }}||                     |          |d<   |t	          |d          |d	<   |                     |                     ||                     d{V }|                     |d
i           }	|                     |	dg           }
| 	                    |
|||          S )ak  
        get the list of most recent trades for a particular symbol

        https://trade.cex.io/docs/#rest-public-api-calls-trade-history

        :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
        :param int [params.until]: timestamp in ms of the latest entry
        :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/?id=public-trades>`
        Npairr.  fromDateISOuntiltill	toDateISOi'  pageSizerB  trades)
r  r  iso8601handle_param_integer_2ra  publicPostGetTradeHistoryr  rJ  rI  parse_trades)r=  r  r  r   rN  r  r  r  r  rB  r  s              r?  fetch_tradeszcex.fetch_tradesu  s:      !!!!!!!!!V$$F4L
 %)\\%%8%8GM"33FGVLLv#'<<#6#6GK "%eU"3"3GJ77GV8T8TUUUUUUUU  ~~h33h33  >>>r@  tradec                    |                      |d          }|                     |          }|                     d |          }|                     |||                     |          |d         |                      |d          d d d |                     |d          |                      |d          |                      |d          d d d|          S )NdateISOr  tradeIdsider  rl  )ri  r  r  r  r.  orderrn  takerOrMakerr  r  rl  r  rg  )ro  	parse8601safe_market
safe_trader  safe_string_lower)r=  r  r  dateStrr  s        r?  parse_tradezcex.parse_trade  s     ""5)44NN7++	!!$//"Y//X&""5)44 **5&99%%eW55&&uh77 
  
   	r@  c                 j  K   |                                   d{V  |                     |          }d|d         i}|                     |                     ||                     d{V }|                     |di           }|                     |d          }|                     ||d         |          S )a7  
        fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data

        https://trade.cex.io/docs/#rest-public-api-calls-order-book

        :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
        Nr  r.  rB  r  r  )r  r  publicPostGetOrderBookr  rJ  r  parse_order_book)	r=  r  r   rN  r  r  r  	orderBookr  s	            r?  fetch_order_bookzcex.fetch_order_book  s       !!!!!!!!!V$$F4L
 44T[[&5Q5QRRRRRRRR& NN8VR88	%%i==	$$Yx0@)LLLr@  r   	timeframec                 6  K   d}|                      |dd          \  }}|t          | j        dz             |                                  d{V  |                     |          }|d         | j        |         |d}||                     |          |d<   d}	|                     |dd	          \  }	}|	|                     |	          |d
<   n,|*|                     |                                           |d
<   ||	|t          | j        dz             ||	|t          | j        dz             |||d<   | 	                    | 
                    ||                     d{V }
|                     |
dg           }|                     |||||          S )a  
        fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market

        https://trade.cex.io/docs/#rest-public-api-calls-candles

        :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
        :param int [params.until]: timestamp in ms of the latest entry
        :returns int[][]: A list of candles ordered, open, high, low, close, volume
        Nrn   dataTypezO fetchOHLCV requires a parameter "dataType" to be either "bestBid" or "bestAsk"r.  )r  
resolutionr  fromISOr  r  toISOzO fetchOHLCV does not support fetching candles with both a limit and since/untilzP fetchOHLCV requires a limit parameter when fetching candles with since or untilr   rB  )handle_option_and_paramsr    r.  r  r  r8  r  r  millisecondspublicPostGetCandlesr  rI  parse_ohlcvs)r=  r  r  r  r   rN  r  r  r  r  r  rB  s               r?  fetch_ohlcvzcex.fetch_ohlcv  s       88zZZ&#DG.$  A  A  A!!!!!!!!!V$$4L/)4 
 

 !%e!4!4GI33FGVLLv#||E22GG]#||D,=,=,?,?@@GG!2u7H#DG.$  A  A  A5#4%-#DG  /A  %A  B  B  B$GG224;;w3O3OPPPPPPPP$ ~~h33  vy%GGGr@  c           	         |                      |d          |                     |d          |                     |d          |                     |d          |                     |d          |                     |d          gS )Nr  r  r  r  r  r  )r  ry  )r=  ohlcvr  s      r?  parse_ohlcvzcex.parse_ohlcv&  s~    e[11UF++UF++UE**UG,,UH--
 	
r@  c                    K   |                                   d{V  |                     |           d{V }|                     |di           }|                     |di           }|                     |d          S )aQ  
        fetch the trading fees for multiple markets

        https://trade.cex.io/docs/#rest-public-api-calls-candles

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a dictionary of `fee structures <https://docs.ccxt.com/?id=fee-structure>` indexed by market symbols
        NrB  
tradingFeeT)r  privatePostGetMyCurrentFeerJ  parse_trading_fees)r=  rN  r  rB  r   s        r?  fetch_trading_feeszcex.fetch_trading_fees0  s       !!!!!!!!!88@@@@@@@@ ~~h33~~dL"55&&tT222r@  Fc                    i }t          |                                          }t          dt          |                    D ]J}||         }d }|r|                     |          }|                     ||         |          }|||d         <   Kt          dt          | j                            D ]A}| j        |         }	|	|vr.|                     |	          }|                     ||          ||	<   B|S )Nr   r  )rt  ru  rv  rw  r  parse_trading_feer  r  )
r=  r  
useKeyAsIdresultru  ikeyr  parsedr  s
             r?  r  zcex.parse_trading_feesI  s    HMMOO$$q#d))$$ 	. 	.Aq'CF /))#..++HSM6BBF'-F6(#$$q#dl++,, 	J 	JA\!_Ff$$V,,!%!7!7&!I!Ivr@  rg  c                     ||                      |d          |                     |d          |                     |d          d d dS )Nr  percent)ri  r  makertakerr  	tierBased)ro  ry  )r=  rg  r  s      r?  r  zcex.parse_trading_feeZ  sS    &&vx88%%c955%%c955
 
 	
r@  c                 "  K   |                                   d {V  |                     |           d {V }|                     |di           }|                     |di           }|                     |          }|                     ||          S )NrB  balancesPerAccounts)r  privatePostGetMyAccountStatusV3rJ  rM  parse_accounts)r=  rN  r  rB  balancesarrayss         r?  fetch_accountszcex.fetch_accountsd  s      !!!!!!!!!==fEEEEEEEE* ~~h33>>$(=rBBx((""66222r@  accountc                     d d d |dS )N)r.  rn  rm  ri   )r=  r  s     r?  parse_accountzcex.parse_account  s    	
 
 	
r@  c                   K   d}|                      |dd          \  }}d}|                      |dd          \  }}d}|dk    ra|                     |           d{V }|                     |di           }|                     |di           }|                     ||i           }n2|                     |           d{V }|                     |di           }|                     |          S )	an  
        query for balance and get the amount of funds available for trading or funds locked in orders

        https://trade.cex.io/docs/#rest-private-api-calls-account-status-v3

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param dict [params.method]: 'privatePostGetMyWalletBalance' or 'privatePostGetMyAccountStatusV3'
        :param dict [params.account]:  in case 'privatePostGetMyAccountStatusV3' is chosen, self can specify the account name(default is empty string)
        :returns dict: a `balance structure <https://docs.ccxt.com/?id=balance-structure>`
        Nr   methodprivatePostGetMyWalletBalancer  rB  r  )handle_param_stringr  rJ  r!  parse_balance)r=  rN  accountNamer   accountBalancer  rB  r  s           r?  fetch_balancezcex.fetch_balance  s      "66vy"MMV11&(Dcdd666!AA&IIIIIIIIH >>(FB77D~~d,A2FFH!^^Hk2FFNN!??GGGGGGGGH "^^HfbAAN!!.111r@  c                    d|i}t          |                                          }t          dt          |                    D ]h}||         }|                     ||i           }|                     |          }|                     |d          |                     |d          d}|||<   i|                     |          S )Nri  r   balanceOnHoldbalance)usedtotal)rt  ru  rv  rw  rJ  rp  ro  safe_balance)	r=  r  r
  ru  r  r  r)  rm  r  s	            r?  r#  zcex.parse_balance  s    H
 HMMOO$$q#d))$$ 	# 	#Aq'CnnXsB77G**3//D((/BB))'9== G #F4LL  (((r@  statusc                   K   |                                   d{V  i }|dk    }|rd|d<   d}| |                     |          }|d         |d<   |||d<   |||d<   n|r|                                 d	z
  |d<   d}	|                     |d
d          \  }	}|	|	|d<   |                     |                     ||                     d{V }
|                     |
dg           }|                     ||||          S )a  
        fetches information on multiple orders made by the user

        https://trade.cex.io/docs/#rest-private-api-calls-orders

        :param str status: order status to fetch for
        :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]: timestamp in ms of the latest entry
        :returns Order[]: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
        NclosedTarchivedr.  r  r  serverCreateTimestampFroml    P% r  r  serverCreateTimestampTorB  )r  r  r  r  privatePostGetMyOrdersr  rI  parse_orders)r=  r-  r  r  r   rN  r  isClosedOrdersr  r  r  rB  s               r?  fetch_orders_by_statuszcex.fetch_orders_by_status  sV      !!!!!!!!! H, 	'"&GJ[[((F$TlGFO"'GJ38G/00 	c373D3D3F3FIb3bG/033FGVLLv16G-.44T[[&5Q5QRRRRRRRRR ~~h33  vue<<<r@  c                 D   K   |                      d||||           d{V S )<  

        https://trade.cex.io/docs/#rest-private-api-calls-orders

        fetches information on multiple canceled orders made by the user
        :param str symbol: unified market symbol of the market orders were made in
        :param int [since]: timestamp in ms of the earliest order, default is None
        :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: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
        r/  Nr6  r=  r  r  r   rN  s        r?  fetch_closed_orderszcex.fetch_closed_orders  s7       0065%QWXXXXXXXXXr@  c                 D   K   |                      d||||           d{V S )r8  r  Nr9  r:  s        r?  fetch_open_orderszcex.fetch_open_orders'  s6       00vVVVVVVVVVr@  r.  c           	         K   |                                   d{V  dt          |          i}|                     |dd|                     ||                     d{V }|d         S )a  
        fetches information on an open order made by the user

        https://trade.cex.io/docs/#rest-private-api-calls-orders

        :param str id: order id
        :param str [symbol]: unified symbol of the market the order was made in
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
        NorderIdr   )r  intr=  r  r=  r.  r  rN  r  r
  s         r?  fetch_open_orderzcex.fetch_open_order5  s       !!!!!!!!!s2ww
 --fdD$++gW]B^B^________ayr@  c           	         K   |                                   d{V  dt          |          i}|                     |dd|                     ||                     d{V }|d         S )a  
        fetches information on an closed order made by the user

        https://trade.cex.io/docs/#rest-private-api-calls-orders

        :param str id: order id
        :param str [symbol]: unified symbol of the market the order was made in
        :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@  r;  r  rA  s         r?  fetch_closed_orderzcex.fetch_closed_orderG  s       !!!!!!!!!s2ww
 //dDKKPWY_D`D`aaaaaaaaayr@  c           	      F    ddddddddd}|                      |||          S )Nr  r/  expiredrejected	cancelingcanceled)PENDING_NEWNEWPARTIALLY_FILLEDFILLEDEXPIREDREJECTEDPENDING_CANCEL	CANCELLEDro  r=  r-  statusess      r?  parse_order_statuszcex.parse_order_statusY  s@    ! & ")#	
 	
 &&999r@  r  c           	         |                      |d          }|                      |d          }d }|
||dz   |z   }|                     ||          }|d         }|                     |                      |d                    }i }|                     |d          }	|	5|                      |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!|          S )"N	currency1	currency2r  r  r-  	feeAmountfeeCurrencyrC  r  serverCreateTimestamprequestedAmountCcy1executedAmountCcy1executedAmountCcy2r.  r?  clientOrderIdr  r  lastUpdateTimestamplastTradeTimestamprn  	orderTyper   postOnlyr  r  r   	stopPricerl  r  averagePricefilled)	remainingr-  rg  r  ri  )	ro  r  rU  ry  rp  r  
safe_orderr  r  )r=  r  r  rW  rX  r  r  r-  rg  rY  
currencyIdfeeCoder  requestedBaseexecutedBaseexecutedQuotes                   r?  parse_orderzcex.parse_orderf  s   B $$UK88	$$UK88	 Y%: 32H!!(F33!(()9)9%)J)JKK$$UK88	 ))%??J--j99G%C
O#CK%%e-DEE	((0EFF''/CDD((0DEE  
$""5)44 
T--e_EE 
  
 Y//	 

 "4#4#4U<Q#R#R 
 !$ 
 f 
 D**5+>> 
 4++E=AA 
  
 D**5&99 
 T%%eW55 
 D,,UK@@ 
 m 
 M 
  t''~>>! 
" l# 
$ - 
  
  
. /  	r@  rn  r  rl  r  c                 `  K   d}|                      |dd          \  }}|t          | j        dz             |                                  d{V  |                     |          }|                                 |d         |d         ||                     |                                          |                                | 	                                | 
                    ||          d}	d}
|                      |ddd	          \  }
}|d
k    r|                     ||          |	d<   |
|	d<   d}|                     |d          \  }}|
d|	d<   ||	d<   |                     |                     |	|                     d{V }|                     |d          }|                     ||          S )aT  
        create a trade order

        https://trade.cex.io/docs/#rest-private-api-calls-new-order

        :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 fulfilled, in units of the quote currency, ignored in market orders
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.accountId]: account-id to use(default is empty string)
        :param float [params.triggerPrice]: the price at which a trigger order is triggered at
        :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
        Nr=   	accountIdz createOrder() : API trading is now allowed from main account, set params["accountId"] or .options["createOrder"]["accountId"] to the name of your sub-accountr  r  )r_  rW  rX  rp  rb  r  r  
amountCcy1r   GTCr   r  r   z
Stop Limitrn  rd  rB  )r  r    r.  r  r  uuid
capitalizelowerupperr  amount_to_precisionprice_to_precisionr"  privatePostDoMyNewOrderr  rJ  rn  )r=  r  rn  r  rl  r  rN  rp  r  r  r   r   r  rB  s                 r?  create_orderzcex.create_order  s       	 99&-Q\]]	6#DG  /O  %O  P  P  P!!!!!!!!!V$$!YY[[)	*"66JJLL**,,2266BB	
 	
 ";;FMS`bghhV7??#66vuEEGG%0GM"#77OOf#*GFO#/GK 55dkk'66R6RSSSSSSSSb ~~h//f---r@  c                 ~  K   |                                   d{V  t          |          dt          |                                           z   |                                 d}|                     |                     ||                     d{V }|                     |di           }|                     |          S )a  
        cancels an open order

        https://trade.cex.io/docs/#rest-private-api-calls-cancel-order

        :param str id: order id
        :param str symbol: unified symbol of the market the order was made in
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: An `order structure <https://docs.ccxt.com/?id=order-structure>`
        Nc_)r?  cancelRequestIdr  rB  )r  r@  strr  privatePostDoCancelMyOrderr  rJ  rn  )r=  r.  r  rN  r  r  rB  s          r?  cancel_orderzcex.cancel_order  s       !!!!!!!!!2ww#c4+<+<+>+>&@&@@**,,
 

 88Wf9U9UVVVVVVVV ~~h33%%%r@  c                 x  K   |                                   d{V  |                     |           d{V }|                     |di           }|                     |dg           }g }t	          dt          |                    D ]!}||         }|                    d|i           "|                     |          S )a  
        cancel all open orders in a market

        https://trade.cex.io/docs/#rest-private-api-calls-cancel-all-orders

        :param str symbol: alpaca cancelAllOrders cannot setting symbol, it will cancel all open orders
        :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>`
        NrB  clientOrderIdsr   r_  )r  privatePostDoCancelAllOrdersrJ  rI  rv  rw  rD  r4  )	r=  r  rN  r  rB  idsordersr  r.  s	            r?  cancel_all_orderszcex.cancel_all_orders*  s       !!!!!!!!!::6BBBBBBBB ~~h33nnT#3R88q#c((## 	1 	1AQBMM?B/0000  (((r@  rm  c                   K   |                                   d{V  d}i }| |                     |          }|d         |d<   |||d<   |||d<   d}|                     |dd          \  }}|||d<   |                     |                     ||                     d{V }|                     |d	g           }	|                     |	|||          S )
a  
        fetch the history of changes, actions done by the user or operations that altered the balance of the user

        https://trade.cex.io/docs/#rest-private-api-calls-transaction-history

        :param str [code]: unified currency code
        :param int [since]: timestamp in ms of the earliest ledger entry
        :param int [limit]: max number of ledger entries to return
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: timestamp in ms of the latest ledger entry
        :returns dict: a `ledger structure <https://docs.ccxt.com/?id=ledger-entry-structure>`
        Nr.  rC  dateFromr  r  r  dateTorB  )r  rC  r  "privatePostGetMyTransactionHistoryr  rI  parse_ledger)
r=  rm  r  r   rN  rC  r  r  r  rB  s
             r?  fetch_ledgerzcex.fetch_ledgerH  s      !!!!!!!!!}}T**H"*4.GJ"'GJ"'GJ33FGVLLv %GH@@WV\A]A]^^^^^^^^  ~~h33  x>>>r@  itemrC  c                    |                      |d          }d }t          j        |d          rd}t          j        d|          }nd}|                      |d          }|                     ||          }|                     ||          }|                      |d          }|                     |          }|                      |d          }	|                     ||                      |d	          ||                      |d
d          d d |                     |	          || 	                    |          || 
                    |          d d d d d|          S )Nrl  0outz-1inrC  r  rn  transactionIdrp  r  )ri  r.  	directionr  referenceAccountreferenceIdrn  rC  rl  r  r  beforeafterr-  rg  )ro  r&   	string_le
string_mulsafe_currencyrp  r  safe_ledger_entryparse_ledger_entry_typerr  r  )
r=  r  rC  rl  r  ri  rm  timestampStringr  rn  s
             r?  parse_ledger_entryzcex.parse_ledger_entryv  sg   !!$11	VS)) 	I'f55FFI%%dJ77
%%j(;;&&z8<<**4==NN?33	f--%%""499"''k2>> $0066''//"Y//'
 '
  !  	r@  c                 <    dddd}|                      |||          S )Nr[  r]  rg  )r[  rd  
commissionrR  )r=  rn  
ledgerTypes      r?  r  zcex.parse_ledger_entry_type  s1     $
 


 
D$777r@  c                   K   |                                   d{V  i }d}||                     |          }|||d<   |||d<   d}|                     |dd          \  }}|||d<   |                     |                     ||                     d{V }|                     |dg           }	|                     |	|||          S )an  
        fetch history of deposits and withdrawals

        https://trade.cex.io/docs/#rest-private-api-calls-funding-history

        :param str [code]: unified currency code for the currency of the deposit/withdrawals, default is None
        :param int [since]: timestamp in ms of the earliest deposit/withdrawal, default is None
        :param int [limit]: max number of deposit/withdrawals to return, default is None
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a list of `transaction structure <https://docs.ccxt.com/?id=transaction-structure>`
        Nr  r  r  r  r  rB  )r  rC  r  privatePostGetMyFundingHistoryr  rI  parse_transactions)
r=  rm  r  r   rN  r  rC  r  r  rB  s
             r?  fetch_deposits_withdrawalszcex.fetch_deposits_withdrawals  s      !!!!!!!!!}}T**H"'GJ"'GJ33FGVLLv %GH<<T[[RX=Y=YZZZZZZZZ& ~~h33&&tXueDDDr@  transactionc                 X   |                      |d          }|                      |d          }|dk    rdn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S )NrC  r  rd  r]  r[  	updatedAtri  r.  txIdtxidrn  re  rl  r-  r  r  addressaddressFrom	addressTotagtagFromtagToupdatedcommissionAmount)rC  r  )commentrg  internal)ro  rp  r  ry  parse_transaction_statusr  )	r=  r  rC  ri  r  rn  rm  r  r  s	            r?  parse_transactionzcex.parse_transaction  s   %%k:>>
$$[+>>	 )Z 7 7||i&&z8<<$$[+>>	NN9--	
K
$"";77
 D
 D	

 
 t
 d&&{H==
 d33D4D4D[RZ4[4[\\
 
 Y//
 t
 4
 
 4
 t
  T!
" t#
$  ((6HII  /
 
 
 	
r@  c                 <    dddd}|                      |||          S )NrG  pendingok)rG  r  approvedrR  rS  s      r?  r  zcex.parse_transaction_status  s1    " 
 

 &&999r@  fromAccount	toAccountc                    K   d}|dk    r&|dk    r |                      |||||           d{V }n|                     |||||           d{V }|                     ddd          }|r
||d<   ||d<   |S )a+  
        transfer currency internally between wallets on the same account

        https://trade.cex.io/docs/#rest-private-api-calls-internal-transfer

        :param str code: unified currency code
        :param float amount: amount to transfer
        :param str fromAccount: 'SPOT', 'FUND', or 'CONTRACT'
        :param str toAccount: 'SPOT', 'FUND', or 'CONTRACT'
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `transfer structure <https://docs.ccxt.com/?id=transfer-structure>`
        Nr  r   fillResponseFromRequestTr  r  )transfer_between_sub_accounts%transfer_between_main_and_sub_accounthandle_option)r=  rm  rl  r  r  rN  r   r  s           r?  r   zcex.transfer  s       ??{b00!??fk[dflmmmmmmmmHH!GGfVaclntuuuuuuuuH"&"4"4ZAZ\`"a"a" 	.&1H]#$-H[!r@  c                 0  K   |                                   d {V  |                     |          }|dk    }|r|n|}|                     |d|                                           }	|d         |                     ||          ||	d}
d }|r0|                     |                     |
|                     d {V }n/|                     |                     |
|                     d {V }|                     |di           }| 	                    ||          S )Nr  guidr.  )rC  rl  rp  
clientTxIdrB  )
r  rC  ro  rs  currency_to_precision#privatePostDoDepositFundsFromWalletr  $privatePostDoWithdrawalFundsToWalletrJ  parse_transfer)r=  rm  rl  r  r  rN  rC  fromMaintargetAccountr  r  r  rB  s                r?  r  z)cex.transfer_between_main_and_sub_account  sG     !!!!!!!!!==&&2%%->		;		<< 00v>>&	
 
  	e!EEdkkRY[aFbFbccccccccHH!FFt{{SZ\bGcGcddddddddH ~~h33""4222r@  c                 ^  K   |                                   d {V  |                     |          }|d         |                     ||          ||d}|                     |                     ||                     d {V }|                     |di           }	|                     |	|          S )Nr.  )rC  rl  fromAccountIdtoAccountIdrB  )r  rC  r  privatePostDoMyInternalTransferr  rJ  r  )
r=  rm  rl  r  r  rN  rC  r  r  rB  s
             r?  r  z!cex.transfer_between_sub_accounts/  s      !!!!!!!!!==&& 00v>>($	
 
 ==dkk'SY>Z>Z[[[[[[[[ ~~h33""4222r@  r   c                     |                      |d          }|                     ||          }||                     |dd          d d |d d d |                     |                      |d                    d	S )NrC  r  r  r-  )	ri  r.  r  r  rC  rl  r  r  r-  )ro  rp  safe_string_2r  )r=  r   rC  ri  currencyCodes        r?  r  zcex.parse_transferD  s    . %%h
;;
..z8DD$$XMM$33D4D4DXx4X4XYY

 

 
	
r@  c                   K   d}|                      |dd          \  }}|t          | j        dz             |                                  d{V  d}|                     |          \  }}|                     |          }||d         |                     |          d}|                     |                     ||                     d{V }| 	                    |di           }| 
                    ||          S )a  
        fetch the deposit address for a currency associated with self account

        https://trade.cex.io/docs/#rest-private-api-calls-deposit-address

        :param str code: unified currency code
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.accountId]: account-id(default to empty string) to refer to(at self moment, only sub-accounts allowed by exchange)
        :returns dict: an `address structure <https://docs.ccxt.com/?id=address-structure>`
        Nr=   rp  z fetchDepositAddress() : main account is not allowed to fetch deposit address from api, set params["accountId"] or .options["createOrder"]["accountId"] to the name of your sub-accountr.  )rp  rC  
blockchainrB  )r  r    r.  r  handle_network_code_and_paramsrC  network_code_to_idprivatePostGetDepositAddressr  rJ  parse_deposit_address)	r=  rm  rN  rp  r  rC  r  r  rB  s	            r?  fetch_deposit_addresszcex.fetch_deposit_addressi  s1      	 99&-Q\]]	6#DG  /h  %h  i  i  i!!!!!!!!!"AA&IIV==&&" 11+>>
 

 ::4;;wPV;W;WXXXXXXXX ~~h33))$999r@  c                    |                      |d          }|                      |d          }|                     ||          }|                     |           ||d         |                     |                      |d                    |d dS )Nr  rC  rm  r  )ri  rC  re  r  r  )ro  r  check_addressrx  )r=  depositAddressrC  r  ri  s        r?  r  zcex.parse_deposit_address  s    "">9==%%njAA
%%j(;;7###" (..t/?/?P\/]/]^^
 
 	
r@  r   GETc                    | j         d         |         dz   |                     ||          z   }|                     ||                     |                    }|dk    r>|dk    r|r|d|                     |          z   z  }n|                     |          }ddi}n|                                  t          |                                           }	|                     |          }||	z   |z   }
| 	                    | 
                    |
          | 
                    | j                  t          j        d          }d| j        |	|d	}||||d
S )Nr   r  r   r  ?Content-Typezapplication/jsonbase64)r  z
X-AGGR-KEYzX-AGGR-TIMESTAMPzX-AGGR-SIGNATURE)urlr   bodyheaders)r4  implode_paramsomitextract_params	urlencodejsoncheck_required_credentialsr~  secondshmacencodesecrethashlibsha256apiKey)r=  pathr   r   rN  r  r  r  queryr  auth	signatures               r?  signzcex.sign  sN   is#c)D,?,?f,M,MM		&$"5"5d";";<<(?? 73!6!666Cyy''"$6 ++---$,,..))G99U##D'>D(D		$++d"3"3T[[5M5Mw~_ghhI 2"k$+$-	 G fdwOOOr@  reasonr  r   r  r  c
                    |j|t          | j        dz             |d         dk    r+|                     |          }
|                     |
          }nt          | j        dz   |z             |                     |d          }|`| j        dz   |z   }|                     | j        d         ||           |                     | j        d         ||           t          |          |	                    d	          dk    rk| 
                    |d
i           }|                     |d          }|<|                     | j        d         ||           t          | j        dz   |z             d S )Nz returned empty responser   {z returned unparsed response: error r   r   r   rB  rejectReasonz createOrder() )r$   r.  fix_stringified_json_members
parse_jsonro  throw_exactly_matched_exceptionr7  throw_broadly_matched_exceptionr   findrJ  )r=  rm  r  r  r   r  r  r  requestHeadersrequestBodyfixedr  feedbackrB  r  s                  r?  handle_errorszcex.handle_errors  st    |"47-G#GHHHaC99$????511"47-L#Lt#STTT  733w}t+H001I5RZ[[[001I5RZ[[[)))88%&&!++>>(FB77D++D.AAL'44T_W5M|]ijjj#DG.?$?,$NOOOtr@  )N)F)N__name__
__module____qualname__r   r<  r   rT  dictr	   r  r   r   r  r  r   r  r~  r   r  r   r   r  r  r   r  r  r   r  rt  r  r  r   r  r  r   r  r   r  r  r   r&  r#  r   r   r6  r;  r=  rB  rD  rU  rn  r   r   floatr   rz  r  r  r   r  r  r  r   r  r  r  r   r   r  r  r  r
   r  r  r  r@  r  __classcell__)r>  s   @r?  r(   r(      s	       c# c c c c c cJ	 -/ 4: 4:: 4: 4: 4: 4:l9$ 98 9 9 9 9v *,  (  (V  (  (  (  (D:4 :F : : : :x ')  S    ( 68 4 4 4F 4 4 4 4 6:" *1 *17 *1 *1 *1 *1 *1X 4  6    2 <@d[] ,? ,? ,?S ,? ,?bfglbm ,? ,? ,? ,?\  v     > @DB %M %MS %M %MS\ %M %M %M %MN ?CQUdhqs ;H ;H ;H ;H3 ;H^a ;Hx|  ~B  yC ;H ;H ;H ;Hz
 
 
4 
 
 
 
 /1 3 3[ 3 3 3 32     "
 
T 
6 
EX 
 
 
 
 +- 3 3g 3 3 3 38
T 
g 
 
 
 
 *, 12 12 12 12 12 12f) ) ) ) )  GKY]lpy{ L= L=3 L= L=SV L=fi L=  AE  FK  AL L= L= L= L=\ 7;\`ik Y Y Y3 YVY Y Y Y Y 59tZ^gi W Wc W WTW W W W W =A   c    $ ?C2  3     $: : : : :L L Lv L L L L L\ mqy{ \. \. \.I \.Y \.X] \.fi \. \. \. \.| 9=R & &S &# & & & &0 59 ) )c ) ) ) )< .2SW`b ,? ,?s ,?# ,?S ,?gklwgx ,? ,? ,? ,?\ t x ;    @8 8 8 <@daenp -E -ES -E -E[^ -Euy  {F  vG -E -E -E -E^
 
T 
X 
Q\ 
 
 
 
B:s : : : : ac  3  C TW gt    0 ~@ 3 3 3U 3ad 3qt 3  ER 3 3 3 3B vx 3 3 3U 3Y\ 3il 3  }J 3 3 3 3*#
 #
t #
x #
= #
 #
 #
 #
J =? %: %: %:> %: %: %: %:N
 
h 
R` 
 
 
 
 &eBSW P P P P4# s  c TX `c        r@  r(   ). ccxt.async_support.base.exchanger   ccxt.abstract.cexr   rG  r  ccxt.base.typesr   r   r   r   r	   r
   r   r   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#   r$   ccxt.base.decimal_to_precisionr%   ccxt.base.preciser&   r(   r  r@  r?  <module>r     so   6 5 5 5 5 5 ) ) ) ) ) )   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  D  D       * * * * * * 0 0 0 0 0 0 - - - - - - . . . . . . ' ' ' ' ' ' . . . . . . . . . . . . ) ) ) ) ) ) 4 4 4 4 4 4 % % % % % %x x x x x(K x x x x xr@  