
    E#iD                       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  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\\5      r)g)    )Exchange)ImplicitAPIN)AnyBalances
CurrenciesCurrencyDepositAddressIntMarketNumOrder	OrderBook	OrderSide	OrderTypeStrStringsTickerTickers
OrderBooksTradeTradingFeesTransaction)List)AuthenticationError)ArgumentsRequired)
BadRequest)InsufficientFunds)OrderNotFound)OrderImmediatelyFillable)NetworkError)InvalidNonce)	TICK_SIZE)Precisec                   `  ^  \ rS rSrS\4U 4S jjr0 4S\\   4S jjr0 4S\	4S jjr
SS0 4S\S\S\4S	 jjrS0 4S
\S\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S0 4S\S\4S jjrSHS\S\S\4S jjrSS0 4S
\S\S\S\\   4S jjrSHS\S\S\4S jjr0 4S\4S jjrSSS0 4S
\S\S\S\S\\   4
S jjrSHS\S\4S jjr S\!4S jr"0 4S\!4S jjr#S0 4S\S
\$4S jjr%S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0 4S\S
\$4S! jjr)SSS0 4S
\$S\S\S\\&   4S" jjr*S#\$4S$ jr+SHS%\S\S\&4S& jjr,S0 4S
\S'\-S(\.S)\/S*\04
S+ jjr1S0 4S\S
\$4S, jjr2S0 4S
\$4S- jjr3SSS0 4S
\$S\S\4S. jjr4SHS/\5S\64S0 jjr7S0 4S1\S\\6   4S2 jjr8SSS0 4S3\$S\S\S\\9   4S4 jjr:S0 4S\S3\$4S5 jjr;SSS0 4S3\$S\S\S\\9   4S6 jjr<SHS7\S/\5S\94S8 jjr=S0 4S3\S)\/S9\S:\$S\94
S; jjr>SHS/\54S< jjr?S0 4S1\4S= jjr@S>S?0 SS4S@ jrAS3\BSA\SB\SC\SD\SE\4SF jrCSGrDU =rE$ )Ihollaex   returnc                   > U R                  [        [        U ]  5       0 SS_SS_SS/_SS_S	S
_SS_S0 SS _SS_SS _SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_0 S S_S!S_S"S_S#S_S$S_S%S_S&S_S'S_S(S_S)S*_S+S_S,S_S-S_S.S_S/S_S0S_S1S_E0 S2S_S3S_S4S_S5S_S6S_S7S_S8S_S9S_S:S_S;S_S<S_S=S_S>S_S?S_S@S_SAS_SBS_E0 SCS_SDS_SES_SFS_SGS_SHS_SIS_SJS_SKS_SLS_SMS_SNS_SOS_SPS_SQS_SRS_SSS_ESSSSST.E_SUSVSWSXSYSZS[S\S]._S^S_S`Sa0S`Sb0ScSdSeSf._Sg[        _ShSSSi._SjSk0 SlSm_SnSm_SoSm_SpSm_SqSm_SrSm_SsSm_StSm_SuSm_SvSm_SwSm_SxSm_SySm_SzSm_S{Sm_S|Sm_S}Sm_0SmSmSmSmSmSmSmSmS~.SmSmS.SmSmS.S.S._SS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SSSSS.SSSSSSSS.SSSSmSSSSS.SS0S.	S S S.S S S.S._SSSSSSS.0_S[
        [        [        [        [        S.[        [        [        [        [        [        [        [        S.S._SU R                  U R                  S-  5      SSSSSSSSSS.	SSSSSSS.S._5      $ )Nidr%   nameHollaEx	countriesKR	rateLimit   versionv2proThasCORSspotmarginswapFfutureoption	addMargincancelAllOrderscancelOrdercreateLimitBuyOrdercreateLimitSellOrdercreateMarketBuyOrdercreateMarketSellOrdercreateOrdercreatePostOnlyOrdercreateReduceOnlyOrdercreateStopLimitOrdercreateStopMarketOrdercreateStopOrderfetchBalancefetchBorrowRateHistoriesfetchBorrowRateHistoryfetchClosedOrdersfetchCrossBorrowRatefetchCrossBorrowRatesfetchCurrenciesfetchDepositAddressemulatedfetchDepositAddressesfetchDepositAddressesByNetworkfetchDepositsfetchFundingHistoryfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchIndexOHLCVfetchIsolatedBorrowRatefetchIsolatedBorrowRatesfetchLeveragefetchMarginModefetchMarketsfetchMarkOHLCVfetchMyTrades
fetchOHLCVfetchOpenInterestHistoryfetchOpenOrderfetchOpenOrders
fetchOrderfetchOrderBookfetchOrderBooksfetchOrdersfetchPositionfetchPositionModefetchPositionsfetchPositionsRiskfetchPremiumIndexOHLCVfetchTickerfetchTickersfetchTradesfetchTradingFeefetchTradingFeesfetchTransactionsfetchTransferfetchTransfersfetchWithdrawalfetchWithdrawalsreduceMarginsandboxsetLeverage)setMarginModesetPositionModetransferwithdraw
timeframes1m5m15m1h4h1d1w)r~   r   r   r   r   r   r   urlszchttps://user-images.githubusercontent.com/1294454/75841031-ca375180-5ddd-11ea-8417-b975674c23cb.jpgrestzhttps://api.sandbox.hollaex.comzhttps://api.hollaex.comzhttps://hollaex.comzhttps://apidocs.hollaex.comz6https://pro.hollaex.com/signup?affiliation_code=QSWA6G)logotestapiwwwdocreferralprecisionModerequiredCredentials)apiKeysecretr   gethealth   	constantskittierstickertickers	orderbook
orderbookstradeschartcharts
minichartszoracle/priceszquick-tradez
udf/configzudf/historyzudf/symbols)userzuser/balancezuser/depositszuser/withdrawalszuser/withdrawal/feezuser/tradesordersorder)zuser/withdrawalr   )z	order/allr   )r   postdelete)publicprivatefeatures)IOCFOKPOGTD)
marginModetriggerPricetriggerPriceTypetriggerDirectionstopLossPricetakeProfitPriceattachedStopLossTakeProfittimeInForcehedgedselfTradePreventiontrailingleveragemarketBuyByCostmarketBuyRequiresPriceicebergd   i )r   limitdaysBack	untilDayssymbolRequired)r   triggerr   r   )r   r   r   r   r   )r   r   r   r   r   r   r   )r   r   r   daysBackCanceledr   r   r   r   r     )	rw   rA   createOrdersr^   rc   rb   rf   rJ   r_   )linearinverse)r5   r7   r8   feestradinggMbP?)	tierBased
percentagetakermaker
exceptions)zAPI request is expiredzInvalid tokenzOrder not foundzInsufficient balancez]Error 1001 - Order rejected. Order could not be submitted order was set to a post only order.)400403404405410429500503)broadexactoptionsbtcethtrxxrpxlmbnbmatic)	BTCETHERC20TRXTRC20XRPXLMBNBMATICr   r   )r   r   r   r   r   r   )api-expiresnetworksnetworksById)deep_extendsuperr%   describer"   r!   r   r   r   r   r   r    parse_to_inttimeout)self	__class__s    T/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/async_support/hollaex.pyr   hollaex.describe   s   gt = ? XB
)XB
IXB
 $XB

 XB
 tXB
 4XB
  III $I 	I
 %I %I UI "4I tI &tI 'I 'I (I tI &tI  (!I" '#I$ (%I& "4'I( )I* +E+I, )%-I. $T/I0 '1I2 (3I4 "45I6 &z7I8 (9I: 1%;I<  =I> &u?I@ #EAIB *5CID $UEIF "5GIH *5IIJ +EKIL  MIN "5OIP QIR !%SIT  UIV dWIX +EYIZ !$[I\ "4]I^ d_I` !$aIb "4cId teIf  gIh $UiIj !%kIl %emIn )%oIp tqIr sIt tuIv "5wIx #DyIz $U{I|  }I~ !%I@ "4AIB #DCID EIF 4GIH uIIJ "'#(! QIXB
d eXB
v }= 5 -4TwXB
N YOXB
P "$QXB
X   !#Q q  	
 !! "1 $Q %a !!   !! %a ( &q  %a!" &q#$ &q%0 !"())*,-/0'("#!"	 ,-!"
 &'!"/+YXB
p #&+(,,0,1).+06:#(#("&#(	( #(/4$)$)+027#()$, %)&+!$$*%+*/& ',#($)*/	# ',!$#($)*/( ',!$$*%+#($)*/$ ',!$$*,-%+#($)*/	*  #ACJ ##
 ##SMqXB
L !%"&""	MXB
\ .:%8'4,= vN &.%%%%''	]XB
B #001DE  " "   $
 #"$""$!CXB
 X X	    c                   #    U R                  U5      I Sh  vN nU R                  US0 5      n[        UR                  5       5      n/ n[	        S[        U5      5       GHx  nXF   nX7   nU R                  US5      n	U R                  US5      n
U R                  U	R                  5       5      nU R                  U
R                  5       5      nUR                  0 SU R                  US5      _SUS	-   U-   _S
U_SU_SS_SU	_SU
_SS_SS_SS_SS_SS_SS_SS_SU R                  US5      _SS_SS_SSSSSSU R                  US5      U R                  US5      S.SSS.U R                  US5      U R                  US 5      S.U R                  US!5      U R                  US"5      S.SSS.S#.U R                  U R                  US$5      5      US%.
E5        GM{     U$  GN7f)&z
retrieves data on all markets for hollaex

https://apidocs.hollaex.com/#constants

:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: an array of objects representing market data
Npairsr   	pair_basepair_2r)   r*   symbol/basequotesettlebaseIdquoteIdsettleIdtyper5   Tr6   Fr7   r8   r9   activecontractr   increment_sizeincrement_price)amountpriceminmaxmin_sizemax_size	min_price	max_price)r   r  r  cost
created_at)
r   contractSizeexpiryexpiryDatetimestrike
optionType	precisionlimitscreatedinfo)publicGetConstants
safe_valuelistkeysrangelensafe_stringcommon_currency_codeupperappendsafe_number	parse8601)r   paramsresponser   r  resultikeymarketr   r   r   r   s                r   fetch_marketshollaex.fetch_markets4  s     0088Z '26EJJL!q#d)$A'CZF%%fk:F&&vx8G,,V\\^<D--gmmo>EMM 0d&&vv60$*u,0 0 	0
 $0 &0 70 D0 0 0 %0 0 %0 %0 $//&(;0  E!0" $#0$   $"&""..v7GH!--f6GH  $#!
  $//
C#//
C
  $//D#//D
  $#$  >>$*:*:6<*PQ_0 0 %p Q 9s   G!GGG!c                 r  #    U R                  U5      I Sh  vN nU R                  US0 5      n[        UR                  5       5      n0 n[	        S[        U5      5       GH  nXF   nX7   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S:X  a  SOS	nU R                  US
0 5      n0 n[        UR                  5       5      n[	        S[        U5      5       H_  nUU   nU R                  UU5      nU R                  U5      nUUU R                  US5      SSU R                  US5      SSSSS.0US.	UU'   Ma     U R                  U	U R                  US5      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 R                  US5      U R                  US5      U R                  US5      S.SU R                  US5      S.S.UUS.5      XZ'   GM     U$  GN7f)z
fetches all available currencies on an exchange

https://apidocs.hollaex.com/#constants

:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: an associative dictionary of currencies
Ncoinsr   r   withdrawal_limitsr   
blockchaincryptootherwithdrawal_feesr  valuer|   r  )	r)   networkr  depositr|   feer  r  r  r)   fullnameallow_depositallow_withdrawalwithdrawal_feeincrement_unitr  r	  )r  r|   )r)   	numericIdcoder  r*   r  r6  r|   r7  r  r  r   r   )r  	safe_dictr  r  r  r  r  safe_currency_code	safe_listnetwork_id_to_code	safe_boolr#  safe_currency_structuresafe_integerr  )r   r%  r&  r.  r  r'  r(  r)  currencyr)   r>  withdrawalLimitsrawTyper   rawNetworksr   
networkIdsj	networkIdnetworkEntrynetworkCodes                        r   fetch_currencieshollaex.fetch_currencies  sa     0088F x"5EJJL!q#d)$A'CzH!!(H5B**2.D#~~h8KRP&&x8G '< 78gD..3DbIKHk..01J1c*o.&qM	#~~k9E"55i@#*"nn\8D# $++L'B!%"#'#'% ))%	 /(  77!..x> ((:>..8<>>(OD NN85GH''2BC!--h8HI  $//%@#//%@
  $#/?C!	 %-9 FL? %n { 9s   H7H4HH7Nsymbolsr   c                   #    U R                  5       I Sh  vN   U R                  U5      I Sh  vN n0 n[        UR                  5       5      n[	        S[        U5      5       HU  nXg   nXH   n	U R                  USS5      n
U R                  U R                  U	S5      5      nU R                  XH   X5      XZ'   MW     U$  N N7f)a  
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data for multiple markets

https://apidocs.hollaex.com/#orderbooks

:param str[]|None symbols: not used by hollaex fetchOrderBooks()
:param int [limit]: not used by hollaex fetchOrderBooks()
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbol
Nr   -	timestamp)
load_marketspublicGetOrderbooksr  r  r  r  safe_symbolr$  r  parse_order_book)r   rQ  r   r%  r&  r'  	marketIdsr(  marketIdr   r   rT  s               r   fetch_order_bookshollaex.fetch_order_books/  s      !!!11&99)	q#i.)A |H *I%%hc:Ft'7'7	;'OPI!2283EvYFN *  	"9s    CB?CCBCCr   c                 V  #    U R                  5       I Sh  vN   U R                  U5      nSUS   0nU R                  U R                  XS5      5      I Sh  vN nU R	                  XdS   5      nU R                  U R                  US5      5      nU R                  XtS   U5      $  N NP7f)a  
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data

https://apidocs.hollaex.com/#orderbook

:param str symbol: unified symbol of the market to fetch the order book for
:param int [limit]: the maximum amount of order book entries to return
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
Nr   r)   rT  )rU  r*  publicGetOrderbookextendr  r$  r  rX  )	r   r   r   r%  r*  requestr&  r   rT  s	            r   fetch_order_bookhollaex.fetch_order_bookF  s      !!!V$fTl
 00W1MNN( OOHTl;	NN4#3#3I{#KL	$$Yx0@)LL7 	"
 Os"   B)B%?B)B'AB)'B)c                    #    U R                  5       I Sh  vN   U R                  U5      nSUS   0nU R                  U R                  XB5      5      I Sh  vN nU R	                  XS5      $  NU N7f)a  
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market

https://apidocs.hollaex.com/#ticker

:param str symbol: unified symbol of the market to fetch the ticker for
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
Nr   r)   )rU  r*  publicGetTickerr_  parse_ticker)r   r   r%  r*  r`  r&  s         r   fetch_tickerhollaex.fetch_tickern  ss      !!!V$fTl
 --dkk'.JKK   22# 	"
 Ls!   A0A,?A0A.A0.A0c                    #    U R                  5       I Sh  vN   U R                  U5      nU R                  U5      I Sh  vN nU R                  X15      $  N? N7f)a  
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market

https://apidocs.hollaex.com/#tickers

:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
N)rU  market_symbolspublicGetTickersparse_tickers)r   rQ  r%  r&  s       r   fetch_tickershollaex.fetch_tickers  sW      !!!%%g...v66  !!(44% 	"6s!   AA)A AAAc                 B   0 n[        UR                  5       5      n[        S[        U5      5       HY  nXV   nX   nU R	                  USU5      n	U R                  U	S S5      n
U
S   nU R                  U R                  X5      U5      XK'   M[     U R                  USU5      $ )Nr   r   rS  )	r  r  r  r  r  safe_marketr_  re  filter_by_array_tickers)r   r   rQ  r%  r'  r  r(  r)  r   rZ  r*  r   s               r   rk  hollaex.parse_tickers  s    GLLN#q#d)$A'C\F''#>H%%hc:FH%F![[):):6)JFSFN % ++FHgFFr   r   r*  c           	         U R                  US5      nU R                  X2S5      nUS   nU R                  U R                  USS5      5      nU R                  US5      nU R	                  0 SU_SU_SU_SU R                  U5      _SU R                  US5      _S	U R                  US	5      _S
S _SS _SS _SS _SS _SU R                  US5      _SU_SU R                  USU5      _SS _SS _SS _S U R                  US5      S S.EU5      $ )Nr   rS  timerT  closer  datetimehighlowbid	bidVolumeask	askVolumevwapopenlastpreviousClosechanger   volume)average
baseVolumequoteVolume)r  ro  r$  safe_string_2safe_tickeriso8601)r   r   r*  rZ  r   rT  rt  s          r   re  hollaex.parse_ticker  s   6 ##FH5!!(C8!NN4#5#5ffk#RS	  1 !
f!
F!
 !
 Y/	!

 D$$VV4!
 4##FE2!
 4!
 !
 4!
 !
 D!
 D$$VV4!
 U!
 D$$VVU;!
 T!
  d!!
" $#!
$ **68<)!
* + 	r   sincec                   #    U R                  5       I Sh  vN   U R                  U5      nSUS   0nU R                  U R                  Xd5      5      I Sh  vN nU R	                  XuS   / 5      nU R                  XX#5      $  Nk N-7f)a  
get the list of most recent trades for a particular symbol

https://apidocs.hollaex.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)   )rU  r*  publicGetTradesr_  rA  parse_trades)	r   r   r  r   r%  r*  r`  r&  r   s	            r   fetch_tradeshollaex.fetch_trades  s      !!!V$fTl
 --dkk'.JKK ,;  >>) 	"
 Ls!   BB?BB,BBtradec                    U R                  US5      nU R                  X2S5      nUS   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 R                  US5      n	U R                  US5      n
U R                  US5      nU R                  US	5      nS nUb  UU R                  U5      S
.nU R	                  US UUUUS US U	U
S US.U5      $ )Nr   rS  rT  sideorder_idr  sizer7  fee_coin)r  rF  )r  r)   rT  ru  r   r   r   r  takerOrMakerr  r  r  r7  )r  ro  r$  r@  
safe_trade)r   r  r*  rZ  r   ru  rT  r  orderIdpriceStringamountStringfeeCostStringfeeCoinr7  s                 r   parse_tradehollaex.parse_trade  s%   . ##E84!!(C8!##E;7NN8,	v.""5*5&&ug6''v6((6""5*5$% 33G<C "   " 
  	r   c           
        #    U R                  5       I Sh  vN   U R                  U5      I Sh  vN nU R                  US0 5      nU R                  US0 5      nU R                  US0 5      nU R                  US0 5      n0 n[        S[	        U R
                  5      5       H  nU R
                  U   n	U R                  U	5      n
U R                  XZS   5      nU R                  XjS   5      nUU	U R                  [        R                  " US5      5      U R                  [        R                  " US5      5      S	S	S
.Xy'   M     U$  GN/ GN7f)a  
fetch the trading fees for multiple markets

https://apidocs.hollaex.com/#tiers

: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
N1r   r   r   r   r)   100T)r  r   r   r   r   r   )rU  publicGetTiersr  r  r  rQ  r*  r  parse_numberr#   
string_div)r   r%  r&  	firstTierr   	makerFees	takerFeesr'  r(  r   r*  makerStringtakerStrings                r   fetch_trading_feeshollaex.fetch_trading_feesF  s3     !!!,,V44: OOHc26	y&"5OOD'26	OOD'26	q#dll+,A\\!_F[[(F**9TlCK**9TlCK **7+=+=k5+QR**7+=+=k5+QR"!FN - a 	"4s    EEEEDEEr~   	timeframec           	        #    U R                  5       I Sh  vN   U R                  U5      nUS   U R                  U R                  X"5      S.nSnSn	U R	                  USSU5      u  pU(       a  U R                  SXXBXY5      I Sh  vN $ U R                  US5      n
U R                  U5      U	-  S	-  nUnU R                  5       nU
c
  Uc  Un
X-
  nOU
c  Un
OUc  X-
  nU R                  US	-  5      US
'   U R                  U
S	-  5      US'   U R                  US5      nU R                  U R                  Xu5      5      I Sh  vN nU R                  XX#U5      $  GNE N N7f)ae  
hollaex has large gaps between candles, so it's recommended to specify since

https://apidocs.hollaex.com/#chart

: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(max 500)
:param dict [params]: extra parameters specific to the exchange API endpoint
:param int [params.until]: timestamp in ms of the latest candle to fetch
:returns int[][]: A list of candles ordered, open, high, low, close, volume
Nr)   )r   
resolutionFi  r_   paginateuntilr   fromto)rU  r*  r  r}   handle_option_and_params"fetch_paginated_call_deterministicrE  parse_timeframemillisecondsr   omitpublicGetChartr_  parse_ohlcvs)r   r   r  r  r   r%  r*  r`  r  maxLimitr  	timeDeltastartnowr&  s                  r   fetch_ohlcvhollaex.fetch_ohlcv  s     !!!V$Tl**4??IQ
 88z[cd@@v^cpv  B  B  B!!&'2((3h>E	!=U]E%E]E]%E++EDL9))%$,767+,,T[[-IJJ   9UKKO 	" B Ks5   E"EA/E"EB<E"E E"E" E"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      /$ )Nrs  r}  rv  rw  rt  r  )r$  r  r#  )r   ohlcvr*  s      r   parse_ohlcvhollaex.parse_ohlcv  sw     NN4++E6:;UF+UF+UE*UG,UH-
 	
r   c                    U R                  U R                  US5      5      nUUU R                  U5      S.n[        U R                  R                  5       5      n[        S[        U5      5       HZ  nXE   nU R                  U5      nU R                  5       nU R                  XS-   5      US'   U R                  XS-   5      US'   XU'   M\     U R                  U5      $ )N
updated_at)r  rT  ru  r   
_availablefree_balancetotal)r$  r  r  r  currencies_by_idr  r  r  r@  accountsafe_balance)	r   r&  rT  r'  currencyIdsr(  
currencyIdr>  r  s	            r   parse_balancehollaex.parse_balance  s    NN4#3#3Hl#KL	"Y/

 4005578q#k*+A$J**:6DllnG"..xl9RSGFO#//z:QRGG"4L ,   ((r   c                    #    U R                  5       I Sh  vN   U R                  U5      I Sh  vN nU R                  U5      $  N. N7f)a,  
query for balance and get the amount of funds available for trading or funds locked in orders

https://apidocs.hollaex.com/#get-balance

:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
N)rU  privateGetUserBalancer  )r   r%  r&  s      r   fetch_balancehollaex.fetch_balance  sG      !!!33F;; !!(++ 	";s   A	AA	AA	A	r)   c                    #    U R                  5       I Sh  vN   SU0nU R                  U R                  XC5      5      I Sh  vN nU R                  U5      $  NA N7f)a8  
fetch an open order by it's id

https://apidocs.hollaex.com/#get-order

:param str id: order id
:param str symbol: not used by hollaex fetchOpenOrder()
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
Nr  )rU  privateGetOrderr_  parse_orderr   r)   r   r%  r`  r&  s         r   fetch_open_orderhollaex.fetch_open_order  sa      !!!
 --dkk'.JKK2 )); 	" L!   AA+AAAAc           	      h   #    SS0nU R                  XX0R                  XT5      5      I Sh  vN $  N7f)a  
fetch all unfilled currently open orders

https://apidocs.hollaex.com/#get-all-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
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
r}  TNfetch_ordersr_  r   r   r  r   r%  r`  s         r   fetch_open_ordershollaex.fetch_open_orders!  s7      D
 &&ve[[=YZZZZ   )202c           	      h   #    SS0nU R                  XX0R                  XT5      5      I Sh  vN $  N7f)a  
fetches information on multiple closed orders made by the user

https://apidocs.hollaex.com/#get-all-orders

: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
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
r}  FNr  r  s         r   fetch_closed_ordershollaex.fetch_closed_orders2  s7      E
 &&ve[[=YZZZZr  c                    #    U R                  5       I Sh  vN   SU0nU R                  U R                  XC5      5      I Sh  vN nUnUc  [        U R                  S-   U-   5      eU R                  U5      $  Na N77f)aO  
fetches information on an order made by the user

https://apidocs.hollaex.com/#get-order

:param str id:
:param str symbol: unified symbol of the market the order was made in
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
Nr  z& fetchOrder() could not find order id )rU  r  r_  r   r)   r  )r   r)   r   r%  r`  r&  r   s          r   fetch_orderhollaex.fetch_orderC  s      !!!
 --dkk'.JKK. =*R RUW WXX&&= 	" Ls!   A<A8+A<A:6A<:A<c                 X  #    U R                  5       I Sh  vN   Sn0 nUb  U R                  U5      nUS   US'   Ub  U R                  U5      US'   Ub  X6S'   U R                  U R	                  Xd5      5      I Sh  vN nU R                  US/ 5      nU R                  XX#5      $  N N+7f)a  
fetches information on multiple orders made by the user

https://apidocs.hollaex.com/#get-all-orders

: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
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
Nr)   r   
start_dater   data)rU  r*  r  privateGetOrdersr_  rA  parse_orders)	r   r   r  r   r%  r*  r`  r&  r  s	            r   r  hollaex.fetch_ordersn  s      !!!
 [[(F &tGH$(LL$7GL!$G..t{{7/KLL< ~~h3  u<<i 	"* M"   B*B&A%B*<B(=*B*(B*statusc                 4    SSSSS.nU R                  X!U5      $ )Nr}  closedcanceled)newpfilledfilledr  )r  )r   r  statusess      r   parse_order_statushollaex.parse_order_status  s*    "	
 &99r   r   c                    U R                  US5      nU R                  X2S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                  US5      nU R                  US5      n	U R                  US5      n
U R                  US	5      nU R                  U R                  US
5      5      nU R	                  US0 5      nU R                  USS5      nU R                  0 SU_SS _SU_SU R                  U5      _SS _S
U_SU_SU_SS _SU_SU_SU	_SU R                  US5      _SU
_S	U_SS _SS _S S US S.EU5      $ )Nr   rS  r)   r  r   r  r  r  r  r  meta	post_onlyFclientOrderIdrT  ru  lastTradeTimestampr   postOnlyr   stopr  	remainingr  )r   r7  r  r  )r  rW  r$  r  r  rC  
safe_orderr  )r   r   r*  rZ  r   r)   rT  r   r  r  r  r  r  r  r  s                  r   r  hollaex.parse_order  s   : ##E84!!(C8eT*NN4#3#3E<#HI	v.v.  0!!%0!!%2(()9)9%)JKufb1>>$U;  
" 
T 
  
 Y/	 

 !$ 
 f 
 f 
 D 
 4 
  
 D 
 U 
 D,,UF; 
 f 
 f 
  ! 
" D# 
$ + 
, - 	r   r   r  r  r  c                 T  #    U R                  5       I Sh  vN   U R                  U5      nUS   UU R                  X5      US.nU R                  U/ SQ5      n	U R	                  US0 5      n
U R                  U
SS5      nUS:H  nU R                  XU5      nU(       d  U R                  X5      US	'   U	b  U R                  X5      US
'   U(       a  SS0US'   U R                  U/ SQ5      nU R                  U R                  X5      5      I Sh  vN nU R                  X5      $  GN N7f)a  
create a trade order

https://apidocs.hollaex.com/#create-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 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
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
Nr)   )r   r  r  r   )r   	stopPricer  r  r  Fr*  r  r  T)r  r   r  r   r  )rU  r*  amount_to_precisionsafe_number_nr  rC  is_post_onlyprice_to_precisionr  privatePostOrderr_  r  )r   r   r   r  r  r  r%  r*  r`  r   r  exchangeSpecificParamisMarketOrderr  r&  s                  r   create_orderhollaex.create_order  s.      !!!V$Tl,,V<	
 ))&2WXvvr2 $t[% H($$]6R#66vEGG#"55fKGFO*D1GFO6#cd..t{{7/KLL0 11] 	", Ms"   D(D#C6D(D&D(&D(c                    #    U R                  5       I Sh  vN   SU0nU R                  U R                  XC5      5      I Sh  vN nU R                  U5      $  NA N7f)a@  
cancels an open order

https://apidocs.hollaex.com/#cancel-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
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
Nr  )rU  privateDeleteOrderr_  r  r  s         r   cancel_orderhollaex.cancel_order:  sa      !!!
 00W1MNN ))% 	" Or  c                 $  #    Uc  [        U R                  S-   5      eU R                  5       I Sh  vN   0 nSnU R                  U5      nUS   US'   U R	                  U R                  X25      5      I Sh  vN nU R                  XT5      $  NZ N7f)aI  
cancel all open orders in a market

https://apidocs.hollaex.com/#cancel-all-orders

:param str symbol: unified market symbol of the market to cancel orders in
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
Nz- cancelAllOrders() requires a symbol argumentr)   r   )r   r)   rU  r*  privateDeleteOrderAllr_  r  )r   r   r%  r`  r*  r&  s         r   cancel_all_ordershollaex.cancel_all_ordersY  s      >#DGG.]$]^^!!!V$"4L33DKK4PQQ    22+ 	"
 Rs"   /BBAB6B7BBc                 X  #    U R                  5       I Sh  vN   0 nSnUb  U R                  U5      nUS   US'   Ub  X5S'   Ub  U R                  U5      US'   U R                  U R	                  XT5      5      I Sh  vN nU R                  US/ 5      nU R                  XX#5      $  N N+7f)a  
fetch all trades made by the user

https://apidocs.hollaex.com/#get-trades

: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
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
Nr)   r   r   r  r  )rU  r*  r  privateGetUserTradesr_  rA  r  )	r   r   r  r   r%  r`  r*  r&  r  s	            r   fetch_my_tradeshollaex.fetch_my_trades|  s      !!!
 [[(F &tGH$G$(LL$7GL!224;;w3OPP  ~~h3  u<<G 	"$ Qr  rF  c                 <   U R                  US5      nS nUb5  UR                  S5      nU R                  US5      nU R                  US5      nU R                  U5        U R                  US5      nU R                  Xb5      nU R                  US5      nUUS   UUUS.$ )	Naddress:r   r   rF  r5  r>  )r  rF  r5  r  tag)r  splitcheck_addresssafe_currency)r   depositAddressrF  r  r  partsr  r5  s           r   parse_deposit_addresshollaex.parse_deposit_address  s     "">9=MM#&E&&ua0G""5!,C7#%%njA
%%j;"">9=" (
 	
r   codesc                 4  #    U R                  5       I Sh  vN   U R                  US5      nU R                  US5      nU R                  U5      I Sh  vN nU R	                  US/ 5      nUc  UOU R                  USU5      nU R                  Xa5      $  N} NB7f)a]  
fetch deposit addresses for multiple currencies and chain types

https://apidocs.hollaex.com/#get-user

:param str[]|None codes: list of unified currency codes, default is None
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a list of `address structures <https://docs.ccxt.com/#/?id=address-structure>`
Nr5  wallet)rU  r  r  privateGetUserr  	filter_byparse_deposit_addresses)r   r%  r%  r5  r&  r'  	addressess          r   fetch_deposit_addresseshollaex.fetch_deposit_addresses  s      !!!""69569-,,V44\ 8R8&FT^^FIW^5_	++I==g 	" 5s"   BB<BBABBr>  c                 X  #    U R                  5       I Sh  vN   0 nSnUb  U R                  U5      nUS   US'   Ub  X5S'   Ub  U R                  U5      US'   U R                  U R	                  XT5      5      I Sh  vN nU R                  US/ 5      nU R                  XX#5      $  N N+7f)a  
fetch all deposits made to an account

https://apidocs.hollaex.com/#get-deposits

: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>`
Nr)   rF  r   r  r  )rU  rF  r  privateGetUserDepositsr_  rA  parse_transactions	r   r>  r  r   r%  r`  rF  r&  r  s	            r   fetch_depositshollaex.fetch_deposits	  s      !!!
 }}T*H"*4.GJ$G$(LL$7GL!44T[[5QRR0 ~~h3&&tuDDW 	"$ Sr  c                 D  #    U R                  5       I Sh  vN   SU0nSnUb  U R                  U5      nUS   US'   U R                  U R                  XC5      5      I Sh  vN nU R	                  US/ 5      nU R                  US0 5      nU R                  X5      $  N N=7f)a  
fetch data on a currency withdrawal via the withdrawal id

https://apidocs.hollaex.com/#get-withdrawals

:param str id: withdrawal id
:param str code: unified currency code of the currency withdrawn, default is None
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
Ntransaction_idr)   rF  r  r   )rU  rF  privateGetUserWithdrawalsr_  r  r?  parse_transaction)	r   r)   r>  r%  r`  rF  r&  r  transactions	            r   fetch_withdrawalhollaex.fetch_withdrawalB  s      !!!b
 }}T*H"*4.GJ77G8TUU0 x4nnT1b1%%k<<E 	" Vs"   B BA	B  B!<B B c                 X  #    U R                  5       I Sh  vN   0 nSnUb  U R                  U5      nUS   US'   Ub  X5S'   Ub  U R                  U5      US'   U R                  U R	                  XT5      5      I Sh  vN nU R                  US/ 5      nU R                  XX#5      $  N N+7f)a  
fetch all withdrawals made from an account

https://apidocs.hollaex.com/#get-withdrawals

: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>`
Nr)   rF  r   r  r  )rU  rF  r  r6  r_  rA  r0  r1  s	            r   fetch_withdrawalshollaex.fetch_withdrawalsq  s      !!!
 }}T*H"*4.GJ$G$(LL$7GL!77G8TUU0 ~~h3&&tuDDW 	"$ Vr  r8  c                    U R                  US5      nU R                  US5      nU R                  U R                  US5      5      nU R                  U R                  US5      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 nS nU	b9  U	R                  S5      nU R                  US	5      n	U R                  US
5      nU	n
UnU R                  US5      nU R	                  UU5      nU R                  US5      nU R                  US5      nU R                  US5      nU(       a  SnOU(       a  SnOU(       a  SnOSnU R                  US5      nU R                  UU5      nU R                  US5      nS nUb  UUS.n0 SU_SU_SU_SU_SU R                  U5      _SS _SU_SU	_SU
_SU_SU_SU_SU_SU_SUS    _SU_S!U_U R                  US"5      S US#.E$ )$Nr)   r5  r  r  r   r  r  r  r   r   rF  r  	dismissedrejectedokr  failedpendingr  r7  )rF  r  r  txidrT  ru  r5  addressFrom	addressTotagFromr  tagTor>  updatedmessage)commentinternalr7  )r  r$  r#  r  r   r  r@  r  )r   r8  rF  r)   rD  rT  rI  r   r  r  rF  rE  r  rH  rG  r"  r  r  r?  r@  feeCurrencyIdfeeCurrencyCodefeeCostr7  s                           r   r7  hollaex.parse_transaction  s   @ k40-=>NN4#3#3K#NO	..!1!1+|!LMV4!!+x8"";	:	MM#&E&&ua0G""5!,CIE%%k:>
%%j(;h7OOK=	??;
;FFFF((jA11-J"";6+C
K
"
 D
 	

 Y/
 t
 ;
 w
 
 w
 3
 U
 D
 f
 (
  f!
" w#
$ ''Y?)
 	
r   r  r  c                   #    U R                  XE5      u  pEU R                  U5        U R                  5       I Sh  vN   U R                  U5      nUb  USU-   -  nU R	                  US5      nUc  [        U R                  S-   5      eU R                  US5      nUS   UUU R                  Xq5      S.nU R                  U R                  X5      5      I Sh  vN n	U R                  X5      $  N N7f)ay  
make a withdrawal

https://apidocs.hollaex.com/#withdrawal

:param str code: unified currency code
:param float amount: the amount to withdraw
:param str address: the address to withdraw to
:param str tag:
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
Nr  r5  z( withdraw() requires a network parameterr)   )rF  r  r  r5  )handle_withdraw_tag_and_paramsr  rU  rF  r  r   r)   r  network_code_to_idprivatePostUserWithdrawalr_  r7  )
r   r>  r  r  r  r%  rF  r5  r`  r&  s
             r   r|   hollaex.withdraw	  s      99#F7#!!!==&?sSy G""695?#DGG.X$XYY69- ..w=	
 77G8TUU %%h993 	" Vs"   8C0C,BC0C.C0.C0c                    US S S.S S S.0 S.nU R                  US5      nU(       a  U R                  US5      SS.US'   U R                  US5      nUb  [        UR                  5       5      n[	        U5      n[        SU5       Hl  nXh   n	XY   n
U R                  U
S	5      nU R                  U5      nU R                  X5      nUR                  5       nU R                  U
S
5      nS US.US   U'   Mn     U$ )N)r7  r   )r  r|   r6  r   r:  r;  Fr|   r3  r   r   r4  )r6  r|   r   )
r  r#  r  r  r  r  r  r@  rB  r!  )r   r7  rF  r'  allowWithdrawalwithdrawalFeesr  
keysLengthr(  r)  r4  r  currencyCoderN  networkCodeUpperwithdrawalFees                   r   parse_deposit_withdraw_fee"hollaex.parse_deposit_withdraw_fee3  s%   @ "
 " 
 //#/AB)-)9)9#?O)P`e!fF:.?@%++-.DTJ1j)g&+!--eX>
#66zB"55cH#.#4#4#6  $ 0 0 @# -8z"#34 * r   c                    #    U R                  U5      I Sh  vN nU R                  US0 5      nU R                  XAS5      $  N)7f)a%  
fetch deposit and withdraw fees

https://apidocs.hollaex.com/#constants

:param str[]|None codes: list of unified currency codes
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a list of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>`
Nr.  r   )r  r?  parse_deposit_withdraw_fees)r   r%  r%  r&  r.  s        r   fetch_deposit_withdraw_fees#hollaex.fetch_deposit_withdraw_feess  sH      0088H x"5//hGGK 9s   AA*Ar   GETc           	         U R                  X@R                  U5      5      nSU R                  -   S-   U R                  X5      -   nUS:X  d  US:X  a  U(       a  USU R	                  U5      -   -  nU R
                  S   S   U-   nUS:X  a  U R                  5         U R                  U R                  SS	U R                  U R                  S
-  5      5      n	U R                  U R                  5       U	5      n
[        U
5      nX1-   U-   nU R                  US.nUS:X  a!  SUS'   U(       a  U R                  U5      nX-  nU R!                  U R#                  U5      U R#                  U R$                  5      [&        R(                  5      nXS'   XXeS.$ )Nr   rc  DELETE?r   r   r   r   expiresr   )zapi-keyr   POSTzapplication/jsonzContent-typezapi-signature)urlmethodbodyheaders)r  extract_paramsr0   implode_params	urlencoder   check_required_credentialssafe_integer_2r   r   r   sumsecondsstrr   jsonhmacencoder   hashlibsha256)r   pathr   rj  r%  rl  rk  queryri  defaultExpiresrg  expiresStringauth	signatures                 r   signhollaex.sign  sp   		&"5"5d";<T\\!C'$*=*=d*KKeO8!3dnnU333iiv&-)++-!00}iY]YjYjkokwkwz~k~Y  ANhht||~~>GLM==0D;;,G *<'99U+DLD		$++d"3T[[5Mw~~^I'0O$dOOr   reasonri  rj  rl  rk  c
                     Uc  g US:  as  US::  am  U R                   S-   U-   n
U R                  US5      nU R                  U R                  S   X5        [	        U5      nU R                  U R                  S   X5        g )Ni  i   rJ  r   r   )r)   r  throw_broadly_matched_exceptionr   rt  throw_exactly_matched_exception)r   r>  r  ri  rj  rl  rk  r&  requestHeadersrequestBodyfeedbackrJ  r  s                r   handle_errorshollaex.handle_errors  s|    CKdck ww}t+H&&x;G001I7]YF001I6\r    )N)F__name__
__module____qualname____firstlineno__r   r   r   r   r+  r   rO  r   r
   r   r[  rt  r   ra  r   rf  r   rl  rk  dictre  r   r  r  r   r  r  r  r  r   r  r  r   r  r   r  r  r  r  r  r  r   r   floatr   r  r  r  r  r   r	   r#  r,  r   r2  r9  r<  r7  r|   r]  ra  r  intr  __static_attributes____classcell__)r   s   @r   r%   r%      s   Y# Yv *, qV qf -/ F: FP :>DY[ w c `j . @DB &MS &M &MS\ &MP 68 3 3F 3: 6:" 57 5 5< 9=R 
Gg 
GG 
G54 5 56 5n <@d[]  ?  ?S  ?  ?bfglbm  ?D6 6v 6 6p /1 9[ 9v ?CQUdhqs 5L 5L 5L3 5L^a 5Lx|  ~B  yC 5Ln
 
4 
*) )" *, , ,2 =A (* (*c (*T 59tZ^gi [c [ [TW [nrsxny [" 7;\`ik [ [3 [VY [ptuzp{ [" 8<B )'C )' )'V 04$UYbd @= @=C @=s @=imnsit @=D: :? ?v ? ?B mqy{ >2 >2I >2Y >2X] >2fi >2@ 9=R *S *# *> 59 !3c !3F 37TX\eg /=C /=s /=RU /=b
h 
R` 
: >B" =>7 =>QUVdQe =>~ 04$UYbd 7E 7EC 7Es 7Eimnyiz 7Er ;?r -= -=C -=^ 37TX\eg 7EC 7Es 7ERU 7Elpq|l} 7Er]
T ]
X ]
Q\ ]
~ QU]_ (:3 (: (: (:# (:do (:T> >@ BFb /Hw /Hb &eBSW P4# s  c TX `c  r   r%   )* ccxt.async_support.base.exchanger   ccxt.abstract.hollaexr   rx  ccxt.base.typesr   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!   ccxt.base.decimal_to_precisionr"   ccxt.base.preciser#   r%   r  r   r   <module>r     se    6 -  V  V  V  V  V  V  0 . ' . * 5 ) ) 4 %zh zr   