
    !: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 d dlmZ d dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ d dlm Z  d dl!m"Z"  G d dee      Z#y)    )Exchange)ImplicitAPIN)AnyBalancesCurrencyDepositAddressIntMarketNumOrder	OrderBook	OrderSide	OrderTypeStrTickerTradeTradingFees)List)ExchangeError)AuthenticationError)PermissionDenied)ArgumentsRequired)OrderNotFound)NotSupported)InvalidNonce)	TICK_SIZE)Precisec                       e Zd Zdef fdZdefdZi fdefdZdi fdede	de
fdZd/d	ed
edefdZi fdedefdZddi fdede	de	dee   fdZi fdefdZdi fdededededef
dZdi fdedefdZdddi fdede	de	dee   fdZdi fdedefdZd/ded
edefdZ dddi fdede	de	fdZ!d Z"d/ded
edefdZ#d Z$i fd ede%fd!Z&d/d"e'de%fd#Z(d$ Z)d%d&i ddfd'Z*d(e+d)ed*ed+ed,ed-efd.Z, xZ-S )0bit2creturnc           !      
   | j                  t        t        |          dddg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i d)dd*dd+dd,dd-dd.dd/dd0dd1dd2dd3dd4dd5dd6dd7dd8dd9di d:dd;dd<dd=dd>dd?dd@ddAddBddCddDddEddFddGddHddIddJdi dKddLddMddNddOddPddQddRddSddTddUddVddWddXddYddZdd[dddddddd\d]d^d_id`dadbdcgdddeg dfig dgg dhdidj| j	                  dkdldmdndodpdddq      | j	                  drdsdtdndudpdddq      | j	                  dvdwdxdndydpdddq      | j	                  dzd{d|dnd}dpdddq      d~dd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| 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| j                  d      | j                  d      ggddiddidddd dddd dddddddddddddd ddddddddddddd ddddd d d d	d d dd d ddt        t        t        dt        t        ddd      S )Nr   Bit2CILi  FCORSspotTmarginswapfutureoption	addMarginborrowCrossMarginborrowIsolatedMarginborrowMargincancelAllOrderscancelOrdercloseAllPositionsclosePositioncreateOrder$createOrderWithTakeProfitAndStopLoss&createOrderWithTakeProfitAndStopLossWscreateReduceOnlyOrderfetchBalancefetchBorrowInterestfetchBorrowRatefetchBorrowRateHistoriesfetchBorrowRateHistoryfetchBorrowRatesfetchBorrowRatesPerSymbolfetchCrossBorrowRatefetchCrossBorrowRatesfetchDepositAddressfetchDepositAddressesfetchDepositAddressesByNetworkfetchFundingHistoryfetchFundingIntervalfetchFundingIntervalsfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchGreeksfetchIndexOHLCVfetchIsolatedBorrowRatefetchIsolatedBorrowRatesfetchIsolatedPositionsfetchLeveragefetchLeveragesfetchLeverageTiersfetchLiquidationsfetchLongShortRatiofetchLongShortRatioHistoryfetchMarginAdjustmentHistoryfetchMarginModefetchMarginModesfetchMarketLeverageTiersfetchMarkOHLCVfetchMarkPricesfetchMyLiquidationsfetchMySettlementHistoryfetchMyTradesfetchOpenInterestfetchOpenInterestHistoryfetchOpenInterestsfetchOpenOrdersfetchOptionfetchOptionChain
fetchOrderfetchOrderBookfetchPositionfetchPositionHistoryfetchPositionModefetchPositionsfetchPositionsForSymbolfetchPositionsHistoryfetchPositionsRiskfetchPremiumIndexOHLCVfetchSettlementHistoryfetchTickerfetchTradesfetchTradingFeefetchTradingFeesfetchTransferfetchTransfersfetchUnderlyingAssetsfetchVolatilityHistoryreduceMarginrepayCrossMarginrepayIsolatedMarginrepayMargin)setLeverage	setMarginsetMarginModesetPositionModetransferwszOhttps://github.com/user-attachments/assets/db0bce50-6842-4c09-a1d5-0c87d22118aarestzhttps://bit2c.co.ilzhttps://www.bit2c.co.ilz<https://bit2c.co.il/Aff/63bfed10-e359-420c-ab5a-ad368dab0bafz https://www.bit2c.co.il/home/apizhttps://github.com/OferE/bit2c)logoapiwwwreferraldocget)zExchanges/{pair}/TickerzExchanges/{pair}/orderbookzExchanges/{pair}/tradeszExchanges/{pair}/lasttrades)zMerchant/CreateCheckoutzFunds/AddCoinFundsRequestzOrder/AddFundzOrder/AddOrderOrder/GetByIdzOrder/AddOrderMarketPriceBuyzOrder/AddOrderMarketPriceSellzOrder/CancelOrderzOrder/AddCoinFundsRequestzOrder/AddStopOrderzPayment/GetMyIdzPayment/SendzPayment/Pay)zAccount/BalancezAccount/Balance/v2zOrder/MyOrdersr   zOrder/AccountHistoryzOrder/OrderHistory)postr   )publicprivateBtcNisBTC/NISBTCNISBtcNis)idsymbolbasequotebaseIdquoteIdtyper%   EthNisETH/NISETHEthLtcNisLTC/NISLTCLtcUsdcNisUSDC/NISUSDCUsdc)r   r   r   r   tradingz0.025z0.03020000z0.02755000075000z0.0225100000z0.02250000z0.015500000z0.0125750000z0.011000000z0.0082000000z0.0063000000z0.0044000000z0.002z0.0175z0.0075z0.005z0.003z0.001)takermaker)	tierBased
percentager   r   tiersfetchTradesMethod public_get_exchanges_pair_trades)IOCFOKPOGTD)
marginModetriggerPricetriggerPriceTypetriggerDirectionstopLossPricetakeProfitPriceattachedStopLossTakeProfittimeInForcehedgedtrailingleveragemarketBuyRequiresPricemarketBuyByCostselfTradePreventionicebergd      )r   limitdaysBack	untilDayssymbolRequired)r   triggerr   r   )r   r   r   r   r   )	sandboxr2   createOrdersr[   rb   r_   fetchOrdersfetchClosedOrders
fetchOHLCV)linearinverse)r%   r'   r(   )zPlease provide valid APIkeyzNo order found.)zPlease provide valid noncez'please approve new terms of use on site)exactbroad)r   name	countries	rateLimitprohasurlsr   marketsfeesoptionsfeaturesprecisionMode
exceptions)deep_extendsuperr   describesafe_market_structureparse_numberr   r   r   r   r   )self	__class__s    R/var/www/html/turnos/venv/lib/python3.12/site-packages/ccxt/async_support/bit2c.pyr   zbit2c.describe   s`
   eT ; =\\\ %\ 	\
 %\ %\ U\ $U\ '\ \ "5\ t\ $U\  \ t\  7!\" 9%#\$ (%\& '\( &u)\* "5+\, +E-\. )%/\0 #E1\2 ,U3\4 '5\6 (7\8 &t9\: (;\< 1%=\> &u?\@ 'A\B (C\D #EE\F *5G\H $UI\J uK\L "5M\N *5O\P +EQ\R )%S\T  U\V !%W\X %eY\Z $U[\\ &u]\^ -e_\` /a\b "5c\d #Ee\f +Eg\h !%i\j "5k\l &um\n +Eo\p  q\r $Us\t +Eu\v %ew\x "4y\z u{\| #E}\~ d\@ !$A\B  C\D 'E\F $UG\H !%I\J *5K\L (M\N %eO\P )%Q\R )%S\T tU\V tW\X "5Y\Z #D[\\  ]\^ !%_\` (a\b )%c\d e\f #Eg\h &ui\j uk\l  %"!&#(!w\| j1 1Z64  !"H  55XQZdity  FK  X]  gm  w{  7|  }55XQZdity  FK  X]  gm  w{  7|  }55XQZdity  FK  X]  gm  w{  7|  } 66iS]gmx}  JP  ]b  lr  |@  8A  B	 !%"&!..w7!..v6 "..s3T5F5Fv5NO!..w79J9J89TU!..w79J9J79ST!..w79J9J89TU!..x8$:K:KF:ST!..x8$:K:KG:TU!..x8$:K:KH:UV!..x8$:K:KF:ST!..y94;L;LW;UV!..y94;L;LW;UV!..y94;L;LW;UV!..y94;L;LW;UV" "..s3T5F5Fw5OP!..w79J9J89TU!..w79J9J69RS!..w79J9J89TU!..x8$:K:KG:TU!..x8$:K:KF:ST!..x8$:K:KH:UV!..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"#%N $%G
  %&+(-,0,1).+06:#(#("'#(	( #($)$)27+0/4#()$, %)&+!$$&%'*/& ',#($)*/	# ',!%#($)*.( $()-"&_0d ##
 ##m:v ' 4G'4 3??O	{I@
 I I	    c                    |d d d}t        | j                  j                               }t        dt	        |            D ]q  }||   }| j                         }| j                  |      }|d   j                         }||v r-| j                  |d|z         |d<   | j                  ||      |d<   |||<   s | j                  |      S )N)info	timestampdatetimer   r   
AVAILABLE_freetotal)
list
currencieskeysrangelenaccountcurrencyuppersafe_stringsafe_balance)	r   responseresultcodesicoder   r   	uppercases	            r   parse_balancezbit2c.parse_balance$  s    

 T__))+,q#e*% 	#A8DllnG}}T*H ,,.IH$"&"2"28\I=U"V#'#3#3Hi#H "F4L	#   ((r   c                    K   | j                          d{    | j                  |       d{   }| j                  |      S 7 .7 w)aP  
        query for balance and get the amount of funds available for trading or funds locked in orders

        https://bit2c.co.il/home/api#balance

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
        N)load_marketsprivateGetAccountBalanceV2r  )r   paramsr   s      r   fetch_balancezbit2c.fetch_balance6  sK      !!!88@@V !!(++Y 	"@s   A	AA	AA	A	Nr   r   c                    K   | j                          d{    | j                  |      }d|d   i}| j                  | j                  ||             d{   }| j	                  ||      S 7 W7 w)a!  
        fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data

        https://bit2c.co.il/home/api#orderb

        :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
        Npairr   )r  marketpublicGetExchangesPairOrderbookextendparse_order_book)r   r   r   r
  r  request	orderbooks          r   fetch_order_bookzbit2c.fetch_order_bookm  sx      !!!V$F4L
 >>t{{7TZ?[\\	$$Y77 	"
 ]"   A2A.A A2A0A20A2tickerr  c                 h   | j                  d |      }| j                  |d      }| j                  |d      }| j                  |d      }| j                  i d|dd dd dd dd d	| j                  |d
      dd d| j                  |d      dd dd dd d|d|dd dd dd d||d |d|      S )Navallr   r   r   highlowbidh	bidVolumeaskl	askVolumevwapopencloselastpreviousClosechanger   average)
baseVolumequoteVolumer   )safe_symbolr   safe_ticker)r   r  r  r   averagePricer*  r&  s          r   parse_tickerzbit2c.parse_ticker  sY   !!$/''5%%fc2
- !
f!
!
 !
 D	!

 4!
 4##FC0!
 !
 4##FC0!
 !
 D!
 D!
 T!
 D!
 T!
 d!
  $!!
" |#!
$ %)!
* + 	r   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://bit2c.co.il/home/api#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  r   )r  r  publicGetExchangesPairTickerr  r/  )r   r   r
  r  r  r   s         r   fetch_tickerzbit2c.fetch_ticker  sx      !!!V$F4L
 ::4;;wPV;WXX  622 	"
 Yr  sincec                   K   | j                          d{    | j                  |      }| j                  d   }d|d   i}|| j                  |      |d<   |||d<   d}|dk(  r*| j	                  | j                  ||             d{   }n)| j                  | j                  ||             d{   }t        |t              rt        |      | j                  ||||      S 7 7 _7 7w)a=  
        get the list of most recent trades for a particular symbol

        https://bit2c.co.il/home/api#transactions
        https://bit2c.co.il/home/api#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>`
        Nr   r  r   dater   r   )r  r  r   parse_to_intpublicGetExchangesPairTradesr   publicGetExchangesPairLasttrades
isinstancestrr   parse_trades)	r   r   r3  r   r
  r  methodr  r   s	            r   fetch_tradeszbit2c.fetch_trades  s      !!!V$12F4L
 "//6GFO$GG77!>>t{{7TZ?[\\H!BB4;;wX^C_``H h$))  65%@@1 	" ]`s4   C.C(A3C.
C*)C.4C,54C.*C.,C.c                 N  K   | j                          d{    | j                  |       d{   }| j                  |di       }t        |j	                               }i }t        dt        |            D ]  }||   }| j                  |      }| j                  ||      }	| j                  |	d      }
| j                  |	d      }| j                  t        j                  |
d            }| j                  t        j                  |d            }|	|||ddd||<    |S 7 
7 w)	a?  
        fetch the trading fees for multiple markets

        https://bit2c.co.il/home/api#balance

        :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
        NFeesr   FeeMakerFeeTaker100T)r   r   r   r   r   r   )r  privateGetAccountBalance
safe_valuer   r   r   r   r,  r   r   r   
string_div)r   r
  r   r   r   r  r  marketIdr   feemakerStringtakerStringr   r   s                 r   fetch_trading_feeszbit2c.fetch_trading_fees  s%     !!!66v>>" x4DIIK q#d)$ 	AAwH%%h/F//$1C**3
;K**3
;K%%g&8&8e&LME%%g&8&8e&LME "!F6N	  K 	">s    D%D D%D#C1D%#D%r   sideamountpricec                   K   | j                          d{    d}| j                  |      }||d   d}	|dk(  r|d| j                  |      z   z  }nW||	d<   | j                  |      }
| j                  |      }| j	                  t        j                  |
|            |	d<   |d	k(  |	d
<    t        | |      | j                  |	|             d{   }| j                  ||      S 7 7 w)a  
        create a trade order

        https://bit2c.co.il/home/api#addo

        :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privatePostOrderAddOrderr   )AmountPairr  MarketPricePriceTotalbuyIsBid)
r  r  
capitalizenumber_to_stringparse_to_numericr   
string_mulgetattrr  parse_order)r   r   r   rK  rL  rM  r
  r<  r  r  amountStringpriceStringr   s                r   create_orderzbit2c.create_order  s      !!!+V$4L
 8mdood&;;;F$GG008L//6K#44W5G5GVa5bcGG $GG.v.t{{7F/KLL&11! 	" Ms"   C*C&B8C*C(C*(C*r   c                    K   d|i}| j                  | j                  ||             d{   }| j                  |      S 7 w)a`  
        cancels an open order

        https://bit2c.co.il/home/api#cancelo

        :param str id: order id
        :param str symbol: Not used by bit2c cancelOrder()
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        r   N)privatePostOrderCancelOrderr  r\  )r   r   r   r
  r  r   s         r   cancel_orderzbit2c.cancel_order%  sK      "
 99$++gv:VWW)) Xs   )AAAc                   K   |t        | j                  dz         | j                          d{    | j                  |      }d|d   i}| j	                  | j                  ||             d{   }| j                  ||d   i       }| j                  |dg       }	| j                  |dg       }
| j                  | j                  |	|
      |||      S 7 7 fw)a  
        fetch all unfilled currently open orders

        https://bit2c.co.il/home/api#geto

        :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 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>`
        Nz- fetchOpenOrders() requires a symbol argumentr  r   r   r  )
r   r   r  r  privateGetOrderMyOrdersr  rD  	safe_listparse_ordersarray_concat)r   r   r3  r   r
  r  r  r   ordersasksbidss              r   fetch_open_orderszbit2c.fetch_open_orders6  s      >#DGG.]$]^^!!!V$F4L
 55dkk'66RSS6$<<vub1~~feR0  !2!24!>uUU 	"
 Ts#   .CCA C1C2A%CCc                    K   | j                          d{    | j                  |      }d|i}| j                  | j                  ||             d{   }| j	                  ||      S 7 T7 w)at  
        fetches information on an order made by the user

        https://bit2c.co.il/home/api#getoid

        :param str id: the order id
        :param str symbol: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        Nr   )r  r  privateGetOrderGetByIdr  r\  )r   r   r   r
  r  r  r   s          r   fetch_orderzbit2c.fetch_orderO  su      !!!V$"
 44T[[&5QRR &11) 	"
 Ss!   A/A+=A/A-A/-A/orderc                 .   d }d}d|v r|d   }d}n|}| j                  |d      }| j                  d |      }| j                  |dd      }|r'| j                  |d      }|dk(  s|d	k(  rd
}	n.|dk(  r)d}	n&| j                  |d      }|dk(  s|dk(  rd
}	n|dk(  rd}	| j                  |d      }
|
dk(  rd}
n|
dk(  rd}
| j                  |d      }|dk(  rd}n|dk(  rd}| j                  |d      }d }d }|r%| j                  |d      }| j                  |d      }n$| j                  |d      }| j                  |d      }| j	                  i d|dd d|d| j                  |      dd d	d |d|
d!d d"d d#|d|d$d d|d%d d&|d'd d d |d d(|      S ))NFNewOrderTr   createdi  status_typer      r$     closedstatusNewOpen	Completed
order_typer   r   1r  r   rU  sellrM  rL  initialAmountclientOrderIdr   r   lastTradeTimestampr   r   postOnlyrK  r   filled	remainingcost)tradesrG  r   r)  )r   r,  safe_integer_productsafe_integer
safe_orderiso8601)r   ro  r  orderUnified
isNewOrderr   r   r   
tempStatusrw  r   rK  rM  rL  r  s                  r   r\  zbit2c.parse_orderp  s   > 
 ,LJ LlD1!!$/--lItL	 **<GJQ*/q!)),AJU"jF&:{*! l;3;DS[D f53;DS[D  w7	%%lH=F((x@I%%lODF((x@I  
" 
T 
  
 Y/	 

 !$ 
 f 
 f 
 D 
 4 
  
 D 
 U 
 D 
 f 
 d 
  ! 
" D# 
$ + 
, - 	r   c                   K   | j                          d{    d}i }|||d<   ||d<   |8| j                  | j                         d      |d<   | j                  |d      |d<   || j                  |      }|d   |d<   | j	                  | j                  ||             d{   }| j                  ||||      S 7 7 w)a  
        fetch all trades made by the user

        https://bit2c.co.il/home/api#orderh

        :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>`
        Ntake.toTimefromTimer   r  )r  yyyymmddmillisecondsr  privateGetOrderOrderHistoryr  r;  )r   r   r3  r   r
  r  r  r   s           r   fetch_my_tradeszbit2c.fetch_my_trades  s      !!!#GFO $d.?.?.A3 GGH"&--s";GJ[[(F$TlGFO99$++gv:VWWN   65%@@g 	" Xs"   CB=BC$B?%C?Cc                 p    d}|j                  d      }t        dt        |            D ]
  }|||   z  } |S )N ,r   )splitr   r   )r   r:  	newStringstrPartsr  s        r   remove_comma_from_valuezbit2c.remove_comma_from_value  sB    	99S>q#h-( 	%A!$I	%r   tradec                 f   d }d }d }d }d }| j                  |d      }||}	| j                  |d      }
| j                  |d      }| j                  |      }| j                  |d      }|j                  d      }| j                  |d      }| j	                  ||      }| j	                  |d   |      }| j                  |d      }|rd	nd
}|r|d   n|d   }| j                  |d      }|dk(  rd}nd}| j                  |d      }|i|dd}nc| j                  |d      }
| j                  |d      }	| j                  |d      }| j                  |d      }| j                  |d      }||rd}nd}| j	                  d |      }| j                  ||	|
| j                  |
      |d   |d ||||d |d|      S )N	referenceticksrM  firstAmount|r  r   isMakerr   r      rt  actionrU  r}  	feeAmountr   )r  r   r5  tidrL  isBidr   )r   r   r   r   r   ro  r   rK  takerOrMakerrM  rL  r  rG  )	r   safe_timestampr  r  safe_marketrD  r  
safe_trader  )r   r  r  rM  rL  orderIdrG  makerOrTakerr  r   r   reference_partsrF  r  r  rK  feeCosts                    r   parse_tradezbit2c.parse_trade"  s   F $$UK8	 B++E7;I$$UG4E007E%%e];F'ooc2O''v6H%%h7F%%oa&8&AFooeY7G&-77L,3oa(9KG&&uh7F{&&uk:G"# %
 ++E6:I!!%/B$$UG4E%%eX6F??5'2D D!D!!$/"Y/X&( 
  	r   c                     |dk(  S )Nr    )r   r  s     r   is_fiatzbit2c.is_fiat  s    u}r   r  c                 :  K   | j                          d{    | j                  |      }| j                  |      rt        | j                  dz         d|d   i}| j                  | j                  ||             d{   }| j                  ||      S 7 7 w)ae  
        fetch the deposit address for a currency associated with self account

        https://bit2c.co.il/home/api#addc

        :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>`
        Nz7 fetchDepositAddress() does not support fiat currenciesCoinr   )r  r   r  r   r   #privatePostFundsAddCoinFundsRequestr  parse_deposit_address)r   r  r
  r   r  r   s         r   fetch_deposit_addresszbit2c.fetch_deposit_address  s      !!!==&<<tww)bbccHTN
 AA$++gW]B^__ ))(H== 	" `s"   BBA)B BBBr   c                 |    | j                  |d      }| j                  |       | j                  d |      }||d |d dS )Naddress)r   r   networkr  tag)r   check_addresssafe_currency_code)r   depositAddressr   r  r  s        r   r  zbit2c.parse_deposit_address  sO     "">9=7#&&tX6"
 	
r   c                 "    | j                         S N)r  )r   s    r   noncezbit2c.nonce  s      ""r   r   GETc                    | j                   d   d   dz   | j                  ||      z   }|dk(  r|dz  }n| j                          | j                         }| j	                  d|i|      }	| j                  |	      }
|dk(  r|	r|d|
z   z  }n|
}| j                  | j                  |
      | j                  | j                        t        j                  d	      }d
| j                  |d}||||dS )Nr   r   /r   z.jsonr  r  ?base64z!application/x-www-form-urlencoded)zContent-Typekeysign)urlr<  bodyheaders)r   implode_paramscheck_required_credentialsr  r  	urlencodehmacencodesecrethashlibsha512apiKey)r   pathr   r<  r
  r  r  r  r  queryauth	signatures               r   r  z
bit2c.sign  s    iiv&,t/B/B4/PP(?7NC++-JJLEKK!E >>%(D3:%C		$++d"3T[[5Mw~~_ghI C{{!G
 fdwOOr   httpCodereasonr  r<  r  r  c
                    |y | j                  |d      }
|
| j                  |d      }
|
]| j                  dz   |z   }| j                  | j                  d   |
|       | j	                  | j                  d   |
|       t        |      y )NerrorError r   r   )r   r   throw_exactly_matched_exceptionr   throw_broadly_matched_exceptionr   )r   r  r  r  r<  r  r  r   requestHeadersrequestBodyr  feedbacks               r   handle_errorszbit2c.handle_errors  s       73=$$Xw7Eww}t+H001I5RZ[001I5RZ[))r   r  ).__name__
__module____qualname__r   r   r   r  r  r:  r	   r   r  dictr
   r   r/  r2  r   r   r=  r   rJ  r   r   floatr   r_  r   rb  r   rk  rn  r\  r  r  r  r  r   r  r   r  r  r  intr  __classcell__)r   s   @r   r   r      sa   J# JX) )$ *, 5, 5,n @DB 8S 8 8S\ 8&4  6 8 68 3 3F 3$ <@d[] %A %AS %A %Abfglbm %AN /1 .[ .` mqy{ 2 2I 2Y 2X] 2fi 2@ 9=R *S *# *" 59tZ^gi Vc V VTW Vnrsxny V2 8<B 2C 2 2Bh hv h hT 37TX\eg ?AC ?As ?ARU ?AB\ \v \ \| =? > >> >4
h 
R` 
$# &eBSW P0c 3 S # X\ dg r   r   )$ ccxt.async_support.base.exchanger   ccxt.abstract.bit2cr   r  ccxt.base.typesr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   typingr   ccxt.base.errorsr   r   r   r   r   r   r   ccxt.base.decimal_to_precisionr   ccxt.base.preciser   r   r  r   r   <module>r     s\    6 +  _  _  _  _  _  * 0 - . * ) ) 4 %DHk Dr   