
    !:ht                       d dl mZ d dlmZ d dlZd dlmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZ d dlmZ d dlmZ d dlmZ d dlmZ d d	lmZ d d
lm Z  d dlm!Z! d dlm"Z" d dlm#Z# d dlm$Z$ d dlm%Z% d dlm&Z& d dlm'Z' d dlm(Z( d dlm)Z) d dl*m+Z+ d dl*m,Z, d dl*m-Z- d dl*m.Z. d dl/m0Z0  G d dee      Z1y)    )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)ROUND)TRUNCATE)DECIMAL_PLACES)SIGNIFICANT_DIGITS)Precisec                       e Zd Zdef fdZd Zd Zi fdefdZi fde	e
   fdZd Zi fdefdZd	 Zi fd
edefdZdQdede
defdZdi fdedefdZddi fd
ededede	e   fdZdQdede
defdZi fdefdZdQdZdi fd
ededefdZdQde
de fdZ!dddi fd
e"dedefdZ#dddi fd
e"dedede	e    fdZ$de%fdZ&i fde%fdZ'i fd ede(fd!Z)di fd
e"d"e*d#e+d$e,d%e-f
d&Z.di fd
e"d"e*d#e+d$e,d%e-f
d'Z/ddi fd(efd)Z0ddi fd(ed
ed"e*d#e+d$e-d%e-fd*Z1di fd(e"d
e"fd+Z2di fd(ed
e"fd,Z3di fd
e"fd-Z4di fd(ed
e"fd.Z5dddi fd
e"dedefd/Z6dddi fd
e"dedede	e7   fd0Z8dddi fd
e"dedede	e7   fd1Z9d2e"fd3Z:dQd4ede
de7fd5Z;dddi fd
e"dedefd6Z<dddi fd
e"dedede	e   fd7Z=di fd e"fd8Z>di fd ed$e,d9ede?fd:Z@dddi fd e"dedefd;ZAdddi fd e"dedede	e?   fd<ZBdddi fd e"dedefd=ZCdddi fd e"dedede	e?   fd>ZDd2e"fd?ZEdQd@edAeFde?fdBZGdQdAeFfdCZHdi fdDefdEZIdFdGi ddfdHZJdIeKdJedKedLedMedNefdOZLi fdPZM xZNS )Rbitvavoreturnc                    | j                  t        t        |          i ddddddgddd	d
dddddi dd ddddddddddddddddddddddddddddddd di d!dd"dd#dd$dd%dd&dd'dd(dd)dd*dd+d,d-dd.dd/dd0dd1dd2di d3dd4dd5dd6dd7dd8dd9dd:dd;dd<dd=dd>dd?dd@ddAddBddCdi dDddEddFddGddHddIddJddKddLddMddNddOddPddQddRddSddTdddddUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddededfdgdhdidjdkdldmdndndndndodndndndndpdqdr	idndndodndpdqdododndodods	dndndtdudnidndndvdwdfdxdydd| j	                  dz      | j	                  d{      | j	                  d|      | j	                  dz      g| j	                  d}      | j	                  d~      g| j	                  d      | j	                  d      g| j	                  d      | j	                  d      g| j	                  d      | j	                  d      g| j	                  d      | j	                  d      g| j	                  d      | j	                  d      g| j	                  d      | j	                  d      g| j	                  d      | j	                  d      gg	| j	                  d|      | j	                  d      g| j	                  d}      | j	                  d      g| j	                  d      | j	                  d      g| j	                  d      | j	                  d      g| j	                  d      | j	                  d      g| j	                  d      | j	                  d      g| j	                  d      | j	                  d      g| j	                  d      | j	                  d      g| j	                  d      | j	                  d      gg	ddiddddddddd d ddd dddddddddddddd ddddddddddddd ddddddddddddd ddid	d d dd d dddi dt
        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        i dt        dt        dt        dt        dt        dt        dt        dt
        dt
        dt        dt        dt        dt
        dt        dt        dt        dt        i dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt        dt
        dt
        dt        dt        t         t
        t        t
        t        t"        t
        t        t"        t"        t
        d՜t        t        t        t        d֜dלdt$        ddddܜd dgdޜdt&        dddii      S )Nidr-   nameBitvavo	countriesNL	rateLimit<   versionv2	certifiedFproThasCORSspotmarginswapfutureoption	addMargincancelAllOrderscancelOrdercloseAllPositionsclosePositioncreateOrdercreateReduceOnlyOrdercreateStopLimitOrdercreateStopMarketOrdercreateStopOrder	editOrderfetchBalancefetchBorrowRateHistoriesfetchBorrowRateHistoryfetchCrossBorrowRatefetchCrossBorrowRatesfetchCurrenciesfetchDepositAddressfetchDepositAddressesfetchDepositAddressesByNetworkfetchDepositsfetchDepositWithdrawFeeemulatedfetchDepositWithdrawFeesfetchFundingHistoryfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchIndexOHLCVfetchIsolatedBorrowRatefetchIsolatedBorrowRatesfetchLeveragefetchLeverageTiersfetchMarginModefetchMarketsfetchMarkOHLCVfetchMyTrades
fetchOHLCVfetchOpenInterestHistoryfetchOpenOrders
fetchOrderfetchOrderBookfetchOrdersfetchPositionfetchPositionHistoryfetchPositionModefetchPositionsfetchPositionsForSymbolfetchPositionsHistoryfetchPositionsRiskfetchPremiumIndexOHLCVfetchTickerfetchTickers	fetchTimefetchTradesfetchTradingFeefetchTradingFeesfetchTransferfetchTransfersfetchWithdrawalsreduceMarginsetLeverage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)
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     )	sandboxrG   createOrdersrf   rj   ri   rl   fetchClosedOrdersrg   )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/var/www/html/turnos/venv/lib/python3.12/site-packages/ccxt/bitvavo.pyr3  zbitvavo.describe"   sO   gt = ? PB
)PB
IPB
 $PB
 	PB

 tPB
 PB
 4PB
  HHH %H 	H
 %H %H UH "4H tH $UH  H tH (H 'H (H  "4!H" T#H$ %H& +E'H( )%)H* '+H, (-H. "4/H0 &t1H2 (3H4 1%5H6  7H8 *:9H: +D;H< &u=H> #E?H@ *5AHB $UCHD "5EHF *5GHH +EIHJ  KHL %eMHN "5OHP QHR !%SHT  UHV dWHX +EYHZ "4[H\ d]H^ !$_H` taHb  cHd 'eHf $UgHh !%iHj *5kHl (mHn %eoHp )%qHr tsHt uHv TwHx tyHz "5{H| #D}H~  H@ !%AHB #DCHD EHF uGHH  IHJ $)! OHPB
b cPB
| i78 .25?
}PB
R  !#$"#)*+,,-()'(/0b&A
 $%!""#/0b&A"##$#$*+-.
 "#&'
   "#"#'&SPB
` !%"&!..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
"aPB
` "$aPB
h $&+(,,0,0)-+/6:#'#'"&#(	( #($)$)27+//3#()$, %)&+!%$*%+*.& ',#($)*.	# ',!%#($)*.( '+!%$*%+#($)*.$ *.#o:x ##
 ##ADiPB
r @=@:@ ,@ ,	@
 +@ /@ /@ /@ :@ :@ :@ :@ 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sPB
D
 3;)."" ##('	E
PB
X
 /Y
PB
Z
 ![
PB
 P P	    c                 `    | j                  |t        | j                  |   d   d   t              S )N	precisionamount)decimal_to_precisionr(   r   r)   )r5  symbolr;  s      r7  amount_to_precisionzbitvavo.amount_to_precisionu  s1     ((4<<;OP[;\]e;fhvwwr8  c                     | j                  |t        | j                  |   d   d   | j                        }| j                  |t        dt
              S )Nr:  price   )r<  r'   r   r-  r(   r)   )r5  r=  r@  s      r7  price_to_precisionzbitvavo.price_to_precision{  sL    ))%V8L[8YZa8bdhdvdvw
 ((!^LLr8  c                 H    | j                  |      }| j                  |d      S )a  
        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r5  paramsresponses      r7  
fetch_timezbitvavo.fetch_time  s)     %%f-   622r8  c                 F    | j                  |      }| j                  |      S )a  

        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_marketsrF  s      r7  fetch_marketszbitvavo.fetch_markets  s'     ((0 !!(++r8  c                 T   | j                   }| j                  |d      }g }| j                  }t        dt	        |            D ]b  }||   }| j                  |d      }| j                  |d      }	| j                  |d      }
| j                  |	      }| j                  |
      }| j                  |d      }| j                  ||	      }| j                  |d      }|j                  | j                  i d|d|d	z   |z   d|d|d
d d|	d|
dd ddddddddddddd|dk(  dddd d d d d d d |d   d   |d   d   | j                  |d|      | j                  |d      dd d d| j                  |d       d dd d d| j                  |d!      d dd"d |d#             e |S )$Nr0   r   marketbasequotestatusr:  r=  /settlebaseIdquoteIdsettleIdtyper=   Tr>   Fr?   r@   rA   activer   contractr   r   r   decimalspricePrecision)r;  r@  minmaxminOrderInBaseAssetminOrderInQuoteAsset)r   r;  r@  r   )r   contractSizeexpiryexpiryDatetimestrike
optionTyper   r   r:  limitscreatedinfo)
currenciesindex_byr   rangelensafe_stringsafe_currency_code
safe_valuerE  appendsafe_market_structuresafe_number)r5  r   rj  currenciesByIdresultr   irO  r0   rU  rV  rP  rQ  rR  baseCurrencybasePrecisions                   r7  rL  zbitvavo.parse_markets  s   __
z48yyq#g,' <	AQZF!!&(3B%%ff5F&&vw7G**62D++G4E%%fh7F??>6BL --lKHMMM$44 26b26$*u,26 26 	26
 $26 &26 726 D26 26 26 %26 26 %26 %26 6Y.26  E!26" $#26$   $"&"i1i1"//j-X!..v7GH  $#!
  $//8MN#
  $#
  $//8NO#$  c26 2 2<	z r8  c                 F    | j                  |      }| j                  |      S )a  

        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_customrF  s      r7  fetch_currencieszbitvavo.fetch_currencies  s(     ''/D ++H55r8  c                 6   | j                  | j                  dg       }i }t        dt        |            D ]?  }||   }| j	                  |d      }| j                  |      }| j                  ||      }i }	| j                  |dg       }
| j	                  |d      dk(  }| j	                  |d      dk(  }|xr |}| j                  |d      }| j                  |d	d
      }| j                  |d      }t        dt        |
            D ],  }|
|   }| j                  |      }||||||||d|d did	|	|<   . | j                  |||| j	                  |d      ||||	|||rdndd d dd d d|d ddd      ||<   B | j                  | j                  |      | _        |S )Nr,  r   r=  r*  depositStatusOKwithdrawalStatuswithdrawalFeer[  rA  withdrawalMinAmountr   r]  )	ri  r0   networkrY  r   r   feer:  rg  r1   fiatcrypto)r;  r   r   )ri  r0   coder1   rY  r   r   r*  r  r:  rX  rg  )	safe_listr"  rl  rm  rn  ro  in_arrayrs  rE  network_id_to_codesafe_currency_structurer1  rj  )r5  rj  r,  ru  rv  currencyr0   r  isFiatr*  networksArrayr   r   rY  withdrawFeer:  minWithdrawj	networkIdnetworkCodes                       r7  r{  zbitvavo.parse_currencies_custom  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))(JBI**85JKK1c-01 )!,	"55i@$#*$& *&!*"#.#'%)%&  77 ((6: "&$"&"(h  $#
  $# 
  +#!9 F4LC;	z **4??FCr8  r=  c                     | j                          | j                  |      }d|d   i}| j                  | j                  ||            }| j	                  ||      S )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>`
        rO  r0   )load_marketsrO  publicGetTicker24hextendparse_ticker)r5  r=  rG  rO  requestrH  s         r7  fetch_tickerzbitvavo.fetch_ticker~  s`     	V$fTl
 **4;;w+GH"   622r8  NtickerrO  c                 t   | j                  |d      }| j                  ||d      }| j                  |d      }| j                  |d      }| j                  |d      }| j                  |d      }| j                  |d      }	| j                  i d|d|d	| j	                  |      d
| j                  |d
      d| j                  |d      d| j                  |d      d| j                  |d      d| j                  |d      d| j                  |d      dd d|	d|d|dd dd dd dd |||d|      S )NrO  -	timestamplastvolumevolumeQuoteopenr=  datetimehighlowbid	bidVolumebidSizeask	askVolumeaskSizevwapclosepreviousClosechanger   average)
baseVolumequoteVolumeri  )rn  safe_symbolrE  safe_tickeriso8601)
r5  r  rO  marketIdr=  r  r  r  r  r  s
             r7  r  zbitvavo.parse_ticker  s   & ##FH5!!(FC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#!
$ %&)!
* + 	r8  symbolsc                 h    | j                          | j                  |      }| j                  ||      S )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)r5  r  rG  rH  s       r7  fetch_tickerszbitvavo.fetch_tickers  s5     	**62& !!(G44r8  sincer   c                 v   | j                          | j                  |      }d}| j                  |dd      \  }}|r| j                  d||||      S d|d   i}|t	        |d      |d<   |||d<   | j                  d	||      \  }}| j                  | j                  ||            }| j                  ||||      S )
an  

        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>`
        Frx   paginaterO  r0   r   r   startend)	r  rO  handle_option_and_paramsfetch_paginated_call_dynamicr^  handle_until_optionpublicGetMarketTradesr  parse_trades)	r5  r=  r  r   rG  rO  r  r  rH  s	            r7  fetch_tradeszbitvavo.fetch_trades  s     	V$88PZ[&44]FESXZ`aafTl
 "5$/GG$GG225'6J--dkk'6.JK   65%@@r8  tradec                 8   | j                  |d      }| j                  |d      }| j                  |d      }| j                  |d      }| j                  |dd      }| j                  |d      }| j                  ||d      }	| j	                  |d	      }
d }|
|
rd	nd
}| j                  |d      }d }|(| j                  |d      }| j                  |      }||d}| j                  |d      }| j                  |||	|| j                  |      |d ||||d |d|      S )Nr@  r;  r  sider0   fillIdrO  r  r   r   r  feeCurrencyr   r  orderId)ri  r0   r=  r  r  r   rX  r  takerOrMakerr@  r;  r   r  )rn  rE  safe_string_2r  rp  ro  
safe_trader  )r5  r  rO  priceStringamountStringr  r  r0   r  r=  r   r  feeCostStringr  feeCurrencyIdfeeCurrencyCoder  s                    r7  parse_tradezbitvavo.parse_trade  sV   r &&ug6''x8%%e[9	v.tX6##E84!!(FC8w/&+7L((6$ ,,UMBM"55mDO%+C ""5)4"Y/( " 
  	r8  c                 f    | j                          | j                  |      }| j                  |      S )aT  

        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_feesrF  s      r7  fetch_trading_feeszbitvavo.fetch_trading_fees{  s3     	))&1 &&x00r8  c                     | j                  |d      }| j                  |d      }| j                  |d      }i }t        dt        | j                              D ]  }| j                  |   }||||ddd||<    |S )Nr   r   r   r   T)ri  r=  r   r   r   r   )rp  rs  rl  rm  r  )	r5  r   rO  	feesValuer   r   ru  rv  r=  s	            r7  r  zbitvavo.parse_trading_fees  s     OOD&1	  G4  G4q#dll+, 		A\\!_F "!F6N		 r8  c                     | j                          | j                  |      }d|d   i}|||d<   | j                  | j                  ||            }| j	                  ||d         }| j                  |d      |d<   |S )aB  

        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
        rO  r0   depthr=  nonce)r  rO  publicGetMarketBookr  parse_order_bookrE  )r5  r=  r   rG  rO  r  rH  	orderbooks           r7  fetch_order_bookzbitvavo.fetch_order_book  s     	V$fTl
 $GG++DKK,HI" ))(F84DE	!..xA	'r8  c           	          | j                  |d      | j                  |d      | j                  |d      | j                  |d      | j                  |d      | j                  |d      gS )Nr   r            r   )rE  rs  )r5  ohlcvrO  s      r7  parse_ohlcvzbitvavo.parse_ohlcv  sn     eQ'UA&UA&UA&UA&UA&
 	
r8  r   c                 P   | j                  |      }|d   | j                  | j                  ||      d}|B| j                  |      }||d<   |d}nt	        |d      }| j                  |||z  dz        |d<   | j                  d||      \  }}|||d<   | j                  ||      S )Nr0   )rO  intervalr  r   r   r  r   )rO  rn  r   parse_timeframer^  sumr  r  )	r5  r=  	timeframer  r   rG  rO  r  durations	            r7  fetch_ohlcv_requestzbitvavo.fetch_ohlcv_request  s    V$Tl(()YO
 ++I6H$GG}E4(!XXeUX-=-DEGEN225'6J$GG{{7F++r8  c           	         | j                          | j                  |      }d}| j                  |dd      \  }}|r| j                  d|||||d      S | j	                  |||||      }| j                  |      }	| j                  |	||||      S )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
        Frg   r  r   )r  rO  r  "fetch_paginated_call_deterministicr  publicGetMarketCandlesparse_ohlcvs)
r5  r=  r  r  r   rG  rO  r  r  rH  s
             r7  fetch_ohlcvzbitvavo.fetch_ohlcv  s     	V$88zZ&::<QVX]_hjprvww**69eUFS..w7   69eUKKr8  c                 2   |d d d}t        dt        |            D ]i  }||   }| j                  |d      }| j                  |      }| j	                         }| j                  |d      |d<   | j                  |d      |d<   |||<   k | j                  |      S )N)ri  r  r  r   r=  	availablefreeinOrderused)rl  rm  rn  ro  r   safe_balance)r5  rH  ru  rv  r   
currencyIdr  r   s           r7  parse_balancezbitvavo.parse_balance  s    

 q#h-( 	#AqkG))'8<J**:6DllnG"..wDGFO"..w	BGFO"F4L	#   ((r8  c                 f    | j                          | j                  |      }| j                  |      S )ae  

        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  rF  s      r7  fetch_balancezbitvavo.fetch_balance-  s3     	))&1 !!(++r8  r  c                    | j                          | j                  |      }d|d   i}| j                  | j                  ||            }| j	                  |d      }| j	                  |d      }| j                  |       ||d||dS )a9  
        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>`
        r=  r0   address	paymentIdN)ri  r  r  r  tag)r  r  privateGetDepositr  rn  check_address)r5  r  rG  r  r  rH  r  r  s           r7  fetch_deposit_addresszbitvavo.fetch_deposit_addressC  s     	==&htn
 ))$++gv*FG ""8Y7x57#
 	
r8  rX  r  r;  r@  c                    | j                  |      }|d   ||d}|dk(  xs |dk(  xs |dk(  }	|dk(  xs |dk(  xs |dk(  }
| j                  |d	      }| j                  |g d
      }| j                  |	d|      }| j	                  |d      }| j	                  |d      }| j                  |g d      }|	rd }|J| j                  |      }| j                  |      }t        j                  ||      }| j                  |      }n| j                  |d      }|=| j                  |d         d   }| j                  |t        || j                        |d<   n| j                  ||      |d<   | j                  |dg      }n,|
r*| j!                  ||      |d<   | j                  ||      |d<   |d uxs |dk(  xs |dk(  }|d uxs |d uxr | xs |dk(  xs |dk(  }|r||}|	rdnd|d<   n|r||}|	rdnd|d<   || j!                  ||      |d<   d|d<   d|d<   |
|dk7  r||d	<   |rd|d<   d }| j#                  |dd      \  }}|| j%                  |      |d<   | j'                  ||      S )Nr0   )rO  r  	orderTyperO  stopLoss
takeProfitr   stopLossLimittakeProfitLimitr   r   	stopPricetriggerAmountFr   r   )r   r   r  r   r   r   rQ  r:  amountQuoter;  r@  r  r  triggerType	lastTradetriggerReferencer   TpostOnlyrG   r+  )rO  rn  safe_string_nis_post_onlyrp  omitnumber_to_stringr+   
string_mulr4  rs  r  r<  r(   r-  r>  rB  r  parse_to_intr  )r5  r=  rX  r  r;  r@  rG  rO  r  isMarketOrderisLimitOrderr   r   r  r   r   r   r  r  quoteAmountr:  isTakeProfit
isStopLossr+  s                           r7  create_order_requestzbitvavo.create_order_requesta  s   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&$($<$<VV$L!YYvx0F#66vu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&'#+*=%0GM""&GJ
!::6=R^_
F!$($5$5j$AGL!{{7F++r8  c                     | j                          | j                  |      }| j                  ||||||      }| j                  |      }	| j	                  |	|      S )a3  
        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]: "decrementAndCancel", "cancelOldest", "cancelNewest", "cancelBoth"
        :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  rO  r   privatePostOrderparse_order)
r5  r=  rX  r  r;  r@  rG  rO  r  rH  s
             r7  create_orderzbitvavo.create_order  s^    2 	V$++FD$vV((1R &11r8  r0   c                 l   i }| j                  |      }	| j                  |d      }
| j                  |g d      }| j                  |g d      }|| j	                  ||      |d<   || j                  ||      |d<   |
| j                  ||
      |d<   || j	                  ||      |d<   | j                  ||      }| j                  |      rt        | j                  dz         | j                  |d      }|||d	<   d }| j                  |d
d      \  }}|| j                  |      |d<   |	d   |d<   |S )NamountRemainingr  )r&  r   r  r  r@  r;  r  zR editOrder() requires an amount argument, or a price argument, or non-empty paramsclientOrderIdr  rL   r+  r0   rO  )rO  rs  r  r  rB  r>  r  is_emptyr   r0   rn  r  r  )r5  r0   r=  rX  r  r;  r@  rG  r  rO  r&  r   r'  r+  s                 r7  edit_order_requestzbitvavo.edit_order_request  sm   V$**63DE))&2`a6#de#66vuEGG $ 8 8 HGH&)-)A)A&/)ZG%&#'+'>'>v|'TGO$++gv.==!#DGG  /C  %C  D  D((A !#GI
!::6;P\]
F!$($5$5j$AGL!"4Lr8  c           	          | j                          | j                  |      }| j                  |||||||      }	| j                  |	      }
| j	                  |
|      S )a  
        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  rO  r)  privatePutOrderr#  )r5  r0   r=  rX  r  r;  r@  rG  rO  r  rH  s              r7  
edit_orderzbitvavo.edit_order  s^     	V$))"fdD&%QWX''0&11r8  c                    |t        | j                  dz         | j                  |      }d|d   i}| j                  |d      }|||d<   d }| j	                  |dd      \  }}|| j                  |      |d<   | j                  ||      S )Nz) cancelOrder() requires a symbol argumentrO  r0   r'  r  rD   r+  )r   r0   rO  rn  r  r  r  )r5  r0   r=  rG  rO  r  r'  r+  s           r7  cancel_order_requestzbitvavo.cancel_order_request  s    >#DGG.Y$YZZV$fTl
 ((A !#GI
!::6=R^_
F!$($5$5j$AGL!{{7F++r8  c                     | j                          | j                  |      }| j                  |||      }| j                  |      }| j	                  ||      S )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  rO  r.  privateDeleteOrderr#  )r5  r0   r=  rG  rO  r  rH  s          r7  cancel_orderzbitvavo.cancel_order!  sW     	V$++B?**73 &11r8  c                     | j                          i }d}|| j                  |      }|d   |d<   | j                  | j                  ||            }| j	                  ||      S )a  

        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>`
        Nr0   rO  )r  rO  privateDeleteOrdersr  parse_orders)r5  r=  rG  r  rO  rH  s         r7  cancel_all_orderszbitvavo.cancel_all_orders:  sl     	[[(F &tGH++DKK,HI   622r8  c                    |t        | j                  dz         | j                          | j                  |      }d|d   i}| j	                  |d      }|||d<   | j                  | j                  ||            }| j                  ||      S )a  
        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 argumentrO  r0   r'  r  )r   r0   r  rO  rn  privateGetOrderr  r#  )r5  r0   r=  rG  rO  r  r'  rH  s           r7  fetch_orderzbitvavo.fetch_orderT  s     >#DGG.X$XYYV$fTl
 ((A !#GI''GV(DEF &11r8  c                     | j                  |      }d|d   i}|||d<   |||d<   | j                  d||      \  }}| j                  ||      S NrO  r0   r  r   r  rO  r  r  r5  r=  r  r   rG  rO  r  s          r7  fetch_orders_requestzbitvavo.fetch_orders_request  k    V$fTl
 $GG$GG225'6J{{7F++r8  c                 H   |t        | j                  dz         | j                          d}| j                  |dd      \  }}|r| j	                  d||||      S | j                  |      }| j                  ||||      }| j                  |      }| j                  ||||      S )az  

        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 argumentFrl   r  )	r   r0   r  r  r  rO  r=  privateGetOrdersr4  	r5  r=  r  r   rG  r  rO  r  rH  s	            r7  fetch_orderszbitvavo.fetch_orders  s     >#DGG.Y$YZZ88PZ[&44]FESXZ`aaV$++FE5&I((1J   65%@@r8  c                     | j                          i }d}|| j                  |      }|d   |d<   | j                  | j                  ||            }| j	                  ||||      S )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>`
        Nr0   rO  )r  rO  privateGetOrdersOpenr  r4  )r5  r=  r  r   rG  r  rO  rH  s           r7  fetch_open_orderszbitvavo.fetch_open_orders  su     	
 [[(F &tGH,,T[[&-IJJ   65%@@r8  rR  c                 H    dddddddddddddd}| j                  |||      S )Nr  canceledclosed)newrG  canceledAuctioncanceledSelfTradePreventioncanceledIOCcanceledFOKcanceledMarketProtectioncanceledPostOnlyfilledpartiallyFilledexpiredrejectedawaitingTriggerrn  r5  rR  statusess      r7  parse_order_statuszbitvavo.parse_order_status  sG    ")+5%%(2 *%!"%
 &&99r8  r   c                    | j                  |d      }| j                  |d      }| j                  |d      }| j                  ||d      }|d   }| j                  | j                  |d            }| j                  |d      }| j                  |d      }	| j                  |d	      }
| j                  |d
      }| j                  |d      }| j                  |d      }| j                  |d      }|:| j                  |d      }| j                  |d      }t	        j
                  ||      }d }| j                  |d      }|(| j                  |d      }| j                  |      }||d}| j                  |dg       }| j                  |d      }| j                  |d      }| j                  i d|d|dd d|d| j                  |      dd d|d|	d|d|d|d	|
d| j                  |d      d
|d|dd d |||||d!|      S )"Nr  rh  rO  r  r=  rR  r  r  r@  r;  r&  filledAmountfilledAmountQuoter  amountQuoteRemainingfeePaidr  r  fillsr   r  ri  r0   r'  r  r  lastTradeTimestamprX  r   r   r  rP  )	remainingrR  r  r   )rn  rE  safe_marketrX  r+   
string_subrs  ro  rp  
safe_orderr  )r5  r   rO  r0   r  r  r=  rR  r  rX  r@  r;  r`  rP  r   r  r\  r  feeCostr  r  	rawTradesr   r  s                           r7  r#  zbitvavo.parse_order*  s   \ eY/%%eY7	##E84!!(FC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# 
$ #+ 
, - 	r8  c                     | j                  |      }d|d   i}|||d<   |||d<   | j                  d||      \  }}| j                  ||      S r:  r;  r<  s          r7  fetch_my_trades_requestzbitvavo.fetch_my_trades_request  r>  r8  c                 H   |t        | j                  dz         | j                          d}| j                  |dd      \  }}|r| j	                  d||||      S | j                  |      }| j                  ||||      }| j                  |      }| j                  ||||      S )aC  

        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 argumentFrf   r  )	r   r0   r  r  r  rO  rg  privateGetTradesr  rA  s	            r7  fetch_my_tradeszbitvavo.fetch_my_trades  s     >#DGG.[$[\\88R\]&44_feUZ\bccV$..vueVL((1$   65%@@r8  c                     | j                  |      }|d   | j                  ||      |d}|||d<   | j                  ||      S )Nr0   )r=  r;  r  r  )r  currency_to_precisionr  )r5  r  r;  r  r  rG  r  r  s           r7  withdraw_requestzbitvavo.withdraw_request  sS    ==&tn00v>
 ?#&GK {{7F++r8  r  c                     | j                  ||      \  }}| j                  |       | j                          | j                  |      }| j	                  |||||      }| j                  |      }| j                  ||      S )a  
        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_paramsr  r  r  rm  privatePostWithdrawalparse_transaction)	r5  r  r;  r  r  rG  r  r  rH  s	            r7  r   zbitvavo.withdraw  s     99#vFV7#==&''fgsFK--g6 %%h99r8  c                     i }d }|| j                  |      }|d   |d<   |||d<   |||d<   | j                  ||      S Nr0   r=  r  r   r  r  r5  r  r  r   rG  r  r  s          r7  fetch_withdrawals_requestz!bitvavo.fetch_withdrawals_request  c    
 }}T*H (GH$GG$GG{{7F++r8  c                     | j                          | j                  ||||      }d}|| j                  |      }| j                  |      }| j	                  ||||ddi      S )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>`
        NrX  r   )r  rv  r  privateGetWithdrawalHistoryparse_transactionsr5  r  r  r   rG  r  r  rH  s           r7  fetch_withdrawalszbitvavo.fetch_withdrawals  sp     	00ueVL}}T*H33G< &&x5%&R^I_``r8  c                     i }d }|| j                  |      }|d   |d<   |||d<   |||d<   | j                  ||      S rs  rt  ru  s          r7  fetch_deposits_requestzbitvavo.fetch_deposits_request#  rw  r8  c                     | j                          | j                  ||||      }d}|| j                  |      }| j                  |      }| j	                  ||||ddi      S )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>`
        NrX  r   )r  r~  r  privateGetDepositHistoryrz  r{  s           r7  fetch_depositszbitvavo.fetch_deposits4  sp     	--dE5&I}}T*H009 &&x5%&R[I\]]r8  c           
      @    dddddddddd	}| j                  |||      S )NpendingokrG  )	awaiting_processingawaiting_email_confirmationawaiting_bitvavo_inspectionapprovedsending
in_mempool	processed	completedrG  rU  rV  s      r7  parse_transaction_statusz bitvavo.parse_transaction_statusT  s;    #,+4+4! #""

 &&99r8  transactionr  c                 ,   d }| j                  |d      }| j                  |d      }| j                  ||      }| j                  | j                  |d            }| j	                  |d      }| j                  |d      }	| j                  |d      }
d }| j	                  |d      }|||d}d }d	|v sd|v rd
}nd}| j                  |d      }i d|d|d|
d|d| j                  |      dd d|	d|	dd d|d|d|d|d|d|dd d|d d d dS )Nr  r=  rR  r;  r  txIdr  r  successr   r   r  ri  r0   txidr  addressFrom	addressTotagFromr  tagTorX  r  updated)r  commentinternal)rE  rn  ro  r  rs  r  )r5  r  r  r0   r  r  r  rR  r;  r  r  r  rd  rX  r  s                  r7  rq  zbitvavo.parse_transactionb  s   D %%k;?	%%k8<
&&z8<..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#
$ )
 	
r8  c                     || j                  |d      dd| j                  |d      ddi d}| j                  |d      }| j                  |d      }| j                  |d      }|d	k(  r|}| j                  ||      }|d
   |d   d|d   |<   |S )Nr  F)r  r   
depositFee)ri  r   r   r*  r*  r   r  Mainnetr   r   )r   r   )rs  rp  rn  r  )r5  r  r  ru  r*  r  currencyCoder  s           r7  parse_deposit_withdraw_feez"bitvavo.parse_deposit_withdraw_fee  s    & ''_=#
 ''\:# 
 ??3
3OOHa0	''&9	!$I--iFi(z*+
z;' r8  codesc                 j    | j                          | j                  |      }| j                  ||d      S )ag  
        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>`
        r=  )r  rz  parse_deposit_withdraw_fees)r5  r  rG  rH  s       r7  fetch_deposit_withdraw_feesz#bitvavo.fetch_deposit_withdraw_fees  s7     	''/( //%JJr8  r   GETc                    | j                  || j                  |            }d| j                  z   dz   | j                  ||      z   }|dk(  xs |dk(  }	|	r|r|d| j	                  |      z   z  }|dk(  r| j                          d}
|	s|r| j                  |      }|}
t        | j                               }||z   |z   |
z   }| j                  | j                  |      | j                  | j                        t        j                        }| j                  | j                  dd      }| j                   |||d	}|	sd
|d<   | j"                  d   |   |z   }||||dS )NrS  r  DELETE?r    r)  10000)zBITVAVO-ACCESS-KEYzBITVAVO-ACCESS-SIGNATUREzBITVAVO-ACCESS-TIMESTAMPr)  zapplication/jsonzContent-Typer   )urlmethodbodyheaders)r  extract_paramsr7   implode_params	urlencodecheck_required_credentialsjsonstrmillisecondshmacencoder   hashlibsha256rn  r"  r   r   )r5  pathr   r  rG  r  r  queryr  getOrDeletepayloadr  auth	signatureaccessWindows                  r7  signzbitvavo.sign  s_   		&$"5"5d";<DLL 3&)<)<T6)JJ?Fh,>sT^^E222)++-G99U+D"GD--/0Iv%+g5D		$++d"3T[[5Mw~~^I++DLL:QSZ[L&*kk,5,5)5	G *<'iis#c)fdwOOr8  httpCodereasonr  r  r  r  c
                    |y | j                  |d      }
| j                  |d      }|
]| j                  dz   |z   }| j                  | j                  d   ||       | j	                  | j                  d   |
|       t        |      y )N	errorCodeerror r!  r   )rn  r0   throw_broadly_matched_exceptionr   throw_exactly_matched_exceptionr   )r5  r  r  r  r  r  r  rH  requestHeadersrequestBodyr  r  feedbacks                r7  handle_errorszbitvavo.handle_errors  s     $$X{;	  73 ww}t+H001I5RZ[001I9V^_))r8  c                 B    d|v r	d|vr|d   S | j                  |dd      S )Nr   rO  r   r   )rp  )r5  r   r  r  rG  configs         r7  calculate_rate_limiter_costz#bitvavo.calculate_rate_limiter_cost)  s/    & 8v+=*%%vvq11r8  )N)O__name__
__module____qualname__r   r3  r>  rB  r
   rI  r   r   rM  rL  r   r|  r{  r  r   r  dictr  r   r   r  r   r  r  r   r  r  r   r  listr  r   r  r  r   r  r  r	   r  r   r   floatr   r   r$  r)  r,  r.  r1  r5  r8  r=  r   rB  rE  rX  r#  rg  rj  rm  r   r   rv  r|  r~  r  r  r   rq  r  r  r  intr  r  __classcell__)r6  s   @r7  r-   r-       s   Q# Qf
xM !# 
3s 
3 $& ,$v, ,4BH ') +6Z +6ZbH 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{} 7,3 7,i 7,y 7,Z_ 7,hk 7,r gksu E23 E2i E2y E2RW E2`c E2N FJQU^` S 6 `drv  @B 2S 2# 2Y 2i 2Y\ 2lo 2* ;?r ,s ,C ,  37r 2s 2C 22 /32 3 34 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 , DHPR :S :% :# :Wb :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 2r8  r-   )2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(   r)   r*   ccxt.base.preciser+   r-    r8  r7  <module>r     s    ( -  J  J  J  J  J  J  * 0 - - . ' & . + ) * . 1 * 0 3 9 = %L 2h L 2r8  