
    E#iL                    L   S SK Jr  S SKJ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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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
CurrenciesCurrencyDepositAddressIntMarketNumOrder	OrderBookOrderRequest	OrderSide	OrderTypeStrStringsTickerTickersTradeTradingFeeInterfaceTradingFeesTransaction)List)ExchangeError)AuthenticationError)PermissionDenied)AccountSuspended)ArgumentsRequired)
BadRequest)	BadSymbol)InsufficientFunds)InvalidOrder)RateLimitExceeded)ExchangeNotAvailable)OnMaintenance)DECIMAL_PLACES)Precisec                     ^  \ rS rSrS\4U 4S jjr0 4S\4S jjr0 4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0 4S\4S jjrS0 4S\S\S\4S jjrSS0 4S\S\S\S\\   4S jjrSSS0 4S\S\S\S\S\\   4
S jjr0 4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SS0 4S\S\S\S\\   4S jjr SSS0 4S\S\S\S\S\\   4
S jjr!S0 4S\S\"S\#S\$S\%S\4S jjr&0 4S\\'   4S jjr(S0 4S \S\4S! jjr)S0 4S\4S" jjr*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-0 4S&\S\.4S' jjr/SSS0 4S&\S\S\S\\0   4S( jjr1SSS0 4S&\S\S\S\\0   4S) jjr2SSS0 4S&\S\S\S\\0   4S* jjr30 4S+ jr4SS0 4S \S\S\"S\#S\%S\%S\4S, jjr5S0 4S&\S\$S-\S.\S\04
S/ jjr6SSS0 4S&\S\S\4S0 jjr7S1\8S\	4S2 jr9SLS3\8S1\	S\:4S4 jjr;SLS5\8S1\	S\4S6 jjr<SLS1\	S\4S7 jjr=SLS\4S8 jjr>S\4S9 jr?SLS\4S: jjr@SLS;\A4S< jjrBS\4S= jrCSMS;\AS\S\S\04S> jjrDS? rESLS@\8S;\A4SA jjrF/ SB0 SS4SC jrGSD\HSE\SF\SG\SH\8SI\4SJ jrISKrJU =rK$ )Nfoxbit   returnc                 |  > U R                  [        [        U ]  5       0 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_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_S0S_S1S_S2S_S3S_ESSSSSS4.E_S5S6S7S8S9S:S;S<S=S>S?S@SASBSC._SDSESFSFSGSH.SISJ/SK._SL[        _SM0 SN[
        _SO[        _SP[
        _SQ[        _SR[        _SS[        _ST[        _SU[
        _SV[        _SW[        _SX[        _SY[        _SZ[
        _S[[        _S\[        _S][        _S^[
        _[        [        [        [        [        [        [        [        [        [        [        S_.E0 S`._SaSSSb._ScSdSeSeSfSgShShSiSj.0SkSfSkSkSgSlSlSlSfSm.	SkSnSoSlSp.SqSk0Sr.Ss.StSdSuSv000Sw._SxSySdSSU R!                  Sz5      U R!                  S{5      S|.0_S}S0 S~S_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SSSSSS.E0 SS~_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SSSSSS.ES._SS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.SSe0SSSSSS.SSSSSSS.SSSSSSS.SSSSSSSS.SSSSSSSSS.SS0S.	00E5      $ )Nidr*   nameFoxbit	countrieszpt-BR	rateLimitgn@@version1commentzFoxbit Exchange	certifiedFprohasCORSTspotmarginswapfutureoptioncancelAllOrderscancelOrdercreateLimitBuyOrdercreateLimitSellOrdercreateMarketBuyOrdercreateMarketSellOrdercreateOrderfecthOrderBookfetchBalancefetchCanceledOrdersfetchClosedOrdersfetchCurrenciesfetchDepositAddressfetchDepositsfetchL2OrderBookfetchLedgerfetchMarketsfetchMyTrades
fetchOHLCVfetchOpenOrders
fetchOrderfetchOrdersfetchTickerfetchTickersfetchTradesfetchTradingFeefetchTradingFeesfetchTransactions)fetchWithdrawalsloadMarketssandboxwithdrawws
timeframes1m5m15m30m1h2h4h6h12h1d1w2w1M)ra   rb   rc   rd   re   rf   rg   rh   ri   rj   rk   rl   rm   urlszOhttps://github.com/user-attachments/assets/1f8faca2-ae2f-4222-b33e-5671e7d873ddzhttps://api.foxbit.com.brz%https://metadata-v2.foxbit.com.br/api)publicprivatestatuszhttps://app.foxbit.com.brzhttps://docs.foxbit.com.br)logoapiwwwdocprecisionMode
exceptions4004294045002001200220032004200530013002300340014002400340044005)40074008400940114012500150025003500450055006)exactbroadrequiredCredentials)apiKeysecretrs   get   <            )
currenciesmarketszmarkets/ticker/24hrzmarkets/{market}/orderbookzmarkets/{market}/candlestickszmarkets/{market}/trades/historyzmarkets/{market}/ticker/24hr   
   )	accountszaccounts/{symbol}/transactionsorderszorders/by-order-id/{id}tradeszdeposits/addressdepositswithdrawalszme/fees/tradingg      @   )r   zorders/batchzorders/cancel-replacer   zorders/cancel)r   postput)ro   rp   ro   rq      )v3rq   feestradingz0.005z0.0025)feeSide	tierBased
percentagetakermakeroptionsalgorandALGOarbitrumARBITRUMavalanchecchainAVAXbitcoinBTCbitcoincashBCHbscBEP20cardanoADAcosmosATOMdogecoinDOGEerc20ETHhederaHBARlitecoinLTCnearNEARoptimismOPTIMISMpolkadotDOTpolygonMATICrippleXRPSOLSTXXLMXTZTRC20)solanastacksstellartezostrc20r   r   r   r   r   )r   r   r   r   r   )sandboxModenetworksByIdnetworksfeatures)lastmarkindex)GTCFOKIOCPOGTD)expire_makerexpire_takerexpire_bothnone)
marginModetriggerPricetriggerPriceTypetriggerDirectionstopLossPricetakeProfitPriceattachedStopLossTakeProfittimeInForcehedgedleveragemarketBuyByCostmarketBuyRequiresPriceselfTradePreventiontrailingicebergAmountmaxd   Z   i'  )r   limitdaysBack	untilDayssymbolRequired   )r   r  r  triggerr   r  )r   r  r  r  r  r   r  )r   r  r  daysBackCanceledr  r  r   r  r    )	r]   rE   createOrdersrP   rS   rR   rT   rI   rQ   )deep_extendsuperr*   describer'   r    r$   r   r   r   r   r"   r#   r!   r%   r&   parse_number)self	__class__s    E/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/foxbit.pyr  foxbit.describe   s   fd < > uA
(uA
HuA
 'uA
 uA
 suA
 (uA
 uA
 5uA
  ((( $( 	(
 $( $( "4( t( &t( '( '( (( t( !$( (  &t!(" $T#($ "4%(& &t'((  )(* #D+(, t-(. /(0  1(2 d3(4 "45(6 d7(8 t9(: t;(< =(> t?(@ "4A(B #DC(D $TE(F %)#  O(uA
h iuA
F i9:E
 30GuA
^ ^_uA
` : , :	
 = / / / J , , , , J -  L!" I#$ J%& *(,-)0))(((;>A#auA
h "$iuA
p  *+'(35:;=??A<> 
 )*>@&'78&'02(*+-/1
  '(,/56+-	! ,Q % "H $b I+quA
H $!&"&!..w7!..x8IuA
Z $!!
! &v! u	!
 "5! 7! u! f! ! U! f! ! F! 
! !  w!!" e#!$ $#$"$-!0J
 - 9	
 = U 9 H J 7 H : F 
 :  Y!" 8#$ $#$"$-52[uA
@ $&+(,$($)%*-
 -2).+06:#'#'#'"&#(( #($)+027,0,0+/$(	0 %*).=$B q% ',!$$&%**.& ',!"$&#($)*/# ',!$$&#($)*/( '+!$$&%*#($)*/$ '+!$$&,.%*#($)*/	*  #_RTAuA
 u u	    c                    U R                  U5      nU R                  US/ 5      n0 n[        S[        U5      5       GH  nX5   nU R	                  US5      nU R                  US5      nU R                  US5      n	U R                  U5      n
U R                  US5      nU R                  US5      nU R                  US/ 5      nU R                  US	5      n0 n[        S[        U5      5       H  nUU   nU R                  US
5      nU R                  UU
5      nU R                  US5      nU R                  US5      nU R                  US5      S:H  nU R                  US5      S:H  nUUUU R                  US5      UUSUU R                  US5      S S S.U R                  US5      S S.U R                  US5      S S.S.S.
UU'   M     U R                  XJ5      b  GM  U R                  UU
UU	SUU R                  USS5      U R                  USS5      U R                  US5      US S S.U R                  US5      S S.U R                  US5      S S.S.US.5      XJ'   GM!     U$ )Ndatar   	precisionsymbolr/   deposit_infowithdraw_infor   typecoderq   ENABLEDTfeeminr   
min_amount)amountdepositr^   )
infor.   networkr/   r#  r^   activer  r  limitsenabledF)r.   r  r$  r/   r&  r  r#  r^   r  r  r'  r   )v3PublicGetCurrencies	safe_listrangelensafe_integersafe_stringsafe_currency_code	safe_dictsafe_string_lowernetwork_id_to_codesafe_numbersafe_currency_structure	safe_bool)r  paramsresponser  resulticurrencyr  
currencyIdr/   r  depositInfowithdrawInfor   r  parsedNetworksjr%  	networkIdnetworkCodenetworkWithdrawInfonetworkDepositInfoisWithdrawEnabledisDepositEnableds                           r  fetch_currenciesfoxbit.fetch_currenciesU  s   --f5L ~~h3q#d)$AwH))(K@I))(H=J##Hf5D**:6D..>BK>>(ODL~~h
B?H))(F;D#%N1c(m,"1+ ,,Wf=	"55iF&*nnWo&N#%)^^G^%L"$($4$45H($SW`$`!#'#3#34F#QU^#^ $#* ,,Wf=/ 1"!*++,?G $(#'#
 $(#3#3K#N#'$
 $(#3#3L,#O#'%/{+ -B ~~f+3#;;$ $ " #~~k9eL $|Y N++L%@!* $(#'#
 $(#3#3K#N#'$
 $(#3#3L,#O#'% !/3=  [ %P r  c                 l    U R                  U5      nU R                  US/ 5      nU R                  U5      $ )a  
Retrieves data on all markets for foxbit.

https://docs.foxbit.com.br/rest/v3/#tag/Market-Data/operation/MarketsController_index

:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: an array of objects representing market data
r  )v3PublicGetMarketsr*  parse_markets)r  r6  r7  r   s       r  fetch_marketsfoxbit.fetch_markets  s:     **62~ ..626!!'**r  r  c                     U R                  5         U R                  U5      nSUS   0nU R                  U R                  XB5      5      nU R	                  US/ 5      nU R                  US0 5      nU R                  Xs5      $ )a  
Get last 24 hours ticker information, in real-time, for given market.

https://docs.foxbit.com.br/rest/v3/#tag/Market-Data/operation/MarketsController_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>`
marketr.   r  r   )load_marketsrN  "v3PublicGetMarketsMarketTicker24hrextendr*  r0  parse_ticker)r  r  r6  rN  requestr7  r  r8  s           r  fetch_tickerfoxbit.fetch_ticker3  s     	V$fTl
 ::4;;w;WX@ ~~h3a,  00r  Nsymbolsc                     U R                  5         U R                  U5      nU R                  U5      nU R                  US/ 5      nU R	                  XA5      $ )a  
Retrieve the ticker data of all markets.

https://docs.foxbit.com.br/rest/v3/#tag/Market-Data/operation/MarketsController_tickers

: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>`
r  )rO  market_symbolsv3PublicGetMarketsTicker24hrr*  parse_tickers)r  rV  r6  r7  r  s        r  fetch_tickersfoxbit.fetch_tickersf  sU     	%%g.44V<, ~~h3!!$00r  c                 (   U R                  5         U R                  U5      nU R                  US/ 5      n0 n[        S[	        U5      5       HB  nX5   nU R                  US5      nU R                  U5      nUS   n	U R                  Xh5      XI'   MD     U$ )aR  
fetch the trading fees for multiple markets

https://docs.foxbit.com.br/rest/v3/#tag/Member-Info/operation/MembersController_listTradingFees

: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
r  r   market_symbolr  )rO  v3PrivateGetMeFeesTradingr*  r+  r,  r.  safe_marketparse_trading_fee)
r  r6  r7  r  r8  r9  entrymarketIdrN  r  s
             r  fetch_trading_feesfoxbit.fetch_trading_fees  s     	11&9 ~~h3q#d)$AGE''?H%%h/FH%F!33EBFN % r  r  c                     U R                  5         U R                  U5      nSnUS   Uc  UOUS.nU R                  U R                  Xc5      5      nU R	                  US5      nU R                  XqU5      $ )a  
Exports a copy of the order book of a specific market.

https://docs.foxbit.com.br/rest/v3/#tag/Market-Data/operation/MarketsController_findOrderbook

: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, the maximum is 100
: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
   r.   )rN  depth	timestamp)rO  rN  !v3PublicGetMarketsMarketOrderbookrQ  r-  parse_order_book)	r  r  r  r6  rN  defaultLimitrS  r7  ri  s	            r  fetch_order_bookfoxbit.fetch_order_book  s|     	V$Tl&+m\%
 99$++g:VW2 %%h<	$$XyAAr  sincec                     U R                  5         U R                  U5      nSUS   0nUb  X6S'   US:  a  SUS'   U R                  U R                  Xd5      5      nU R	                  US/ 5      nU R                  XX#5      $ )a  
Retrieve the trades of a specific market.

https://docs.foxbit.com.br/rest/v3/#tag/Market-Data/operation/MarketsController_publicTrades

: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>`
rN  r.   	page_size   r  )rO  rN  %v3PublicGetMarketsMarketTradesHistoryrQ  r*  parse_trades	r  r  ro  r  r6  rN  rS  r7  r  s	            r  fetch_tradesfoxbit.fetch_trades  s     	V$fTl
 #(K s{'*$ ==dkk'>Z[~~h3  u<<r  ra   	timeframec                 D   U R                  5         U R                  U5      nU R                  U R                  X"5      nUS   US.nUb  U R	                  U5      US'   Ub  XHS'   US:  a  SUS'   U R                  U R                  X5      5      n	U R                  XXsU5      $ )as  
Fetch historical candlestick data containing the open, high, low, and close price, and the volume of a market.

https://docs.foxbit.com.br/rest/v3/#tag/Market-Data/operation/MarketsController_findCandlesticks

: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
r.   )rN  interval
start_timer  r
  )rO  rN  r.  r`   iso8601$v3PublicGetMarketsMarketCandlesticksrQ  parse_ohlcvs)
r  r  rx  ro  r  r6  rN  rz  rS  r7  s
             r  fetch_ohlcvfoxbit.fetch_ohlcv  s     	V$##DOOYJTl 
 $(LL$7GL!$Gs{#& <<T[[=YZ    8EJJr  c                    U R                  5         U R                  U5      nU R                  US/ 5      nSU0n[        S[	        U5      5       Hj  nX5   nU R                  US5      nU R                  U5      nU R                  US5      n	U R                  US5      n
U R                  US5      nUU
U	S.nXU'   Ml     U R                  U5      $ )	aU  
Query for balance and get the amount of funds available for trading or funds locked in orders.

https://docs.foxbit.com.br/rest/v3/#tag/Account/operation/AccountsController_all

:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
r  r$  r   currency_symbolbalancebalance_lockedbalance_available)freeusedtotal)rO  v3PrivateGetAccountsr*  r+  r,  r.  r/  safe_balance)r  r6  r7  r   r8  r9  accountr;  currencyCoder  r  r  
balanceObjs                r  fetch_balancefoxbit.fetch_balance#  s     	,,V4 >>(FB7H
 q#h-(AkG))'3DEJ22:>L$$Wi8E##G-=>D##G-@ADJ
 $.<  )   ((r  c                 (    U R                  SXX45      $ )a  
Fetch all unfilled currently open orders.

https://docs.foxbit.com.br/rest/v3/#tag/Trading/operation/OrdersController_listOrders

: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>`
ACTIVEfetch_orders_by_statusr  r  ro  r  r6  s        r  fetch_open_ordersfoxbit.fetch_open_ordersK       **8VERRr  c                 (    U R                  SXX45      $ )a  
Fetch all currently closed orders.

https://docs.foxbit.com.br/rest/v3/#tag/Trading/operation/OrdersController_listOrders

: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>`
FILLEDr  r  s        r  fetch_closed_ordersfoxbit.fetch_closed_ordersY  r  r  c                 (    U R                  SXX45      $ )NCANCELEDr  r  s        r  fetch_canceled_ordersfoxbit.fetch_canceled_ordersg  s    **:veTTr  rq   c                 @   U R                  5         S nSU0nUb  U R                  U5      nUS   US'   Ub  U R                  U5      US'   Ub  XGS'   US:  a  SUS'   U R                  U R	                  Xu5      5      nU R                  US/ 5      n	U R                  U	5      $ )Nstater.   r^  r{  rq  r  r  rO  rN  r|  v3PrivateGetOrdersrQ  r*  parse_orders)
r  rq   r  ro  r  r6  rN  rS  r7  r  s
             r  r  foxbit.fetch_orders_by_statusj  s    V
 [[(F'-d|GO$$(LL$7GL!#(K s{'*$**4;;w+GH~~h3  &&r  r  sider"  pricec                 d   U R                  5         U R                  U5      nUR                  5       nUS:w  a)  US:w  a#  US:w  a  US:w  a  US:w  a  [        SU-   S-   5      eU R	                  US5      nU R                  US	S
5      n	U R                  US5      n
US   UR                  5       US.nUS:X  d  US:X  a  U
c  [        SU-   S-   5      eUb  US:X  a  SUS'   OXS'   U	(       a  SUS'   U
b  U R                  X5      US'   US:X  a  U R                  X5      US'   OU R                  X5      US'   US:X  d  US:X  a  U R                  X5      US'   U R                  US5      nUb  XS'   U R                  U/ SQ5      nU R                  U R                  X5      5      nU R                  X5      $ )a  
Create an order with the specified characteristics

https://docs.foxbit.com.br/rest/v3/#tag/Trading/operation/OrdersController_create

:param str symbol: unified symbol of the market to create an order in
:param str type: 'market', 'limit', 'stop_market', 'stop_limit', 'instant'
:param str side: 'buy' or 'sell'
:param float amount: how much you want to trade in units of the 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
:param str [params.timeInForce]: "GTC", "FOK", "IOC", "PO"
:param float [params.triggerPrice]: The time in force for the order. One of GTC, FOK, IOC, PO. See .features or foxbit's doc to see more details.
:param bool [params.postOnly]: True or False whether the order is post-only
:param str [params.clientOrderId]: a unique identifier for the order
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
LIMITMARKETSTOP_MARKET
STOP_LIMITINSTANTInvalid order type: B. Must be one of: limit, market, stop_market, stop_limit, instant.r   postOnlyFr   r.   r^  r  r  . Must have triggerPrice.r   T	post_onlytime_in_force
stop_pricer"  quantityr  clientOrderIdclient_order_id)r   r  r   r  )rO  rN  upperr#   safe_string_upperr5  r3  price_to_precisionamount_to_precisionr.  omitv3PrivatePostOrdersrQ  parse_order)r  r  r  r  r"  r  r6  rN  r   r  r   rS  r  r7  s                 r  create_orderfoxbit.create_order}  s   $ 	V$zz|7?tx/DM4IdVbNbgkoxgx5<  @D   D  E  E,,V]C>>&*e<''?#D\JJL

 = DL$8#"#9D#@C^#^__"d"'+$+6(#'GK #$($;$;F$QGL!9 $ 7 7 GGH"&":":6"JGJ7?dl2#66vEGG((A$)6%&6#_`++DKK,HI 11r  r   c                    U R                  5         / n[        S[        U5      5       GH  nU R                  X5      nU R	                  US5      nU R                  U5      nU R                  US5      nU R                  US0 5      n	US:w  a)  US:w  a#  US:w  a  US:w  a  US	:w  a  [        S
U-   S-   5      eU R                  U	S5      n
U R                  U	SS5      nU R                  U	S5      nUS   U R                  US5      US.nUS:X  d  US:X  a  Uc  [        S
U-   S-   5      eU
b  U
S:X  a  SUS'   OXS'   U	S	 U(       a  SUS'   U	S	 Ub  U R                  Xl5      US'   U	S	 US	:X  a%  U R                  X`R	                  US5      5      US'   O$U R                  X`R	                  US5      5      US'   US:X  d  US:X  a$  U R                  X`R	                  US5      5      US'   UR                  U R                  X5      5        GM     SU0nU R                  U R                  X5      5      nU R                  US/ 5      nU R!                  U5      $ )a  
create a list of trade orders

https://docs.foxbit.com.br/rest/v3/#tag/Trading/operation/createBatch

:param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
: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  r6  r  r  r  r  r  r  r  r   r  Fr   r.   r  r  r  r   Tr  r  r  r"  r  r  r  )rO  r+  r,  r0  r.  rN  r  r#   r5  r3  r  r  appendrQ  v3PrivatePostOrdersBatchr*  r  )r  r   r6  ordersRequestsr9  orderr  rN  r  orderParamsr   r  r   rS  createOrdersRequestr7  r  s                    r  create_ordersfoxbit.create_orders  s    	q#f+&ANN6-E%%eX6F[[(F))%8D.."=Kw48#38MRVZfRfkos|k|"#9D#@  DH  $H  I  I00mLK~~k:uEH++KHL!'..uf=G
 }$(<'&'='DGb'bcc&$&+/GK(/:O,.'+$
+'(,(?(?(U%/y $($;$;FDTDTUZ\dDe$f!&*&>&>vGWGWX]_gGh&i
#w$,"6#'#:#:6CSCSTY[bCc#d !!$++g"CDK 'L  &~600=P1YZ  ~~h3  &&r  r.   c                     U R                  5         U R                  U5      SS.nU R                  U R                  XC5      5      nU R	                  US/ 5      nU R                  US0 5      nU R                  U5      $ )af  
Cancel open orders.

https://docs.foxbit.com.br/rest/v3/#tag/Trading/operation/OrdersController_cancel

: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>`
ID)r.   r  r  r   )rO  r  v3PrivatePutOrdersCancelrQ  r*  r0  r  )r  r.   r  r6  rS  r7  r  r8  s           r  cancel_orderfoxbit.cancel_order   sz     	##B'
 00W1MN ~~h3a,''r  c                     U R                  5         SS0nUb  U R                  U5      nSUS'   US   US'   U R                  U R                  X25      5      nU R	                  SU05      /$ )a  
Cancel all open orders or all open orders for a specific market.

https://docs.foxbit.com.br/rest/v3/#tag/Trading/operation/OrdersController_cancel

:param str symbol: unified market symbol of the market to cancel orders in
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
r  ALLr  r.   r^  r$  )rO  rN  r  rQ  
safe_order)r  r  r6  rS  rN  r7  s         r  cancel_all_ordersfoxbit.cancel_all_orders  s     	E
 [[(F&GFO'-d|GO$00W1MN H!
   	r  c                     U R                  5         SU0nU R                  U R                  XC5      5      nU R                  US5      $ )aw  
       Get an order by ID.

       https://docs.foxbit.com.br/rest/v3/#tag/Trading/operation/OrdersController_findByOrderId

@param id
       :param str symbol: it is not used in the foxbit API
       :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)rO  v3PrivateGetOrdersByOrderIdIdrQ  r  )r  r.   r  r6  rS  r7  s         r  fetch_orderfoxbit.fetch_order<  sL     	"
 55dkk'6RS( $//r  c                 >   U R                  5         Sn0 nUb  U R                  U5      nUS   US'   Ub  U R                  U5      US'   Ub  X6S'   US:  a  SUS'   U R                  U R	                  Xd5      5      nU R                  US/ 5      nU R                  XX#5      $ )a  
fetches information on multiple orders made by the user

https://docs.foxbit.com.br/rest/v3/#tag/Trading/operation/OrdersController_listOrders

: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
:param str [params.state]: Enum: ACTIVE, CANCELED, FILLED, PARTIALLY_CANCELED, PARTIALLY_FILLED
:param str [params.side]: Enum: BUY, SELL
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
Nr.   r^  r{  rq  r  r  r  )	r  r  ro  r  r6  rN  rS  r7  lists	            r  fetch_ordersfoxbit.fetch_ordersa  s     	[[(F'-d|GO$$(LL$7GL!#(K s{'*$**4;;w+GH0 ~~h3  u<<r  c                 d   Uc  [        U R                  S-   5      eU R                  5         U R                  U5      nSUS   0nUb  U R	                  U5      US'   Ub  X6S'   US:  a  SUS'   U R                  U R                  Xd5      5      nU R                  US/ 5      nU R                  XX#5      $ )a'  
Trade history queries will only have data available for the last 3 months, in descending order(most recents trades first).

https://docs.foxbit.com.br/rest/v3/#tag/Trading/operation/TradesController_all

: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 trade 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>`
z+ fetchMyTrades() requires a symbol argumentr^  r.   r{  rq  r  r  )	r   r.   rO  rN  r|  v3PrivateGetTradesrQ  r*  rt  ru  s	            r  fetch_my_tradesfoxbit.fetch_my_trades  s     >#DGG.[$[\\V$VD\
 $(LL$7GL!#(K s{'*$**4;;w+GH ~~h3  u<<r  r  c                    U R                  5         U R                  U5      nSUS   0nU R                  U5      u  pVUb  U R                  XQ5      US'   U R	                  U R                  XF5      5      nU R                  Xs5      $ )a  
Fetch the deposit address for a currency associated with self account.

https://docs.foxbit.com.br/rest/v3/#tag/Deposit/operation/DepositsController_depositAddress

:param str code: unified currency code
:param dict [params]: extra parameters specific to the exchange API endpoint
:param str [params.networkCode]: the blockchain network to create a deposit address on
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
r  r.   network_code)rO  r:  handle_network_code_and_paramsnetwork_code_to_idv3PrivateGetDepositsAddressrQ  parse_deposit_address)r  r  r6  r:  rS  rA  paramsOmitedr7  s           r  fetch_deposit_addressfoxbit.fetch_deposit_address  s     	==&x~
 %)$G$G$O!"&*&=&=k&PGN#33DKK4VW ))(==r  c                 .   U R                  5         0 nSnUb  U R                  U5      nUb  X5S'   US:  a  SUS'   Ub  U R                  U5      US'   U R                  U R	                  XT5      5      nU R                  US/ 5      nU R                  XX#5      $ )a  
Fetch all deposits made to an account.

https://docs.foxbit.com.br/rest/v3/#tag/Deposit/operation/DepositsController_listOrders

:param str [code]: unified currency code
:param int [since]: the earliest time in ms to fetch deposits for
:param int [limit]: the maximum number of deposit structures to retrieve
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
Nrq  r  r{  r  )rO  r:  r|  v3PrivateGetDepositsrQ  r*  parse_transactions	r  r  ro  r  r6  rS  r:  r7  r  s	            r  fetch_depositsfoxbit.fetch_deposits  s     	}}T*H#(K s{'*$$(LL$7GL!,,T[[-IJ" ~~h3&&tuDDr  c                 .   U R                  5         0 nSnUb  U R                  U5      nUb  X5S'   US:  a  SUS'   Ub  U R                  U5      US'   U R                  U R	                  XT5      5      nU R                  US/ 5      nU R                  XX#5      $ )a  
Fetch all withdrawals made from an account.

https://docs.foxbit.com.br/rest/v3/#tag/Withdrawal/operation/WithdrawalsController_listWithdrawals

:param str [code]: unified currency code
:param int [since]: the earliest time in ms to fetch withdrawals for
:param int [limit]: the maximum number of withdrawal structures to retrieve
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
Nrq  r  r{  r  )rO  r:  r|  v3PrivateGetWithdrawalsrQ  r*  r  r  s	            r  fetch_withdrawalsfoxbit.fetch_withdrawals  s     	}}T*H#(K s{'*$$(LL$7GL!//G0LM@ ~~h3&&tuDDr  c                     U R                  XX45      nU R                  XX45      nU R                  XV5      nU R                  US5      nU$ )at  
Fetch all transactions(deposits and withdrawals) made from an account.

https://docs.foxbit.com.br/rest/v3/#tag/Withdrawal/operation/WithdrawalsController_listWithdrawals
https://docs.foxbit.com.br/rest/v3/#tag/Deposit/operation/DepositsController_listOrders

:param str [code]: unified currency code
:param int [since]: the earliest time in ms to fetch withdrawals for
:param int [limit]: the maximum number of withdrawal structures to retrieve
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
ri  )r  r  array_concatsort_by)	r  r  ro  r  r6  r   r   allTransactionsr8  s	            r  fetch_transactionsfoxbit.fetch_transactionsF  sM     ,,T%H&&tEB++KBo{;r  c                     U R                  U5      nU R                  US0 5      nU R                  US0 5      nU R                  US5      nSSS.nU R                  XeU5      U R                  US5      SSUS	.$ )
a  
The latest known information on the availability of the exchange API.

https://status.foxbit.com/

:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `status structure <https://docs.ccxt.com/#/?id=exchange-status-structure>`
r  
attributesrq   okmaintenance)NORMALUNDER_MAINTENANCE	updatedAtN)rq   updatedetaurlr$  )statusPublicGetStatusr0  r.  )r  r6  r7  r  r  	statusRaw	statusMaps          r  fetch_statusfoxbit.fetch_statusY  s     --f5 ~~h3^^D,;
$$Z:	!.
	
 &&yYG''
K@
 	
r  c                    Uc  [        U R                  S-   5      eUR                  5       nUS:w  a#  US:w  a  US:w  a  US:w  a  [        SU-   S-   5      eU R	                  5         U R                  U5      nSS	U R                  U5      S
.UUR                  5       US   S.S.n	US:X  d  US:X  a4  U R                  X%5      U	S   S'   US:X  a  U R                  X&5      U	S   S'   US:X  a.  U R                  X&5      U	S   S'   U R                  X%5      U	S   S'   US:X  a  U R                  X%5      U	S   S'   U R                  U R                  X5      5      n
U R                  U
S   U5      $ )a  
Simultaneously cancel an existing order and create a new one.

https://docs.foxbit.com.br/rest/v3/#tag/Trading/operation/OrdersController_cancelReplace

:param str id: order id
: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 the currency you want to trade in units of the 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, used on stop 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>`
z' editOrder() requires a symbol argumentr  r  r  r  r  z6. Must be one of: LIMIT, MARKET, STOP_MARKET, INSTANT.ALLOW_FAILUREr  )r  r.   r.   )r  r  r^  )modecancelcreater  r  r  r  r"  )r   r.   r  r#   rO  rN  r  r  r   v3PrivatePostOrdersCancelReplacerQ  r  )r  r.   r  r  r  r"  r  r6  rN  rS  r7  s              r  
edit_orderfoxbit.edit_order  s    >#DGG.W$WXXzz|7?tx/DM4IdV_N_5<?wwxxV$#''+
 

!'
 7?dh.,0,D,DV,TGHj)w-1-D-DV-S!'*= .2.E.Ef.TGHl+,0,D,DV,TGHj)9*.*A*A&*QGHh'88W9UV  2F;;r  addresstagc                 b   U R                  XE5      u  pEU R                  5         U R                  U5      nUS   U R                  U5      US.nUb  XGS'   SnU R	                  U5      u  pUb  U R                  U5      US'   U R                  U R                  Xu5      5      n	U R                  U	5      $ )a  
Make a withdrawal.

https://docs.foxbit.com.br/rest/v3/#tag/Withdrawal/operation/WithdrawalsController_createWithdrawal

: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>`
r.   )r  r"  destination_addressNdestination_tagr  )	handle_withdraw_tag_and_paramsrO  r:  number_to_stringr  r  v3PrivatePostWithdrawalsrQ  parse_transaction)
r  r  r"  r  r  r6  r:  rS  rA  r7  s
             r  r^   foxbit.withdraw  s     99#F==&'~++F3#*

 ?),%&"AA&I"&*&=&=k&JGN#00W1MN %%h//r  c                 j   U R                  5         0 nUc  [        U R                  S-   5      eUb  X5S'   US:  a  SUS'   Ub  U R                  U5      US'   U R	                  U5      nUS   US'   U R                  U R                  XT5      5      nU R                  US/ 5      nU R                  XX#5      $ )a;  
fetch the history of changes, actions done by the user or operations that altered balance of the user

https://docs.foxbit.com.br/rest/v3/#tag/Account/operation/AccountsController_getTransactions

:param str code: unified currency code, default is None
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
:param int [limit]: max number of ledger entrys to return, default is None
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
z' fetchLedger() requires a code argumentrq  r  r{  r.   r  r  )	rO  r   r.   r|  r:  &v3PrivateGetAccountsSymbolTransactionsrQ  r*  parse_ledgerr  s	            r  fetch_ledgerfoxbit.fetch_ledger  s     	<#DGG.W$WXX#(K s{'*$$(LL$7GL!==&$TN>>t{{7?[\~~h3  >>r  rN  c                    U R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  U5      nU R                  U5      nUS-   U-   n	U R                  US5      n
U R                  0 SU_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 S S U R	                  U
S5      U R	                  U
S5      S
SSU R                  US5      U R                  US5      U R                  US5      S.U R	                  US5      S S.U R	                  US5      S S.S S S.S S S.S.US.E5      $ ) Nr  basequote/default_feesr.   baseIdquoteIdr&  Tr  r:   r;   Fr=   r<   r>   contractsettlesettleIdcontractSizer   r   r   r  )r  r"  costquantity_minr  	price_min)r"  r  r+  r   )linearinverseexpiryexpiryDatetimestrike
optionTyper   r   r   r   r   r  r'  r$  )r.  r0  r/  safe_market_structurer3  r-  )r  rN  r.   
baseAssetsr%  quoteAssetsr&  r!  r"  r  r   s              r  parse_marketfoxbit.parse_market  sF   fh/^^FF3
!!*h7nnVW5"";9&&v.''0e#~~fn5)) 5+
"5+
f5+
 D5+
 U	5+

 f5+
 w5+
 d5+
 F5+
 D5+
 e5+
 e5+
 E5+
 e5+
 5+
 d5+
  !5+
" D#5+
$ "%%dG4%%dG4**;D++JD))+{C  ++FNC
  ++FK@
  
  $ i5+
 5 5	r  rb  c                 Z    UUS   U R                  US5      U R                  US5      SSS.$ )Nr  r   r   T)r$  r  r   r   r   r   )r3  )r  rb  rN  s      r  ra  foxbit.parse_trading_fee9  s=    X&%%eW5%%eW5
 	
r  tickerc                    U R                  US5      nU R                  X2S S5      nUS   nU R                  US5      nU R                  US5      nU R                  US5      nUS   n	U R                  U	S5      n
U R                  0 S	U_S
U R	                  U R                  U	S5      5      _SU R                  U R	                  U R                  U	S5      5      5      _SU R                  US5      _SU R                  US5      _SU R                  US5      _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U
_SU
_SS _SU R                  US5      _SU R                  US5      _SS _U R                  US5      U R                  US5      US.EU5      $ )Nr^  r:   rolling_24hbestaskbid
last_trader  r  ri  datedatetimehighlow	bidVolumevolume	askVolumevwapopencloser   previousClosechangeprice_changer   price_change_percentaveragequote_volume)
baseVolumequoteVolumer$  )r.  safe_symbolr0  safe_ticker
parse_dater|  r3  )r  r;  rN  rc  r  r=  r>  bestAskbestBid	lastTrade	lastPrices              r  rR  foxbit.parse_tickerC  s9   ##FO<!!(D&A]+~~ff-..u-..u-<(	$$Y8	 !
f!
)9)9)V)LM!
 T__T5E5EiQW5X%YZ!
 D$$[&9	!

 4##K7!
 4##GW5!
 ))'8<!
 4##GW5!
 ))'8<!
 D!
 D$$[&9!
 Y!
 I!
 T!
 d&&{NC!
  $**;8NO!!
" t#!
$ **;A++KH)!
* + 	r  c           	          U R                  US5      U R                  US5      U R                  US5      U R                  US5      U R                  US5      U R                  US5      /$ )Nr   r  r   r      r   )r-  r3  )r  ohlcvrN  s      r  parse_ohlcvfoxbit.parse_ohlcvc  sl    eQ'UA&UA&UA&UA&UA&
 	
r  c                    U R                  U R                  US5      5      nU R                  US5      nU R                  USU R                  US5      5      nU R                  US5      nU R                  USU5      n[        R                  " XE5      nU R                  U R                  US5      5      U R                  US5      S S	.n	U R                  U R                  US
5      UUU R                  U5      US   S S US UUUU	S.U5      $ )N
created_atr  rG  r  r  
taker_sidefee_currency_symbolr  )r:  r+  rater.   r  )r.   r$  ri  rC  r  r  r  r  takerOrMakerr  r"  r+  r  )	rV  r.  r1  r(   
string_mulrT  r3  
safe_trader|  )
r  traderN  ri  r  r"  privateSideFieldr  r+  r  s
             r  parse_tradefoxbit.parse_tradem  s   OOD$4$4UL$IJ	  0!!%43C3CE:3VW11%@%%e\;KL!!%0(()9)9%AV)WX$$UE2

 ""5$/"Y/X&  
  	r  c                 8    SSSSSSS.nU R                  X!U5      $ )NrJ  closedcanceled)PARTIALLY_CANCELEDr  PARTIALLY_FILLEDr  PENDING_CANCELr  r.  r  rq   statusess      r  parse_order_statusfoxbit.parse_order_status  s0    "( &("
 &99r  c                 "   U R                  US5      nUc  Ub  U R                  U5      nUb  US   nU R                  U R                  US5      5      nU R                  US5      nU R                  US5      nU R                  US5      nS nUb  Ub  [        R                  " Xv5      nU R                  US5      n	U	(       d;  U R                  US5      n
U R                  USU
5      n[        R
                  " X5      n	U R                  US	5      nU R                  US
5      nUS:X  a  U R                  US5      nU R                  0 SU R                  US5      _SU_SU R                  US5      _SU_SU R                  U5      _SS _SU R                  U R                  US5      5      _SU R                  US5      _SU R                  US5      _SU R                  US5      _SU R                  US5      _SS _S	U_SU R                  U5      _SU R                  US5      _SS _SS _U R                  U	5      U R                  US5      U R                  U5      U R                  U5      U R                  U5      S UU R                  US 5      S!.S".E5      $ )#Nr^  r  rb  r  quantity_executedr  funds_received	price_avgr  r&  buyr%  r.   r$  r  r  ri  rC  lastTradeTimestamprq   r  r  r   r  r  r  
reduceOnlyr   r  r   r   fee_paid)r:  r+  )r+  rP  r"  filled	remainingr   r  )r.  rN  rV  r(   
string_addrg  r1  r  r  r|  rv  r5  r  r3  )r  r  rN  r  ri  r  r  r  r"  r+  priceAveragepriceToCalculater  feeCurrencys                 r  r  foxbit.parse_order  s   !!%9>f0[[(FH%FOOD$4$4UL$IJ	  0!!%)<=$$UJ7	 V%7''	:F'78++E;?L#//wM%%&6?D%%eV4,,VY?5=00BK  
$""5$/ 
E 
 T--e5FG 
 	 

 Y/ 
 !$ 
 d--d.>.>ug.NO 
 d&&vx8 
 D$$UF3 
 4++E?C 
 uk: 
 $ 
 D 
 T&&u- 
 D,,ULA 
  t! 
" T# 
$ %%d+''{;''/''/**95'((
;1 
  	r  r:  c                     U R                  US5      nU R                  US5      nU R                  S U5      nU R                  XE5      nU R                  US5      U R                  US5      UUUS.$ )Nr%  r  r  r  )r  r  r:  r%  r$  )r0  r.  r/  r2  )r  depositAddressr:  r%  r@  r  unifiedNetworks          r  r  foxbit.parse_deposit_address  sy    ..;$$Wf5	..tX>00I''	B##NE:$%"
 	
r  c                 D    SSSSSSSSSSSSS.nU R                  X!U5      $ )Npendingfailedro  r  )
SUBMITTING	SUBMITTEDREJECTED	CANCELLEDACCEPTEDWARNING	UNBLOCKEDBLOCKED
PROCESSINGr  FAILEDDONErs  rt  s      r  parse_transaction_statusfoxbit.parse_transaction_status  sD     $" # " #"
" &99r  c                    U R                  US5      nU R                  USS5      nU R                  US5      nSnUb  US   S:X  a  SnU R                  US	S
5      n	U R                  US5      n
U R                  US5      nU
nU R                  U5      nU R	                  U R                  US5      5      nU R                  US5      nU R                  U5      nU R                  U5      nU	b  U
b  [        R                  " X5      n[        R                  " X5      nU R                  U	5      UU R                  U5      S.n0 SU_SU R                  US5      _SU R                  US5      _SU_SU_SU R                  US5      _SU_SU_SS _SU R                  US5      _SU R                  US5      _SS _SU_SU R                  U
5      _S U_S!U_S"S _US S S#.E$ )$Ndetails_cryptoreceiving_addressr  sn
withdrawalr   Dr#  r  0r"  r  r  rb  )r+  r:  re  r$  r.   txidtransaction_idri  rC  r%  r  r  	addressToaddressFromr  r  tagTotagFromr  r:  rq   r  )r  r5   internal)r0  safe_string_2r.  r/  r  rV  r|  r(   
string_sub
string_divr  )r  transactionr:  ro  r  cryptoDetailsr  r  r  r  r"  currencySymbolactualAmountr  rq   rb  ri  rC  feeRatefeeObjs                       r  r  foxbit.parse_transaction  sn   {4DE$$]4GI^_k40>beslD{E37!!+x8))+7HI..~>..t/?/?W/UV%%k<@
OOJ/	<<	*?v1"--f:L$$S7%%c*$%%g.


K
$"";5
 D$$]4DE
 	

 
 t''^D
 w
 
 4
 4##K1BC
 T%%k3DE
 t
 D
 d''/
 
  f!
" t#
$ )
 	
r  c                 6    SSSSSS.nU R                  X!U5      $ )Nr  ri  transfer)
DEPOSITINGWITHDRAWINGTRADINGINTERNAL_TRANSFERINGOTHERSrs  )r  r  typess      r  parse_ledger_entry_typefoxbit.parse_ledger_entry_type  s-    '($.#
 T22r  itemc                    U R                  US5      nU R                  US5      nU R                  U5      nU R                  US5      nU R                  U5      nU R                  US5      nU R                  U5      n	Sn
U R	                  US5      nUnU R	                  US5      nU R	                  US5      U	S	.nUS
:  a  Sn
US-  nUUUU R                  U5      U
S S S UU	UX-
  USUS.$ )Nuuidrb  reason_typer  inr"  r  r  )r+  r:  r   outr  )r.   r$  ri  rC  	directionr  referenceIdreferenceAccountr  r:  r"  beforeafterrq   r  )r.  	parse8601r  r/  r3  r|  )r  r  r:  r.   	createdAtri  
reasonTyper  exchangeSymbolr  r  r"  
realAmountr  r  s                  r  parse_ledger_entryfoxbit.parse_ledger_entry$  s    dF+$$T<8	NN9-	%%dM:
++J7))$0AB00@	!!$1
""43$$T51&
 A:I"J"Y/" $& &
 	
r  GETc                    US   nUS   nSU-   S-   U R                  X5      -   n	US:X  a  Sn	SnU R                  S   U   U	-   n
U R                  X@R                  U5      5      nU R	                  5       nSnSnUS	:X  a  [        UR                  5       5      n[        U5      nUS:  a  U R                  U5      nU
S
U-   -  n
[        S[        U5      5       H8  nUU   nU R                  UU5      nUb  UUS-   U-   -  nUUS-
  :  d  M3  US-  nM:     US:X  d  US:X  a  U R                  U5      nSnUb  UnSS0nUS:X  a  U R                  5         U R                  U5      U-   U	-   U-   U-   nU R                  U R                  U5      U R                  U R                   5      ["        R$                  S5      nU R&                  US'   U R                  U5      US'   UUS'   XXeS.$ )Nr   r  z/rest/r#  rq   z/statusrs    r  ?=&POSTPUTzContent-Typezapplication/jsonrp   hexzX-FB-ACCESS-KEYzX-FB-ACCESS-TIMESTAMPzX-FB-ACCESS-SIGNATURE)r  methodbodyheaders)implode_paramsrn   r  extract_paramsmillisecondsr  keysr,  	urlencoder+  r.  jsoncheck_required_credentialsr  hmacencoder   hashlibsha256r   )r  pathrs   r  r6  r  r  r3   urlPathfullPathr  ri  querysignatureQuery	paramKeysparamKeysLengthr9  keyvaluebodyToSignaturepreHash	signatures                         r  signfoxbit.signT  s   a&a&g%+d.A.A$.OOh HGiiw'(26#6#6t#<=%%'	U?V[[]+I!)nO"v.sU{"1c)n-l((5$"cCi%&77N**"c)N . Vv99V$D"O.
 i++-++I6?(J^[^mmG		$++g"6DKK8PRYR`R`bghI)-G%&/3/D/DY/OG+,/8G+,dOOr  httpCodereasonr  r  r  r  c
                    Uc  g U R                  US5      n
U R                  U
S5      nU R                  U
S5      nU R                  U
S5      nSnU(       a&  [        S[	        U5      5       H  nXU   -   S-   nM     U
b  U R
                  S-   U-   S-   U-   nU R                  U R                  S	   UU5        U R                  U R                  S	   UU5        U R                  U R                  S
   UU5        [        U5      eg )Nerrorr  detailsmessager  r    z
 details: r   r   )
r0  r.  r*  r+  r,  r.   throw_broadly_matched_exceptionrw   throw_exactly_matched_exceptionr   )r  r  r  r  r  r  r  r7  requestHeadersrequestBodyr  r  r  r  detailsStringr9  feedbacks                    r  handle_errorsfoxbit.handle_errors~  s   x1v...	2""5)41c'l+ -
 :S @ ,ww}w.=MH001I7T\]001I=Zbc001I4QYZ))r   )N)NNN)L__name__
__module____qualname____firstlineno__r   r  r   rF  r   r   rK  strr   rT  r   r   r[  r   rd  r
   r   rm  r   rv  r  r  r   r  r   r   r  r  r  r  r   r   floatr   r  r   r  r  r  r  r  r  r	   r  r   r  r  r  r  r  r^   r  dictr7  r   ra  rR  r_  rk  rv  r  r   r  r  r  r  r  r  intr  __static_attributes____classcell__)r  s   @r  r*   r*      s   v# vp	 ') qZ qf $& i+$v, i+V 02 113 11f 11f 04B #1W #17 #1J )+ { 8 :>b ,Bs ,B3 ,BY ,B\ 6:UW  =3  =s  =#  =\`af\g  =D 9=4^bkm *K# *K# *KS *KX[ *Krvw{r| *KX $& &)( &)P /3TXac S S3 Sc Shlmrhs S 154VZce S# SS SPS Sjnotju S 37TX\eg UC Us URU Ulpqvlw U AESWfjsu 'S '# 'S '`c 'z~  @E  {F '& gksu ;23 ;2i ;2y ;2RW ;2`c ;2z ;2z @B D'D$6 D'L 37r (s (C (: /32  > 26b #0c #03 #0U #0J *.Dt\^ 3=3 3=c 3= 3=cghmcn 3=j -1tRV_a )=c )= )=C )=fjkpfq )=V 79 ># >^ >@ *.Dt\^ )E3 )Ec )E )Ecghsct )EV -1tRV_a 8Ec 8E 8EC 8Efjkvfw 8Et .2SW`b s # S gklwgx & #% %
N `drv  @B 5<S 5<# 5<Y 5<i 5<Y\ 5<lo 5<  GL 5<n KOWY #0S #0% #0# #0C #0^i #0J (,$TZ\ ? ?C ?s ?8?4 ?F ?B
t 
V 
GZ 
4  6 @
 
4 
 8	: 	:3 3j
h 
:s :(.
x .
s .
be .
q| .
`3.
t .
x .
`  b$T (PTc 3 S # X\ dg  r  r*   )/ccxt.base.exchanger   ccxt.abstract.foxbitr   r  ccxt.base.typesr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   typingr   ccxt.base.errorsr   r   r   r   r   r    r!   r"   r#   r$   r%   r&   ccxt.base.decimal_to_precisionr'   ccxt.base.preciser(   r*   r  r  r  <module>r     sq    ( ,  m  m  m  m  m  m  * 0 - - . ' & . ) . 1 * 9 %tX{ tr  