
    E#iW                       S SK Jr  S SKJr  S SKrS SKrS SKJrJrJ	r	J
r
JrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJ r   S SK!J"r"  S SK#J$r$  S SK#J%r%  S SK#J&r&  S S	K#J'r'  S S
K#J(r(  S SK#J)r)  S SK#J*r*  S SK#J+r+  S SK#J,r,  S SK#J-r-  S SK#J.r.  S SK#J/r/  S SK#J0r0  S SK#J1r1  S SK#J2r2  S SK#J3r3  S SK4J5r5  S SK6J7r7   " S S\\5      r8g)    )Exchange)ImplicitAPIN)AccountAnyBalances
CurrenciesCurrencyDepositAddressIntLedgerEntryMarketNumOrder	OrderBookOrderRequestCancellationRequest	OrderSide	OrderTypePositionStrStringsTickerTickersFundingRateTradeTradingFeeInterfaceTradingFeesTransaction)List)ExchangeError)AuthenticationError)PermissionDenied)AccountNotEnabled)ArgumentsRequired)
BadRequest)	BadSymbol)InsufficientFunds)InvalidOrder)OrderNotFound)NotSupported)DDoSProtection)RateLimitExceeded)OnMaintenance)InvalidNonce)RequestTimeout)	TICK_SIZE)Precisec                   r  ^  \ rS rSrS\4U 4S jjr0 4S\4S jjr0 4S\\	   4S jjr
S0 4S\S\4S jjr0 4S	\S\4S
 jjrSSS0 4S	\S\S\S\\   4S jjrSS0 4S	\S\S\S\\   4S jjrSSS0 4S	\S\S\S\S\\   4
S jjrS0 4S	\S\S\4S jjrS\4S jr0 4S\4S jjrS0 4S\S	\4S jjrS0 4S	\S\S\ S\!S\"4
S jjr#S0 4S	\S\S\ S\!S\"4
S jjr$0 4S\\%   4S jjr&S0 4S	\S\S\ S\!S\"4
S jjr'SS0 4S\S	\S\S\ S\"S\"4S  jjr(S0 4S\S	\S\!S\"4S! jjr)S0 4S	\4S" jjr*S0 4S\S	\4S# jjr+S0 4S$\\   S	\4S% jjr,0 4S\\-   4S& jjr.SSS0 4S	\S\S\S\\   4S' jjr/SSS0 4S	\S\S\4S( jjr0S) r1S0 4S*\S\!S+\S,\S\24
S- jjr30 4S*\S\\4   4S. jjr50 4S*\S\44S/ jjr6SSS0 4S*\S\S\S\\2   4S0 jjr7SSS0 4S*\S\S\S\\2   4S1 jjr8SiS2\9S3\	S\4S4 jjr:SiS5\9S3\	S\4S6 jjr;SiS3\	S\4S7 jjr<S8\4S9 jr=S:\4S; jr>SiS<\9S3\	S\4S= jjr?S> r@S? rASiS@\9SA\BS\24SB jjrC0 4SC jrDSiSA\B4SD jjrES0 4SE\4SF jjrFSSS0 4S*\S\S\S\\G   4SG jjrHSiSH\9SA\BS\G4SI jjrISJ rJ0 4S\\K   4SK jjrLSL rMSSS0 4S	\S\S\4SM jjrNSN rOSO rP0 4S	\4SP jjrQSiS3\	S\R4SQ jjrSSSS0 4S	\S\S\4SR jjrT0 4S	\4SS jjrUS0 4S\S\\V   4ST jjrWSiSU\9S3\	4SV jjrXSW rYSX rZS0 4S	\S\ S\4SY jjr[0 4S	\S\\4SZ jjr]0 4S\^4S[ jjr_S\ r`SiS]\9S3\	S\\4S^ jjraS_S`0 SS4Sa jrbS*\cSb\Sc\Sd\Se\9Sf\4Sg jrdShreU =rf$ )j	cryptocom    returnc                   > U R                  [        [        U ]  5       0 SS_SS_SS/_SS_S	S
_SS_SS_S0 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 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_S0S_S1S_S2S_E0 S3S_S4S_S5S,_S6S_S7S_S8S_S9S_S:S_S;S_S<S_S=S_S>S_S?S_S@S_SAS_SBS_SCS_E0 SDS_SES_SFS_SGS_SHS_SIS_SJS_SKS_SLS_SMS_SNS_SOS_SPS_SQS_SRS_SSS_STS_E0 SUS_SVS_SWS_SXS_SYS_SZS_S[S_S\S_S]S_S^S_S_S_S`S_SaS_SbS_ScS_SdS_SeS_ESSSSSSf.E_SgShSiSjSkSlSmSnSoSpSqSrSsSt._SuSvSwSxSxSy.SzS{S|S}S~.SSSS./ SQSS._SSSSS000SSSSSSSSSSS.
SS0S.S0 SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_0 SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_ESSSSSS.E0S.SSSSSSSSSSS.	0S0 SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SSSSSSSSSSSSS.E0S.SSSSSSSSSSS.	0S0 SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SSSSS.E0S.S~._SSU R	                  S5      U R	                  S5      U R	                  S5      U R	                  S5      /U R	                  S5      U R	                  S5      /U R	                  S5      U R	                  S5      /U R	                  S5      U R	                  S5      /U R	                  S5      U R	                  S5      /U R	                  S5      U R	                  S5      /U R	                  S5      U R	                  S5      /U R	                  S5      U R	                  S5      /U R	                  S5      U R	                  S5      /U R	                  S5      U R	                  S5      /U R	                  S5      U R	                  S5      //U R	                  S5      U R	                  S5      /U R	                  S5      U R	                  S5      /U R	                  S5      U R	                  S5      /U R	                  S5      U R	                  S5      /U R	                  S5      U R	                  S5      /U R	                  S5      U R	                  S5      /U R	                  S5      U R	                  S5      /U R	                  S5      U R	                  S5      /U R	                  S5      U R	                  S5      /U R	                  S5      U R	                  S5      /U R	                  S5      U R	                  S5      //S.S.0_SSSSSSSSS.SSSS.SS._SSSSSSSS.SSSS SSSSS.SSSSSSSS.SS
0SSS SSS.SSSSS.SSSSSS.SSS SSSSS.SSS S SSSSS.SS0S.	SSS0S.SS0SS0S.SS0SS0S.S._SSS0_GS [
        _GS0 GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS	[        _GS
[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _0 GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS [        _GS![        _GS"[        _GS#[        _E0 GS$[        _GS%[        _GS&[        _GS'[        _GS([        _GS)[        _GS*[        _GS+[        _GS,[        _GS-[        _GS.[         _GS/["        _GS0[$        _GS1[        _GS2[        _GS3[        _GS4[        _E[        [&        GS5.E0 GS6._5      $ (7  Nidr3   namez
Crypto.com	countriesMTversionv2	rateLimit
   	certifiedTprohasCORSFspotmarginswapfutureoption	addMargincancelAllOrderscancelOrdercancelOrderscancelOrdersForSymbolscloseAllPositionsclosePositioncreateMarketBuyOrderWithCostcreateMarketOrderWithCostcreateMarketSellOrderWithCostcreateOrdercreateOrderscreateStopOrdercreateTriggerOrder	editOrderfetchAccountsfetchBalancefetchBidsAsksfetchBorrowInterestfetchBorrowRateHistoriesfetchBorrowRateHistoryfetchClosedOrdersemulatedfetchCrossBorrowRatefetchCrossBorrowRatesfetchCurrenciesfetchDepositAddressfetchDepositAddresses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fetchPositionHistoryfetchPositionModefetchPositionsfetchPositionsHistoryfetchPremiumIndexOHLCVfetchSettlementHistoryfetchStatusfetchTickerfetchTickers	fetchTimefetchTradesfetchTradingFeefetchTradingFeesfetchTransactionFeesfetchTransactionsfetchTransfersfetchUnderlyingAssetsfetchVolatilityHistoryfetchWithdrawalsreduceMarginrepayCrossMarginrepayIsolatedMarginsandbox)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.comz"https://api.crypto.com/exchange/v1zhttps://api.crypto.com/v2zhttps://deriv-api.crypto.com/v1)baser   r<   r   zhttps://crypto.com/z"https://crypto.com/exch/kdacthrnxtg      ?)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   publicgetzv1/public/get-announcements   g
@)
public/authpublic/get-instrumentspublic/get-bookpublic/get-candlestickpublic/get-tradespublic/get-tickerspublic/get-valuations#public/get-expired-settlement-pricepublic/get-insurancezpublic/get-risk-parametersz"public/staking/get-conversion-rate   )r   postr   z 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/amend-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-listzprivate/create-withdrawalzprivate/get-currency-networkszprivate/get-deposit-addressprivate/get-accountszprivate/get-withdrawal-historyzprivate/get-deposit-historyzprivate/get-fee-ratezprivate/get-instrument-fee-ratezprivate/staking/stakezprivate/staking/unstakez$private/staking/get-staking-positionz'private/staking/get-staking-instrumentszprivate/staking/get-open-stake)z!private/staking/get-stake-historyz"private/staking/get-reward-historyzprivate/staking/convertz private/staking/get-open-convertz#private/staking/get-convert-history)r   private)	r   r   r   r   zpublic/get-tickerr   z%public/margin/get-transfer-currenciesz!public/margin/get-load-curreniceszpublic/respond-heartbeatz$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-order)	r   r   r   r   r   r   r   r   r   zprivate/convert-collateral)r   r   r   r   r   tradingz0.0025z0.005010000z0.00250000z0.0015250000z0.001500000z0.00082500000z0.000651000000025000000	100000000	250000000	500000000z0.004z0.0018z0.0005z0.0004z0.00035z0.00031z0.00025)makertaker)r   r   tiersoptionsSPOTMARGINDERIVATIVES)fundingrC   rD   r   rE   rF   BSCETHTRON)BEP20ERC20TRC20CCXT)defaultTypeaccountsByIdnetworksbrokerfeatures)lastmarkindex)IOCFOKPOGTD)
marginModetriggerPricetriggerPriceTypetriggerDirectionstopLossPricetakeProfitPriceattachedStopLossTakeProfittimeInForcehedgedselfTradePreventiontrailingicebergleveragemarketBuyByCostmarketBuyRequiresPricemax)r   limitdaysBack	untilDayssymbolRequired)r   triggerr  r  )r   r  r  r  r  )r   r  r	  r
  r  r  r  )r   r  r	  daysBackCanceledr
  r  r  r  r  ,  )	r   rR   rS   rz   r}   r|   r   r]   r{   defaultr   )extendsra   r  )linearinverse)r  rC   rE   rF   commonCurrenciesUSD_STABLE_COINUSDCprecisionMode
exceptions219306314325415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4010240103401044010740401408014290143005430034300443012)500019010001)exactbroad)deep_extendsuperr3   describeparse_numberr0   r(   r'   r    r"   r%   r+   r.   r#   r&   r!   r)   r/   r,   r-   )self	__class__s    V/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/async_support/cryptocom.pyrQ  cryptocom.describe"   s   i ? A D
+D
LD
 $D
 t	D

 D
 D
 4D
  [[[ $[ 	[
 $[ $[ U[ "4[ t[ [ )$[ $U[  [ /[ ,U[  0![" t#[$ %[& "4'[( %d)[* T+[,  -[. /[0  1[2 &u3[4 +E5[6 )%7[8 $Z9[: ';[< (=[> "4?[@ &tA[B (C[D 1$E[F  G[H +EI[J *:K[L +DM[N &uO[P #DQ[R *4S[T $UU[V uW[X "5Y[Z *5[[\ +E][^ t_[`  a[b %ec[d /e[f "5g[h +Ei[j k[l !%m[n +Eo[p  q[r ds[t "4u[v dw[x !$y[z t{[|  }[~ '[@ $UA[B !$C[D (E[F )%G[H )$I[J uK[L tM[N O[P UQ[R tS[T "4U[V #DW[X 'Y[Z $U[[\ !%][^ (_[` )%a[b #Dc[d e[f #Eg[h &ui[j 4k[l  %!&#(! u[D
H ID
d ?6#? 5>5#D	 -? $
 K/eD
V 91  ,26</067122356CI45:;  A!!$  (!>(!>(! 3F(! ;F	(!
 4V(! 3E(! 25(! 8(! 3E(! 8(! 8(! 5f(! 8(! 6v(! 7(!  1#!(!" >v#(!$ 7%(!& A&'(!( >v)(!* 5f+(!, 8-(!. <V/(!0 :61(!2 3F3(!4 =f5(!6 :67(!8 3A9(!: >q;(!< 4Q=(!> 6q?(!@ CAA(!B FqC(!D =aE(!F BCBC78@ACDO(!* %=@ +,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<+! ' m^WD
T	 !..x8!..w7 "..s3T5F5Fx5PQ!..w79J9J79ST!..w79J9J89TU!..x8$:K:KG:TU!..x8$:K:KH:UV!..y94;L;LY;WX!..z:D<M<Mc<RS!..z:D<M<Mc<RS!..{;T=N=Ns=ST!..{;T=N=Ns=ST!..{;T=N=Ns=ST" "..s3T5F5Fw5OP!..w79J9J79ST!..w79J9J89TU!..x8$:K:KG:TU!..x8$:K:KH:UV!..y94;L;LW;UV!..z:D<M<Mh<WX!..z:D<M<Mh<WX!..{;T=N=Ny=YZ!..{;T=N=Ny=YZ!..{;T=N=Ny=YZ"!U	D
X
 %%"&#0)+! #"#
 !Y
D
z
 #&*(, %)$(%)-
 -2)-+/6:#'#'"&#(	( #(/3$)#($)+/263$8 r% ',!$$(%&*/& ',#($)*/	# '+!$#($)*/( ',!$$(%&#($)*/$ ',!$$(,0%&#($)*/	*  #OJX  )!4( "9 "9 	 "9 "9 	ub{
D
B !6!CD
H YID
J 6<6,6 <6 <	6
 <6 ]6 -6 -6 Z6 -6 ^6 \6 Z6 Z6 Z6  .!6" .#6$ Y%6& Z'6( Z)6* \+6, \-6. \/60 \162 Z364 \566 \768 \96: \;6< \=6> \?6@ \A6B ZC6D ZE6F ZG6H ZI6J ZK6L ZM6N ZO6P 0Q6R \S6T 0U6V 0W6X ZY6Z ][6\ ^]6^ ._6` \a6b \c6d \e6f Zg6h +,k6n q9KD
  	    c                   #    U R                  S5      (       d  0 $ SnU R                  USSS5      u  p!U(       a  0 $ 0 n U R                  U5      I Sh  vN nU R                  US0 5      nU R                  US0 5      n[        UR                  5       5      n0 n[        S[        U5      5       GH  n	Xy   n
Xj   nU
nU R                  U5      n0 nU R                  US/ 5      n[        S[        U5      5       H  nUU   nU R                  US	5      nU R                  U5      nUUUSU R                  US
S5      U R                  USS5      U R!                  US5      SSU R!                  US5      SS.0S.	UU'   M     U R#                  UUUU R                  US5      SSSSSSSSS.0SUS.5      X'   GM     U$  GNe! [         a#  n[	        U[
        5      (       a  0 s SnA$ UeSnAff = f7f)a  
fetches all available currencies on an exchange

https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-currency-networks

:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: an associative dictionary of currencies
Fra   skipFetchCurrenciesNresultcurrency_mapr   network_list
network_iddeposit_enabledwithdraw_enabledwithdrawal_feer   min_withdrawal_amountminr  )	infor7   networkactivedepositr   fee	precisionlimits	full_nameamountcrypto)rd  r7   coder8   rf  rg  r   rh  ri  rj  typer   )check_required_credentialshandle_option_and_params'v1PrivatePostPrivateGetCurrencyNetworks	Exception
isinstancer    	safe_dictlistkeysrangelensafe_currency_code	safe_listsafe_stringnetwork_id_to_code	safe_boolsafe_numbersafe_currency_structure)rS  paramsrY  responsee
resultDatacurrencyMaprw  rZ  ikeycurrencyr7   rn  r   chainsjchain	networkIdre  s                       rU  fetch_currenciescryptocom.fetch_currencies$  s6     ..u55I#&*&C&CFL]_tv{&|#I	!II&QQHf ^^Hh;
nnZDK$$&'q#d)$A'C"'HB**2.DH^^HnbAF1c&k*q	 ,,ULA	11)<!#&"#~~e5FN $u6H% P++E3CD!%"#'#3#3E;R#S#'%%!	 +(  77 ((;? !## !$#9 FL7 %\ K R 	!]++ 	G	sM   <G+F; F8F; E G+8F; ;
G(G#G(G+!G##G((G+c                 b  #    U R                  U5      I Sh  vN nU R                  US0 5      nU R                  US/ 5      n/ n[        S[	        U5      5       GH  nXF   nU R                  US5      nUS:H  n	US:H  n
US:H  nUS	:H  nU R                  US
5      nU R                  US5      nU	(       a  SOUnU R                  U5      nU R                  U5      nU	(       a  SOU R                  U5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  U R                  US5      5      nUb  [        U5      OSnUS-   U-   nSnSnUS:X  a  SnSnOxUS:X  a  SnUS-   U-   nSnOeUS:X  a"  SnUS-   U-   S-   U R                  U5      -   nSnO=US	:X  a7  SnUS:X  a  SOSnUS-   U-   S-   U R                  U5      -   S-   U-   S-   U-   nSnUR                  0 SU R                  US5      _SU_SU_S U_S!U_S"U_S#U_S$U_S%U_SU	_S&U=(       d    U_SU
_SU_SU_S'U R                  US(5      _S)U_S*U(       a  SOS_U(       a  SOSU R                  US+5      UU R                  U5      U R                  U5      UU R                  U R                  US,5      5      U R                  U R                  US-5      5      S..U R                  S/5      U R                  US05      S1.SSS1.SSS1.SSS1.S2.SUS3.
E5        GM     U$  GN7f)4a  

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
NrZ  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/rC   FrE   :TrF   -rG   callCPr7   symbolr   quotesettlebaseIdquoteIdsettleIdro  rD   rf  tradablecontractr  contract_sizeprice_tick_sizeqty_tick_size)pricerl  1max_leveragerb  )r  rl  r  cost)
r  contractSizeexpiryexpiryDatetimer  
optionTyperi  rj  createdrd  )v1PublicGetPublicGetInstrumentsru  r{  rx  ry  r|  rz  safe_string_lowerr~  	omit_zerointyymmddappendr  iso8601rR  )rS  r  r  resultResponser  rZ  r  marketr  rC   rE   rF   rG   r  r  r  r   r  r  r  r  marginBuyEnabledmarginSellEnabledexpiryStringr  r  ro  r  symbolOptionTypes                                rU  fetch_marketscryptocom.fetch_markets  s*     ==fEEp (B?~~nfb9q#d)$AWF((=I
*D 00D(*F)+F%%fj9F&&v{;G#tH**62D++G4E!Tt'>'>x'HF//
CJ%%fh7F#~~f6JK $v7L M>>$*:*:6CX*YZL+7+CS&$FCZ%'FDHJ& ..#-h&#-3dkk&6IIi'+5+?3c #-3dkk&6IICORXX[^^aqqMM 0d&&vx80&0 0 	0
 &0 &0 70 H0 0 0 ,D2C0 0 &0 &0 $..<0  H!0" 8$$#0$ &.5D $ 0 0 I "&,,v"6++F3(!..t/?/?HY/Z["//0@0@0YZ  $005#//G!
  $#
  $#
  $#$  _0 0M %n e Fs   L/L,LL/Nsymbolsc                   #    U R                  5       I Sh  vN   Sn0 nUba  Sn[        U[        5      (       a/  [        U5      nUS:  a  [	        U R
                  S-   5      eUS   nOUnU R                  U5      nUS   US'   U R                  U R                  XB5      5      I Sh  vN nU R                  US0 5      nU R                  US/ 5      n	U R                  X5      $  N N=7f)	aI  
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market

https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-tickers
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   r7   instrument_namerZ  r  )load_marketsrt  rv  ry  r%   r7   r  v1PublicGetPublicGetTickersextendru  r{  parse_tickers)
rS  r  r  r  requestr  symbolsLengthr  rZ  r  s
             rU  fetch_tickerscryptocom.fetch_tickers[  s      !!!F'4(( #G 1$$TWW/s%stt  [[(F)/G%&99$++g:VWW2 (B7~~ffb1!!$00S 	" Xs"   C&C"BC&&C$'<C&$C&r  c                    #    U R                  5       I Sh  vN   U R                  U5      nU R                  U/U5      I Sh  vN nU R                  X15      $  NA N7f)a  

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  r  
safe_value)rS  r  r  tickerss       rU  fetch_tickercryptocom.fetch_ticker  sU      !!!V$**F8V<<w// 	"<s!   AA+AAAAsincer  c                 ,  #    U R                  5       I Sh  vN   SnU R                  USS5      u  pTU(       a  U R                  SXX45      I Sh  vN $ Sn0 nUb  U R                  U5      nUS   US'   Ub  X'S'   Ub  X7S'   U R	                  US	5      nU R                  US	/5      nUb  XS
'   U R                  U R                  Xt5      5      I Sh  vN n	U R                  U	S0 5      n
U R                  U
S/ 5      nU R                  XX#5      $  N N N@7f)a  
fetches information on multiple orders made by the user

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>`
NFr   paginater7   r  
start_timer  untilend_timerZ  r  )r  rq  fetch_paginated_call_dynamicr  safe_integeromit#v1PrivatePostPrivateGetOrderHistoryr  ru  r{  parse_orders)rS  r  r  r  r  r  r  r  r  r  r  orderss               rU  fetch_orderscryptocom.fetch_orders  s5     !!!88PZ[::=&Y^ggg[[(F)/G%&$)L!$G!!&'26G9-"'JAA$++gB^__P ~~h"5fb1  >>y 	" h `s4   DD8DDBDD=DDDc                   #    U R                  5       I Sh  vN   SnU R                  USS5      u  pTU(       a  U R                  SXX45      I Sh  vN $ U R                  U5      nSUS   0nUb  X'S'   Ub  X7S'   U R	                  US	5      nU R                  US	/5      nUb  XS
'   U R                  U R                  Xt5      5      I Sh  vN n	U R                  U	S0 5      n
U R                  U
S/ 5      nU R                  XX#5      $  N N N@7f)ag  
get a list of the most recent trades for a particular symbol

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>`
NFr   r  r  r7   start_tscountr  end_tsrZ  r  )r  rq  r  r  r  r  v1PublicGetPublicGetTradesr  ru  r{  parse_trades)rS  r  r  r  r  r  r  r  r  r  rZ  tradess               rU  fetch_tradescryptocom.fetch_trades  s'     !!!88PZ[::=&Y^gggV$vd|
 "'J$G!!&'26G9- %H88W9UVV* (B73  >>Q 	" h Ws4   DD8DDA9D	D

=DD
Dr   	timeframec           	        #    U R                  5       I Sh  vN   SnU R                  USSS5      u  peU(       a  U R                  SXXBUS5      I Sh  vN $ U R                  U5      nUS   U R	                  U R
                  X"5      S.nUb  US:  a  SnXHS'   U R                  5       n	U R                  U5      n
U R                  US	U	5      nU R                  US	/5      nUb-  X:S
-  -
  US'   Ub  U R                  X:U-  S
-  5      US'   O	XS'   OXS'   U R                  U R                  X5      5      I Sh  vN nU R                  US0 5      nU R                  US/ 5      nU R                  XX#U5      $  GN_ GN& NC7f)a  
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market

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
NFr{   r  r  r7   )r  r  r  r  i  r  r  rZ  r  )r  rq  "fetch_paginated_call_deterministicr  r|  r   microsecondsparse_timeframer  r  sumv1PublicGetPublicGetCandlestickr  ru  r{  parse_ohlcvs)rS  r  r  r  r  r  r  r  r  nowdurationr  r  rZ  r  s                  rU  fetch_ohlcvcryptocom.fetch_ohlcv$  s     !!!88z[`a@@v^cpvx{|||V$%d|))$//9P
 s{$G!''	2!!&'376G9-"'T/"9GJ $(HHUu4Dt4K$L!$)! %H==dkk'>Z[[, (B7~~ffb1  yGGe 	" }, \s4   E=E5;E=E8C$E=7E;8>E=8E=;E=c                   #    U R                  5       I Sh  vN   U R                  U5      nSUS   0nU(       a  [        US5      US'   U R                  U R	                  XS5      5      I Sh  vN nU R                  US0 5      nU R                  US/ 5      nU R                  US5      n	U R                  U	S	5      n
U R                  XU
5      $  N Nb7f)
a  
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data

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  r7   2   depthrZ  r  r   t)
r  r  rc  v1PublicGetPublicGetBookr  ru  r{  r  r  parse_order_book)rS  r  r  r  r  r  r  rZ  r  	orderBook	timestamps              rU  fetch_order_bookcryptocom.fetch_order_bookg  s      !!!V$vd|
 "5"~GG66t{{77STT& (B7~~ffb1OOD!,	%%i5	$$Y	BB= 	" Us#   CCAC,C-A!CCc                    U R                  US0 5      nU R                  US/ 5      nU R                  US   S/ 5      nSU0n[        S[	        U5      5       Hh  nXF   nU R                  US5      nU R                  U5      n	U R                  5       n
U R                  US5      U
S'   U R                  US	5      U
S
'   XU	'   Mj     U R                  U5      $ )NrZ  r  r   position_balancesrd  r  quantitytotalreserved_qtyused)	ru  r{  r  rx  ry  r|  rz  accountsafe_balance)rS  r  responseResultr  positionBalancesrZ  r  balance
currencyIdrn  r	  s              rU  parse_balancecryptocom.parse_balance  s    (B?~~nfb9??474GL)q#./0A&)G))'3DEJ**:6DllnG#//DGG"..wGGFO"4L 1   ((rW  c                    #    U R                  5       I Sh  vN   U R                  U5      I Sh  vN nU R                  U5      $  N. N7f)aX  
query for balance and get the amount of funds available for trading or funds locked in orders

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  )rS  r  r  s      rU  fetch_balancecryptocom.fetch_balance  sI      !!!==fEEX !!(++[ 	"Es   A	AA	AA	A	r7   c                   #    U R                  5       I Sh  vN   SnUb  U R                  U5      nSU0nU R                  U R                  XS5      5      I Sh  vN nU R	                  US0 5      nU R                  Xt5      $  Nj N*7f)a  
fetches information on an order made by the user

https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-order-detail

:param str id: order id
:param str symbol: unified symbol of the market the order was made in
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
Norder_idrZ  )r  r  "v1PrivatePostPrivateGetOrderDetailr  ru  parse_order)rS  r7   r  r  r  r  r  orders           rU  fetch_ordercryptocom.fetch_order  s      !!![[(F
 @@WA]^^D x26..U 	" _"   BBABB)BBro  siderl  r  c                    U R                  U5      nUR                  5       nUS   UR                  5       U R                  X5      S.n	US:X  d  US:X  d  US:X  a  U R                  X5      U	S'   U R	                  U R
                  SS5      n
XS	'   S nS nU R                  S
Xv5      u  pU R                  S
U5      u  pUS:X  d  Ub  SU	S'   OUS:X  a  SU	S'   U R                  USS5      nUb(  US:X  a  SU	S'   OUS:X  a  SU	S'   OUS:X  a  SU	S'   OXS'   U R                  USS5      nU(       d  US:X  a  S/U	S'   SU	S'   U R                  U/ SQ5      nU R                  US5      nU R                  US5      nUS LnUS LnUS LnU(       a  U R                  X5      U	S '   U R                  U5      nUS:X  d  US:X  d  US:X  aV  US!:X  a(  [        R                  " UU5      (       a  SU	S"'   OSU	S"'   O[        R                  " UU5      (       a  SU	S"'   OSU	S"'   OUS!:X  a(  [        R                  " UU5      (       a  S#U	S"'   OS$U	S"'   O[        R                  " UU5      (       a  S$U	S"'   OrS#U	S"'   OlU(       a-  US:X  d  US:X  a  SU	S"'   OS$U	S"'   U R                  UU5      U	S '   O8U(       a-  US:X  d  US:X  a  SU	S"'   OS#U	S"'   U R                  UU5      U	S '   OXS"'   U R                  U/ S%Q5      nU R!                  X5      $ )&Nr7   )r  r  r  LIMIT
STOP_LIMITTAKE_PROFIT_LIMITr  r   r   	broker_idrR   rD   r   spot_marginrC   r   r   time_in_forceGTCGOOD_TILL_CANCELr   IMMEDIATE_OR_CANCELr   FILL_OR_KILLpostOnlyFr   	POST_ONLY	exec_inst	stopPricer   	ref_pricer   r   r.  buyro  TAKE_PROFIT	STOP_LOSSr)  clientOrderIdr   r-  r   r   r   )r  upperamount_to_precisionprice_to_precisionr|  r   handle_market_type_and_params$custom_handle_margin_mode_and_paramssafe_string_upper_2r~  safe_string_nr  number_to_stringr1   	string_ltr  r  )rS  r  ro  r  rl  r  r  r  uppercaseTyper  r   
marketTyper   r   r)  r   r   r   	isTriggerisStopLossTriggerisTakeProfitTriggerpriceStrings                         rU  create_order_requestcryptocom.create_order_request  sT   V$

%d|JJL00@

 W$-<*G]^qMq#66vEGG!!$,,&A%

!??v^
!FF}V\]
("
(>%-GM"6!%+GM"..v}oV"e#+=(%+@(%+9(+6(>>&*e<+-$/=GK '9GO$))&2\]((A**63DE!-	*$6.d:#'#:#:6#PGK //6K(m|.KQ^buQu5=((lCC*=*6((lCC*6*=5=((lCC*7*5((lCC*5*7(m|.K"."-#'#:#:6=#QGK  (m?R.R"5"/#'#:#:6?#SGK +FO6  $Q  R{{7++rW  c                   #    U R                  5       I Sh  vN   U R                  U5      nU R                  XX4XV5      nU R                  U5      I Sh  vN n	U R	                  U	S0 5      n
U R                  X5      $  Ne N*7f)aJ  
create a trade order

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 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.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.triggerPrice]: price to trigger a trigger 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>`
NrZ  )r  r  rC  v1PrivatePostPrivateCreateOrderru  r  )rS  r  ro  r  rl  r  r  r  r  r  rZ  s              rU  create_ordercryptocom.create_orderb  s~     & !!!V$++F$V==gFF (B7//! 	" Gs!   B A<<B A>)B >B r  c           	        #    U R                  5       I Sh  vN   / n[        S[        U5      5       H  nX   nU R                  US5      nU R                  US5      nU R                  US5      nU R	                  US5      n	U R	                  US5      n
U R                  US0 5      nU R                  XgXX5      nUR                  U5        M     U R                  US	S
5      nUUS.nU R                  U R                  X5      5      I Sh  vN nU R	                  US/ 5      nU R                  US5      nUb  SU0/nU R                  U5      $ U R                  U5      $  GNG NV7f)a#  
create a list of trade orders

https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-order-list-list
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
: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  ro  r  rl  r  r  contingency_typeLISTrJ  
order_listrZ  list_idr  )r  rx  ry  r|  r  ru  create_advanced_order_requestr  #v1PrivatePostPrivateCreateOrderListr  r  )rS  r  r  ordersRequestsr  rawOrdermarketIdro  r  rl  r  orderParamsorderRequest
contigencyr  r  rZ  listId	ocoOrderss                      rU  create_orderscryptocom.create_orders  so     !!!q#f+&AyH''(;H##Hf5D##Hf5D__Xx8FOOHg6E..8R@K==hd\aoL!!,/ ' %%f.@&I
 *(
 AA$++gB^__T 8R8!!&)4$f-.I$$Y//  ((A 	"" `s#   E"EC2E"	E 
AE" E"c                    U R                  U5      nUR                  5       nUS   UR                  5       S.n	US:X  d  US:X  d  US:X  a  U R                  X5      U	S'   U R                  U R                  SS5      n
XS	'   U R                  US
S5      nUb(  US:X  a  SU	S'   OUS:X  a  SU	S'   OUS:X  a  SU	S'   OXS'   U R                  USS5      nU(       d  US:X  a  S/U	S'   SU	S'   U R                  U/ SQ5      nU R                  US5      nU R                  US5      nUS LnUS LnUS LnU(       a  U R                  U5      nUS:X  d  US:X  d  US:X  aV  US:X  a(  [        R                  " UU5      (       a  SU	S'   OSU	S'   O[        R                  " UU5      (       a  SU	S'   OSU	S'   OUS:X  a(  [        R                  " UU5      (       a  SU	S'   OpSU	S'   Oj[        R                  " UU5      (       a  SU	S'   OHSU	S'   OBU(       a  US:X  d  US:X  a  SU	S'   O)SU	S'   O#U(       a  US:X  d  US:X  a  SU	S'   O
SU	S'   OXS'   US:X  a  US:X  d  US:X  d  US:X  a  S nSnU R                  US S!S5      u  nnU R                  US"S#5      nU R                  US"5      nUb  U R                  UU5      nOU(       ag  Uc  [!        U R"                  S$-   5      eU R                  U5      nU R                  U5      n[        R$                  " UU5      nU R                  UU5      nOU R                  X5      nUU	S#'   OU R'                  X5      U	S%'   U R                  U/ S&Q5      nU R)                  X5      $ )'Nr7   )r  r  r  r   r!  r  r   r   r"  r   r$  r%  r&  r   r'  r   r(  r)  Fr   r*  r+  r,  r   r   r/  ro  r0  r1  MARKETTrR   !createMarketBuyOrderRequiresPricer  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  r2  )r  r4  r6  r|  r   r9  r~  r:  r  r;  r1   r<  rq  safe_number_2r  cost_to_precisionr(   r7   
string_mulr5  r  )rS  r  ro  r  rl  r  r  r  r=  r  r   r   r)  r   r   r   r?  r@  rA  rB  quoteAmountr]  r  amountStringcostRequests                            rU  rO  'cryptocom.create_advanced_order_request  s   
 V$

%d|JJL
 W$-<*G]^qMq#66vEGG!!$,,&A%..v}oV"e#+=(%+@(%+9(+6(>>&*e<+-$/=GK '9GO$))&2\]((A**63DE!-	*$6.d://6K(m|.KQ^buQu5=((lCC*=*6((lCC*6*=5=((lCC*7*5((lCC*5*7(m|.K"."- (m?R.R"5"/+FOEM(!:Q\@\bo  tA  cAK04-8<8U8UV\^k  nQ  SW  9X5-v%%ffjADYYvv.F"44VTB2=&tww  2}  (}  ~  ~#'#8#8#@L"&"7"7">K")"4"4\;"OK"&"8"8"MK"44VD"-GJ"&":":6"JGJ6  $Q  R{{7++rW  c                    #    U R                  5       I Sh  vN   U R                  XXVU5      nU R                  U5      I Sh  vN n	U R                  U	S0 5      n
U R	                  U
5      $  NT N*7f)a  
edit a trade order

https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-amend-order

:param str id: order id
:param str symbol: unified market symbol of the order to edit
:param str [type]: not used by cryptocom editOrder
:param str [side]: not used by cryptocom editOrder
:param float amount:(mandatory) how much of the currency you want to trade in units of the base currency
:param float price:(mandatory) the price for the order, in units of the quote currency, ignored in market orders
:param dict [params]: extra parameters specific to the exchange API endpoint
:param str [params.clientOrderId]: the original client order id of the order to edit, required if id is not provided
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
NrZ  )r  edit_order_requestv1PrivatePostPrivateAmendOrderru  r  )rS  r7   r  ro  r  rl  r  r  r  r  rZ  s              rU  
edit_ordercryptocom.edit_order4  sk       !!!))"fVL<<WEE(B7''	 	"Es!   A/A++A/A-)A/-A/c                 P   0 nUb  XS'   OFU R                  USS5      nUc  [        U R                  S-   5      eXvS'   U R                  USS/5      nUb  Uc  [        U R                  S-   5      eU R	                  X#5      US'   U R                  X$5      US'   U R                  Xe5      $ )Nr  orig_client_oidr3  zA editOrder() requires an id argument or orig_client_oid parameterz editOrder() requires both amount and price arguments. If you do not want to change the amount or price, you should pass the original valuesnew_quantity	new_price)safe_string_2r$   r7   r  r5  r6  r  )rS  r7   r  rl  r  r  r  originalClientOrderIds           rU  rg  cryptocom.edit_order_requestJ  s    >"$J$($6$6v?PRa$b!$,'2u(uvv-B)*6,=+OPN#DGG  /}  %}  ~  ~"&":":6"J#66vE{{7++rW  c                    #    U R                  5       I Sh  vN   Sn0 nUb  U R                  U5      nUS   US'   U R                  U R                  XB5      5      I Sh  vN nU R	                  SU05      /$  N` N7f)aa  
cancel all open orders

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:
Nr7   r  rd  )r  r  #v1PrivatePostPrivateCancelAllOrdersr  
safe_order)rS  r  r  r  r  r  s         rU  cancel_all_orderscryptocom.cancel_all_orders[  s      !!![[(F)/G%&AA$++gB^__ 2344 	" `s"   A;A7AA;A9A;9A;c                   #    U R                  5       I Sh  vN   SnUb  U R                  U5      nSU0nU R                  U R                  XS5      5      I Sh  vN nU R	                  US0 5      nU R                  Xt5      $  Nj N*7f)a  
cancels an open order

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  rZ  )r  r  v1PrivatePostPrivateCancelOrderr  ru  r  )rS  r7   r  r  r  r  r  rZ  s           rU  cancel_ordercryptocom.cancel_ordern  s      !!![[(F
 ==dkk'>Z[[ (B7//+ 	" \r  idsc                   #    Uc  [        U R                  S-   5      eU R                  5       I Sh  vN   U R                  U5      n/ n[	        S[        U5      5       H)  nX   nUS   [        U5      S.nUR                  U5        M+     SUS.n	U R                  U R                  X5      5      I Sh  vN n
U R                  U
S/ 5      nU R                  XSSU5      $  N N-7f)	af  
cancel multiple orders

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   r7   r  r  rK  rL  rZ  )r$   r7   r  r  rx  ry  strr  #v1PrivatePostPrivateCancelOrderListr  r{  r  )rS  r{  r  r  r  orderRequestsr  r7   r  r  r  rZ  s               rU  cancel_orderscryptocom.cancel_orders  s      >#DGG.Z$Z[[!!!V$q#c(#AB#)$<GE   ' $ !''
 AA$++gB^__(B7  tVDD! 	" `s"   /C#CBC#3C!4,C#!C#c                   #    U R                  5       I Sh  vN   / n[        S[        U5      5       H^  nX   nU R                  US5      nU R                  US5      nU R	                  U5      nUS   [        U5      S.n	UR                  U	5        M`     SUS.n
U R                  U R                  X5      5      I Sh  vN nU R                  US/ 5      nU R                  USSSU5      $  N N.7f)	a  
cancel multiple orders for multiple symbols

https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order-list-list

:param CancellationRequest[] orders: each order should contain the parameters required by cancelOrder namely id and symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
: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>`
Nr   r7   r  r}  rK  rL  rZ  )r  rx  ry  r|  r  r~  r  r  r  r{  r  )rS  r  r  r  r  r  r7   r  r  	orderItemr  r  rZ  s                rU  cancel_orders_for_symbols#cryptocom.cancel_orders_for_symbols  s      !!!q#f+&AIE!!%.B%%eX6F[[(F#)$<GI   + ' !''
 AA$++gB^__(B7  tT6BB% 	"  `s"   C-C)B%C-<C+=-C-+C-c                 B  #    U R                  5       I Sh  vN   Sn0 nUb  U R                  U5      nUS   US'   U R                  U R                  Xd5      5      I Sh  vN nU R	                  US0 5      nU R                  US/ 5      n	U R                  XX#5      $  N N>7f)a  
fetch all unfilled currently open orders

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>`
Nr7   r  rZ  r  )r  r  !v1PrivatePostPrivateGetOpenOrdersr  ru  r{  r  )
rS  r  r  r  r  r  r  r  r  r  s
             rU  fetch_open_orderscryptocom.fetch_open_orders  s      !!![[(F)/G%&??G@\]]L ~~h"5fb1  >>] 	" ^s"   BBABB=BBc                 .  #    U R                  5       I Sh  vN   SnU R                  USS5      u  pTU(       a  U R                  SXX4S5      I Sh  vN $ 0 nSnUb  U R                  U5      nUS   US'   Ub  X&S'   Ub  X6S	'   U R	                  US
5      nU R                  US
/5      nUb  XS'   U R                  U R                  Xd5      5      I Sh  vN n	U R                  U	S0 5      n
U R                  U
S/ 5      nU R                  XX#5      $  N N N@7f)a>  
fetch all trades made by the user

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>`
NFrz   r  r   r7   r  r  r  r  r  rZ  r  )r  rq  r  r  r  r  v1PrivatePostPrivateGetTradesr  ru  r{  r  )rS  r  r  r  r  r  r  r  r  r  rZ  r  s               rU  fetch_my_tradescryptocom.fetch_my_trades	  s7     !!!88R\]::?F[`jmnnn[[(F)/G%&$)L!$G!!&'26G9-"'J;;DKK<XYY< (B73  >>e 	" o Zs4   DD9DDBDD=DDDc                     S nS nS nUR                  S5      S:  a,  UR                  S5      u  p$UR                  S5      nUS   nX#/$ UnX#/$ )N?r   =r   )findsplit)rS  addressStringaddresstagrawTagsplitteds         rU  parse_addresscryptocom.parse_addressK  sf    c"Q&+11#6OG||C(H1+C ~ $G~rW  rn  r  r  c                   #    U R                  XE5      u  pEU R                  5       I Sh  vN   U R                  U5      nUS   UUS.nUb  XGS'   SnU R                  U5      u  pU R	                  U5      n	U	b  XS'   U R                  U R                  Xu5      5      I Sh  vN n
U R                  U
S5      nU R                  X5      $  N N)7f)a  
make a withdrawal

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>`
Nr7   )r  rl  r  address_tagr]  rZ  )	handle_withdraw_tag_and_paramsr  safe_currencyhandle_network_code_and_paramsnetwork_code_to_id$v1PrivatePostPrivateCreateWithdrawalr  ru  parse_transaction)rS  rn  rl  r  r  r  r  r  networkCoder  r  rZ  s               rU  r   cryptocom.withdrawW  s      99#F!!!%%d+ 

 ?%(M""AA&I++K8	 $-L!BB4;;wC_``" (3%%f77A 	" as"   'CCA5CC	 (C	Cc                   #    U R                  5       I Sh  vN   U R                  U5      nSUS   0nU R                  U R                  XB5      5      I Sh  vN nU R	                  US0 5      nU R                  US/ 5      n[        U5      nUS:X  a  [        U R                  S-   5      e0 n	[        SU5       H  n
U R	                  Xz5      nU R                  US5      nU R                  US5      nU R                  U5      nU R                  U5      u  nnU R                  U5        U R                  US	5      nU R                  UU5      nUUUUUS
.U	U'   M     U	$  GNE GN7f)a  
fetch a dictionary of addresses for a currency, indexed by network

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  r7   rZ  deposit_address_listr   z7 fetchDepositAddressesByNetwork() generating address...r  re  )rd  r  re  r  r  )r  r  %v1PrivatePostPrivateGetDepositAddressr  ru  r{  ry  r    r7   rx  r|  rz  r  check_addressr}  )rS  rn  r  r  r  r  r  	addressesaddressesLengthrZ  r  valuer  r  responseCoder  r  r  re  s                      rU  "fetch_deposit_addresses_by_network,cryptocom.fetch_deposit_addresses_by_network  sp     !!!%%d+
 CCDKKPWD`aa( ~~h"5NN4)?D	i.a*c cddq/*ANN90E ,,UI>M))%<J22:>L--m<LGSw'((	:I--iFG(""F7O +  _ 	"
 bs"   E!E?E!EDE!E!c                    #    U R                  US5      nU R                  US/5      nU R                  X5      I Sh  vN nX4;   a  XC   $ [        UR	                  5       5      nXES      $  N-7f)ao  
fetch the deposit address for a currency associated with self account

https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-deposit-address

: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>`
re  Nr   )safe_string_upperr  r  rv  rw  )rS  rn  r  re  depositAddressesrw  s         rU  fetch_deposit_addresscryptocom.fetch_deposit_address  su      ((;6I;/!%!H!H!VV&#,,(--/0D#G,, Ws   :A,A*.A,c                   #    U R                  5       I Sh  vN   Sn0 nUb  U R                  U5      nUS   US'   Ub  X&S'   Ub  X6S'   U R                  US5      nU R                  US/5      nUb  XvS'   U R	                  U R                  Xd5      5      I Sh  vN nU R                  US0 5      n	U R                  U	S	/ 5      n
U R                  XX#5      $  N N>7f)
aP  
fetch all deposits made to an account

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>`
Nr7   r  r  	page_sizer  r  rZ  deposit_list)	r  r  r  r  %v1PrivatePostPrivateGetDepositHistoryr  ru  r{  parse_transactions)rS  rn  r  r  r  r  r  r  r  r  depositLists              rU  fetch_depositscryptocom.fetch_deposits  s      !!!))$/H"*4.GJ"'J#(K !!&'26G9- %HCCDKKPWD`aa. ~~h"5nnT>2>&&{eKKQ 	" b"   CCBCC=CCc                   #    U R                  5       I Sh  vN   Sn0 nUb  U R                  U5      nUS   US'   Ub  X&S'   Ub  X6S'   U R                  US5      nU R                  US/5      nUb  XvS'   U R	                  U R                  Xd5      5      I Sh  vN nU R                  US0 5      n	U R                  U	S	/ 5      n
U R                  XX#5      $  N N>7f)
a^  
fetch all withdrawals made from an account

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>`
Nr7   r  r  r  r  r  rZ  withdrawal_list)	r  r  r  r  (v1PrivatePostPrivateGetWithdrawalHistoryr  ru  r{  r  )rS  rn  r  r  r  r  r  r  r  r  withdrawalLists              rU  fetch_withdrawalscryptocom.fetch_withdrawals  s      !!!))$/H"*4.GJ"'J#(K !!&'26G9- %HFFt{{SZGcdd2 ~~h"5.?D&&~NNU 	" er  tickerr  c                 `   U R                  US5      nU R                  US5      nU R                  XBS5      nU R                  US5      nU R                  US5      nU R                  0 SUS   _SU_SU R	                  U5      _S	U R                  US
5      _SU R                  US5      _SU R                  US5      _SS _SU R                  US5      _SS _SS _SS _SU_SU_SS _SS _SU R                  US5      _SS _U R                  US5      US:X  a  U R                  US5      OS US.EU5      $ ) Nr  r  _r  ar  r   datetimehighhlowlbidb	bidVolumeaskk	askVolumevwapopencloser   previousClosechange
percentagecaveragevUSDvv)
baseVolumequoteVolumerd  )r  r|  safe_marketsafe_tickerr  r  )rS  r  r  r   rS  r  r   s          rU  parse_tickercryptocom.parse_tickerE  s   B %%fc2	##FC0!!(C8  1, !
fX&!
!
 Y/!
 D$$VS1	!

 4##FC0!
 4##FC0!
 !
 4##FC0!
 !
 D!
 D!
 T!
 D!
 T!
 d!
  $**637!!
" t#!
$ **637>Cun4++FD9SW)!
* + 	rW  tradec                 P   U R                  USS5      nU R                  USS5      nU R                  XBS5      nU R                  US5      nU R                  US5      nU R	                  UU R                  USS	5      UU R                  U5      US
   U R                  US5      U R                  USS5      U R                  US5      U R                  USS5      U R                  USS5      S S U R                  U5      U R                  [        R                  " U5      5      S.S.U5      $ )Nr  create_timer  r  r  fee_instrument_namer   dtrade_idr  r  sr  
taker_sideptraded_priceqtraded_quantityr  r  )rd  r7   r   r  r  r  r  takerOrMakerr  rl  r  ro  rh  )safe_integer_2ro  r  r|  
safe_trader  safe_string_lower_2r  r_  rz  rR  r1   
string_neg)rS  r  r  r   rS  feeCurrencyfeeCostStrings          rU  parse_tradecryptocom.parse_trade  s5   F ''sMB	%%eS2CD!!(C8&&u.CD((7$$UC<"Y/X&%%eZ8,,UC@ 225,G''sNC((5FG 33K@))'*<*<]*KL 
" # 	rW  c           	          U R                  US5      U R                  US5      U R                  US5      U R                  US5      U R                  US5      U R                  US5      /$ )Nr  or  r  r  r  )r  r  )rS  ohlcvr  s      rU  parse_ohlcvcryptocom.parse_ohlcv  sn     eS)UC(UC(UC(UC(UC(
 	
rW  statusc                 6    SSSSSS.nU R                  X!U5      $ )Nr  canceledclosedrejectedexpired)ACTIVECANCELEDFILLEDREJECTEDEXPIREDr|  rS  r  statusess      rU  parse_order_statuscryptocom.parse_order_status  s-    "" 
 &99rW  r   c                 2    SSSS.nU R                  X!U5      $ )Nr%  r   r   )r&  r'  r(  r	  )rS  r   timeInForcess      rU  parse_time_in_forcecryptocom.parse_time_in_force  s'     %#(!

 ;GGrW  r  c           
      l   U R                  US5      nUb<  US:w  a6  U R                  U R                  US5      U R                  US5      USS.5      $ U R                  US5      nU R                  US5      nU R                  XR5      nU R	                  US	5      nS nUb,  S
n[        S[        U5      5       H  n	Xy   n
U
S:X  d  M  Sn  O   U R                  US5      nU R                  0 SU_SU R                  US5      _SU R                  US5      _SU_SU R                  U5      _SU R                  US5      _SU R                  U R                  US5      5      _SU_SU R                  US5      _SU R                  U R                  US5      5      _SU_SU R                  US5      _SU R                  US5      _SU R                  US 5      _S!U R                  US"5      _S#S _S$U R                  US%5      _U R                  US&5      U R                  U5      U R                  US'5      S(./ S).EU5      $ )*Nrn  r   r  
client_oidr  )r7   r3  rd  r  r  r  r+  Fr*  Tr  rd  r7   r3  r   r  lastTradeTimestampupdate_timer  r  ro  
order_typer   r$  r)  r  r  limit_pricerl  r  filledcumulative_quantity	remainingr  	avg_pricecumulative_valuecumulative_feer  )r  rh  r  )r  rt  r|  safe_symbolr  rx  ry  r  r  r  r  r  rz  )rS  r  r  rn  r  rS  r  execInstr)  r  instr  s               rU  r  cryptocom.parse_order  s   ^   /419??&&uj9!%!1!1%!F$	$   ##E=9##E+<=!!(3??5+6H1c(m,{;&#H	 -
 &&u.CD  
E 
$""5*5 
 T--e\B 
 	 

 W- 
 !$"3"3E="I 
 d--d.>.>uh.OP 
 f 
 D**5,? 
 433D4D4DUO4\] 
  
 D**5&9 
 T%%e]; 
 d&&uj9 
 d&&u.CD 
  ! 
" t''{;# 
$ $$U,>? 33K@((0@A / 
0 1 	rW  c                 4    SSSSS.nU R                  X!U5      $ )Npendingokfailed)r   r  23r	  r
  s      rU  parse_deposit_statuscryptocom.parse_deposit_statusA	  s*    	
 &99rW  c                 :    SSSSSSSS.nU R                  X!U5      $ )Nr#  r%  r$  r   )r   r  r&  r'  456r	  r
  s      rU  parse_withdrawal_status!cryptocom.parse_withdrawal_statusJ	  s3    
 &99rW  transactionr  c                    S nU R                  US5      nS nSU;   a  SnU R                  U5      nOSnU R                  U5      nU R                  US5      nU R                  U5      u  pxU R                  US5      n	U R	                  X5      n
U R                  US5      nU R                  US5      nS nUb  XS	.n0 S
U_SU R                  US5      _SU R                  US5      _SU_SU R                  U5      _SS _SU_SU_SS _SU_SU_SS _SU_SU R                  US5      _SU
_SU_SU R                  US5      _S U R                  US5      US.E$ )Nr  
client_wid
withdrawalrg  r  r  r  rh  r  rd  r7   txidr   r  re  	addressToaddressFromr  tagTotagFromro  rl  updatedr  )internalcommentrh  )r|  r.  r(  r  rz  r  r  r  )rS  r0  r  ro  	rawStatusr  r  r  r  r  rn  r   feeCostrh  s                 rU  r  cryptocom.parse_transactionV	  s   X $$[(;	;&D11)<FD..y9F((i@))-8%%k:>
&&z<%%k=A	"";6#5C
K
$"";5
 D$$[&9
 	

 Y/
 t
 w
 
 4
 3
 S
 t
 D
 d&&{H=
 
  f!
" t((mD#
$ ''\B)
 	
rW  c                    U R                  U R                  S5      nU R                  USS5      nU R                  US5      nSnU R	                  X5      u  pRUb"  US:w  a  [        U R                  S-   5      e XR/$ US:X  d  USL a  SnXR/$ )aM  
@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   rD   FNcrossz only cross margin is supportedT)r|  r   r~  r  handle_margin_mode_and_paramsr*   r7   )rS  
methodNamer  r   isMarginr   s         rU  r8  .cryptocom.custom_handle_margin_mode_and_params	  s     &&t||]C>>&(E:68,
!??
S
!W$"477-N#NOO %
 ## x'X-=$
##rW  c                    U R                  US/ 5      n[        U5      nUS S S.S S S.0 S.nUb  [        SU5       H  nX6   nU R                  US5      nU R                  US5      n	U R	                  X5      n
S S S.U R                  US5      SS.S	.US
   U
'   US:X  d  Me  U R                  US5      US   S'   SUS   S'   M     U$ )Nr\  )rh  r  )rd  r   rg  r   r   r]  rn  r`  F)rg  r   r   r   r   rh  r  )r{  ry  rx  r|  r}  r  )rS  rh  r  networkListnetworkListLengthrZ  r  networkInfor  currencyCoder  s              rU  parse_deposit_withdraw_fee$cryptocom.parse_deposit_withdraw_fee	  s
   " nnS."=,"
 " 
 "1/0)n ,,[,G	#//&A"55iN'+4@(,(8(8FV(Wgl m3z";/ %)040@0@N^0_F:&u-7<F:&|4 1 rW  codesc                    #    U R                  5       I Sh  vN   U R                  U5      I Sh  vN nU R                  US5      nU R                  US5      nU R	                  XQS5      $  NS N<7f)a\  
fetch deposit and withdraw fees

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>`
NrZ  r[  rk  )r  rr  r  r{  parse_deposit_withdraw_fees)rS  rL  r  r  r  r  s         rU  fetch_deposit_withdraw_fees%cryptocom.fetch_deposit_withdraw_fees	  sg      !!!EEfMMx2nnT>://KPP	 	"Ms   A.A*A.A,;A.,A.c                   #    U R                  5       I Sh  vN   0 nSnUb  U R                  U5      nUb  X%S'   Ub  X5S'   U R                  US5      nU R                  US/5      nUb  XuS'   U R	                  U R                  XT5      5      I Sh  vN nU R                  US0 5      n	U R                  U	S/ 5      n
U R                  XX#5      $  N N>7f)ad  
fetch the history of changes, actions done by the user or operations that altered the balance of the user

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>`
Nr  r  r  r  rZ  r  )	r  r  r  r  #v1PrivatePostPrivateGetTransactionsr  ru  r{  parse_ledger)rS  rn  r  r  r  r  r  r  r  rZ  ledgers              rU  fetch_ledgercryptocom.fetch_ledger	  s      !!!))$/H$)L!$G!!&'26G9-"'JAA$++gB^__< (B73  5@@[ 	" `s"   CCA9CC=CCitemc                 h   U R                  US5      nU R                  US5      nU R                  XB5      nU R                  XB5      nU R                  US5      nS n[        R
                  " US5      (       a  Sn[        R                  " U5      nOSnU R                  UU R                  US5      UU R                  US5      U R                  US	5      U R                  US
5      U R                  U R                  US5      5      UU R                  U5      UU R                  U5      S S S S S S.S.U5      $ )Nevent_timestamp_msr  transaction_qtyr   outinr  
account_idr  trade_match_idjournal_typer  )rd  r7   	directionr	  referenceIdreferenceAccountro  r  rl  r   r  beforeafterr  rh  )r  r|  rz  r  r1   r<  
string_abssafe_ledger_entryparse_ledger_entry_typerR  r  )rS  rW  r  r   r  rn  rl  r`  s           rU  parse_ledger_entrycryptocom.parse_ledger_entry9
  sB   * %%d,@A	%%d,=>
&&z<%%j;!!$(9:	VS))I''/FI%%""44"''l;++D*= $ 0 07G H001A1A$1WX''/"Y/ '
& ' 	rW  c                     0 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S.EnU R                  X!U5      $ )NTRADINGr  	TRADE_FEErh  WITHDRAW_FEEWITHDRAWr3  DEPOSITrg  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_CONVERSIONr	  )rS  ro  
ledgerTypes      rU  rg  !cryptocom.parse_ledger_entry_typen
  s    
w

 E
 	

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

. 
$77rW  c                 *  #    U R                  5       I Sh  vN   U R                  U5      I Sh  vN nU R                  US0 5      nU R                  US0 5      nU R                  US/ 5      nUR	                  U5        U R                  XQ5      $  Nx Na7f)aV  
fetch all the accounts associated with a profile

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
NrZ  master_accountsub_account_list)r  v1PrivatePostPrivateGetAccountsru  r{  r  parse_accounts)rS  r  r  rZ  masterAccountaccountss         rU  fetch_accountscryptocom.fetch_accounts
  s      !!!==fEE@ (B7v/?D>>&*<bA&""844K 	"Es    BBBBA BBc                 P    U R                  US5      U R                  US5      S US.$ )Nuuidlabel)r7   ro  rn  rd  r	  )rS  r	  s     rU  parse_accountcryptocom.parse_account
  s4    6 ""7F3$$Wg6	
 	
rW  c                    #    U R                  5       I Sh  vN   SnUb  U R                  U5      nSnU R                  SXT5      u  pdU R                  SUS/ SQ5        US:X  a  SnSUR	                  5       0nU R                  U R                  Xt5      5      I Sh  vN nU R                  US0 5      n	U R                  U	S	/ 5      n
U R                  X5      nU R                  US
5      nU R                  XX#5      $  N Na7f)a  
fetches historical settlement records

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>`
Nr   ro  )rF   rG   r  r  rG   r  instrument_typerZ  r  r   )r  r  r7  check_required_argumentr4  *v1PublicGetPublicGetExpiredSettlementPricer  ru  r{  parse_settlementssort_byfilter_by_symbol_since_limit)rS  r  r  r  r  r  ro  r  r  rZ  r  settlementssorteds                rU  fetch_settlement_history"cryptocom.fetch_settlement_history
  s     !!![[(F99:RTZc$$%=tVMvw8Dtzz|
 HHU\Ieff$ (B7~~ffb1,,T:k;700NNE 	" gs#   C>C:BC>C<A C><C>c                     U R                  US5      nU R                  US5      nUU R                  XB5      U R                  US5      UU R	                  U5      S.$ )Nxr  r  )rd  r  r  r   r  )r  r|  r  r  r  )rS  r~  r  r   rS  s        rU  parse_settlementcryptocom.parse_settlement
  sb     %%j#6	##J4&&x8%%j#6"Y/
 	
rW  c                     / n[        S[        U5      5       H&  nUR                  U R                  X   U5      5        M(     U$ )Nr   )rx  ry  r  r  )rS  r  r  rZ  r  s        rU  r  cryptocom.parse_settlements  s?     q#k*+AMM$//GH ,rW  c                   #    U R                  5       I Sh  vN   U R                  U5      nUS   (       d  [        U R                  S-   5      eUS   SSS.nU R	                  U R                  XB5      5      I Sh  vN nU R                  US0 5      nU R                  US	/ 5      nU R                  US
0 5      nU R                  X5      $  N NP7f)a  
fetches historical funding rates

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 dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>`
NrE   z0 fetchFundingRate() supports swap contracts onlyr7   estimated_funding_rater   )r  valuation_typer  rZ  r  r   )	r  r  r&   r7   v1PublicGetPublicGetValuationsr  ru  r{  parse_funding_rate)	rS  r  r  r  r  r  rZ  r  entrys	            rU  fetch_funding_ratecryptocom.fetch_funding_rate-  s      !!!V$f~DGG&XXYY%d|6

 <<T[[=YZZ" (B7~~ffb1tQ+&&u55; 	" [s#   CC	A#C:C;ACCc                 h   U R                  US5      nS nUb%  [        [        R                  " US-  5      5      S-  n0 SU_SU R	                  S U5      _SS _SS _SS _SS _S	U_S
U R                  U5      _SU R                  US5      _SU_SU R                  U5      _SS _SS _SS _SS _SS _SS _SS0E$ )Nr  i6 rd  r  	markPrice
indexPriceinterestRateestimatedSettlePricer   r  fundingRater  fundingTimestampfundingDatetimenextFundingRatenextFundingTimestampnextFundingDatetimepreviousFundingRatepreviousFundingTimestamppreviousFundingDatetimeintervalr   )r  r  mathceilr  r  r  )rS  r  r  r   r  s        rU  r  cryptocom.parse_funding_rateV  sL    %%h4	 "499Y-@#ABWL
H
d&&tV4
 
 $	

 D
 #D
 
 Y/
 4++Hc:
  0
 t||,<=
 t
 #D
 "4
 "4
  '!
" &t#
$ %
 	
rW  c           
        #    Uc  [        U R                  S-   5      eU R                  5       I Sh  vN   SnU R                  USS5      u  pTU(       a  U R	                  SXUSU5      I Sh  vN $ U R                  U5      nUS   (       d  [        U R                  S-   5      eUS	   S
S.nUb  X'S'   Ub  X7S'   U R                  US5      nU R                  US/5      nUb  XS'   U R                  U R                  Xt5      5      I Sh  vN n	U R                  U	S0 5      n
U R                  U
S/ 5      nU R                  U
S5      n/ n[        S[        U5      5       H^  nX   nU R                  US5      nUR!                  UU R#                  X5      U R%                  US5      UU R'                  U5      S.5        M`     U R)                  US5      nU R+                  UUS   X#5      $  GN GN~ N7f)as  
fetches historical funding rates

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 argumentFrk   r  8hrE   z7 fetchFundingRateHistory() supports swap contracts onlyr7   funding_hist)r  r  r  r  r  r  rZ  r  r  r   r  r  )rd  r  r  r   r  r   r  )r$   r7   r  rq  r  r  r&   r  r  r  r  ru  r{  r|  rx  ry  r  r  r  r  r  r  )rS  r  r  r  r  r  r  r  r  r  rZ  r  rS  ratesr  r  r   r  s                     rU  fetch_funding_rate_history$cryptocom.fetch_funding_rate_historyv  s     >#DGG.e$eff!!!88AZ\fg@@AZ\bkprvx~V$f~DGG&__``%d|,
 "'J$G!!&'26G9- %H<<T[[=YZZ" (B7~~ffb1##F,=>q#d)$AGE))%5ILL**8<#//s;& LL3  % e[1009I5XXi 	" @  [s5   /G/G':G/,G*-BG/	G-
CG/*G/-G/c                 R  #    U R                  5       I Sh  vN   U R                  U5      nSUS   0nU R                  U R                  XB5      5      I Sh  vN nU R	                  US0 5      nU R                  US/ 5      nU R                  U R	                  US5      U5      $  N NN7f)a  
fetch data on a single open contract trade position

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  r7   rZ  r  r   )r  r   v1PrivatePostPrivateGetPositionsr  ru  r{  parse_position)rS  r  r  r  r  r  rZ  r  s           rU  fetch_positioncryptocom.fetch_position  s      !!!V$vd|
 >>t{{7?[\\. (B7~~ffb1""4>>$#:FCC= 	"
 ]s"   B'B#?B'B%AB'%B'c                   #    U R                  5       I Sh  vN   U R                  U5      n0 nSnUba  Sn[        U[        5      (       a/  [	        U5      nUS:  a  [        U R                  S-   5      eUS   nOUnU R                  U5      nUS   US'   U R                  U R                  X25      5      I Sh  vN nU R                  US0 5      nU R                  US/ 5      n	/ n
[        S[	        U	5      5       HM  nX   nU R                  US5      nU R                  USSS	5      nU
R                  U R!                  X5      5        MO     U R#                  U
S
SS5      $  GNH N7f)aZ  
fetch all open positions

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   r7   r  rZ  r  r  r  F)r  market_symbolsrt  rv  ry  r%   r7   r  r  r  ru  r{  rx  r|  r  r  r  filter_by_array_positions)rS  r  r  r  r  r  r  r  r  	positionsrZ  r  r  rS  marketInners                  rU  fetch_positionscryptocom.fetch_positions  sd     !!!%%g.F'4(( #G 1$$TWW/u%uvv  [[(F)/G%&>>t{{7?[\\. (B?NN>62>	q#i.)ALE''/@AH**8T4LKMM$--eAB	 *
 --fheLL] 	" ]s#   E#EB E#7E!8B'E#!E#positionc                 @   U R                  US5      nU R                  X2S S5      nU R                  X2S S5      nU R                  US5      nU R                  US5      nU R	                  0 SU_SS _SU_SU_S	U R                  U5      _S
S _S[        R                  " US5      (       a  SOS_S[        R                  " U5      _SUS   _SS _SS _SS _SS _SU R                  US5      _SU R                  US5      _SS _SS _S U R                  US5      S S S S S S S.E5      $ )Nr  r  update_timestamp_msr  rd  r7   r  r   r  r   r  r   r/  sell	contractsr  
entryPricer  r^  r  
collateralopen_pos_costinitialMarginr  maintenanceMargininitialMarginPercentageopen_position_pnl)maintenanceMarginPercentageunrealizedPnlliquidationPricer   r  marginRatior   r   )
r|  r  r  r  safe_positionr  r1   	string_gtre  r  )rS  r  r  rS  r  r   rl  s          rU  r  cryptocom.parse_position   s    ##H.?@!!(D*E!!(D*E%%h0EF	!!(J7!! #
H#
$#
 f#
 	#

 Y/#
 d#
 W..vs;;E#
 ++F3#
 F>2#
 $#
 #
 #
 #
 $**8_E#
 T--h?#
   !#
" &t##
$ ,0!--h8KL $!#3#
  	rW  c                 "    U R                  5       $ N)milliseconds)rS  s    rU  noncecryptocom.nonceO  s      ""rW  c                    SnX#:  a  [        U5      $ [        U[         5      (       a  U$ SnS n[        U[        5      (       a  UnO*U R                  U5      n[        UR	                  5       5      n[        S[        U5      5       Hv  nXW   nXH-  nX   n	U	S:X  a  US-  nM  [        U	[        5      (       a7  [        S[        U	5      5       H  n
X@R                  X   US-   5      -  nM     Mh  U[        U	5      -  nMx     U$ )N    r   Noner   )r~  rt  rv  keysortrw  rx  ry  params_to_string)rS  objectlevelmaxLevelreturnString
paramsKeysr  r  r  r  r  s              rU  r  cryptocom.params_to_stringR  s    v;fc""M
fd##J\\&)Ffkkm,Jq#j/*A-CLKE&E4((q#e*-A $9$9%(EAI$NNL . E
* + rW  c                   #    U R                  5       I Sh  vN   U R                  U5      nUS   SS.nU R                  US5      nU R                  US5      nUb  XeS'   Ub  U R	                  US   U5      US'   U R                  U R                  XS5      5      I Sh  vN nU R                  US5      n	U R                  X5      $  N N)7f)	aH  
       closes open positions for a market

       https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-close-position

       :param str symbol: Unified CCXT market symbol
       :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>`
       Nr7   r\  )r  ro  ro  r  r  rZ  )	r  r  r  r|  r6  !v1PrivatePostPrivateClosePositionr  ru  r  )
rS  r  r  r  r  r  ro  r  r  rZ  s
             rU  close_positioncryptocom.close_positionl  s      !!!V$%d|
 %%ff5  1"FO#66vh7GOGG??G@\]] (3//3 	" ^s"   C	CBC	C(C	C	c                 
  #    U R                  5       I Sh  vN   U R                  U5      nSUS   0nU R                  U R                  XB5      5      I Sh  vN nU R	                  US0 5      nU R                  Xc5      $  Nh N*7f)aJ  
fetch the trading fees for a market

https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-instrument-fee-rate

:param str symbol: unified market symbol
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
Nr  r7   rZ  )r  r  (v1PrivatePostPrivateGetInstrumentFeeRater  ru  parse_trading_fee)rS  r  r  r  r  r  r  s          rU  fetch_trading_feecryptocom.fetch_trading_fee  s      !!!V$vd|
 FFt{{SZGcdd  ~~h"5%%d33- 	"
 es!   BA??BB)BBc                    #    U R                  5       I Sh  vN   U R                  U5      I Sh  vN nU R                  US0 5      nU R                  U5      $  NA N*7f)aG  

https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-fee-rate

fetch the trading fees for multiple markets
: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
NrZ  )r  v1PrivatePostPrivateGetFeeRateru  parse_trading_fees)rS  r  r  rZ  s       rU  fetch_trading_feescryptocom.fetch_trading_fees  sY      !!!<<VDD  (B7&&v..% 	"Ds   AAAA)AAc                    0 nXS'   [        S[        U R                  5      5       H  nU R                  U   nU R                  U5      nUS   nU(       a  SOSnU(       a  SOSnUUU R	                  [
        R                  " U R                  X5      S5      5      U R	                  [
        R                  " U R                  X5      S5      5      S S S	.n	XU'   M     U$ )
Nrd  r   rE   effective_deriv_taker_rate_bpseffective_spot_taker_rate_bpseffective_deriv_maker_rate_bpseffective_spot_maker_rate_bpsr   rd  r  r   r   r  	tierBased)rx  ry  r  r  rR  r1   
string_divr|  )
rS  r  rZ  r  r  r  isSwaptakerFeeKeymakerFeeKey
tradingFees
             rU  r  cryptocom.parse_trading_fees  s     !vq#dll+,A\\!_F[[(FF^F>D:JiK>D:JiK  **7+=+=d>N>Nx>egn+op**7+=+=d>N>Nx>egn+op"!J (6N - rW  rh  c                 *   U R                  US5      nU R                  X25      nUUU R                  [        R                  " U R                  US5      S5      5      U R                  [        R                  " U R                  US5      S5      5      S S S.$ )Nr  effective_maker_rate_bpsr   effective_taker_rate_bpsr  )r|  r  rR  r1   r  )rS  rh  r  rS  r  s        rU  r  cryptocom.parse_trading_fee  s     ##C):;!!(3&&w'9'9$:J:J3Pj:kmt'uv&&w'9'9$:J:J3Pj:kmt'uv
 	
rW  r   GETc           	      6   U R                  US5      nU R                  US5      nU R                  S   U   S-   U-   n	U R                  X@R                  U5      5      n
US:X  a   U
(       a  U	SU R	                  U
5      -   -  n	GOU R                  5         [        U R                  5       5      nU R                  0 U5      n[        UR                  5       5      nU R                  US5      nX-   U R                  -   U-   U-   nU R                  U R                  U5      U R                  U R                  5      [         R"                  5      n[%        U5      nU R'                  UUUU R                  UUS.5      nUS:X  a  SnS	nUR)                  UU5      nS
S0nXXeS.$ )Nr   r   r   r  r   r  )r7   methodr  api_keysigr  z{}z[]zContent-Typezapplication/json)r   r  bodyheaders)r|  r   r  extract_params	urlencoderp  r~  r  r  rv  rw  r  apiKeyhmacencodesecrethashlibsha256ry  jsonreplace)rS  pathr   r  r  r  r  ro  accessr   queryr  requestParamsr  
strSortKeypayload	signatureparamsKeysLengthparamsStringarrayStrings                       rU  signcryptocom.sign  s   Q'!!#q)iit$s*T1		&"5"5d";<XsT^^E222++-

%E KKF3Mm0023J..}a@JlT[[0:=EG		$++g"6DKK8PRYR`R`aI":99 ;;  D  1$#"||K> 2G dOOrW  reasonr   r  r  r  c
                     U R                  US5      n
U
S:w  aL  U R                  S-   U-   nU R                  U R                  S   X5        [	        U R                  S-   U-   5      eg )Nrn  r    rM  )r|  r7   throw_exactly_matched_exceptionr  r    )rS  rn  r4  r   r  r  r  r  requestHeadersrequestBody	errorCodefeedbacks               rU  handle_errorscryptocom.handle_errors-  sb    $$Xv6	ww}t+H001I9_# 455rW   r  )g__name__
__module____qualname____firstlineno__r   rQ  r   r  r   r   r  r   r   r  r~  r   r  r   r   r   r  r   r  rv  r  r   r  r   r  r  r  r   r   floatr   rC  rG  r   rY  rO  ri  rg  ru  ry  r  r   r  r  r  r  r   r   r
   r  r  r  r  dictr  r  r  r  r  r  r(  r.  r	   r  r8  rJ  rO  r   rU  rh  rg  r   r  r  r  r  r  r  r   r  r  r  r   r  r  r  r  r  r   r  r   r  r  r  r2  r  r<  __static_attributes____classcell__)rT  s   @rU  r3   r3       s|   @# @D -/ x: xt *, {V {z 6:" 417 41 41l 68 0 0F 0 04$UYbd J? J?C J?s J?imnsit J?X <@d[] 6? 6?S 6? 6?bfglbm 6?p ?CQUdhqs AH AH AH3 AH^a AHx|  ~B  yC AHF @DB )CS )C )CS\ )CV) ) *, 6, 6,p 8<B 5/C 5/ 5/n os{} P,3 P,i P,y P,Z_ P,hk P,d mqy{ #0 #0I #0Y #0X] #0fi #0J FH K)$|*< K)Z x|  EG ^,C ^,y ^,PY ^,ch ^,qt ^,@ fjx|  FH (3 ( (9 (I (_b (ru (, TX`b ,S ,# ,u ,S ," 59 5c 5& 9=R  0S  0#  0D AER EtCy E# E> Y[ Cd;N6O C< 59tZ^gi :?c :? :?TW :?nrsxny :?x 37TX\eg @?C @?s @?RU @?D
 QU]_ .83 .8 .8 .8# .8do .8` JL 9S 9PTUcPd 9v =? - -> -& 04$UYbd 5L 5LC 5Ls 5Limnyiz 5Ln 37TX\eg 7OC 7Os 7ORU 7Olpq|l} 7Or;4 ; ;6 ;z9 9v 9 9v
 
4 
(: :Hs H\ \v \ \|:
:S
T S
X S
Q\ S
j GI $(, ,\ BFb Qw Q  .2SW`b :As :A# :AS :Agklwgx :Ax3t 3x 3; 3j84 +- .5g .5`
B <@daenp /OS /O /O[^ /Ob
&  <> '6s '6R
6 
[ 
@ >BPTcgpr DYs DY# DY]` DYL 8: (D3 (DT 8<B 8MW 8M4PX> 8Mt-t -V -^#4 CGr (03 (0i (0V[ (0T ;=  4c  4AT  4D /1 /[ /:<
T 
6 
EX 
& &eBSW %PN# s  c TX `c  rW  r3   )9 ccxt.async_support.base.exchanger   ccxt.abstract.cryptocomr   r$  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   r   r   r   typingr   ccxt.base.errorsr    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   ccxt.base.decimal_to_precisionr0   ccxt.base.preciser1   r3   r>  rW  rU  <module>rN     s    6 /   o  o  o  o  o  o  o  * 0 - . . ' & . ) * ) + . * ) + 4 %S4+ S4rW  