
    i                    P   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 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# 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BalancesCurrencyIntMarketNumOrder	OrderBookOrderRequest	OrderSide	OrderTypeStrStringsTickerTickersTradeTransaction)List)ExchangeError)AuthenticationError)PermissionDenied)AccountNotEnabled)ArgumentsRequired)
BadRequest)	BadSymbol)InsufficientFunds)InvalidOrder)NotSupported)DDoSProtection)OnMaintenance)InvalidNonce)	TICK_SIZE)Precisec                       e Zd Z fdZi fdee         fdZdi fdedefdZ	i fde
defdZdddi fded	ed
edee         fdZddi fde
d	ed
edee         fdZdddi fde
d	ed
edee         fdZdi fde
d
edefdZdefdZi fdefdZdi fde
defdZdi fde
dedededef
dZdi fde
dedededef
dZ i fdee!         fdZ"di fde
dedededef
dZ#di fdefdZ$di fde
defdZ%di fdefdZ&dddi fded	ed
edee         fd Z'dddi fded	ed
efd!Z(d" Z)di fd#e
defd$Z*i fd#e
fd%Z+i fd#e
fd&Z,d' Z-dddi fd#ed	ed
edee.         fd(Z/dddi fd#ed	ed
edee.         fd)Z0dLd*edefd+Z1dLd*edefd,Z2dLd*edefd-Z3d. Z4d/ Z5dLd*edefd0Z6d1 Z7d2 Z8dLd3e9de.fd4Z:i fd5Z;dLd3e9fd6Z<di fd7efd8Z=dddi fd#ed	ed
efd9Z>dLd3e9fd:Z?d; Z@i fdeeA         fd<ZBd= ZCdddi fded	ed
efd>ZDd? ZEd@ ZFdddi fded	ed
efdAZGi fde
fdBZHdi fdefdCZIdLd*efdDZJdE ZKdF ZLdi fde
dedefdGZMdHdIi ddfdJZNdK ZO xZPS )M	cryptocomc                    |                      t          t          |                                           i ddddddg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(d)dd*dd+dd,dd-dd.dd/dd0d(d1dd2di d3dd4dd5dd6dd7dd8dd9dd:dd;dd<dd=dd>dd?dd@ddAddBddCdi dDddEddFddGddHddIddJddKddLddMddNddOddPddQddRddSddTddddddddddddddddUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdgdhdidjdkdhdldmdndog dpdqdrdsdtdududvdvdvdvdvdudvdw	idxi dydudzdud{dud|dud}dud~ddduddddudddduddddudddddduddudududududududududud	iddtdvdvdvdvdvdvdvdvdvd	idxi dydudzduddudduddudduddudduddudduddud~dddddddudduddudddudududududddudududiddtdududvdvdvdvdvdudvdw	idxi dydudzdud{dud|dud}dud~ddduddddudddduddudddduddddddudududududiddhdd|                     d          |                     d          |                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          gg	|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          gg	ddidddddddddddddddÜdddidt
          di dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          i dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          t          t          t          t          t           di d          S )Nidr'   namez
Crypto.com	countriesMTversionv2	rateLimit
   	certifiedTprohasCORSFspotmarginswapfutureoption	addMargincancelAllOrderscancelOrdercancelOrderscloseAllPositionsclosePositioncreateMarketBuyOrderWithCostcreateMarketOrderWithCostcreateMarketSellOrderWithCostcreateOrdercreateOrdersfetchAccountsfetchBalancefetchBidsAsksfetchBorrowInterestfetchBorrowRateHistoriesfetchBorrowRateHistoryfetchClosedOrdersemulatedfetchCrossBorrowRatefetchCrossBorrowRatesfetchCurrenciesfetchDepositAddressfetchDepositAddressesByNetworkfetchDepositsfetchDepositsWithdrawalsfetchDepositWithdrawFeefetchDepositWithdrawFeesfetchFundingHistoryfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchGreeksfetchIndexOHLCVfetchIsolatedBorrowRatefetchIsolatedBorrowRatesfetchLedgerfetchLeveragefetchLeverageTiersfetchMarginAdjustmentHistoryfetchMarginModefetchMarketLeverageTiersfetchMarketsfetchMarkOHLCVfetchMySettlementHistoryfetchMyTrades
fetchOHLCVfetchOpenOrders
fetchOrderfetchOrderBookfetchOrdersfetchPositionfetchPositionModefetchPositionsfetchPremiumIndexOHLCVfetchSettlementHistoryfetchStatusfetchTickerfetchTickers	fetchTimefetchTradesfetchTradingFeefetchTradingFees)fetchTransactionFeesfetchTransactionsfetchTransfersfetchUnderlyingAssetsfetchVolatilityHistoryfetchWithdrawalsreduceMarginrepayCrossMarginrepayIsolatedMarginsetLeveragesetMarginModesetPositionModetransferwithdraw
timeframes1m5m15m30m1h4h6h12h1D7D14D1M)r   r   r   r   r   r   r   r   1d1w2wr   urlszehttps://user-images.githubusercontent.com/1294454/147792121-38ed5e36-c229-48d6-b49a-48d05fc19ed4.jpegz#https://uat-api.3ona.co/exchange/v1zhttps://uat-api.3ona.co/v2)v1r.   derivativesz"https://api.crypto.com/exchange/v1zhttps://api.crypto.com/v2zhttps://deriv-api.crypto.com/v1zhttps://crypto.com/z"https://crypto.com/exch/kdacthrnxtg333333?)urldiscount)z?https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.htmlz0https://exchange-docs.crypto.com/spot/index.htmlz7https://exchange-docs.crypto.com/derivatives/index.htmlz0https://crypto.com/exchange/document/fees-limits)logotestapiwwwreferraldocfeesr   getg
@   )	public/authpublic/get-instrumentspublic/get-bookpublic/get-candlestickpublic/get-tradeszpublic/get-tickerszpublic/get-valuationsz#public/get-expired-settlement-pricezpublic/get-insurancepostz private/set-cancel-on-disconnectz private/get-cancel-on-disconnectzprivate/user-balancezprivate/user-balance-historyzprivate/get-positionszprivate/create-ordergUUUUUU?zprivate/create-order-listzprivate/cancel-orderzprivate/cancel-order-listzprivate/cancel-all-orderszprivate/close-positionzprivate/get-order-historyd   zprivate/get-open-ordersprivate/get-order-detailgUUUUUU?private/get-tradeszprivate/change-account-leverageprivate/get-transactions)	"private/create-subaccount-transferprivate/get-subaccount-balancesprivate/get-order-listprivate/create-withdrawalprivate/get-currency-networksprivate/get-deposit-addressprivate/get-accountsprivate/get-withdrawal-historyprivate/get-deposit-history)publicprivate)	r   r   r   r   zpublic/get-tickerr   z%public/margin/get-transfer-currenciesz!public/margin/get-load-curreniceszpublic/respond-heartbeatr   r   r   r   r   z$private/export/create-export-requestz"private/export/get-export-requestsz%private/export/download-export-outputzprivate/get-account-summary)r   r   r   r   r   zprivate/otc/get-otc-userzprivate/otc/get-instrumentszprivate/otc/request-quotezprivate/otc/accept-quotezprivate/otc/get-quote-historyzprivate/otc/get-trade-historyzprivate/otc/create-orderzprivate/convert-collateral)r   r   r   r   r   tradingz0.004025000z0.003550000z0.0015100000z0.001250000z0.00091000000z0.000820000000z0.0007	100000000z0.0006	200000000z0.0004z0.0025z0.0016z0.00015z0.00014z0.00013z0.00012z0.0001)makertaker)r   r   tiersoptionsSPOTMARGINDERIVATIVES)fundingr5   r6   r   r7   r8   BSCETHTRON)BEP20ERC20TRC20CCXT)defaultTypeaccountsByIdnetworksbrokercommonCurrenciesUSD_STABLE_COINUSDCprecisionMode
exceptions2193141000110002100031000410005100061000710008100092000120002200053000330004300053000630007300083000930010300133001430016300173002330024300254000140002400034000440005)400064000740101500019010001)exactbroad)deep_extendsuperr'   describeparse_numberr$   r   r   r   r   r!   r#   r   r   r   r   r"   )self	__class__s    b/var/www/html/crypto-bot/backend/venv/lib/python3.11/site-packages/ccxt/async_support/cryptocom.pyr  zcryptocom.describe   s   i 6 6 ? ? A A iD
+iD
LiD
 $iD
 t	iD

 iD
 iD
 4iD
  SSS $S 	S
 $S $S US "4S tS S $US  S /S ,US 0S  t!S" #S S$  %S& 'S(  )S* &u+S, +E-S. )%/S0 $Z1S2 '3S4 (5S6 "57S8 &t9S: 1$;S<  =S> +E?S@ *:ASB +DCSD &uES S SF #EGSH *4ISJ $UKSL uMSN "5OSP *5QSR +ESST tUSV  WSX %eYSZ /[S\ "5]S^ +E_S` aSb !%cSd +EeSf  gS S Sh diSj "4kSl dmSn !$oSp tqSr  sSt $UuSv !$wSx )%ySz )${S| u}S~ tS@ ASB UCSD tESF "5GSH #EIS SJ ).%*"').*/$( %$)',$!&#(! eS S SiD
x  yiD
T ?6#?  ?5#D 
 -? $   
 K- UiD
D  +16</067122356CI45
  
   !>!>! 3F! ;F	!
 4V! 3E! 8! 3E! 8! 8! 5f! 8! 6v! 7! 1#!  >v!!" 7#!$ CI?E6<9?=C;A4:>D;A5! ! ! , ,^ +,67/0671212EFAB89
  
   !>!>! 8! =f	!
 <V! :6! :6! CF! A&! DV! :6! 3E! 3E! 8! 8!  8!!" 6v#!$ 9>254:?EBH8>;A9<8;=C=C8>;! ! !  / /d +16</067122356CI45
  
   !>!>! 3F! ;F	!
 4V! 3E! 8! 3E! 8! 8! 5f! 9&! 8! 6v! 7!  1#!!" >v#!$ 9?BH?E6<+! ! ! '  ' }F FEiD
R !..w77!..w77 "..s33T5F5Fw5O5OP!..w779J9J89T9TU!..w779J9J89T9TU!..x88$:K:KG:T:TU!..x88$:K:KH:U:UV!..y994;L;LX;V;VW!..z::D<M<Mh<W<WX!..{;;T=N=Nx=X=XY!..{;;T=N=Nx=X=XY
" "..s33T5F5Fw5O5OP!..w779J9J89T9TU!..w779J9J89T9TU!..x88$:K:KH:U:UV!..x88$:K:KI:V:VW!..y994;L;LY;W;WX!..z::D<M<Mi<X<XY!..{;;T=N=Ny=Y=YZ!..{;;T=N=Nx=X=XY
"  SiD
N	 %%"&#0)+! ! #"# 
 ! O	iD
r	 !6!s	iD
x	 Yy	iD
z	 (<(<( ]( -	(
 -( Z( -( ^( \( Z( Z( Z( .( .( Y(  Z!(" Z#( ($ \%(& \'(( \)(* \+(, Z-(. \/(0 \1(2 \3(4 \5(6 \7(8 \9(: \;(< Z=(> Z?(@ ZA(B ZC(D ZE( (F ('0',O( ( (R U+ +{	iD
 i i i	    returnc                   K   |                      |           d{V }|                     |di           }|                     |dg           }g }t          dt          |                    D ]}||         }|                     |d          }|dk    }	|dk    }
|dk    }|d	k    }|                     |d
          }|                     |d          }|	rdn|}|                     |          }|                     |          }|	rdn|                     |          }|                     |d          }|                     |d          }|                     |d          }|                     |d          }|                     |                     |d                    }|dz   |z   }d}d}|dk    rd}d}n|dk    rd}|dz   |z   }d}nm|dk    r&d}|dz   |z   dz   | 	                    |          z   }d}nA|d	k    r;d}|dk    rdnd}|dz   |z   dz   | 	                    |          z   dz   |z   dz   |z   }d}|
                    i d|                     |d          d|d|d |d!|d"|d#|d$|d%|d|	d&|p|d|
d|d|d'|                     |d(          d)|d*|rdnd|rdnd|                     |d+          ||                     |          |                     |          ||                     |                     |d,                    |                     |                     |d-                    d.|                     d/          |                     |d0          d1ddd1ddd1ddd1d2d|d3
           |S )4a=  
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-instruments
        retrieves data on all markets for cryptocom
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: an array of objects representing market data
        Nresultdatar   	inst_typeCCY_PAIRPERPETUAL_SWAPFUTUREWARRANTbase_ccy	quote_ccyput_callstrikemargin_buy_enabledmargin_sell_enabledexpiry_timestamp_ms/r5   Fr7   :Tr8   -r9   callCPr)   symbolbasequotesettlebaseIdquoteIdsettleIdtyper6   activetradablecontractlinearcontract_sizeprice_tick_sizeqty_tick_size)priceamount1max_leverage)minmax)leverager3  r2  cost)
inversecontractSizeexpiryexpiryDatetimer  
optionType	precisionlimitscreatedinfo)v1PublicGetPublicGetInstruments
safe_valuerangelensafe_stringsafe_currency_codesafe_string_lower	omit_zerosafe_integeryymmddappendsafe_numberiso8601r  )r	  paramsresponseresultResponser  r  imarketr  r5   r7   r8   r9   r'  r(  r)  r$  r%  r&  r>  r  marginBuyEnabledmarginSellEnabledr<  r#  r*  r-  symbolOptionTypes                               r  fetch_marketszcryptocom.fetch_markets  s      ==fEEEEEEEEp 8R@@~vr::q#d))$$ U	 U	A!WF((==I
*D 00D(*F)+F%%fj99F&&v{;;G#0ttH**622D++G44E!HTTt'>'>x'H'HF//
CCJ%%fh77F#v7KLL $8M N N^^D$5$5f>S$T$TUUFCZ%'FDHJ&& ...#-h&&#-3dkk&6I6IIi''+5+?+?33c #-3dkk&6I6IICORXX[^^aqqMM 0d&&vx880&0 0 	0
 &0 &0 70 H0 0 0 ,D2C0 0 &0 &0 $//&*==0  H!0" 86$$$#0$ &.855D $ 0 0 I I "&,,v"6"6++F33(!..t/?/?HY/Z/Z[["//0@0@0Y0YZZ   $0055#//GG! !
  $# 
  $# 
  $#  $  _0 0 0 0 0 0 0b r  Nsymbolsc                   K   |                                   d{V  d}i }|nd}t          |t                    r5t          |          }|dk    rt	          | j        dz             |d         }n|}|                     |          }|d         |d<   |                     |                     ||                     d{V }| 	                    |di           }| 
                    |dg           }	|                     |	|          S )	a{  
        fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
        :see: https://exchange-docs.crypto.com/spot/index.html#public-get-ticker
        :see: https://exchange-docs.crypto.com/derivatives/index.html#public-get-tickers
        :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>`
        Nr   zB fetchTickers() symbols argument cannot contain more than 1 symbolr   r)   instrument_namer  r  )load_markets
isinstancelistrF  r   r)   rT  v1PublicGetPublicGetTickersextendrD  	safe_listparse_tickers)
r	  rY  rP  rT  requestr#  symbolsLengthrQ  r  r  s
             r  fetch_tickerszcryptocom.fetch_tickersD  s$      !!!!!!!!!F'4(( ! #G 1$$$TW/s%sttt  [[((F)/G%&99$++gv:V:VWWWWWWWW2 8R88~~ffb11!!$000r  r#  c                    K   |                                   d{V  |                     |          }|                     |g|           d{V }|                     ||          S )a  
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-tickers
        fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
        :param str symbol: unified symbol of the market to fetch the ticker for
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
        N)r\  r#  re  rD  )r	  r#  rP  tickerss       r  fetch_tickerzcryptocom.fetch_tickerx  sz       !!!!!!!!!V$$**F8V<<<<<<<<w///r  sincelimitc                 r  K   |                                   d{V  d}|                     |dd          \  }}|r|                     d||||           d{V S d}i }| |                     |          }|d         |d<   |||d<   |||d<   |                     |d	d
          }|                     |d	d
g          }|||d<   |                     |                     ||                     d{V }	|                     |	di           }
| 	                    |
dg           }| 
                    ||||          S )a  
        fetches information on multiple orders made by the user
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-order-history
        :param str symbol: unified market symbol of the market the orders were made in
        :param int [since]: the earliest time in ms to fetch orders for, max date range is one day
        :param int [limit]: the maximum number of order structures to retrieve, default 100 max 100
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: timestamp in ms for the ending date filter, default is the current time
        :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
        :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
        NFrl   paginater)   r[  
start_timerj  untiltillend_timer  r  )r\  handle_option_and_paramsfetch_paginated_call_dynamicrT  safe_integer_2omit#v1PrivatePostPrivateGetOrderHistoryr`  rD  ra  parse_orders)r	  r#  ri  rj  rP  rl  rT  rc  rn  rQ  r  orderss               r  fetch_orderszcryptocom.fetch_orders  s      !!!!!!!!!88PZ[[& 	h::=&RWY^`fggggggggg[[((F)/G%&$)GL!$GG##FGV<<6GV#455"'GJAA$++gW]B^B^________P x266fb11  >>>r  c                 d  K   |                                   d{V  d}|                     |dd          \  }}|r|                     d||||           d{V S |                     |          }d|d         i}|||d<   |||d<   |                     |d	d
          }|                     |d	d
g          }|||d<   |                     |                     ||                     d{V }	|                     |	di           }
| 	                    |
dg           }| 
                    ||||          S )a  
        get a list of the most recent trades for a particular symbol
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-trades
        :param str symbol: unified symbol of the market to fetch trades for
        :param int [since]: timestamp in ms of the earliest trade to fetch, maximum date range is one day
        :param int [limit]: the maximum number of trades to fetch
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: timestamp in ms for the ending date filter, default is the current time
        :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
        :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
        NFrv   rl  r[  r)   start_tscountrn  ro  end_tsr  r  )r\  rq  rr  rT  rs  rt  v1PublicGetPublicGetTradesr`  rD  ra  parse_trades)r	  r#  ri  rj  rP  rl  rT  rc  rn  rQ  r  tradess               r  fetch_tradeszcryptocom.fetch_trades  s      !!!!!!!!!88PZ[[& 	h::=&RWY^`fgggggggggV$$vd|
 "'GJ$GG##FGV<<6GV#455 %GH88Wf9U9UVVVVVVVV* 8R8833  >>>r  r   c           	        K   |                                   d{V  d}|                     |ddd          \  }}|r!|                     d|||||d           d{V S |                     |          }|d         |                     | j        ||          d}|||d<   |||d	<   |                     |d
d          }	|                     |d
dg          }|	|	|d<   |                     | 	                    ||                     d{V }
| 
                    |
di           }|                     |dg           }|                     |||||          S )a  
        fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-candlestick
        :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 for the ending date filter, default is the current time
        :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
        :returns int[][]: A list of candles ordered, open, high, low, close, volume
        NFrh   rl  i,  r)   )r[  	timeframerz  r{  rn  ro  r|  r  r  )r\  rq  "fetch_paginated_call_deterministicrT  rG  r   rs  rt  v1PublicGetPublicGetCandlestickr`  rD  ra  parse_ohlcvs)r	  r#  r  ri  rj  rP  rl  rT  rc  rn  rQ  r  r  s                r  fetch_ohlcvzcryptocom.fetch_ohlcv  s      !!!!!!!!!88z[`aa& 	}@@vW\^cenpvx{|||||||||V$$%d|))$/9iPP
 
 "'GJ$GG##FGV<<6GV#455 %GH==dkk'SY>Z>Z[[[[[[[[, 8R88~~ffb11  vy%GGGr  c                   K   |                                   d{V  |                     |          }d|d         i}|r||d<   |                     |                     ||                     d{V }|                     |di           }|                     |dg           }|                     |d          }	|                     |	d          }
|                     |	||
          S )	aQ  
        fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-book
        :param str symbol: unified symbol of the market to fetch the order book for
        :param int [limit]: the number of order book entries to return, max 50
        :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)   depthr  r  r   t)r\  rT  v1PublicGetPublicGetBookr`  rD  rK  parse_order_book)r	  r#  rj  rP  rT  rc  rQ  r  r  	orderBook	timestamps              r  fetch_order_bookzcryptocom.fetch_order_book>  s       !!!!!!!!!V$$vd|
  	%$GG66t{{7F7S7STTTTTTTT& 8R88vvr22OOD!,,	%%i55	$$Y	BBBr  c                    |                      |di           }|                      |dg           }|                      |d         dg           }d|i}t          dt          |                    D ]}||         }|                     |d          }|                     |          }	|                                 }
|                     |d          |
d<   |                     |d	          |
d
<   |
||	<   |                     |          S )Nr  r  r   position_balancesrB  r[  quantitytotalreserved_qtyused)rD  rE  rF  rG  rH  accountsafe_balance)r	  rQ  responseResultr  positionBalancesr  rS  balance
currencyIdcoder  s              r  parse_balancezcryptocom.parse_balanceg  s   8R@@~vr::??474GLL(#q#.//00 	# 	#A&q)G))'3DEEJ**:66DllnnG#//DDGG"..wGGGFO"F4LL  (((r  c                    K   |                                   d{V  |                     |           d{V }|                     |          S )a  
        query for balance and get the amount of funds available for trading or funds locked in orders
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-user-balance
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
        N)r\  v1PrivatePostPrivateUserBalancer  )r	  rP  rQ  s      r  fetch_balancezcryptocom.fetch_balancev  sh       !!!!!!!!!==fEEEEEEEEX !!(+++r  r)   c                 ,  K   |                                   d{V  d}||                     |          }d|i}|                     |                     ||                     d{V }|                     |di           }|                     ||          S )a  
        fetches information on an order made by the user
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-order-detail
        :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order_idr  )r\  rT  "v1PrivatePostPrivateGetOrderDetailr`  	safe_dictparse_order)r	  r)   r#  rP  rT  rc  rQ  orders           r  fetch_orderzcryptocom.fetch_order  s       !!!!!!!!![[((F
 @@WV\A]A]^^^^^^^^D x266v...r  r*  sider3  r2  c                 >   |                      |          }|                                }|d         |                                |                     ||          d}	|dk    s|dk    s|dk    r|                     ||          |	d<   |                     | j        dd          }
|
|	d	<   d }d }|                     d
||          \  }}|                     d
|          \  }}|dk    s|d|	d<   n|dk    rd|	d<   |                     |dd          }|)|dk    rd|	d<   n|dk    rd|	d<   n|dk    rd|	d<   n||	d<   | 	                    |dd          }|s|dk    rdg|	d<   d|	d<   | 
                    |g d          }|                     |d          }|                     |d          }|d u}|d u}|d u}|r|                     ||          |	d <   |                     |          }|dk    s|dk    s|dk    rH|d!k    r!t          j        ||          rd|	d"<   nd|	d"<   nt          j        ||          rd|	d"<   nd|	d"<   n|d!k    r!t          j        ||          rd#|	d"<   nd$|	d"<   nt          j        ||          rd$|	d"<   nqd#|	d"<   nk|r1|dk    s|dk    rd|	d"<   nd$|	d"<   |                     ||          |	d <   n8|r1|dk    s|dk    rd|	d"<   nd#|	d"<   |                     ||          |	d <   n||	d"<   |                     |g d%          }|                     |	|          S )&Nr)   )r[  r  r  LIMIT
STOP_LIMITTAKE_PROFIT_LIMITr2  r   r   	broker_idrC   r6   r   spot_marginr5   r   timeInForcetime_in_forceGTCGOOD_TILL_CANCELIOCIMMEDIATE_OR_CANCELFOKFILL_OR_KILLpostOnlyFPO	POST_ONLY	exec_inst	stopPricetriggerPrice	ref_pricestopLossPricetakeProfitPricer  buyr*  TAKE_PROFIT	STOP_LOSSr  clientOrderIdr  r  r  r  r  )rT  upperamount_to_precisionprice_to_precisionrG  r   handle_market_type_and_params$custom_handle_margin_mode_and_paramssafe_string_upper_2	safe_boolsafe_string_nrN  number_to_stringr%   	string_ltrt  r`  )r	  r#  r*  r  r3  r2  rP  rT  uppercaseTyperc  r   
marketType
marginModer  r  r  r  r  	isTriggerisStopLossTriggerisTakeProfitTriggerpriceStrings                         r  create_order_requestzcryptocom.create_order_request  s.   V$$

%d|JJLL00@@
 

 W$$-<*G*G]^qMqMq#66vuEEGG!!$,&AA%

!??vW]^^
F!FF}V\]]
F(""
(>%-GM""6!!%+GM"..v}oVV"e##+=((%%+@((%%+9((+6(>>&*e<< 	:+--$/=GK '9GO$))&2\2\2\]]((AA**63DEE!-	*$6.d: &	,#'#:#:6<#P#PGK //66K((m|.K.KQ^buQuQu5==(lCC 7*=*6(lCC >*6*=5==(lCC 6*7*5(lCC 8*5*7 	,((m|.K.K"."-#'#:#:6=#Q#QGK    	,((m?R.R.R"5"/#'#:#:6?#S#SGK  +GFO6  $Q  $Q  $Q  R  R{{7F+++r  c                 (  K   |                                   d{V  |                     |          }|                     ||||||          }|                     |           d{V }	|                     |	di           }
|                     |
|          S )a  
        create a trade order
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-order
        :param str symbol: unified symbol of the market to create an order in
        :param str type: 'market', 'limit', 'stop_loss', 'stop_limit', 'take_profit', 'take_profit_limit'
        :param str side: 'buy' or 'sell'
        :param float amount: how much you want to trade in units of base currency
        :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.timeInForce]: 'GTC', 'IOC', 'FOK' or 'PO'
        :param str [params.ref_price_type]: 'MARK_PRICE', 'INDEX_PRICE', 'LAST_PRICE' which trigger price type to use, default is MARK_PRICE
        :param float [params.stopPrice]: price to trigger a stop order
        :param float [params.stopLossPrice]: price to trigger a stop-loss trigger order
        :param float [params.takeProfitPrice]: price to trigger a take-profit trigger order
        :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        Nr  )r\  rT  r  v1PrivatePostPrivateCreateOrderr  r  )r	  r#  r*  r  r3  r2  rP  rT  rc  rQ  r  s              r  create_orderzcryptocom.create_order2  s      " !!!!!!!!!V$$++FD$vVV==gFFFFFFFF (B77///r  rw  c           	      H  K   |                                   d{V  g }t          dt          |                    D ]}||         }|                     |d          }|                     |d          }|                     |d          }|                     |d          }	|                     |d          }
|                     |di           }|                     ||||	|
|          }|                    |           |                     |d	d
          }||d}|                     |                     ||                     d{V }|                     |dg           }|                     |d          }|d|ig}| 	                    |          S | 	                    |          S )a  
        create a list of trade orders
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-order-list-list
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-order-list-oco
        :param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
        :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        Nr   r#  r*  r  r3  r2  rP  contingency_typeLISTr  
order_listr  list_idr  )
r\  rE  rF  rG  rD  create_advanced_order_requestrM  #v1PrivatePostPrivateCreateOrderListr`  rv  )r	  rw  rP  ordersRequestsrS  rawOrdermarketIdr*  r  r3  r2  orderParamsorderRequest
contigencyrc  rQ  r  listId	ocoOrderss                      r  create_orderszcryptocom.create_ordersU  s      !!!!!!!!!q#f++&& 		0 		0AayH''(;;H##Hf55D##Hf55D__Xx88FOOHg66E//(HbAAK==hdTZ\acnooL!!,////%%f.@&II
 *(
 
 AA$++gW]B^B^________T 8R88!!&)44$f-.I$$Y///  (((r  c                 &   |                      |          }|                                }|d         |                                d}	|dk    s|dk    s|dk    r|                     ||          |	d<   |                     | j        dd          }
|
|	d	<   |                     |d
d          }|)|dk    rd|	d<   n|dk    rd|	d<   n|dk    rd|	d<   n||	d<   |                     |dd          }|s|dk    rdg|	d<   d|	d<   |                     |g d          }|                     |d          }|                     |d          }|d u}|d u}|d u}|r| 	                    |          }|dk    s|dk    s|dk    rH|dk    r!t          j        ||          rd|	d<   nd|	d<   nt          j        ||          rd|	d<   nd|	d<   n|dk    r!t          j        ||          rd|	d<   n`d|	d<   nZt          j        ||          rd|	d<   n?d|	d<   n9|r|dk    s|dk    rd|	d<   n%d|	d<   n|r|dk    s|dk    rd|	d<   nd|	d<   n||	d<   |dk    r|dk    s|dk    s|dk    rd }d}|                     |d d!d          \  }}|                     |d"d#          }|                     |d"          }||                     ||          }n|ro|t!          | j        d$z             | 	                    |          }| 	                    |          }t          j        ||          }|                     ||          }n|                     ||          }||	d#<   n|                     ||          |	d%<   |                     |g d&          }|                     |	|          S )'Nr)   )r[  r  r  r  r  r2  r   r   r  r  r  r  r  r  r  r  r  r  Fr  r  r  r  r  r  r  r*  r  r  MARKETTrC   !createMarketBuyOrderRequiresPricer9  notionala	   createOrder() requires the price argument for market buy orders to calculate the total cost to spend(amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to False and pass the cost to spend(quote quantity) in the amount argumentr  r  )rT  r  r  rG  r   r  r  r  rN  r  r%   r  rq  safe_number_2rt  cost_to_precisionr   r)   
string_mulr  r`  )r	  r#  r*  r  r3  r2  rP  rT  r  rc  r   r  r  r  r  r  r  r  r  r  quoteAmountr  r9  amountStringcostRequests                            r  r  z'cryptocom.create_advanced_order_request  s   
 V$$

%d|JJLL
 
 W$$-<*G*G]^qMqMq#66vuEEGG!!$,&AA%..v}oVV"e##+=((%%+@((%%+9((+6(>>&*e<< 	:+--$/=GK '9GO$))&2\2\2\]]((AA**63DEE!-	*$6.d: #	,//66K((m|.K.KQ^buQuQu5==(lCC 7*=*6(lCC >*6*=5==(lCC 6*7*5(lCC 8*5*7 	,((m|.K.K"."-  	,((m?R.R.R"5"/+GFOEMM(!:!:Q\@\@\bo  tA  cA  cAK04-8<8U8UV\^k  nQ  SW  9X  9X5-v%%ffjAADYYvv..F"44VTBB2 	E=&tw  2}  (}  ~  ~  ~#'#8#8#@#@L"&"7"7">">K")"4\;"O"OK"&"8"8"M"MKK"44VVDD"-GJ"&":":66"J"JGJ6  $Q  $Q  $Q  R  R{{7F+++r  c                    K   |                                   d{V  d}i }| |                     |          }|d         |d<   |                     |                     ||                     d{V S )a  
        cancel all open orders
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-all-orders
        :param str symbol: unified market symbol of the orders to cancel
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict} Returns exchange raw message{@link https://docs.ccxt.com/#/?id=order-structure:
        Nr)   r[  )r\  rT  #v1PrivatePostPrivateCancelAllOrdersr`  )r	  r#  rP  rT  rc  s        r  cancel_all_orderszcryptocom.cancel_all_orders  s       !!!!!!!!![[((F)/G%&==dkk'SY>Z>Z[[[[[[[[[r  c                 ,  K   |                                   d{V  d}||                     |          }d|i}|                     |                     ||                     d{V }|                     |di           }|                     ||          S )a  
        cancels an open order
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order
        :param str id: the order id of the order to cancel
        :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\  rT  v1PrivatePostPrivateCancelOrderr`  r  r  )r	  r)   r#  rP  rT  rc  rQ  r  s           r  cancel_orderzcryptocom.cancel_order  s       !!!!!!!!![[((F
 ==dkk'SY>Z>Z[[[[[[[[ (B77///r  c                   K   |t          | j        dz             |                                  d{V  |                     |          }g }t	          dt          |                    D ]7}||         }|d         t          |          d}|                    |           8d|d}	|                     | 	                    |	|                     d{V }
| 
                    |
dg           }|                     ||dd|          S )	a  
        cancel multiple orders
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order-list-list
        :param str[] ids: order ids
        :param str symbol: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
        Nz* cancelOrders() requires a symbol argumentr   r)   )r[  r  r  r  r  )r   r)   r\  rT  rE  rF  strrM  #v1PrivatePostPrivateCancelOrderListr`  ra  rv  )r	  idsr#  rP  rT  orderRequestsrS  r)   r  rc  rQ  r  s               r  cancel_orderszcryptocom.cancel_orders/  s3      >#DG.Z$Z[[[!!!!!!!!!V$$q#c((## 	( 	(AQB#)$<GG E   '''' &'
 
 AA$++gW]B^B^________(B77  tVDDDr  c                 p  K   |                                   d{V  d}i }| |                     |          }|d         |d<   |                     |                     ||                     d{V }|                     |di           }|                     |dg           }	|                     |	|||          S )a,  
        fetch all unfilled currently open orders
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-open-orders
        :param str symbol: unified market symbol
        :param int [since]: the earliest time in ms to fetch open orders for
        :param int [limit]: the maximum number of open order structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
        Nr)   r[  r  r  )r\  rT  !v1PrivatePostPrivateGetOpenOrdersr`  rD  ra  rv  )
r	  r#  ri  rj  rP  rT  rc  rQ  r  rw  s
             r  fetch_open_orderszcryptocom.fetch_open_ordersL  s       !!!!!!!!![[((F)/G%&??GU[@\@\]]]]]]]]L x266fb11  >>>r  c                 r  K   |                                   d{V  d}|                     |dd          \  }}|r|                     d||||           d{V S i }d}| |                     |          }|d         |d<   |||d<   |||d<   |                     |d	d
          }|                     |d	d
g          }|||d<   |                     |                     ||                     d{V }	|                     |	di           }
| 	                    |
dg           }| 
                    ||||          S )a  
        fetch all trades made by the user
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-trades
        :param str symbol: unified market symbol
        :param int [since]: the earliest time in ms to fetch trades for, maximum date range is one day
        :param int [limit]: the maximum number of trade structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: timestamp in ms for the ending date filter, default is the current time
        :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
        :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
        NFrg   rl  r)   r[  rm  rj  rn  ro  rp  r  r  )r\  rq  rr  rT  rs  rt  v1PrivatePostPrivateGetTradesr`  rD  ra  r~  )r	  r#  ri  rj  rP  rl  rc  rT  rn  rQ  r  r  s               r  fetch_my_tradeszcryptocom.fetch_my_trades  s      !!!!!!!!!88R\]]& 	j::?FTY[`bhiiiiiiiii[[((F)/G%&$)GL!$GG##FGV<<6GV#455"'GJ;;DKKQW<X<XYYYYYYYY< 8R8833  >>>r  c                     d }d }d }|                     d          dk    r6|                    d          \  }}|                    d          }|d         }n|}||gS )N?r   =r   )findsplit)r	  addressStringaddresstagrawTagsplitteds         r  parse_addresszcryptocom.parse_address  sl    c""Q&&+11#66OGV||C((H1+CC#G~r  r  c                   K   |                      ||          \  }}|                                  d{V  |                     |          }|d         ||d}|||d<   d}|                     |          \  }}|                     |          }	|	|	|d<   |                     |                     ||                     d{V }
|                     |
d          }|                     ||          S )a  
        make a withdrawal
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-withdrawal
        :param str code: unified currency code
        :param float amount: the amount to withdraw
        :param str address: the address to withdraw to
        :param str tag:
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
        Nr)   )currencyr3  r  address_tag
network_idr  )	handle_withdraw_tag_and_paramsr\  r  handle_network_code_and_paramsnetwork_code_to_id$v1PrivatePostPrivateCreateWithdrawalr`  r  parse_transaction)r	  r  r3  r  r  rP  r  rc  networkCode	networkIdrQ  r  s               r  r   zcryptocom.withdraw  s      99#vFFV!!!!!!!!!==&& 
 

 ?%(GM""AA&IIV++K88	 $-GL!BB4;;wX^C_C_````````" (33%%fh777r  c                 .  K   |                                   d{V  |                     |          }d|d         i}|                     |                     ||                     d{V }|                     |di           }|                     |dg           }t          |          }|dk    rt          | j        dz             i }	t          d|          D ]}
|                     ||
          }| 	                    |d          }| 	                    |d          }| 
                    |          }|                     |          \  }}|                     |           | 	                    |d	          }|                     ||          }|||||d
|	|<   |	S )a  
        fetch a dictionary of addresses for a currency, indexed by network
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-deposit-address
        :param str code: unified currency code of the currency for the deposit address
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a dictionary of `address structures <https://docs.ccxt.com/#/?id=address-structure>` indexed by the network
        Nr  r)   r  deposit_address_listr   z7 fetchDepositAddressesByNetwork() generating address...r  network)rB  r  r  r  r  )r\  r  %v1PrivatePostPrivateGetDepositAddressr`  rD  rF  r   r)   rE  rG  rH  r  check_addressnetwork_id_to_code)r	  r  rP  r  rc  rQ  r  	addressesaddressesLengthr  rS  valuer  r  responseCoder  r  r  r  s                      r  "fetch_deposit_addresses_by_networkz,cryptocom.fetch_deposit_addresses_by_network   s      !!!!!!!!!==&&
 CCDKKPWY_D`D`aaaaaaaa( x266OOD*@"EE	i..a*c cdddq/** 	 	AOOIq11E ,,UI>>M))%<<J22:>>L--m<<LGSw'''((	::I--iFFG("" F7OO r  c                   K   |                      |d          }|                     |dg          }|                     ||           d{V }||v r||         S t          |                                          }||d                  S )a9  
        fetch the deposit address for a currency associated with self account
        :param str code: unified currency code
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
        r  Nr   )safe_string_upperrt  r'  r^  keys)r	  r  rP  r  depositAddressesr*  s         r  fetch_deposit_addresszcryptocom.fetch_deposit_address9  s       ((;;6I;//!%!H!Hv!V!VVVVVVV&&&#G,,(--//00D#DG,,r  c                 D    dddddddd}|                      |||          S )	NBTCr   SOLBNBCRONOSMATICOP)r.  r   r/  r0  r1  r2  r3  rG  )r	  r  networksByIds      r  safe_networkzcryptocom.safe_networkI  s=    
 
 iCCCr  c                   K   |                                   d{V  d}i }| |                     |          }|d         |d<   |||d<   |||d<   |                     |dd          }|                     |ddg          }|||d<   |                     |                     ||                     d{V }|                     |d	i           }	|                     |	d
g           }
|                     |
|||          S )a  
        fetch all deposits made to an account
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-deposit-history
        :param str code: unified currency code
        :param int [since]: the earliest time in ms to fetch deposits for
        :param int [limit]: the maximum number of deposits structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: timestamp in ms for the ending date filter, default is the current time
        :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
        Nr)   r  rz  	page_sizern  ro  r|  r  deposit_list)	r\  r  rs  rt  %v1PrivatePostPrivateGetDepositHistoryr`  rD  ra  parse_transactions)r	  r  ri  rj  rP  r  rc  rn  rQ  r  depositLists              r  fetch_depositszcryptocom.fetch_depositsU  s5      !!!!!!!!!}}T**H"*4.GJ"'GJ#(GK ##FGV<<6GV#455 %GHCCDKKPWY_D`D`aaaaaaaa. x266nnT>2>>&&{HeUKKKr  c                   K   |                                   d{V  d}i }| |                     |          }|d         |d<   |||d<   |||d<   |                     |dd          }|                     |ddg          }|||d<   |                     |                     ||                     d{V }|                     |d	i           }	|                     |	d
g           }
|                     |
|||          S )a  
        fetch all withdrawals made from an account
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-withdrawal-history
        :param str code: unified currency code
        :param int [since]: the earliest time in ms to fetch withdrawals for
        :param int [limit]: the maximum number of withdrawals structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: timestamp in ms for the ending date filter, default is the current time
        :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
        Nr)   r  rz  r8  rn  ro  r|  r  withdrawal_list)	r\  r  rs  rt  (v1PrivatePostPrivateGetWithdrawalHistoryr`  rD  ra  r;  )r	  r  ri  rj  rP  r  rc  rn  rQ  r  withdrawalLists              r  fetch_withdrawalszcryptocom.fetch_withdrawals  s6      !!!!!!!!!}}T**H"*4.GJ"'GJ#(GK ##FGV<<6GV#455 %GHFFt{{SZ\bGcGcdddddddd2 x266.?DD&&~xNNNr  rT  c                    |                      |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k    r|                     |d          nd |d|          S ) Nr  rS  _r%  ar#  r  datetimehighhlowlbidb	bidVolumeaskk	askVolumevwapopencloselastpreviousClosechange
percentagecaveragevUSDvv)
baseVolumequoteVolumerB  )rK  rG  safe_marketsafe_tickerrO  rN  )r	  tickerrT  r  r  r%  rT  s          r  parse_tickerzcryptocom.parse_ticker  s   B %%fc22	##FC00!!(FC88  11,, !
fX&!
!
 Y//!
 D$$VS11	!

 4##FC00!
 4##FC00!
 !
 4##FC00!
 !
 D!
 D!
 T!
 D!
 T!
 d!
  $**6377!!
" t#!
$ **6377>Cunn4++FD999SW)!
 !
 !
* +  	r  c                    |                      |dd          }|                     |dd          }|                     ||d          }|                     |d          }|                     |d          }|                     ||                     |dd	          ||                     |          |d
         |                     |d          |                     |dd          |                     |d          |                     |dd          |                     |dd          d d | 	                    |          | 
                    t          j        |                    dd|          S )Nr  create_timerS  r[  rD  fee_instrument_namer   dtrade_idr#  r  sr  
taker_sideptraded_priceqtraded_quantityr  r9  )rB  r)   r  rF  r#  r  r  takerOrMakerr2  r3  r9  r*  fee)rs  safe_string_2r_  rG  
safe_traderO  safe_string_lower_2rI  r  rH  r  r%   
string_neg)r	  traderT  r  r  feeCurrencyfeeCostStrings          r  parse_tradezcryptocom.parse_trade  sp   F ''sMBB	%%eS2CDD!!(FC88&&u.CDD((77$$UC<<"Y//X&%%eZ88,,UC@@ 225,GG''sNCC((5FGG 33K@@))'*<]*K*KLL  
  
" #  	r  c           	         |                      |d          |                     |d          |                     |d          |                     |d          |                     |d          |                     |d          gS )Nr  orH  rJ  rX  rZ  )rK  rN  )r	  ohlcvrT  s      r  parse_ohlcvzcryptocom.parse_ohlcv9  s     eS))UC((UC((UC((UC((UC((
 	
r  c                 @    dddddd}|                      |||          S )NrR  canceledclosedrejectedexpired)ACTIVECANCELEDFILLEDREJECTEDEXPIREDr4  r	  statusstatusess      r  parse_order_statuszcryptocom.parse_order_statusM  s7    "" 
 
 &&999r  c                 <    dddd}|                      |||          S )Nr  r  r  )r  r  r  r4  )r	  r  timeInForcess      r  parse_time_in_forcezcryptocom.parse_time_in_forceW  s1     %#(!
 

 k;GGGr  c           
      R   |                      |d          }|H|dk    rB|                     |                     |d          |                     |d          |dd          S |                      |d          }|                     |d          }|                     ||          }|                     |d	          }d }|4d
}t          dt          |                    D ]}	||	         }
|
dk    rd} n|                     |d          }|                     i d|d|                     |d          d|                     |d          d|d|                     |          d|                      |d          d|                     |                     |d                    d|d| 	                    |d          d| 
                    |                     |d                    d|d| 	                    |d          d|                     |d          d|                     |d           d!|                     |d"          d#d d$|                     |d%          |                     |d&          |                     |          |                     |d'          d(g d)|          S )*Nr  r   r  
client_oidr  )r)   r  rB  r  rd  r[  r  Fr  Tre  rB  r)   r  r  rF  lastTradeTimestampupdate_timer  r#  r*  
order_typer  r  r  r  r2  limit_pricer3  r  filledcumulative_quantity	remainingrY  	avg_pricecumulative_valuecumulative_feern  )r9  rp  r  )rK  
safe_orderrG  safe_symbolrD  rE  rF  rO  r  rI  r  rN  rH  )r	  r  rT  r  rA  r  r#  execInstr  rS  instrv  s               r  r  zcryptocom.parse_order_  sM   ^   //4199??&&uj99!%!1!1%!F!F$	$ $    ##E=99##E+<==!!(F33??5+66H1c(mm,,  {;&&#HE ' &&u.CDD  
E 
$""5*55 
 T--e\BB 
 	 

 W-- 
 !$"3"3E="I"I 
 d--d.>.>uh.O.OPP 
 f 
 D**5,?? 
 433D4D4DUO4\4\]] 
  
 D**5&99 
 T%%e];; 
 d&&uj99 
 d&&u.CDD 
  ! 
" t''{;;# 
$ $$U,>?? 33K@@((0@AA  / 
  
  
0 1  	r  c                 >    ddddd}|                      |||          S )Npendingokfailed)r   r4  23r4  r  s      r  parse_deposit_statuszcryptocom.parse_deposit_status  s4    	
 
 &&999r  c                 D    dddddddd}|                      |||          S )Nr  r  r  r~  )r   r4  r  r  456r4  r  s      r  parse_withdrawal_statusz!cryptocom.parse_withdrawal_status  s=    
 
 &&999r  r  c                    d }|                      |d          }d }d|v rd}|                     |          }n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S )Nr  
client_wid
withdrawaldepositr  r  rd  rp  rn  rB  r)   txidr  rF  r  	addressToaddressFromr  tagTotagFromr*  r3  updatedr  )internalcommentrp  )rG  r  r  r  rH  rK  rN  rO  )r	  transactionr  r*  	rawStatusr  r  r  r  r  r  r  feeCostrp  s                 r  r  zcryptocom.parse_transaction  sA   X $$[(;;	;&&D11)<<FFD..y99F((i@@))-88%%k:>>
&&z8<<%%k=AA	"";66#W55C
K
$"";55
 D$$[&99
 	

 Y//
 t
 w
 
 4
 3
 S
 t
 D
 d&&{H==
 
  f!
" t((mDD#
$ ''\BB)
 
 
 	
r  c                 (   |                      | j        d          }|                     |dd          }|                     |d          }d}|                     ||          \  }}||dk    rt          | j        dz             n|dk    s|du rd}||gS )a\  
         * @ignore
        marginMode specified by params["marginMode"], self.options["marginMode"], self.options["defaultMarginMode"], params["margin"] = True or self.options["defaultType"] = 'margin'
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns Array: the marginMode in lowercase
        r   r6   FNcrossz only cross margin is supportedT)rG  r   r  rt  handle_margin_mode_and_paramsr    r)   )r	  
methodNamerP  r   isMarginr  s         r  r  z.cryptocom.custom_handle_margin_mode_and_params'  s     &&t|]CC>>&(E::68,,
!??
FSS
F!W$$"47-N#NOOO % x''X-=-=$
F##r  c                    |                      |d          }t          |          }|d d dd d di d}|t          d|          D ]}||         }|                     |d          }|                     |d          }	|                     ||	          }
d d d|                     |d          ddd	|d
         |
<   |dk    r*|                     |d          |d         d<   d|d         d<   |S )Nnetwork_list)rp  rW  )rB  r   r  r   r   r  r  withdrawal_feeF)r  r   r   r   r   rp  rW  )rD  rF  rE  rG  r"  rN  )r	  rp  r  networkListnetworkListLengthr  rS  networkInfor  currencyCoder  s              r  parse_deposit_withdraw_feez$cryptocom.parse_deposit_withdraw_fee;  sE   " ooc>::,," 
 "  
 
 "1/00 = =)!n ,,[,GG	#//&AA"55iNN'+4@@(,(8(8FV(W(Wgl m m3 3z";/ %))040@0@N^0_0_F:&u-7<F:&|4r  codesc                    K   |                                   d{V  |                     |           d{V }|                     |d          }|                     |d          }|                     ||d          S )a  
        fetch deposit and withdraw fees
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-currency-networks
        :param str[]|None codes: list of unified currency codes
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a list of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>`
        Nr  currency_map	full_name)r\  'v1PrivatePostPrivateGetCurrencyNetworksrD  ra  parse_deposit_withdraw_fees)r	  r  rP  rQ  r  currencyMaps         r  fetch_deposit_withdraw_feesz%cryptocom.fetch_deposit_withdraw_feesi  s       !!!!!!!!!EEfMMMMMMMMx22nnT>:://UKPPPr  c                   K   |                                   d{V  i }d}||                     |          }|||d<   |||d<   |                     |dd          }|                     |ddg          }|||d<   |                     |                     ||                     d{V }|                     |di           }	|                     |	dg           }
|                     |
|||          S )	a  
        fetch the history of changes, actions done by the user or operations that altered the balance of the user
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-transactions
        :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 for the ending date filter, default is the current time
        :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
        Nrm  rj  rn  ro  rp  r  r  )r\  r  rs  rt  #v1PrivatePostPrivateGetTransactionsr`  rD  parse_ledger)r	  r  ri  rj  rP  rc  r  rn  rQ  r  ledgers              r  fetch_ledgerzcryptocom.fetch_ledgerw  s&      !!!!!!!!!}}T**H$)GL!$GG##FGV<<6GV#455"'GJAA$++gW]B^B^________< 8R8844  5%@@@r  c                 r   |                      |d          }|                     |d          }|                     |d          }d }t          j        |d          rd}t          j        |          }nd}|                     |d          ||                     |d          |                     |d	          |                     |d
          |                     |                     |d                    |                     ||          |                     |          ||                     |          d d d d d d|dS )Nevent_timestamp_msr[  transaction_qtyr   outinr  
account_idrg  trade_match_idjournal_typern  )r)   	directionr  referenceIdreferenceAccountr*  r  r3  r  rF  beforeafterr  rp  rB  )	rK  rG  r%   r  
string_absparse_ledger_entry_typerH  r  rO  )r	  itemr  r  r  r3  r  s          r  parse_ledger_entryzcryptocom.parse_ledger_entry  sP   * %%d,@AA	%%d,=>>
!!$(9::	VS)) 	I'//FFI""444"''l;;++D*== $ 0 07G H H001A1A$1W1WXX//
HEE''//"Y//   %
 
 	
r  c                     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}|                      |||          S )NTRADINGru  	TRADE_FEErp  WITHDRAW_FEEWITHDRAWr  DEPOSITr  ROLLBACK_WITHDRAWrollbackROLLBACK_DEPOSITFUNDINGREALIZED_PNLINSURANCE_FUND	insuranceSOCIALIZED_LOSSLIQUIDATION_FEESESSION_RESETreset
ADJUSTMENT
adjustmentSESSION_SETTLE
settlementUNCOVERED_LOSSADMIN_ADJUSTMENTdelist
conversion)DELISTSETTLEMENT_FEEAUTO_CONVERSIONMANUAL_CONVERSIONr4  )r	  r*  
ledgerTypes      r  r  z!cryptocom.parse_ledger_entry_type  s   
w

 E
 	

 y
  
 

 u
 G
 k
 w
 u
 W
 ,
 l
  g!
" #
$ #+!-+
 
 

. 
D$777r  c                 P  K   |                                   d{V  |                     |           d{V }|                     |di           }|                     |di           }|                     |dg           }|                    |           |                     ||          S )a  
        fetch all the accounts associated with a profile
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-accounts
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a dictionary of `account structures <https://docs.ccxt.com/#/?id=account-structure>` indexed by the account type
        Nr  master_accountsub_account_list)r\  v1PrivatePostPrivateGetAccountsrD  rM  parse_accounts)r	  rP  rQ  r  masterAccountaccountss         r  fetch_accountszcryptocom.fetch_accounts  s       !!!!!!!!!==fEEEEEEEE@ 8R880@"EE??6+=rBB&&&""8V444r  c                 `    |                      |d          |                      |d          d |dS )Nuuidlabel)r)   r*  r  rB  r4  )r	  r  s     r  parse_accountzcryptocom.parse_account,	  s?    6 ""7F33$$Wg66	
 
 	
r  c                 V  K   |                                   d{V  d}||                     |          }d}|                     d||          \  }}|                     d|dg d           |dk    rd}d|                                i}|                     |                     ||                     d{V }|                     |di           }	|                     |	d	g           }
|                     |
|          }| 	                    |d
          }| 
                    ||||          S )a5  
        fetches historical settlement records
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-expired-settlement-price
        :param str symbol: unified market symbol of the settlement history
        :param int [since]: timestamp in ms
        :param int [limit]: number of records
        :param dict [params]: exchange specific params
        :param int [params.type]: 'future', 'option'
        :returns dict[]: a list of `settlement history objects <https://docs.ccxt.com/#/?id=settlement-history-structure>`
        Nrq   r*  )r8   r9   r  r  r9   r  instrument_typer  r  r  )r\  rT  r  check_required_argumentr  *v1PublicGetPublicGetExpiredSettlementPricer`  rD  parse_settlementssort_byfilter_by_symbol_since_limit)r	  r#  ri  rj  rP  rT  r*  rc  rQ  r  r  settlementssorteds                r  fetch_settlement_historyz"cryptocom.fetch_settlement_historyM	  sV      !!!!!!!!![[((F99:RTZ\bccf$$%=tVMvMvMvwww8Dtzz||
 HHU\^dIeIeffffffff$ 8R88vvr22,,T6::k;7700NNNr  c                     |                      |d          }|                     |d          }||                     ||          |                     |d          ||                     |          dS )NxrS  rZ  )rB  r#  r2  r  rF  )rK  rG  r  rN  rO  )r	  r  rT  r  r  s        r  parse_settlementzcryptocom.parse_settlement|	  sx     %%j#66	##J44&&x88%%j#66"Y//
 
 	
r  c                     g }t          dt          |                    D ]1}|                    |                     ||         |                     2|S )Nr   )rE  rF  rM  r  )r	  r  rT  r  rS  s        r  r  zcryptocom.parse_settlements	  sZ     q#k**++ 	I 	IAMM$//AGGHHHHr  c           
      h  K   |t          | j        dz             |                                  d{V  d}|                     |dd          \  }}|r |                     d|||d|           d{V S |                     |          }|d         st          | j        dz             |d	         d
d}|||d<   |||d<   |                     |dd          }|                     |ddg          }|||d<   | 	                    | 
                    ||                     d{V }	|                     |	di           }
|                     |
dg           }|                     |
d          }g }t          dt          |                    D ]v}||         }|                     |d          }|                    ||                     ||          |                     |d          ||                     |          d           w|                     |d          }|                     ||d         ||          S )a  
        fetches historical funding rates
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-valuations
        :param str symbol: unified symbol of the market to fetch the funding rate history for
        :param int [since]: timestamp in ms of the earliest funding rate to fetch
        :param int [limit]: the maximum amount of [funding rate structures] to fetch
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: timestamp in ms for the ending date filter, default is the current time
        :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
        :returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>`
        Nz5 fetchFundingRateHistory() requires a symbol argumentFrX   rl  8hr7   z7 fetchFundingRateHistory() supports swap contracts onlyr)   funding_hist)r[  valuation_typerz  r{  rn  ro  r|  r  r  r[  r   r  rZ  )rB  r#  fundingRater  rF  r  r#  )r   r)   r\  rq  r  rT  r   rs  rt  v1PublicGetPublicGetValuationsr`  rD  rG  rE  rF  rK  rM  r  rN  rO  r  r  )r	  r#  ri  rj  rP  rl  rT  rc  rn  rQ  r  r  r  ratesrS  entryr  r  s                     r  fetch_funding_rate_historyz$cryptocom.fetch_funding_rate_history	  s      >#DG.e$efff!!!!!!!!!88AZ\fgg& 	@@@AZ\bdikprvx~V$$f~ 	aDG&__```%d|,
 
 "'GJ$GG##FGV<<6GV#455 %GH<<T[[RX=Y=YZZZZZZZZ" 8R88vvr22##F,=>>q#d))$$ 		 		AGE))%55ILL**8V<<#//s;;& LL33      e[11009I5RWXXXr  c                   K   |                                   d{V  |                     |          }d|d         i}|                     |                     ||                     d{V }|                     |di           }|                     |dg           }|                     |                     |d          |          S )a  
        fetch data on a single open contract trade position
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-positions
        :param str symbol: unified market symbol of the market the position is held in
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `position structure <https://docs.ccxt.com/#/?id=position-structure>`
        Nr[  r)   r  r  r   )r\  rT   v1PrivatePostPrivateGetPositionsr`  r  ra  parse_position)r	  r#  rP  rT  rc  rQ  r  r  s           r  fetch_positionzcryptocom.fetch_position	  s       !!!!!!!!!V$$vd|
 >>t{{7TZ?[?[\\\\\\\\. (B77~~ffb11""4>>$#:#:FCCCr  c                 8  K   |                                   d{V  |                     |          }i }d}|nd}t          |t                    r5t	          |          }|dk    rt          | j        dz             |d         }n|}|                     |          }|d         |d<   |                     | 	                    ||                     d{V }| 
                    |di           }| 
                    |dg           }	g }
t          dt	          |	                    D ]a}|	|         }|                     |d          }|                     |ddd	          }|
                    |                     ||                     b|                     |
d
dd          S )a  
        fetch all open positions
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-positions
        :param str[]|None symbols: list of unified market symbols
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
        Nr   zD fetchPositions() symbols argument cannot contain more than 1 symbolr   r)   r[  r  r  r-  r#  F)r\  market_symbolsr]  r^  rF  r   r)   rT  r&  r`  rD  rE  rG  r_  rM  r'  filter_by_array_positions)r	  rY  rP  rc  rT  r#  rd  rQ  r  	positionsr  rS  r#  r  marketInners                  r  fetch_positionszcryptocom.fetch_positions
  s      !!!!!!!!!%%g..F'4(( ! #G 1$$$TW/u%uvvv  [[((F)/G%&>>t{{7TZ?[?[\\\\\\\\. 8R@@OONFB??	q#i..)) 	C 	CAaLE''/@AAH**8T4LLKMM$--e[AABBBB--fheLLLr  c                    |                      |d          }|                     ||d d          }|                     ||d d          }|                     |d          }|                      |d          }|                     i d|dd d|d|d	|                     |          d
d dt          j        |d          rdnddt          j        |          d|d         d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-  update_timestamp_msr  rB  r)   r#  r  rF  hedgedr  r   r  sell	contractsr;  
entryPrice	markPricer  r8  
collateralopen_pos_costinitialMarginr9  maintenanceMargininitialMarginPercentageopen_position_pnl)maintenanceMarginPercentageunrealizedPnlliquidationPricer  rW  marginRatior  r  )
rG  r_  r  rK  safe_positionrO  r%   	string_gtr  rN  )r	  positionrT  r  r#  r  r3  s          r  r'  zcryptocom.parse_positionC
  s    ##H.?@@!!(FD*EE!!(FD*EE%%h0EFF	!!(J77!! #
H#
$#
 f#
 	#

 Y//#
 d#
 W.vs;;GEE#
 +F33#
 F>2#
 $#
 #
 #
 #
 $**8_EE#
 T--h??#
   !#
" &t##
$ ,0!--h8KLL $!#3#
 #
 #
   	r  c                 *    |                                  S N)milliseconds)r	  s    r  noncezcryptocom.noncer
  s      """r  c                 \   d}||k    rt          |          S t          |t                     r|S d}d }t          |t                    r|}n6|                     |          }t          |                                          }t          dt          |                    D ]}||         }||z  }||         }	|	dk    r|dz  }#t          |	t                    rCt          dt          |	                    D ]$}
||                     |	|
         |dz             z  }%{|t          |	          z  }|S )N    r   Noner   )r  r]  r^  keysortr*  rE  rF  params_to_string)r	  objectlevelmaxLevelreturnString
paramsKeysr  rS  keyr%  js              r  rL  zcryptocom.params_to_stringu
  sE   Hv;;fc"" 	M
fd## 	-JJ\\&))Ffkkmm,,Jq#j//** 
	+ 
	+AQ-CCL3KE&E4(( +q#e**-- O OA D$9$9%(EAI$N$NNLLO E

*r  c                   K   |                                   d{V  |                     |          }|d         dd}|                     |d          }|                     |d          }|||d<   ||                     |d         |          |d<   |                     |                     ||                     d{V }|                     |d          }	|                     |	|          S )	a  
        closes open positions for a market
        :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-close-position
        :param str symbol: Unified CCXT market symbol
        :param str [marginMode]: not used by cryptocom.closePositions
        :param str [side]: not used by cryptocom.closePositions
        :param dict [params]: extra parameters specific to the okx api endpoint
         *
         * EXCHANGE SPECIFIC PARAMETERS
        :param str [params.type]: LIMIT or MARKET
        :param number [params.price]: for limit orders only
        :returns dict[]: `A list of position structures <https://docs.ccxt.com/#/?id=position-structure>`
        Nr)   r  )r[  r*  r*  r2  r#  r  )	r\  rT  r)  rG  r  !v1PrivatePostPrivateClosePositionr`  r  r  )
r	  r#  r  rP  rT  rc  r*  r2  rQ  r  s
             r  close_positionzcryptocom.close_position
  s      !!!!!!!!!V$$%d|
 
 %%ff55  11"GFO#66vh7GOOGG??GU[@\@\]]]]]]]] (33///r  r   GETc           	         |                      |d          }|                      |d          }| j        d         |         dz   |z   }	|                     ||                     |                    }
|dk    r|
r|	d|                     |
          z   z  }	n5|                                  t          |                                           }|                     i |          }t          |
                                          }|                     |d          }||z   | j        z   |z   |z   }|                     |                     |          |                     | j                  t           j                  }t%          |          }|                     |||| j        ||d          }|dk    rd}d	}|                    ||          }d
di}|	|||dS )Nr   r   r   r  r   r  )r)   methodrP  api_keysigrF  z{}z[]zContent-Typezapplication/json)r   rY  bodyheaders)rG  r   rt  extract_params	urlencodecheck_required_credentialsr  rF  r`  r^  r*  rL  apiKeyhmacencodesecrethashlibsha256rF  jsonreplace)r	  pathr   rY  rP  r]  r\  r*  accessr   queryrF  requestParamsrQ  
strSortKeypayload	signatureparamsKeysLengthparamsStringarrayStrings                       r  signzcryptocom.sign
  s   Q''!!#q))it$s*T1		&$"5"5d";";<<X 3sT^^E2222++---

%%E KKF33Mm002233J..}a@@JUlT[0:=EG		$++g"6"6DK8P8PRYR`aaI":99 ;    D  1$$#"||K>> 2G fdwOOOr  c
                     |                      |d          }
|
dk    rI| j        dz   |z   }|                     | j        d         |
|           t	          | j        dz   |z             d S )Nr  r    r  )rG  r)   throw_exactly_matched_exceptionr   r   )r	  r  reasonr   rY  r]  r\  rQ  requestHeadersrequestBody	errorCodefeedbacks               r  handle_errorszcryptocom.handle_errors
  sp    $$Xv66	w}t+H001I9V^___# 4555tr  rD  )Q__name__
__module____qualname__r  r   r	   rX  r   r   re  r  r   rh  r   r   r   rx  r   r  r^  r  r   r  r   r  r  r  r   r   floatr
   r  r  r   r  r  r  r  r   r  r  r  r   r'  r,  r6  r   r=  rB  rb  rx  r|  r  r  r  r  r  r   r  r  r  r  r  r  r  r   r	  r  r  r  r  r$  r(  r.  r'  rF  rL  rV  rs  r|  __classcell__)r
  s   @r  r'   r'      s	       j j j j jX *, x xV x x x xt 6:" 21 217 21 21 21 21 21h 68 0 0 0F 0 0 0 0 04$UYbd H? H? H?C H?s H?imnsit H? H? H? H?T <@d[] 4? 4? 4?S 4? 4?bfglbm 4? 4? 4? 4?l 8<$]ajl 7H 7H 7HC 7HWZ 7Hquvzq{ 7H 7H 7H 7Hr @DB 'C 'CS 'C 'CS\ 'C 'C 'C 'CR) ) ) ) ) *, 4, 4, 4, 4, 4, 4,l 8<B 2/ 2/C 2/ 2/ 2/ 2/ 2/h os{} P, P,3 P,i P,y P,Z_ P,hk P, P, P, P,d mqy{ !0 !0 !0I !0Y !0X] !0fi !0 !0 !0 !0F FH H) H)$|*< H) H) H) H)T x|  EG ^, ^,C ^,y ^,PY ^,ch ^,qt ^, ^, ^, ^,@ 59 \ \c \ \ \ \  9=R 0 0S 0# 0 0 0 0@ 6:" E Es E E E E: 59tZ^gi 8? 8?c 8? 8?TW 8?nrsxny 8? 8? 8? 8?t 37TX\eg >? >?C >?s >?RU >? >? >? >?@
 
 
 EIQS ,8 ,83 ,8 ,8 ,8 ,8 ,8\ JL 7 7S 7 7 7 7r =? - - - - - - 
D 
D 
D 04$UYbd 3L 3L 3LC 3Ls 3Limnyiz 3L 3L 3L 3Lj 37TX\eg 5O 5OC 5Os 5ORU 5Olpq|l} 5O 5O 5O 5On; ;6 ;V ; ; ; ;z9 9 95 9 9 9 9v
 
 
4 
 
 
 
(: : :H H H\ \ \5 \ \ \ \|: : :
: 
: 
:S
 S
x S
; S
 S
 S
 S
j GI $ $ $ $(, , , , , ,\ BFb Q Qw Q Q Q Q .2SW`b 8A 8As 8A# 8AS 8A 8A 8A 8At1
 1
 1
 1
 1
 1
f8 8 84 +- ,5 ,5g ,5 ,5 ,5 ,5\
 
 
B <@daenp -O -OS -O -O[^ -O -O -O -O^
 
 
&    >BPTcgpr BY BYs BY# BY]` BY BY BY BYH 8: &D &D3 &D &D &D &DP 8<B 6M 6MW 6M 6M 6M 6Mp- -v - - - -^# # #  4 CGr '0 '03 '0i '0V[ '0 '0 '0 '0R &eBSW %P %P %P %PN      r  r'   ), ccxt.async_support.base.exchanger   ccxt.abstract.cryptocomr   re  ccxt.base.typesr   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   r   r    r!   r"   r#   ccxt.base.decimal_to_precisionr$   ccxt.base.preciser%   r'    r  r  <module>r     sx   6 5 5 5 5 5 / / / / / /  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s  s       * * * * * * 0 0 0 0 0 0 - - - - - - . . . . . . . . . . . . ' ' ' ' ' ' & & & & & & . . . . . . ) ) ) ) ) ) ) ) ) ) ) ) + + + + + + * * * * * * ) ) ) ) ) ) 4 4 4 4 4 4 % % % % % %I+ I+ I+ I+ I++ I+ I+ I+ I+ I+r  