
    E#i                         S SK Jr  S SKJ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  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\\5      r g)    )Exchange)ImplicitAPI)AnyBalances
CurrenciesIntMarketNumOrder	OrderBook	OrderSide	OrderTypeStrStringsTickerTickersTradeTradingFees)List)ExchangeError)ArgumentsRequired)InsufficientFunds)InvalidOrder)	TICK_SIZE)Precisec                   L  ^  \ rS rSrS\4U 4S jjr0 4S\\   4S jjrS\	S\4S jr
0 4S\4S jjrS0 4S	\S\4S
 jjrS/S\S\4S jjrS0 4S\S\S\4S jjrSS0 4S\S\S\S\\   4S jjrS/S\	S\S\4S jjr0 4S\4S jjrS\4S jrS0 4S\S\S\S\S\S\ 4S jjr!S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S0 4S\"S\S\S\\    4S jjr%S/S\	S\S\ 4S jjr&S/S \"S\"4S! jjr'0 4S\(4S" jjr)S/S\4S# jjr*S$S%0 SS4S& jr+S'\,S(\S)\S*\S+\	S,\4S- jr-S.r.U =r/$ )0	cryptomus   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_S/S_S0S_S1S_E0 S2S_S3S_S4S_S5S_S6S_S7S_S8S_S9S_S:S_S;S_S<S_S=S_S>S_S?S_S@S_SAS_SBS_E0 SCS_SDS_SES_SFS_SGS_SHS_SIS_SJS_SKS_SLS_SMS_SNS_SOS_SPS_SQS_SRS_SSS_E0 STS_SUS_SVS_SWS_SXS_SYS_SZS_S[S_S\S_S]S_S^S_S_S_S`S_SaS_SbS_ScS_SdS_E0 SeS_SfS_SgS_ShS_SiS_SjS_SkS_SlS_SmS_SnS_SoS_SpS_SqS_SrS_SsS_StS_SuS_E0 SvS_SwS_SxS_SyS_SzS_S{S_S|S_S}S_S~S_SS_SS_SS_SS_SS_SS_SS_SS_ESSSSSSSSSSS.
E_S0 _SSSSS.SSSSS._SSSSSSSSS.0SSSSSSSS.SSS.SS0S.S._SSSSU R	                  S5      U R	                  S5      S.0_SSSSSSSSSSSSSSSSSS.SSSSSSSSSSSSSSSS.SS0S._S0 _S[
        [        [        [        S.0 S._S[        _SSSS._S0 0E5      $ )Nidr   name	Cryptomus	countriesCA	rateLimitd   versionv2	certifiedFprohasCORSspotTmarginswapfutureoption	addMarginborrowCrossMarginborrowIsolatedMarginborrowMargincancelAllOrderscancelAllOrdersAftercancelOrdercancelOrderscancelWithdrawcloseAllPositionsclosePositioncreateConvertTradecreateDepositAddresscreateMarketBuyOrderWithCostcreateMarketOrdercreateMarketOrderWithCostcreateMarketSellOrderWithCostcreateOrder$createOrderWithTakeProfitAndStopLoss&createOrderWithTakeProfitAndStopLossWscreatePostOnlyOrdercreateReduceOnlyOrdercreateStopLimitOrdercreateStopLossOrdercreateStopMarketOrdercreateStopOrdercreateTakeProfitOrdercreateTrailingAmountOrdercreateTrailingPercentOrdercreateTriggerOrderfetchAccountsfetchBalancefetchBorrowInterestfetchBorrowRatefetchBorrowRateHistoriesfetchBorrowRateHistoryfetchBorrowRatesfetchBorrowRatesPerSymbolfetchCanceledAndClosedOrdersfetchCanceledOrdersfetchClosedOrderfetchClosedOrdersfetchConvertCurrenciesfetchConvertQuotefetchConvertTradefetchConvertTradeHistoryfetchCrossBorrowRatefetchCrossBorrowRatesfetchCurrenciesfetchDepositAddressfetchDepositsfetchDepositsWithdrawalsfetchFundingHistoryfetchFundingIntervalfetchFundingIntervalsfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchGreeksfetchIndexOHLCVfetchIsolatedBorrowRatefetchIsolatedBorrowRatesfetchIsolatedPositionsfetchLedgerfetchLeveragefetchLeveragesfetchLeverageTiersfetchLiquidationsfetchLongShortRatiofetchLongShortRatioHistoryfetchMarginAdjustmentHistoryfetchMarginModefetchMarginModesfetchMarketLeverageTiersfetchMarketsfetchMarkOHLCVfetchMarkPricesfetchMyLiquidationsfetchMySettlementHistoryfetchMyTrades
fetchOHLCVfetchOpenInterestfetchOpenInterestHistoryfetchOpenInterestsfetchOpenOrderfetchOpenOrdersfetchOptionfetchOptionChain
fetchOrderfetchOrderBookfetchOrdersfetchOrderTradesfetchPositionfetchPositionHistoryfetchPositionModefetchPositionsfetchPositionsForSymbolfetchPositionsHistoryfetchPositionsRiskfetchPremiumIndexOHLCVfetchSettlementHistoryfetchStatusfetchTickerfetchTickers	fetchTimefetchTradesfetchTradingFeefetchTradingFeesfetchTransactionsfetchTransfersfetchVolatilityHistoryfetchWithdrawalsreduceMargin)
repayCrossMarginrepayIsolatedMarginrepayMarginsandboxsetLeverage	setMarginsetMarginModesetPositionModetransferwithdraw
timeframesurlszOhttps://github.com/user-attachments/assets/8e0b1c48-7c01-4177-9224-f1b01d89d7e7zhttps://api.cryptomus.com)publicprivatezhttps://cryptomus.comz"https://doc.cryptomus.com/personalzhttps://cryptomus.com/tariffsz,https://app.cryptomus.com/signup/?ref=JRP4yj)logoapiwwwdocfeesreferralr   get   )zv2/user-api/exchange/marketsz!v2/user-api/exchange/market/pricezv1/exchange/market/assetsz,v1/exchange/market/order-book/{currencyPair}zv1/exchange/market/tickersz(v1/exchange/market/trades/{currencyPair})v2/user-api/exchange/ordersz#v2/user-api/exchange/orders/historyz$v2/user-api/exchange/account/balancez$v2/user-api/exchange/account/tariffszv2/user-api/payment/serviceszv2/user-api/payout/serviceszv2/user-api/transaction/list)r   z"v2/user-api/exchange/orders/marketz%v2/user-api/exchange/orders/{orderId})r   postdeleter   tradingz0.02)
percentagefeeSidemakertakeroptionsbscdashpolygonarbitrumsoltonethtronltcxmrbchdoge	avalanchebtcrub)BEP20DASHPOLYGONARBSOLTONERC20TRC20LTCXMRBCHDOGEAVAXBTCRUBr   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   r   r   r   r   levelr   )!createMarketBuyOrderRequiresPricenetworksnetworksByIdr   commonCurrencies
exceptions)5006zInsufficient funds.zMinimum amount 15 USDT)exactbroadprecisionModerequiredCredentials)apiKeyuidfeatures)	deep_extendsuperr   describeparse_numberr   r   r   r   )self	__class__s    H/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/cryptomus.pyr   cryptomus.describe   s`	   i ? A xD
+xD
KxD
 $xD
 	xD

 txD
 xD
 5xD
  BBB %B 	B
 %B %B UB $UB 'B B "5B 'B tB B !%B  $U!B"  #B$ %e%B& ''B( /)B* $U+B, ,U-B. 0/B0 t1B2 73B4 9%5B6 &u7B8 (9B: ';B< &u=B> (?B@ "5ABB (CBD ,UEBF -eGBH %eIBJ  KBL MBN &uOBP "5QBR +ESBT )%UBV #EWBX ,UYBZ /[B\ &u]B^ #E_B` $UaBb )%cBd $UeBf $UgBh +EiBj 'kBl (mBn "4oBp &uqBr  sBt +EuBv &uwBx 'yBz ({B| #E}B~ *5B@ $UABB uCBD "5EBF *5GBH +EIBJ )%KBL uMBN  OBP !%QBR %eSBT $UUBV &uWBX -eYBZ /[B\ "5]B^ #E_B` +EaBb cBd !%eBf "5gBh &uiBj +EkBl  mBn eoBp $UqBr +EsBt %euBv !%wBx "4yBz u{B| #E}B~ dB@ !$ABB uCBD #EEBF  GBH 'IBJ $UKBL !%MBN *5OBP (QBR %eSBT )%UBV )%WBX uYBZ u[B\ ]B^ U_B` taBb "5cBd #DeBf $UgBh !%iBj )%kBl #EmBn oBp %*',$ $"!&#(!!CBxD
V "WxD
X i9: /;7J
YxD
n 89=>56HI67DE	 89?@@A@A897889 89>?
 @oxD
j "&$!..v6!..v6	kxD
z 59""(%  "#   "'  $ #"( %  "#   "!'  !$ Q#I'{xD
J KxD
L (*+<.:	 MxD
d YexD
f "$gxD
n oxD
 x x	    c                 l    U R                  U5      nU R                  US/ 5      nU R                  U5      $ )z
retrieves data on all markets for the exchange

https://doc.cryptomus.com/personal/market-cap/tickers

:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: an array of objects representing market data
result)!publicGetV2UserApiExchangeMarkets	safe_listparse_markets)r   paramsresponser   s       r   fetch_marketscryptomus.fetch_markets  s9     99&A( (B7!!&))r   marketc                    U R                  US5      nUR                  S5      nUS   nUS   nU R                  U5      nU R                  U5      nU R                  U R                  S5      nU R                  0 SU_SUS-   U-   _SU_S	U_S
U_SU_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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$S _S%U R                  U R                  U R                  US&5      5      5      U R                  U R                  U R                  US'5      5      5      S(._S)U R                  US*5      U R                  US+5      S,.U R                  US-5      U R                  US.5      S,.S S S,.S S S,.S/._S0S _S1U_E5      $ )2Nsymbol_r   r   r   r!   /basequotebaseIdquoteIdactiveTtyper.   subTyper/   Fr0   r1   r2   contractsettlesettleIdcontractSizelinearinverser   r   r   	tierBasedr   expiryexpiryDatetimestrike
optionType	precision	quotePrecbasePrec)amountpricelimitsquoteMinSizequoteMaxSizeminmaxbaseMinSizebaseMaxSize)r  r  leveragecostcreatedinfo)
safe_stringsplitsafe_currency_code	safe_dictr   safe_market_structuresafe_number	safe_boolr   parse_precision)	r   r  marketIdpartsr	  r
  r  r  r   s	            r   parse_marketcryptomus.parse_market/  s    ##FH5s#q(&&v.''0~~dii3)) 6+
(6+
dSj5(6+
 D6+
 U	6+

 f6+
 w6+
 d6+
 F6+
 t6+
 D6+
 e6+
 E6+
 e6+
 e6+
 6+
  d!6+
" #6+
$ D%6+
& d'6+
( t)6+
* T%%dG4+6+
, T%%dG4-6+
. $..|</6+
0 16+
2 t''i836+
4 d56+
6 d76+
8 d96+
: $;6+
< ++D,@,@AQAQRXZeAf,gh**4+?+?@P@PQWYc@d+ef=6+
D ++FNC++FNC
  ++FMB++FMB
  
  E6+
h ti6+
j Fk6+
 6 6	r   c                    U R                  U5      nU R                  US5      nU R                  US5      n[        UR	                  5       5      n0 n[        S[        U5      5       H  nXW   nU R                  U5      n	0 n
XH   n[        S[        U5      5       H  nX   nU R                  US5      nU R                  U5      nUUU R                  US5      U R                  US5      S.U R                  US5      U R                  US	5      S.S
.SU R                  US5      U R                  US5      SSUS.	X'   M     U R                  UU	U
US.5      Xi'   M     U$ )z
fetches all available currencies on an exchange

https://doc.cryptomus.com/personal/market-cap/assets

:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: an associative dictionary of currencies
r   currency_coder   network_codemin_withdrawmax_withdrawr!  min_depositmax_deposit)r   depositNcan_withdrawcan_deposit)	r!   networkr  r  r=  r   feer  r)  )r!   coder   r)  )publicGetV1ExchangeMarketAssetsr   group_bylistkeysrangelenr,  r*  network_id_to_coder/  r0  safe_currency_structure)r   r   r   coinsgroupedByIdrF  r   ir!   rB  r   networkEntriesjnetworkEntry	networkIdnetworkCodes                   r   fetch_currenciescryptomus.fetch_currencies}  s    77?& x2mmE?;K$$&'q#d)$AB**2.DH(_N1c.12-0 ,,\>J	"55i@#* $(#3#3L.#Q#'#3#3L.#Q%
 $(#3#3L-#P#'#3#3L-#P$	 ##~~lNK $|] K!%(%)%	 30  77$&	9 FL; %F r   Nsymbolsc                     U R                  5         U R                  U5      nU R                  U5      nU R                  US5      nU R	                  XA5      $ )a  
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market

https://doc.cryptomus.com/personal/market-cap/tickers

:param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
data)load_marketsmarket_symbols publicGetV1ExchangeMarketTickersr   parse_tickers)r   rU  r   r   rW  s        r   fetch_tickerscryptomus.fetch_tickers  sS     	%%g.88@ ~~h/!!$00r   c                 L   U R                  US5      nU R                  X25      nUS   nU R                  US5      nU R                  0 SU_SS _SS _SS _SS _SS _S	S _S
S _SS _SS _SS _SU_SU_SS _SS _SS _SS _U R                  US5      U R                  US5      US.EU5      $ )Ncurrency_pairr  
last_price	timestampdatetimehighlowbid	bidVolumeask	askVolumevwapopencloselastpreviousClosechanger   averagebase_volumequote_volume)
baseVolumequoteVolumer)  )r*  safe_marketsafe_ticker)r   tickerr  r2  r  rl  s         r   parse_tickercryptomus.parse_ticker  sQ    ##FO<!!(3!5 !
f!
!
 !
 D	!

 4!
 4!
 !
 4!
 !
 D!
 D!
 T!
 D!
 T!
 d!
  $!!
" t#!
$ **6=A++FNC)!
* + 	r   r  limitc           	      @   U R                  5         U R                  U5      nSUS   0nSnU R                  USSU5      u  pcXeS'   U R                  U R	                  XS5      5      nU R                  US0 5      nU R                  US5      n	U R                  XU	SS	S
S5      $ )aI  
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data

https://doc.cryptomus.com/personal/market-cap/orderbook

:param str symbol: unified symbol of the market to fetch the order book for
:param int [limit]: the maximum amount of order book entries to return
:param dict [params]: extra parameters specific to the exchange API endpoint
:param int [params.level]: 0 or 1 or 2 or 3 or 4 or 5 - the level of volume
:returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
currencyPairr!   r   r   r   rW  ra  bidsasksr  quantity)rX  r  handle_option_and_params.publicGetV1ExchangeMarketOrderBookCurrencyPairextendr-  safe_timestampparse_order_book)
r   r  ry  r   r  requestr   r   rW  ra  s
             r   fetch_order_bookcryptomus.fetch_order_book  s     	V$F4L
 55f>NPWY^_ FFt{{SZGcd( ~~h3''k:	$$T9ffgWabbr   sincec                     U R                  5         U R                  U5      nSUS   0nU R                  U R                  Xd5      5      nU R	                  US5      nU R                  XX#5      $ )a  
get the list of most recent trades for a particular symbol

https://doc.cryptomus.com/personal/market-cap/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
:param int [limit]: the maximum amount of trades to fetch(maximum value is 100)
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
r{  r!   rW  )rX  r  +publicGetV1ExchangeMarketTradesCurrencyPairr  r   parse_trades)	r   r  r  ry  r   r  r  r   rW  s	            r   fetch_tradescryptomus.fetch_trades.  so     	V$F4L
 CCDKKPWD`a ~~h/  u<<r   tradec                 0   U R                  US5      nU R                  U R                  US5      UU R                  U5      US   U R                  US5      U R                  US5      U R                  US5      U R                  US5      S S S S S S.US	.U5      $ )
Nra  trade_idr  r  r  rq  rp  currencyr'  )r!   ra  rb  r  sider  r  r'  takerOrMakerr  orderrA  r)  )r  
safe_trader*  iso8601)r   r  r  ra  s       r   parse_tradecryptomus.parse_tradeQ  s     ''{;	""5*5"Y/X&$$UF3%%eW5&&un=$$UM:   ! 
" # 	r   c                     U R                  5         0 nU R                  U R                  X!5      5      nU R                  US/ 5      nU R	                  U5      $ )a7  
query for balance and get the amount of funds available for trading or funds locked in orders

https://doc.cryptomus.com/personal/converts/balance

:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
r   )rX  )privateGetV2UserApiExchangeAccountBalancer  r   parse_balance)r   r   r  r   r   s        r   fetch_balancecryptomus.fetch_balancep  sS     	AA$++gB^_ (B7!!&))r   c                 .   SU0n[        S[        U5      5       Hh  nX   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'   XrU'   Mj     U R                  U5      $ )Nr)  r   rv  	availablefreeheldused)rG  rH  r*  r,  accountsafe_balance)r   balancer   rM  balanceEntry
currencyIdrB  r  s           r   r  cryptomus.parse_balance  s     G
 q#g,'A":L)),AJ**:6DllnG"..|[IGFO"..|VDGFO"4L (   ((r   r  r  r  r  c                 N   U R                  5         U R                  U5      nUS   USS.nU R                  US5      n	U	b  U R                  US5      nXS'   US:H  n
U R	                  U5      nU R	                  U5      nSnU R                  US5      u  pSnUS	:X  a  U
(       ag  S
nU R                  USSS
5      u  pU(       a8  Uc  Uc  [        U R                  S-   5      eUc  [        R                  " X5      nOU(       a  UOUnXS'   OXS'   U R                  U R                  X5      5      nOhUS:X  aJ  Uc  [        U R                  S-   U-   S-   5      eXS'   XXS'   U R                  U R                  X5      5      nO[        U R                  S-   5      eU R                  X5      $ )ar  
create a trade order

https://doc.cryptomus.com/personal/exchange/market-order-creation
https://doc.cryptomus.com/personal/exchange/limit-order-creation

:param str symbol: unified symbol of the market to create an order in
:param str type: 'market' or 'limit' or for spot
:param str side: 'buy' or 'sell'
:param float amount: how much of you want to trade in units of the base currency
:param float [price]: the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders(only for limit orders)
:param dict [params]: extra parameters specific to the exchange API endpoint
:param float [params.cost]: *market buy only* the quote quantity that can be used alternative for the amount
:param str [params.clientOrderId]: a unique identifier for the order(optional)
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
r!   ccxt)r  	directiontagclientOrderIdNclient_order_idbuyr'  r  TrD   r   z createOrder() requires the price argument for market buy orders to calculate the total cost to spend(amount * price), alternatively set the createMarketBuyOrderRequiresPrice option of param to False and pass the cost to spend in the amount argumentvaluer~  ry  z0 createOrder() requires a price parameter for a z orderr  z9 createOrder() requires a type parameter(limit or market))rX  r  r*  omitnumber_to_stringhandle_param_stringr  r   r!   r   
string_mul(privatePostV2UserApiExchangeOrdersMarketr  r   "privatePostV2UserApiExchangeOrdersparse_order)r   r  r  r  r  r  r   r  r  r  sideBuyamountToStringpriceToStringr'  r   r   s                   r   create_ordercryptomus.create_order  s   " 	V$Tl

 ((A$YYv7F)6%&%-..v6--e4//?8481<@<Y<YZ`bo  rU  W[  =\914DL*477  6q  ,q  r  r&11.P#'4^D#' &4
#DDT[[QXEabHW_}'2d(dgk(knv(vww"0J$G>>t{{7?[\H#DGG.i$ijj 11r   r!   c                     U R                  5         0 nXS'   U R                  U R                  XC5      5      nU R                  SU05      $ )ax  
cancels an open limit order

https://doc.cryptomus.com/personal/exchange/limit-order-cancellation

:param str id: order id
:param str symbol: unified symbol of the market the order was made in(not used in cryptomus)
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
orderIdr)  )rX  +privateDeleteV2UserApiExchangeOrdersOrderIdr  
safe_order)r   r!   r  r   r  r   s         r   cancel_ordercryptomus.cancel_order  sM     		CCDKKPWD`a 122r   c                 ^   U R                  5         0 nSnUb  U R                  U5      nUS   US'   Ub  X5S'   U R                  U R                  XT5      5      nU R	                  US/ 5      n/ n	[        S[        U5      5       H'  n
X   nU	R                  U R                  X5      5        M)     U	$ )a  
fetches information on multiple orders made by the user

https://doc.cryptomus.com/personal/exchange/history-of-completed-orders

:param str symbol: unified market symbol of the market orders were made in(not used in cryptomus)
:param int [since]: the earliest time in ms to fetch orders for(not used in cryptomus)
:param int [limit]: the maximum number of order structures to retrieve(not used in cryptomus)
:param dict [params]: extra parameters specific to the exchange API endpoint
:param str [params.direction]: order direction 'buy' or 'sell'
:param str [params.order_id]: order id
:param str [params.client_order_id]: client order id
:param str [params.limit]: A special parameter that sets the maximum number of records the request will return
:param str [params.offset]: A special parameter that sets the number of records from the beginning of the list
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
Nr!   r  ry  r   r   )	rX  r  (privateGetV2UserApiExchangeOrdersHistoryr  r   rG  rH  appendr  )r   r  r  ry  r   r  r  r   r   ordersrM  r  s               r    fetch_canceled_and_closed_orders*cryptomus.fetch_canceled_and_closed_orders  s    " 	[[(F &tGH$G@@WA]^P (B7q#f+&AIEMM$**59: ' r   c                     U R                  5         SnUb  U R                  U5      n0 nUb  US   US'   U R                  U R                  Xd5      5      nU R	                  US/ 5      nU R                  XSS5      $ )a{  
fetch all unfilled currently open orders

https://doc.cryptomus.com/personal/exchange/list-of-active-orders

:param str symbol: unified market symbol
:param int [since]: the earliest time in ms to fetch open orders for(not used in cryptomus)
:param int [limit]: the maximum number of  open orders structures to retrieve(not used in cryptomus)
:param dict [params]: extra parameters specific to the exchange API endpoint
:param str [params.direction]: order direction 'buy' or 'sell'
:param str [params.order_id]: order id
:param str [params.client_order_id]: client order id
:param str [params.limit]: A special parameter that sets the maximum number of records the request will return
:param str [params.offset]: A special parameter that sets the number of records from the beginning of the list
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
Nr!   r  r   )rX  r  !privateGetV2UserApiExchangeOrdersr  r   parse_orders)	r   r  r  ry  r   r  r  r   r   s	            r   fetch_open_orderscryptomus.fetch_open_orders=  s    " 	[[(F
 &tGH99$++g:VW( (B7  t<<r   r  c           	          U R                  USS5      nU R                  US5      nU R                  XB5      nU R                  US5      nU R                  U5      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                  US	5      nU R                  US
/ 5      nS nU R	                  US5      nU R                  US5      nUb$  U R                  U5      U R                  US5      S.nUc  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 R                  US5      nU R                  0 SU_SU_SU_SU R                  U5      _SS _SUS   _SU	_SS _SS _SU
_S	U_SU R                  US5      _SU R                  US5      _SU_SU_SU_S U R                  US!5      _S UUS US".EU5      $ )#Norder_idr!   r  	createdAtdealaverageFilledPricer  r  r  transactionsr   feeCurrencyrA  r  filledPricer~  r  stater  ra  rb  lastTradeTimestamptimeInForcepostOnlyr  	stopPricestopLossPricetriggerPricer  r'  ro  filledfilledQuantity)	remainingstatusrA  tradesr)  )safe_string_2r*  rt  	parse8601r-  r/  r   r,  parse_order_statusr  r  )r   r  r  r!   r2  dateTimera  r  r  r  r  r  transactionrA  firstTxr  r  r'  r  r  s                       r   r  cryptomus.parse_orderm  s   r z48##E84!!(3##E;7NN8,	~~eVR0!--d4HIv.{3  0nnT>2>..a0&&w>" 33K@((%8C =$$Wm<E!!%4w/(()9)9%)IJ((@  
" 
] 
  
 Y/	 

 !$ 
 fX& 
 D 
 4 
  
 D 
 U 
 ))%A 
 D,,UOD 
 f 
 D 
  )! 
" d&&u.>?# 
$ - 
. / 	r   r  c                 8    SSSSSSS.nU R                  X!U5      $ )Nrj  closedcanceledexpiredfailed)r  	completedpartially_completed	cancelledr  r  )r*  )r   r  statusess      r   r  cryptomus.parse_order_status  s0    !#)# 
 &99r   c           	      "   U R                  U5      nU R                  US0 5      nU R                  US0 5      nU R                  US5      nU R                  US5      n[        R                  " US5      n[        R                  " US5      nU R                  US/ 5      n0 nU R                  U5      n	[        S[        U R                  5      5       H<  n
U R                  U
   nUUU R                  U5      U R                  U5      SSU	S	.X'   M>     U$ )
a/  
fetch the trading fees for multiple markets

https://trade-docs.coinlist.co/?javascript--nodejs#list-fees

: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
r   current_tariff_stepmaker_percenttaker_percent100tariff_stepsr   T)r)  r  r   r   r   r  tiers))privateGetV2UserApiExchangeAccountTariffsr-  r*  r   
string_divr   parse_fee_tiersrG  rH  rU  r   )r   r   r   rW  currentFeeTiermakerFeetakerFeefeeTiersr   r  rM  r  s               r   fetch_trading_feescryptomus.fetch_trading_fees  s    AA&Ib ~~h"5.CRH##NOD##NOD%%h6%%h6>>$;$$X.q#dll+,A\\!_F  **84**84"!FN - r   c                    / 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	[        R
                  " U	S5      n	[        R
                  " US5      nUR                  XpR                  U	5      /5        UR                  XpR                  U5      /5        M     UUS.$ )Nr   from_turnoverr  r  r  )r   r   )rG  rH  r/  r*  r   r  r  r   )
r   r   r  	takerFees	makerFeesrM  tierturnoverr   r   s
             r   r  cryptomus.parse_fee_tiers3  s    		q#h-(A;D''o>H$$T?;E$$T?;E&&ue4E&&ue4Eh(9(9%(@ABh(9(9%(@AB ) 
 	
r   r   GETc                 R   U R                  X5      nU R                  X@R                  U5      5      nU R                  S   U   S-   U-   nUS:X  a  U R	                  5         Sn	SU R
                  0nUS:w  a  U R                  U5      nUn	SUS'   O(U R                  U5      n
[        U
5      S	:w  a  US
U
-   -  nU R                  U	5      nXR                  -   nU R                  U R                  U5      S5      nXS'   O(U R                  U5      n
[        U
5      S	:w  a  US
U
-   -  nXXeS.$ )Nr   r  r    userIdr
  zapplication/jsonzContent-Typer   ?md5sign)urlmethodbodyheaders)implode_paramsr  extract_paramsr   check_required_credentialsr   json	urlencoderH  string_to_base64secrethashencode)r   pathr   r  r   r  r  endpointr  
jsonParamsqueryjsonParamsBase64stringToSign	signatures                 r   r  cryptomus.signD  s-   &&t46#6#6t#<=iis#c)H4)++-J$((G yy(!
*<'v.u:?3;&C#44Z@+kk9L		$++l";UCI'FONN6*E5zQsU{"dOOr   httpCodereasonr  r  r  r  c
                    Uc  g SU;   aN  U R                  US5      n
U R                  S-   U-   nU R                  U R                  S   X5        [	        U5      eSU;   am  U R                  US5      nU R                  S-   U-   nU R                  U R                  S   X5        U R                  U R                  S   X5        [	        U5      eg )NrB   r   messager   )r*  r!   throw_exactly_matched_exceptionr   r   throw_broadly_matched_exception)r   r&  r'  r  r  r  r  r   requestHeadersrequestBodyrB  feedbackr*  s                r   handle_errorscryptomus.handle_errors`  s    X##Hf5Dww}t+H001I4Z))(" &&x;Gww}t+H001I7]001I7]))r    )N)0__name__
__module____qualname____firstlineno__r   r   r   r	   r   dictr4  r   rS  r   r   r\  r   rw  strr   r   r  r   r  r  r   r  r  r   r   floatr
   r   r  r   r  r  r  r  r  r   r  r  r  intr0  __static_attributes____classcell__)r   s   @r   r   r      s   y# yv $& *$v, *@L4 LF L\ ') CZ CJ 04B 1W 17 18"6 "V "H :>b *cs *c3 *cY *cX 6:UW !=3 !=s !=# !=\`af\g !=F v  > $& *( *4) )* gksu >23 >2i >2y >2RW >2`c >2z >2@ 37r 3s 3C 3, >BPTcgpr Fs F# F]` Fw{  }B  xC FP /3TXac .= .=3 .=c .=hlmrhs .=`i iv i iV	: 	: 	: )+ N{ N`
 
" &eBSW P8c 3 S # X\ dg  r   r   N)!ccxt.base.exchanger   ccxt.abstract.cryptomusr   ccxt.base.typesr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   typingr   ccxt.base.errorsr   r   r   r   ccxt.base.decimal_to_precisionr   ccxt.base.preciser   r   r2  r   r   <module>rD     sP    ( / c  c  c  c  c  * . . ) 4 %_+ _r   