
    !:h!                    h   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.  G d dee      Z/y)    )Exchange)ImplicitAPIN)AnyBalancesCurrencyDepositAddressIntMarketNumOrder	OrderBook	OrderSide	OrderTypeStrStringsTickerTickersTradeTradingFeesTransactionTransferEntry)List)ExchangeError)AuthenticationError)PermissionDenied)ArgumentsRequired)	BadSymbol)InsufficientFunds)InvalidOrder)OrderNotFound)NotSupported)RateLimitExceeded)ExchangeNotAvailable)InvalidNonce)ROUND)TRUNCATE)DECIMAL_PLACES)SIGNIFICANT_DIGITS)Precisec                       e Zd Zdef fdZdi fdefdZdi fdefdZdKdefdZ	i fde
fd	Zi fdee   fd
Zd Zd Zi fdefdZi fdededededef
dZdKdededefdZdedefdZd Zdi fdededefdZdi fdedefdZ i fdede!fdZ"dKdedede!fd Z#dKd!edede$fd"Z%dd#i fded$ededee$   fd%Z&dddi f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ded'e(d(e)de*d)e*fd,Z,di fd+edefd-Z-di fdefd.Z.dKd/edede/fd0Z0dddi fded$ededee/   fd1Z1dddi fded$ededee/   fd2Z2di fd+edefd3Z3dKdede4fd4Z5d5ddi fded$ededee4   fd6Z6d7 Z7i fdede8fd8Z9i fdede8fd9Z:dddi fded$ededee;   fd:Z<dKd;edede;fd<Z=defd=Z>di fdeded>ede;fd?Z?di fdefd@Z@dA ZAdBdCi ddfdDZBdeCdEedFedGedHedIefdJZD xZES )L	bitfinex1returnc           !      v   | j                  t        t        |          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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d(dd)dd*ddddddddddddddd+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d<d=d>d?d@dAgdBdCi dDdEdFdGdHdGdIdGdJdGdKdLdMdLdNdLdOdLdPdLdQdLdRdGdSdGdTdGdUdGdVdGdWdGdGdGdGdXidCdGdYdEdEdYdZdZdGdEd[	id\i d]dZd^dYd_d`dadYdbdYdcdZdddYdedYdfdYdgdYdhdEdidEdjdYdkdYdldYdmdYdndYi dodpdqdrdsdrdtdrdudrdvdrdwdrdxdrdydrdzdpd{dZd|dZd}dZd~dZddYddYddZdYdZdid=dCdd| j	                  d      | j	                  d      | 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| 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| j	                  d      | j	                  d      g| j	                  d      | j	                  d      ggddddi i ddi ddddddddddddddddddddddddddddddddddi ddddddddēddƓddȓddʓdd̓ddΓddГddғddԓdd֓ddؓddړddܓddޓt
        t        t        t        t        t        t        t        t        t        t        t
        t        t        t        dߜt        t        t        t        t        t        ddt        i dddddddddddddddddddddddddddddd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d0dĐd1d2d3d4d5d6d7d8d9d:d;d<d=dȐd>i d?d@dAdBdʐdCdDdEdFdGdΐdHdIdJdԐdKdLdMd֐dNdOdPdِdQdRdSdTdUdVdWdXdYdҐdZd[d\d]d^d_d`dadIdbdcdddedfdgdhdidhdjdkdl      S (m  Nr+   BitfinexVGv1gSՄ@TCORSspotmarginswapfutureoptioncancelAllOrderscancelOrdercreateDepositAddresscreateOrder	editOrderfetchBalancefetchClosedOrdersfetchDepositAddressfetchDepositAddressesFfetchDepositAddressesByNetworkfetchDepositsfetchDepositsWithdrawalsfetchDepositWithdrawFeeemulatedfetchDepositWithdrawFeesfetchFundingHistoryfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchIndexOHLCVfetchLeverageTiersfetchMarginModefetchMarketsfetchMarkOHLCVfetchMyTrades
fetchOHLCVfetchOpenOrders
fetchOrderfetchOrderBook)fetchPositionModefetchPositionsfetchPremiumIndexOHLCVfetchTickerfetchTickers	fetchTimefetchTradesfetchTradingFeefetchTradingFeesfetchTransactionFeesfetchTransactionstransferwithdraw1m5m15m30m1h3h4h6h12h1D7D14D1M)ra   rb   rc   rd   re   rf   rg   rh   ri   1d1w2wrm   zOhttps://github.com/user-attachments/assets/9147c6c5-7197-481e-827b-7483672bb0e9zhttps://api-pub.bitfinex.comzhttps://api.bitfinex.com)v2publicprivatezhttps://www.bitfinex.comz*https://www.bitfinex.com/?refcode=P61eYxFLz!https://docs.bitfinex.com/v1/docsz0https://github.com/bitfinexcom/bitfinex-api-node)logoapiwwwreferraldocgetzplatform/status   tickers   zticker/{symbol}ztickers/histztrades/{symbol}/histzbook/{symbol}/{precision}g      ?zbook/{symbol}/P0zbook/{symbol}/P1zbook/{symbol}/P2zbook/{symbol}/P3zbook/{symbol}/R0z-stats1/{key}:{size}:{symbol}:{side}/{section}z&stats1/{key}:{size}:{symbol}/{section}z&stats1/{key}:{size}:{symbol}:long/lastz&stats1/{key}:{size}:{symbol}:long/histz'stats1/{key}:{size}:{symbol}:short/lastz'stats1/{key}:{size}:{symbol}:short/hist)z,candles/trade:{timeframe}:{symbol}/{section}z'candles/trade:{timeframe}:{symbol}/lastz'candles/trade:{timeframe}:{symbol}/hist      )	zbook/{symbol}zlendbook/{currency}zlends/{currency}zpubticker/{symbol}zstats/{symbol}symbolssymbols_detailsr{   ztrades/{symbol}postaccount_feesaccount_infosbalancesgOn"@basket_managecreditszdeposit/newzfunding/closehistoryzhistory/movementskey_infomargin_infosmytradesmytrades_fundingzoffer/cancelz	offer/newzoffer/statusofferszoffers/histgRV@zorder/cancelg?zorder/cancel/allzorder/cancel/multizorder/cancel/replacez	order/newzorder/new/multizorder/statusorderszorders/histzposition/claimzposition/close	positionssummarytaken_fundstotal_taken_fundsr_   )unused_taken_fundsr`   z0.001z0.0020500000100000025000005000000750000010000000z0.001815000000z0.001620000000z0.001425000000z0.001230000000z0.0008z0.0006z0.0004z0.0002)takermaker)feeSide	tierBased
percentager   r   tiers)r   r   depositr`   )tradingfundingALGALGOAMPAMPLATOATOMBCHABCXECBCHNBCHDATDATADOGMDOGEDSHDASHEDOPNTEUSEURSEUTEURTIDXIDIOTIOTAIQXIQLUNALUNCLUNA2MNAMANAORSz	ORS GroupPASPASSQSHQASHQTMQTUMRBTRBTCSNGSNGLSSTJSTORJTERRAUSTUSTCTSDTUSDYGGYEEDYYWYOYOWUDCUSDCUSTUSDTVSYVSYSWAXWAXPXCHXCHFZBTZB)temporarily_unavailablezOrder could not be cancelled.zNo such order found.zOrder price must be positive.z5Could not find a key matching the given X-BFX-APIKEY.z4Key price should be a decimal number, e.g. "123.456"z5Key amount should be a decimal number, e.g. "123.456"ERR_RATE_LIMIT	RatelimitzNonce is too small.zNo summary found.z8Cannot evaluate your available balance, please try againzUnknown symbolz8Cannot complete transfer. Exchange balance insufficient.zLMomentary balance check. Please wait few seconds and try the transfer again.)zInvalid X-BFX-SIGNATUREz%This API key does not have permissionz not enough exchange balance for zminimum size for zInvalid orderzThe available balance is only)exactbroadAGIagiAIDaidAIOaioANTantAVTaventusBATbatbabBCIbciBFTbftBSVbsvBTCbitcoinBTGbgoldCFIcfiCOMPcompDAIdaiDADIdaddashdatacoinDTHdtheidooELFelfEOSeosETC	ethereumcETHethereumETP	metaverseFUNfunGNTgolemIOSTiosiotaLEOletLINKlinkLRClrcLTClitecoinLYMlymmnaMITmitMKRmkrMTNmtnNEOneoODEodeOMGomisegoOMNI
mastercoinqashqtumRCNrcnRDNrdnREPrepREQreqRLCrlcSAN	santimentsngSNTstatusSPANKspkstjTNBtnbTRXtrxtsdUSDwireudcUTKutk	tetherusoVEEveewaxXLMxlmXMRmoneroXRPrippleXVGxvgyoyowzcashzrxxtz)ZECZRXXTZzexchange limitzexchange market)limitmarketEURJPYGBPCNH)rU  ro  rp  rq  rr  exchanger   r   )r2   r3   r   r4   )currencyNames
orderTypesfiataccountsByType)idname	countriesversion	rateLimitprohas
timeframesurlsru   feescommonCurrencies
exceptionsprecisionModeoptions)deep_extendsuperr+   describeparse_numberr#   r    r   r   r"   r$   r   r   r   r   r(   )self	__class__s    H/var/www/html/turnos/venv/lib/python3.12/site-packages/ccxt/bitfinex1.pyr  zbitfinex1.describe    sG   i ? A 000 $0 	0
 $0 $0 "40 t0 '0 t0 T0 0 $T0 &t0 (0  1%!0"  #0$ +D%0& *:'0( +D)0* &u+0, #E-0. *5/00 $U102 "5304 %e506 "5708 90: !%;0<  =0> d?0@ "4A0B dC0D !$E0F &+"&*/# $"##($((,%/  _0d   j889
 2H7F$  )1!1 *1 '	
 / 4U +E +E +E +E +E H A! A! A!  B1!" B1#$ IJCDCD)2 )*/0,-./*+#%+-#$+,  %&%'% #E% (	%
 "1% &r% (% "1% ,Q% #A% '% #A% +A% '% $Q%  '!%" !!#%$ &u%%& ''%( +C)%* -c+%, /-%. $S/%0 *31%2 '3%4 !#5%6 &u7%8 )"9%: )";%< $R=%> "2?%@ &qA%B ,QC%D #BE%F /0$&I%'SQh  %!%"&!..w7!..w7 "..s3T5F5Fw5OP!..x8$:K:KG:TU!..y94;L;LW;UV!..y94;L;LW;UV!..y94;L;LW;UV!..y94;L;LW;UV!..z:D<M<Mh<WX!..z:D<M<Mh<WX!..z:D<M<Mh<WX!..z:D<M<Mh<WX!..z:D<M<Mg<VW" "..s3T5F5Fw5OP!..x8$:K:KH:UV!..y94;L;LX;VW!..y94;L;LX;VW!..y94;L;LX;VW!..y94;L;LS;QR!..z:D<M<Mc<RS!..z:D<M<Mc<RS!..z:D<M<Mc<RS!..z:D<M<Mc<RS!..z:D<M<Mc<RS""H "'"'  " "I-^&!v&!v&! v&! %	&!
 &! v&! w&! v&! u&! v&! v&! t&!  v!&!" t#&!$ %&!& '&!( v)&!* {+&!, v-&!. v/&!0 v1&!2 v3&!4 w5&!6 w7&!8 F9&!: v;&!< v=&!> w?&!@ vA&!B vC&!D vE&!F vG&!H vI&!J tK&!R 0D5B,95AM`LXMY&7!2+7)6Pd&/Padq$ 0C=M8I)5%15F%6 0P"5P"5P" 5P" 5	P"
 9P" 5P" 5P" 5P" 5P" 5P" 9P" 7P" 5P"  F!P"" 5#P"$ E%P"& F'P"( J)P"* 5+P", 7-P". 5/P"0 51P"2 ;3P"4 :5P"6 ;7P"8 59P": 7;P"< E=P"> F?P"B 5CP"F FGP"H 5IP"J :KP"L 5MP"N EOP"P 5QP"R 5SP"T 5UP"V 5WP"X 5YP"Z 9[P"\ L]P"^ F_P"` FaP"b 5cP"d 5eP"f 5gP"h 5iP"j 5kP"l ;mP"n UoP"p 8qP"r UsP"t UuP"v 5wP"x 5yP"z E{P"| 6}P"~ EP"@ 5AP"B KCP"L 5MP"N 5OP"P 5QP"R 8SP"T 8UP"V 5WP"X WYP"Z #  _P"d ./
 !     ''(%	#{cwD
  	    Ncodesc                    | j                          i }| j                  |      }| j                  |di       }t        |j	                               }t        dt        |            D ]V  }||   }| j                  |      }	|| j                  |	|      s.| j                  ||      i | j                  ||      d||	<   X |S )a  
 @deprecated
        please use fetchDepositWithdrawFees instead

        https://docs.bitfinex.com/v1/reference/rest-auth-fees

        :param str[]|None codes: list of unified currency codes
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `fees structures <https://docs.ccxt.com/#/?id=fee-structure>`
        r`   r   )r`   r   info)
load_marketsprivatePostAccountFees	safe_dictlistkeysrangelensafe_currency_codein_arraysafe_number)
r  r  paramsresultresponser  idsirx  codes
             r  fetch_transaction_feesz bitfinex1.fetch_transaction_fees  s     	..v6 ~~h
B7499;q#c(# 		AQB**2.D!4==u+E ,,T26((r2F4L		 r  c                     | j                          | j                  |      }| j                  |d      }| j                  ||      S )ag  
        fetch deposit and withdraw fees

        https://docs.bitfinex.com/v1/reference/rest-auth-fees

        :param str[]|None codes: list of unified currency codes
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `fees structures <https://docs.ccxt.com/#/?id=fee-structure>`
        r`   )r  r  	safe_listparse_deposit_withdraw_fees)r  r  r  r  r`   s        r  fetch_deposit_withdraw_feesz%bitfinex1.fetch_deposit_withdraw_fees  sE     	..v6 >>(J7//%@@r  currencyc                 :    | j                  |      d dd d di |dS )N)feer   )r`   r   networksr  )r  )r  r  r  s      r  parse_deposit_withdraw_feez$bitfinex1.parse_deposit_withdraw_fee  s9     ((-"
 " 
 	
r  c                 V   | j                          | j                  |      }i }| j                  | j                  di       }| j	                  |d      }| j	                  |d      }| j	                  |d      }| j	                  |d      }| j	                  |d      }	| j	                  |d      }
t        dt        | j                              D ]Z  }| j                  |   }| j                  |      }||d	d	d
}|d   |v r||d<   ||d<   n|d   r|	|d<   |
|d<   n
||d<   ||d<   |||<   \ |S )aS  
        fetch the trading fees for multiple markets

        https://docs.bitfinex.com/v1/reference/rest-auth-summary

        :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
        rv  	maker_fee	taker_feemaker_fee_2fiattaker_fee_2fiatmaker_fee_2derivtaker_fee_2derivr   T)r  symbolr   r   quoter   r   contract)	r  privatePostSummaryr  r  r  r  r  r   rn  )r  r  r  r  rv  makerFeetakerFeemakerFee2FiattakerFee2FiatmakerFee2DerivtakerFee2Derivr  r  rn  r  s                  r  fetch_trading_feeszbitfinex1.fetch_trading_fees  sW    	**62P ~~dllFB7##Hk:##Hk:((3DE((3DE))(4FG))(4FGq#dll+, 	!A\\!_F[[(F  "!	C g$&,G,G
#-G-G'G'G F6N%	!& r  c                    | j                         }| j                         }||g\  }}g }t        dt        |            D ]  }||   }| j	                  |d      }	| j                  |	|      s.|	j                         }	d}
d}|	j                  d      dk\  r|	j                  d      }|d   }
|d   }n
|	dd }
|	dd }| j                  |
      }| j                  |      }|dz   |z   }d	}|	j                  d
      dkD  rd}|j                  i d|	d|d|d|ddd|
d|ddd|d	|d	k(  d| j                  |d      d|dk(  ddddddd|dk(  ddddddddt        d      | j                  |d      d ddd!| j                  |d"      | j                  |d#      d!| j                  d$      dd!ddd!d%d|d&
        |S )'af  
        retrieves data on all markets for bitfinex

        https://docs.bitfinex.com/v1/reference/rest-public-symbols
        https://docs.bitfinex.com/v1/reference/rest-public-symbol-details

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: an array of objects representing market data
        r   pairN:r|   rz   r}   /r2   F0r4   rx  r  baser  settlebaseIdquoteIdsettleIdtyper3   r5   Fr6   activeTr  linear8price_precision)amountprice)minmaxminimum_order_sizemaximum_order_sizez1e-8)leverager  r  cost)
inversecontractSizeexpiryexpiryDatetimestrike
optionType	precisionlimitscreatedr  )publicGetSymbolspublicGetSymbolsDetailsr  r  safe_stringr  upperfindsplitr  append	safe_boolintsafe_integerr  r  )r  r  
idsPromisedetailsPromiser  detailsr  r  rn  rx  r  r  partsr  r  r  r  s                    r  fetch_marketszbitfinex1.fetch_markets<  s    **,
 557 #N3Wq#g,' H	AQZF!!&&1B==S)BFGwws|q q(AaQq'**62D++G4ECZ%'FDwwt}r!MM 3b3&3 3 	3
 $3 &3 73 D3 3 3 $..:3 3 %3 %3 $3  TV^!3" $#3$   $"&"
 "#h!..v7HI  $#!
  $//8LM#//8LM
  $008#
  $#$  e3 3+H	R r  c                     | j                  |      }| j                  |t        | j                  |   d   d   t              S )Nr  r  )safe_symboldecimal_to_precisionr&   marketsr'   )r  r  r  s      r  amount_to_precisionzbitfinex1.amount_to_precision  sA     !!&)((4<<;OP[;\]e;fhvwwr  c                     | j                  |      }| j                  |t        | j                  |   d   d   | j                        }| j                  |t
        dt              S )Nr  r     )r  r  r%   r  r  r&   r'   )r  r  r  s      r  price_to_precisionzbitfinex1.price_to_precision  s\    !!&)))%V8L[8YZa8bdhdvdvw
 ((!^LLr  c                 *   | j                          | j                  | j                  di       }| j                  |dd      }| j                  |||      }|Ct	        |j                               }t        | j                  dz   dj                  |      z         | j                  |d      }| j                  |      }d|i}|dk(  }	t        d	t        |            D ]  }
||
   }| j                  |d      }| j                  |d
d      }t        |      dz
  }||d dk(  }|	 xs |}||k(  sP|sS| j                  |      }||vsi| j                         }| j                  |d      |d<   | j                  |d      |d<   |||<    | j!                  |      S )al  
        query for balance and get the amount of funds available for trading or funds locked in orders

        https://docs.bitfinex.com/v1/reference/rest-auth-wallet-balances

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
        rw  r  rs  Nz. fetchBalance() type parameter must be one of z, r  derivativesr   r      f0	availablefreer  total)r  r  r  r  r  r  r   rx  joinomitprivatePostBalancesr  r  safe_string_lowerr  accountsafe_balance)r  r  rw  requestedTypeaccountTyper  queryr  r  isDerivativer  balancer  
currencyIdstartisDerivativeCodederivativeConditionr  r  s                      r  fetch_balancezbitfinex1.fetch_balance  s    	6FK((D&&~}mT++-.D*Z Z]a]f]fgk]l lmm		&&)++E2 )$5q#h-( 	+AqkG##GV4D//RHJ
Oa'E)%&1T9'3#3#G7Gt#)<..z: "llnG&*&6&6w&LGFO'+'7'7'JGG$#*F4L'	+(   ((r  r  r  fromAccount	toAccountc                 z   | j                          | j                  | j                  di       }| j                  |||      }| j                  |||      }| j	                  |      }	| j                  |	d   |      }
| j                  |	d   |      }| j                  ||      }||
|||d}| j                  | j                  ||            }| j                  |d      }| j                  |d      }|t        | j                  dz         | j                  | j                  ||	      ||| j                  |      d      S )a'  
        transfer currency internally between wallets on the same account

        https://docs.bitfinex.com/v1/reference/rest-auth-transfer-between-wallets

        :param str code: unified currency code
        :param float amount: amount to transfer
        :param str fromAccount: account to transfer from
        :param str toAccount: account to transfer to
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `transfer structure <https://docs.ccxt.com/#/?id=transfer-structure>`
        rw  rx  )r  r  currency_to
walletfromwallettor   messagez transfer failed)r  r  r  )r  r  r  r  r  convert_derivatives_idcurrency_to_precisionprivatePostTransferextend
safe_valuer   rx  parse_transferr  )r  r  r  r  r  r  rw  fromIdtoIdr  fromCurrencyIdtoCurrencyIdrequestedAmountrequestr  r  r  s                    r  r_   zbitfinex1.transfer  sF    	6FK!!.+{K	9E==&44Xd^[Q228D>9M44T6B%&' 
 ++DKK,HI 1-""695?*< <=={{4..vx@&"''8C
  	r  r_   c                 x    |d d d | j                  d |      d d d | j                  | j                  |d            d	S )NrL  )	r  rx  	timestampdatetimer  r  r  r  rL  )r  parse_transfer_statusr  )r  r_   r  s      r  r  zbitfinex1.parse_transfer  sN     //h?001A1A(H1UV

 
	
r  rL  c                 0    ddi}| j                  |||      S )NSUCCESSokr  r  rL  statusess      r  r#  zbitfinex1.parse_transfer_status0  s%    t
 &&99r  c                 z    t        |      dz
  }||d  dk(  }|dk7  r|dk7  r|dk7  r	|r|d| }|S |dk(  r|s|dz   }|S )Nr  r  r  r   r3   r   )r  )r  r  r  r	  r
  s        r  r  z bitfinex1.convert_derivatives_id6  sl    J!#%ef-5M!di&7DH<LRb#Ae,J  ]"+;#d*Jr  r  rm  c           	          | j                          | j                  |      }d|d   i}|
||d<   ||d<   | j                  | j                  ||            }| j	                  ||d   ddddd	      S )
a:  
        fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data

        https://docs.bitfinex.com/v1/reference/rest-public-orderbook

        :param str symbol: unified symbol of the market to fetch the order book for
        :param int [limit]: the maximum amount of order book entries to return
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
        r  rx  N
limit_bids
limit_asksbidsasksr  r  )r  rn  publicGetBookSymbolr  parse_order_book)r  r  rm  r  rn  r  r  s          r  fetch_order_bookzbitfinex1.fetch_order_book?  s     	V$fTl
 $)GL!$)GL!++DKK,HI$$Xvh/?vvW^`hiir  r   c                     | j                          | j                  |      }| j                  |      }i }t        dt	        |            D ]   }| j                  ||         }|d   }|||<   " | j                  |d|      S )a  
        fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
        :param str[] [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  )r  market_symbolspublicGetTickersr  r  parse_tickerfilter_by_array_tickers)r  r   r  r  r  r  tickerr  s           r  fetch_tickerszbitfinex1.fetch_tickersU  s     	%%g.((0q#h-( 	$A&&x{3FH%F#F6N	$ ++FHgFFr  c                     | j                          | j                  |      }d|d   i}| j                  | j                  ||            }| j	                  ||      S )a  
        fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market

        https://docs.bitfinex.com/v1/reference/rest-public-ticker

        :param str symbol: unified symbol of the market to fetch the ticker for
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
        r  rx  )r  rn  publicGetPubtickerSymbolr  r6  )r  r  r  rn  r  r8  s         r  fetch_tickerzbitfinex1.fetch_tickerf  s`     	V$fTl
 ..t{{7F/KL   00r  r8  rn  c                    | j                  |d      }| j                  |d      }| j                  ||      }|d   }| j                  |d      }| j                  i d|d|d| j	                  |      d| j                  |d      d| j                  |d      d| j                  |d      d	d d
| j                  |d
      dd dd dd d|d|dd dd dd d| j                  |d      | j                  |d      d |d|      S )Nr!  r  r  
last_pricer"  highlowbid	bidVolumeask	askVolumevwapopencloselastpreviousClosechanger   averagemidvolume)
baseVolumequoteVolumer  )safe_timestampr  safe_marketsafe_tickeriso8601)r  r8  rn  r!  marketIdr  rH  s          r  r6  zbitfinex1.parse_ticker  s    ''<	##FF3!!(F3!5 !
f!
!
 Y/!
 D$$VV4	!

 4##FE2!
 4##FE2!
 !
 4##FE2!
 !
 D!
 D!
 T!
 D!
 T!
 d!
  $!!
" t''6#!
$ **68<)!
* + 	r  tradec                    | j                  |d      }| j                  |d      }d }| j                  |d      }| j                  |d      }| j                  |d      }| j                  |d      }	d }
d|v rMt        j                  | j                  |d            }| j                  |d      }| j                  |      }||d	}
| j                  |||| j                  |      |d
   |||d ||	d |
d|      S )Ntidr!  r  order_idr  r  
fee_amountfee_currency)r  r  r  )rx  r  r!  r"  r  r  ordersidetakerOrMakerr  r  r  r  )r  rP  r   r)   
string_negr  
safe_traderS  )r  rU  rn  rx  r!  r  r\  orderIdpriceStringamountStringr  feeCostStringfeeCurrencyIdfeeCurrencyCodes                 r  parse_tradezbitfinex1.parse_trade  s!   J eU+''{;	%%eV4""5*5&&ug6''x85 #..t/?/?|/TUM ,,UNCM"55mDO%+C "Y/X&  " 
  	r  2   sincec                     | j                          | j                  |      }|d   |d}|| j                  |dz        |d<   | j                  | j	                  ||            }| j                  ||||      S )a!  
        get the list of most recent trades for a particular symbol

        https://docs.bitfinex.com/v1/reference/rest-public-trades

        :param str symbol: unified symbol of the market to fetch trades for
        :param int [since]: timestamp in ms of the earliest trade to fetch
        :param int [limit]: the maximum amount of trades to fetch
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
        rx  )r  limit_trades  r!  )r  rn  parse_to_intpublicGetTradesSymbolr  parse_tradesr  r  rh  rm  r  rn  r  r  s           r  fetch_tradeszbitfinex1.fetch_trades  s     	V$Tl!
 #'#4#4UT\#BGK --dkk'6.JK   65%@@r  c                 0   |t        | j                  dz         | j                          | j                  |      }d|d   i}|||d<   || j	                  |dz        |d<   | j                  | j                  ||            }| j                  ||||      S )a  
        fetch all trades made by the user

        https://docs.bitfinex.com/v1/reference/rest-auth-past-trades

        :param str symbol: unified market symbol
        :param int [since]: the earliest time in ms to fetch trades for
        :param int [limit]: the maximum number of trades structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
        z+ fetchMyTrades() requires a symbol argumentr  rx  rj  rk  r!  )r   rx  r  rn  rl  privatePostMytradesr  rn  ro  s           r  fetch_my_tradeszbitfinex1.fetch_my_trades  s     >#DGG.[$[\\V$fTl
 &+GN##'#4#4UT\#BGK ++DKK,HI  65%@@r  r  r\  r  c                 4   | j                          | j                  |      }| j                  |dd      }|j                         }| j	                  |dg      }|d   r | j                  | j                  d   ||      }|d   || j                  ||      |dddd}	|j                  d      d	kD  rt        | j                               |	d
<   n| j                  ||      |	d
<   |rd|	d<   | j                  | j                  |	|            }
| j                  |
|      S )a  
        create a trade order

        https://docs.bitfinex.com/v1/reference/rest-auth-new-order

        :param str symbol: unified symbol of the market to create an order in
        :param str type: 'market' or 'limit'
        :param str side: 'buy' or 'sell'
        :param float amount: how much of currency you want to trade in units of base currency
        :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        postOnlyFr2   ru  rx  r   )r  r\  r  r  ocoorderbuy_price_ocosell_price_ocorn  r  r  Tis_postonly)r  rn  r  lowerr  r   r  r  r  strnoncer  privatePostOrderNewr  parse_order)r  r  r  r\  r  r  r  rn  ru  r  r  s              r  create_orderzbitfinex1.create_order/  s    	V$>>&*e<zz|6J<0&> ))$,,|*DdDQDTl..vv>
 99X#"4::<0GG#66vuEGG%)GM"++DKK,HI&11r  rx  c                 ~   | j                          dt        |      i}|| j                  ||      |d<   || j                  |      |d<   || j	                  |      |d<   |||d<   |#| j                  | j                  d   ||      |d<   | j                  | j                  ||            }	| j                  |	      S )NrX  r  r  r  r\  ru  r  )
r  r  r  number_to_string	market_idr  r  privatePostOrderCancelReplacer  r~  )
r  rx  r  r  r\  r  r  r  r[  r  s
             r  
edit_orderzbitfinex1.edit_orderX  s    B
 !44VUCE'N"33F;E(O"nnV4E(O E&M ,,T\\,-GtTE&M55dkk%6PQ))r  c                     | j                          dt        |      i}| j                  | j                  ||            }| j	                  |      S )a|  
        cancels an open order

        https://docs.bitfinex.com/v1/reference/rest-auth-cancel-order

        :param str id: order id
        :param str symbol: not used by bitfinex cancelOrder()
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        rX  )r  r  privatePostOrderCancelr  r~  r  rx  r  r  r  r  s         r  cancel_orderzbitfinex1.cancel_orderj  sP     	B
 ..t{{7F/KL4 ))r  c                 L    | j                  |      }| j                  d|i      gS )a8  
        cancel all open orders

        https://docs.bitfinex.com/v1/reference/rest-auth-cancel-all-orders

        :param str symbol: not used by bitfinex cancelAllOrders
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: response from exchange
        r  )privatePostOrderCancelAll
safe_order)r  r  r  r  s       r  cancel_all_orderszbitfinex1.cancel_all_orders  s6     11&9
 OO 
 	
r  r[  c                    | j                  |d      }| j                  |d      }| j                  |d      }d }|rd}n|rd}nd}| j                  |d      }| j                  ||      }| j                  |dd	      }	|	j	                  d
      dk\  }
|
r|d   j                  d      }|d   }	| j                  |d      }| j                  |d      }| j                  i d|d|dd d|d| j                  |      dd d|d|	dd dd d|d| j                  |d      dd d| j                  |d      d| j                  |d      d| j                  |d      d| j                  |d      |d d d d |      S )!Nr\  is_liveis_cancelledrF  canceledclosedr  r  r  z	exchange r    r|   r!  rx  r  clientOrderIdr"  lastTradeTimestamptimeInForceru  r  triggerPricerK  avg_execution_pricer  original_amount	remainingremaining_amountfilledexecuted_amount)rL  r  r  trades)	r  r  safe_string_upperr  r  r  rP  r  rS  )r  r[  rn  r\  rF  r  rL  rT  r  	orderTypers  r  r!  rx  s                 r  r~  zbitfinex1.parse_order  s#   2 v.~~eY/>>%8FFF))%:!!(F3$$UFB7	>>+.!3&M'',EaI''{;	eT*  
E 
" 
 T 
 	 

 Y/ 
 !$ 
 f 
 I 
 4 
  
 D 
 T%%eW5 
 D 
 t''/DE 
 d&&u.?@ 
  ))%1CD! 
" d&&u.?@# 
$ + 
, - 	r  c                     | j                          |)|| j                  vrt        | j                  dz   |z         | j	                  |      }| j                  |d||      }|| j                  |d|      }|S )a  
        fetch all unfilled currently open orders

        https://docs.bitfinex.com/v1/reference/rest-auth-active-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>`
        Nz has no symbol r  )r  r  r   rx  privatePostOrdersparse_orders	filter_by)r  r  rh  rm  r  r  r   s          r  fetch_open_orderszbitfinex1.fetch_open_orders  s     	dll*#DGG.?$?&$HII))&1""8T5%@^^FHf=Fr  c                    | j                          | j                  |      }i }|||d<   | j                  | j                  ||            }| j	                  |d||      }|| j                  |d|      }| j                  |dddgd      }|S )a>  
        fetches information on multiple closed orders made by the user

        https://docs.bitfinex.com/v1/reference/rest-auth-orders-history

        :param str symbol: unified market symbol of the market orders were made in
        :param int [since]: the earliest time in ms to fetch orders for
        :param int [limit]: the maximum number of order structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
        Nrm  r  rL  r  r  F)r  r  privatePostOrdersHistr  r  r  filter_by_array)r  r  rh  rm  r  r  r  r   s           r  fetch_closed_orderszbitfinex1.fetch_closed_orders  s     	V$$GG--dkk'6.JK""8T5%@^^FHf=F%%fh:8NPUVr  c                     | j                          dt        |      i}| j                  | j                  ||            }| j	                  |      S )a  
        fetches information on an order made by the user

        https://docs.bitfinex.com/v1/reference/rest-auth-order-status

        :param str id: the order id
        :param str symbol: not used by bitfinex fetchOrder
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        rX  )r  r  privatePostOrderStatusr  r~  r  s         r  fetch_orderzbitfinex1.fetch_order  sN     	B
 ..t{{7F/KL))r  c           	          | j                  |d      | j                  |d      | j                  |d      | j                  |d      | j                  |d      | j                  |d      gS )Nr   r|   rz      r     )r  r  )r  ohlcvrn  s      r  parse_ohlcvzbitfinex1.parse_ohlcv-  sn     eQ'UA&UA&UA&UA&UA&
 	
r  ra   c                    | j                          |d}nt        |d      }| j                  |      }d|d   z   }|| j                  | j                  ||      d|d}| j                  |d      }	|||d<   n$|	"| j                  |      }
|	|dz
  |
z  d	z  z
  |d<   |	|	|d
<   | j                  |d      }| j                  | j                  ||            }| j                  |||||      S )a  
        fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market

        https://docs.bitfinex.com/reference/rest-public-candles#aggregate-funding-currency-candles

        :param str symbol: unified symbol of the market to fetch OHLCV data for
        :param str timeframe: the length of time each candle represents
        :param int [since]: timestamp in ms of the earliest candle to fetch
        :param int [limit]: the maximum amount of candles to fetch
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: timestamp in ms of the latest candle to fetch
        :returns int[][]: A list of candles ordered, open, high, low, close, volume
        d   i'  trx  r|   )r  	timeframesortrm  untilr	  rk  end)r  r  rn  r  r  r  parse_timeframer  $v2GetCandlesTradeTimeframeSymbolHistr  parse_ohlcvs)r  r  r  rh  rm  r  rn  v2idr  r  durationr  s               r  fetch_ohlcvzbitfinex1.fetch_ohlcvA  s    	=Eu%EV$VD\!))$//9iP	
 !!&'2$GG++I6H$h(>(EFGG"GEN67+<<T[[RX=YZ   69eUKKr  c                     || j                   d   v r| j                   d   |   S t        | j                  dz   |z   dz         )Nrt  r  z not supported for withdrawal)r  r!   rx  )r  r  s     r  get_currency_namezbitfinex1.get_currency_nameo  sE    4<<00<<066477S=4/2QQRRr  c                 n    | j                          ddi}| j                  || j                  ||            S )a  
        create a currency deposit address

        https://docs.bitfinex.com/v1/reference/rest-auth-deposit

        :param str code: unified currency code of the currency for the deposit address
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
        renewr|   )r  fetch_deposit_addressr  )r  r  r  r  s       r  create_deposit_addressz bitfinex1.create_deposit_addressu  s<     	Q
 ))$GV0LMMr  c                    | j                          | j                  |      }|ddd}| j                  | j                  ||            }| j	                  |d      }d}d|v r|}|d   }| j                  |       |||d|dS )a|  
        fetch the deposit address for a currency associated with self account

        https://docs.bitfinex.com/v1/reference/rest-auth-deposit

        :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>`
        rs  r   )methodwallet_namer  addressNaddress_pool)r  r  tagnetworkr  )r  r  privatePostDepositNewr  r  check_address)r  r  r  ry  r  r  r  r  s           r  r  zbitfinex1.fetch_deposit_address  s     	%%d+%

 --dkk'6.JK//(I6X%C~.G7#
 	
r  c                 x   | j                          | j                  |d      }| j                  |d      }d}|0|t        | j                  dz         | j                  |      }|d   }||d<   || j                  |dz        |d<   | j                  | j                  ||            }| j                  ||||      S )ag  
        fetch history of deposits and withdrawals

        https://docs.bitfinex.com/v1/reference/rest-auth-deposit-withdrawal-history

        :param str code: unified currency code for the currency of the deposit/withdrawals
        :param int [since]: timestamp in ms of the earliest deposit/withdrawal, default is None
        :param int [limit]: max number of deposit/withdrawals to return, default is None
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a list of `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
        r  NzY fetchDepositsWithdrawals() requires a currency `code` argument or a `currency` parameterrx  rk  rh  )
r  r  r  r   rx  r  rl  privatePostHistoryMovementsr  parse_transactions)	r  r  rh  rm  r  r  r  r  r  s	            r  fetch_deposits_withdrawalsz$bitfinex1.fetch_deposits_withdrawals  s     	%%fj9
		&*-|'  3N  )N  O  O==.%d^
&j!..ut|<E'N33DKKv4NO& &&x5%HHr  transactionc                    | j                  |d      }| j                  |d      }| j                  ||      }| j                  |d      }|t        j                  |      }i d|d| j                  |dd      d| j                  |d      d| j                  |d      d|d	d d
| j                  |d
      d| j                  | j                  |d            d|d| j                  |      d| j                  |d      dd dd d| j                  |d      dd dd d| j                  |d      d d || j                  |      d ddS )Ntimestamp_createdr  r  r  rx  withdrawal_idtxidr  r  r  rL  r!  r"  r  addressFrom	addressTor  descriptiontagFromtagToupdated)r  r  rate)commentinternalr  )rP  r  r  r)   
string_abssafe_string_2r   r  parse_transaction_statusrS  r  )r  r  r  r!  r  r  feeCosts          r  parse_transactionzbitfinex1.parse_transaction  s   X ''5HI	%%k:>
&&z8<"";6((1G
K
$$$[$H
 D$$[&9
 D**;?	

 
 t
 d&&{H=
 d33D4D4D[RZ4[\
 
 Y/
 t''Y?
 4
 
 4##K?
 t
  T!
" t**;D#
$  ))'2)
 	
r  c                 6    ddddd}| j                  |||      S )Npendingr  failedr&  )SENDINGCANCELEDZEROCONFIRMED	COMPLETEDr'  r(  s      r  r  z"bitfinex1.parse_transaction_status!  s,     "%	
 &&99r  r  c                    | j                  ||      \  }}| j                  |       | j                          | j                  |      }| j	                  |      }|d| j                  |      |d}|||d<   | j                  | j                  ||            }	| j                  |	di       }
| j                  |
d      }| j                  |
d      }| j                  | j                  d   |      }|dk(  rV|*| j                  d   |   } || j                  dz   |z         t        | j                  d	z   | j                  |
      z         | j!                  |
|      S )
a  
        make a withdrawal

        https://docs.bitfinex.com/v1/reference/rest-auth-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>`
        rs  )withdraw_typewalletselectedr  r  
payment_idr   r  r  r   r  z" withdraw returned an id of zero: )handle_withdraw_tag_and_paramsr  r  r  r  r  privatePostWithdrawr  r  r  r  find_broadly_matched_keyr  rx  r   jsonr  )r  r  r  r  r  r  ry  r  r  	responsesr  rx  r  errorMessageExceptionClasss                  r  r`   zbitfinex1.withdraw*  sa    99#vFV7#%%d+==&!(++F3	
 ?$'GL!,,T[[&-IJ	 >>)Q3x9""8Y744T__W5MwW7'!%!9,!G$TWWs]W%<==*N NQUQZQZ[cQd dee%%h99r  c                 H    | j                          | j                  |      }|S )av  
        fetch all open positions

        https://docs.bitfinex.com/v1/reference/rest-auth-active-positions

        :param str[]|None symbols: list of unified market symbols
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
        )r  privatePostPositions)r  r   r  r  s       r  fetch_positionszbitfinex1.fetch_positionsZ  s'     	,,V4  r  c                 "    | j                         S N)microseconds)r  s    r  r|  zbitfinex1.noncew  s      ""r  rr   GETc                    d| j                  ||      z   }|dk(  r	d|z   |z   }nd| j                  z   |z   }| j                  || j                  |            }| j                  d   |   |z   }	|dk(  s|j                  d      dk\  r |rd| j                  |      z   }
|	|
z  }	||
z  }|dk(  r| j                          | j                         }| j                  t        |      |d	|      }| j                  |      }| j                  |      }| j                  | j                        }| j                  | j                  |      |t         j"                        }| j$                  ||d
d}|	|||dS )Nr  rq   ru   rr   z/histr   ?rs   )r|  r  zapplication/json)zX-BFX-APIKEYzX-BFX-PAYLOADzX-BFX-SIGNATUREzContent-Type)urlr  bodyheaders)implode_paramsr{  r  extract_paramsr  r  	urlencodecheck_required_credentialsr|  r  r{  r  string_to_base64encodesecrethmachashlibsha384apiKey)r  pathru   r  r  r  r   r  r  r  suffixr|  payloadr  	signatures                  r  signzbitfinex1.signz  sn   ++D&99$;Ci')GDLL(72G		&$"5"5d";<iis#g-8O7!3q!8t~~e44v6!)++-JJLEKKU"! E 99U#D++D1G[[-F		$++g"6OI $!(#, 2	G fdwOOr  reasonr  r  r  r   c
                 l   |y d}
|dk\  r|d   dk(  r0d}
n-| j                  |di       }| j                  |dd      }|dk(  rd}
|
rp| j                  d	z   |z   }| j                  |d
d      }| j	                  | j
                  d   ||       | j                  | j
                  d   ||       t        |      y )NFi  r   {TrL  r  errorr  r  r   r   )r  r  rx  r  throw_exactly_matched_exceptionr  throw_broadly_matched_exceptionr   )r  r  r  r  r  r  r   r  requestHeadersrequestBody
throwErrorresponseObjectrL  feedbackr  s                  r  handle_errorszbitfinex1.handle_errors  s    
3;Aw#~!
 "^^Ha<N%%nhCF !
ww}t+H((9gFG001I7T\]001I7T\]))r  r  )F__name__
__module____qualname__r   r  r   r  r  r   r  r   r  r   r
   r  r  r  r   r  r{  floatr   r_   dictr  r   r#  r  r	   r   r2  r   r9  r   r<  r6  r   rf  rp  rs  r   r   r   r  r  r  r  r   r~  r  r  r  r  r  r  r  r   r  r  r   r  r  r  r`   r  r|  r  r  r  __classcell__)r  s   @r  r+   r+      s   @# @D 7;2 !G !F <@ A A.
 
" )+ M{ M^ $& h$v, hTxM $& 4)( 4)l [] /S /% /c /c /an /b
t 
x 
= 
&:C :C : :>b js j3 jY j, 04B GW G7 G" 02 13 1f 1<'4 ' '6 'RC Cv C CJ 6:SU !A3 !As !A# !AZ^_dZe !AF -1tRV_a Ac A AC A4 gksu '23 '2i '2y '2RW '2`c '2R `drv  @B *S *# *Y *i *Y\ *lo *$ 37r )*s )*C )*V /32 
 
(B Bv B BH /3TXac  3 c hlmrhs , 154VZce # S PS jnotju 0 26b *c *3 *$
 
4 
( 26DW[df ,L# ,Lc ,LQT ,Lkoptku ,L\S 8: N3 Nn N  79 
# 
^ 
B 6:[_hj ,Is ,I# ,IUX ,Iost  pA ,I\K
T K
X K
Q\ K
Z:s : DHPR .:S .:% .:# .:Wb .:` 26b w :# &eBSW P@# s  c TX `c r  r+   )0ccxt.base.exchanger   ccxt.abstract.bitfinex1r   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$   ccxt.base.decimal_to_precisionr%   r&   r'   r(   ccxt.base.preciser)   r+    r  r  <module>r,     sz    ( /  M  M  M  M  M  M  * 0 - . & . ) * ) . 1 ) 0 3 9 = %P+ Pr  