
    !:hs                       d dl mZ d dlmZ d dlZd dlmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z" d dl#m$Z$ d dl%m&Z& d dl%m'Z' d dl%m(Z( d d	l%m)Z) d d
l%m*Z* d dl%m+Z+ d dl%m,Z, d dl%m-Z- d dl%m.Z. d dl%m/Z/ d dl%m0Z0 d dl%m1Z1 d dl%m2Z2 d dl%m3Z3 d dl4m5Z5 d dl6m7Z7  G d dee      Z8y)    )Exchange)ImplicitAPIN)AnyBalances
CurrenciesCurrencyDepositAddressIntLeverage
MarginModeMarginModesMarginModificationMarketNumOrder	OrderBook	OrderSide	OrderTypePositionStrStringsTickerTickersFundingRateFundingRates
OrderBooksTradeTradingFeeInterfaceTradingFeesTransactionTransferEntry)List)ExchangeError)AuthenticationError)PermissionDenied)AccountSuspended)ArgumentsRequired)
BadRequest)	BadSymbol)InsufficientFunds)InvalidOrder)OrderNotFound)NotSupported)RateLimitExceeded)ExchangeNotAvailable)OnMaintenance)	TICK_SIZE)Precisec                   H    e Zd Zdef fdZd Zi fdee   fdZi fde	fdZ
i fdedefdZi fdedefdZdefd	Zi fdefd
Zi fdedefdZdi fdedefdZdldededefdZddi fdedededee   fdZdddi fdededefdZdldededefdZd ZdefdZ d Z!dldede"de#fdZ$dddi fdedededee#   fd Z%dddi fdedededee#   fd!Z&dddi fdedededee#   fd"Z'ddi fdedede(fd#Z)di fdedede*fd$Z+dld%edede,fd&Z-i fdede,fd'Z.i fde/fd(Z0d)ddi fdedededee1   fd*Z2dldede1fd+Z3dddi fdedededee4   fd,Z5di fd-edefd.Z6dddi fd-edededefd/Z7dddi fdedededee4   fd0Z8di fd-edefd1Z9di fdefd2Z:di fd-edefd3Z;ddi fd-eded4e<d5e=d6e>d7e>fd8Z?di fded4e<d5e=d6e@d7e>f
d9ZAddi fdeBd:ed4e<d5e=d6e@d7e>d;efd<ZCdefd=ZDdld>edede4fd?ZEdi fdee   deFfd@ZGdld;edeHfdAZIi fded6e@dBedCedeJf
dDZKdldEede"deJfdFZLdefdGZMdi fded6e@dHede#fdIZNdi fdedeOfdJZPdddi fdededefdKZQdi fdedeeR   fdLZSi fdefdMZTdldNedefdOZUdldefdPZVdi fdefdQZWi fdefdRZXi fdedeYfdSZZdldedeYfdTZ[i fdede\fdUZ]dldVedede\fdWZ^i fded6e@de\fdXZ_i fded6e@de\fdYZ`i fdedeafdZZbdld[ededeafd\Zcdi fd[edefd]Zddi fd^efd_Zedlde"fd`Zfdi fded5e=de4fdaZgi df fdb	ZhdeidceddedeedfedgefdhZjdidji ddfdkZk xZlS )mhitbtcreturnc                    | j                  t        t        |          dddgddi dddd	d
d	dd	dddddd	dd	dd	dddd	dd	dd	dd	dd	dd	dd	i dd	dddd	dd dd dd	ddd dd!d	d"d	d#dd$dd%d	d&d	d'd(d)d	d*d i d+d	d,d	d-d	d.dd/d	d0dd1dd2d	d3d d4dd5d(d6d	d7dd8d	d9d	d:dd;di d<d	d=d	d>d	d?dd@d	dAd	dBd	dCddDddEd	dFd	dGd	dHddId	dJd	dKd	dLd	i dMddNd	dOd	dPd	dQd	dRd	dSd(dTddUd	dVd	dWd	dXd	dYddZdd[dd\d	d]d	t        d^d_d_d`dadad`dbdcdddegdfdggdhdii djdkdldkdmdkdndkdodkdpdkdqdkdrdkdsdkdtdkdudkdvdkdwdkdxdkdydkdzdkd{dkdkdkdkdkdkdkdkdkdkdkdkdkdkd|ii d}d~dd~dddddd~dd~dd~dd~dddddddddddd~dd~dd~dd~i dd~dd~dd~dddddddddd~dd~dd~dd~dd~dd~dd~ddddddddddddddd~d~d~d~di dddddddddddddddddddddddddddddd~dd~dd~dd~idddddddddddddddddddddd`dd	d	| j                  d      | j                  d      | j                  d      | j                  d      g| j                  d      | j                  d      g| j                  d      | j                  d      g| j                  d      | j                  d      g| j                  d      | j                  d      g| j                  d      | j                  d      g| j                  d«      | j                  dë      g| j                  dī      | j                  d      g| j                  dū      | j                  dƫ      g| j                  dǫ      | j                  dƫ      gg
| j                  d      | j                  d      g| j                  d      | j                  dȫ      g| j                  d      | j                  d      g| j                  d      | j                  d      g| j                  d      | j                  d      g| j                  d      | j                  d      g| j                  d«      | j                  d      g| j                  dī      | j                  dɫ      g| j                  dū      | j                  d      g| j                  dǫ      | j                  d      gg
dʜd˜id	dd	d dddd d	d	d	d	d̜ddddddd	d͜d d	ddddd	dМd	dddd	dќd	ddddd	dҜd d	dddddddd	dӜ	ddid՜	ddiddd	iddiddiddiddidٜddiddidۜddiddidۜdܜddddddddddd
i dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        i dt        dt        dt        dt        dt        dt        dt         dt        d t        dt        dt        dt        dt        dt        dt"        dt        dt        i d	t        d
t        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        t        t        t        t        t        di dddddi d d!d"d dd#ddd$d$d%d&dd'd(d(d)d)d*d*d+d+d,d,d-d-d.d.d/d/d0d0d1d1i d2d3d4d5d6d7d8d9d:d:d;d;d<d<d=d=d>d>d?d@dAdAdBdBdCdCdDdDdEdEdFdFdGdGi dHdHdIdIdJdJdKdKdLdLdMdMdNdNdOdOdPdPdQdQdRdRdSdTdUdVdWdWdXdXdYdZd[d[i d\d\d]d]d^d^d_d_d`d`dadbdcdcdddedfdfdgdgdhdidjdjdkdkdldldmdmdndndodpi dqdqdrdrdsdsdtdtdududvdvdwdwdxdydzdzd{d|d}d}d~d~ddddddddddddidddddddidi ddddddddddddddddddddddddddddddddddddddd      S (  Nr4   HitBTCHKgDl
@3CORSFspotTmarginswapfutureoption	addMargincancelAllOrderscancelOrderclosePositioncreateDepositAddresscreateOrdercreatePostOnlyOrdercreateReduceOnlyOrdercreateStopLimitOrdercreateStopMarketOrdercreateStopOrder	editOrderfetchAccountsfetchBalancefetchBorrowRateHistoriesfetchBorrowRateHistoryfetchClosedOrdersfetchCrossBorrowRatefetchCrossBorrowRatesfetchCurrenciesfetchDepositAddressfetchDepositAddressesfetchDepositAddressesByNetworkfetchDepositsfetchDepositsWithdrawalsfetchDepositWithdrawFeeemulatedfetchDepositWithdrawFeesfetchFundingHistoryfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchGreeksfetchIndexOHLCVfetchIsolatedBorrowRatefetchIsolatedBorrowRatesfetchLeveragefetchLeverageTiersfetchLiquidationsfetchMarginModefetchMarginModesfetchMarketLeverageTiersfetchMarketsfetchMarkOHLCVfetchMyLiquidationsfetchMySettlementHistoryfetchMyTrades
fetchOHLCVfetchOpenInterestfetchOpenInterestHistoryfetchOpenInterestsfetchOpenOrderfetchOpenOrdersfetchOptionfetchOptionChain
fetchOrderfetchOrderBookfetchOrderBooksfetchOrdersfetchOrderTradesfetchPositionfetchPositionsfetchPremiumIndexOHLCVfetchSettlementHistoryfetchTickerfetchTickersfetchTradesfetchTradingFeefetchTradingFeesfetchTransactionsfetchVolatilityHistoryfetchWithdrawalsreduceMarginsandboxsetLeverage	setMarginsetMarginModesetPositionModetransferwithdrawzchttps://user-images.githubusercontent.com/1294454/27766555-8eaec20e-5edc-11e7-9c5b-6dc69fc42f5e.jpgz!https://api.demo.hitbtc.com/api/3)publicprivatezhttps://api.hitbtc.com/api/3zhttps://hitbtc.comz(https://hitbtc.com/?ref_id=5a5d39a65d466zhttps://api.hitbtc.comz=https://github.com/hitbtc-com/hitbtc-api/blob/master/APIv2.mdz"https://hitbtc.com/fees-and-limitszIhttps://support.hitbtc.com/hc/en-us/articles/115005148605-Fees-and-limits)logotestapiwwwreferraldocfeesgetzpublic/currency
   zpublic/currency/{currency}zpublic/symbolzpublic/symbol/{symbol}zpublic/tickerzpublic/ticker/{symbol}zpublic/price/ratezpublic/price/historyzpublic/price/tickerzpublic/price/ticker/{symbol}zpublic/tradeszpublic/trades/{symbol}zpublic/orderbookzpublic/orderbook/{symbol}zpublic/candleszpublic/candles/{symbol}zpublic/converted/candles)z!public/converted/candles/{symbol}zpublic/futures/infozpublic/futures/info/{symbol}zpublic/futures/history/fundingz'public/futures/history/funding/{symbol}z"public/futures/candles/index_pricez+public/futures/candles/index_price/{symbol}z!public/futures/candles/mark_pricez*public/futures/candles/mark_price/{symbol}z$public/futures/candles/premium_indexz-public/futures/candles/premium_index/{symbol}z$public/futures/candles/open_interestz-public/futures/candles/open_interest/{symbol}zspot/balance   zspot/balance/{currency}
spot/order   spot/order/{client_order_id}zspot/feezspot/fee/{symbol}zspot/history/orderzspot/history/tradezmargin/account margin/account/isolated/{symbol}zmargin/account/cross/{currency}margin/ordermargin/order/{client_order_id}zmargin/configzmargin/history/orderzmargin/history/tradezmargin/history/positionszmargin/history/clearingzfutures/balancezfutures/balance/{currency}zfutures/account!futures/account/isolated/{symbol}futures/orderfutures/order/{client_order_id}zfutures/configzfutures/feezfutures/fee/{symbol}zfutures/history/orderzfutures/history/tradezfutures/history/positionszfutures/history/clearingzwallet/balance   zwallet/balance/{currency}zwallet/crypto/address)z$wallet/crypto/address/recent-depositz%wallet/crypto/address/recent-withdrawz wallet/crypto/address/check-minezwallet/transactionszwallet/transactions/{tx_id}zwallet/crypto/fee/estimatezwallet/airdropszwallet/amount-lockszsub-accountsub-account/aclzsub-account/balance/{subAccID}z0sub-account/crypto/address/{subAccID}/{currency}zspot/order/listzmargin/order/listzfutures/order/listzwallet/crypto/withdrawzwallet/convertzwallet/transferzwallet/internal/withdrawz&wallet/crypto/check-offchain-availablezwallet/crypto/fees/estimatezwallet/airdrops/{id}/claimzsub-account/freezezsub-account/activatezsub-account/transferr   )r   r   r   )r   r   zmargin/positionz!margin/position/isolated/{symbol}r   r   zfutures/positionz'futures/position/{margin_mode}/{symbol}r   r   wallet/crypto/withdraw/{id})r   r   r   )r   postpatchdeleteputtradingz0.0009010z0.0007100z0.0006500z0.00051000z0.00035000z0.000210000z0.00012000050000z-0.0001100000z0.0008z0.0004)makertaker)	tierBased
percentager   r   tiers)IOCFOKPOGTD)
marginModetriggerPricetriggerPriceTypetriggerDirectionstopLossPricetakeProfitPriceattachedStopLossTakeProfittimeInForcehedgedselfTradePreventiontrailingleveragemarketBuyByCostmarketBuyRequiresPriceiceberg  i )r   limitdaysBack	untilDayssymbolRequired
marketType)r   triggerr   r   r   )r   r   r   r   r   r   )	r   r   r   daysBackCanceledr   r   r   r   r   r   )	r   rE   createOrdersrn   rw   rt   rz   rP   ro   extendsdefaultr   )r   rE   rw   rn   rt   rP   forDerivatives)linearinverse)r   r;   r   r=   r>   M1M3M5M15M30H1H4D1D71M)
1m3m5m15m30m1h4h1d1wr   42950350460080010021003100410052001200220032010201120122020202220241000110021100222000120002200032000420005200062000720008200092001020011200122001420016200182003120032200332003420040200412004220043200442004520047200482004920080)2100121003210042200422008)exactbroadERC20ETHTRC20)r*  USDTBTCbtcOMNIethETCBEP20BSCTRXNEARDGBAEARADACHZABBCALGOAPTATOMAVAXCAVACAVAXXAVAXBSVBCHSVBEP2BNBCELOCKBCTXCDASHDCRDOGEdogeEGLDEOSETHWEVERFETFILFLOWGLMRGRINHBARHIVEHYDRAICPICXIOSTIOTAIOTXKAVAKLAYKIMKOMODOKMDKSMLSKLTCltcMINAMOVRNANONEOONEONTOPTIMISMOPPLCUMATICPOLYGONQTUMREIOASISROSERVNSCSCRTSOLSTEEMTHETAThetaTRUEVETVSYSWAVESWAXXCHXECNEMXEMXLMXMRxmrXRDXRPXTZXVGXYMZECZENZILwalletderivatives)r;   fundingr=   r>   
includeFee)defaultNetworkdefaultNetworksnetworksaccountsByTyper   AUTOCubeBCCBDPBidiPassBETz
DAO.CasinoBIT
BitRewardsBOXz	BOX TokenCPTCryptaurGETThemisGMTz	GMT TokenHSRHCIQzIQ.CashLNC
LinkerCoinPLAPlayChipPNTPentaSBTCzSuper BitcoinSTEPNSTXSTOX
TokenvilleMTL)TVXMTXPNT)idname	countries	rateLimitversionhasprecisionModeurlsr   r   features
timeframes
exceptionsoptionscommonCurrencies)deep_extendsuperr4   describer1   parse_numberr.   r#   r/   r%   r$   r)   r(   r+   r&   r*   r,   r0   )self	__class__s    S/var/www/html/turnos/venv/lib/python3.12/site-packages/ccxt/async_support/hitbtc.pyr  zhitbtc.describe   s1   fd < > VVV $V 	V
 %V %V TV "4V tV  V 'V tV &tV (V 'V  (!V" "4#V$ T%V&  'V( )V* +D+V, )$-V. $T/V0 '1V2 (3V4 "45V6 &t7V8 (9V: 1%;V<  =V> +D?V@ *:AVB +DCVD &tEVF #DGVH *4IVJ $TKVL uMVN "4OVP *5QVR +ESVT  UVV %dWVX $UYVZ ":[V\ #D]V^ +E_V` aVb !$cVd &ueVf +EgVh  iVj dkVl $TmVn +EoVp %dqVr !$sVt "4uVv uwVx #EyVz d{V| !$}V~ "4V@ uAVB #DCVD  EVF !$GVH )$IVJ )%KVL tMVN OVP tQVR "4SVT #DUVV $ZWVX )%YVZ #D[V\ ]V^ 4_V` taVb UcVd  eVf "5gVh DiVj DkVn '}AB
 == ,F,S
 9_!.  )24b ( 1"	
 ( 1" ,R / .r 7 ( 1" +B 4R )"  22!" 3B#$ >@/18::<CE>@GI=?FH@BIK@BIK=!F/&/12/ %a/ 7	/
 #B/ ,R/ -b/ -b/ )!/ ;A/ :1/ '/ 9!/ (/ //  /!/" 3B#/$ 22%/& *2'/( 5b)/* *1+/, <Q-/. (//0 :11/2 )"3/4 &r5/6 /7/8 09/: 0;/< 4R=/> 3B?/@ )"A/B 4RC/D 0E/F ACAC<>/17968+-/1')+-:<LN]/`$a)1 ' ,Q	
 ( -a 0 1" )" *2 3B A" 6r 5b -b  /!" /#$ *2%* 9::;;< '(89+,=>():;,-CD)*;<79 =>=>79o\G@D !%"&!..x8!..x8 "..s3T5F5Fx5PQ!..t4d6G6G6QR!..u5t7H7H7RS!..u5t7H7H7RS!..v68I8I(8ST!..v68I8I(8ST!..w79J9J89TU!..w79J9J39OP!..w79J9J99UV!..x8$:K:KI:VW" "..s3T5F5Fx5PQ!..t4d6G6G6QR!..u5t7H7H7RS!..u5t7H7H7RS!..v68I8I(8ST!..v68I8I(8ST!..w79J9J89TU!..w79J9J89TU!..w79J9J89TU!..x8$:K:KH:UV"!H  $&+(,,0,1).+06:#'#'"&#'	( #(/4$)$)+027#')$, %)&*!%$*%+*/&*& '+#($)*/&*# '+!%#($)*/&*( $(&*!%$*,-%+#($)*/&*
*  #y?B y  )$d$ %e# %e& %e( %e*#( "#3 "#3 	 "#3 "#3 	}fP 9,9=9 /9 /	9
 +9 =9 /9 ,9 /9 /9 I9 J9 J9 J9 J9  J!9" J#9$ J%9& L'9( Z)9* -+9, Z-9. ./90 ]192 ]394 ]596 ]798 ]99: ];9< \=9> \?9@ ]A9B ]C9D ]E9F ]G9H ]I9J ]K9L ]M9N ]O9P ]Q9R ]S9T ]U9V ]W9X ]Y9Z ][9\ -]9^ \_9` \a9b \c9d \e9f ]g9h +--**q9t w<| #* #$y5y Ey 5	y
 Uy 5y Uy Uy Fy 5y $y$ $%y( 5)y2 53y8 F9yB FCyH 5IyR FSyT VUyV VWyb 7cyd EeyB FCyH 5IyT FUy\ F]y` 5ayh Fiyv Fwy@ 5AyD FEyL FMyR 5SyT 5UyX FYyf Fgyl Fmyn Foyr Fsyz W{y| 5}y~ 5yB FCyD FEyF FGyJ FKyL EMyN eOyR 5SyX 5Yy\ 5]yh Fiyn Foyt Fuyx 5yyJ 5KyN 5OyP QyZ F[y` Yayl Fmyp 5qyv Vwy| 5}y@ $AyB FCyL 5MyR WSyZ W[yb Fcyl 5myr Fsyv Wwyx 5yy@ 5AyJ 5KyL 5MyR 5SyV 5Wy` 5ayb 5cyd 5eyf 5gyh 5iyj 5kyl 5myn 5oyv #')+	# !%MIT!!u! z! |	!
 |! {! z! x! {! t! i! |! z! w! !  !!" v#!$ #)!giA
 i i	    c                 "    | j                         S N)milliseconds)r  s    r  noncezhitbtc.nonce  s      ""r  c                 b  K   | j                  |       d{   }g }t        |j                               }t        dt	        |            D ]Z  }||   }|j                  d      r| j                  ||      }| j                  |d      }| j                  |d      }	|dk(  }
|dk(  }| j                  |dd	      }|xr |}|	du}|
xr | }d	}| j                  |d
d      }| j                  |d      }| j                  |d      }| j                  |      }| j                  |      }| j                  |      }d}d}|dz   |z   }d}d}d}d}|
rI| j                  d      }|}| j                  |      }|duxr ||k(  }| }|dz   |z   }|r|dz   |	z   }d}nd}| j                  |d      }| j                  |d      }| j                  |      } | j                  |      }!|j                  i d|d|d|d|d|d|d|d|d|d|d|d|d|d|d d!d"|
d#||| j                  |d$      | j                  |d%      ||	ddd|| |!d&| j                  d      | j                  |d'd(      d)| dd)|!dd)| j                  t        j                   ||            dd)d*d|d+       ] |S 7 w),z
        retrieves data on all markets for hitbtc

        https://api.hitbtc.com/#symbols

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: an array of objects representing market data
        Nr   _BQXtypeexpiryfuturesr;   margin_tradingFbase_currency
underlyingquote_currencyfee_currency/1:-r>   r=   quantity_increment	tick_sizer  symbolbasequotesettlebaseIdquoteIdsettleIdr<   r?   activeTcontractr   	take_rate	make_rate)amountpricemax_initial_leverager   minmax)r   r  r  cost)r   r   r   contractSizer  expiryDatetimestrike
optionTypefeeCurrency	precisionlimitscreatedinfo)publicGetPublicSymbollistkeysrangelenendswith
safe_valuesafe_stringsafe_integer	safe_boolsafe_string_2safe_currency_coder  appendsafe_numberr2   
string_mul)"r  paramsresponseresultidsir  marketr   r  r  r;   marginTradingr<   r>   r=   r?   r  r  feeCurrencyIdr  r  r  r  r  r  r  r  r   r   	lotString
stepStringlotsteps"                                     r  fetch_marketszhitbtc.fetch_markets  s     33F;;> 8==?#q#c(# ^	AQB{{6"__Xr2F))&&9J&&vx8F"i/H&(D NN63CUKM+mFD(F+VDF''NF&&v/?@G ,,V^DM**62D++G4E11-@KHFCZ%'FDLFG#005(00: ,C5F?$*#.#c\F2F#D!D((1EFI))&+>J##I.C$$Z0DMM 3b3&3 3 	3
 &3 &3 73 H3 3 3 &3 3 &3 &3 $3  H!3" &#3$ #))&+>))&+> , "&"*!!  $005#//8NPQR!
  ##
  $#
  $001C1CIz1Z[#$  e3 3W^	~ A <s   J/J,JJ/c                 X  K   | j                  |       d{   }i }t        |j                               }t        dt	        |            D ]U  }||   }| j                  |      }||   }| j                  |dg       }	i }
t        dt	        |	            D ]  }|	|   }| j                  |dd      }| j                  |      }||j                         n|}|||d| j                  |d      | j                  |d      | j                  |d      | j                  |d	      d
dddid	|
|<    | j                  |||| j                  |d      | j                  |d      | j                  |d       | j                  |d      | j                  |d      |
dddddidd      ||<   X |S 7 w)a  
        fetches all available currencies on an exchange

        https://api.hitbtc.com/#currencies

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an associative dictionary of currencies
        Nr   r  protocolnetwork
payout_feepayin_enabledpayout_enabledprecision_payoutr   r  )	r  r  r  r  feedepositr   r  r  precision_transfer	full_namedelistedr  )r  coder  r  r  r  r"  r   r  r!  r  r  )publicGetPublicCurrencyr  r   r  r  r	  	safe_listr  network_id_to_codeupperr  r  safe_currency_structurer  )r  r  r  r  
currenciesr  
currencyIdr&  entryrawNetworksr  j
rawNetwork	networkIdnetworkCodes                  r  fetch_currencieszhitbtc.fetch_currencies  s     55f==V (--/*
q#j/* -	A#AJ**:6DZ(E..
B?KH1c+./ (^
 ..z:yQ	"55i@6A6Mk//1TX&#*"++JE#~~j/J $z;K L!%!1!1*>P!Q"#'#'%)%*  77 !--e5IJ((<"nnUJ??>>%A NN52BC$## #9 F4L7-	\ w >s   F*F'FF*r&  c                   K   | j                          d{    | j                  |      }d|d   i}| j                  |d      }|L|dk(  rG| j                  | j                  d      }| j                  ||      }|||d<   | j                  |d      }| j                  | j                  ||             d{   }| j                  |d      }	| j                  |	      | j                  |d      | j                  |d      d|d	S 7 7 Ow)
a  
        create a currency deposit address

        https://api.hitbtc.com/#generate-deposit-crypto-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: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
        Ncurrencyr  r  r,  r  address
payment_id)r6  r7  tagr  r  )
load_marketsr6  safe_string_upperr  r  r  omitprivatePostWalletCryptoAddressextendr	  )
r  r&  r  r6  requestr  r  parsedNetworkr  r-  s
             r  create_deposit_addresszhitbtc.create_deposit_address  s     !!!==&
 ((;dfnt||Z@H ,,Xw?M(&3
#YYvy1F<<T[[RX=YZZ %%h
;
//
;'')<##Hl;
 	
# 	" [s#   D	DB D	7D8AD	D	c                 H  K   | j                          d{    | j                  |      }d|d   i}| j                  |d      }|L|dk(  rG| j                  | j                  d      }| j                  ||      }|||d<   | j                  |d      }| j                  | j                  ||             d{   }| j                  |d      }	| j                  |	d      }
| j                  |	d      }| j                  |	d	      }| j                  |      }||d|
|d
S 7 7 hw)av  
        fetch the deposit address for a currency associated with self account

        https://api.hitbtc.com/#get-deposit-crypto-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>`
        Nr6  r  r  r,  r  r   r7  r8  )r  r6  r  r7  r9  )
r:  r6  r;  r  r  r  r<  privateGetWalletCryptoAddressr>  r	  )r  r&  r  r6  r?  r  r  r@  r  firstAddressr7  r-  r9  
parsedCodes                 r  fetch_deposit_addresszhitbtc.fetch_deposit_address"  s:     !!!==&
 ((;dfnt||Z@H ,,Xw?M(&3
#YYvy1F;;DKKQW<XYY x3""<;%%lJ?
|\:,,Z8
"
 	
+ 	" Zs#   D"DB D"7D 8A&D" D"c                 .   d|i}t        dt        |            D ]i  }||   }| j                  |d      }| j                  |      }| j	                         }| j                  |d      |d<   | j                  |d      |d<   |||<   k | j                  |      S )Nr  r   r6  	availablefreereservedused)r  r  r  r	  accountsafe_balance)r  r  r  r  r.  r-  r&  rL  s           r  parse_balancezhitbtc.parse_balanceI  s    )q#h-( 	#AQKE))%<J**:6DllnG"..ukBGFO"..ujAGFO"F4L	#   ((r  c                 (  K   | j                  |dd      }| j                  |dg      }| j                  | j                  di       }| j	                  |||      }d}|dk(  r| j                  |       d{   }n|dk(  r| j                  |       d{   }nb|dk(  r| j                  |       d{   }nCt        |j                               }t        | j                  dz   dj                  |      z         | j                  |      S 7 7 z7 ]w)	a  
        query for balance and get the amount of funds available for trading or funds locked in orders

        https://api.hitbtc.com/#wallet-balance
        https://api.hitbtc.com/#get-spot-trading-balance
        https://api.hitbtc.com/#get-trading-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  r;   r  Nr  r  z. fetchBalance() type parameter must be one of , )safe_string_lowerr<  r  r  r  privateGetWalletBalanceprivateGetSpotBalanceprivateGetFuturesBalancer  r   r(   r  joinrN  )r  r  r  r  rL  r  r   s          r  fetch_balancezhitbtc.fetch_balanceU  s
     %%fff=6F8,7GL"">4>h!99&AAH!77??H%!::6BBH++-.DTWW'WWZ^ZcZcdhZiijj !!(++' B?Bs7   A2D4D5DDD2D3ADDDr  c                    K   | j                          d{    | j                  |      }d|d   i}| j                  | j                  ||             d{   }| j	                  ||      S 7 W7 w)a  
        fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market

        https://api.hitbtc.com/#tickers

        :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>`
        Nr  r  )r:  r  publicGetPublicTickerSymbolr>  parse_tickerr  r  r  r  r?  r  s         r  fetch_tickerzhitbtc.fetch_ticker{  sy      !!!V$fTl
 99$++gv:VWW   622' 	"
 Xs"   A2A.A A2A0A20A2Nsymbolsc                   K   | j                          d{    | j                  |      }i }|'| j                  |      }dj                  |      }||d<   | j	                  | j                  ||             d{   }i }t        |j                               }t        dt        |            D ]7  }	||	   }
| j                  |
      }|d   }||
   }| j                  ||      ||<   9 | j                  |d|      S 7 7 w)a  
        fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market

        https://api.hitbtc.com/#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>`
        N,r\  r   r  )r:  market_symbols
market_idsrU  publicGetPublicTickerr>  r  r   r  r  safe_marketrY  filter_by_array_tickers)r  r\  r  r?  	marketIds	delimitedr  r  r   r  marketIdr  r  r.  s                 r  fetch_tickerszhitbtc.fetch_tickers  s     !!!%%g.0I+I!*GI33DKK4PQQ  HMMO$q#d)$ 	>AAwH%%h/FH%FX&E!..uf=F6N	> ++FHgFF? 	" Rs#   DC=A$D;C?<BD?Dtickerr  c                    | j                  |d         }| j                  d |      }| j                  |d      }| j                  |d      }| j                  |d      }| j                  |d      }| j                  i d|d|d| j	                  |      d| j                  |d      d	| j                  |d	      d
| j                  |d
      dd d| j                  |d      dd dd d|d|d|dd dd dd dd |||d|      S )N	timestampvolumevolume_quoteopenlastr  datetimehighlowbid	bidVolumeask	askVolumevwapclosepreviousClosechanger   average)
baseVolumequoteVolumer  )	parse8601safe_symbolr  safe_tickeriso8601)	r  rh  r  rj  r  r{  r|  rm  rn  s	            r  rY  zhitbtc.parse_ticker  s    NN6+#67	!!$/%%fh7
&&v~>// !
f!
!
 Y/!
 D$$VV4	!

 4##FE2!
 4##FE2!
 !
 4##FE2!
 !
 D!
 D!
 T!
 D!
 T!
 d!
  $!!
" t#!
$ %&)!
* + 	r  sincer   c                 t  K   | j                          d{    d}i }|t        |d      |d<   |||d<   d}|C| j                  |      }|d   |d<   | j                  | j	                  ||             d{   }n)| j                  | j	                  ||             d{   }|| j                  ||      S g }t        |j                               }	t        dt        |	            D ]A  }
|	|
   }| j                  |      }||   }| j                  ||      }| j                  ||      }C |S 7 7 7 w)a  
        get the list of most recent trades for a particular symbol

        https://api.hitbtc.com/#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
        :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>`
        Nr   r   fromr  r  r   )r:  r  r  publicGetPublicTradesSymbolr>  publicGetPublicTradesparse_tradesr  r   r  r  array_concat)r  r  r  r   r  r  r?  r  tradesrd  r  rf  marketInner	rawTradesparseds                  r  fetch_tradeszhitbtc.fetch_trades  sR     !!!"5$/GG#GFO[[(F &tGH!==dkk'SY>Z[[H!77GV8TUUH$$Xv66)	q#i.) 	7A |H++h/K *I&&y+>F&&vv6F	7 1 	" \Us5   D8D1A!D88D49)D8"D6#BD84D86D8c                   K   | j                          d{    d}i }|| j                  |      }|d   |d<   |||d<   |||d<   d}d}d}	| j                  d||      \  }}| j                  d|      \  }}| j	                  |ddg      }|*| j                  | j                  ||             d{   }	n|d	k(  r*| j                  | j                  ||             d{   }	nv|d
k(  r*| j                  | j                  ||             d{   }	nG|dk(  r*| j                  | j                  ||             d{   }	nt        | j                  dz         | j                  |	|||      S 7 \7 7 7 g7 :w)a  
        fetch all trades made by the user

        https://api.hitbtc.com/#spot-trades-history
        https://api.hitbtc.com/#futures-trades-history
        https://api.hitbtc.com/#margin-trades-history

        :param str symbol: unified market symbol
        :param int [since]: the earliest time in ms to fetch trades for
        :param int [limit]: the maximum number of trades structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported
        :param bool [params.margin]: True for fetching margin trades
        :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
        Nr  r  r   r  rn   r   r<   r;   r=   z- fetchMyTrades() not support self market typer:  r  handle_market_type_and_paramshandle_margin_mode_and_paramsr<  privateGetMarginHistoryTrader>  privateGetSpotHistoryTradeprivateGetFuturesHistoryTrader-   r  r  
r  r  r  r   r  r  r?  r   r   r  s
             r  fetch_my_tradeszhitbtc.fetch_my_trades  s      !!![[(F &tGH$GG#GFO

!??QWY_`
F!??QWX
F6L(#;<!!>>t{{7TZ?[\\HV#!%!@!@WV\A]!^^v%!%!C!CDKKPWY_D`!aax'!%!B!B4;;wX^C_!``"477-\#\]]  65%@@7 	"" ] _a`sX   E=E2BE=3E54.E="E7#.E=E9.E= E;2E=5E=7E=9E=;E=tradec                 n   | j                  |d         }| j                  |d      }| j                  ||      }|d   }d }| j                  |d      }| j                  |d      }||rdnd}	nd}	|;| j                  |di       }
| j                  |
d      }| j	                  |      }||d}| j                  |d	d
      }| j                  |d      }| j                  |dd      }| j                  |d      }| j                  |d      }| j                  ||||| j                  |      |d ||	||d |d|      S )Nrj  r  r!  r   r   r  r  )r  r6  clientOrderIdclient_order_idr  quantityqtysider  )r  r  orderrj  ro  r  r  r  takerOrMakerr  r  r  r!  )r}  r  rb  r  r	  r  
safe_trader  )r  r  r  rj  rf  r  r!  feeCostStringr   r  r  r  feeCurrencyCodeorderIdpriceStringamountStringr  r  s                     r  parse_tradezhitbtc.parse_tradeC  st   r NN5#56	##E84!!(F3!((6w/&+7L"L$??6626D**4@K"55kBO%+C $$UO=NO&&ug6))%UCv.eT*"Y/( " 
  	r  c                 :  K   | j                          d {    d|i}d }|| j                  |      }|d   |d<   || j                  |      |d<   |||d<   | j                  | j	                  ||             d {   }| j                  |||||      S 7 7 w)Ntypesr  r,  r  r   )r:  r6  r  privateGetWalletTransactionsr>  parse_transactions)	r  r  r&  r  r   r  r?  r6  r  s	            r  fetch_transactions_helperz hitbtc.fetch_transactions_helper  s     !!!U
 }}T*H$,TNGL!"ll51GFO$GG::4;;wPV;WXX2 &&x5%PPK 	" Ys"   BBA&B=B>BBstatusc                 8    dddddd}| j                  |||      S )Npendingfailedok)CREATEDPENDINGFAILEDROLLED_BACKSUCCESSr  r  r  statusess      r  parse_transaction_statuszhitbtc.parse_transaction_status  s/      #
 &&99r  c                 2    ddd}| j                  |||      S )Nr"  
withdrawal)DEPOSITWITHDRAWr  )r  r  r  s      r  parse_transaction_typezhitbtc.parse_transaction_type  s&     $
 tT22r  transactionr6  c                    | j                  |dd      }| j                  | j                  |d            }| j                  | j                  |d            }| j                  | j                  |d            }| j	                  | j                  |d            }| j                  |di       }| j                  |d      }	| j                  |	      }
| j                  |d	      }| j                  |d
      }|}| j                  |d      }|}| j                  |d      }| j                  |d      }| j                  |d      }| j                  |d      }|dk(  }d d d d}| j                  |d      }|
|
|d<   ||d<   i d|d|d|d|d|
dd d|d|d|d| j                  |      d
|d|d|d|dd d|d|d ||dS ) Noperation_idr  
created_at
updated_atr  r  nativer6  hashr7  r8  sendersr   r  subtypeOFFCHAIN)r6  r  rater!  r  r  txidr  rj  ro  addressFrom	addressTor9  tagFromtagToupdated)commentinternalr!  )	r  r}  r  r  r  r  r	  r  r  )r  r  r6  r  rj  r  r  r  r  r-  r&  txhashr7  r  r9  r  senderr  r  subTyper  r!  feeCosts                          r  parse_transactionzhitbtc.parse_transaction  sv   B ^TBNN4#3#3K#NO	..!1!1+|!LM**4+;+;K+PQ..t/?/?X/VWh;%%fj9
&&z2!!&&1""695	v|43&&vq1!!&(3"";	:j( 

 ""651"C
O!CK
K
"
 F
 D	

 
 t
 f
 f
 
 Y/
 w
 ;
 
 3
 t
  U!
" w#
$  )
 	
r  c                 H   K   | j                  d||||       d{   S 7 w)a_  
        fetch history of deposits and withdrawals

        https://api.hitbtc.com/#get-transactions-history

        :param str [code]: unified currency code for the currency of the deposit/withdrawals, default is None
        :param int [since]: timestamp in ms of the earliest deposit/withdrawal, default is None
        :param int [limit]: max number of deposit/withdrawals to return, default is None
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a list of `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
        zDEPOSIT,WITHDRAWNr  r  r&  r  r   r  s        r  fetch_deposits_withdrawalsz!hitbtc.fetch_deposits_withdrawals5  s*      334FeUZ\bcccc   " "c                 H   K   | j                  d||||       d{   S 7 w)a  
        fetch all deposits made to an account

        https://api.hitbtc.com/#get-transactions-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
        :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
        r  Nr  r  s        r  fetch_depositszhitbtc.fetch_depositsC  s(      33ItUESYZZZZr  c                 H   K   | j                  d||||       d{   S 7 w)a  
        fetch all withdrawals made from an account

        https://api.hitbtc.com/#get-transactions-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
        :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
        r  Nr  r  s        r  fetch_withdrawalszhitbtc.fetch_withdrawalsQ  s(      33JeUTZ[[[[r  c                   K   | j                          d{    i }|%| j                  |      }dj                  |      |d<   |||d<   | j                  | j	                  ||             d{   }i }t        |j                               }t        dt        |            D ]Y  }	||	   }
||
   }| j                  |
      }| j                  | j                  |d            }| j                  ||
   ||dd      ||<   [ |S 7 7 w)	aZ  
        fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data for multiple markets

        https://api.hitbtc.com/#order-books

        :param str[] [symbols]: list of unified market symbols, all symbols fetched if None, default is None
        :param int [limit]: max number of entries per orderbook to return, default is None
        :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 symbol
        Nr^  r\  depthr   rj  rr  rt  )r:  r`  rU  publicGetPublicOrderbookr>  r  r   r  r  r~  r}  r  parse_order_book)r  r\  r   r  r?  marketIdsInnerr  r  rd  r  rf  	orderbookr  rj  s                 r  fetch_order_bookszhitbtc.fetch_order_books_  s     !!!!__W5N!$.!9GI$GG66t{{7F7STT)	q#i.) 	hA |H *I%%h/Ft'7'7	;'OPI!228H3EvyZ_afgF6N	h ! 	" Us#   DDAD/D0BDDc                 >  K   | j                          d{    | j                  |      }d|d   i}|||d<   | j                  | j                  ||             d{   }| j	                  | j                  |d            }| j                  |||dd      S 7 7 <w)a!  
        fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data

        https://api.hitbtc.com/#order-books

        :param str symbol: unified symbol of the market to fetch the order book for
        :param int [limit]: the maximum amount of order book entries to return
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
        Nr  r  r  rj  rr  rt  )r:  r  publicGetPublicOrderbookSymbolr>  r}  r  r  )r  r  r   r  r  r?  r  rj  s           r  fetch_order_bookzhitbtc.fetch_order_book|  s      !!!V$fTl
 $GG<<T[[RX=YZZNN4#3#3Hk#JK	$$Xvy%OO 	" [s"   BBABB;BBr!  c                     | j                  |d      }| j                  |d      }| j                  |d      }| j                  ||      }||||d d dS )Nr  r  r  )r  r  r   r   r   r   )r  r  r~  )r  r!  r  r   r   rf  r  s          r  parse_trading_feezhitbtc.parse_trading_fee  sh       k2  k2##C2!!(F3
 	
r  c                   K   | j                          d{    | j                  |      }d|d   i}d}|d   dk(  r*| j                  | j                  ||             d{   }nJ|d   dk(  r*| j	                  | j                  ||             d{   }nt        | j                  dz         | j                  ||      S 7 7 c7 3w)a  
        fetch the trading fees for a market

        https://api.hitbtc.com/#get-trading-commission
        https://api.hitbtc.com/#get-trading-commission-2

        :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  r  r  r;   r=   z/ fetchTradingFee() not support self market type)r:  r  privateGetSpotFeeSymbolr>  privateGetFuturesFeeSymbolr-   r  r  rZ  s         r  fetch_trading_feezhitbtc.fetch_trading_fee  s      !!!V$fTl
 &>V#!99$++gv:VWWHF^v%!<<T[[RX=YZZHtww)ZZ[[ %%h77% 	" XZs4   C	CA
C	!C"1C	C0C	C	C	c                   K   | j                          d{    | j                  dd|      \  }}d}|dk(  r| j                  |       d{   }n7|dk(  r| j                  |       d{   }nt	        | j
                  dz         i }t        dt        |            D ]   }| j                  ||         }|d   }|||<   " |S 7 7 z7 ]w)a  
        fetch the trading fees for multiple markets

        https://api.hitbtc.com/#get-all-trading-commissions
        https://api.hitbtc.com/#get-all-trading-commissions-2

        :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
        Nr   r;   r=   z0 fetchTradingFees() not support self market typer   r  )	r:  r  privateGetSpotFeeprivateGetFuturesFeer-   r  r  r  r  )	r  r  r   queryr  r  r  r!  r  s	            r  fetch_trading_feeszhitbtc.fetch_trading_fees  s      !!! >>?QSWY_`
E!33E::H6!!66u==Htww)[[\\ q#h-( 	!A((!5C]F F6N	! / 	" ;=s4   CC5CCC+C	,ACC	Cr   c           	        K   | j                          d{    d}| j                  |dd      \  }}|r| j                  d|||||d       d{   S | j                  |      }|d   | j	                  | j
                  ||      d}|| j                  |      |d<   | j                  d	||      \  }}|t        |d      |d
<   | j	                  |d      }	| j                  |d      }d}
|	dk(  r*| j                  | j                  ||             d{   }
n|	dk(  r*| j                  | j                  ||             d{   }
nX|	dk(  r*| j                  | j                  ||             d{   }
n)| j                  | j                  ||             d{   }
| j                  |
||||      S 7 7 j7 7 z7 M7 %w)ap  
        fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market

        https://api.hitbtc.com/#candles
        https://api.hitbtc.com/#futures-index-price-candles
        https://api.hitbtc.com/#futures-mark-price-candles
        https://api.hitbtc.com/#futures-premium-index-candles

        :param str symbol: unified symbol of the market to fetch OHLCV data for
        :param str timeframe: the length of time each candle represents
        :param int [since]: timestamp in ms of the earliest candle to fetch
        :param int [limit]: the maximum amount of candles to fetch
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: timestamp in ms of the latest funding rate
        :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
        NFro   paginater   r  )r  periodr  untilr   r  markindexpremiumIndex)r:  handle_option_and_params"fetch_paginated_call_deterministicr  r  r  r  handle_until_optionr  r<  ,publicGetPublicFuturesCandlesMarkPriceSymbolr>  -publicGetPublicFuturesCandlesIndexPriceSymbol/publicGetPublicFuturesCandlesPremiumIndexSymbolpublicGetPublicCandlesSymbolparse_ohlcvs)r  r  	timeframer  r   r  r  r  r?  r  r  s              r  fetch_ohlcvzhitbtc.fetch_ohlcv  s    $ !!!88zZ&@@vW\^cenpvx|}}}V$Tl&&t	9M
 "ll51GFO227GVL"5$/GG  167+F?!NNt{{[bdjOkllHg!OOPTP[P[\cekPlmmHn$!QQRVR]R]^egmRnooH!>>t{{7TZ?[\\H8   69eUKKk 	" ~ mmo\sj   GF68GF9CGF<.GF>.G2G 3)GGG9G<G>G GGc           	          | j                  | j                  |d            | j                  |d      | j                  |d      | j                  |d      | j                  |d      | j                  |d      gS )Nrj  rm  r  r  rw  rk  )r}  r  r  )r  ohlcvr  s      r  parse_ohlcvzhitbtc.parse_ohlcv2  sw    2 NN4++E;?@UF+UE*UE*UG,UH-
 	
r  c                 H  K   | j                          d{    d}i }|| j                  |      }|d   |d<   || j                  |      |d<   |||d<   d}d}| j                  d||      \  }}| j	                  d|      \  }}| j                  |ddg      }d}	|*| j                  | j                  ||             d{   }	n|d	k(  r*| j                  | j                  ||             d{   }	nv|d
k(  r*| j                  | j                  ||             d{   }	nG|dk(  r*| j                  | j                  ||             d{   }	nt        | j                  dz         | j                  |	|||      }
| j                  |
dddgd      S 7 7 7 7 }7 Pw)a7  
        fetches information on multiple closed orders made by the user

        https://api.hitbtc.com/#spot-orders-history
        https://api.hitbtc.com/#futures-orders-history
        https://api.hitbtc.com/#margin-orders-history

        :param str symbol: unified market symbol of the market orders were made in
        :param int [since]: the earliest time in ms to fetch orders for
        :param int [limit]: the maximum number of order structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported
        :param bool [params.margin]: True for fetching margin orders
        :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
        Nr  r  r  r   rP   r   r<   r;   r=   z1 fetchClosedOrders() not support self market typer  closedcanceledF)r:  r  r  r  r  r<  privateGetMarginHistoryOrderr>  privateGetSpotHistoryOrderprivateGetFuturesHistoryOrderr-   r  parse_ordersfilter_by_array)r  r  r  r   r  r  r?  r   r   r  r  s              r  fetch_closed_orderszhitbtc.fetch_closed_ordersS  s      !!![[(F &tGH"ll51GFO$GG

!??@SU[]cd
F!??@SU[\
F6L(#;<!!>>t{{7TZ?[\\HV#!%!@!@WV\A]!^^v%!%!C!CDKKPWY_D`!aax'!%!B!B4;;wX^C_!``"477-`#`aa""8VUEB##FHx6LeTT9 	"" ] _a`sY   F"FB+F"F.F"1F2.F" F!.F"F AF"F"F"F" F"r  c                   K   | j                          d{    d}|| j                  |      }d|i}d}d}| j                  d||      \  }}| j                  d|      \  }}| j	                  |ddg      }d}|*| j                  | j                  ||             d{   }n|dk(  r*| j                  | j                  ||             d{   }nv|dk(  r*| j                  | j                  ||             d{   }nG|dk(  r*| j                  | j                  ||             d{   }nt        | j                  dz         | j                  |d	      }	| j                  |	|      S 7 X7 7 7 w7 Jw)
a  
        fetches information on an order made by the user

        https://api.hitbtc.com/#spot-orders-history
        https://api.hitbtc.com/#futures-orders-history
        https://api.hitbtc.com/#margin-orders-history

        :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
        :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported
        :param bool [params.margin]: True for fetching a margin order
        :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        Nr  rw   r   r<   r;   r=   z* fetchOrder() not support self market typer   )r:  r  r  r  r<  r  r>  r  r  r-   r  	safe_dictparse_order)
r  r  r  r  r  r?  r   r   r  r  s
             r  fetch_orderzhitbtc.fetch_order  s     !!![[(Fr
 

!??fV\]
F!??fU
F6L(#;<!!>>t{{7TZ?[\\HV#!%!@!@WV\A]!^^v%!%!C!CDKKPWY_D`!aax'!%!B!B4;;wX^C_!``"477-Y#YZZ( x+v..Y 	" ] _a`sY   E9E.BE9E1 .E9E3.E9=E5>.E9,E7-AE91E93E95E97E9c                   K   | j                          d{    d}|| j                  |      }d|i}d}d}	| j                  d||      \  }}| j                  d|      \  }	}| j	                  |ddg      }d}
|	*| j                  | j                  ||             d{   }
n|dk(  r*| j                  | j                  ||             d{   }
nv|dk(  r*| j                  | j                  ||             d{   }
nG|dk(  r*| j                  | j                  ||             d{   }
nt        | j                  dz         | j                  |
|||      S 7 H7 7 7 g7 :w)	a  
        fetch all the trades made from a single order

        https://api.hitbtc.com/#spot-trades-history
        https://api.hitbtc.com/#futures-trades-history
        https://api.hitbtc.com/#margin-trades-history

        :param str id: order id
        :param str symbol: unified market symbol
        :param int [since]: the earliest time in ms to fetch trades for
        :param int [limit]: the maximum number of trades to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported
        :param bool [params.margin]: True for fetching margin trades
        :returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
        Norder_idr{   r   r<   r;   r=   z0 fetchOrderTrades() not support self market typer  )r  r  r  r  r   r  r  r?  r   r   r  s              r  fetch_order_tradeszhitbtc.fetch_order_trades  s    " !!![[(F
 

!??@RTZ\bc
F!??@RTZ[
F6L(#;<!!>>t{{7TZ?[\\HV#!%!@!@WV\A]!^^v%!%!C!CDKKPWY_D`!aax'!%!B!B4;;wX^C_!``"477-_#_``N   65%@@} 	" ] _a`sX   E)EBE)E! .E)E#.E)=E%>.E),E'-2E)!E)#E)%E)'E)c                   K   | j                          d{    d}i }|| j                  |      }|d   |d<   d}d}| j                  d||      \  }}| j                  d|      \  }}| j	                  |ddg      }d}	|*| j                  | j                  ||             d{   }	n|dk(  r*| j                  | j                  ||             d{   }	nv|dk(  r*| j                  | j                  ||             d{   }	nG|dk(  r*| j                  | j                  ||             d{   }	nt        | j                  d	z         | j                  |	|||      S 7 N7 7 7 g7 :w)
a  
        fetch all unfilled currently open orders

        https://api.hitbtc.com/#get-all-active-spot-orders
        https://api.hitbtc.com/#get-active-futures-orders
        https://api.hitbtc.com/#get-active-margin-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 orders structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported
        :param bool [params.margin]: True for fetching open margin orders
        :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
        Nr  r  rt   r   r<   r;   r=   z/ fetchOpenOrders() not support self market type)r:  r  r  r  r<  privateGetMarginOrderr>  privateGetSpotOrderprivateGetFuturesOrderr-   r  r  r  s
             r  fetch_open_orderszhitbtc.fetch_open_orders  s      !!![[(F &tGH

!??@QSY[ab
F!??@QSYZ
F6L(#;<!!77GV8TUUHV#!%!9!9$++gv:V!WWv%!%!<!<T[[RX=Y!ZZx'!%!;!;DKKQW<X!YY"477-^#^__(   65%@@U 	" V XZYsX   E/E$BE/%E'&.E/E).E/E+.E/2E-32E/'E/)E/+E/-E/c                   K   | j                          d{    d}|| j                  |      }d|i}d}d}| j                  d||      \  }}| j                  d|      \  }}| j	                  |ddg      }d}|*| j                  | j                  ||             d{   }n|dk(  r*| j                  | j                  ||             d{   }nv|dk(  r*| j                  | j                  ||             d{   }nG|dk(  r*| j                  | j                  ||             d{   }nt        | j                  dz         | j                  ||      S 7 F7 7 7 e7 8w)	a  
        fetch an open order by it's id

        https://api.hitbtc.com/#get-active-spot-order
        https://api.hitbtc.com/#get-active-futures-order
        https://api.hitbtc.com/#get-active-margin-order

        :param str id: order id
        :param str symbol: unified market symbol, default is None
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported
        :param bool [params.margin]: True for fetching an open margin order
        :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        Nr  rs   r   r<   r;   r=   z. fetchOpenOrder() not support self market type)r:  r  r  r  r<  "privateGetMarginOrderClientOrderIdr>   privateGetSpotOrderClientOrderId#privateGetFuturesOrderClientOrderIdr-   r  r  	r  r  r  r  r  r?  r   r   r  s	            r  fetch_open_orderzhitbtc.fetch_open_orderK  s{     !!![[(Fr
 

!??@PRXZ`a
F!??@PRXY
F6L(#;<!!DDT[[QXZ`EabbHV#!%!F!Ft{{SZ\bGc!ddv%!%!I!I$++V]_eJf!ggx'!%!H!HU\^dIe!ff"477-]#]^^&111 	" c egfX   E'EBE'E .E'E!.E'=E#>.E',E%-0E'E'!E'#E'%E'c                   K   | j                          d{    d}i }|| j                  |      }|d   |d<   d}d}| j                  d||      \  }}| j                  d|      \  }}| j	                  |ddg      }d}|*| j                  | j                  ||             d{   }n|dk(  r*| j                  | j                  ||             d{   }nv|dk(  r*| j                  | j                  ||             d{   }nG|dk(  r*| j                  | j                  ||             d{   }nt        | j                  d	z         | j                  ||      S 7 L7 7 7 e7 8w)
a  
        cancel all open orders

        https://api.hitbtc.com/#cancel-all-spot-orders
        https://api.hitbtc.com/#cancel-futures-orders
        https://api.hitbtc.com/#cancel-all-margin-orders

        :param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported
        :param bool [params.margin]: True for canceling margin orders
        :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
        Nr  r  rA   r   r<   r;   r=   z/ cancelAllOrders() not support self market type)r:  r  r  r  r<  privateDeleteMarginOrderr>  privateDeleteSpotOrderprivateDeleteFuturesOrderr-   r  r  r  r  r  r  r?  r   r   r  s           r  cancel_all_orderszhitbtc.cancel_all_orderst  s|     !!![[(F &tGH

!??@QSY[ab
F!??@QSYZ
F6L(#;<!!::4;;wPV;WXXHV#!%!<!<T[[RX=Y!ZZv%!%!?!?GU[@\!]]x'!%!>!>t{{7TZ?[!\\"477-^#^__  622/ 	" Y []\sX   E-E"BE-%E%&.E-E'.E-E).E-2E+30E-%E-'E-)E-+E-c                   K   | j                          d{    d}d|i}|| j                  |      }d}d}| j                  d||      \  }}| j                  d|      \  }}| j	                  |ddg      }d}|*| j                  | j                  ||             d{   }n|dk(  r*| j                  | j                  ||             d{   }nv|dk(  r*| j                  | j                  ||             d{   }nG|dk(  r*| j                  | j                  ||             d{   }nt        | j                  dz         | j                  ||      S 7 F7 7 7 e7 8w)	a  
        cancels an open order

        https://api.hitbtc.com/#cancel-spot-order
        https://api.hitbtc.com/#cancel-futures-order
        https://api.hitbtc.com/#cancel-margin-order

        :param str id: order id
        :param str symbol: unified symbol of the market the order was made in
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported
        :param bool [params.margin]: True for canceling a margin order
        :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        Nr  rB   r   r<   r;   r=   z+ cancelOrder() not support self market type)r:  r  r  r  r<  %privateDeleteMarginOrderClientOrderIdr>  #privateDeleteSpotOrderClientOrderId&privateDeleteFuturesOrderClientOrderIdr-   r  r  r!  s	            r  cancel_orderzhitbtc.cancel_order  sw     !!!r
 [[(F

!??vW]^
F!??vV
F6L(#;<!!GGT[]cHdeeHV#!%!I!I$++V]_eJf!ggv%!%!L!LT[[Y`bhMi!jjx'!%!K!KDKKX_agLh!ii"477-Z#Z[[&111 	" f hjir#  r  r  r  r  c                 f  K   | j                          d {    d }|| j                  ||      d}	|dk(  s|dk(  r/|t        | j                  dz         | j	                  ||      |	d<   || j                  |      }d }
d }| j                  d||      \  }
}| j                  d|      \  }}| j                  |ddg      }d }|*| j                  | j                  |	|             d {   }n|
d	k(  r*| j                  | j                  |	|             d {   }nv|
d
k(  r*| j                  | j                  |	|             d {   }nG|
dk(  r*| j                  | j                  |	|             d {   }nt        | j                  dz         | j                  ||      S 7 7 7 7 e7 8w)N)r  r  r   	stopLimitz' editOrder() limit order requires pricer  rK   r   r<   r;   r=   z) editOrder() not support self market type)r:  amount_to_precisionr#   r  price_to_precisionr  r  r  r<  $privatePatchMarginOrderClientOrderIdr>  "privatePatchSpotOrderClientOrderId%privatePatchFuturesOrderClientOrderIdr-   r  )r  r  r  r  r  r  r  r  r  r?  r   r   r  s                r  
edit_orderzhitbtc.edit_order  s    !!!!00@
 GO!4}#DGG.W$WXX#66vuEGG[[(F

!??VU[\
F!??VT
F6L(#;<!!FFt{{SZ\bGcddHV#!%!H!HU\^dIe!ffv%!%!K!KDKKX_agLh!iix'!%!J!J4;;W^`fKg!hh"477-X#XYY&11; 	"& e gihsX   F1F&CF1)F)*.F1F+.F1F-.F16F/70F1)F1+F1-F1/F1c           
      >  K   | j                          d{    | j                  |      }d}d}	| j                  d||      \  }	}d}
| j                  d|      \  }
}| j	                  ||	|||||
|      \  }}d}|	dk(  r*| j                  | j                  ||             d{   }nZ|	dk(  s|
*| j                  | j                  ||             d{   }n)| j                  | j                  ||             d{   }| j                  ||      S 7 7 s7 D7 w)a   
        create a trade order

        https://api.hitbtc.com/#create-new-spot-order
        https://api.hitbtc.com/#create-margin-order
        https://api.hitbtc.com/#create-futures-order

        :param str symbol: unified symbol of the market to create an order in
        :param str type: 'market' or 'limit'
        :param str side: 'buy' or 'sell'
        :param float amount: how much of currency you want to trade in units of base currency
        :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported for spot-margin, swap supports both, default is 'cross'
        :param bool [params.margin]: True for creating a margin order
        :param float [params.triggerPrice]: The price at which a trigger order is triggered at
        :param bool [params.postOnly]: if True, the order will only be posted to the order book and not executed immediately
        :param str [params.timeInForce]: "GTC", "IOC", "FOK", "Day", "GTD"
        :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        NrE   r=   r<   )
r:  r  r  r  create_order_requestprivatePostFuturesOrderr>  privatePostMarginOrderprivatePostSpotOrderr  )r  r  r  r  r  r  r  r  r?  r   r   r  s               r  create_orderzhitbtc.create_order  s)    * !!!V$
!??vW]^
F
!??vV
F33FJdTZ\acmouv!99$++gv:VWWHH$**@!88Wf9UVVH!66t{{7F7STTH&11 	" XVTsF   DDBD#D$0DD)D>D?DDDDr   r   c	                 R   |dk(  }	| j                  |d      }
| j                  |d      }| j                  |g d      }| j                  |dk(  d |      }||| j	                  |d   |      |d   d}|
1|d	   d
k7  r)|d	   dk7  r!t        | j                  dz   |d	   z   dz         |
du r|
|d<   |rd|d<   |||d<   |	s
|dk(  s|dk(  r2|t        | j                  dz         | j                  |d   |      |d<   |dk(  r,| j                  |d      }|t        | j                  dz         |+| j                  |d   |      |d<   |	rd|d	<   n7|dk(  r2d|d	<   n,|dk(  s|dk(  s
|dk(  s|dk(  rt        | j                  dz         | j                  |g d      }|d
k(  r	|d}||d<   ||gS ) Nr   
reduceOnlyr   )r   	stopPrice
stop_pricer  r  r  )r  r  r  r  r  r=   r<   z0 createOrder() does not support reduce_only for zJ orders, reduce_only orders are supported for swap and margin markets onlyTreduce_only	post_onlytime_in_forcer0  takeProfitLimitz9 createOrder() requires a price argument for limit ordersr  r   expire_timez@ createOrder() requires an expire_time parameter for a GTD orderr@  
stopMarkettakeProfitMarketzU createOrder() requires a triggerPrice parameter for stop-loss and take-profit orders)r   r   r?  r@  r>  postOnlycrossmargin_mode)
r  r  safe_number_nis_post_onlyr1  r+   r  r#   r2  r<  )r  r  r   r  r  r  r  r   r  isLimitr>  r   r   
isPostOnlyr?  
expireTimes                   r  r8  zhitbtc.create_order_request
	  s:   7?__V\:
&&v}=))&2]^&&tx'7vF
001A6JTl	
" !v&(vf~/I"477-_#_bhiobp#p  t@  $@  A  A%/GM"#'GK "'2GO$t{*8I0I}#DGG.i$ijj#66vh7GOGG5 ))&-@J!#DGG.p$pqq#$($;$;F8<Ll$[GL!"-!".k!t|';IZAZ`dhz`z  +B  !B  C  C6#wx!$
%/GM"  r  c                 :    ddddddd}| j                  |||      S )Nrm  r	  r
  r  )new	suspendedpartiallyFilledfilledr
  expiredr  r  s      r  parse_order_statuszhitbtc.parse_order_statusB	  s2    %"
 &&99r  r  c                    | j                  |d      }| j                  |d      }| j                  |d      }| j                  |d      }| j                  |d      }| j                  |d      }| j                  |d      }	| j                  |	      }
| j                  |d      }d }||	k7  r| j                  |      }| j                  |d	      }| j                  | j                  |d
            }| j                  |d      }| j                  ||      }|d   }| j	                  |d      }| j                  |d      }| j	                  |d      }| j                  i d|d|d|d|
d| j                  |
      d|d|d|d|d|d|d|d|d|d| j	                  |d      d|dd d |||d | j                  |d      d d d|      S )Nr  r  r  r  r  price_averager  r  quantity_cumulativer  r  rB  rC  r  r  r  r  rj  ro  lastTradeTimestamplastUpdateTimestampr  r   rH  r>  rA  rT  	remainingr@  )r  r  rz  r  r!  r   r   r   )r  r}  rV  rb  r  
safe_orderr  )r  r  r  r  r  r  r  r  rz  r  rj  r  rZ  rT  r  rf  r  rH  r   r  s                       r  r  zhitbtc.parse_orderM	  sx   D e%67 v.v.!!%4  0""5/:""5,7NN7+	""5,7!g!%!8!!%)>?(()9)9%)JK##E84!!(F3!??5+6&&uo>OOE84	  
E 
" 
 R 
 	 

 Y/ 
 !"4 
 "#5 
 f 
 U 
 f 
 D 
 D 
 ; 
  
 $//%? 
  f! 
" # 
$  ,,ULA#!3 
4 5 	r  c                   K   | j                          d{    d}|%| j                  |      }| j                  |d         }d}| j                  d||      \  }}d}|dk(  r| j	                  |       d{   }n7|dk(  r| j                  |       d{   }nt        | j                  dz         | j                  |dg       }| j                  ||d      S 7 7 d7 Gw)	a  
        fetches margin mode of the user

        https://api.hitbtc.com/#get-margin-position-parameters
        https://api.hitbtc.com/#get-futures-position-parameters

        :param str[] symbols: unified market symbols
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a list of `margin mode structures <https://docs.ccxt.com/#/?id=margin-mode-structure>`
        Nr   rg   r<   r=   z; fetchMarginModes() supports swap contracts and margin onlyconfigr  )
r:  r_  r  r  privateGetMarginConfigprivateGetFuturesConfigr)   r  r(  parse_margin_modes)r  r\  r  r  r   r  r_  s          r  fetch_margin_modeszhitbtc.fetch_margin_modes	  s      !!!))'2G[[,F
!??@QSY[ab
F!!88@@H$ 6!!99&AAH& DGG&ccdd(B7&&vwAAc 	" A& Bs5   C CA C 7C8C CAC C C c                 r    | j                  |d      }|| j                  ||      | j                  |d      dS )Nr  rJ  )r  r  r   )r  r~  rQ  )r  r   r  rf  s       r  parse_margin_modezhitbtc.parse_margin_mode 
  sA    ##J9&&x800]K
 	
r  fromAccount	toAccountc                   K   | j                          d{    | j                  |      }| j                  ||      }| j                  | j                  di       }|j                         }|j                         }| j                  |||      }	| j                  |||      }
|	|
k(  rt        | j                  dz         |d   ||	|
d}| j                  | j                  ||             d{   }| j                  ||      S 7 7 w)a  
        transfer currency internally between wallets on the same account

        https://api.hitbtc.com/#transfer-between-wallet-and-exchange

        :param str code: unified currency code
        :param float amount: amount to transfer
        :param str fromAccount: account to transfer from
        :param str toAccount: account to transfer to
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `transfer structure <https://docs.ccxt.com/#/?id=transfer-structure>`
        Nr  zJ transfer() fromAccount and toAccount arguments cannot be the same accountr  )r6  r  sourcedestination)r:  r6  currency_to_precisionr  r  lowerr  r(   r  privatePostWalletTransferr>  parse_transfer)r  r&  r  rf  rg  r  r6  requestAmountr  fromIdtoIdr?  r  s                r  r   zhitbtc.transfer
  s     !!!==&224@7GL!'')OO%	!!.+{K	9ET>TWW'sstt #	
 77GV8TUU ""8X66- 	"  Vs"   DDCD,D-DDr   c           
      Z    | j                  |d      d d | j                  d |      d d d d |d	S )Nr   )	r  rj  ro  r6  r  rf  rg  r  r  )r  r	  )r  r   r6  s      r  rn  zhitbtc.parse_transfer.
  sC     ""8Q///h?

 
	
r  c                   K   | j                          d {    |dk7  rt        | j                  dz         | j                  | j                  di       }|j                         }|j                         }| j                  ||      }| j                  ||      }||k(  rt        | j                  dz         ||Ct        |j                               }t        | j                  dz   dj                  |      z         ||| j                  ||      d}| j                  | j                  ||             d {   }	d|	iS 7 *7 w)	Nr,  z6 convertCurrencyNetwork() only supports USDT currentlyr  z8 convertCurrencyNetwork() fromNetwork cannot be the samezm convertCurrencyNetwork() requires a fromNetwork parameter and a toNetwork parameter, supported networks are rP  )from_currencyto_currencyr  r  )r:  r#   r  r  r  r*  r  r(   r  r   r'   rU  rk  privatePostWalletConvertr>  )
r  r&  r  fromNetwork	toNetworkr  r  r   r?  r  s
             r  convert_currency_networkzhitbtc.convert_currency_networkB
  sd    !!!6>*b bcc??4<<R@!'')OO%	&&x=$$Xy9	)#TWW'aabbY%6(D#DGG  /^  %^  ae  aj  aj  ko  ap  %p  q  q($00v>

 66t{{7F7STT H
 	
) 	"$ Us"   EE D E7E8	EEr7  c                 x  K   | j                  ||      \  }}| j                          d{    | j                  |       | j                  |      }|d   ||d}|||d<   | j	                  | j
                  di       }| j                  |d      }	|	0|dk(  r+| j                  ||	      }
|
|
|d<   | j                  |d      }| j	                  | j
                  d	i       }| j                  |d
d      }|rd|d<   | j                  | j                  ||             d{   }| j                  ||      S 7 
7 w)a  
        make a withdrawal

        https://api.hitbtc.com/#withdraw-crypto

        :param str code: unified currency code
        :param float amount: the amount to withdraw
        :param str address: the address to withdraw to
        :param str tag:
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
        Nr  )r6  r  r7  r8  r  r  r,  network_coder   r  FTinclude_fee)handle_withdraw_tag_and_paramsr:  check_addressr6  r  r  r;  r  r<  r  privatePostWalletCryptoWithdrawr>  r  )r  r&  r  r7  r9  r  r6  r?  r  r  r@  withdrawOptionsr  r  s                 r  r   zhitbtc.withdraw[
  sL     99#vFV!!!7#==& 

 ?$'GL!??4<<R@((;dfn ,,Xw?M(*7'YYvy1F//$,,
BG^^O\5I
%)GM"==dkk'SY>Z[[ %%h997 	"* \s"   )D:D5C2D:D8D:8D:c                   K   | j                          d{    d}i }|J| j                  |      }| j                  |d         }| j                  |      }dj	                  |      |d<   d}| j                  d||      \  }}|dk7  rt        | j                  dz   |z   dz         | j                  | j                  ||             d{   }t        |j                               }i }	t        dt        |            D ]S  }
| j                  ||
      }| j                  ||      }| j                  |      }|d	   }| j!                  ||      }||	|<   U | j#                  |	d	|      S 7 R7 w)
a  
        fetches funding rates for multiple markets

        https://api.hitbtc.com/#futures-info

        :param str[] symbols: unified symbols of the markets to fetch the funding rates for, all market funding rates are returned if not assigned
        :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-structure>`
        Nr   r^  r\  r_   r=   z& fetchFundingRates() does not support z marketsr  )r:  r_  r  r`  rU  r  r-   r  publicGetPublicFuturesInfor>  r  r   r  r  r  r  parse_funding_rater  )r  r\  r  r  r?  queryMarketIdsr  r  rd  fundingRatesr  rf  rawFundingRater  r  fundingRates                   r  fetch_funding_rateszhitbtc.fetch_funding_rates
  s}     !!!))'2G[[,F!__W5N!$.!9GI99:MvW]^f6>tww)QQTXX[eeff88Wf9UVV$ )	q#i.) 	/A''	15H!__Xx@N++h/K *F11.+NK#.L 	/ ##L(GDDO 	" Ws#   E-E(B3E-
E+BE-+E-c           
        K   | j                          d{    d}| j                  |dd      \  }}|r| j                  d|||d|d       d{   S d}i }| j                  d||      \  }}|| j	                  |      }|d   }|d	   |d
<   |||d<   |||d<   | j                  | j                  ||             d{   }t        |j                               }	g }
t        dt        |	            D ]  }|	|   }| j                  |      }||   }t        dt        |            D ]e  }||   }| j                  |d         }| j                  |d      }| j                  |d      }|
j                  |||| j!                  |      |d       g  | j#                  |
d      }| j%                  ||||      S 7 7 l7 w)a  

        https://api.hitbtc.com/#funding-history

        fetches historical funding rate prices
        :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 <https://docs.ccxt.com/#/?id=funding-rate-history-structure>` to fetch
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: timestamp in ms of the latest funding rate
        :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>`
        NFr^   r  8hr   r  r  r  r\  r  r   r   funding_raterj  )r  r  r  rj  ro  )r:  r  r  r  r  $publicGetPublicFuturesHistoryFundingr>  r  r   r  r  rb  r~  r  r  r
  r}  sort_byfilter_by_symbol_since_limit)r  r  r  r   r  r  r  r?  r  	contractsratesr  rf  r  fundingRateDatar0  r.  symbolInnerr  ro  sorteds                        r  fetch_funding_rate_historyz!hitbtc.fetch_funding_rate_history
  s     !!!88AZ\fg&@@AZ\bdikprvx~  AE  F  F  F
 227GVL[[(FH%F!'GI#GFO$GGBB4;;wX^C_``  )	q#i.) 	A |H**84K&x0O1c/23 '*"..{8/DE"..unE++E;?!)#.!%!9 ( 		  e[100NNw 	" F( as5   G F88G F;A0G  F>C8G ;G >G c                   K   | j                          d{    i }d}d}| j                  dd|      \  }}|dk(  rd}| j                  d|      \  }}| j                  |ddg      }d}|*| j	                  | j                  ||             d{   }nv|dk(  r*| j                  | j                  ||             d{   }nG|dk(  r*| j	                  | j                  ||             d{   }nt        | j                  dz         g }t        dt        |            D ]%  }|j                  | j                  ||                ' |S 7 67 7 7 ew)	a~  
        fetch all open positions

        https://api.hitbtc.com/#get-futures-margin-accounts
        https://api.hitbtc.com/#get-all-margin-accounts

        :param str[]|None symbols: not used by hitbtc fetchPositions()
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported, defaults to spot-margin endpoint if self is set
        :param bool [params.margin]: True for fetching spot-margin positions
        :returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
        Nr}   r;   r=   r   r<   z. fetchPositions() not support self market typer   )r:  r  r  r<  privateGetMarginAccountr>  privateGetFuturesAccountr-   r  r  r  r
  parse_position)	r  r\  r  r?  r   r   r  r  r  s	            r  fetch_positionszhitbtc.fetch_positions  sf     !!!

!??@PRVX^_
FJ!??@PRXY
F6L(#;<!!99$++gv:VWWHV#!%!>!>t{{7TZ?[!\\x'!%!=!=dkk'SY>Z![["477-]#]^^B q#h-( 	<AMM$--hqk:;	<m 	" X ][sG   EEA8EE.E>E?.E-E.AEEEEc                 n  K   | j                          d{    | j                  |      }d|d   i}d}d}| j                  dd|      \  }}| j                  d|      \  }}| j	                  |ddg      }d}|*| j                  | j                  ||             d{   }nv|dk(  r*| j                  | j                  ||             d{   }nG|dk(  r*| j                  | j                  ||             d{   }nt        | j                  dz         | j                  ||      S 7 7 7 c7 6w)	a  
        fetch data on a single open contract trade position

        https://api.hitbtc.com/#get-futures-margin-account
        https://api.hitbtc.com/#get-isolated-margin-account

        :param str symbol: unified market symbol of the market the position is held in, default is None
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported, defaults to spot-margin endpoint if self is set
        :param bool [params.margin]: True for fetching a spot-margin position
        :returns dict: a `position structure <https://docs.ccxt.com/#/?id=position-structure>`
        Nr  r  r|   r   r<   r=   z- fetchPosition() not support self market type)r:  r  r  r  r<  %privateGetMarginAccountIsolatedSymbolr>  &privateGetFuturesAccountIsolatedSymbolr-   r  r  r(  s           r  fetch_positionzhitbtc.fetch_positionI  sJ     !!!V$fTl
 

!??QUW]^
F!??QWX
F6L(#;<!!GGT[]cHdeeHV#!%!L!LT[[Y`bhMi!jjx'!%!K!KDKKX_agLh!ii"477-\#\]]B ""8V44i 	" f kisF   D5D,BD5D/.D5D1.D5<D3=0D5/D51D53D5positionc                    | j                  |d      }| j                  |d      }| j                  |d      }| j                  |dg       }d }d }d }	t        dt	        |            D ]=  }
||
   }| j                  |d      }| j                  |d      }| j                  |d      }	? | j                  |d	g       }d }t        dt	        |            D ]  }
||
   }| j                  |d
      } | j                  |d      }| j                  ||      }|d   }| j                  i d|dd d|dd d|d|d|d|dd dd d|	dd dd dd dd dd d| j                  |      |d d d |d d |d d d d      S )Nr  r   r  	positionsr   price_liquidationprice_entryr  r,  margin_balancer  r  r  notionalr   
marginTypeliquidationPrice
entryPriceunrealizedPnlr   r  r  	markPrice	lastPricer  r   rj  )ro  r[  maintenanceMarginmaintenanceMarginPercentage
collateralinitialMargininitialMarginPercentager   marginRatior   r   )r  r  r  r  r  rb  safe_positionr}  )r  r  r  r   r   ro  r  r  r  r  r  r.  r,  r  rf  r  s                   r  r  zhitbtc.parse_position  sK   B %%h7
##Hj9##Hl;OOHk2>	
	q#i.) 	<AaLE#//7JK))%?J((
;I		<
 __X|R@

q#j/* 	CAqME))%1ABJ	C ##Hh7!!(F3!!! #
H#
$#
 f#
 	#

 *#
 *#
  0#
 *#
 T#
 $#
 #
 D#
 #
 #
 D#
  d!#
" 1##
$ !#'!%+/$!'+ !#9#
  	r  c           	          | j                  |d      }| j                  |d      }| j                  | j                  d |      d || j	                  |      ||d|      S )Nrj  open_interest)r  openInterestAmountopenInterestValuerj  ro  r  )r  r  safe_open_interestr~  r}  )r  interestr  ro  values        r  parse_open_interestzhitbtc.parse_open_interest  sm      ##Hk:  ?;&&&&tV4"&!&1 (
  	r  c                   K   | j                          d{    i }| j                  |      }d}|%| j                  |      }dj                  |      |d<   | j	                  | j                  ||             d{   }g }t        |j                               }t        dt        |            D ]<  }||   }	| j                  |	      }
|j                  | j                  ||	   |
             > | j                  |d|      S 7 7 w)ag  
        Retrieves the open interest for a list of symbols

        https://api.hitbtc.com/#futures-info

        :param str[] [symbols]: a list of unified CCXT market symbols
        :param dict [params]: exchange specific parameters
        :returns dict[]: a list of `open interest structures <https://docs.ccxt.com/#/?id=open-interest-structure>`
        Nr^  r\  r   r  )r:  r_  r`  rU  r  r>  r  r   r  r  rb  r
  r  r  )r  r\  r  r?  rd  r  resultsmarketsr  rf  r  s              r  fetch_open_interestszhitbtc.fetch_open_interests  s     !!!%%g.	0I!$)!4GI88Wf9UVV$ x}}'q#g,' 	VAqzH**84KNN433HX4FTU	V ##GXw??? 	" Ws#   DDA$D;D<BDDc                 "  K   | j                          d{    | j                  |      }|d   st        | j                  dz         d|d   i}| j	                  | j                  ||             d{   }| j                  ||      S 7 t7 w)aZ  
        Retrieves the open interest of a derivative trading pair

        https://api.hitbtc.com/#futures-info

        :param str symbol: Unified CCXT market symbol
        :param dict [params]: exchange specific parameters
        :returns dict} an open interest structure{@link https://docs.ccxt.com/#/?id=interest-history-structure:
        Nr=   z1 fetchOpenInterest() supports swap contracts onlyr  r  )r:  r  r)   r   publicGetPublicFuturesInfoSymbolr>  r  rZ  s         r  fetch_open_interestzhitbtc.fetch_open_interest&  s      !!!V$f~DGG&YYZZfTl
 >>t{{7TZ?[\\  ''&99/ 	" ]"   BBAB4B5BBc                 "  K   | j                          d{    | j                  |      }|d   st        | j                  dz         d|d   i}| j	                  | j                  ||             d{   }| j                  ||      S 7 t7 w)aL  
        fetch the current funding rate

        https://api.hitbtc.com/#futures-info

        :param str symbol: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
        Nr=   z0 fetchFundingRate() supports swap contracts onlyr  r  )r:  r  r)   r  r  r>  r  rZ  s         r  fetch_funding_ratezhitbtc.fetch_funding_rateI  s      !!!V$f~DGG&XXYYfTl
 >>t{{7TZ?[\\  &&x88/ 	" ]r  c                    | j                  |d      }| j                  |d      }i d|d| j                  d |      d| j                  |d      d| j                  |d      d	| j                  |d
      dd d| j                  |      d|d| j                  |d      d| j                  |      d|d| j                  |d      dd dd dd dd dd dd iS )Nnext_funding_timerj  r  r  r  
mark_price
indexPriceindex_priceinterestRateinterest_rateestimatedSettlePricero  r  r  fundingTimestampfundingDatetimenextFundingRateindicative_funding_ratenextFundingTimestampnextFundingDatetimepreviousFundingRatepreviousFundingTimestamppreviousFundingDatetimeinterval)r  r~  r  r}  )r  r  r  fundingDateTimero  s        r  r  zhitbtc.parse_funding_ratel  sh     **85HI##Hk:
H
d&&tV4
 ))(LA
 $**8]C	

 D,,XG
 #D
 1
 
 4++HnE
  ?
 
 t//:ST
 #D
 "4
 "4
  '!
" &t#
$ %
 	
r  c                 
  K   | j                          d {    | j                  |      }| j                  |d      }|d   r|t        | j                  dz         | j                  |      }|dk7  r| j                  ||      }nd}|d   |d}|||d<   d }	d }
| j                  d||      \  }	}| j                  d|      \  }
}d }|	dk(  r*| j                  | j                  ||             d {   }nQ|	dk(  s
|	d	k(  s|
d
k(  r*| j                  | j                  ||             d {   }nt        | j                  dz         | j                  | j                  ||      | j                  |      |d      S 7 f7 7 Vw)Nr   r=   zD modifyMarginHelper() requires a leverage parameter for swap marketsr   r  )r  r  modifyMarginHelperr<   r;   isolatedz2 modifyMarginHelper() not support self market type)r  r  )r:  r  r  r'   r  number_to_stringr1  r  r  &privatePutFuturesAccountIsolatedSymbolr>  %privatePutMarginAccountIsolatedSymbolr-   parse_margin_modificationr  )r  r  r  r  r  r  r   stringAmountr?  r   r   r  s               r  modify_margin_helperzhitbtc.modify_margin_helper  s    !!!V$##FJ7&>'2x(xyy,,V43--flCFFTl$
 "*GJ

!??@TV\^de
F!??@TV\]
F!HHU\^dIeffHH$**>JR\D\!GGT[]cHdeeHtww)]]^^& {{499(FK''/N
  	a 	"2 ges5   FE<CF1E?28F*F+AF?FFdatac                     | j                  |dg       }| j                  |d      }| j                  |d      }||d   d dd d | j                  |d      d | j                  |      |d
S )Nr,  r   r  r  r  r&  )
r  r  r  r   r  totalr&  r  rj  ro  )r  r  r}  )r  r  r  r,  currencyInforo  s         r  r  z hitbtc.parse_margin_modification  s{    * __T<<
z15##D,7X&$$$\6:1 
 	
r  c                    K   | j                  |      dk7  rt        | j                  dz         | j                  ||d|       d{   S 7 w)a  
        remove margin from a position

        https://api.hitbtc.com/#create-update-margin-account-2
        https://api.hitbtc.com/#create-update-margin-account

        :param str symbol: unified market symbol
        :param float amount: the amount of margin to remove
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported, defaults to the spot-margin endpoint if self is set
        :param bool [params.margin]: True for reducing spot-margin
        :returns dict: a `margin structure <https://docs.ccxt.com/#/?id=reduce-margin-structure>`
        r   zc reduceMargin() on hitbtc requires the amount to be 0 and that will remove the entire margin amountreduceN)r  r(   r  r  r  r  r  r  s       r  reduce_marginzhitbtc.reduce_margin  sY        (C/TWW  (M  M  N  N..vvxPPPPs   AAAAc                 F   K   | j                  ||d|       d{   S 7 w)a  
        add margin

        https://api.hitbtc.com/#create-update-margin-account-2
        https://api.hitbtc.com/#create-update-margin-account

        :param str symbol: unified market symbol
        :param float amount: amount of margin to add
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported, defaults to the spot-margin endpoint if self is set
        :param bool [params.margin]: True for adding spot-margin
        :returns dict: a `margin structure <https://docs.ccxt.com/#/?id=add-margin-structure>`
        addN)r  r  s       r  
add_marginzhitbtc.add_margin   s%      ..vvufMMMMs   !!c                   K   | j                          d{    | j                  |      }d|d   i}d}| j                  d|      \  }}| j                  |ddg      }d}|*| j	                  | j                  ||             d{   }n|d   dk(  r*| j	                  | j                  ||             d{   }n||d   d	k(  r*| j                  | j                  ||             d{   }nJ|d   dk(  r*| j	                  | j                  ||             d{   }nt        | j                  d
z         | j                  ||      S 7 67 7 7 h7 8w)ao  
        fetch the set leverage for a market

        https://api.hitbtc.com/#get-futures-margin-account
        https://api.hitbtc.com/#get-isolated-margin-account

        :param str symbol: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.marginMode]: 'cross' or 'isolated' only 'isolated' is supported, defaults to the spot-margin endpoint if self is set
        :param bool [params.margin]: True for fetching spot-margin leverage
        :returns dict: a `leverage structure <https://docs.ccxt.com/#/?id=leverage-structure>`
        Nr  r  rd   r   r<   r  r;   r=   z- fetchLeverage() not support self market type)
r:  r  r  r<  r  r>  r  r-   r  parse_leverage)r  r  r  r  r?  r   r  s          r  fetch_leveragezhitbtc.fetch_leverage  sa     !!!V$fTl
 
!??QWX
F6L(#;<!!GGT[]cHdeeHf~'!%!K!KDKKX_agLh!ii6)!%!L!LT[[Y`bhMi!jj8+!%!K!KDKKX_agLh!ii"477-\#\]]> ""8V44e 	" f jjisX   EEA/EE1E8E91E*E+1EE0EEEEEr   c                     | j                  |d      }| j                  |d      }|| j                  ||      | j                  |d      ||dS )Nr  r   r  )r  r  r   longLeverageshortLeverage)r  r  r~  rQ  )r  r   r  rf  leverageValues        r  r  zhitbtc.parse_leverageQ  sY    ##Hh7))(J?&&x8006B)*
 	
r  c                 f  K   |t        | j                  dz         | j                          d{    |d   t        | j                  dz         | j                  |      }| j	                  |d      }| j                  |d   d   dd      }|d	   d
k7  rt        | j                  dz         |dk  s||kD  r*t        | j                  dz   t        |      z   dz   |z         |d   t        |      | j                  ||      d}| j                  | j                  ||             d{   S 7 7 w)ae  
        set the level of leverage for a market

        https://api.hitbtc.com/#create-update-margin-account-2

        :param float leverage: the rate of leverage
        :param str symbol: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: response from the exchange
        Nz) setLeverage() requires a symbol argumentr  zj setLeverage() requires a margin_balance parameter that will transfer margin to the specified trading pairr  r   r  2   r  r=   z+ setLeverage() supports swap contracts onlyr   z0 setLeverage() leverage should be between 1 and z for r  )r  r   r  )r'   r  r:  r  r  r  r)   r(   strr1  r  r>  )r  r   r  r  r  r  maxLeverager?  s           r  set_leveragezhitbtc.set_leverage\  sU     >#DGG.Y$YZZ!!!"#+#DGG  /[  %[  \  \V$!!&*:;''x(8(DeRP&>V#DGG&SSTTqLh4TWW'YY\_`k\llovvy  A  ATlH"66vvF
 @@WV\A]^^^! 	"  _s"   .D1D-C7D1(D/)D1/D1codesc                    K   | j                          d{    | j                  |       d{   }| j                  ||      S 7 /7 w)aT  
        fetch deposit and withdraw fees

        https://api.hitbtc.com/#currencies

        :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 `fees structures <https://docs.ccxt.com/#/?id=fee-structure>`
        N)r:  r'  parse_deposit_withdraw_fees)r  r  r  r  s       r  fetch_deposit_withdraw_feesz"hitbtc.fetch_deposit_withdraw_fees{  sK      !!!55f==4 //%@@7 	"=s   A
AA
AA
A
c                    | j                  |dg       }| j                  |      }t        dt        |            D ]  }||   }| j	                  |d      }| j                  |      }||j                         nd }| j                  |d      }	| j                  |d      }
|	|	dnd d}|
du r||d	<   |d d dd
|d   |<    |S )Nr  r   r  r  r   F)r!  r   Tr   )r   r"  )r  deposit_withdraw_feer  r  r  r)  r*  r  )r  r!  r6  r  r  r0  networkEntryr2  r3  withdrawFee	isDefaultwithdrawResults               r  parse_deposit_withdraw_feez!hitbtc.parse_deposit_withdraw_fee  s    0 ??3
B7**3/q#h-( 	A#A;L((yAI11)<K2=2I+++-PTK**<FKi@I"(3(?ed$N D %3z"*"&/F:{+	( r  c                   K   | j                          d{    d}| j                  d|d      \  }}| j                  |      }|d   |d}| j                  | j	                  ||             d{   }| j                  ||      S 7 p7 w)a  
        closes open positions for a market

        https://api.hitbtc.com/#close-all-futures-margin-positions

        :param str symbol: unified ccxt market symbol
        :param str side: 'buy' or 'sell'
        :param dict [params]: extra parameters specific to the okx api endpoint
        :param str [params.symbol]: *required* unified market symbol
        :param str [params.marginMode]: 'cross' or 'isolated', default is 'cross'
        :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        NrC   rI  r  )r  rJ  )r:  r  r  ,privateDeleteFuturesPositionMarginModeSymbolr>  r  )r  r  r  r  r   r  r?  r  s           r  close_positionzhitbtc.close_position  s      !!!
!??QWY`a
FV$Tl%
 JJ4;;W^`fKghh  &111 	" is"   BBAB0B	1B	Bc                     | j                  | j                  d      }| j                  |dd      }d}t        t        |   |||      \  }}||dk(  s|du rd}||gS )aR  
 @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
        defaultTyper<   FNTr  )r  r  r  r  r4   r  )r  
methodNamer  defaultValuer  isMarginr   r  s          r  r  z$hitbtc.handle_margin_mode_and_params  ss     &&t||]C>>&(E:
"64Nz[acop
Fx'X-='
F##r  reasonurlmethodheadersbodyc
                 0   | j                  |d      }
| j                  |
d      }|p| j                  dz   |z   }| j                  |
dd      }| j	                  | j
                  d   ||       | j                  | j
                  d   ||       t        |      y )Nerrorr&   messagedescriptionr'  r(  )r  r  r  r  throw_exactly_matched_exceptionr  throw_broadly_matched_exceptionr#   )r  r&  r
  r  r  r  r  r  requestHeadersrequestBodyr  	errorCodefeedbackr  s                 r  handle_errorszhitbtc.handle_errors	  s    " '2$$UF3	 ww}t+H((	=IG001I9V^_001I7T\]))r  r   r  c                 V   | j                  || j                  |            }| j                  ||      }| j                  d   |   dz   |z   }	d }
t	        |j                               }t        |      }ddi}|dk(  r|r+d| j                  |      z   }
|	|
z   }	n| j                  |      }|dk(  r| j                          t        | j                               }|d|z   g}|dk(  r|
#|j                  |
       n|j                  |       |j                  |       d	j                  |      }| j                  | j                  |      | j                  | j                         t"        j$                  d
      }| j&                  dz   |z   dz   |z   }| j)                  |      }d|z   |d<   |	|||dS )Nr   r  zContent-Typezapplication/jsonr  ?r   z/api/3/ hexr  zHS256 Authorization)r  r  r  r  )r<  extract_paramsimplode_paramsr  r  r   r  	urlencodejsoncheck_required_credentialsr  r  r
  rU  hmacencodesecrethashlibsha256apiKeystring_to_base64)r  pathr   r  r  r  r  r  implodedPathr  
getRequestr   queryLengthrj  payloadpayloadString	signaturesecondPayloadencodeds                      r  signzhitbtc.sign$  s   		&$"5"5d";<**48iis#c)L8
EJJL!$i.
 U? 4>>%#88
J&99V$D)++-DJJL)Iy<78G)NN:.t$NN9%GGG,M		$++m"<dkk$++>VX_XfXfhmnI KK#-	9C?)KM++M:G'/''9GO$fdwOOr  r  )m__name__
__module____qualname__r   r  r  r"   r   r  r   r4  r  r	   rA  rF  r   rN  rV  r   r[  r   r   rg  dictrY  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  r  r  r  r"  r)  r.  r   r   r   r6  floatr<  objectr8  rV  r  r   rc  r   re  r!   r   rn  ry  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  intr  r5  __classcell__)r  s   @r  r4   r4      s   j# jX# *, IV IV -/ d: dL >@ !
 !
N !
F =? %
 %
> %
N
) 
) *, $, $,L 68 3 3F 3> 6:" )G7 )G )GV)4 ) )6 )V <@d[] $ $S $ $bfglbm $L 37TX\eg +AC +As +ARU +AZc cv c cJ&QP:s :3R
T R
X R
Q\ R
h <@daenp dS d d[^ duy  {F  vG d 04$UYbd [ [C [s [imnyiz [ 37TX\eg \C \s \RU \lpq|l} \ :>DY[ w c `j : @DB PS P PS\ P,
T 
6 
EX 
* ;= 8c 8AT 8> /1 ![ !F 8<$]ajl GL GLC GLWZ GLquvzq{ GLR
 
4 
B 7;\`ik ,U ,U3 ,UVY ,Uptuzp{ ,U\ 8<B ;/C ;/ ;/z ?CQUdhqs OA3 OA OA3 OA^a OAb 59tZ^gi :Ac :A :ATW :Anrsxny :Ax =A '2 '2c '2R 59 %3c %3N 9=R '2S '2# '2R fjx|  FH 23 2 29 2I 2_b 2ru 2@ mqy{ $2 $2I $2Y $2X] $2fi $2L CG  [_  hj 6!6 6!s 6!) 6![d 6!ns 6!| 6!  UX 6!p	: 	:s sv s sj =A <BS	 <BP[ <B|
D 
* 
 ac $73 $7 $7C $7TW $7gt $7L
t 
x 
= 
(
3 
2 JNVX ):3 ): ): ):]h ):V <@ 1E 1E| 1Ef >BPTcgpr IOs IO# IO]` IOV 8<B CW C4PX> CJ 8: A53 A5FRt RV RhF 6 =A )@' )@V =? !: !:F <> !9s !9+ !9F%
6 %
[ %
N LN 4 4Rd 4l#
d #
F #
N` #
J FH Q# Qu QL^ Q$ CE Ns NE NI[ N  8: ?53 ?5h ?5B	
t 	
V 	
x 	
 ?C2 _3 _ _> BFb %Aw %AN. .` CGr %23 %2i %2V[ %2N @BPT $ # s  c TX `c 6 &eBSW Pr  r4   )9 ccxt.async_support.base.exchanger   ccxt.abstract.hitbtcr   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   r   r    r!   typingr"   ccxt.base.errorsr#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   ccxt.base.decimal_to_precisionr1   ccxt.base.preciser2   r4    r  r  <module>rF     s    6 ,  V  V  V  V  V  V  V  V  * 0 - - . ' & . ) * ) . 1 * 4 %f8PX{ f8Pr  