
    E#i}                    h   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  S SKJr  S SKJr  S SKJr  S SKJr  S S	KJr  S S
KJ r   S SKJ!r!  S SKJ"r"  S SKJ#r#  S SKJ$r$  S SKJ%r%  S SKJ&r&  S SKJ'r'  S SK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TradeTradingFeesTransaction)List)ExchangeError)AuthenticationError)PermissionDenied)AccountSuspended)ArgumentsRequired)
BadRequest)	BadSymbol)InsufficientFunds)InvalidAddress)InvalidOrder)OrderNotFound)RateLimitExceeded)ExchangeNotAvailable)OnMaintenance)TRUNCATE)	TICK_SIZE)Precisec                   6  ^  \ 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 r0 4S\4S jjrS r0 4S	\S\4S
 jjrSRS\S\	S\4S jjrS0 4S\S\4S jjrSS0 4S	\S\S\S\\   4S jjrSRS\S\	S\4S jjr0 4S\4S jjrSRS jrS0 4S	\S\S\4S jjrSRS\	S\4S jjr SSS0 4S	\!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%0 4S\$4S jjr&0 4S\S\'4S  jjr(S0 4S	\!S!\)S"\*S#\+S$\,4
S% jjr-S0 4S	\!S!\)S"\*S#\+S$\,4
S& jjr.SS0 4S'\4S( jjr/SS0 4S'\S	\S!\)S"\*S#\,S$\,4S) jjr0S0 4S'\!S	\!4S* jjr1S0 4S'\S	\!4S+ jjr2S0 4S	\!4S, jjr3S0 4S'\S	\!4S- jjr4SSS0 4S	\!S\S\4S. jjr5SSS0 4S	\!S\S\S\\6   4S/ jjr7SSS0 4S	\!S\S\S\\6   4S0 jjr8S1\!4S2 jr9SRS3\S\	S\64S4 jjr:SSS0 4S	\!S\S\4S5 jjr;SSS0 4S	\!S\S\S\\   4S6 jjr<S0 4S\!4S7 jjr=S0 4S\S#\+S8\S9\!S\>4
S: jjr?SSS0 4S\!S\S\4S; jjr@SSS0 4S\!S\S\S\\>   4S< jjrASSS0 4S\!S\S\4S= jjrBSSS0 4S\!S\S\S\\>   4S> jjrCS1\!4S? jrDSRS@\SA\ES\>4SB jjrFSRSA\E4SC jjrGS0 4SD\4SE jjrHSFSG0 SS4SH jrISI\JSJ\SK\SL\SM\SN\4SO jrK0 4SP jrLSQrMU =rN$ )Sbitvavo   returnc                   > U R                  [        [        U ]  5       0 SS_SS_SS/_SS_S	S
_SS_SS_S0 SS _SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_S S_0 S!S_S"S_S#S_S$S_S%S_S&S_S'S_S(S_S)S_S*S_S+S_S,S_S-S_S.S_S/S_S0S_S1S_E0 S2S_S3S_S4S_S5S6_S7S_S8S_S9S_S:S_S;S_S<S_S=S_S>S_S?S_S@S_SAS_SBS_SCS_E0 SDS_SES_SFS_SGS_SHS_SIS_SJS_SKS_SLS_SMS_SNS_SOS_SPS_SQS_SRS_SSS_STS_E0 SUS_SVS_SWS_SXS_SYS_SZS_S[S_S\S_S]S_S^S_S_S_S`S_SaS_SbS_ScS_SdS_SeS_E0 SfS_SgS_ShS_SiS_SjS_SkS_SlS_SmS_SnS_SoS_SpS_SqS_SrS_SsS_StS_SuS_SvS_ESSSSw.E_SxSySzS{S|S}S~SSSSSS._SSSSS.SSSSS._SSSSSSSSSSSSS.S.	0SSSSSS.SSSSSS.	SSS.SS0SSS.S.S._SSS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      //	S.S.0_SS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.SS.S SSSSSS.SSSSS.SS SSSS.SSSSSSSS.S SS0S.	S S S.S S S.S._S0 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[        _E0 S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[
        _S[
        _S[        _S[        _E[         [
        [        [
        [        ["        [
        [        ["        ["        [
        S.E[        [        [        [        S.S._S[$        SSSS.S GS /GS._GS[&        _GSGSGS00E5      $ (  Nidr+   nameBitvavo	countriesNL	rateLimit<   versionv2	certifiedFproThasCORSspotmarginswapfutureoption	addMarginborrowCrossMarginborrowIsolatedMarginborrowMargincancelAllOrderscancelOrdercloseAllPositionsclosePositioncreateOrder$createOrderWithTakeProfitAndStopLoss&createOrderWithTakeProfitAndStopLossWscreatePostOnlyOrdercreateReduceOnlyOrdercreateStopLimitOrdercreateStopMarketOrdercreateStopOrder	editOrderfetchBalancefetchBorrowInterestfetchBorrowRatefetchBorrowRateHistoriesfetchBorrowRateHistoryfetchBorrowRatesfetchBorrowRatesPerSymbolfetchCrossBorrowRatefetchCrossBorrowRatesfetchCurrenciesfetchDepositAddressfetchDepositAddressesfetchDepositAddressesByNetworkfetchDepositsfetchDepositWithdrawFeeemulatedfetchDepositWithdrawFeesfetchFundingHistoryfetchFundingIntervalfetchFundingIntervalsfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchGreeksfetchIndexOHLCVfetchIsolatedBorrowRatefetchIsolatedBorrowRatesfetchIsolatedPositionsfetchLeveragefetchLeveragesfetchLeverageTiersfetchLiquidationsfetchLongShortRatiofetchLongShortRatioHistoryfetchMarginAdjustmentHistoryfetchMarginModefetchMarginModesfetchMarketLeverageTiersfetchMarketsfetchMarkOHLCVfetchMarkPricesfetchMyLiquidationsfetchMySettlementHistoryfetchMyTrades
fetchOHLCVfetchOpenInterestfetchOpenInterestHistoryfetchOpenInterestsfetchOpenOrdersfetchOptionfetchOptionChain
fetchOrderfetchOrderBookfetchOrdersfetchPositionfetchPositionHistoryfetchPositionModefetchPositionsfetchPositionsForSymbolfetchPositionsHistoryfetchPositionsRiskfetchPremiumIndexOHLCVfetchSettlementHistoryfetchTickerfetchTickers	fetchTimefetchTradesfetchTradingFeefetchTradingFeesfetchTransferfetchTransfersfetchVolatilityHistoryfetchWithdrawalsreduceMarginrepayCrossMarginrepayIsolatedMarginrepayMarginsetLeverage	setMarginsetMarginMode)setPositionModetransferwithdraw
timeframes1m5m15m30m1h2h4h6h8h12h1d)r   r   r   r   r   r   r   r   r   r   r   urlszOhttps://github.com/user-attachments/assets/d213155c-8c71-4701-9bd5-45351febc2a8zhttps://api.bitvavo.com)publicprivatezhttps://bitvavo.com/zhttps://docs.bitvavo.com/zhttps://bitvavo.com/en/feesz!https://bitvavo.com/?a=24F34952F7)logoapiwwwdocfeesreferralr   get         )costnoMarket)	timemarketsassetsz{market}/bookz{market}/tradesz{market}/candleszticker/pricezticker/bookz
ticker/24h)	accountorderorders
ordersOpentradesbalancedepositdepositHistorywithdrawalHistory)r   
withdrawalr   )r   r   )r   postputdeleter   tradingz0.0025z0.0020100000z0.0020250000z0.0016500000z0.00121000000z0.00102500000z0.00085000000z0.000610000000z0.000525000000z0.0004z0.0015z0.0003)takermaker)	tierBased
percentager   r   tiersrequiredCredentials)apiKeysecretfeatures)IOCFOKPOGTD)EXPIRE_MAKEREXPIRE_TAKEREXPIRE_BOTHNONE)
marginModetriggerPricetriggerPriceTypetriggerDirectionstopLossPricetakeProfitPriceattachedStopLossTakeProfittimeInForcehedgedtrailingleveragemarketBuyRequiresPricemarketBuyByCostselfTradePreventioniceberg  i )r   limitdaysBack	untilDayssymbolRequired)r   triggerr   r   )r   r   r   r   r   )r   r   r   r   r   r   r   r     )	sandboxrI   createOrdersr}   r   r   r   fetchClosedOrdersr~   )linearinverse)r<   r>   r?   
exceptions101102103104105107108109110200201202203204205206210211212213214215216217230231232233234235236240300301302303304305306307308309310311312315317400401402403)404405406407408409410411412413414)zstart parameter is invalidzsymbol parameter is invalidzamount parameter is invalidzorderId parameter is invalid)exactbroadoptionsi'  ETHTRX)ERC20TRC20EUR)currencyToPrecisionRoundingModeBITVAVO-ACCESS-WINDOWnetworks
operatorIdfiatCurrenciesprecisionModecommonCurrenciesMIOTAIOTA)deep_extendsuperr+   describeparse_numberr   r   r$   r   r%   r   r"   r    r#   r   r   r&   r!   r'   r(   )self	__class__s    F/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/bitvavo.pyrX  bitvavo.describe    s\   gt = ? wB
)wB
IwB
 $wB
 	wB

 twB
 wB
 4wB
  jjj %j 	j
 %j %j Uj $Uj 'j j "4j tj $Uj  j tj  7!j" 9%#j$ &u%j& ('j( ')j* (+j, "4-j. T/j0 1j2 &u3j4 "55j6 +E7j8 )%9j: #E;j< ,U=j> '?j@ (AjB "4CjD &tEjF (GjH 1%IjJ  KjL *:MjN +DOjP &uQjR 'SjT (UjV #EWjX *5YjZ $U[j\ u]j^ "5_j` *5ajb +Ecjd )%ejf  gjh !%ijj %ekjl $Umjn &uojp -eqjr /sjt "5ujv #Ewjx +Eyjz {j| !%}j~ "5j@ &uAjB +ECjD  EjF dGjH $UIjJ +EKjL %eMjN "4OjP uQjR #ESjT dUjV !$WjX tYjZ  [j\ ']j^ $U_j` !%ajb *5cjd (ejf %egjh )%ijj )%kjl tmjn ojp Tqjr tsjt "5ujv #Dwjx  yjz !%{j| )%}j~ #Dj@ AjB #ECjD &uEjF uGjH uIjJ UKjL  MjN $)! SjwB
f gwB
@ i78 .25?
AwB
V  !#$"#)*+,,-()'(/0b&A
 $%!""#/0b&A"##$#$*+-.
 "#&'
   "#"#'&WwB
d !%"&!..x8!..w7 "..s3T5F5Fx5PQ!..x8$:K:KH:UV!..x8$:K:KH:UV!..x8$:K:KH:UV!..y94;L;LX;VW!..y94;L;LX;VW!..y94;L;LX;VW!..z:D<M<Mh<WX!..z:D<M<Mh<WX
" "..s3T5F5Fx5PQ!..x8$:K:KH:UV!..x8$:K:KH:UV!..x8$:K:KH:UV!..y94;L;LX;VW!..y94;L;LX;VW!..y94;L;LX;VW!..z:D<M<Mh<WX!..z:D<M<Mh<WX
"ewB
d "$ewB
l $&+(,,0,0)-+/6:#'#'"&#(	( #($)$)27+/,1,1+/$)	0 $)3$6 %)&+!%$*%+*.& ',#($)*.	# ',!%#($)*.( '+!%$*%+#($)*.$ *.#y?B ##
 ##KImwB
@	 @=@:@ ,@ ,	@
 +@ /@ /@ /@ :@ :@ :@ :@ 9@ :@ :@  :!@" <#@$ <%@& <'@( <)@* <+@, <-@. ,/@0 <1@2 =3@4 =5@6 :7@8 <9@: <;@< ==@> :?@@ =A@B .C@D .E@F .G@H .I@J .K@N .O@P .Q@R +S@T .U@V .W@X +Y@Z +[@\ +]@^ :_@` +a@b =c@d =e@f +g@h +i@j )(%(,)(%))(@D 3=3<3?4@	EHA	wB
R 3;)."" ##('	SwB
f YgwB
h !iwB
 w w	    c                 H    U R                  U5      nU R                  US5      $ )z
fetches the current integer timestamp in milliseconds from the exchange server
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns int: the current integer timestamp in milliseconds from the exchange server
r   )publicGetTimesafe_integerrZ  paramsresponses      r\  
fetch_timebitvavo.fetch_time  s)     %%f-   622r^  c                 F    U R                  U5      nU R                  U5      $ )z

https://docs.bitvavo.com/#tag/General/paths/~1markets/get

retrieves data on all markets for bitvavo
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: an array of objects representing market data
)publicGetMarketsparse_marketsrb  s      r\  fetch_marketsbitvavo.fetch_markets  s'     ((0( !!(++r^  c                    / nU R                   n[        S[        U5      5       GH  nX   nU R                  US5      nU R                  US5      nU R                  US5      nU R	                  U5      n	U R	                  U5      n
U R                  US5      nUR                  U R                  0 SU_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S:H  _SS_SS _S S S S S S US   S   US   S   U R                  U R                  U R                  US5      5      5      U R                  US5      U R                  U R                  U R                  US5      5      5      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.S$.S US%.E5      5        GM     U$ )&Nr   marketbasequotestatusr/   symbol/settlebaseIdquoteIdsettleIdtyper<   Tr=   Fr>   r?   r@   activer   contractr  r   r   quantityDecimalstickSizenotionalDecimals)amountpricer   minmaxminOrderInBaseAssetmaxOrderInBaseAssetminOrderInQuoteAssetmaxOrderInQuoteAsset)r   r}  r~  r   )r  contractSizeexpiryexpiryDatetimestrike
optionTyper   r   	precisionlimitscreatedinfo)
r   rangelensafe_stringsafe_currency_codeappendsafe_market_structurerY  parse_precisionsafe_number)rZ  r   resultr   irm  r/   rt  ru  rn  ro  rp  s               r\  ri  bitvavo.parse_markets  s   yyq#g,'AZF!!&(3B%%ff5F&&vw7G**62D++G4E%%fh7FMM$44 36b36$*u,36 36 	36
 $36 &36 736 D36 36 36 %36 36 %36 %36 6Y.36  E!36" $#36$   $"&"i1i1"//0D0DTEUEUV\^pEq0rs!--fjA --d.B.B4CSCSTZ\nCo.pq  $#!
  $//8MN#//8MN
  $#
  $//8NO#//8NO$  e36 3 3 (x r^  c                 F    U R                  U5      nU R                  U5      $ )z

https://docs.bitvavo.com/#tag/General/paths/~1assets/get

fetches all available currencies on an exchange
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: an associative dictionary of currencies
)publicGetAssetsparse_currencies_customrb  s      r\  fetch_currenciesbitvavo.fetch_currencies  s(     ''/D ++H55r^  c                 F   U R                  U R                  S/ 5      n0 n[        S[        U5      5       GHg  nX   nU R	                  US5      nU R                  U5      nU R                  Xr5      n0 n	U R                  US/ 5      n
U R	                  US5      S:H  nU R	                  US5      S:H  nU=(       a    UnU R                  US5      nU R	                  US	S
5      nU R                  US5      n[        S[        U
5      5       HK  nU
U   nU R                  U5      nUUUUUUUU R                  U R                  U5      5      SUS S.0S.	U	U'   MM     U R                  UUUU R	                  US5      UUUU	US U(       a  SOSS S S.S S S.US S.S.S.5      X7'   GMj     U$ )NrQ  r   rq  rO  depositStatusOKwithdrawalStatuswithdrawalFeedecimals8withdrawalMinAmountr   r  )	r  r/   networkrx  r   r   feer  r  r0   fiatcrypto)r}  r   r   )r  r/   coder0   rx  r   r   rO  r  r  rw  r  )	safe_listrG  r  r  r  r  in_arrayr  network_id_to_coderY  r  safe_currency_structure)rZ  
currenciesrQ  r  r  currencyr/   r  isFiatrO  networksArrayr   r   rx  withdrawFeer  minWithdrawj	networkIdnetworkCodes                       r\  r  bitvavo.parse_currencies_custom3  s   D 6FKq#j/*A!}H!!(H5B**2.D]]48FH NN8ZDM&&xATIG))(4FG4OJ+F**8_EK((:sCI**85JKK1c-01)!,	"55i@$#*$& *&!%!2!243G3G	3R!S"#.#'%)% 2&  77 ((6: "&$"!"(h  $#
  $# 
  +#!9 FLC +x r^  rq  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  

https://docs.bitvavo.com/#tag/Market-Data/paths/~1ticker~124h/get

fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
:param str symbol: unified symbol of the market to fetch the ticker for
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
rm  r/   )load_marketsrm  publicGetTicker24hextendparse_ticker)rZ  rq  rc  rm  requestrd  s         r\  fetch_tickerbitvavo.fetch_ticker  s\     	V$fTl
 **4;;w+GH"   22r^  Ntickerrm  c                 r   U R                  US5      nU R                  X2S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                  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U R                  US5      _SU R                  US5      _SU R                  US5      _SS _SU	_SU_SU_SS _SS _SS _SS _UUUS.EU5      $ )Nrm  -	timestamplastvolumevolumeQuoteopenrq  datetimehighlowbid	bidVolumebidSizeask	askVolumeaskSizevwapclosepreviousClosechanger   average)
baseVolumequoteVolumer  )r  safe_symbolra  safe_tickeriso8601)
rZ  r  rm  marketIdrq  r  r  r  r  r  s
             r\  r  bitvavo.parse_ticker  s   & ##FH5!!(C8%%fk:	/%%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^  symbolsc                 f    U R                  5         U R                  U5      nU R                  X15      $ )a  
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
: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>`
)r  r  parse_tickers)rZ  r  rc  rd  s       r\  fetch_tickersbitvavo.fetch_tickers  s3     	**62& !!(44r^  sincer   c                 r   U R                  5         U R                  U5      nSnU R                  USS5      u  pdU(       a  U R                  SXX45      $ SUS   0nUb  [	        US5      US'   Ub  X'S'   U R                  S	Xt5      u  ptU R                  U R                  Xt5      5      nU R                  XX#5      $ )
a  

https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1trades/get

get the list of most recent trades for a particular symbol
: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
:param int [params.until]: the latest time in ms to fetch entries for
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
Fr   paginaterm  r/   r   r   startend)	r  rm  handle_option_and_paramsfetch_paginated_call_dynamicr  handle_until_optionpublicGetMarketTradesr  parse_trades)	rZ  rq  r  r   rc  rm  r  r  rd  s	            r\  fetch_tradesbitvavo.fetch_trades  s     	V$88PZ[44]FSXaafTl
 "5$/GG$G225'J--dkk'.JK   5@@r^  tradec                 D   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S5      nU R                  US5      nU R                  XS5      n	U R	                  US	5      n
S nU
b  U
(       a  S	OS
nU R                  US5      nS nUb(  U R                  US5      nU R                  U5      nUUS.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      $ )Nr~  r}  r  sider/   fillIdrm  r  r   r   r  feeCurrencyr   r  orderId)r  r/   rq  r  r  r   rw  r  takerOrMakerr~  r}  r   r  )r  ra  safe_string_2r  
safe_valuer  
safe_trader  )rZ  r  rm  priceStringamountStringr  r  r/   r  rq  r   r  feeCostStringr  feeCurrencyIdfeeCurrencyCoder  s                    r\  parse_tradebitvavo.parse_trade4  sT   r &&ug6''x8%%e[9	v.tX6##E84!!(C8w/&+7L((6$ ,,UMBM"55mDO%+C ""5)4"Y/( " 
  	r^  c                 f    U R                  5         U R                  U5      nU R                  U5      $ )a,  

https://docs.bitvavo.com/#tag/Account/paths/~1account/get

fetch the trading fees for multiple markets
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
)r  privateGetAccountparse_trading_feesrb  s      r\  fetch_trading_feesbitvavo.fetch_trading_fees  s3     	))&1 &&x00r^  c                     U R                  US5      nU R                  US5      nU R                  US5      n0 n[        S[        U R                  5      5       H  nU R                  U   nUUUUSSS.Xh'   M     U$ )Nr   r   r   r   T)r  rq  r   r   r   r   )r  r  r  r  r  )	rZ  r   rm  	feesValuer   r   r  r  rq  s	            r\  r  bitvavo.parse_trading_fees  s     OOD&1	  G4  G4q#dll+,A\\!_F "!FN - 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	                  XdS   5      nU R                  US5      US'   U$ )a
  

https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1book/get

fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
: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
rm  r/   depthrq  nonce)r  rm  publicGetMarketBookr  parse_order_bookra  )rZ  rq  r   rc  rm  r  rd  	orderbooks           r\  fetch_order_bookbitvavo.fetch_order_book  s     	V$fTl
 $G++DKK,HI" ))(84DE	!..xA	'r^  c           	          U R                  US5      U R                  US5      U R                  US5      U R                  US5      U R                  US5      U R                  US5      /$ )Nr   r            r   )ra  r  )rZ  ohlcvrm  s      r\  parse_ohlcvbitvavo.parse_ohlcv  sn     eQ'UA&UA&UA&UA&UA&
 	
r^  r   c                 H   U R                  U5      nUS   U R                  U R                  X"5      S.nUbA  U R                  U5      nX7S'   Uc  SnO[	        US5      nU R                  X4U-  S-  5      US'   U R                  SXu5      u  puUb  XGS'   U R                  Xu5      $ )Nr/   )rm  intervalr  r   r   r  r   )rm  r  r   parse_timeframer  sumr  r  )	rZ  rq  	timeframer  r   rc  rm  r  durations	            r\  fetch_ohlcv_requestbitvavo.fetch_ohlcv_request  s    V$Tl(()O
 ++I6H$G}E4(!XXeX-=-DEGEN225'J$G{{7++r^  c           	         U R                  5         U R                  U5      nSnU R                  USS5      u  puU(       a  U R                  SXXBUS5      $ U R	                  XX4U5      nU R                  U5      n	U R                  XX#U5      $ )a  

https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1candles/get

fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
: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]: the latest time in ms to fetch entries for
: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
Fr~   r  r   )r  rm  r  "fetch_paginated_call_deterministicr  publicGetMarketCandlesparse_ohlcvs)
rZ  rq  r  r  r   rc  rm  r  r  rd  s
             r\  fetch_ohlcvbitvavo.fetch_ohlcv  s     	V$88zZ::<X]jprvww**6eFS..w7   9UKKr^  c                 2   US S S.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      $ )N)r  r  r  r   rq  	availablefreeinOrderused)r  r  r  r  r   safe_balance)rZ  rd  r  r  r   
currencyIdr  r   s           r\  parse_balancebitvavo.parse_balance4  s    

 q#h-(AkG))'8<J**:6DllnG"..wDGFO"..w	BGFO"4L )   ((r^  c                 f    U R                  5         U R                  U5      nU R                  U5      $ )a=  

https://docs.bitvavo.com/#tag/Account/paths/~1balance/get

query for balance and get the amount of funds available for trading or funds locked in orders
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
)r  privateGetBalancer.  rb  s      r\  fetch_balancebitvavo.fetch_balanceD  s3     	))&1 !!(++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	                  US5      nU R	                  US5      nU R                  U5        UUSUUS.$ )a  
fetch the deposit address for a currency associated with self account
: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>`
rq  r/   address	paymentIdN)r  r  r  r5  tag)r  r  privateGetDepositr  r  check_address)rZ  r  rc  r  r  rd  r5  r7  s           r\  fetch_deposit_addressbitvavo.fetch_deposit_addressZ  s     	==&htn
 ))$++g*FG ""8Y7x57#
 	
r^  rw  r  r}  r~  c                    U R                  U5      nUS   UUS.nUS:H  =(       d    US:H  =(       d    US:H  n	US:H  =(       d    US:H  =(       d    US:H  n
U R                  US	5      nU R                  U/ S
Q5      nU R                  U	SU5      nU R	                  US5      nU R	                  US5      nU R                  U/ SQ5      nU	(       a  S nUbK  U R                  U5      nU R                  U5      n[        R                  " UU5      nU R                  U5      nOU R                  US5      nUb=  U R                  US   5      S   nU R                  U[        UU R                  5      US'   OU R                  X5      US'   U R                  US/5      nO/U
(       a(  U R!                  X5      US'   U R                  X5      US'   US L=(       d    US:H  =(       d    US:H  nUS L=(       d*    US L=(       a    U(       + =(       d    US:H  =(       d    US:H  nU(       a  Ub  UnU	(       a  SOSUS'   OU(       a  Ub  UnU	(       a  SOSUS'   Ub  U R!                  X5      US'   SUS'   SUS'   Ub
  US:w  a  XS	'   U(       a  SUS'   S nU R#                  USS5      u  nnUb  U R%                  U5      US'   O['        U R(                  S-   5      eS nU R#                  USS 5      u  nnUb  US!:X  a  S"US '   OUUS '   U R+                  X5      $ )#Nr/   )rm  r  	orderTyperm  stopLoss
takeProfitr   stopLossLimittakeProfitLimitr   r   	stopPricetriggerAmountFr   r   )r   r   rC  r   r   r   ro  r  amountQuoter}  r~  r=  rD  triggerType	lastTradetriggerReferencer   TpostOnlyrI   rP  zk createOrder() requires an operatorId in params or options, eg: exchange.options['operatorId'] = 1234567890r   r   
cancelBoth)rm  r  safe_string_nis_post_onlyr  omitnumber_to_stringr)   
string_mulrY  r  r  decimal_to_precisionr'   rR  amount_to_precisionprice_to_precisionr  parse_to_intr   r/   r  )rZ  rq  rw  r  r}  r~  rc  rm  r  isMarketOrderisLimitOrderr   r   rI  r   r   r   r  r  quoteAmountr  isTakeProfit
isStopLossrP  r   s                            r\  create_order_requestbitvavo.create_order_requestx  sg   V$Tl

 )\tz/A\t|G[dT_-Dd$RcJc&&v}=))&2`a$$]E6B@//&2CD6#stD "33E:#44V<%00{K((5''7 MM&/:;G	)-)B)B4S\^b^p^p)q&$($<$<V$L!YYvx0F#66vEGG $ 8 8 HGH't3m9MmSW[lSl#4/  [\5M4eXdTd  [jnr|j|  [  CG  KZ  CZ
(,1>:OGK *.3@<FWGK #'+'>'>v'TGO$%,GM"*5G&'#+*=%0M""&GJ
!::6=R^_
F!$($5$5j$AGL!#DGG  /^  %^  _  _"&*&C&CFM[p&q#V*"m31=-.1D-.{{7++r^  c                     U R                  5         U R                  U5      nU R                  XX4XV5      nU R                  U5      n	U R	                  X5      $ )a  
create a trade order

https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/post

: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 bitvavo api endpoint
:param str [params.timeInForce]: "GTC", "IOC", or "PO"
:param float [params.stopPrice]: Alias for triggerPrice
: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 float [params.stopLossPrice]: The price at which a stop loss order is triggered at
:param float [params.takeProfitPrice]: The price at which a take profit order is triggered at
:param str [params.triggerType]: "price"
:param str [params.triggerReference]: "lastTrade", "bestBid", "bestAsk", "midPrice" Only for stop orders: Use self to determine which parameter will trigger the order
:param str [params.selfTradePrevention]: one of EXPIRE_BOTH, cancelOldest, cancelNewest or decrementAndCancel
:param bool [params.disableMarketProtection]: don't cancel if the next fill price is 10% worse than the best fill price
:param bool [params.responseRequired]: Set self to 'false' when only an acknowledgement of success or failure is required, self is faster.
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
)r  rm  rY  privatePostOrderparse_order)
rZ  rq  rw  r  r}  r~  rc  rm  r  rd  s
             r\  create_orderbitvavo.create_order  sV    2 	V$++F$V((1R 11r^  r/   c                    0 nU R                  U5      n	U R                  US5      n
U R                  U/ SQ5      nU R                  U/ SQ5      nUb  U R	                  X&5      US'   Ub  U R                  X%5      US'   U
b  U R                  X*5      US'   Ub  U R	                  X+5      US'   U R                  X5      nU R                  U5      (       a  [        U R                  S-   5      eU R                  US5      nUc  XS	'   S nU R                  US
S5      u  pUb  U R                  U5      US'   O[        U R                  S-   5      eU	S   US'   U$ )NamountRemainingrB  )ra  r   rC  rD  r~  r}  rD  zR editOrder() requires an amount argument, or a price argument, or non-empty paramsclientOrderIdr  rQ   rP  zi editOrder() requires an operatorId in params or options, eg: exchange.options['operatorId'] = 1234567890r/   rm  )rm  r  rK  rM  rR  rQ  r  is_emptyr   r/   r  r  rS  )rZ  r/   rq  rw  r  r}  r~  rc  r  rm  ra  r   rb  rP  s                 r\  edit_order_requestbitvavo.edit_order_request  s   V$**63DE))&2`a6#de#66vEGG $ 8 8 HGH&)-)A)A&)ZG%&#'+'>'>v'TGO$++g.==!!#DGG  /C  %C  D  D((A !#I
!::6;P\]
!$($5$5j$AGL!#DGG  /\  %\  ]  ]"4Lr^  c           	          U R                  5         U R                  U5      nU R                  XX4XVU5      n	U R                  U	5      n
U R	                  X5      $ )an  
edit a trade order

https://docs.bitvavo.com/#tag/Orders/paths/~1order/put

:param str id: cancel order id
: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 bitvavo api endpoint
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
)r  rm  rd  privatePutOrderr]  )rZ  r/   rq  rw  r  r}  r~  rc  rm  r  rd  s              r\  
edit_orderbitvavo.edit_order  sV     	V$))"d&QWX''011r^  c                 J   Uc  [        U R                  S-   5      eU R                  U5      nSUS   0nU R                  US5      nUc  XS'   S nU R	                  USS5      u  psUb  U R                  U5      US'   O[        U R                  S-   5      eU R                  XS5      $ )	Nz) cancelOrder() requires a symbol argumentrm  r/   rb  r  rF   rP  zk cancelOrder() requires an operatorId in params or options, eg: exchange.options['operatorId'] = 1234567890)r   r/   rm  r  r  rS  r  )rZ  r/   rq  rc  rm  r  rb  rP  s           r\  cancel_order_requestbitvavo.cancel_order_request3  s    >#DGG.Y$YZZV$fTl
 ((A !#I
!::6=R^_
!$($5$5j$AGL!#DGG  /^  %^  _  _{{7++r^  c                     U R                  5         U R                  U5      nU R                  XU5      nU R                  U5      nU R	                  Xd5      $ )a  

https://docs.bitvavo.com/#tag/Orders/paths/~1order/delete

cancels an open order

https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/delete

: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>`
)r  rm  rk  privateDeleteOrderr]  )rZ  r/   rq  rc  rm  r  rd  s          r\  cancel_orderbitvavo.cancel_orderE  sS     	V$++B?**73 11r^  c                 R   U R                  5         0 nSnUb  U R                  U5      nUS   US'   SnU R                  USS5      u  pRUb  U R                  U5      US'   O[	        U R
                  S-   5      eU R                  U R                  X25      5      nU R                  Xd5      $ )aw  

https://docs.bitvavo.com/#tag/Orders/paths/~1orders/delete

cancel all open 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
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
Nr/   rm  rE   rP  zn canceAllOrders() requires an operatorId in params or options, eg: exchange.options['operatorId'] = 1234567890)	r  rm  r  rS  r   r/   privateDeleteOrdersr  parse_orders)rZ  rq  rc  r  rm  rP  rd  s          r\  cancel_all_ordersbitvavo.cancel_all_orders^  s     	[[(F &tGH
!::6CTVbc
!$($5$5j$AGL!#DGG  /a  %a  b  b++DKK,HI   22r^  c                    Uc  [        U R                  S-   5      eU R                  5         U R                  U5      nSUS   0nU R	                  US5      nUc  XS'   U R                  U R                  XS5      5      nU R                  Xt5      $ )aw  
fetches information on an order made by the user

https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/get

:param str id: the 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>`
z( fetchOrder() requires a symbol argumentrm  r/   rb  r  )r   r/   r  rm  r  privateGetOrderr  r]  )rZ  r/   rq  rc  rm  r  rb  rd  s           r\  fetch_orderbitvavo.fetch_order~  s     >#DGG.X$XYYV$fTl
 ((A !#I''G(DEF 11r^  c                     U R                  U5      nSUS   0nUb  X&S'   Ub  X6S'   U R                  SXd5      u  pdU R                  Xd5      $ Nrm  r/   r  r   r  rm  r  r  rZ  rq  r  r   rc  rm  r  s          r\  fetch_orders_requestbitvavo.fetch_orders_request  a    V$fTl
 $G$G225'J{{7++r^  c                 F   Uc  [        U R                  S-   5      eU R                  5         SnU R                  USS5      u  pTU(       a  U R	                  SXX45      $ U R                  U5      nU R                  XX45      nU R                  U5      nU R                  XX#5      $ )a*  

https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1orders/get

fetches information on multiple orders made by the user
: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 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)
:param int [params.until]: the latest time in ms to fetch entries for
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
z) fetchOrders() requires a symbol argumentFr   r  )	r   r/   r  r  r  rm  r~  privateGetOrdersrs  	rZ  rq  r  r   rc  r  rm  r  rd  s	            r\  fetch_ordersbitvavo.fetch_orders  s     >#DGG.Y$YZZ88PZ[44]FSXaaV$++F5I((1J   5@@r^  c                     U R                  5         0 nSnUb  U R                  U5      nUS   US'   U R                  U R                  XT5      5      nU R	                  XvX#5      $ )a  

https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1ordersOpen/get

fetch all unfilled currently open orders
:param str symbol: unified market symbol
:param int [since]: the earliest time in ms to fetch open orders for
:param int [limit]: the maximum number of  open 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>`
Nr/   rm  )r  rm  privateGetOrdersOpenr  rs  )rZ  rq  r  r   rc  r  rm  rd  s           r\  fetch_open_ordersbitvavo.fetch_open_orders  so     	
 [[(F &tGH,,T[[-IJJ   5@@r^  rp  c                 F    SSSSSSSSSSSSSS.nU R                  X!U5      $ )Nr  canceledclosed)newr  canceledAuctioncanceledSelfTradePreventioncanceledIOCcanceledFOKcanceledMarketProtectioncanceledPostOnlyfilledpartiallyFilledexpiredrejectedawaitingTriggerr  rZ  rp  statusess      r\  parse_order_statusbitvavo.parse_order_statusB  sE    ")+5%%(2 *%!"%
 &99r^  r   c                    U R                  US5      nU R                  US5      nU R                  US5      nU R                  XRS5      nUS   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S5      nU R                  US5      nUc;  U R                  US5      nU R                  US5      n[        R
                  " UU5      nS nU R                  US5      nUb(  U R                  US5      nU R                  U5      nU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S _SU_SU R                  U5      _SS _SU_SU	_SU_SU_SU_S	U
_SU R                  US5      _S
U_SU_SS _S U_UUUUS!.EU5      $ )"Nr  r  rm  r  rq  rp  r  r=  r~  r}  ra  filledAmountfilledAmountQuoterE  amountQuoteRemainingfeePaidr  r  fillsr   rI  r  r/   rb  r  r  lastTradeTimestamprw  r   r   r  r  )	remainingrp  r  r   )r  ra  safe_marketr  r)   
string_subr  r  r  
safe_orderr  )rZ  r   rm  r/   r  r  rq  rp  r  rw  r~  r}  r  r  r   rE  r  r  feeCostr  r  	rawTradesr   rI  s                           r\  r]  bitvavo.parse_orderT  s   \ eY/%%eY7	##E84!!(C8!(()9)9%)JKv.{3  0!!%2$$U,=>	!!%8':;<**5-@K#'#3#3E;Q#R %%k3GHD""5)4 ,,UMBM"55mDO+C OOE7B7	&&um<??5*5  
E 
" 
 T 
 	 

 Y/ 
 !$ 
 f 
 D 
 ; 
  
 D 
 U 
 D,,UNC 
 f 
 D 
  t! 
" f# 
$ #+ 
, - 	r^  c                     U R                  U5      nSUS   0nUb  X&S'   Ub  X6S'   U R                  SXd5      u  pdU R                  Xd5      $ r{  r|  r}  s          r\  fetch_my_trades_requestbitvavo.fetch_my_trades_request  r  r^  c                 F   Uc  [        U R                  S-   5      eU R                  5         SnU R                  USS5      u  pTU(       a  U R	                  SXX45      $ U R                  U5      nU R                  XX45      nU R                  U5      nU R                  XX#5      $ )a  

https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1trades/get

fetch all trades made by the user
: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 int [params.until]: the latest time in ms to fetch entries for
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
z+ fetchMyTrades() requires a symbol argumentFr}   r  )	r   r/   r  r  r  rm  r  privateGetTradesr  r  s	            r\  fetch_my_tradesbitvavo.fetch_my_trades  s     >#DGG.[$[\\88R\]44_fUZccV$..veL((1$   5@@r^  c                     U R                  U5      nUS   U R                  X5      US.nUb  XGS'   U R                  Xu5      $ )Nr/   )rq  r}  r5  r6  )r  currency_to_precisionr  )rZ  r  r}  r5  r7  rc  r  r  s           r\  withdraw_requestbitvavo.withdraw_request  sM    ==&tn00>
 ?#&K {{7++r^  r5  r7  c                     U R                  XE5      u  pEU R                  U5        U R                  5         U R                  U5      nU R	                  XX4U5      nU R                  U5      nU R                  X5      $ )aO  
make a 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>`
)handle_withdraw_tag_and_paramsr9  r  r  r  privatePostWithdrawalparse_transaction)	rZ  r  r}  r5  r7  rc  r  r  rd  s	            r\  r   bitvavo.withdraw  su     99#F7#==&''gFK--g6 %%h99r^  c                     0 nS nUb  U R                  U5      nUS   US'   Ub  X%S'   Ub  X5S'   U R                  XT5      $ Nr/   rq  r  r   r  r  rZ  r  r  r   rc  r  r  s          r\  fetch_withdrawals_request!bitvavo.fetch_withdrawals_request  ]    
 }}T*H (GH$G$G{{7++r^  c                     U R                  5         U R                  XX45      nSnUb  U R                  U5      nU R                  U5      nU R	                  XvX#SS05      $ )a  

https://docs.bitvavo.com/#tag/Account/paths/~1withdrawalHistory/get

fetch all withdrawals made from an account
: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 bitvavo api endpoint
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
Nrw  r   )r  r  r  privateGetWithdrawalHistoryparse_transactionsrZ  r  r  r   rc  r  r  rd  s           r\  fetch_withdrawalsbitvavo.fetch_withdrawals+  sh     	00eL}}T*H33G< &&x5&R^I_``r^  c                     0 nS nUb  U R                  U5      nUS   US'   Ub  X%S'   Ub  X5S'   U R                  XT5      $ r  r  r  s          r\  fetch_deposits_requestbitvavo.fetch_deposits_requestM  r  r^  c                     U R                  5         U R                  XX45      nSnUb  U R                  U5      nU R                  U5      nU R	                  XvX#SS05      $ )a  

https://docs.bitvavo.com/#tag/Account/paths/~1depositHistory/get

fetch all deposits made to an account
: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 bitvavo api endpoint
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
Nrw  r   )r  r  r  privateGetDepositHistoryr  r  s           r\  fetch_depositsbitvavo.fetch_deposits^  sh     	--d5I}}T*H009 &&x5&R[I\]]r^  c           
      >    SSSSSSSSSS.	nU R                  X!U5      $ )Npendingokr  )	awaiting_processingawaiting_email_confirmationawaiting_bitvavo_inspectionapprovedsending
in_mempool	processed	completedr  r  r  s      r\  parse_transaction_status bitvavo.parse_transaction_status~  s9    #,+4+4! #""

 &99r^  transactionr  c                 4   S nU R                  US5      nU R                  US5      nU R                  XR5      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U R	                  US5      nUb  UUS.nS nS	U;   d  SU;   a  S
nOSnU R                  US5      n0 SU_SU_SU
_SU_SU R                  U5      _SS _SU	_SU	_SS _SU_SU_SU_SU_SU_SU_SS _SU_S S S S.E$ )Nr  rq  rp  r}  r5  txIdr  r  successr   r   r6  r  r/   txidr  addressFrom	addressTotagFromr7  tagTorw  r  updated)r  commentinternal)ra  r  r  r  r  r  )rZ  r  r  r/   r  r-  r  rp  r}  r5  r  r  r  rw  r7  s                  r\  r  bitvavo.parse_transaction  s   D %%k;?	%%k8<
&&z<..t/?/?X/VW!!+x8"";	:V4"";6 C $){*BDD{K8
K
"
 D
 	

 Y/
 4
 w
 
 t
 3
 S
 D
 f
 
 f
  t!
" 3#
$ )
 	
r^  c                     UU R                  US5      SS.U R                  US5      SS.0 S.nU R                  US5      nU R                  US5      nU R                  US5      nUS	:X  a  UnU R                  XV5      nUS
   US   S.US   U'   U$ )Nr  F)r  r   
depositFee)r  r   r   rO  rO  r   r  Mainnetr   r   )r   r   )r  r  r  r  )rZ  r  r  r  rO  r  currencyCoder  s           r\  parse_deposit_withdraw_fee"bitvavo.parse_deposit_withdraw_fee  s    & ''_=#
 ''\:# 
 ??3
3OOHa0	''&9	!$I--iFi(z*+
z;' r^  codesc                 h    U R                  5         U R                  U5      nU R                  X1S5      $ )a7  
fetch deposit and withdraw fees

https://docs.bitvavo.com/#tag/General/paths/~1assets/get

: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>`
rq  )r  r  parse_deposit_withdraw_fees)rZ  r  rc  rd  s       r\  fetch_deposit_withdraw_fees#bitvavo.fetch_deposit_withdraw_fees  s5     	''/( //JJr^  r   GETc                    U R                  X@R                  U5      5      nSU R                  -   S-   U R                  X5      -   nUS:H  =(       d    US:H  n	U	(       a  U(       a  USU R	                  U5      -   -  nUS:X  a  U R                  5         Sn
U	(       d  U(       a  U R                  U5      nUn
[        U R                  5       5      nX-   U-   U
-   nU R                  U R                  U5      U R                  U R                  5      [        R                  5      nU R                  U R                  SS5      nU R                   UUUS	.nU	(       d  S
US'   U R"                  S   U   U-   nXXeS.$ )Nrr  r  DELETE?r    rN  10000)zBITVAVO-ACCESS-KEYzBITVAVO-ACCESS-SIGNATUREzBITVAVO-ACCESS-TIMESTAMPrN  zapplication/jsonzContent-Typer   )urlmethodbodyheaders)rM  extract_paramsr6   implode_params	urlencodecheck_required_credentialsjsonstrmillisecondshmacencoder   hashlibsha256r  rG  r   r   )rZ  pathr   r  rc  r  r  queryr  getOrDeletepayloadr  auth	signatureaccessWindows                  r\  signbitvavo.sign%  sU   		&"5"5d";<DLL 3&)<)<T)JJ?Fh,>sT^^E222)++-G99U+D"GD--/0I%+g5D		$++d"3T[[5Mw~~^I++DLL:QSZ[L&*kk,5,5)5	G *<'iis#c)dOOr^  httpCodereasonr  r  r  r  c
                    Uc  g U R                  US5      n
U R                  US5      nU
b[  U R                  S-   U-   nU R                  U R                  S   X5        U R	                  U R                  S   X5        [        U5      eg )N	errorCodeerror rF  rE  )r  r/   throw_broadly_matched_exceptionr  throw_exactly_matched_exceptionr   )rZ  r  r  r  r  r  r  rd  requestHeadersrequestBodyr  r  feedbacks                r\  handle_errorsbitvavo.handle_errorsB  s     $$X{;	  73 ww}t+H001I5[001I9_))r^  c                 J    SU;   a  SU;  a  US   $ U R                  USS5      $ )Nr   rm  r   r   )r  )rZ  r   r  r
  rc  configs         r\  calculate_rate_limiter_cost#bitvavo.calculate_rate_limiter_costS  s/    & 8v+=*%%vvq11r^   )N)O__name__
__module____qualname____firstlineno__r   rX  r
   re  r   r   rj  ri  r   r  r  r  r   r  dictr  r   r   r  r   r  r   r   r  r  r   r  listr  r   r  r%  r   r.  r2  r	   r:  r   r   floatr   rY  r^  rd  rh  rk  ro  rt  rx  r~  r   r  r  r  r]  r  r  r  r   r   r  r  r  r  r  r   r  r  r  r  intr  r"  __static_attributes____classcell__)r[  s   @r\  r+   r+      s   x# xt !# 
3s 
3 $& ,$v, ,>?B ') +6Z +6Z`D 02  33  3f  3D/4 / /6 /b 04B 5W 57 5: 6:UW -A3 -As -A# -A\`af\g -A^\ \v \ \| )+ 1{ 1,4 :>b %s %3 %Y %N
 
4 
( :>D_cln ,# ,c ,Y\ ,. 26DW[df L# Lc LQT Lkoptku L@) )  $& ,( ,, 79 
# 
^ 
< os{} @,3 @,i @,y @,Z_ @,hk @,D gksu E23 E2i E2y E2RW E2`c E2N FJQU^` S : `drv  @B 2S 2# 2Y 2i 2Y\ 2lo 2* ;?r ,s ,C ,$ 37r 2s 2C 22 /32 3 3@ 26b 82c 823 82t 26DW[df ,3 ,c ,QT ," *.Dt\^ <A3 <Ac <A <Acghmcn <A| /3TXac 9A 9A3 9Ac 9Ahlmrhs 9Av: :$b bv b bH 59tZ^gi ,c , ,TW ," -1tRV_a )Ac )A )AC )Afjkpfq )AV @DB ,S , KOWY :S :% :# :C :^i :2 59tZ^gi ,c , ,TW ," -1tRV_a  ac  a  aC  afjkvfw  aD 26DW[df ,3 ,c ,QT ," *.Dt\^ ^3 ^c ^ ^cghsct ^@:s :L
T L
X L
Q\ L
\( (T <@ K KB &eBSW P:c 3 S # X\ dg " MO 2 2r^  r+   )0ccxt.base.exchanger   ccxt.abstract.bitvavor   r  ccxt.base.typesr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   typingr   ccxt.base.errorsr   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   ccxt.base.decimal_to_precisionr'   r(   ccxt.base.preciser)   r+   r$  r^  r\  <module>r6     sz    ( -  J  J  J  J  J  J  * 0 - - . ' & . + ) * . 1 * 3 4 %x 2h x 2r^  