
    ie                       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 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-m.Z.  G d dee          Z/dS )    )Exchange)ImplicitAPIN)Balances
CurrenciesCurrency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                   v    e Zd Z fdZdFdZd Zd Zi 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dFd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dFde	defdZi fdefdZdFdZdi fdededefdZdFd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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(Z.ddi fd'eded!e(d"e)d#e+d$e+fd)Z/di fd'e!de!fd*Z0di fd'ede!fd+Z1di fde!fd,Z2di fd'ede!fd-Z3dddi fde!dedefd.Z4dddi fde!dededee5         fd/Z6dddi fde!dededee5         fd0Z7d1 Z8dFde	de5fd2Z9dddi fde!dedefd3Z:dddi fde!dededee         fd4Z;di fde!fd5Z<di fded#e*fd6Z=dddi fde!dedefd7Z>dddi fde!dededee?         fd8Z@dddi fde!dedefd9ZAdddi fde!dededee?         fd:ZBd; ZCdFd<eDde?fd=ZEdFd<eDfd>ZFdi fd?efd@ZGdAdBi ddfdCZHdD ZIi fdEZJ xZKS )Gbitvavoc                    |                      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ddddddddddddddddDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdTdUdVdWdXdYdZd[d\d]d]d]d]d^d]d]d]d]d_d`da	id]d]d^d]d_d`d^d^d]d^d^db	d]d]dcddd]id]d]dedfdUdgdhdd|                     di          |                     dj          |                     dk          |                     di          g|                     dl          |                     dm          g|                     dn          |                     do          g|                     dp          |                     dq          g|                     dr          |                     ds          g|                     dt          |                     du          g|                     dv          |                     dw          g|                     dx          |                     dy          g|                     dz          |                     d{          gg	|                     dk          |                     d|          g|                     dl          |                     ds          g|                     dn          |                     du          g|                     dp          |                     dw          g|                     dr          |                     dy          g|                     dt          |                     d{          g|                     dv          |                     d{          g|                     dx          |                     d}          g|                     dz          |                     d}          gg	d~didd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dddddddt$          dddi          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fetchDepositsfetchDepositWithdrawFeeemulatedfetchDepositWithdrawFeesfetchFundingHistoryfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchIndexOHLCVfetchIsolatedBorrowRatefetchIsolatedBorrowRatesfetchLeveragefetchLeverageTiersfetchMarginModefetchMarketsfetchMarkOHLCVfetchMyTrades
fetchOHLCVfetchOpenInterestHistoryfetchOpenOrders
fetchOrderfetchOrderBookfetchOrdersfetchPositionfetchPositionModefetchPositions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   urlszdhttps://user-images.githubusercontent.com/1294454/169202626-bd130fc5-fcf9-41bb-8d97-6093225c73cd.jpgz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
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)BITVAVO-ACCESS-WINDOWnetworksprecisionModecommonCurrenciesMIOTAIOTA)deep_extendsuperr+   describeparse_numberr   r   r"   r   r#   r   r    r   r!   r   r   r$   r   r(   )self	__class__s    R/var/www/html/crypto-bot/backend/venv/lib/python3.11/site-packages/ccxt/bitvavo.pyr  zbitvavo.describe"   s   gt 4 4 = = ? ? CB
)CB
ICB
 $CB
 	CB

 tCB
 CB
 4CB
  CCC %C 	C
 %C %C UC "4C tC $UC  C tC (C 'C (C  "4!C" T#C C$ %C& +E'C( )%)C* '+C, (-C. "4/C0 &t1C2  3C4 *:5C6 +D7C8 &u9C: #E;C< *5=C> $U?C@ "5ACB *5CCD +EEC C CF  GCH %eICJ "5KCL MCN !%OCP  QCR dSCT +EUCV "4WCX dYCZ !$[C\ t]C^  _C` $UaCb !%cCd %eeCf )%gC Ch  $ $!##($(!&"'$( %$!&#(! EC C CCB
X  YCB
r ~78  .25?
 
sCB
H  !#$"#)*+,,-()'(/0b&A&A
 
 $%!""#/0b&A&A"##$#$*+-.
 
 "#&' 
   "#"# ' & &ICB
V !%"&!..x88!..w77 "..s33T5F5Fx5P5PQ!..x88$:K:KH:U:UV!..x88$:K:KH:U:UV!..x88$:K:KH:U:UV!..y994;L;LX;V;VW!..y994;L;LX;V;VW!..y994;L;LX;V;VW!..z::D<M<Mh<W<WX!..z::D<M<Mh<W<WX
" "..s33T5F5Fx5P5PQ!..x88$:K:KH:U:UV!..x88$:K:KH:U:UV!..x88$:K:KH:U:UV!..y994;L;LX;V;VW!..y994;L;LX;V;VW!..y994;L;LX;V;VW!..z::D<M<Mh<W<WX!..z::D<M<Mh<W<WX
"  WCB
V "$ $WC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 H_CB
p ).""  qCB
~ /CB
@ !ACB
 C C C	    Nc                 ^    |                      |d| j        |         d         t                    S )Nr   	precision)decimal_to_precision
currenciesr'   )r	  codefeenetworkCodes       r  currency_to_precisionzbitvavo.currency_to_precision(  s)    ((a1F{1SUcdddr  c                 t    |                      |t          | j        |         d         d         t                    S )Nr  amount)r  r&   r   r'   )r	  symbolr  s      r  amount_to_precisionzbitvavo.amount_to_precision+  s2     ((4<;OP[;\]e;fhvwwwr  c                     |                      |t          | j        |         d         d         | j                  }|                      |t          dt
                    S )Nr  price   )r  r%   r   r  r&   r'   )r	  r  r  s      r  price_to_precisionzbitvavo.price_to_precision1  sM    ))%V8L[8YZa8bdhdvww
 ((!^LLLr  c                 X    |                      |          }|                     |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r	  paramsresponses      r  
fetch_timezbitvavo.fetch_time9  s/     %%f--   6222r  returnc                 V    |                      |          }|                     |          S )a  
        :see: 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_marketsr   s      r  fetch_marketszbitvavo.fetch_marketsE  s-     ((00 !!(+++r  c                    | j         }|                     |d          }g }| j        }t          dt	          |                    D ]}||         }|                     |d          }|                     |d          }	|                     |d          }
|                     |	          }|                     |
          }|                     |d          }|                     ||	          }|                     |d          }|	                    | 
                    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         |                     |d|          |                     |d          dd d d|                     |d           d dd d d|                     |d!          d dd"d |d#                     |S )$Nr-   r   marketbasequotestatusr  r  /settlebaseIdquoteIdsettleIdtyper:   Tr;   Fr<   r=   r>   activer   contractlinearr   r   decimalspricePrecision)r  r  minmaxminOrderInBaseAssetminOrderInQuoteAsset)leverager  r  r   )inversecontractSizeexpiryexpiryDatetimestrike
optionTyper   r   r  limitscreatedinfo)r  index_byr   rangelensafe_stringsafe_currency_code
safe_valuer  appendsafe_market_structuresafe_number)r	  r   r  currenciesByIdresultr   ir*  r-   r0  r1  r+  r,  r-  baseCurrencybasePrecisions                   r  r'  zbitvavo.parse_markets]  s   _
z488yq#g,,'' <	 <	AQZF!!&(33B%%ff55F&&vw77G**622D++G44E%%fh77F??>6BBL --lKH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X!..v7GHH   $#! !
  $//8MNN# 
  $# 
  $//8NOO#  $  c26 26 26 2 2 2 2 2 2f r  c                 V    |                      |          }|                     |          S )a  
        :see: 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_currenciesr   s      r  fetch_currencieszbitvavo.fetch_currencies  s.     ''//D $$X...r  c                    i }t          dt          |                    D ]D}||         }|                     |d          }|                     |          }i }|                     |dg           }t          |          }	|	dk    }
|                     |d          dk    }|                     |d          dk    }|o|}|                     |d          }|                     |d	d
          }|                     |d          }|
r1|d         }|                     |          }||||||||d|d did	||<   ||||                     |d          ||||||d d dd d d|d ddd||<   F|                     | j	        |          | _	        |S )Nr   r  r   r   depositStatusOKwithdrawalStatuswithdrawalFeer7  r  withdrawalMinAmountr{   r9  )	rG  r-   networkr4  r   r{   r  r  rE  r.   )r  r   r{   )rG  r-   r  r.   r4  r   r{   r   r  r  rE  )
rI  rJ  rK  rL  rM  rP  r  network_id_to_coder  r  )r	  r  rR  rS  currencyr-   r  r   networksArraynetworksLengthisOneNetworkr   r   r4  withdrawFeer  minWithdraw	networkIdr  s                      r  rX  zbitvavo.parse_currencies  s   D q#j//** ;	 ;	A!!}H!!(H55B**2..DH OOHj"EEM //N*a/LxAATIG//(4FGG4OJ+F**8_EEK))(JBBI**85JKKK )!,	"55i@@$#*$& *&!*"#.#'% %) )%" !((6:: "&$"&  $# 
  $#   
  +#! !  F4LL6 **4?FCCr  r  c                     |                                   |                     |          }d|d         i}|                     |                     ||                    }|                     ||          S )a  
        :see: 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>`
        r*  r-   )load_marketsr*  publicGetTicker24hextendparse_ticker)r	  r  r!  r*  requestr"  s         r  fetch_tickerzbitvavo.fetch_ticker/  sr     	V$$fTl
 **4;;w+G+GHH"   6222r  r*  c                    |                      |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|          S )Nr*  -	timestamplastvolumevolumeQuoteopenr  datetimehighlowbid	bidVolumebidSizeask	askVolumeaskSizevwapclosepreviousClosechanger   average)
baseVolumequoteVolumerG  )rK  safe_symbolr  safe_tickeriso8601)
r	  tickerr*  marketIdr  rr  rs  r  r  rv  s
             r  rm  zbitvavo.parse_tickerO  s	   & ##FH55!!(FC88%%fk::	//%%fh77
&&v}==// !
f!
!
 Y//!
 D$$VV44	!

 4##FE22!
 4##FE22!
 ))&)<<!
 4##FE22!
 ))&)<<!
 D!
 D!
 T!
 D!
 T!
 d!
  $!!
" t#!
$ %&)!
 !
 !
* +  	r  symbolsc                     |                                   |                     |          }|                     ||          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>`
        )rj  rk  parse_tickers)r	  r  r!  r"  s       r  fetch_tickerszbitvavo.fetch_tickers  sA     	**622& !!(G444r  sincelimitc                    |                                   |                     |          }d}|                     |dd          \  }}|r|                     d||||          S d|d         i}|t	          |d          |d<   |||d	<   |                     d
||          \  }}|                     |                     ||                    }|                     ||||          S )ar  
        :see: 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>`
        Frp   paginater*  r-   N  r  startend)	rj  r*  handle_option_and_paramsfetch_paginated_call_dynamicr:  handle_until_optionpublicGetMarketTradesrl  parse_trades)	r	  r  r  r  r!  r*  r  rn  r"  s	            r  fetch_tradeszbitvavo.fetch_trades  s    	V$$88PZ[[& 	b44]FESXZ`aaafTl
 "5$//GG$GG225'6JJ--dkk'6.J.JKK   65%@@@r  c                    |                      |d          }|                      |d          }|                     |d          }|                      |d          }|                     |dd          }|                      |d          }|                     ||d          }	|                     |d	          }
d }|
|
rd	nd
}|                      |d          }d }|0|                      |d          }|                     |          }||d}|                      |d          }|                     |||	||                     |          |d ||||d |d|          S )Nr  r  rr  sider-   fillIdr*  rq  r   r   r  feeCurrencyr   rb  orderId)rG  r-   r  rr  rw  r   r3  r  takerOrMakerr  r  r   r  )rK  r  safe_string_2r  rM  rL  
safe_trader  )r	  trader*  priceStringamountStringrr  r  r-   r  r  r   r  feeCostStringr  feeCurrencyIdfeeCurrencyCoder  s                    r  parse_tradezbitvavo.parse_trade  s   r &&ug66''x88%%e[99	v..tX66##E844!!(FC88w//&+877L((66$ ,,UMBBM"55mDDO%+ C ""5)44"Y//( " 
  
   	r  c                 ~    |                                   |                     |          }|                     |          S )aX  
        :see: 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
        )rj  privateGetAccountparse_trading_feesr   s      r  fetch_trading_feeszbitvavo.fetch_trading_fees(  s?     	))&11 &&x000r  c                 
   |                      |d          }|                     |d          }|                     |d          }i }t          dt          | j                            D ]}| j        |         }||||ddd||<   |S )Nr   r   r   r   T)rG  r  r   r   r   r   )rM  rP  rI  rJ  r  )	r	  r   r*  	feesValuer   r   rR  rS  r  s	            r  r  zbitvavo.parse_trading_fees<  s     OOD&11	  G44  G44q#dl++,, 		 		A\!_F "! F6NN r  c                 6   |                                   |                     |          }d|d         i}|||d<   |                     |                     ||                    }|                     ||d                   }|                     |d          |d<   |S )aF  
        :see: 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
        r*  r-   Ndepthr  nonce)rj  r*  publicGetMarketBookrl  parse_order_bookr  )r	  r  r  r!  r*  rn  r"  	orderbooks           r  fetch_order_bookzbitvavo.fetch_order_bookV  s     	V$$fTl
 $GG++DKK,H,HII" ))(F84DEE	!..xAA	'r  c           	         |                      |d          |                     |d          |                     |d          |                     |d          |                     |d          |                     |d          gS )Nr   r            r   )r  rP  )r	  ohlcvr*  s      r  parse_ohlcvzbitvavo.parse_ohlcv{  s     eQ''UA&&UA&&UA&&UA&&UA&&
 	
r  r}   c                    |                      |          }|d         |                     | j        ||          d}|N|                     |          }||d<   |d}nt	          |d          }|                     |||z  dz            |d<   |                     d||          \  }}|||d<   |                     ||          S )Nr-   )r*  intervalr    r  r  r  )r*  rK  r|   parse_timeframer:  sumr  rl  )	r	  r  	timeframer  r  r!  r*  rn  durations	            r  fetch_ohlcv_requestzbitvavo.fetch_ohlcv_request  s    V$$Tl(()YOO
 
 ++I66H$GG}E4((!XXeUX-=-DEEGEN225'6JJ$GG{{7F+++r  c           	      T   |                                   |                     |          }d}|                     |dd          \  }}|r|                     d|||||d          S |                     |||||          }|                     |          }	|                     |	||||          S )a  
        :see: 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
        Frb   r  r  )rj  r*  r  "fetch_paginated_call_deterministicr  publicGetMarketCandlesparse_ohlcvs)
r	  r  r  r  r  r!  r*  r  rn  r"  s
             r  fetch_ohlcvzbitvavo.fetch_ohlcv  s     	V$$88zZZ& 	x::<QVX]_hjprvwww**69eUFSS..w77   69eUKKKr  c                 t   |d d d}t          dt          |                    D ]}||         }|                     |d          }|                     |          }|                                 }|                     |d          |d<   |                     |d          |d<   |||<   |                     |          S )N)rG  rr  rw  r   r  	availablefreeinOrderused)rI  rJ  rK  rL  r   safe_balance)r	  r"  rR  rS  r   
currencyIdr  r   s           r  parse_balancezbitvavo.parse_balance  s    
 

 q#h--(( 	# 	#AqkG))'8<<J**:66DllnnG"..wDDGFO"..w	BBGFO"F4LL  (((r  c                 ~    |                                   |                     |          }|                     |          S )ai  
        :see: 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>`
        )rj  privateGetBalancer  r   s      r  fetch_balancezbitvavo.fetch_balance  s?     	))&11 !!(+++r  r  c                 L   |                                   |                     |          }d|d         i}|                     |                     ||                    }|                     |d          }|                     |d          }|                     |           |||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  r-   address	paymentIdN)rb  r  tagr`  rG  )rj  rb  privateGetDepositrl  rK  check_address)r	  r  r!  rb  rn  r"  r  r  s           r  fetch_deposit_addresszbitvavo.fetch_deposit_address  s     	==&&htn
 ))$++gv*F*FGG ""8Y77x557###
 
 	
r  r3  r  r  r  c                    |                      |          }|d         ||d}|dk    p|dk    p|dk    }	|dk    p|dk    p|dk    }
|                     |d	          }|                     |g d
          }|                     |	d|          }|                     |d          }|                     |d          }|                     |g d          }|	rd }|U|                     |          }|                     |          }t          j        ||          }| 	                    |          }n| 
                    |d          }|G|                     |d                   d         }|                     |t          || j                  |d<   n|                     ||          |d<   |                     |dg          }n4|
r2|                     ||          |d<   |                     ||          |d<   |d up|dk    p|dk    }|d up|d ur| p|dk    p|dk    }|r||}|	rdnd|d<   n|r||}|	rdnd|d<   |#|                     ||          |d<   d|d<   d|d<   ||dk    r||d	<   |rd|d<   |                     ||          S )Nr-   )r*  r  	orderTyper*  stopLoss
takeProfitr  stopLossLimittakeProfitLimittimeInForcetriggerPrice	stopPricetriggerAmountFstopLossPricetakeProfitPrice)r  r  r  r  r  r   r,  r  amountQuoter  r  r  r  triggerType	lastTradetriggerReferencePOTpostOnly)r*  rK  safe_string_nis_post_onlyrM  omitnumber_to_stringr)   
string_mulr  rP  rb  r  r&   r  r  r  rl  )r	  r  r3  r  r  r  r!  r*  rn  isMarketOrderisLimitOrderr  r  r  r  r  r   r  r  quoteAmountr  isTakeProfit
isStopLosss                          r  create_order_requestzbitvavo.create_order_request  sN   V$$Tl
 

 )\tz/A\t|G[dT_-Dd$RcJc&&v}==))&2`2`2`aa$$]E6BB@@//&2CDD6#s#s#stt 	ID "33E::#44V<<%0{KK((55''77 MM&/::;G	)-)B)B4S\^b^p)q)q&&$($<$<VV$L$L!YYvx00FF 	I#66vuEEGG $ 8 8 H HGH't3m9MmSW[lSl#4/  [\5M4eXdTd  [jnr|j|  [  CG  KZ  CZ
 	X(,1>#S::OGK   	X*.3@#W<<FWGK #'+'>'>v|'T'TGO$%,GM"*5G&'#+*=*=%0GM" 	'"&GJ{{7F+++r  c                     |                                   |                     |          }|                     ||||||          }|                     |          }	|                     |	|          S )aI  
        create a trade order
        :see: https://docs.bitvavo.com/#tag/Orders/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 fullfilled, 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]: The price at which a trigger order is triggered at
        :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>`
        )rj  r*  r  privatePostOrderparse_order)
r	  r  r3  r  r  r  r!  r*  rn  r"  s
             r  create_orderzbitvavo.create_order;  sp    . 	V$$++FD$vVV((11R &111r  r-   c                 l   i }|                      |          }	|                     |d          }
|                     |g d          }|                     |g d          }||                     ||          |d<   ||                     ||          |d<   |
|                     ||
          |d<   ||                     ||          |d<   |                     ||          }|                     |          rt          | j	        dz             | 
                    |d          }|||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  r-   r*  )r*  rP  r  r  r  r  rl  is_emptyr   r-   rK  )r	  r-   r  r3  r  r  r  r!  rn  r*  r  r  r  s                r  edit_order_requestzbitvavo.edit_order_request  sj   V$$**63DEE))&2`2`2`aa6#d#d#dee#66vuEEGG $ 8 8 H HGH&)-)A)A&/)Z)ZG%&#'+'>'>v|'T'TGO$++gv..==!! 	D#DG  /C  %C  D  D  D((AA !#GI"4Lr  c           	          |                                   |                     |          }|                     |||||||          }	|                     |	          }
|                     |
|          S )a  
        edit a trade order
        :see: 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 fullfilled, in units of the base 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>`
        )rj  r*  r  privatePutOrderr  )r	  r-   r  r3  r  r  r  r!  r*  rn  r"  s              r  
edit_orderzbitvavo.edit_order  sp     	V$$))"fdD&%QWXX''00&111r  c                     |t          | j        dz             |                     |          }d|d         i}|                     |d          }|||d<   |                     ||          S )Nz) cancelOrder() requires a symbol argumentr*  r-   r  r  )r   r-   r*  rK  rl  )r	  r-   r  r!  r*  rn  r  s          r  cancel_order_requestzbitvavo.cancel_order_request  sy    >#DG.Y$YZZZV$$fTl
 ((AA !#GI{{7F+++r  c                     |                                   |                     |          }|                     |||          }|                     |          }|                     ||          S )a  
        :see: https://docs.bitvavo.com/#tag/Orders/paths/~1order/delete
        cancels an open order
        :see: 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>`
        )rj  r*  r
  privateDeleteOrderr  )r	  r-   r  r!  r*  rn  r"  s          r  cancel_orderzbitvavo.cancel_order  si     	V$$++B??**733 &111r  c                     |                                   i }d}| |                     |          }|d         |d<   |                     |                     ||                    }|                     ||          S )a  
        :see: 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-   r*  )rj  r*  privateDeleteOrdersrl  parse_orders)r	  r  r!  rn  r*  r"  s         r  cancel_all_orderszbitvavo.cancel_all_orders  s~     	[[((F &tGH++DKK,H,HII   6222r  c                 R   |t          | j        dz             |                                  |                     |          }d|d         i}|                     |d          }|||d<   |                     |                     ||                    }|                     ||          S )a  
        fetches information on an order made by the user
        :see: https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/get
        :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>`
        Nz( fetchOrder() requires a symbol argumentr*  r-   r  r  )r   r-   rj  r*  rK  privateGetOrderrl  r  )r	  r-   r  r!  r*  rn  r  r"  s           r  fetch_orderzbitvavo.fetch_order  s     >#DG.X$XYYYV$$fTl
 ((AA !#GI''GV(D(DEEF &111r  c                     |                      |          }d|d         i}|||d<   |||d<   |                     d||          \  }}|                     ||          S Nr*  r-   r  r  r  r*  r  rl  r	  r  r  r  r!  r*  rn  s          r  fetch_orders_requestzbitvavo.fetch_orders_request  t    V$$fTl
 $GG$GG225'6JJ{{7F+++r  c                 ~   |t          | j        dz             |                                  d}|                     |dd          \  }}|r|                     d||||          S |                     |          }|                     ||||          }|                     |          }|                     ||||          S )a~  
        :see: 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>`
        Nz) fetchOrders() requires a symbol argumentFrg   r  )	r   r-   rj  r  r  r*  r  privateGetOrdersr  	r	  r  r  r  r!  r  r*  rn  r"  s	            r  fetch_orderszbitvavo.fetch_orders+  s     >#DG.Y$YZZZ88PZ[[& 	b44]FESXZ`aaaV$$++FE5&II((11J   65%@@@r  c                     |                                   i }d}| |                     |          }|d         |d<   |                     |                     ||                    }|                     ||||          S )a  
        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-   r*  )rj  r*  privateGetOrdersOpenrl  r  )r	  r  r  r  r!  rn  r*  r"  s           r  fetch_open_orderszbitvavo.fetch_open_ordersg  s     	
 [[((F &tGH,,T[[&-I-IJJJ   65%@@@r  c                 P    dddddddddddddd}|                      |||          S )Nrv  canceledclosed)newr#  canceledAuctioncanceledSelfTradePreventioncanceledIOCcanceledFOKcanceledMarketProtectioncanceledPostOnlyfilledpartiallyFilledexpiredrejectedawaitingTriggerrK  r	  r-  statusess      r  parse_order_statuszbitvavo.parse_order_status  sO    ")+5%%(2 *%!"%
 
 &&999r  c           	         |                      |d          }|                     |d          }|                      |d          }|                     ||d          }|d         }|                     |                      |d                    }|                      |d          }|                      |d          }	|                      |d	          }
|                      |d
          }|                      |d          }|                      |d          }|                      |d          }|A|                      |d          }|                      |d          }t	          j        ||          }d }|                     |d          }|0|                      |d          }|                     |          }||d}|                     |dg           }|                      |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!|          S )"Nr  rF  r*  rq  r  r-  r  r  r  r  r  filledAmountfilledAmountQuoter  amountQuoteRemainingfeePaidr  r  fillsr  r  r  rG  r-   r  rr  rw  lastTradeTimestampr3  r  r   r  )r,  	remainingr-  r  r   )rK  r  safe_marketr4  r)   
string_subrP  rL  rM  
safe_orderr  )r	  r   r*  r-   rr  r  r  r-  r  r3  r  r  r<  r,  r   r  r8  r  feeCostr  r  	rawTradesr  r  r  s                            r  r  zbitvavo.parse_order  s#   \ eY//%%eY77	##E844!!(FC88!(()9)9%)J)JKKv..{33  00!!%22$$U,=>>	!!%88':;;<**5-@@K#'#3#3E;Q#R#R %k3GHHD""5)44 ,,UMBBM"55mDDO+ C OOE7B77	&&um<<??5*55$$UN;;	  
E 
" 
 T 
 	 

 Y// 
 !$ 
 f 
 D 
 ; 
  
 D 
 U 
  
 I 
 f 
  D! 
" t# 
$ "- 
  
  
. /  	r  c                     |                      |          }d|d         i}|||d<   |||d<   |                     d||          \  }}|                     ||          S r  r  r  s          r  fetch_my_trades_requestzbitvavo.fetch_my_trades_request  r  r  c                 ~   |t          | j        dz             |                                  d}|                     |dd          \  }}|r|                     d||||          S |                     |          }|                     ||||          }|                     |          }|                     ||||          S )a<  
        :see: https://docs.bitvavo.com/#tag/Trades/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>`
        Nz+ fetchMyTrades() requires a symbol argumentFra   r  )	r   r-   rj  r  r  r*  rC  privateGetTradesr  r  s	            r  fetch_my_tradeszbitvavo.fetch_my_trades(  s     >#DG.[$[\\\88R\]]& 	d44_feUZ\bcccV$$..vueVLL((11$   65%@@@r  c                     |                      |          }|d         |                     ||          |d}|||d<   |                     ||          S )Nr-   )r  r  r  r  )rb  r  rl  )r	  r  r  r  r  r!  rb  rn  s           r  withdraw_requestzbitvavo.withdraw_requestQ  sa    ==&&tn00v>>
 
 ?#&GK {{7F+++r  c                 8   |                      ||          \  }}|                     |           |                                  |                     |          }|                     |||||          }|                     |          }|                     ||          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  rj  rb  rH  privatePostWithdrawalparse_transaction)	r	  r  r  r  r  r!  rb  rn  r"  s	            r  r{   zbitvavo.withdraw^  s     99#vFFV7###==&&''fgsFKK--g66 %%h999r  c                     i }d }| |                      |          }|d         |d<   |||d<   |||d<   |                     ||          S Nr-   r  r  r  rb  rl  r	  r  r  r  r!  rn  rb  s          r  fetch_withdrawals_requestz!bitvavo.fetch_withdrawals_requestw  i    
 }}T**H (GH$GG$GG{{7F+++r  c                     |                                   |                     ||||          }d}||                     |          }|                     |          }|                     ||||ddi          S )a#  
        :see: 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>`
        Nr3  r   )rj  rQ  rb  privateGetWithdrawalHistoryparse_transactionsr	  r  r  r  r!  rn  rb  r"  s           r  fetch_withdrawalszbitvavo.fetch_withdrawals  s     	00ueVLL}}T**H33G<< &&x5%&R^I_```r  c                     i }d }| |                      |          }|d         |d<   |||d<   |||d<   |                     ||          S rN  rO  rP  s          r  fetch_deposits_requestzbitvavo.fetch_deposits_request  rR  r  c                     |                                   |                     ||||          }d}||                     |          }|                     |          }|                     ||||ddi          S )a  
        :see: 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>`
        Nr3  r   )rj  rY  rb  privateGetDepositHistoryrU  rV  s           r  fetch_depositszbitvavo.fetch_deposits  s     	--dE5&II}}T**H0099 &&x5%&R[I\]]]r  c           
      H    dddddddddd	}|                      |||          S )Npendingokr#  )	awaiting_processingawaiting_email_confirmationawaiting_bitvavo_inspectionapprovedsending
in_mempool	processed	completedr#  r1  r2  s      r  parse_transaction_statusz bitvavo.parse_transaction_status  sC    #,+4+4! #""

 

 &&999r  rb  c                    d }|                      |d          }|                     |d          }|                     ||          }|                     |                     |d                    }|                     |d          }|                     |d          }	|                     |d          }
d }|                     |d          }|||d}d }d	|v sd|v rd
}n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S )Nrr  r  r-  r  r  txIdr  r  successr   r   r  rG  r-   txidrw  addressFrom	addressTotagFromr  tagTor3  rb  updated)r`  commentinternal)r  rK  rL  rh  rP  r  )r	  transactionrb  r-   rr  r  r  r-  r  r  rl  r  r@  r3  r  s                  r  rL  zbitvavo.parse_transaction  s   D %%k;??	%%k8<<
&&z8<<..t/?/?X/V/VWW!!+x88"";	::V44"";66  C $$){*B*BDDD{K88
K
"
 D
 	

 Y//
 4
 w
 
 t
 3
 S
 D
 f
 
 f
  t!
" 3#
$ )
 
 
 	
r  c                 d   ||                      |d          dd|                      |d          ddi d}|                     |d          }|                     |d          }|                     |d          }|d	k    r|}|                     ||          }|d
         |d         d|d         |<   |S )Nr^  F)r  r   
depositFee)rG  r{   r   r   r   r   r  Mainnetr   r{   )r   r{   )rP  rM  rK  ra  )r	  r  rb  rR  r   rh  currencyCoder  s           r  parse_deposit_withdraw_feez"bitvavo.parse_deposit_withdraw_fee3  s    & ''_==# 
 ''\::#  
 
 ??3
33OOHa00	''&99	!!$I--iFFi(z*+
 +
z;' r  codesc                     |                                   |                     |          }|                     ||d          S )ak  
        fetch deposit and withdraw fees
        :see: 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  )rj  rW  parse_deposit_withdraw_fees)r	  rz  r!  r"  s       r  fetch_deposit_withdraw_feesz#bitvavo.fetch_deposit_withdraw_fees]  sC     	''//( //%JJJr  r   GETc                    |                      ||                     |                    }d| j        z   dz   |                     ||          z   }|dk    p|dk    }	|	r|r|d|                     |          z   z  }|dk    r|                                  d}
|	s|r|                     |          }|}
t          |                                           }||z   |z   |
z   }| 	                    | 
                    |          | 
                    | j                  t          j                  }|                     | j        dd          }| j        |||d	}|	sd
|d<   | j        d         |         |z   }||||dS )Nr.  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_paramsr4   implode_params	urlencodecheck_required_credentialsjsonstrmillisecondshmacencoder   hashlibsha256rK  r   r   r   )r	  pathr   r  r!  r  r  queryr  getOrDeletepayloadrr  auth	signatureaccessWindows                  r  signzbitvavo.sign|  s   		&$"5"5d";";<<DL 3&)<)<T6)J)JJ?Fh,> 	3 3sT^^E2222)++---G # #99U++D"GD--//00Iv%+g5D		$++d"3"3T[[5M5Mw~^^I++DL:QSZ[[L&*k,5,5)5	 G  =*<'is#c)fdwOOOr  c
                 *   |d S |                      |d          }
|                      |d          }|
`| j        dz   |z   }|                     | j        d         ||           |                     | j        d         |
|           t          |          d S )N	errorCodeerror r   r   )rK  r-   throw_broadly_matched_exceptionr   throw_exactly_matched_exceptionr   )r	  httpCodereasonr  r  r  r  r"  requestHeadersrequestBodyr  r  feedbacks                r  handle_errorszbitvavo.handle_errors  s    4 $$X{;;	  733 w}t+H001I5RZ[[[001I9V^___)))tr  c                 P    d|v rd|vr|d         S |                      |dd          S )Nr   r*  r   r   )rM  )r	  r   r  r  r!  configs         r  calculate_rate_limiter_costz#bitvavo.calculate_rate_limiter_cost  s8    &  8v+=+=*%%vvq111r  )N)L__name__
__module____qualname__r  r  r  r  r#  r   r	   r(  r'  r   rY  rX  r  r   ro  rm  r   r   r  r   r   r  r  r   r  r  r   r  listr  r   r  r  r   r  r  r  r   r   floatr
   r  r   r  r  r
  r  r  r  r  r   r  r!  r4  r  rC  rF  rH  r{   rQ  r   rW  rY  r\  rh  r   rL  ry  r}  r  r  r  __classcell__)r
  s   @r  r+   r+       sd	       D D D D DLe e e ex x xM M M !# 
3 
3 
3 
3 $& , ,$v, , , , ,0B B BH ') )/ )/Z )/ )/ )/ )/Va a aF 02 3 33 3f 3 3 3 3@/ /6 /V / / / /b 04B 5 5W 57 5 5 5 5: 6:UW +A +A3 +As +A# +A\`af\g +A +A +A +AZ\ \ \5 \ \ \ \| )+ 1 1{ 1 1 1 1(   4 :>b # #s #3 #Y # # # #J
 
 
4 
 
 
 
( :>D_cln , ,# ,c ,Y\ , , , ,. 26DW[df L L# Lc LQT Lkoptku L L L L<) ) ) ) )  $& , ,( , , , ,( 79 
 
# 
 
 
 
< os{} 3, 3,3 3,i 3,y 3,Z_ 3,hk 3, 3, 3, 3,j gksu C2 C23 C2i C2y C2RW C2`c C2 C2 C2 C2J FJQU^`  S    . `drv  @B 2 2S 2# 2Y 2i 2Y\ 2lo 2 2 2 2& ;?r 
, 
,s 
,C 
, 
, 
, 
, 37r 2 2s 2C 2 2 2 2* /32 3 3 3 3 3 30 26b 52 52c 523 52 52 52 52n 26DW[df , ,3 ,c ,QT , , , ," *.Dt\^ :A :A3 :Ac :A :Acghmcn :A :A :A :Ax /3TXac 6A 6A 6A3 6Ac 6Ahlmrhs 6A 6A 6A 6Ap: : :$d d d5 d d d dL 59tZ^gi , ,c , ,TW , , , ," -1tRV_a 'A 'Ac 'A 'AC 'Afjkpfq 'A 'A 'A 'AR @DB , ,S , , , , ?C2 : :S :% : : : :2 59tZ^gi , ,c , ,TW , , , ," -1tRV_a a ac a aC afjkvfw a a a a@ 26DW[df , ,3 ,c ,QT , , , ," *.Dt\^ ^ ^3 ^c ^ ^cghsct ^ ^ ^ ^<: : :L
 L
x L
; L
 L
 L
 L
\( ( ( ( ( (T <@ K K K K K K> &eBSW P P P P:  " MO 2 2 2 2 2 2 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   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+    r  r  <module>r     s   ( ' ' ' ' ' - - - - - -  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u  u       * * * * * * 0 0 0 0 0 0 - - - - - - - - - - - - . . . . . . ' ' ' ' ' ' & & & & & & . . . . . . + + + + + + ) ) ) ) ) ) * * * * * * . . . . . . 1 1 1 1 1 1 * * * * * * 0 0 0 0 0 0 3 3 3 3 3 3 9 9 9 9 9 9 = = = = = = % % % % % %M2 M2 M2 M2 M2h M2 M2 M2 M2 M2r  