
    E#i                        S SK Jr  S SKJr  S SKrS SKrS SKrS SKJrJ	r	J
r
JrJrJrJrJrJrJrJrJrJrJr  S SKJr  S SKJr  S SKJr  S SKJr  S S	KJr  S S
KJr  S SKJr  S SKJr  S SKJ r   S SK!J"r"  S SK#J$r$   " S S\\5      r%g)    )Exchange)ImplicitAPIN)AnyBalancesIntMarketNumOrder	OrderBook	OrderSide	OrderTypeStrStringsTickerTickersTrade)List)ExchangeError)AuthenticationError)PermissionDenied)InsufficientFunds)InvalidOrder)OrderNotFound)DDoSProtection)InvalidNonce)	TICK_SIZE)Precisec                   z  ^  \ rS rSrS\4U 4S jjr0 4S\\   4S jjrS\	S\4S jr
S\4S jr0 4S\4S jjrS	0 4S
\S\S\4S jjrS2S\	S\S\4S jjr0 4S
\S\4S jjrS	0 4S\S\4S jjrS2S\	S\S\4S jjrS	S	0 4S
\S\S\S\\   4S jjrS	0 4S
\S\S\S\S\4
S jjrS	0 4S\S
\ 4S jjr!S\ 4S jr"S2S\	S\S\#4S  jjr$S	0 4S\S
\ 4S! jjr%S	S	S	0 4S
\ S\S\4S" jjr&S	S	S	0 4S
\ S\S\S\\#   4S# jjr'S	S	S	0 4S
\ S\S\S\\#   4S$ jjr(S% r)S&S'0 S	S	4S( jr*S)\+S*\S+\S,\S-\	S.\4S/ jr,S&S'0 S	S	0 4S0 jr-S1r.U =r/$ )3btcbox   returnc                   > U R                  [        [        U ]  5       SSS/SSS0 SS _SS	_S
S_SS_SS_SS_SS_SS_SS_SS_SS	_SS_SS_SS	_SS_SS_SS_0 SS_SS	_SS_SS_SS_SS_SS_S S_S!S_S"S_S#S_S$S_S%S_S&S_S'S_S(S_S)S_E0 S*S_S+S_S,S_S-S_S.S_S/S_S0S_S1S_S2S_S3S_S4S_S5S_S6S_S7S_S8S_S9S_S:S_E0 S;S_S<S_S=S_S>S_S?S_S@S	_SAS_SBS_SCS	_SDS	_SES	_SFS_SGS_SHS_SIS_SJS_SKS_E0 SLS_SMS_SNS_SOS	_SPS	_SQS	_SRS_SSS_STS_SUS_SVS_SWS_SXS_SYS_SZS_S[S_S\S_ESSSSSS].ES^S_S`0SaSbScSd.Se/ SfQ0Sg/ ShQ0SeSi/0Sj.S	SkSl.SmSn.SSSS SSSS SSSSSo.SSSSSSSSp.S S SSSS	Sq.SSrSSS	Ss.SSrS S SSS	St.S S Su.	S S Sv.S S Sv.Sw.[        [
        [        [        [        [        [        [        [        [        [        Sx.
Sy.5      $ )zNr   BtcBoxJPi  v1FCORSspotTmarginswapfutureoption	addMarginborrowCrossMarginborrowIsolatedMarginborrowMargincancelOrdercloseAllPositionsclosePositioncreateOrder$createOrderWithTakeProfitAndStopLoss&createOrderWithTakeProfitAndStopLossWscreatePostOnlyOrdercreateReduceOnlyOrderfetchBalancefetchBorrowInterestfetchBorrowRatefetchBorrowRateHistoriesfetchBorrowRateHistoryfetchBorrowRatesfetchBorrowRatesPerSymbolfetchCrossBorrowRatefetchCrossBorrowRatesfetchCurrencies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fetchOpenInterestfetchOpenInterestHistoryfetchOpenInterestsfetchOpenOrdersfetchOptionfetchOptionChain
fetchOrderfetchOrderBookfetchOrdersfetchPositionfetchPositionHistoryfetchPositionModefetchPositionsfetchPositionsForSymbolfetchPositionsHistoryfetchPositionsRiskfetchPremiumIndexOHLCVfetchSettlementHistoryfetchTickerfetchTickersfetchTradesfetchTransferfetchTransfersfetchVolatilityHistoryfetchWithdrawalfetchWithdrawalsreduceMarginrepayCrossMarginrepayIsolatedMarginrepayMarginsetLeverage	setMargin)setMarginModesetPositionModetransferwithdrawwszOhttps://github.com/user-attachments/assets/1e2cb499-8d0f-4f8f-9464-3c015cfbc76brestzhttps://www.btcbox.co.jp/apizhttps://www.btcbox.co.jp/z'https://blog.btcbox.jp/en/archives/8762zMhttps://support.btcbox.co.jp/hc/en-us/articles/360001235694-Fees-introduction)logoapiwwwdocfeesget)depthorderstickertickerspost)balance	trade_addtrade_cancel
trade_list
trade_viewwalletzajax/coin/coinInfo)publicprivatewebApi   )webApiEnablewebApiRetriesz0.0001)fetchMarketsamountPrecision)IOCFOKPOGTD)
marginModetriggerPricetriggerPriceTypetriggerDirectionstopLossPricetakeProfitPriceattachedStopLossTakeProfittimeInForcehedgedleveragemarketBuyRequiresPricemarketBuyByCostselfTradePreventiontrailingiceberg)r   triggerr   symbolRequiredd   )r   limitr   r   r   )r   r   daysBack	untilDaysr   r   r   )	sandboxr3   createOrdersfetchMyTradesra   r^   rc   fetchClosedOrders
fetchOHLCV)linearinverse)r'   r)   r*   )
104105106107200201202203401402)idname	countries	rateLimitversionprohasurlsr   optionsfeaturesprecisionMode
exceptions)deep_extendsuperr   describer   r   r   r   r   r   r   r   )self	__class__s    S/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/async_support/btcbox.pyr   btcbox.describe   sp   fd < >[[[ %[ 	[
 %[ %[ U[ $U[ '[ [ t[ $U[  [ t[ 7[  9%![" &u#[$ (%[& '[( &u)[* "5+[, +E-[. )%/[0 #E1[2 ,U3[4 '5[6 (7[8 "59[: &u;[< '=[> (?[@ #EA[B *5C[D $UE[F uG[H "5I[J *5K[L +EM[N )%O[P  Q[R !%S[T %eU[V $UW[X &uY[Z -e[[\ /][^ "5_[` #Ea[b +Ec[d !%e[f "5g[h &ui[j +Ek[l $Um[n +Eo[p %eq[r "4s[t uu[v #Ew[x dy[z !${[| t}[~  [@ 'A[B $UC[D !%E[F *5G[H (I[J %eK[L )%M[N )%O[P tQ[R S[T tU[V  W[X !%Y[Z )%[[\ "5][^ #E_[` a[b #Ec[d &ue[f ug[h ui[j Uk[l "'#(!!u[z j: 3@g    	 ,'6 %)%&! $,  %&+(-,0,1).+06:#(#("'#(	( #($)27+0/4$)#()$, %)%)&+#($)*.	# ',!$#($)*.( ',!$$(%)#($)*.$ *."&c2h ##
 ##q<z '*'##(##$$%UVA
 V V	    c                   #    U R                  5       nU R                  SSS5      n[        R                  " X#/6 I Sh  vN u  pEU R	                  US0 5      n[        UR                  5       5      n/ n[        S[        U5      5       GHn  n	Xy   n
U
R                  S5      nU R                  US5      nU R                  US5      nUR                  5       nUR                  5       nXJ   nUS	-   U-   nUS
:X  a  U R                  S5      OU R                  S5      nU R	                  Xo0 5      nU R	                  US0 5      nUR                  U R                  0 SU_SS_SU_SU_SU_SU_SU_SS_SS_SS_SS_SS_SS_SS_SS_SU_SU_SSSSSSSSSSS .SSS .SSS .SSS .S!.U R                  U R                  U R                  US"5      5      5      SS#.U R                  US$5      S%:H  SUS&.E5      5        GMq     U$  GN7f)'z
retrieves data on all markets for ace
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: an array of objects representing market data
r   webApiGetAjaxCoinCoinInfoTNdatar   _   /BTCz0.0005z0.0010trader   uppercaseIdsymbolbasebaseIdquotequoteIdsettlesettleIdtyper'   r(   Fr)   r*   r+   takermakerminmaxamountpricecostr   pricedecimalr   r   enable1)contractr   r   contractSizeexpiryexpiryDatetimestrike
optionTypelimits	precisionactivecreatedinfo)publicGetTickersfetch_web_endpointasynciogather	safe_dictlistkeysrangelensplitsafe_stringlowerparse_numberappendsafe_market_structureparse_precision)r   paramspromise1promise2	response1	response2result2Data	marketIdsmarketsimarketIdsymbolPartsbaseCurrr   r   r   resr   feedetailstradeDetailss                        r   fetch_marketsbtcbox.fetch_markets   s     ((***>;VX\]%,^^h5I%JJ	nnY;)*	q#i.)A |H"..-K''Q7H$$[!4EkkmG!B%C^e+F24+$##H-DDUDUV^D_Cnn[b9G>>'7B?LNN455 37b37t37 &37 	37
 "37 37 737 $37 D37 37 37 %37 37 %37 %37  !37" #37$ " $"&"  $#
  $#
  $#
  $#!& "..t/C/CDDTDTUacqDr/st" **<BcIe37 3 3 *@ K  Ks   ;G?G<F?G?marketc                 d   U R                  US5      nU R                  U5      nU R                  US5      nU R                  U5      nUS-   U-   n0 SU R                  US5      _SS _SU_SU_SU_SU_SU_S	S _S
S _SS_SS_SS_SS_SS_SS_SS_SS _S S S S S S U R                  US5      U R                  US5      S.S S S.S S S.S S S.S.U R                  U R	                  U R                  US5      5      5      U R                  U R	                  U R                  US5      5      5      S.S S US.E$ )Nr   r   r   r   r   r   r   r   r   r   r   r'   Tr(   Fr)   r*   r+   r   r   minLimitBaseAmountmaxLimitBaseAmountr   r   quotePrecisionbasePrecisionr   )r   r   r   r   r   r   r   r   r   r   r   )r  safe_currency_codesafe_numberr  r  )r   r#  r   r   r   r   r   s          r   parse_marketbtcbox.parse_marketC  s   !!&&1&&v.""673''0e#1
$""6841
41
 f1
 D	1

 f1
 U1
 w1
 d1
 1
 F1
 D1
 e1
 E1
 e1
 e1
  !1
" d#1
$  "  ++F4HI++F4HI
  
  
  & **4+?+?@P@PQWYi@j+kl++D,@,@AQAQRXZiAj,kl a1
 1	
r   c                 x   SU0n[        U R                  R                  5       5      n[        S[	        U5      5       Hj  nX4   nU R                  U5      nUS   nUS-   nX;   d  M)  U R                  5       n	US-   n
U R                  X5      U	S'   U R                  X5      U	S'   XU'   Ml     U R                  U5      $ )Nr   r   r   _balance_lockfreeused)	r  
currenciesr  r  r	  currencyaccountr  safe_balance)r   responseresultcodesr  coder3  
currencyIdr0  r4  r1  s              r   parse_balancebtcbox.parse_balance|  s    )T__))+,q#e*%A8D}}T*H!$J
*D,,.!G+"&"2"28"B"&"2"28"B&t &   ((r   c                    #    U R                  5       I Sh  vN   U R                  U5      I Sh  vN nU R                  U5      $  N. N7f)a1  
query for balance and get the amount of funds available for trading or funds locked in orders

https://blog.btcbox.jp/en/archives/8762#toc13

: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privatePostBalancer;  )r   r  r6  s      r   fetch_balancebtcbox.fetch_balance  sE      !!!0088!!(++ 	"8   A	AA	AA	A	Nr   r   c                 &  #    U R                  5       I Sh  vN   U R                  U5      n0 n[        U R                  5      nUS:  a  US   US'   U R	                  U R                  XS5      5      I Sh  vN nU R                  XtS   5      $  Nv N7f)a  
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data

https://blog.btcbox.jp/en/archives/8762#toc6

: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   r   coinr   )r>  r#  r	  symbolspublicGetDepthextendparse_order_book)r   r   r   r  r#  request
numSymbolsr6  s           r   fetch_order_bookbtcbox.fetch_order_book  s      !!!V$&
>$X.GFO,,T[[-IJJ$$Xh/?@@ 	" Ks"   BBAB4B5BBr   c                    U R                  S U5      nU R                  US5      nU R                  0 SU_SS _SS _SU R                  US5      _SU R                  US5      _SU R                  US5      _S	S _S
U R                  US5      _SS _SS _SS _SU_SU_SS _SS _SS _SS _U R                  US5      U R                  US5      US.EU5      $ )Nlastr   	timestampdatetimehighlowbidbuy	bidVolumeasksell	askVolumevwapopenclosepreviousClosechange
percentageaveragevolvolume)
baseVolumequoteVolumer   )safe_symbolr  safe_ticker)r   r   r#  r   rN  s        r   parse_tickerbtcbox.parse_ticker  si   !!$// !
f!
!
 !
 D$$VV4	!

 4##FE2!
 4##FE2!
 !
 4##FF3!
 !
 D!
 D!
 T!
 D!
 T!
 d!
  $!!
" t#!
$ **659++FH=)!
* + 	r   c                    #    U R                  5       I Sh  vN   U R                  U5      n0 n[        U R                  5      nUS:  a  US   US'   U R	                  U R                  XB5      5      I Sh  vN nU R                  Xc5      $  Ns N7f)a  
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market

https://blog.btcbox.jp/en/archives/8762#toc5

: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   rD  )r>  r#  r	  rE  publicGetTickerrG  rf  )r   r   r  r#  rI  rJ  r6  s          r   fetch_tickerbtcbox.fetch_ticker  s      !!!V$&
>$X.GFO--dkk'.JKK  22 	" Ls"   BB
AB4B5BBrE  c                    #    U R                  5       I Sh  vN   U R                  U5      I Sh  vN nU R                  X15      $  N. N7f)a  
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
:param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
N)r>  r  parse_tickers)r   rE  r  r6  s       r   fetch_tickersbtcbox.fetch_tickers  sE      !!!..v66!!(44 	"6rB  r   c                 B   U R                  US5      nU R                  S U5      nU R                  US5      nU R                  US5      nU R                  US5      nS nU R                  US5      nU R                  UUS UU R	                  U5      US   UUS UUS S S.U5      $ )Ndatetidr   r   r   r   )r   r   orderrO  rP  r   r   sidetakerOrMakerr   r   r   r  )safe_timestampsafe_marketr  
safe_tradeiso8601)	r   r   r#  rO  r   priceStringamountStringr   rt  s	            r   parse_tradebtcbox.parse_trade  s     ''v6	!!$/eU+&&ug6''x8v."Y/X&  " 
  	r   sincec                 "  #    U R                  5       I Sh  vN   U R                  U5      n0 n[        U R                  5      nUS:  a  US   US'   U R	                  U R                  Xd5      5      I Sh  vN nU R                  XX#5      $  Nt N7f)a  
get the list of most recent trades for a particular symbol

https://blog.btcbox.jp/en/archives/8762#toc7

: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   rD  )r>  r#  r	  rE  publicGetOrdersrG  parse_trades)	r   r   r~  r   r  r#  rI  rJ  r6  s	            r   fetch_tradesbtcbox.fetch_trades  s      !!!V$&
>$X.GFO--dkk'.JKK   5@@% 	" Ls"   BBAB4B5BBr   rt  r   r   c                    #    U R                  5       I Sh  vN   U R                  U5      nUUUUS   S.nU R                  U R                  X5      5      I Sh  vN n	U R	                  X5      $  NX N7f)aG  
create a trade order

https://blog.btcbox.jp/en/archives/8762#toc18

: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>`
Nr   )r   r   r   rD  )r>  r#  privatePostTradeAddrG  parse_order)
r   r   r   rt  r   r   r  r#  rI  r6  s
             r   create_orderbtcbox.create_order(  s{      !!!V$8$	
 11$++g2NOO 11 	" Ps"   A3A/AA3A1A31A3r   c                    #    U R                  5       I Sh  vN   Uc  SnU R                  U5      nUUS   S.nU R                  U R                  XS5      5      I Sh  vN nU R	                  Xd5      $  N[ N7f)aD  
cancels an open order

https://blog.btcbox.jp/en/archives/8762#toc17

:param str id: order id
:param str symbol: unified symbol of the market the order was made in
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
NBTC/JPYr   r   rD  )r>  r#  privatePostTradeCancelrG  r  r   r   r   r  r#  rI  r6  s          r   cancel_orderbtcbox.cancel_orderG  s      !!!>FV$8$
 44T[[5QRR 11 	" Ss"   A6A2AA6A4A64A6statusc                 6    SSSSSS.nU R                  X!U5      $ )NrZ  closedcanceled)partall	cancelledr  no)r  )r   r  statusess      r   parse_order_statusbtcbox.parse_order_statusa  s/     #
 &99r   rs  c                 z   U R                  US5      nU R                  US5      nS nUb  U R                  US   S-   5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  U R                  US5      5      n	U	c  [        R                  " US5      (       a  S	n	S n
U R                  S U5      nU R                  US
5      nU R                  0 SU_SS _SU_SU R                  U5      _SS _SU_SU_SS _SU_S
S _SS _SS _SU	_SUS   _SU_SS _SS _U
S US S.EU5      $ )Nr   rP  z+09:00amount_originalamount_outstandingr   r  0r  r   clientOrderIdrO  lastTradeTimestampr   	remainingfilledrt  r   postOnlyr   r   r   )tradesr  r   r_  )r  	parse8601r  r   string_equalsrw  
safe_orderry  )r   rs  r#  r   datetimeStringrO  r   r  r   r  r  rt  s               r   r  btcbox.parse_orderl  s    eT*))%<	%uZ'88'CDI!!%):;$$U,@A	  0(()9)9%)JK>$$Y44!!!$/v.  
" 
T 
  
 Y/	 

 !$ 
 f 
  
 d 
 D 
 D 
 4 
  
 f 
 fX& 
 U 
  D! 
" D# 
$ + 
, - 	r   c                   #    U R                  5       I Sh  vN   Uc  SnU R                  U5      nU R                  UUS   S.U5      nU R                  U R                  XS5      5      I Sh  vN nU R	                  Xd5      $  Nk N7f)ac  
fetches information on an order made by the user

https://blog.btcbox.jp/en/archives/8762#toc16

:param str id: the order id
:param str symbol: unified symbol of the market the order was made in
: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  )r>  r#  rG  privatePostTradeViewr  r  s          r   fetch_orderbtcbox.fetch_order  s      !!!>FV$++8$
  224;;w3OPP 11- 	" Qs"   BBAB,B-BBc                 >  #    U R                  5       I S h  vN   U R                  U5      nUUS   S.nU R                  U R                  Xu5      5      I S h  vN nU R	                  XX45      n	US:X  a#  [        S[        U	5      5       H
  n
SX   S'   M     U	$  N NC7f)Nr   )r   rD  rZ  r   r  )r>  r#  privatePostTradeListrG  parse_ordersr  r	  )r   r   r   r~  r   r  r#  rI  r6  r   r  s              r   fetch_orders_by_typebtcbox.fetch_orders_by_type  s     !!!V$8$
 224;;w3OPP ""8UB 6>1c&k*&,	(# +5 	" Qs#   BBA BBABBc                 D   #    U R                  SXX45      I Sh  vN $  N7f)a  
fetches information on multiple orders made by the user

https://blog.btcbox.jp/en/archives/8762#toc15

: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>`
r  Nr  r   r   r~  r   r  s        r   fetch_ordersbtcbox.fetch_orders  s"      ..ufUSSSS     c                 D   #    U R                  SXX45      I Sh  vN $  N7f)a  
fetch all unfilled currently open orders

https://blog.btcbox.jp/en/archives/8762#toc15

: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>`
rZ  Nr  r  s        r   fetch_open_ordersbtcbox.fetch_open_orders  s"      ..vveTTTTr  c                 "    U R                  5       $ N)milliseconds)r   s    r   noncebtcbox.nonce  s      ""r   r   GETc                    U R                   S   S   S-   U R                  -   S-   U-   nUS:X  a  U(       a  USU R                  U5      -   -  nOUS:X  a  U R                   S   S-   U-   nOU R                  5         [	        U R                  5       5      nU R                  U R                  US.U5      n	U R                  U	5      n
U R                  U R                  U R                  5      S	5      nU R                  U R                  U
5      U R                  U5      [        R                  5      U	S
'   U R                  U	5      nSS0nXsXeS.$ )Nr   r   r   r   ?r   r   )keyr  md5	signaturezContent-Typez!application/x-www-form-urlencoded)urlmethodbodyheaders)r   r   	urlencodecheck_required_credentialsstrr  rG  apiKeyhashencodesecrethmachashlibsha256)r   pathr   r  r  r  r  r  r  queryrI  r  s               r   signbtcbox.sign  s2   iiv&,t||;cADH(?sT^^F333H_))E"S(4/C++-

%EKK{{! E nnU+GYYt{{4;;7?F!%4;;w+?VATV]VdVd!eE+>>%(D CG dOOr   httpCodereasonr  r  r  r  c
                     Uc  g US:  a  g U R                  US5      n
U
b  U
SL a  g U R                  US5      nU R                  S-   U-   nU R                  U R                  X5        [	        U5      e)Ni  r7  Tr9   )
safe_valuer   throw_exactly_matched_exceptionr   r   )r   r  r  r  r  r  r  r6  requestHeadersrequestBodyr7  r9  feedbacks                r   handle_errorsbtcbox.handle_errors  st    s?84>Vt^x077S=4',,T__dMH%%r   c           	      $  #    U R                  XX4XVU5      I S h  vN n[        U[        5      (       aX  U R                  U5      nU R	                  U5      (       d  [        U R                  S-   U-   5      e[        R                  " U5      nU$  Ns7f)Nr  )	fetch2
isinstancer  stripis_json_encoded_objectr   r   jsonloads)	r   r  r   r  r  r  r  configr6  s	            r   rI  btcbox.request&  sy     TvVVh$$zz(+H..x88#DGGcMH$<==zz(+H Ws   BBA4B r  )0__name__
__module____qualname____firstlineno__r   r   r   r   r!  dictr+  r   r;  r@  r  r   r   rK  r   rf  rj  r   r   rn  r   r|  r  r   r   floatr	   r  r   r  r  r
   r  r  r  r  r  r  r  intr  rI  __static_attributes____classcell__)r   s   @r   r   r      s   W# Wr *, MV M^7
4 7
F 7
r) )  *, , , @DB AS A AS\ A(4  6 4 68 3 3F 3& 6:" 	57 	5 	5! !v ! !F <@d[] A AS A Abfglbm A@ mqy{ 2 2I 2Y 2X] 2fi 2> 9=R 2S 2# 24	: 	:4 4v 4 4l 8<B !2C !2 !2F >BPTcgpr s # ]` : 04$UYbd T TC Ts Timnsit T 59tZ^gi Uc U UTW Unrsxny U# &eBSW P.&c &3 &S &# &X\ &dg & '/uRQU\`ik  r   r   )& ccxt.async_support.base.exchanger   ccxt.abstract.btcboxr   r  r  r  ccxt.base.typesr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   typingr   ccxt.base.errorsr   r   r   r   r   r   r   r   ccxt.base.decimal_to_precisionr   ccxt.base.preciser   r   r  r   r   <module>r     s_    6 ,    J  J  J  J  * 0 - . ) * + ) 4 %UX{ Ur   