
    eie&                    ,   d dl mZ d dlmZ d dlZd dlmZmZmZm	Z	m
Z
mZmZmZ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    F/var/www/html/volatility/venv/lib/python3.11/site-packages/ccxt/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                    g }|                     |                     |                     |                     |                     |                     |}|                     |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
        r   datar   currency)	appendpublicPostGetCurrenciesInfopublicPostGetProcessingInfo	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, 		!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)rY  withdraw)
r.  networkr1   rY  rb  activefeerW  limitsinfowalletDepositwalletWithdrawal)amountrb  )r.  coder/  typerd  rY  rb  re  rW  rf  r   rg  )safe_stringsafe_currency_code	safe_boolparse_numberparse_precisionrH  listkeysrangelennetwork_id_to_codesafe_numbersafe_currency_structure)r=  rS  r.  rk  rl  currencyPrecisionr   rawNetworksrs  j	networkId
rawNetworknetworkCoderY  rb  s                  r?  parse_currencyzcex.parse_currencyt  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                     |                      |          }|                     |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
        rB  )publicPostGetPairsInforG  parse_markets)r=  rL  responserB  s       r?  fetch_marketszcex.fetch_markets  sB     ..v66, ~~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settleIdrl  r0   Tr1   Fr2   r3   r4   contractr   r   baseMinbaseMaxr^  minPricemaxPricequoteMinquoteMax)rj  pricecostr   baseLotSizepricePrecisionbasePrecisionquotePrecision)rj  r  r  r  )
contractSizeexpiryexpiryDatetimestrike
optionTyperf  rW  rd  createdrg  )rm  rn  safe_market_structurerw  rp  rq  )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                     |                      |          }|                     |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
        rB  	timestamp)publicPostGetServerTimerH  safe_integer)r=  rL  r  rB  r  s        r?  
fetch_timezcex.fetch_time  sG     //77 ~~h//%%dK88	r@  r  c                     |                                   |                     |g|          }|                     ||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>`
        )load_marketsfetch_tickersrH  )r=  r  rL  r  s       r?  fetch_tickerzcex.fetch_ticker!  sC     	%%vh77~~h333r@  Nsymbolsc                    |                                   i }||                     |          |d<   |                     |                     ||                    }|                     |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extendrH  parse_tickers)r=  r  rL  requestr  rB  s         r?  r  zcex.fetch_tickers/  s     	#w77GG++DKK,H,HII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  rg  )rm  safe_symbolsafe_tickerrw  )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                    |                                   |                     |          }d|d         i}||                     |          |d<   d}|                     |dd          \  }}||                     |          |d<   |t	          |d          |d	<   |                     |                     ||                    }|                     |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>`
        pairr.  NfromDateISOuntiltill	toDateISOi'  pageSizerB  trades)
r  r  iso8601handle_param_integer_2r_  publicPostGetTradeHistoryr  rH  rG  parse_trades)r=  r  r  r   rL  r  r  r  r  rB  r  s              r?  fetch_tradeszcex.fetch_tradest  s    	V$$F4L
 %)\\%%8%8GM"33FGVLLv#'<<#6#6GK "%eU"3"3GJ11$++gv2N2NOO  ~~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  rj  )rg  r  r  r  r.  orderrl  takerOrMakerr  r  rj  r  re  )rm  	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                 N   |                                   |                     |          }d|d         i}|                     |                     ||                    }|                     |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
        r  r.  rB  r  r  )r  r  publicPostGetOrderBookr  rH  r  parse_order_book)	r=  r  r   rL  r  r  r  	orderBookr  s	            r?  fetch_order_bookzcex.fetch_order_book  s     	V$$F4L
 ..t{{7F/K/KLL& NN8VR88	%%i==	$$Yx0@)LLLr@  r   	timeframec                    d}|                      |dd          \  }}|t          | j        dz             |                                  |                     |          }|d         | j        |         |d}||                     |          |d<   d}	|                     |dd	          \  }	}|	|                     |	          |d
<   n,|*|                     |                                           |d
<   ||	|t          | j        dz             ||	|t          | j        dz             |||d<   | 	                    | 
                    ||                    }
|                     |
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  rG  parse_ohlcvs)r=  r  r  r  r   rL  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,,T[[&-I-IJJ$ ~~h33  vy%GGGr@  c           	         |                      |d          |                     |d          |                     |d          |                     |d          |                     |d          |                     |d          gS )Nr  r  r  r  r  r  )r  rw  )r=  ohlcvr  s      r?  parse_ohlcvzcex.parse_ohlcv%  s~    e[11UF++UF++UE**UG,,UH--
 	
r@  c                     |                                   |                     |          }|                     |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
        rB  
tradingFeeT)r  privatePostGetMyCurrentFeerH  parse_trading_fees)r=  rL  r  rB  r   s        r?  fetch_trading_feeszcex.fetch_trading_fees/  sk     	226:: ~~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  )rr  rs  rt  ru  r  parse_trading_feer  r  )
r=  r  
useKeyAsIdresultrs  ikeyr  parsedr  s
             r?  r  zcex.parse_trading_feesH  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@  re  c                     ||                      |d          |                     |d          |                     |d          d d dS )Nr  percent)rg  r  makertakerr  	tierBased)rm  rw  )r=  re  r  s      r?  r  zcex.parse_trading_feeY  sS    &&vx88%%c955%%c955
 
 	
r@  c                    |                                   |                     |          }|                     |di           }|                     |di           }|                     |          }|                     ||          S )NrB  balancesPerAccounts)r  privatePostGetMyAccountStatusV3rH  rK  parse_accounts)r=  rL  r  rB  balancesarrayss         r?  fetch_accountszcex.fetch_accountsc  s{    77??* ~~h33>>$(=rBBx((""66222r@  accountc                     d d d |dS )N)r.  rl  rk  rg   )r=  r  s     r?  parse_accountzcex.parse_account  s    	
 
 	
r@  c                    d}|                      |dd          \  }}d}|                      |dd          \  }}d}|dk    r[|                     |          }|                     |di           }|                     |di           }|                     ||i           }n,|                     |          }|                     |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  rH  r  parse_balance)r=  rL  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;;FCCH >>(FB77D~~d,A2FFH!^^Hk2FFNN99&AAH "^^HfbAAN!!.111r@  c                    d|i}t          |                                          }t          dt          |                    D ]h}||         }|                     ||i           }|                     |          }|                     |d          |                     |d          d}|||<   i|                     |          S )Nrg  r   balanceOnHoldbalance)usedtotal)rr  rs  rt  ru  rH  rn  rm  safe_balance)	r=  r  r  rs  r	  r
  r'  rk  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                    |                                   i }|dk    }|rd|d<   d}| |                     |          }|d         |d<   |||d<   |||d<   n|r|                                 d	z
  |d<   d}	|                     |d
d          \  }	}|	|	|d<   |                     |                     ||                    }
|                     |
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>`
        closedTarchivedNr.  r  r  serverCreateTimestampFroml    P% r  r  serverCreateTimestampTorB  )r  r  r  r  privatePostGetMyOrdersr  rG  parse_orders)r=  r+  r  r  r   rL  r  isClosedOrdersr  r  r  rB  s               r?  fetch_orders_by_statuszcex.fetch_orders_by_status  s.    	 H, 	'"&GJ[[((F$TlGFO"'GJ38G/00 	c373D3D3F3FIb3bG/033FGVLLv16G-...t{{7F/K/KLLR ~~h33  vue<<<r@  c                 4    |                      d||||          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-  r4  r=  r  r  r   rL  s        r?  fetch_closed_orderszcex.fetch_closed_orders  s      **8VUE6RRRr@  c                 4    |                      d||||          S )r6  r  r7  r8  s        r?  fetch_open_orderszcex.fetch_open_orders&  s      **665%PPPr@  r.  c           	          |                                   dt          |          i}|                     |dd|                     ||                    }|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>`
        orderIdNr   )r  intr;  r  r=  r.  r  rL  r  r  s         r?  fetch_open_orderzcex.fetch_open_order4  s\     	s2ww
 ''dDKKQW<X<XYYayr@  c           	          |                                   dt          |          i}|                     |dd|                     ||                    }|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>`
        r=  Nr   )r  r>  r9  r  r?  s         r?  fetch_closed_orderzcex.fetch_closed_orderF  s\     	s2ww
 ))&$dkk'SY>Z>Z[[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rm  r=  r+  statusess      r?  parse_order_statuszcex.parse_order_statusX  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lastTradeTimestamprl  	orderTyper   postOnlyr  r  r   	stopPricerj  r  averagePricefilled)	remainingr+  re  r  rg  )	rm  r  rS  rw  rn  r  
safe_orderr  r  )r=  r  r  rU  rV  r  r  r+  re  rW  
currencyIdfeeCoder  requestedBaseexecutedBaseexecutedQuotes                   r?  parse_orderzcex.parse_ordere  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@  rl  r  rj  r  c                 D   d}|                      |dd          \  }}|t          | j        dz             |                                  |                     |          }|                                 |d         |d         ||                     |                                          |                                | 	                                | 
                    ||          d}	d}
|                      |ddd	          \  }
}|d
k    r|                     ||          |	d<   |
|	d<   d}|                     |d          \  }}|
d|	d<   ||	d<   |                     |                     |	|                    }|                     |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]  rU  rV  rn  r`  r  r  
amountCcy1r   GTCr   r  r   z
Stop Limitrl  rb  rB  )r  r    r.  r  r  uuid
capitalizelowerupperr  amount_to_precisionprice_to_precisionr   privatePostDoMyNewOrderr  rH  rl  )r=  r  rl  r  rj  r  rL  rn  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 //GV0L0LMMb ~~h//f---r@  c                 b   |                                   t          |          dt          |                                           z   |                                 d}|                     |                     ||                    }|                     |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>`
        c_)r=  cancelRequestIdr  rB  )r  r>  strr  privatePostDoCancelMyOrderr  rH  rl  )r=  r.  r  rL  r  r  rB  s          r?  cancel_orderzcex.cancel_order  s     	2ww#c4+<+<+>+>&@&@@**,,
 

 224;;w3O3OPP ~~h33%%%r@  c                 \   |                                   |                     |          }|                     |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>`
        rB  clientOrderIdsr   r]  )r  privatePostDoCancelAllOrdersrH  rG  rt  ru  rD  r2  )	r=  r  rL  r  rB  idsordersr	  r.  s	            r?  cancel_all_orderszcex.cancel_all_orders)  s     	44V<< ~~h33nnT#3R88q#c((## 	1 	1AQBMM?B/0000  (((r@  rk  c                    |                                   d}i }| |                     |          }|d         |d<   |||d<   |||d<   d}|                     |dd          \  }}|||d<   |                     |                     ||                    }|                     |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  rG  parse_ledger)
r=  rk  r  r   rL  rC  r  r  r  rB  s
             r?  fetch_ledgerzcex.fetch_ledgerG  s     	}}T**H"*4.GJ"'GJ"'GJ33FGVLLv %GH::4;;wPV;W;WXX  ~~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 )Nrj  0outz-1inrC  r  rl  transactionIdrn  r  )rg  r.  	directionr  referenceAccountreferenceIdrl  rC  rj  r  r  beforeafterr+  re  )rm  r&   	string_le
string_mulsafe_currencyrn  r  safe_ledger_entryparse_ledger_entry_typerp  r  )
r=  r  rC  rj  r  rg  rk  timestampStringr  rl  s
             r?  parse_ledger_entryzcex.parse_ledger_entryu  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 )NrY  r[  re  )rY  rb  
commissionrP  )r=  rl  
ledgerTypes      r?  r  zcex.parse_ledger_entry_type  s1     $
 


 
D$777r@  c                 r   |                                   i }d}||                     |          }|||d<   |||d<   d}|                     |dd          \  }}|||d<   |                     |                     ||                    }|                     |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  rG  parse_transactions)
r=  rk  r  r   rL  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66t{{7F7S7STT& ~~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  rb  r[  rY  	updatedAtrg  r.  txIdtxidrl  rc  rj  r+  r  r  addressaddressFrom	addressTotagtagFromtagToupdatedcommissionAmount)rC  r  )commentre  internal)rm  rn  r  rw  parse_transaction_statusr  )	r=  r  rC  rg  r  rl  rk  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 )NrE  pendingok)rE  r  approvedrP  rQ  s      r?  r  zcex.parse_transaction_status  s1    " 
 

 &&999r@  fromAccount	toAccountc                     d}|dk    r |dk    r|                      |||||          }n|                     |||||          }|                     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=  rk  rj  r  r  rL  r   r  s           r?  r   zcex.transfer  s     ??{b0099$U^`fggHHAA$P[]fhnooH"&"4"4ZAZ\`"a"a" 	.&1H]#$-H[!r@  c                    |                                   |                     |          }|dk    }|r|n|}|                     |d|                                           }	|d         |                     ||          ||	d}
d }|r*|                     |                     |
|                    }n)|                     |                     |
|                    }|                     |di           }| 	                    ||          S )Nr  guidr.  )rC  rj  rn  
clientTxIdrB  )
r  rC  rm  rq  currency_to_precision#privatePostDoDepositFundsFromWalletr  $privatePostDoWithdrawalFundsToWalletrH  parse_transfer)r=  rk  rj  r  r  rL  rC  fromMaintargetAccountr  r  r  rB  s                r?  r  z)cex.transfer_between_main_and_sub_account  s   ==&&2%%->		;		<< 00v>>&	
 
  	_??GU[@\@\]]HH@@WV\A]A]^^H ~~h33""4222r@  c                 B   |                                   |                     |          }|d         |                     ||          ||d}|                     |                     ||                    }|                     |di           }	|                     |	|          S )Nr.  )rC  rj  fromAccountIdtoAccountIdrB  )r  rC  r  privatePostDoMyInternalTransferr  rH  r  )
r=  rk  rj  r  r  rL  rC  r  r  rB  s
             r?  r  z!cex.transfer_between_sub_accounts.  s    ==&& 00v>>($	
 
 77GV8T8TUU ~~h33""4222r@  r   c                     |                      |d          }|                     ||          }||                     |dd          d d |d d d |                     |                      |d                    d	S )NrC  r  r  r+  )	rg  r.  r  r  rC  rj  r  r  r+  )rm  rn  safe_string_2r  )r=  r   rC  rg  currencyCodes        r?  r  zcex.parse_transferC  s    . %%h
;;
..z8DD$$XMM$33D4D4DXx4X4XYY

 

 
	
r@  c                    d}|                      |dd          \  }}|t          | j        dz             |                                  d}|                     |          \  }}|                     |          }||d         |                     |          d}|                     |                     ||                    }| 	                    |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=   rn  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.  )rn  rC  
blockchainrB  )r  r    r.  r  handle_network_code_and_paramsrC  network_code_to_idprivatePostGetDepositAddressr  rH  parse_deposit_address)	r=  rk  rL  rn  r~  rC  r  r  rB  s	            r?  fetch_deposit_addresszcex.fetch_deposit_addressh  s    	 99&-Q\]]	6#DG  /h  %h  i  i  i"AA&IIV==&&" 11+>>
 

 44T[[&5Q5QRR ~~h33))$999r@  c                    |                      |d          }|                      |d          }|                     ||          }|                     |           ||d         |                     |                      |d                    |d dS )Nr  rC  rk  r  )rg  rC  rc  r  r  )rm  r  check_addressrv  )r=  depositAddressrC  r  rg  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  rL  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_jsonrm  throw_exactly_matched_exceptionr7  throw_broadly_matched_exceptionr   findrH  )r=  rk  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   rR  dictr	   r  r   r   r  r  r   r  r|  r   r  r   r   r  r  r   r  r  r   r  rr  r  r  r   r  r  r   r  r   r  r  r   r$  r!  r   r   r4  r9  r;  r@  rB  rS  rl  r   r   floatr   rx  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:Z 4: 4: 4: 4:l9$ 98 9 9 9 9v $&  (  ($v,  (  (  (  (D:4 :F : : : :x !#  s    ( 02 4 43 4f 4 4 4 4 04B *1 *1W *17 *1 *1 *1 *1X 4  6    2 6:UW ,? ,?3 ,?s ,?# ,?\`af\g ,? ,? ,? ,?\  v     > :>b %M %Ms %M3 %MY %M %M %M %MN 9=4^bkm ;H ;H# ;H# ;HS ;HX[ ;Hrvw{r| ;H ;H ;H ;Hz
 
 
4 
 
 
 
 )+ 3 3{ 3 3 3 32     "
 
T 
6 
EX 
 
 
 
 %' 3 34= 3 3 3 38
T 
g 
 
 
 
 $& 12 12( 12 12 12 12f) ) ) ) )  AESWfjsu L= L=S L=# L=S L=`c L=z~  @E  {F L= L= L= L=\ 154VZce S S# SS SPS S S S S /3TXac Q Q Q3 Qc Q Q Q Q 7;2  3     $ 9=R  S #    $: : : : :L L Lv L L L L L\ gksu \. \.3 \.i \.y \.RW \.`c \. \. \. \.| 37r & &s &C & & & &0 /32 ) ) ) ) ) )< (,$TZ\ ,? ,? ,?C ,?s ,?aefqar ,? ,? ,? ,?\ t x ;    @8 8 8 6:[_hj -E -Es -E# -EUX -Eost  pA -E -E -E -E^
 
T 
X 
Q\ 
 
 
 
B:s : : : : []  S % c c an    0 xz 3 3# 3u 3[^ 3kn 3  L 3 3 3 3B pr 3 3# 3u 3SV 3cf 3  wD 3 3 3 3*#
 #
t #
x #
= #
 #
 #
 #
J 79 %: %:# %:^ %: %: %: %:N
 
h 
R` 
 
 
 
 &eBSW P P P P4# s  c TX `c        r@  r(   )-ccxt.base.exchanger   ccxt.abstract.cexr   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     sf   ( ' ' ' ' ' ) ) ) ) ) )  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@  