
    E#io                       S SK Jr  S SKJr  S SKrS SKJrJrJrJ	r	J
r
JrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJ r J!r!J"r"  S SK#J$r$  S SK%J&r&  S SK%J'r'  S SK%J(r(  S S	K%J)r)  S S
K%J*r*  S SK%J+r+  S SK%J,r,  S SK%J-r-  S SK%J.r.  S SK%J/r/  S SK%J0r0  S SK%J1r1  S SK%J2r2  S SK%J3r3  S SK4J5r5  S SK6J7r7   " S S\\5      r8g)    )Exchange)ImplicitAPIN)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                   T  ^  \ rS rSrS\4U 4S jjrS r0 4S\\   4S jjr	0 4S\
4S jjr0 4S\S\4S jjr0 4S\S\4S	 jjrS\4S
 jr0 4S\4S jjr0 4S\S\4S jjrS0 4S\S\4S jjrSpS\S\S\4S jjrSS0 4S\S\S\S\\   4S jjrSSS0 4S\S\S\4S jjrSpS\S\S\4S jjrS r S\4S jr!S r"SpS\S\#S\$4S  jjr%SSS0 4S\S\S\S\\$   4S! jjr&SSS0 4S\S\S\S\\$   4S" jjr'SSS0 4S\S\S\S\\$   4S# jjr(SS0 4S\S\S\)4S$ jjr*S0 4S\S\S\+4S% jjr,SpS&\S\S\-4S' jjr.0 4S\S\-4S( jjr/0 4S\04S) jjr1S*SS0 4S\S+\S\S\S\\2   4
S, jjr3SpS\S\24S- jjr4SSS0 4S\S\S\S\\5   4S. jjr6S0 4S/\S\4S0 jjr7SSS0 4S/\S\S\S\4S1 jjr8SSS0 4S\S\S\S\\5   4S2 jjr9S0 4S/\S\4S3 jjr:S0 4S\4S4 jjr;S0 4S/\S\4S5 jjr<SS0 4S/\S\S6\=S7\>S8\?S9\?4S: jjr@S0 4S\S6\=S7\>S8\AS9\?4
S; jjrBSS0 4S\CS<\S6\=S7\>S8\AS9\?S=\4S> jjrDS\4S? jrESpS@\S\S\54SA jjrFS0 4S\\   S\G4SB jjrHSpS=\S\I4SC jjrJ0 4S\S8\ASD\SE\S\K4
SF jjrLSpSG\S\#S\K4SH jjrMS\4SI jrNS0 4S\S8\ASJ\SK\S\$4
SL jjrOS0 4S\S\P4SM jjrQSSS0 4S\S\S\4SN jjrRS0 4S\S\\S   4SO jjrT0 4S\4SP jjrUSpSQ\S\4SR jjrVSpS\4SS jjrWS0 4S\4ST jjrX0 4S\4SU jjrY0 4S\S\Z4SV jjr[SpS\S\Z4SW jjr\0 4S\S\]4SX jjr^SpSY\S\S\]4SZ jjr_0 4S\S8\AS\]4S[ jjr`0 4S\S8\AS\]4S\ jjra0 4S\S\b4S] jjrcSpS^\S\S\b4S_ jjrdS0 4S^\eS\4S` jjrfS0 4Sa\4Sb jjrgSpS\#4Sc jjrhS0 4S\S7\>S\54Sd jjri0 S4U 4Se jjrjS\eSf\Sg\Sh\Si\Sj\4Sk jrkSlSm0 SS4Sn jrlSormU =rn$ )qhitbtc   returnc                   > U R                  [        [        U ]  5       SSS/SS0 SS_SS	_S
S	_SS	_SS_SS_SS	_SS	_SS	_SS_SS	_SS	_SS	_SS	_SS	_SS	_SS	_0 SS	_SS_SS	_SS _SS _SS	_SS_S S_S!S	_S"S	_S#S_S$S_S%S	_S&S	_S'S(_S)S	_S*S _E0 S+S	_S,S	_S-S	_S.S_S/S	_S0S_S1S_S2S	_S3S _S4S_S5S(_S6S	_S7S_S8S	_S9S	_S:S_S;S_E0 S<S	_S=S	_S>S	_S?S_S@S	_SAS	_SBS	_SCS_SDS_SES	_SFS	_SGS	_SHS_SIS	_SJS	_SKS	_SLS	_E0 SMS_SNS	_SOS	_SPS	_SQS	_SRS	_SSS(_STS_SUS	_SVS	_SWS	_SXS	_SYS_SZS_S[S_S\S	_S]S	_E[        S^S_S_S`.SaSaS`.SbScSdSe/SfSg/Sh.Si0 SjSk_SlSk_SmSk_SnSk_SoSk_SpSk_SqSk_SrSk_SsSk_StSk_SuSk_SvSk_SwSk_SxSk_SySk_SzSk_S{Sk_SkSkSkSkSkSkSkSkSkSkSkSkSkS|.E00 S}S~_SS~_SS_SS_SS~_SS~_SS~_SS~_SS_SS_SS_SS_SS_SS~_SS~_SS~_SS~_0 SS~_SS~_SS~_SS_SS_SS_SS_SS~_SS~_SS~_SS~_SS~_SS~_SS~_SS_SS_SS_ESSSSSSSSS~S~S~S~S.E0 SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS~_SS~_SS~_SS~0ESSSS.SSSSSSSSSSSS.SSSS.S.S`.SS	S	U R                  S5      U R                  S5      U R                  S5      U R                  S5      /U R                  S5      U R                  S5      /U R                  S5      U R                  S5      /U R                  S5      U R                  S5      /U R                  S5      U R                  S5      /U R                  S5      U R                  S5      /U R                  S5      U R                  S5      /U R                  S5      U R                  S5      /U R                  S5      U R                  S5      /U R                  S5      U R                  S5      //
U R                  S5      U R                  S5      /U R                  S5      U R                  S5      /U R                  S5      U R                  S5      /U R                  S5      U R                  S5      /U R                  S5      U R                  S5      /U R                  S5      U R                  S5      /U R                  S5      U R                  S5      /U R                  S5      U R                  S5      /U R                  S5      U R                  S5      /U R                  S5      U R                  S5      //
S.S.0S	SS	S SSSS S	S	S	S	S.SSSSSSS	S.S S	SSSSS	S.S	SSSS	S.S	SSSSS	S.S S	SSSSSSSS	S.	SS0S.	SS0SSS	0SS0SS0SS0SS0S.SS0SS0S.SS0SS0S.S.SSSSSSSSSSS.
0 S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _0 S[        _S[        _S[        _S[        _S[        _S[        _S[         _S[        _GS [        _GS[        _GS[        _GS[        _GS[        _GS[        _GS["        _GS[        _GS[        _E0 GS	[        _GS
[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _E[        [        [        [        [        GS.E0 GS.GSGSGSGS.0 GS GS!_GS"GS _GSGS#_GSGS_GS$GS$_GS%GS&_GSGS'_GS(GS(_GS)GS)_GS*GS*_GS+GS+_GS,GS,_GS-GS-_GS.GS._GS/GS/_GS0GS0_GS1GS1_0 GS2GS3_GS4GS5_GS6GS7_GS8GS9_GS:GS:_GS;GS;_GS<GS<_GS=GS=_GS>GS>_GS?GS@_GSAGSA_GSBGSB_GSCGSC_GSDGSD_GSEGSE_GSFGSF_GSGGSG_E0 GSHGSH_GSIGSI_GSJGSJ_GSKGSK_GSLGSL_GSMGSM_GSNGSN_GSOGSO_GSPGSP_GSQGSQ_GSRGSR_GSSGST_GSUGSV_GSWGSW_GSXGSX_GSYGSZ_GS[GS[_E0 GS\GS\_GS]GS]_GS^GS^_GS_GS__GS`GS`_GSaGSb_GScGSc_GSdGSe_GSfGSf_GSgGSg_GShGSi_GSjGSj_GSkGSk_GSlGSl_GSmGSm_GSnGSn_GSoGSp_E0 GSqGSq_GSrGSr_GSsGSs_GStGSt_GSuGSu_GSvGSv_GSwGSw_GSxGSy_GSzGSz_GS{GS|_GS}GS}_GS~GS~_GSGS_GSGS_GSGS_GSGS_GSGS_EGSGS0ESGSGSGSGS.GSS0GS.0 GSGS_GSGS_GSGS_GSGS_GSGS_GSGS_GSGS_GSGS_GSGS_GSGS_GSGS_GSGS_GSGS_GSGS_GSGS_GSGS_GSGS_GSGSGSGS.EGS.5      $ (  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   rF   createOrdersro   rx   ru   r{   rQ   rp   extendsdefaultr   )r   rF   rx   ro   ru   rQ   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    E/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/hitbtc.pyr  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                 "    U R                  5       $ N)milliseconds)r  s    r  noncehitbtc.nonce  s      ""r  c                    U R                  U5      n/ n[        UR                  5       5      n[        S[	        U5      5       GH  nXE   nUR                  S5      (       a  M   U R                  X&5      nU R                  US5      nU R                  US5      n	US:H  n
US:H  nU R                  USS5      nU=(       a    UnU	S	LnU
=(       a    U(       + nSnU R                  US
S5      nU R                  US5      nU R                  US5      nU R                  U5      nU R                  U5      nU R                  U5      nS	nS	nUS-   U-   nSnS	nS	nS	nU
(       aW  U R                  S5      nUnU R                  U5      nUS	L=(       a    UU:H  nU(       + nUS-   U-   nU(       a  US-   U	-   nSnOSnU R                  US5      nU R                  US5      nU R                  U5      n U R                  U5      n!UR                  0 SU_SU_SU_SU_SU_SU_SU_SU_SU_SU_SU_SU_SU_SU_S S!_S"U
_S#U_UU R                  US$5      U R                  US%5      UU	S	S	S	UU U!S&.U R                  S5      U R                  US'S(5      S).U S	S).U!S	S).U R                  [        R                   " UU5      5      S	S).S*.S	US+.E5        GM     U$ ),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
r   _BQXtypeexpiryfuturesr<   margin_tradingFN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_marketshitbtc.fetch_markets  s    --f5> 8==?#q#c(#AB{{6""__X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 $~ r  c                 B   U R                  U5      n0 n[        UR                  5       5      n[        S[	        U5      5       GHX  nXE   nU R                  U5      nX&   nU R                  US/ 5      n	0 n
[        S[	        U	5      5       H  nX   nU R                  USS5      nU R                  U5      nUb  UR                  5       OUnUUUSU R                  US5      U R                  US5      U R                  US5      U R                  US	5      S
SSS.0S.	X'   M     U R                  UUUU R                  US5      U R                  US5      U R                  US5      (       + U R                  US5      U R                  US5      U
SSSSS.0SS.5      X7'   GM[     U$ )z
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
r   r  protocolnetworkN
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_currencieshitbtc.fetch_currencies  s    //7V (--/*
q#j/*A#J**:6D(E..
B?KH1c+./(^
 ..z:yQ	"55i@6A6Mk//1TX&#*"++JE#~~j/J $z;K L!%!1!1*>P!Q"#'#'%)% 0*  77 !--e5IJ((<"nnUJ??>>%A NN52BC$## #9 FL7 +\ r  r*  c                    U R                  5         U R                  U5      nSUS   0nU R                  US5      nUbL  US:X  aF  U R                  U R                  S5      nU R                  Xe5      nUb  XtS'   U R                  US5      nU R                  U R                  XB5      5      nU R                  US5      n	U R                  U	5      U R                  US5      U R                  US5      SUS	.$ )
aO  
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>`
currencyr  r   Nr-  r  address
payment_id)r;  r<  tagr   r   )
load_marketsr;  safe_string_upperr  r  r  omitprivatePostWalletCryptoAddressextendr  )
r  r*  r  r;  requestr   r  parsedNetworkr  r1  s
             r  create_deposit_addresshitbtc.create_deposit_address  s     	==&
 ((;dfnt||Z@H ,,X?M(&3
#YYvy1F66t{{77ST %%h
;
//
;'')<##Hl;
 	
r  c                    U R                  5         U R                  U5      nSUS   0nU R                  US5      nUbL  US:X  aF  U R                  U R                  S5      nU R                  Xe5      nUb  XtS'   U R                  US5      nU R                  U R                  XB5      5      nU R                  US5      n	U R                  U	S5      n
U R                  U	S5      nU R                  U	S	5      nU R                  U5      nUUSU
US
.$ )aF  
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>`
r;  r  r   Nr-  r  r   r<  r=  )r   r;  r   r<  r>  )
r?  r;  r@  r  r  r  rA  privateGetWalletCryptoAddressrC  r  )r  r*  r  r;  rD  r   r  rE  r  firstAddressr<  r1  r>  
parsedCodes                 r  fetch_deposit_addresshitbtc.fetch_deposit_address"  s    	==&
 ((;dfnt||Z@H ,,X?M(&3
#YYvy1F55dkk'6RS x3""<;%%lJ?
|\:,,Z8
"
 	
r  c                 .   SU0n[        S[        U5      5       Hh  nX   nU R                  US5      nU R                  U5      nU R	                  5       nU R                  US5      US'   U R                  US5      US'   XrU'   Mj     U R                  U5      $ )Nr   r   r;  	availablefreereservedused)r  r  r  r  accountsafe_balance)r  r  r  r  r2  r1  r*  rS  s           r  parse_balancehitbtc.parse_balanceI  s    )q#h-(AKE))%<J**:6DllnG"..ukBGFO"..ujAGFO"4L )   ((r  c                    U R                  USS5      nU R                  US/5      nU R                  U R                  S0 5      nU R	                  X2U5      nSnUS:X  a  U R                  U5      nOsUS:X  a  U R                  U5      nO[US:X  a  U R                  U5      nOC[        UR                  5       5      n[        U R                  S-   SR                  U5      -   5      eU R                  U5      $ )	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_lowerrA  r  r  r  privateGetWalletBalanceprivateGetSpotBalanceprivateGetFuturesBalancer  r  r(   r  joinrU  )r  r  r  r  rS  r  r  s          r  fetch_balancehitbtc.fetch_balanceU  s     %%fff=6F8,7GL"">>h33F;H11&9H%44V<H++-.DTWW'WWZ^ZcZcdhZiijj !!(++r  r  c                     U R                  5         U R                  U5      nSUS   0nU R                  U R                  XB5      5      nU R	                  XS5      $ )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>`
r  r  )r?  r  publicGetPublicTickerSymbolrC  parse_tickerr  r  r  r  rD  r  s         r  fetch_tickerhitbtc.fetch_ticker{  s\     	V$fTl
 33DKK4PQ   22r  Nsymbolsc                    U R                  5         U R                  U5      n0 nUb&  U R                  U5      nSR                  U5      nXSS'   U R	                  U R                  X25      5      n0 n[        UR                  5       5      n[        S[        U5      5       H4  n	X   n
U R                  U
5      nUS   nXj   nU R                  X5      X|'   M6     U R                  USU5      $ )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>`
,rf  r   r  )r?  market_symbols
market_idsr]  publicGetPublicTickerrC  r  r  r  r  safe_marketrb  filter_by_array_tickers)r  rf  r  rD  	marketIds	delimitedr  r  r  r  marketIdr  r  r2  s                 r  fetch_tickershitbtc.fetch_tickers  s     	%%g.0I+I!*I--dkk'.JK  HMMO$q#d)$AwH%%h/FH%F&E!..u=FN % ++FHgFFr  tickerr  c                    U R                  US   5      nU R                  S U5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  0 SU_SU_SU R	                  U5      _SU R                  US5      _S	U R                  US	5      _S
U R                  US
5      _SS _SU R                  US5      _SS _SS _SU_SU_SU_SS _SS _SS _SS _UUUS.EU5      $ )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  rs  r  ru  r  r  r  rx  ry  s	            r  rb  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                 *   U R                  5         Sn0 nUb  [        US5      US'   Ub  X&S'   SnUb:  U R                  U5      nUS   US'   U R                  U R	                  Xd5      5      nO U R                  U R	                  Xd5      5      nUb  U R                  Xu5      $ / n[        UR                  5       5      n	[        S[        U	5      5       H>  n
X   nU R                  U5      nX{   nU R                  X5      nU R                  X5      nM@     U$ )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  publicGetPublicTradesSymbolrC  publicGetPublicTradesparse_tradesr  r  r  r  array_concat)r  r  r  r   r  r  rD  r  tradesrn  r  rp  marketInner	rawTradesparseds                  r  fetch_tradeshitbtc.fetch_trades  s    	"5$/GG#FO[[(F &tGH77G8TUH11$++g2NOH$$X66)	q#i.)A |H++h/K *I&&y>F&&v6F * r  c                    U R                  5         Sn0 nUb  U R                  U5      nUS   US'   Ub  X6S'   Ub  X&S'   SnSnSn	U R                  SXT5      u  ptU R                  SU5      u  pU R	                  USS/5      nUb!  U R                  U R                  Xd5      5      n	OUS	:X  a!  U R                  U R                  Xd5      5      n	OfUS
:X  a!  U R                  U R                  Xd5      5      n	O?US:X  a!  U R                  U R                  Xd5      5      n	O[        U R                  S-   5      eU R                  XX#5      $ )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  ro   r   r=   r<   r>   z- fetchMyTrades() not support self market typer?  r  handle_market_type_and_paramshandle_margin_mode_and_paramsrA  privateGetMarginHistoryTraderC  privateGetSpotHistoryTradeprivateGetFuturesHistoryTrader-   r  r  
r  r  r  r   r  r  rD  r   r   r  s
             r  fetch_my_tradeshitbtc.fetch_my_trades  sQ     	[[(F &tGH$G#FO

!??QW`
!??QWX
6L(#;<!88W9UVHV#::4;;w;WXv%==dkk'>Z[x'<<T[[=YZ"477-\#\]]  5@@r  tradec                 z   U R                  US   5      nU R                  US5      nU R                  XB5      nUS   nS nU R                  US5      nU R                  US5      nUb  U(       a  SOSn	OSn	Ub;  U R                  US0 5      n
U R                  U
S5      nU R	                  U5      nUUS.nU R                  US	S
5      nU R                  US5      nU R                  USS5      nU R                  US5      nU R                  US5      nU R                  UUUUU R                  U5      US UU	UUS US.U5      $ )Nru  r  r%  r   r   r   r  )r  r;  clientOrderIdclient_order_idr  quantityqtysider  )r   r  orderru  rz  r  r  r  takerOrMakerr  r  r  r%  )r  r  rl  r  r  r  
safe_trader  )r  r  r  ru  rp  r  r%  feeCostStringr   r  r   r  feeCurrencyCodeorderIdpriceStringamountStringr  r  s                     r  parse_tradehitbtc.parse_tradeC  sr   r NN5#56	##E84!!(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                    U R                  5         SU0nS nUb  U R                  U5      nUS   US'   Ub  U R                  U5      US'   Ub  XFS'   U R                  U R	                  Xe5      5      nU R                  XX4U5      $ )Ntypesr  r0  r  r   )r?  r;  r  privateGetWalletTransactionsrC  parse_transactions)	r  r  r*  r  r   r  rD  r;  r  s	            r  fetch_transactions_helper hitbtc.fetch_transactions_helper  s    U
 }}T*H$,TNGL!"ll51GFO$G44T[[5QR2 &&x5PPr  statusc                 6    SSSSSS.nU R                  X!U5      $ )Npendingfailedok)CREATEDPENDINGFAILEDROLLED_BACKSUCCESSr  r  r  statusess      r  parse_transaction_statushitbtc.parse_transaction_status  s-      #
 &99r  c                 0    SSS.nU R                  X!U5      $ )Nr&  
withdrawal)DEPOSITWITHDRAWr  )r  r  r  s      r  parse_transaction_typehitbtc.parse_transaction_type  s$     $
 T22r  transactionr;  c                    U R                  USS5      nU R                  U R                  US5      5      nU R                  U R                  US5      5      nU R                  U R                  US5      5      nU R	                  U R                  US5      5      nU R                  US0 5      nU R                  US5      n	U R                  U	5      n
U R                  US	5      nU R                  US
5      nUnU R                  US5      nUnU R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      nUS:H  nS S S S.nU R                  US5      nUb
  U
US'   UUS'   0 SU_SU_SU_SU_SU
_SS _SU_SU_SU_SU R                  U5      _S
U_SU_SU_SU_SS _SU_SU_S UUS.E$ ) Noperation_idr  
created_at
updated_atr  r  nativer;  hashr<  r=  sendersr   r  subtypeOFFCHAIN)r;  r  rater%  r  r   txidr   ru  rz  addressFrom	addressTor>  tagFromtagToupdated)commentinternalr%  )	r  r  r  r  r  r  r  r  r  )r  r  r;  r  ru  r  r  r  r  r1  r*  txhashr<  r  r>  r  senderr  r  subTyper  r%  feeCosts                          r  parse_transaction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                 (    U R                  SXX45      $ )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,WITHDRAWr  r  r*  r  r   r  s        r  fetch_deposits_withdrawals!hitbtc.fetch_deposits_withdrawals5  s     --.@$u]]r  c                 (    U R                  SXX45      $ )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  r  r  s        r  fetch_depositshitbtc.fetch_depositsC  s     --ieTTr  c                 (    U R                  SXX45      $ )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  r  r  s        r  fetch_withdrawalshitbtc.fetch_withdrawalsQ  s     --j$uUUr  c                    U R                  5         0 nUb%  U R                  U5      nSR                  U5      US'   Ub  X$S'   U R                  U R	                  XC5      5      n0 n[        UR                  5       5      n[        S[        U5      5       HU  n	X   n
Xj   nU R                  U
5      nU R                  U R                  US5      5      nU R                  Xj   XSS5      X|'   MW     U$ )a"  
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
rh  rf  depthr   ru  r}  r  )r?  rj  r]  publicGetPublicOrderbookrC  r  r  r  r  r  r  r  parse_order_book)r  rf  r   r  rD  marketIdsInnerr  r  rn  r  rp  	orderbookr  ru  s                 r  fetch_order_bookshitbtc.fetch_order_books_  s     	!__W5N!$.!9GI$G00W1MN)	q#i.)A |H *I%%h/Ft'7'7	;'OPI!2283EvZ_afgFN * r  c                 
   U R                  5         U R                  U5      nSUS   0nUb  X%S'   U R                  U R                  XS5      5      nU R	                  U R                  US5      5      nU R                  XaUSS5      $ )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
r  r  r  ru  r}  r  )r?  r  publicGetPublicOrderbookSymbolrC  r  r  r  )r  r  r   r  r  rD  r  ru  s           r  fetch_order_bookhitbtc.fetch_order_book|  s     	V$fTl
 $G66t{{77STNN4#3#3Hk#JK	$$Xy%OOr  r%  c                     U R                  US5      nU R                  US5      nU R                  US5      nU R                  XR5      nUUUUS S S.$ )Nr  r  r  )r   r  r   r   r   r   )r  r  r  )r  r%  r  r   r   rp  r  s          r  parse_trading_feehitbtc.parse_trading_fee  sf       k2  k2##C2!!(3
 	
r  c                 P   U R                  5         U R                  U5      nSUS   0nSnUS   S:X  a!  U R                  U R                  XB5      5      nOBUS   S:X  a!  U R	                  U R                  XB5      5      nO[        U R                  S-   5      eU R                  XS5      $ )aJ  
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>`
r  r  Nr  r<   r>   z/ fetchTradingFee() not support self market type)r?  r  privateGetSpotFeeSymbolrC  privateGetFuturesFeeSymbolr-   r  r  rc  s         r  fetch_trading_feehitbtc.fetch_trading_fee  s     	V$fTl
 &>V#33DKK4PQHF^v%66t{{77STHtww)ZZ[[ %%h77r  c                 X   U R                  5         U R                  SSU5      u  p#SnUS:X  a  U R                  U5      nO0US:X  a  U R                  U5      nO[	        U R
                  S-   5      e0 n[        S[        U5      5       H  nU R                  XF   5      nUS   nXuU'   M!     U$ )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
r   Nr<   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_feeshitbtc.fetch_trading_fees  s     	 >>?QSWY_`
--e4H6!007Htww)[[\\ q#h-(A((5C]F 6N ) r  r   	timeframec           	         U R                  5         SnU R                  USS5      u  peU(       a  U R                  SXXBUS5      $ U R                  U5      nUS   U R	                  U R
                  X"5      S.nUb  U R                  U5      US'   U R                  S	X5      u  pUb  [        US5      US
'   U R	                  US5      n	U R                  US5      nSn
U	S:X  a!  U R                  U R                  X5      5      n
OnU	S:X  a!  U R                  U R                  X5      5      n
OGU	S:X  a!  U R                  U R                  X5      5      n
O U R                  U R                  X5      5      n
U R                  XX#U5      $ )a   
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
Frp   paginater   r  )r  periodNr  untilr   r  markindexpremiumIndex)r?  handle_option_and_params"fetch_paginated_call_deterministicr  r  r  r  handle_until_optionr  rA  ,publicGetPublicFuturesCandlesMarkPriceSymbolrC  -publicGetPublicFuturesCandlesIndexPriceSymbol/publicGetPublicFuturesCandlesPremiumIndexSymbolpublicGetPublicCandlesSymbolparse_ohlcvs)r  r  r  r  r   r  r  r  rD  r  r  s              r  fetch_ohlcvhitbtc.fetch_ohlcv  s|   $ 	88zZ::<X]jprvwwV$Tl&&t	M
 "ll51GFO227GL"5$/GG  167+F?HHU\IefHgII$++V]JfgHn$KKDKKX_LhiH88W9UVH8   9UKKr  c           	          U R                  U R                  US5      5      U R                  US5      U R                  US5      U R                  US5      U R                  US5      U R                  US5      /$ )Nru  rx  r  r  r  rv  )r  r  r  )r  ohlcvr  s      r  parse_ohlcvhitbtc.parse_ohlcv2  sw    2 NN4++E;?@UF+UE*UE*UG,UH-
 	
r  c                    U R                  5         Sn0 nUb  U R                  U5      nUS   US'   Ub  U R                  U5      US'   Ub  X6S'   SnSnU R                  SXT5      u  ptU R	                  SU5      u  pU R                  USS/5      nSn	Ub!  U R                  U R                  Xd5      5      n	OUS	:X  a!  U R                  U R                  Xd5      5      n	OfUS
:X  a!  U R                  U R                  Xd5      5      n	O?US:X  a!  U R                  U R                  Xd5      5      n	O[        U R                  S-   5      eU R                  XX#5      n
U R                  U
SSS/S5      $ )a  
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   rQ   r   r=   r<   r>   z1 fetchClosedOrders() not support self market typer  closedcanceledF)r?  r  r  r  r  rA  privateGetMarginHistoryOrderrC  privateGetSpotHistoryOrderprivateGetFuturesHistoryOrderr-   r  parse_ordersfilter_by_array)r  r  r  r   r  r  rD  r   r   r  r  s              r  fetch_closed_ordershitbtc.fetch_closed_ordersS  sy     	[[(F &tGH"ll51GFO$G

!??@SU[d
!??@SU[\
6L(#;<!88W9UVHV#::4;;w;WXv%==dkk'>Z[x'<<T[[=YZ"477-`#`aa""8UB##FHx6LeTTr  r  c                    U R                  5         SnUb  U R                  U5      nSU0nSnSnU R                  SXC5      u  pcU R                  SU5      u  psU R	                  USS/5      nSnUb!  U R                  U R                  XS5      5      nOUS:X  a!  U R                  U R                  XS5      5      nOfUS:X  a!  U R                  U R                  XS5      5      nO?US:X  a!  U R                  U R                  XS5      5      nO[        U R                  S-   5      eU R                  US	5      n	U R                  X5      $ )
aK  
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  rx   r   r=   r<   r>   z* fetchOrder() not support self market typer   )r?  r  r  r  rA  r'  rC  r(  r)  r-   r  	safe_dictparse_order)
r  r  r  r  r  rD  r   r   r  r  s
             r  fetch_orderhitbtc.fetch_order  s?    	[[(Fr
 

!??f]
!??fU
6L(#;<!88W9UVHV#::4;;w;WXv%==dkk'>Z[x'<<T[[=YZ"477-Y#YZZ( x+..r  c                 `   U R                  5         SnUb  U R                  U5      nSU0nSnSn	U R                  SXe5      u  pU R                  SU5      u  pU R	                  USS/5      nSn
U	b!  U R                  U R                  Xu5      5      n
OUS:X  a!  U R                  U R                  Xu5      5      n
OfUS:X  a!  U R                  U R                  Xu5      5      n
O?US:X  a!  U R                  U R                  Xu5      5      n
O[        U R                  S-   5      eU R                  XX45      $ )	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  rD  r   r   r  s              r  fetch_order_tradeshitbtc.fetch_order_trades  s6   " 	[[(F
 

!??@RTZc
!??@RTZ[
6L(#;<!88W9UVHV#::4;;w;WXv%==dkk'>Z[x'<<T[[=YZ"477-_#_``N   5@@r  c                 l   U R                  5         Sn0 nUb  U R                  U5      nUS   US'   SnSnU R                  SXT5      u  ptU R                  SU5      u  pU R	                  USS/5      nSn	Ub!  U R                  U R                  Xd5      5      n	OUS:X  a!  U R                  U R                  Xd5      5      n	OfUS:X  a!  U R                  U R                  Xd5      5      n	O?US:X  a!  U R                  U R                  Xd5      5      n	O[        U R                  S	-   5      eU R                  XX#5      $ )
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  ru   r   r=   r<   r>   z/ fetchOpenOrders() not support self market type)r?  r  r  r  rA  privateGetMarginOrderrC  privateGetSpotOrderprivateGetFuturesOrderr-   r  r*  r  s
             r  fetch_open_ordershitbtc.fetch_open_orders  s:     	[[(F &tGH

!??@QSYb
!??@QSYZ
6L(#;<!11$++g2NOHV#33DKK4PQv%66t{{77STx'55dkk'6RS"477-^#^__(   5@@r  c                 ^   U R                  5         SnUb  U R                  U5      nSU0nSnSnU R                  SXC5      u  pcU R                  SU5      u  psU R	                  USS/5      nSnUb!  U R                  U R                  XS5      5      nOUS:X  a!  U R                  U R                  XS5      5      nOfUS:X  a!  U R                  U R                  XS5      5      nO?US:X  a!  U R                  U R                  XS5      5      nO[        U R                  S-   5      eU R                  X5      $ )	a9  
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  rt   r   r=   r<   r>   z. fetchOpenOrder() not support self market type)r?  r  r  r  rA  "privateGetMarginOrderClientOrderIdrC   privateGetSpotOrderClientOrderId#privateGetFuturesOrderClientOrderIdr-   r  r0  	r  r  r  r  r  rD  r   r   r  s	            r  fetch_open_orderhitbtc.fetch_open_orderK  s2    	[[(Fr
 

!??@PRXa
!??@PRXY
6L(#;<!>>t{{7?[\HV#@@WA]^v%CCDKKPWD`ax'BB4;;wC_`"477-]#]^^11r  c                 j   U R                  5         Sn0 nUb  U R                  U5      nUS   US'   SnSnU R                  SX25      u  pRU R                  SU5      u  pbU R	                  USS/5      nSnUb!  U R                  U R                  XB5      5      nOUS:X  a!  U R                  U R                  XB5      5      nOfUS:X  a!  U R                  U R                  XB5      5      nO?US:X  a!  U R                  U R                  XB5      5      nO[        U R                  S	-   5      eU R                  Xs5      $ )
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  rB   r   r=   r<   r>   z/ cancelAllOrders() not support self market type)r?  r  r  r  rA  privateDeleteMarginOrderrC  privateDeleteSpotOrderprivateDeleteFuturesOrderr-   r  r*  r  r  r  r  rD  r   r   r  s           r  cancel_all_ordershitbtc.cancel_all_orderst  s6    	[[(F &tGH

!??@QSYb
!??@QSYZ
6L(#;<!44T[[5QRHV#66t{{77STv%99$++g:VWx'88W9UV"477-^#^__  22r  c                 ^   U R                  5         SnSU0nUb  U R                  U5      nSnSnU R                  SXC5      u  pcU R                  SU5      u  psU R	                  USS/5      nSnUb!  U R                  U R                  XS5      5      nOUS:X  a!  U R                  U R                  XS5      5      nOfUS:X  a!  U R                  U R                  XS5      5      nO?US:X  a!  U R                  U R                  XS5      5      nO[        U R                  S-   5      eU R                  X5      $ )	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  rC   r   r=   r<   r>   z+ cancelOrder() not support self market type)r?  r  r  r  rA  %privateDeleteMarginOrderClientOrderIdrC  #privateDeleteSpotOrderClientOrderId&privateDeleteFuturesOrderClientOrderIdr-   r  r0  rA  s	            r  cancel_orderhitbtc.cancel_order  s0    	r
 [[(F

!??v^
!??vV
6L(#;<!AA$++gB^_HV#CCDKKPWD`av%FFt{{SZGcdx'EEdkkRYFbc"477-Z#Z[[11r  r  r  r  r  c                    U R                  5         S nUU R                  X%5      S.n	US:X  d  US:X  a/  Uc  [        U R                  S-   5      eU R	                  X&5      U	S'   Ub  U R                  U5      nS n
S nU R                  SX5      u  pU R                  SU5      u  pU R                  USS/5      nS nUb!  U R                  U R                  X5      5      nOU
S	:X  a!  U R                  U R                  X5      5      nOfU
S
:X  a!  U R                  U R                  X5      5      nO?U
S:X  a!  U R                  U R                  X5      5      nO[        U R                  S-   5      eU R                  X5      $ )N)r  r  r   	stopLimitz' editOrder() limit order requires pricer  rL   r   r=   r<   r>   z) editOrder() not support self market type)r?  amount_to_precisionr#   r  price_to_precisionr  r  r  rA  $privatePatchMarginOrderClientOrderIdrC  "privatePatchSpotOrderClientOrderId%privatePatchFuturesOrderClientOrderIdr-   r0  )r  r  r  r  r  r  r  r  r  rD  r   r   r  s                r  
edit_orderhitbtc.edit_order  sv   !00@
 GO!4}#DGG.W$WXX#66vEGG[[(F

!??V\
!??VT
6L(#;<!@@WA]^HV#BB4;;wC_`v%EEdkkRYFbcx'DDT[[QXEab"477-X#XYY11r  c           
         U R                  5         U R                  U5      nSnSn	U R                  SXv5      u  pSn
U R                  SU5      u  pU R	                  XyX#XEX5      u  pSnU	S:X  a!  U R                  U R                  X5      5      nOJU	S:X  d  U
b!  U R                  U R                  X5      5      nO U R                  U R                  X5      5      nU R                  X5      $ )ax  
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>`
NrF   r>   r=   )
r?  r  r  r  create_order_requestprivatePostFuturesOrderrC  privatePostMarginOrderprivatePostSpotOrderr0  )r  r  r  r  r  r  r  r  rD  r   r   r  s               r  create_orderhitbtc.create_order  s    * 	V$
!??v^

!??vV
33FTZcmv33DKK4PQHH$**@224;;w3OPH00W1MNH11r  r   r   c	                    US:H  n	U R                  US5      n
U R                  US5      nU R                  U/ SQ5      nU R                  US:H  S U5      nUUU R	                  US   U5      US   S.nU
b3  US	   S
:w  a*  US	   S:w  a!  [        U R                  S-   US	   -   S-   5      eU
SL a  XS'   U(       a  SUS'   Ub  XS'   U	(       d  US:X  d  US:X  a3  Uc  [        U R                  S-   5      eU R                  US   U5      US'   US:X  a-  U R                  US5      nUc  [        U R                  S-   5      eUb1  U R                  US   U5      US'   U	(       a  SUS	'   O<US:X  a  SUS	'   O0US:X  d  US:X  d  US:X  d  US:X  a  [        U R                  S-   5      eU R                  U/ SQ5      nUS
:X  a	  Uc  SnX~S'   X/$ ) 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_forcerR  takeProfitLimitz9 createOrder() requires a price argument for limit ordersr  r   expire_timez@ createOrder() requires an expire_time parameter for a GTD orderrd  
stopMarkettakeProfitMarketzU createOrder() requires a triggerPrice parameter for stop-loss and take-profit orders)r   r   rc  rd  rb  postOnlycrossmargin_mode)
r  r  safe_number_nis_post_onlyrS  r+   r  r#   rT  rA  )r  r  r   r  r  r  r  r   r  isLimitrb  r   r   
isPostOnlyrD  
expireTimes                   r  r[  hitbtc.create_order_request
	  s3   7?__V\:
&&v}=))&2]^&&tx'7vF
001A6JTl	
" !v&(vf~/I"477-_#_bhiobp#p  t@  $@  A  A%/M"#'GK "'2O$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!$
%/M"  r  c                 8    SSSSSSS.nU R                  X!U5      $ )Nrx  r%  r&  r  )new	suspendedpartiallyFilledfilledr&  expiredr  r  s      r  parse_order_statushitbtc.parse_order_statusB	  s0    %"
 &99r  r  c                    U R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      n	U R                  U	5      n
U R                  US5      nS nX:w  a  U R                  U5      nU R                  US	5      nU R                  U R                  US
5      5      nU R                  US5      nU R                  X5      nUS   nU R	                  US5      nU R                  US5      nU R	                  US5      nU R                  0 SU_SU_SU_SU
_SU R                  U
5      _SU_SU_SU_SU_SU_SU_SU_SU_SU_SU R	                  US5      _SU_SS _S UUUS U R                  US5      S S S.EU5      $ )Nr  r  r  r  r  price_averager  r  quantity_cumulativer  r  rf  rg  r  r   r  r  ru  rz  lastTradeTimestamplastUpdateTimestampr  r   rl  rb  re  ry  	remainingrd  )r  r  r  r  r%  r   r   r   )r  r  r{  rl  r  
safe_orderr  )r  r  r  r  r  r  r  r  r  r  ru  r  r  ry  r  rp  r  rl  r   r  s                       r  r0  hitbtc.parse_orderM	  st   D e%67 v.v.!!%4  0""5/:""5,7NN7+	""5,7!!%!8!!%)>?(()9)9%)JK##E84!!(3!??5+6&&uo>OOE84	  
E 
" 
 R 
 	 

 Y/ 
 !"4 
 "#5 
 f 
 U 
 f 
 D 
 D 
 ; 
  
 $//%? 
  f! 
" # 
$  ,,ULA#!3 
4 5 	r  c                    U R                  5         SnUb%  U R                  U5      nU R                  US   5      nSnU R                  SX25      u  pBSnUS:X  a  U R	                  U5      nO0US:X  a  U R                  U5      nO[        U R                  S-   5      eU R                  US/ 5      nU R                  XaS5      $ )	ar  
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   rh   r=   r>   z; fetchMarginModes() supports swap contracts and margin onlyconfigr  )
r?  ri  r  r  privateGetMarginConfigprivateGetFuturesConfigr)   r  r,  parse_margin_modes)r  rf  r  r  r   r  r  s          r  fetch_margin_modeshitbtc.fetch_margin_modes	  s     	))'2G[[,F
!??@QSYb
!226:H$ 6!33F;H& DGG&ccdd(B7&&vAAr  c                 p    U R                  US5      nUU R                  X25      U R                  US5      S.$ )Nr  rn  )r   r  r   )r  r  rY  )r  r   r  rp  s       r  parse_margin_modehitbtc.parse_margin_mode 
  s?    ##J9&&x800]K
 	
r  fromAccount	toAccountc                    U R                  5         U R                  U5      nU R                  X5      nU R                  U R                  S0 5      nUR                  5       nUR                  5       nU R                  XU5      n	U R                  XU5      n
X:X  a  [        U R                  S-   5      eUS   UU	U
S.nU R                  U R                  X5      5      nU R                  X5      $ )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>`
r  zJ transfer() fromAccount and toAccount arguments cannot be the same accountr  )r;  r  sourcedestination)r?  r;  currency_to_precisionr  r  lowerr  r(   r  privatePostWalletTransferrC  parse_transfer)r  r*  r  r  r  r  r;  requestAmountr  fromIdtoIdrD  r  s                r  r   hitbtc.transfer
  s     	==&224@7GL!'')OO%	!!.{K9E>TWW'sstt #	
 11$++g2NO ""866r  r   c           
      Z    U R                  US5      S S U R                  S U5      S S S S US.	$ )Nr   )	r  ru  rz  r;  r  r  r  r  r   )r  r  )r  r   r;  s      r  r  hitbtc.parse_transfer.
  sC     ""8Q///h?

 
	
r  c                 Z   U R                  5         US:w  a  [        U R                  S-   5      eU R                  U R                  S0 5      nUR                  5       nUR                  5       nU R                  Xc5      nU R                  Xd5      nX4:X  a  [        U R                  S-   5      eUb  UcC  [        UR                  5       5      n[        U R                  S-   SR                  U5      -   5      eUUU R                  X5      S.nU R                  U R                  X5      5      n	SU	0$ )	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 rX  )from_currencyto_currencyr  r   )r?  r#   r  r  r  r.  r  r(   r  r  r'   r]  r  privatePostWalletConvertrC  )
r  r*  r  fromNetwork	toNetworkr  r  r  rD  r  s
             r  convert_currency_networkhitbtc.convert_currency_networkB
  sA   6>*b bcc??4<<R@!'')OO%	&&x=$$X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>

 00W1MN H
 	
r  r<  r>  c                 J   U R                  XE5      u  pEU R                  5         U R                  U5        U R                  U5      nUS   UUS.nUb  XGS'   U R	                  U R
                  S0 5      nU R                  US5      n	U	b0  US:X  a*  U R                  X5      n
U
b  XS'   U R                  US5      nU R	                  U R
                  S0 5      nU R                  US	S
5      nU(       a  SUS'   U R                  U R                  Xu5      5      nU R                  X5      $ )ay  
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>`
r  )r;  r  r<  r=  r  r   r-  network_coder   r  FTinclude_fee)handle_withdraw_tag_and_paramsr?  check_addressr;  r  r  r@  r  rA  r
  privatePostWalletCryptoWithdrawrC  r  )r  r*  r  r<  r>  r  r;  rD  r  r   rE  withdrawOptionsr  r  s                 r  r   hitbtc.withdraw[
  s$    99#F7#==& 

 ?$'L!??4<<R@((;dfn ,,X?M(*7'YYvy1F//$,,
BG^^O\5I
%)GM"77G8TU %%h99r  c                    U R                  5         Sn0 nUbJ  U R                  U5      nU R                  US   5      nU R                  U5      nSR	                  U5      US'   SnU R                  SX25      u  pbUS:w  a  [        U R                  S-   U-   S-   5      eU R                  U R                  XB5      5      n[        UR                  5       5      n0 n	[        S[        U5      5       HP  n
U R                  X5      nU R                  X{5      nU R                  U5      nUS	   nU R!                  X5      nXU'   MR     U R#                  U	S	U5      $ )
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   rh  rf  r`   r>   z& fetchFundingRates() does not support z marketsr  )r?  ri  r  rj  r]  r  r-   r  publicGetPublicFuturesInforC  r  r  r  r  r  r  parse_funding_rater+  )r  rf  r  r  rD  queryMarketIdsr  r  rn  fundingRatesr  rp  rawFundingRater  r  fundingRates                   r  fetch_funding_rateshitbtc.fetch_funding_rates
  sO    	))'2G[[,F!__W5N!$.!9GI99:Mv^6>tww)QQTXX[eeff224;;w3OP$ )	q#i.)A''	5H!__X@N++h/K *F11.NK#.  * ##L(GDDr  c           
      >   U R                  5         SnU R                  USS5      u  pTU(       a  U R                  SXUSUS5      $ Sn0 nU R                  SXt5      u  ptUb  U R	                  U5      nUS   nUS	   US
'   Ub  X'S'   Ub  X7S'   U R                  U R                  Xt5      5      n[        UR                  5       5      n	/ n
[        S[        U	5      5       H  nX   nU R                  U5      nX   n[        S[        U5      5       He  nX   nU R                  US   5      nU R                  US5      nU R                  US5      nU
R                  UUUU R!                  U5      US.5        Mg     M     U R#                  U
S5      nU R%                  UXU5      $ )ak  

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>`
Fr_   r  8hr   Nr  r  r  rf  r  r   r   funding_rateru  )r   r  r  ru  rz  )r?  r  r  r  r  $publicGetPublicFuturesHistoryFundingrC  r  r  r  r  rl  r  r  r  r  r  sort_byfilter_by_symbol_since_limit)r  r  r  r   r  r  r  rD  r  	contractsratesr  rp  r  fundingRateDatar4  r2  symbolInnerr  rz  sorteds                        r  fetch_funding_rate_history!hitbtc.fetch_funding_rate_history
  s    	88AZ\fg::;TV\ejlprxz~
 227GL[[(FH%F!'GI#FO$G<<T[[=YZ  )	q#i.)A |H**84K&0O1c/23'*"..{8/DE"..unE++E;?!)#.!%!9 (  4	 *  e[100NNr  c                 T   U R                  5         0 nSnSnU R                  SSU5      u  pBUS:X  a  SnU R                  SU5      u  pRU R                  USS/5      nSnUb!  U R	                  U R                  X25      5      nOfUS:X  a!  U R                  U R                  X25      5      nO?US:X  a!  U R	                  U R                  X25      5      nO[        U R                  S-   5      e/ n[        S[        U5      5       H%  nUR                  U R                  Xh   5      5        M'     U$ )	a6  
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  rA  privateGetMarginAccountrC  privateGetFuturesAccountr-   r  r  r  r  parse_position)	r  rf  r  rD  r   r   r  r  r  s	            r  fetch_positionshitbtc.fetch_positions  s(    	

!??@PRVX^_
J!??@PRXY
6L(#;<!33DKK4PQHV#88W9UVx'77G8TU"477-]#]^^B q#h-(AMM$--hk:; )r  c                    U R                  5         U R                  U5      nSUS   0nSnSnU R                  SSU5      u  pRU R                  SU5      u  pbU R	                  USS/5      nSnUb!  U R                  U R                  XB5      5      nOfUS:X  a!  U R                  U R                  XB5      5      nO?US:X  a!  U R                  U R                  XB5      5      nO[        U R                  S-   5      eU R                  Xs5      $ )	al  
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>`
r  r  Nr}   r   r=   r>   z- fetchPosition() not support self market type)r?  r  r  r  rA  %privateGetMarginAccountIsolatedSymbolrC  &privateGetFuturesAccountIsolatedSymbolr-   r  r  rH  s           r  fetch_positionhitbtc.fetch_positionI  s    	V$fTl
 

!??QUW]^
!??QWX
6L(#;<!AA$++gB^_HV#FFt{{SZGcdx'EEdkkRYFbc"477-\#\]]B ""844r  positionc                    U R                  US5      nU R                  US5      nU R                  US5      nU R                  US/ 5      nS nS nS n	[        S[	        U5      5       H=  n
Xj   nU R                  US5      nU R                  US5      nU R                  US5      n	M?     U R                  US	/ 5      nS n[        S[	        U5      5       H  n
X   nU R                  US
5      nM     U R                  US5      nU R                  X5      nUS   nU R                  0 SU_SS _SU_SS _SU_SU_SU_SU_SS _SS _SU	_SS _SS _SS _SS _SS _SU R                  U5      _US S S US S US S S S.E5      $ )Nr  r   r  	positionsr   price_liquidationprice_entryr  r0  margin_balancer  r   r  notionalr   
marginTypeliquidationPrice
entryPriceunrealizedPnlr   r  r  	markPrice	lastPricer  r   ru  )rz  r  maintenanceMarginmaintenanceMarginPercentage
collateralinitialMargininitialMarginPercentager   marginRatior   r   )r  r  r  r  r  rl  safe_positionr  )r  r  r  r   r   rz  r  r  r  r  r  r2  r0  r  rp  r  s                   r  r  hitbtc.parse_position  s9   B %%h7
##Hj9##Hl;OOHk2>	
	q#i.)ALE#//7JK))%?J((
;I	 *
 __X|R@

q#j/*AME))%1ABJ + ##Hh7!!(3!!! #
H#
$#
 f#
 	#

 *#
 *#
  0#
 *#
 T#
 $#
 #
 D#
 #
 #
 D#
  d!#
" 1##
$ !#'!%+/$!'+ !#9#
  	r  c           	          U R                  US5      nU R                  US5      nU R                  U R                  S U5      S UU R	                  U5      UUS.U5      $ )Nru  open_interest)r  openInterestAmountopenInterestValueru  rz  r   )r  r  safe_open_interestr  r  )r  interestr  rz  values        r  parse_open_interesthitbtc.parse_open_interest  sm      ##Hk:  ?;&&&&tV4"&!&1 (
  	r  c                    U R                  5         0 nU R                  U5      nSnUb%  U R                  U5      nSR                  U5      US'   U R	                  U R                  X25      5      n/ n[        UR                  5       5      n[        S[        U5      5       H;  nXx   n	U R                  U	5      n
UR                  U R                  XY   U
5      5        M=     U R                  USU5      $ )a7  
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>`
Nrh  rf  r   r  )r?  ri  rj  r]  r  rC  r  r  r  r  rl  r  r  r+  )r  rf  r  rD  rn  r  resultsmarketsr  rp  r  s              r  fetch_open_interestshitbtc.fetch_open_interests  s     	%%g.	0I!$)!4GI224;;w3OP$ x}}'q#g,'AzH**84KNN433H4FTU ( ##GXw??r  c                     U R                  5         U R                  U5      nUS   (       d  [        U R                  S-   5      eSUS   0nU R	                  U R                  XB5      5      nU R                  XS5      $ )a*  
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:
r>   z1 fetchOpenInterest() supports swap contracts onlyr  r  )r?  r  r)   r   publicGetPublicFuturesInfoSymbolrC  r  rc  s         r  fetch_open_interesthitbtc.fetch_open_interest&  sx     	V$f~DGG&YYZZfTl
 88W9UV  ''99r  c                     U R                  5         U R                  U5      nUS   (       d  [        U R                  S-   5      eSUS   0nU R	                  U R                  XB5      5      nU R                  XS5      $ )a  
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>`
r>   z0 fetchFundingRate() supports swap contracts onlyr  r  )r?  r  r)   r  r  rC  r  rc  s         r  fetch_funding_ratehitbtc.fetch_funding_rateI  sx     	V$f~DGG&XXYYfTl
 88W9UV  &&x88r  c                    U R                  US5      nU R                  US5      n0 SU_SU R                  S U5      _SU R                  US5      _SU R                  US5      _S	U R                  US
5      _SS _SU R                  U5      _SU_SU R                  US5      _SU R                  U5      _SU_SU R                  US5      _SS _SS _SS _SS _SS _SS 0E$ )Nnext_funding_timeru  r   r  r  
mark_price
indexPriceindex_priceinterestRateinterest_rateestimatedSettlePricerz  r  r  fundingTimestampfundingDatetimenextFundingRateindicative_funding_ratenextFundingTimestampnextFundingDatetimepreviousFundingRatepreviousFundingTimestamppreviousFundingDatetimeinterval)r  r  r  r  )r  r  r  fundingDateTimerz  s        r  r  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                    U R                  5         U R                  U5      nU R                  US5      nUS   (       a  Uc  [        U R                  S-   5      eU R                  U5      nUS:w  a  U R                  X5      nOSnUS   US.nUb  XhS'   S n	S n
U R                  SXT5      u  pU R                  SU5      u  pS nU	S:X  a!  U R                  U R                  X5      5      nOKU	S:X  d  U	S	:X  d  U
S
:X  a!  U R                  U R                  X5      5      nO[        U R                  S-   5      eU R                  U R                  X5      U R                  U5      US.5      $ )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_stringrS  r  r  &privatePutFuturesAccountIsolatedSymbolrC  %privatePutMarginAccountIsolatedSymbolr-   parse_margin_modificationr  )r  r  r  r  r  r  r   stringAmountrD  r   r   r  s               r  modify_margin_helperhitbtc.modify_margin_helper  sx   V$##FJ7&>'2x(xyy,,V43--fCFFTl$
 "*J

!??@TV\e
!??@TV\]
BB4;;wC_`HH$**>JR\D\AA$++gB^_Htww)]]^^& {{499(K''/N
  	r  datac                     U R                  US/ 5      nU R                  US5      nU R                  US5      nUUS   S SS S U R                  US5      S U R                  U5      US.
$ )Nr0  r   r  r  r  r*  )
r   r  r  r   r  totalr*  r  ru  rz  )r  r  r  )r  r  r  r0  currencyInforz  s         r  r   hitbtc.parse_margin_modification  s{    * __T<<
z15##D,7X&$$$\6:1 
 	
r  c                     U R                  U5      S:w  a  [        U R                  S-   5      eU R                  XSU5      $ )aT  
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reduce)r  r(   r  r  r  r  r  r  s       r  reduce_marginhitbtc.reduce_margin  sM       (C/TWW  (M  M  N  N((6JJr  c                 (    U R                  XSU5      $ )a5  
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>`
add)r  r  s       r  
add_marginhitbtc.add_margin   s     ((GGr  c                 @   U R                  5         U R                  U5      nSUS   0nSnU R                  SU5      u  pRU R                  USS/5      nSnUb!  U R	                  U R                  XB5      5      nOUS   S:X  a!  U R	                  U R                  XB5      5      nOlUS   S	:X  a!  U R                  U R                  XB5      5      nOBUS   S:X  a!  U R	                  U R                  XB5      5      nO[        U R                  S
-   5      eU R                  Xc5      $ )a'  
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>`
r  r  Nre   r   r=   r  r<   r>   z- fetchLeverage() not support self market type)
r?  r  r  rA  r  rC  r  r-   r  parse_leverage)r  r  r  r  rD  r   r  s          r  fetch_leveragehitbtc.fetch_leverage  s    	V$fTl
 
!??QWX
6L(#;<!AA$++gB^_Hf~'EEdkkRYFbc6)FFt{{SZGcd8+EEdkkRYFbc"477-\#\]]> ""844r  r   c                     U R                  US5      nU R                  US5      nUU R                  X25      U R                  US5      UUS.$ )Nr  r   r  )r   r  r   longLeverageshortLeverage)r  r	  r  rY  )r  r   r  rp  leverageValues        r  r&  hitbtc.parse_leverageQ  sW    ##Hh7))(J?&&x8006B)*
 	
r  c                 :   Uc  [        U R                  S-   5      eU R                  5         US   c  [        U R                  S-   5      eU R                  U5      nU R	                  US5      nU R                  US   S   SS5      nUS   S	:w  a  [        U R                  S
-   5      eUS:  d  X:  a*  [        U R                  S-   [        U5      -   S-   U-   5      eUS   [        U5      U R                  X%5      S.nU R                  U R                  Xs5      5      $ )a-  
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
z) 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(   strrS  r  rC  )r  r   r  r  r  r  maxLeveragerD  s           r  set_leveragehitbtc.set_leverage\  s5    >#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6vF
 ::4;;w;WXXr  codesc                 f    U R                  5         U R                  U5      nU R                  X15      $ )a$  
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>`
)r?  r+  parse_deposit_withdraw_fees)r  r4  r  r  s       r  fetch_deposit_withdraw_fees"hitbtc.fetch_deposit_withdraw_fees{  s3     	//74 //@@r  c                    U R                  US/ 5      nU R                  U5      n[        S[        U5      5       H  nX5   nU R	                  US5      nU R                  U5      nUb  UR                  5       OS nU R                  US5      n	U R                  US5      n
U	U	b  SOS S.nU
SL a  XS	'   US S S.S
.US   U'   M     U$ )Nr  r   r   r!  r   F)r%  r   Tr   )r   r&  )r  deposit_withdraw_feer  r  r  r-  r.  r  )r  r%  r;  r  r  r4  networkEntryr6  r7  withdrawFee	isDefaultwithdrawResults               r  parse_deposit_withdraw_fee!hitbtc.parse_deposit_withdraw_fee  s    0 ??3
B7**3/q#h-(A#;L((yAI11)<K2=2I+++-PTK**<FKi@I"(3(?ed$N D %3z"*"&/F:{+ )( r  c                     U R                  5         SnU R                  SUS5      u  pCU R                  U5      nUS   US.nU R                  U R	                  Xc5      5      nU R                  Xu5      $ )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>`
NrD   rm  r  )r  rn  )r?  r  r  ,privateDeleteFuturesPositionMarginModeSymbolrC  r0  )r  r  r  r  r   r  rD  r  s           r  close_positionhitbtc.close_position  s|     	
!??QWY`a
V$Tl%
 DDT[[QXEab  11r  c                    > U R                  U R                  S5      nU R                  USS5      nSn[        [        U ]  XU5      u  pbUc  US:X  d  USL a  SnXb/$ )aM  
@ignore
       marginMode specified by params["marginMode"], self.options["marginMode"], self.options["defaultMarginMode"], params["margin"] = True or self.options["defaultType"] = 'margin'
       :param dict [params]: extra parameters specific to the exchange API endpoint
       :returns Array: the marginMode in lowercase
       defaultTyper=   FNTr  )r  r  r
  r  r4   r  )r  
methodNamer  defaultValuerF  isMarginr   r  s          r  r  $hitbtc.handle_margin_mode_and_params  sl     &&t||]C>>&(E:
"64Nzcop
x'X-='
##r  reasonurlmethodheadersbodyc
                 .   U R                  US5      n
U R                  U
S5      nUbn  U R                  S-   U-   nU R                  U
SS5      nU R	                  U R
                  S   X5        U R                  U R
                  S   X5        [        U5      eg )Nerrorr*   messagedescriptionr(  r)  )r  r  r  r  throw_exactly_matched_exceptionr  throw_broadly_matched_exceptionr#   )r  r*  rK  rL  rM  rN  rO  r  requestHeadersrequestBodyrQ  	errorCodefeedbackrS  s                 r  handle_errorshitbtc.handle_errors	  s    " '2$$UF3	 ww}t+H((	=IG001I9_001I7]))r  r   r  c                 ^   U R                  X@R                  U5      5      nU R                  X5      nU R                  S   U   S-   U-   n	S n
[	        UR                  5       5      n[        U5      nSS0nUS:X  a   U(       a  SU R                  U5      -   n
X-   n	OU R                  U5      nUS:X  a  U R                  5         [        U R                  5       5      nUSU-   /nUS:X  a  U
b  UR                  U
5        OUR                  U5        UR                  U5        S	R                  U5      nU R                  U R                  U5      U R                  U R                   5      ["        R$                  S
5      nU R&                  S-   U-   S-   U-   nU R)                  U5      nSU-   US'   XXeS.$ )Nr   r  zContent-Typezapplication/jsonr  ?r   z/api/3/ hexr  zHS256 Authorization)rL  rM  rO  rN  )rA  extract_paramsimplode_paramsr  r  r  r  	urlencodejsoncheck_required_credentialsr0  r  r  r]  hmacencodesecrethashlibsha256apiKeystring_to_base64)r  pathr   rM  r  rN  rO  r  implodedPathrL  
getRequestr  queryLengthru  payloadpayloadString	signaturesecondPayloadencodeds                      r  signhitbtc.sign$  s   		&"5"5d";<**48iis#c)L8
EJJL!$i.
 U? 4>>%#88
&99V$D)++-DJJL)Iy<78G)NN:.t$NN9%GGG,M		$++m"<dkk$++>VX_XfXfhmnI KK#-	9C?)KM++M:G'/''9GO$dOOr   r  )o__name__
__module____qualname____firstlineno__r   r  r  r"   r   r  r   r8  r0  r	   rF  rL  r   rU  r^  r   rd  r   r   rq  dictrb  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,  r1  r5  r;  rB  rI  rO  r   r   r   rX  floatr_  objectr[  r{  r0  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&  intr2  r7  r?  rC  r  r[  rw  __static_attributes____classcell__)r  s   @r  r4   r4      sx   j# jX# $& I$v, IV ') dZ dL 8: !
3 !
n !
F 79 %
# %
^ %
N
) 
) $& $,( $,L 02 33 3f 3> 04B )GW )G7 )GV)4 ) )6 )V 6:UW $3 $s $# $\`af\g $L -1tRV_a +Ac +A +AC +AZc cv c cJ&QP:s :3R
T R
X R
Q\ R
h 6:[_hj ^s ^# ^UX ^ost  pA ^ *.Dt\^ U3 Uc U Ucghsct U -1tRV_a Vc V VC Vfjkvfw V 48dSU   Zd : :>b Ps P3 PY P,
T 
6 
EX 
* 57 8 8;N 8> )+ !{ !F 9=4^bkm GL# GL# GLS GLX[ GLrvw{r| GLR
 
4 
B 154VZce ,U# ,US ,UPS ,Ujnotju ,U\ 26b ;/c ;/3 ;/z 9=4^bkm OAS OA# OAS OAX[ OAb /3TXac :A :A3 :Ac :Ahlmrhs :Ax 7;2 '23 '2 '2R /32 %3 %3N 37r '2s '2C '2R `drv  @B 2S 2# 2Y 2i 2Y\ 2lo 2@ gksu $23 $2i $2y $2RW $2`c $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 7;2 <B$s) <B+ <B|
D 
* 
 [] $7S $7% $7c $7c $7an $7L
t 
x 
= 
(
S 
2 KOWY ):S ):% ):# ):C ):^i ):V 6:" 1E7 1E 1Ef 8<$]ajl IO IOC IOWZ IOV 26b Cw CT(^ CJ 24 A5S A5FRt RV RhF 6 7;2 )@G )@V 79 !:# !:F 68 !9 !9K !9F%
6 %
[ %
N FH 43 4L^ 4l#
d #
F #
N` #
J @B KC K KFX K$ =? H He HCU H  24 ?5S ?5 ?5B	
t 	
V 	
x 	
 9=R YS Y# Y> <@ %A %AN. .` =A %2S %2	 %2PU %2N @BPT $ # s  c TX `c 6 &eBSW P Pr  r4   )9ccxt.base.exchanger   ccxt.abstract.hitbtcr   rj  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   ry  r  r  <module>r     s    ( ,  V  V  V  V  V  V  V  V  * 0 - - . ' & . ) * ) . 1 * 4 %f8PX{ f8Pr  