
    !: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    D/var/www/html/turnos/venv/lib/python3.12/site-packages/ccxt/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                 f    | j                          | j                  |      }| j                  |      S )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>`
        )load_marketsprivateGetAccountBalanceV2r  )r   paramsr   s      r   fetch_balancezbit2c.fetch_balance6  s4     	226:V !!(++r   Nr   r   c                     | j                          | j                  |      }d|d   i}| j                  | j                  ||            }| j	                  ||      S )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
        pairr   )r  marketpublicGetExchangesPairOrderbookextendparse_order_book)r   r   r   r
  r  request	orderbooks          r   fetch_order_bookzbit2c.fetch_order_bookm  s^     	V$F4L
 88Wf9UV	$$Y77r   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                     | j                          | j                  |      }d|d   i}| j                  | j                  ||            }| j	                  ||      S )a  
        fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market

        https://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>`
        r  r   )r  r  publicGetExchangesPairTickerr  r.  )r   r   r
  r  r  r   s         r   fetch_tickerzbit2c.fetch_ticker  s^     	V$F4L
 44T[[&5QR  622r   sincec                    | j                          | j                  |      }| j                  d   }d|d   i}|| j                  |      |d<   |||d<   d}|dk(  r"| j	                  | j                  ||            }n!| j                  | j                  ||            }t        |t              rt        |      | j                  ||||      S )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>`
        r   r  r   Ndater   r   )r  r  r   parse_to_intpublicGetExchangesPairTradesr   publicGetExchangesPairLasttrades
isinstancestrr   parse_trades)	r   r   r2  r   r
  r  methodr  r   s	            r   fetch_tradeszbit2c.fetch_trades  s     	V$12F4L
 "//6GFO$GG7788Wf9UVH<<T[[RX=YZH h$))  65%@@r   c                    | j                          | j                  |      }| 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 )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
        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    	008" 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	  r   r   sideamountpricec                    | j                          d}| j                  |      }||d   d}	|dk(  r|d| j                  |      z   z  }nW||	d<   | j                  |      }
| j                  |      }| j	                  t        j                  |
|            |	d<   |dk(  |	d	<    t        | |      | j                  |	|            }| j                  ||      S )
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>`
        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   rJ  rK  rL  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(74(Wf)EF&11r   r   c                 n    d|i}| j                  | j                  ||            }| j                  |      S )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   )privatePostOrderCancelOrderr  r[  )r   r   r   r
  r  r   s         r   cancel_orderzbit2c.cancel_order%  s>     "
 33DKK4PQ))r   c                    |t        | j                  dz         | j                          | j                  |      }d|d   i}| j	                  | j                  ||            }| j                  ||d   i       }| j                  |dg       }	| j                  |dg       }
| j                  | j                  |	|
      |||      S )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>`
        z- fetchOpenOrders() requires a symbol argumentr  r   r  r  )
r   r   r  r  privateGetOrderMyOrdersr  rC  	safe_listparse_ordersarray_concat)r   r   r2  r   r
  r  r  r   ordersasksbidss              r   fetch_open_orderszbit2c.fetch_open_orders6  s     >#DGG.]$]^^V$F4L
 //GV0LM6$<<vub1~~feR0  !2!24!>uUUr   c                     | j                          | j                  |      }d|i}| j                  | j                  ||            }| j	                  ||      S )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>`
        r   )r  r  privateGetOrderGetByIdr  r[  )r   r   r   r
  r  r  r   s          r   fetch_orderzbit2c.fetch_orderO  s\     	V$"
 ..t{{7F/KL &11r   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   rT  sellrL  rK  initialAmountclientOrderIdr   r   lastTradeTimestampr   r   postOnlyrJ  r   filled	remainingcost)tradesrF  r   r(  )r   r+  safe_integer_productsafe_integer
safe_orderiso8601)r   rn  r  orderUnified
isNewOrderr   r   r   
tempStatusrv  r   rJ  rL  rK  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                 V   | j                          d}i }|||d<   ||d<   |8| j                  | j                         d      |d<   | j                  |d      |d<   || j                  |      }|d   |d<   | j	                  | j                  ||            }| j                  ||||      S )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   r2  r   r
  r  r  r   s           r   fetch_my_tradeszbit2c.fetch_my_trades  s     	#GFO $d.?.?.A3 GGH"&--s";GJ[[(F$TlGFO33DKK4PQN   65%@@r   c                 p    d}|j                  d      }t        dt        |            D ]
  }|||   z  } |S )N ,r   )splitr   r   )r   r9  	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ticksrL  firstAmount|r  r   isMakerr   r      rs  actionrT  r|  	feeAmountr   )r  r   r4  tidrK  isBidr   )r   r   r   r   r   rn  r   rJ  takerOrMakerrL  rK  r  rF  )	r   safe_timestampr  r  safe_marketrC  r  
safe_trader  )r   r  r  rL  rK  orderIdrF  makerOrTakerr  r   r   reference_partsrE  r  r  rJ  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                 
   | j                          | j                  |      }| j                  |      rt        | j                  dz         d|d   i}| j                  | j                  ||            }| j                  ||      S )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>`
        z7 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
 ;;DKKQW<XY ))(H==r   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  r9  r	   r   r  dictr
   r   r.  r1  r   r   r<  r   rI  r   r   floatr   r^  r   ra  r   rj  rm  r[  r  r  r  r  r   r  r   r  r  r  intr  __classcell__)r   s   @r   r   r      s[   J# JX) )$ $& 5,( 5,n :>b 8s 83 8Y 8&4  6 8 02 33 3f 3$ 6:UW %A3 %As %A# %A\`af\g %AN )+ .{ .` gksu 23 2i 2y 2RW 2`c 2@ 37r *s *C *" /3TXac V V3 Vc Vhlmrhs V2 26b 2c 23 2Bh hv h hT -1tRV_a ?Ac ?A ?AC ?AB\ \v \ \| 79 ># >^ >4
h 
R` 
$# &eBSW P0c 3 S # X\ dg r   r   )$ccxt.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\    ( +  _  _  _  _  _  * 0 - . * ) ) 4 %DHk Dr   