
    !:h#                    p   d dl mZ d dlmZ d dl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      Z0y)    )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    V/var/www/html/turnos/venv/lib/python3.12/site-packages/ccxt/async_support/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                   K   | j                          d{    i }| j                  |       d{   }| j                  |di       }t        |j	                               }t        dt        |            D ]V  }||   }| j                  |      }	|| j                  |	|      s.| j                  ||      i | j                  ||      d||	<   X |S 7 7 w)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>`
        Nr`   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      !!!44V<< ~~h
B7499;q#c(# 		AQB**2.D!4==u+E ,,T26((r2F4L		 - 	"<s    CCCCB!CCc                    K   | j                          d{    | j                  |       d{   }| j                  |d      }| j                  ||      S 7 A7 *w)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>`
        Nr`   )r  r  	safe_listparse_deposit_withdraw_fees)r  r  r  r  r`   s        r  fetch_deposit_withdraw_feesz%bitfinex1.fetch_deposit_withdraw_fees  s[      !!!44V<< >>(J7//%@@ 	"<s   AAAA)AA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                   K   | j                          d{    | j                  |       d{   }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 7 '7 w)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
        Nrv  	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  sn     !!!0088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%	!& I 	"8s    ED=EE DE Ec                   K   | j                         }| j                         }t        j                  ||g  d{   \  }}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 7 w)'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
        Nr   pair: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publicGetSymbolsDetailsasynciogatherr  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 %^^j.-IJJ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 W Ks   8G%G"F(G%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                 \  K   | j                          d{    | j                  | j                  di       }| j                  |dd      }| j                  |||      }|Ct	        |j                               }t        | j                  dz   dj                  |      z         | j                  |d      }| j                  |       d{   }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 7 7 w)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>`
        Nrw  r  rs  z. 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		&&)11%88 )$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'	+(   ((W 	" 9s6   F,F'B2F,	F*
A1F,<F,?F,AF,*F,r  r  fromAccount	toAccountc                   K   | j                          d{    | j                  | j                  di       }| j                  |||      }| j                  |||      }| j	                  |      }	| j                  |	d   |      }
| j                  |	d   |      }| j                  ||      }||
|||d}| j                  | j                  ||             d{   }| j                  |d      }| j                  |d      }|t        | j                  dz         | j                  | j                  ||	      ||| j                  |      d      S 7 97 zw)	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>`
        Nrw  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  s_     !!!6FK!!.+{K	9E==&44Xd^[Q228D>9M44T6B%&' 
 11$++gv2NOO 1-""695?*< <=={{4..vx@&"''8C
  	9 	" Ps#   EEC EEA8EE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_status1  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_id7  sl    J!#%ef-5M!di&7DH<LRb#Ae,J  ]"+;#d*Jr  r  rm  c           	        K   | j                          d{    | j                  |      }d|d   i}|
||d<   ||d<   | j                  | j                  ||             d{   }| j	                  ||d   ddddd	      S 7 k7  w)
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
        Nr  rx  
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!11$++gv2NOO$$Xvh/?vvW^`hii 	" Ps"   BBAB#B$BBr   c                 0  K   | j                          d{    | j                  |      }| j                  |       d{   }i }t        dt	        |            D ]   }| j                  ||         }|d   }|||<   " | j                  |d|      S 7 {7 Sw)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>`
        Nr   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_tickersV  s      !!!%%g...v66q#h-( 	$A&&x{3FH%F#F6N	$ ++FHgFF 	"6s"   BB)B BABBc                    K   | j                          d{    | j                  |      }d|d   i}| j                  | j                  ||             d{   }| j	                  ||      S 7 W7 w)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>`
        Nr  rx  )r  rn  publicGetPubtickerSymbolr  r8  )r  r  r  rn  r!  r:  s         r  fetch_tickerzbitfinex1.fetch_tickerg  sy      !!!V$fTl
 44T[[&5QRR   00% 	"
 Ss"   A2A.A A2A0A20A2r:  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  r:  rn  r#  marketIdr  rJ  s          r  r8  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  rR  r  r)   
string_negr  
safe_traderU  )r  rW  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                    K   | j                          d{    | j                  |      }|d   |d}|| j                  |dz        |d<   | j                  | j	                  ||             d{   }| j                  ||||      S 7 s7 w)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>`
        Nrx  )r  limit_trades  r#  )r  rn  parse_to_intpublicGetTradesSymbolr  parse_tradesr  r  rj  rm  r  rn  r!  r  s           r  fetch_tradeszbitfinex1.fetch_trades  s      !!!V$Tl!
 #'#4#4UT\#BGK 33DKK4PQQ   65%@@+ 	" Rs"   BB
AB1B2BBc                 `  K   |t        | j                  dz         | j                          d{    | j                  |      }d|d   i}|||d<   || j	                  |dz        |d<   | j                  | j                  ||             d{   }| j                  ||||      S 7 y7 w)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>`
        Nz+ fetchMyTrades() requires a symbol argumentr  rx  rl  rm  r#  )r   rx  r  rn  rn  privatePostMytradesr  rp  rq  s           r  fetch_my_tradeszbitfinex1.fetch_my_trades  s      >#DGG.[$[\\!!!V$fTl
 &+GN##'#4#4UT\#BGK 11$++gv2NOO  65%@@ 	" Ps"   .B.B*A B.B,B.,B.r  r^  r  c                 f  K   | j                          d{    | 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                  |	|             d{   }
| j                  |
|      S 7 7 w)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>`
        N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  rw  r!  r  s              r  create_orderzbitfinex1.create_order0  s3     !!!V$>>&*e<zz|6J<0&> ))$,,|*DdDQDTl..vv>
 99X#"4::<0GG#66vuEGG%)GM"11$++gv2NOO&113 	"0 Ps"   D1D,C>D1D/D1/D1rx  c                   K   | j                          d {    dt        |      i}|| j                  ||      |d<   || j                  |      |d<   || j	                  |      |d<   |||d<   |#| j                  | j                  d   ||      |d<   | j                  | j                  ||             d {   }	| j                  |	      S 7 7 w)NrZ  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_orderY  s     !!!B
 !44VUCE'N"33F;E(O"nnV4E(O E&M ,,T\\,-GtTE&M;;DKKv<VWW)) 	" Xs"   CCB$C;C<CCc                    K   | j                          d{    dt        |      i}| j                  | j                  ||             d{   }| j	                  |      S 7 K7 w)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>`
        NrZ  )r  r  privatePostOrderCancelr  r  r  rx  r  r  r!  r  s         r  cancel_orderzbitfinex1.cancel_orderk  si      !!!B
 44T[[&5QRR4 ))= 	" S!   A&A"5A&A$A&$A&c                 h   K   | j                  |       d{   }| j                  d|i      gS 7 w)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
        Nr  )privatePostOrderCancelAll
safe_order)r  r  r  r  s       r  cancel_all_orderszbitfinex1.cancel_all_orders  sC      77??
 OO 
 	
	 @s   202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_cancelledrH  canceledclosedr  r  r  z	exchange r    r|   r#  rx  r  clientOrderIdr$  lastTradeTimestamptimeInForcerw  r  triggerPricerM  avg_execution_pricer  original_amount	remainingremaining_amountfilledexecuted_amount)rL  r  r  trades)	r  r  safe_string_upperr  r  r  rR  r  rU  )r  r]  rn  r^  rH  r  rL  rV  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                    K   | j                          d{    |)|| j                  vrt        | j                  dz   |z         | j	                  |       d{   }| j                  |d||      }|| j                  |d|      }|S 7 s7 1w)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  rj  rm  r  r  r   s          r  fetch_open_orderszbitfinex1.fetch_open_orders  s      !!!dll*#DGG.?$?&$HII//77""8T5%@^^FHf=F 	" 8s"   BB
ABB0BBc                 J  K   | j                          d{    | j                  |      }i }|||d<   | j                  | j                  ||             d{   }| j	                  |d||      }|| j                  |d|      }| j                  |dddgd      }|S 7 7 Gw)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  rj  rm  r  r!  r  r   s           r  fetch_closed_orderszbitfinex1.fetch_closed_orders  s      !!!V$$GG33DKK4PQQ""8T5%@^^FHf=F%%fh:8NPUV 	"
 Rs#   B#BAB#B!AB#!B#c                    K   | j                          d{    dt        |      i}| j                  | j                  ||             d{   }| j	                  |      S 7 K7 w)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>`
        NrZ  )r  r  privatePostOrderStatusr  r  r  s         r  fetch_orderzbitfinex1.fetch_order  sg      !!!B
 44T[[&5QRR)) 	" S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                   K   | j                          d{    |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                  ||             d{   }| j                  |||||      S 7 7 w)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
        Nd   i'  trx  r|   )r  	timeframesortrm  untilr  rm  end)r  r  rn  r  r  r  parse_timeframer   $v2GetCandlesTradeTimeframeSymbolHistr  parse_ohlcvs)r  r  r  rj  rm  r  rn  v2idr!  r  durationr  s               r  fetch_ohlcvzbitfinex1.fetch_ohlcvB  s.     !!!=Eu%EV$VD\!))$//9iP	
 !!&'2$GG++I6H$h(>(EFGG"GEN67+BB4;;wX^C_``   69eUKK= 	", as"   D C<CD "C>#D >D 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_namep  sE    4<<00<<066477S=4/2QQRRr  c                    K   | j                          d{    ddi}| j                  || j                  ||             d{   S 7 27 w)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>`
        Nrenewr|   )r  fetch_deposit_addressr  )r  r  r  r!  s       r  create_deposit_addressz bitfinex1.create_deposit_addressv  sU      !!!Q
 //dkk'66RSSS	 	" Ts!   AA	-AAAAc                 2  K   | j                          d{    | j                  |      }|ddd}| j                  | j                  ||             d{   }| j	                  |d      }d}d|v r|}|d   }| j                  |       |||d|dS 7 |7 >w)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>`
        Nrs  r   )methodwallet_namer  address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+%

 33DKK4PQQ//(I6X%C~.G7#
 	
 	" Rs!   BB?BB=BBc                   K   | j                          d{    | j                  |d      }| j                  |d      }d}|0|t        | j                  dz         | j                  |      }|d   }||d<   || j                  |dz        |d<   | j                  | j                  ||             d{   }| j                  ||||      S 7 7 w)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>`
        Nr  zY fetchDepositsWithdrawals() requires a currency `code` argument or a `currency` parameterrx  rm  rj  )
r  r  r   r   rx  r  rn  privatePostHistoryMovementsr  parse_transactions)	r  r  rj  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99$++eV:TUU& &&x5%HHA 	" Vs"   CCBC5C6CC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  )rR  r  r  r)   
string_abssafe_string_2r  r  parse_transaction_statusrU  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                   K   | j                  ||      \  }}| j                  |       | j                          d{    | j                  |      }| j	                  |      }|d| j                  |      |d}|||d<   | j                  | j                  ||             d{   }	| 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 7 07 ʭw)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>`
        Nrs  )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+  sz     99#vFV7#!!!%%d+==&!(++F3	
 ?$'GL!224;;w3OPP	 >>)Q3x9""8Y744T__W5MwW7'!%!9,!G$TWWs]W%<==*N NQUQZQZ[cQd dee%%h99? 	" Qs#   :E1E,A'E1$E/%CE1/E1c                 x   K   | j                          d{    | j                  |       d{   }|S 7 7 w)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>`
        N)r  privatePostPositions)r  r   r  r  s       r  fetch_positionszbitfinex1.fetch_positions[  s=      !!!226::  # 	":s   :6:8::c                 "    | j                         S N)microseconds)r  s    r  r~  zbitfinex1.noncex  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.sign{  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   r4  r   r;  r   r>  r8  r   rh  rr  ru  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 =A !' !F BFb Aw A.
 
" /1 M[ M^ *, hV hTxM *, 4) 4)l ac /3 / /C /TW /gt /b
t 
x 
= 
&:C :C : @DB jS j jS\ j, 6:" G7 G G" 68 1 1F 1<'4 ' '6 'RC Cv C CJ <@bY[ !A !AS !A !A`dej`k !AF 37TX\eg AC As ARU A4 mqy{ '2 '2I '2Y '2X] '2fi '2R fjx|  FH *3 * *9 *I *_b *ru *$ 9=R )*S )*# )*V 59 
c 
(B Bv B BH 59tZ^gi c  TW nrsxny , 7;\`ik  3 VY ptuzp{ 0 8<B *C * *$
 
4 
( 8<$]ajl ,L ,LC ,LWZ ,Lquvzq{ ,L\S >@ T TN T  =? 
 
> 
B <@daenp ,IS ,I ,I[^ ,Iuy  {F  vG ,I\K
T K
X K
Q\ K
Z:s : JNVX .:3 .: .: .:]h .:` 8<B W :# &eBSW P@# s  c TX `c r  r+   )1 ccxt.async_support.base.exchanger   ccxt.abstract.bitfinex1r   r  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/     s}    6 /   M  M  M  M  M  M  * 0 - . & . ) * ) . 1 ) 0 3 9 = %P+ Pr  