
    i                     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 d dlmZ d dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlm Z  d dlm!Z! d dlm"Z" d dlm#Z# d dlm$Z$ d dlm%Z% d dl&m'Z' d dl&m(Z( d dl&m)Z) d dl&m*Z* d dl+m,Z,  G d dee          Z-dS )    )Exchange)ImplicitAPIN)BalancesCurrency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                   x    e Zd Z fdZdi fdee         fdZdi fdefdZd?d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d?de	fdZ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d?dedefdZ d?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,d?dede-fd+Z.dddi fde$d ededee-         fd,Z/dddi fde$d ededee-         fd-Z0di fd'ede$fd.Z1d?dede2fd/Z3d0ddi fded ededee2         fd1Z4d2 Z5i fdefd3Z6i fdefd4Z7dddi fde$d ededee8         fd5Z9d?de	de8fd6Z:d7 Z;di fdedefd8Z<di fdefd9Z=d: Z>d;d<i ddfd=Z?d> Z@ xZAS )@bitfinexc           !      8   |                      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/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|                     d          |                     d          |                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          gg|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     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fetchDepositsFfetchDepositsWithdrawalsfetchDepositWithdrawFeeemulatedfetchDepositWithdrawFees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)rX   rY   rZ   r[   r\   r]   r^   r_   r`   1d1w2wrd   zchttps://user-images.githubusercontent.com/1294454/27766244-e328a50c-5ed2-11e7-947b-041416579bb3.jpgz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_detailsrr   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_fundsrV   )unused_taken_fundsrW   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   depositrW   )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)rL  rf  rg  rh  ri  exchanger   r   )r/   r0   r   r1   )currencyNames
orderTypesfiataccountsByType)idname	countriesversion	rateLimitprohas
timeframesurlsrl   feescommonCurrencies
exceptionsprecisionModeoptions)deep_extendsuperr)   describeparse_numberr!   r   r   r   r    r"   r   r   r   r   r&   )self	__class__s    a/var/www/html/crypto-bot/backend/venv/lib/python3.11/site-packages/ccxt/async_support/bitfinex.pyr  zbitfinex.describe    s   h 5 5 > > @ @ *** $* 	*
 $* $* "4* t* '* t* T* * $T* &t*  *  +D!*" *:#* *$ +D%*& "5'*( %e)** "5+*, -*. !%/*0  1*2 d3*4 "45*6 d7*8 !$9*: $U;*< !$=*> )%?*@ tA*B C*D UE* *F  $#($((,%/  S* * *X    ~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 Qh  %!%"&!..w77!..w77 "..s33T5F5Fw5O5OP!..x88$:K:KG:T:TU!..y994;L;LW;U;UV!..y994;L;LW;U;UV!..y994;L;LW;U;UV!..y994;L;LW;U;UV!..z::D<M<Mh<W<WX!..z::D<M<Mh<W<WX!..z::D<M<Mh<W<WX!..z::D<M<Mh<W<WX!..z::D<M<Mg<V<VW" "..s33T5F5Fw5O5OP!..x88$:K:KH:U:UV!..y994;L;LX;V;VW!..y994;L;LX;V;VW!..y994;L;LX;V;VW!..y994;L;LS;Q;QR!..z::D<M<Mc<R<RS!..z::D<M<Mc<R<RS!..z::D<M<Mc<R<RS!..z::D<M<Mc<R<RS!..z::D<M<Mc<R<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" 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" P" 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" 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" P"Z #  _P" P" P"d ./ 
 !      ''(%	# #{c ckyC
 yC
 y y y	    Ncodesc                   K   |                                   d{V  i }|                     |           d{V }|                     |d          }t          |                                          }t          dt          |                    D ]i}||         }|                     |          }	||                     |	|          s8| 	                    ||          i | 	                    ||          d||	<   j|S )a  
         * @deprecated
        please use fetchDepositWithdrawFees instead
        :see: 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>`
        NrW   r   )rW   r   info)
load_marketsprivatePostAccountFees
safe_valuelistkeysrangelensafe_currency_codein_arraysafe_number)
r  r  paramsresultresponserx  idsiro  codes
             r  fetch_transaction_feeszbitfinex.fetch_transaction_fees  s      !!!!!!!!!44V<<<<<<<< x44499;;q#c((## 		 		AQB**2..D!4==u+E+E! ,,T266((r22 F4LL
 r  c                    K   |                                   d{V  |                     |           d{V }|                     |d          }|                     ||          S )ak  
        fetch deposit and withdraw fees
        :see: 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>`
        NrW   )r  r  	safe_listparse_deposit_withdraw_fees)r  r  r  r  rW   s        r  fetch_deposit_withdraw_feesz$bitfinex.fetch_deposit_withdraw_fees  s|       !!!!!!!!!44V<<<<<<<< >>(J77//%@@@r  currencyc                 B    |                      |          d dd d di |dS )N)feer   )rW   r   networksr  )r  )r  r  r  s      r  parse_deposit_withdraw_feez#bitfinex.parse_deposit_withdraw_fee  sK     ((--" 
 "  
 
 	
r  returnc                   K   |                                   d{V  |                     |           d{V }i }|                     | j        di           }|                     |d          }|                     |d          }|                     |d          }|                     |d          }|                     |d          }	|                     |d          }
t          d	t          | j                            D ]b}| j        |         }|                     |          }||d
d
d}|d         |v r||d<   ||d<   n|d         r|	|d<   |
|d<   n
||d<   ||d<   |||<   c|S )aW  
        fetch the trading fees for multiple markets
        :see: 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
        Nrm  	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  rv   re  )r  r  r  r  rm  makerFeetakerFeemakerFee2FiattakerFee2FiatmakerFee2DerivtakerFee2Derivr  r  re  r  s                  r  fetch_trading_feeszbitfinex.fetch_trading_fees  s      !!!!!!!!!0088888888P t|VR88##Hk::##Hk::((3DEE((3DEE))(4FGG))(4FGGq#dl++,, 	! 	!A\!_F[[((F  "!	 C g$&&,G,G
# (-G-G'G'G F6NNr  c                 b  K   |                                   d{V }|                                  d{V }g }t          dt          |                    D ]}||         }|                     |d          }|                     ||          s8|                                }d}d}	|                    d          dk    r&|                    d          }
|
d         }|
d         }	n|dd         }|dd         }	| 	                    |          }| 	                    |	          }|dz   |z   }d	}|                    d
          dk    rd}|
                    i d|d|d|d|ddd|d|	ddd|d	|d	k    d|                     |d          d|dk    ddddddd|dk    ddddddddt          d          |                     |d          d ddd!|                     |d"          |                     |d#          d!|                     d$          dd!ddd!d%d|d&
           |S )'ap  
        retrieves data on all markets for bitfinex
        :see: https://docs.bitfinex.com/v1/reference/rest-public-symbols
        :see: 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:rs   rq   rt   /r/   F0r1   ro  r  baser  settlebaseIdquoteIdsettleIdtyper0   r2   Fr3   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  appendr  intsafe_integerr  r  )r  r  r  detailsr  r  re  ro  r  r  partsr  r  r  r  s                  r  fetch_marketszbitfinex.fetch_markets0  sL      ))++++++++ 4466666666 q#g,,'' H	 H	AQZF!!&&11B==S)) BFGwws||q  q(AaCQqS'**622D++G4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$   $"&"
 "#hh!..v7HII   $#! !
  $//8LMM#//8LMM 
  $0088# 
  $#  $  e3 3 3 3 3 3 3h r  c                     |                      |          }|                     |t          | j        |         d         d         t                    S )Nr  r  )safe_symboldecimal_to_precisionr$   marketsr%   )r  r  r  s      r  amount_to_precisionzbitfinex.amount_to_precision  sE     !!&))((4<;OP[;\]e;fhvwwwr  c                     |                      |          }|                     |t          | j        |         d         d         | j                  }|                     |t
          dt                    S )Nr  r     )r  r  r#   r  r{  r$   r%   )r  r  r  s      r  price_to_precisionzbitfinex.price_to_precision  s`    !!&))))%V8L[8YZa8bdhdvww
 ((!^LLLr  c                   K   |                                   d{V  |                     | j        di           }|                     |dd          }|                     |||          }|Nt	          |                                          }t          | j        dz   d                    |          z             | 	                    |d          }| 
                    |           d{V }d|i}|dk    }	t          d	t          |                    D ]}
||
         }|                     |d          }|                     |d
d          }t          |          dz
  }||d         dk    }|	 p|}||k    rf|rd|                     |          }||vrK|                                 }|                     |d          |d<   |                     |d          |d<   |||<   |                     |          S )ap  
        query for balance and get the amount of funds available for trading or funds locked in orders
        :see: 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>`
        Nrn  r  rj  z. fetchBalance() type parameter must be one of z, r  derivativesr   r      f0	availablefreer  total)r  r  r|  r  r  r  r   ro  joinomitprivatePostBalancesr  r  safe_string_lowerr  accountsafe_balance)r  r  rn  requestedTypeaccountTyper  queryr  r  isDerivativer  balancer  
currencyIdstartisDerivativeCodederivativeConditionr  r  s                      r  fetch_balancezbitfinex.fetch_balance  s      !!!!!!!!!7GLL((DD&&~}mTT++--..D*Z Z]a]f]fgk]l]l lmmm		&&))11%88888888 (#$5q#h--(( 	+ 	+AqkG##GV44D//RHHJ
OOa'E)%&&1T9'3#3#G7Gt##)<#..z:: "llnnG&*&6&6w&L&LGFO'+'7'7'J'JGG$#*F4L  (((r  r  r  fromAccount	toAccountc                   K   |                                   d{V  |                     | j        di           }|                     |||          }|                     |||          }|                     |          }	|                     |	d         |          }
|                     |	d         |          }|                     ||          }||
|||d}|                     |                     ||                     d{V }|                     |d          }|                     |d          }|t          | j
        dz             |                     |                     ||	          |||                     |          d          S )	a+  
        transfer currency internally between wallets on the same account
        :see: 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>`
        Nrn  ro  )r  r  currency_to
walletfromwallettor   messagez transfer failed)r  r  r  )r  r  r|  r  r  convert_derivatives_idcurrency_to_precisionprivatePostTransferextendr   ro  parse_transferr  )r  r  r  r  r  r  rn  fromIdtoIdr  fromCurrencyIdtoCurrencyIdrequestedAmountrequestr  r  r  s                    r  rV   zbitfinex.transfer  s      !!!!!!!!!7GLL!!.+{KK	9EE==&&44Xd^[QQ228D>9MM44T6BB%&' 
 
 11$++gv2N2NOOOOOOOO 1--""6955?*< <==={{4..vx@@&"''88C
 C
   	r  c                     |d d d |                      d |          d d d |                     |                     |d                    d	S )NrC  )	r  ro  	timestampdatetimer  r  r  r  rC  )r  parse_transfer_statusr  )r  rV   r  s      r  r  zbitfinex.parse_transfer
  s\     //h??001A1A(H1U1UVV

 

 
	
r  c                 8    ddi}|                      |||          S )NSUCCESSokr  r  rC  statusess      r  r  zbitfinex.parse_transfer_status  s(    t
 &&999r  c                     t          |          dz
  }||d          dk    }|dk    r|dk    r|dk    r|r|d|         }n|dk    r|s|dz   }|S )Nr  r  r  r   r0   r   )r  )r  r  r  r  r  s        r  r	  zbitfinex.convert_derivatives_id#  s|    J!#%eff-5M!!di&7&7DH<L<LRb<L#AeG,JJ]""+;"#d*Jr  r  rd  c           	      0  K   |                                   d{V  |                     |          }d|d         i}|
||d<   ||d<   |                     |                     ||                     d{V }|                     ||d         ddddd	          S )
a>  
        fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
        :see: 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  ro  
limit_bids
limit_asksbidsasksr  r  )r  re  publicGetBookSymbolr  parse_order_book)r  r  rd  r  re  r  r  s          r  fetch_order_bookzbitfinex.fetch_order_book,  s       !!!!!!!!!V$$fTl
 $)GL!$)GL!11$++gv2N2NOOOOOOOO$$Xvh/?vvW^`hiiir  rv   c                 \  K   |                                   d{V  |                     |          }|                     |           d{V }i }t          dt	          |                    D ]*}|                     ||                   }|d         }|||<   +|                     |d|          S )a  
        fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
        :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
        Nr   r  )r  market_symbolspublicGetTickersr  r  parse_tickerfilter_by_array_tickers)r  rv   r  r  r  r  tickerr  s           r  fetch_tickerszbitfinex.fetch_tickers@  s       !!!!!!!!!%%g....v66666666q#h--(( 	$ 	$A&&x{33FH%F#F6NN++FHgFFFr  c                   K   |                                   d{V  |                     |          }d|d         i}|                     |                     ||                     d{V }|                     ||          S )a  
        fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
        :see: 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  ro  )r  re  publicGetPubtickerSymbolr  r*  )r  r  r  re  r  r,  s         r  fetch_tickerzbitfinex.fetch_tickerQ  s       !!!!!!!!!V$$fTl
 44T[[&5Q5QRRRRRRRR  000r  re  c                 v   |                      |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|          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,  re  r  marketIdr  r<  s          r  r*  zbitfinex.parse_tickera  s   ''<<	##FF33!!(F33!55 !
f!
!
 Y//!
 D$$VV44	!

 4##FE22!
 4##FE22!
 !
 4##FE22!
 !
 D!
 D!
 T!
 D!
 T!
 d!
  $!!
" t''66#!
$ **68<<)!
 !
 !
* +  	r  c                 D   |                      |d          }|                     |d          }d }|                     |d          }|                      |d          }|                      |d          }|                      |d          }	d }
d|v rXt          j        |                      |d                    }|                      |d          }|                     |          }||d	}
|                     ||||                     |          |d
         |||d ||	d |
d|          S )Ntidr  r  order_idr  r  
fee_amountfee_currency)r  r  r  )ro  r  r  r  r  r  ordersidetakerOrMakerr  r  r  r  )r  rD  r  r'   
string_negr  
safe_traderG  )r  tradere  ro  r  r  rO  orderIdpriceStringamountStringr  feeCostStringfeeCurrencyIdfeeCurrencyCodes                 r  parse_tradezbitfinex.parse_trade~  sQ   J eU++''{;;	%%eV44""5*55&&ug66''x885  #.t/?/?|/T/TUUM ,,UNCCM"55mDDO%+ C "Y//X&  " 
  
   	r  2   sincec                 B  K   |                                   d{V  |                     |          }|d         |d}||                     |dz            |d<   |                     |                     ||                     d{V }|                     ||||          S )a%  
        get the list of most recent trades for a particular symbol
        :see: 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>`
        Nro  )r  limit_trades  r  )r  re  parse_to_intpublicGetTradesSymbolr  parse_tradesr  r  r\  rd  r  re  r  r  s           r  fetch_tradeszbitfinex.fetch_trades  s       !!!!!!!!!V$$Tl!
 
 #'#4#4UT\#B#BGK 33DKK4P4PQQQQQQQQ   65%@@@r  c                   K   |t          | j        dz             |                                  d{V  |                     |          }d|d         i}|||d<   ||                     |dz            |d<   |                     |                     ||                     d{V }|                     ||||          S )a  
        fetch all trades made by the user
        :see: 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  ro  r^  r_  r  )r   ro  r  re  r`  privatePostMytradesr  rb  rc  s           r  fetch_my_tradeszbitfinex.fetch_my_trades  s       >#DG.[$[\\\!!!!!!!!!V$$fTl
 &+GN##'#4#4UT\#B#BGK 11$++gv2N2NOOOOOOOO  65%@@@r  r  rO  r  c                   K   |                                   d{V  |                     |          }|                     |dd          }|                                }|                     |dg          }|d         r"|                     | j        d         ||          }|d         ||                     ||          |dddd}	|                    d	          d
k    r%t          | 
                                          |	d<   n|                     ||          |	d<   |rd|	d<   |                     |                     |	|                     d{V }
|                     |
|          S )a  
        create a trade order
        :see: 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 fullfilled, 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postOnlyFr/   rl  ro  r   )r  rO  r  r  ocoorderbuy_price_ocosell_price_ocore  r  r  Tis_postonly)r  re  	safe_boollowerr  r  r|  r  r  strnoncer  privatePostOrderNewr  parse_order)r  r  r  rO  r  r  r  re  ri  r  r  s              r  create_orderzbitfinex.create_order  s      !!!!!!!!!V$$>>&*e<<zz||6J<00&> 	R ))$,|*DdDQQDTl..vv>>
 
 99X##"4::<<00GG#66vuEEGG 	*%)GM"11$++gv2N2NOOOOOOOO&111r  ro  c                   K   |                                   d {V  dt          |          i}||                     ||          |d<   ||                     |          |d<   ||                     |          |d<   |||d<   |%|                     | j        d         ||          |d<   |                     |                     ||                     d {V }	| 	                    |	          S )NrK  r  r  r  rO  rl  r  )
r  r  r  number_to_string	market_idr  r|  privatePostOrderCancelReplacer  rs  )
r  ro  r  r  rO  r  r  r  rN  r  s
             r  
edit_orderzbitfinex.edit_order#  s     !!!!!!!!!B
 !44VUCCE'N"33F;;E(O"nnV44E(O E&M ,,T\,-GtTTE&M;;DKKv<V<VWWWWWWWW)))r  c                    K   |                                   d{V  dt          |          i}|                     |                     ||                     d{V S )a  
        cancels an open order
        :see: 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>`
        NrK  )r  r  privatePostOrderCancelr  )r  ro  r  r  r  s        r  cancel_orderzbitfinex.cancel_order5  st       !!!!!!!!!B
 00Wf1M1MNNNNNNNNNr  c                 <   K   |                      |           d{V S )a}  
        cancel all open orders
        :see: https://docs.bitfinex.com/v1/reference/rest-auth-cancel-all-orders
        :param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: response from exchange
        N)privatePostOrderCancelAll)r  r  r  s      r  cancel_all_orderszbitfinex.cancel_all_ordersD  s.       33F;;;;;;;;;r  c           	         |                      |d          }|                     |d          }|                     |d          }d }|rd}n|rd}nd}|                     |d          }|                     ||          }|                      |dd	          }	|	                    d
          dk    }
|
r#|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 |          S )!NrO  is_liveis_cancelledr:  canceledclosedr  r  r  z	exchange r    rs   r  ro  r  clientOrderIdr  lastTradeTimestamptimeInForceri  r  	stopPricetriggerPricer?  avg_execution_pricer  original_amount	remainingremaining_amountexecuted_amount)filledrC  r  r  trades)	r  r  safe_string_upperr  r  r  rD  
safe_orderrG  )r  rN  re  rO  r:  r  rC  rH  r  	orderTyperj  r  r  ro  s                 r  rs  zbitfinex.parse_orderN  sx   2 v..ui00??5.99 	FF 	FFF))%::!!(F33$$UFB77	>>+..!3 	!&M'',,EaI''{;;	eT**  
E 
" 
 T 
 	 

 Y// 
 !$ 
 f 
 I 
 4 
  
 D 
 T%%eW55 
  
 D 
 t''/DEE 
  d&&u.?@@! 
" ))%1CDD# 
$ &&u.?@@- 
  
  
. /  	r  c                    K   |                                   d{V  |#|| j        vrt          | j        dz   |z             |                     |           d{V }|                     |d||          }||                     |d|          }|S )a  
        fetch all unfilled currently open orders
        :see: 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   ro  privatePostOrdersparse_orders	filter_by)r  r  r\  rd  r  r  r   s          r  fetch_open_orderszbitfinex.fetch_open_orders  s       !!!!!!!!!dl**#DG.?$?&$HIII//77777777""8T5%@@^^FHf==Fr  c                 n  K   |                                   d{V  |                     |          }i }|||d<   |                     |                     ||                     d{V }|                     |d||          }||                     |d|          }|                     |dddgd          }|S )aB  
        fetches information on multiple closed orders made by the user
        :see: 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>`
        Nrd  r  rC  r  r  F)r  r  privatePostOrdersHistr  r  r  filter_by_array)r  r  r\  rd  r  r  r  r   s           r  fetch_closed_orderszbitfinex.fetch_closed_orders  s       !!!!!!!!!V$$$GG33DKK4P4PQQQQQQQQ""8T5%@@^^FHf==F%%fh:8NPUVVr  c                    K   |                                   d{V  dt          |          i}|                     |                     ||                     d{V }|                     |          S )ax  
        fetches information on an order made by the user
        :see: https://docs.bitfinex.com/v1/reference/rest-auth-order-status
        :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>`
        NrK  )r  r  privatePostOrderStatusr  rs  )r  ro  r  r  r  r  s         r  fetch_orderzbitfinex.fetch_order  s       !!!!!!!!!B
 44T[[&5Q5QRRRRRRRR)))r  c           	         |                      |d          |                     |d          |                     |d          |                     |d          |                     |d          |                     |d          gS )Nr   rs   rq      r     )r  r  )r  ohlcvre  s      r  parse_ohlcvzbitfinex.parse_ohlcv  s     eQ''UA&&UA&&UA&&UA&&UA&&
 	
r  rX   c                   K   |                                   d{V  |d}nt          |d          }|                     |          }d|d         z   }||                     | j        ||          d|d}|||d<   |                     |                     ||                     d{V }	|                     |	||||          S )	a  
        fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
        :see: 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
        :returns int[][]: A list of candles ordered, open, high, low, close, volume
        Nd   i'  tro  rs   )r  	timeframesortrd  r  )r  r  re  r  rv  $v2GetCandlesTradeTimeframeSymbolHistr  parse_ohlcvs)
r  r  r  r\  rd  r  re  v2idr  r  s
             r  fetch_ohlcvzbitfinex.fetch_ohlcv  s       !!!!!!!!!=EEu%%EV$$VD\!))$/9iPP	
 
 $GGBB4;;wX^C_C_````````   69eUKKKr  c                     || j         d         v r| j         d         |         S t          | j        dz   |z   dz             )Nrk  r  z not supported for withdrawal)r|  r   ro  )r  r  s     r  get_currency_namezbitfinex.get_currency_name  sE    4<000<06647S=4/2QQRRRr  c                    K   |                                   d{V  ddi}|                     ||                     ||                     d{V S )a  
        create a currency deposit address
        :see: 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renewrs   )r  fetch_deposit_addressr  )r  r  r  r  s       r  create_deposit_addresszbitfinex.create_deposit_address
  sp       !!!!!!!!!Q
 //dkk'66R6RSSSSSSSSSr  c                 T  K   |                                   d{V  |                     |          }|ddd}|                     |                     ||                     d{V }|                     |d          }d}d|v r
|}|d         }|                     |           |||d|dS )a  
        fetch the deposit address for a currency associated with self account
        :see: 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>`
        Nrj  r   )methodwallet_namer  addressaddress_pool)r  r  tagnetworkr  )r  r  privatePostDepositNewr  r  check_address)r  r  r  rp  r  r  r  r  s           r  r  zbitfinex.fetch_deposit_address  s       !!!!!!!!!%%d++%
 

 33DKK4P4PQQQQQQQQ//(I66X%%C~.G7###
 
 	
r  c                   K   |                                   d{V  |                     |d          }|                     |d          }d}|6|t          | j        dz             |                     |          }|d         }||d<   ||                     |dz            |d<   |                     |                     ||                     d{V }| 	                    ||||          S )ak  
        fetch history of deposits and withdrawals
        :see: 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` parameterro  r_  r\  )
r  r  r  r   ro  r  r`  privatePostHistoryMovementsr  parse_transactions)	r  r  r\  rd  r  r  r  r  r  s	            r  fetch_deposits_withdrawalsz#bitfinex.fetch_deposits_withdrawals7  s      !!!!!!!!!%%fj99
		&*--|'  3N  )N  O  O  O==..%d^
&j!..ut|<<E'N99$++eV:T:TUUUUUUUU& &&x5%HHHr  c                    |                      |d          }|                     |d          }|                     ||          }|                     |d          }|t          j        |          }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S )Ntimestamp_createdr  r  r  ro  withdrawal_idtxidr  r  r  rC  r  r  r  addressFrom	addressTor  descriptiontagFromtagToupdated)r  r  rate)commentinternalr  )rD  r  r  r'   
string_abssafe_string_2r  r  parse_transaction_statusrG  r  )r  transactionr  r  r  r  feeCosts          r  parse_transactionzbitfinex.parse_transactionc  s   X ''5HII	%%k:>>
&&z8<<"";66(11G
K
$$$[$HH
 D$$[&99
 D**;??	

 
 t
 d&&{H==
 d33D4D4D[RZ4[4[\\
 
 Y//
 t''Y??
 4
 
 4##K??
 t
  T!
" t**;DD#
$  ))'22 )
 
 
 	
r  c                 >    ddddd}|                      |||          S )Npendingr  failedr  )SENDINGCANCELEDZEROCONFIRMED	COMPLETEDr  r  s      r  r  z!bitfinex.parse_transaction_status  s4     "%	
 
 &&999r  c                 :  K   |                      ||          \  }}|                     |           |                                  d{V  |                     |          }|                     |          }|d|                     |          |d}|||d<   |                     |                     ||                     d{V }	|                     |	di           }
| 	                    |
d          }| 
                    |
d          }|                     | j        d         |          }|dk    rX|)| j        d         |         } || j        d	z   |z             t          | j        d
z   |                     |
          z             |                     |
|          S )a  
        make a withdrawal
        :see: 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>`
        Nrj  )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  rv  privatePostWithdrawr  r  r  r  find_broadly_matched_keyrz  ro  r   jsonr  )r  r  r  r  r  r  rp  r  r  	responsesr  ro  r  errorMessageExceptionClasss                  r  rW   zbitfinex.withdraw  s      99#vFFV7###!!!!!!!!!%%d++==&&!(++F33	
 
 ?$'GL!224;;w3O3OPPPPPPPP	 ??9a44h88""8Y7744T_W5MwWW77'!%!9,!G$nTWs]W%<===*N NQUQZQZ[cQdQd deee%%h999r  c                 t   K   |                                   d{V  |                     |           d{V }|S )az  
        fetch all open positions
        :see: 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  rv   r  r  s       r  fetch_positionszbitfinex.fetch_positions  sX       !!!!!!!!!226::::::::  r  c                 *    |                                  S N)milliseconds)r  s    r  rq  zbitfinex.nonce  s      """r  ri   GETc                 .   d|                      ||          z   }|dk    r	d|z   |z   }nd| j        z   |z   }|                     ||                     |                    }| j        d         |         |z   }	|dk    s|                    d          dk    r$|r"d|                     |          z   }
|	|
z  }	||
z  }|dk    r|                                  |                                 }| 	                    t          |          |d	|          }|                     |          }|                     |          }|                     | j                  }|                     |                     |          |t           j                  }| j        ||d
d}|	|||dS )Nr  rh   rl   ri   z/histr   ?rj   )rq  r  zapplication/json)zX-BFX-APIKEYzX-BFX-PAYLOADzX-BFX-SIGNATUREzContent-Type)urlr  bodyheaders)implode_paramsrr  r  extract_paramsrw  r  	urlencodecheck_required_credentialsrq  r  rp  r  string_to_base64encodesecrethmachashlibsha384apiKey)r  pathrl   r  r  r  r  r  r  r  suffixrq  payloadr  	signatures                  r  signzbitfinex.sign  s   ++D&999$;;Ci')GGDL(72G		&$"5"5d";";<<is#g-8OO7!3!3q!8!8 "t~~e444v6!)++---JJLLEKKU"! !  E 99U##D++D11G[[--F		$++g"6"6OOI $!(#, 2	 G fdwOOOr  c
                    |d S d}
|dk    r|d         dk    rd}
n6|                      |di           }|                     |dd          }|dk    rd}
|
rw| j        d	z   |z   }|                     |d
d          }|                     | j        d         ||           |                     | j        d         ||           t          |          d S )NFi  r   {TrC  r  errorr  r  r   r   )r  r  ro  r  throw_exactly_matched_exceptionrz  throw_broadly_matched_exceptionr   )r  r  reasonr  r  r  r  r  requestHeadersrequestBody
throwErrorresponseObjectrC  feedbackr  s                  r  handle_errorszbitfinex.handle_errors%  s    4
3;;Aw#~~!
 "__Xq"==N%%nhCCF  !
 	*w}t+H((9gFFG001I7T\]]]001I7T\]]])))tr  r  )B__name__
__module____qualname__r  r   rp  r  r   r  r   r  r   r  r   r  r  r  r   r  floatr   rV   r  r  r	  r   r   r&  r   r-  r   r0  r*  r   rZ  rd  r   rg  r   r   r	   rt  ry  r|  r  r
   rs  r  r  r  r  r  r  r  r  r  r   r  r  r  rW   r  rq  r  r  __classcell__)r  s   @r  r)   r)      ss       z z z z zx ?C2  $s)    B BFb A Aw A A A A*
 
 
 
 
 
" /1 K K[ K K K KZ *, e eV e e e eNx x xM M M *, 2) 2) 2) 2) 2) 2)h ac - -3 - -C -TW -gt - - - -^
 
 
 
 
 
&: : :   @DB j jS j jS\ j j j j( 6:" G G7 G G G G G" 68 1 1 1F 1 1 1 1  6 V    :C C C5 C C C CJ <@bY[ A A AS A A`dej`k A A A AB 37TX\eg A AC As ARU A A A A0 mqy{ %2 %2 %2I %2Y %2X] %2fi %2 %2 %2 %2N fjx|  FH * *3 * *9 *I *_b *ru * * * *$ 9=R O OS O# O O O O 59 < <c < < < <C C C5 C C C CJ 59tZ^gi  c  TW nrsxny    ( 7;\`ik   3 VY ptuzp{    , 8<B * *C * * * * *
 
 
4 
 
 
 
( 8<$]ajl "L "L "LC "LWZ "Lquvzq{ "L "L "L "LHS S S >@ T T T T T T =? 
 
 
 
 
 
> <@daenp *I *IS *I *I[^ *Iuy  {F  vG *I *I *I *IXK
 K
x K
; K
 K
 K
 K
Z: : : EIQS ,: ,:3 ,: ,: ,: ,: ,:\ 8<B  W    6# # # &eBSW P P P P@      r  r)   ). ccxt.async_support.base.exchanger   ccxt.abstract.bitfinexr   r  ccxt.base.typesr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   typingr   ccxt.base.errorsr   r   r   r   r   r   r   r   r   r    r!   r"   ccxt.base.decimal_to_precisionr#   r$   r%   r&   ccxt.base.preciser'   r)    r  r  <module>r     s   6 5 5 5 5 5 . . . . . .  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x  x       * * * * * * 0 0 0 0 0 0 - - - - - - . . . . . . & & & & & & . . . . . . ) ) ) ) ) ) * * * * * * ) ) ) ) ) ) . . . . . . 1 1 1 1 1 1 ) ) ) ) ) ) 0 0 0 0 0 0 3 3 3 3 3 3 9 9 9 9 9 9 = = = = = = % % % % % %[ [ [ [ [x [ [ [ [ [r  