
    eiN                    T   d dl mZ d dlmZ d dlZd dlmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ d dlmZ d dlmZ d dlmZ d dlm Z  d d	lm!Z! d d
lm"Z" d dlm#Z# d dlm$Z$ d dlm%Z% d dlm&Z& d dlm'Z' d dlm(Z( d dlm)Z) d dl*m+Z+ d dl,m-Z-  G d dee          Z.dS )    )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                       e Zd Zdef fdZi fdefdZi fdee         fdZ	i fde
defdZdi fde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i fde
dededee         fdZdddi fde
de
dededee         f
dZi fdefdZdddi fdedededee         fdZdddi fdedededee         fdZdddi fdedededee         fdZdddi fdededededee         f
dZ di fde
de!de"de#de$defdZ%i fdee&         fdZ'di fde
defd Z(di fdefd!Z)di fde
dedefd"Z*dddi fdedededee         fd#Z+dddi fdedededee         fd$Z,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'Z0dddi fd%edededee/         fd(Z1dddi fd%edededee/         fd)Z2i fd*Z3ddi fde
de
de!de"de$de$defd+Z4di fd%e
de#d,e
d-ede/f
d.Z5dddi fd%ededefd/Z6d0e7defd1Z8dJd2e7d0ede9fd3Z:dJd4e7d0edefd5Z;dJd0edefd6Z<dJdefd7Z=defd8Z>dJdefd9Z?dJd:e@fd;ZAdefd<ZBdKd:e@dedede/fd=ZCd> ZDdJd?e7d:e@fd@ZEg dAi ddfdBZFdCeGdDe
dEe
dFe
dGe7dHe
fdIZH xZIS )Lfoxbitreturnc                    |                      t          t          |                                           i ddddddg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d*dd+dd,dd-dd.dd/dd0dd1dd2dd3ddddddd4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdFdGdHdIdJgdKdLt          dMi dNt
          dOt          dPt
          dQt          dRt          dSt          dTt          dUt
          dVt          dWt          dXt          dYt          dZt
          d[t          d\t          d]t          d^t
          t          t          t          t          t          t          t          t          t          t          t          d_i d`dadddbdcdddededfdgdhdhdidjidkdfdkdkdgdldldldfdm	dkdndodldpdqdkidrdsdtdddudviiidwdxdydddd|                     dz          |                     d{          d|id}di d~dddddddddddddddddddddddddddddddddddddddi dd~ddddddddddddddddddddddddddddddddddddddddd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ddeidddddddddddddddddddddddddddddddddddddddid	ii          S )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)r`   ra   rb   rc   rd   re   rf   rg   rh   ri   rj   rk   rl   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secretrr   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)rn   ro   rn   rp      )v3rp   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\   rD   createOrdersrO   rR   rQ   rS   rH   rP   )deep_extendsuperr*   describer'   r    r$   r   r   r   r   r"   r#   r!   r%   r&   parse_number)self	__class__s    W/var/www/html/volatility/venv/lib/python3.11/site-packages/ccxt/async_support/foxbit.pyr  zfoxbit.describe   s   fd 3 3 < < > > 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7!..x8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 2[uA
@ $&+(,$($)%*- -
 -2).+06:#'#'#'"&#(( ( #($)+027,0,0+/$(	0 0 %*).=$ $B q% ',!$$&%**.& & ',!"$&#($)*/# # ',!$$&#($)*/( ( '+!$$&%*#($)*/$ $ '+!$$&,.%*#($)*/	* 	*  #_R RTAuA
 uA
 u u u	    c                   K   |                      |           d {V }|                     |dg           }i }t          dt          |                    D ]}||         }|                     |d          }|                     |d          }|                     |d          }	|                     |          }
|                     |d          }|                     |d          }|                     |dg           }|                     |d	          }i }t          dt          |                    D ]}||         }|                     |d
          }| 	                    ||
          }|                     |d          }|                     |d          }|                     |d          dk    }|                     |d          dk    }||||                     |d          ||d|| 
                    |d          d d d| 
                    |d          d d| 
                    |d          d ddd
||<   |                     ||
          |                     ||
||	d||                     |dd          |                     |dd          | 
                    |d          |d d d| 
                    |d          d d| 
                    |d          d dd|d          ||
<   |S )Ndatar   	precisionsymbolr.   deposit_infowithdraw_infor   typecoderp   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_currencieszfoxbit.fetch_currenciesU  sq     33F;;;;;;;;L ~~h33q#d))$$ G	 G	AAwH))(K@@I))(H==J##Hf55D**:66D..>BBK>>(ODDL~~h
B??H))(F;;D#%N1c(mm,,    "1+ ,,Wf==	"55iFF&*nnWo&N&N#%)^^G^%L%L"$($4$45H($S$SW`$`!#'#3#34F#Q#QU^#^ $#* ,,Wf==/ 1"!*++,?GG $(#'# #
 $(#3#3K#N#N#'$ $
 $(#3#3L,#O#O#'% % / /{++2 ~~fd++3#;;$ $ " #~~k9eLL $|Y N N++L%@@!* $(#'# #
 $(#3#3K#N#N#'$ $
 $(#3#3L,#O#O#'% %  !/3= =    t6 r  c                    K   |                      |           d{V }|                     |dg           }|                     |          S )a6  
        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
        Nr  )v3PublicGetMarketsr(  parse_markets)r  r4  r5  r   s       r  fetch_marketszfoxbit.fetch_markets  sY       0088888888~ ..6266!!'***r  r  c                 ^  K   |                                   d{V  |                     |          }d|d         i}|                     |                     ||                     d{V }|                     |dg           }|                     |di           }|                     ||          S )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>`
        Nmarketr-   r  r   )load_marketsrJ  "v3PublicGetMarketsMarketTicker24hrextendr(  r.  parse_ticker)r  r  r4  rJ  requestr5  r  r6  s           r  fetch_tickerzfoxbit.fetch_ticker3  s       !!!!!!!!!V$$fTl
 @@WV\A]A]^^^^^^^^@ ~~h33a,,  000r  Nsymbolsc                    K   |                                   d{V  |                     |          }|                     |           d{V }|                     |dg           }|                     ||          S )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>`
        Nr  )rK  market_symbolsv3PublicGetMarketsTicker24hrr(  parse_tickers)r  rQ  r4  r5  r  s        r  fetch_tickerszfoxbit.fetch_tickersf  s       !!!!!!!!!%%g..::6BBBBBBBB, ~~h33!!$000r  c                   K   |                                   d{V  |                     |           d{V }|                     |dg           }i }t          dt	          |                    D ]V}||         }|                     |d          }|                     |          }|d         }	|                     ||          ||	<   W|S )ax  
        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
        Nr  r   market_symbolr  )rK  v3PrivateGetMeFeesTradingr(  r)  r*  r,  safe_marketparse_trading_fee)
r  r4  r5  r  r6  r7  entrymarketIdrJ  r  s
             r  fetch_trading_feeszfoxbit.fetch_trading_fees  s       !!!!!!!!!77???????? ~~h33q#d))$$ 	C 	CAGE''??H%%h//FH%F!33E6BBF6NNr  r  c                 >  K   |                                   d{V  |                     |          }d}|d         ||n|d}|                     |                     ||                     d{V }|                     |d          }|                     |||          S )aF  
        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
        N   r-   )rJ  depth	timestamp)rK  rJ  !v3PublicGetMarketsMarketOrderbookrM  r+  parse_order_book)	r  r  r  r4  rJ  defaultLimitrO  r5  rb  s	            r  fetch_order_bookzfoxbit.fetch_order_book  s       !!!!!!!!!V$$Tl&+m\\%
 
 ??GU[@\@\]]]]]]]]2 %%h<<	$$XvyAAAr  sincec                 X  K   |                                   d{V  |                     |          }d|d         i}|||d<   |dk    rd|d<   |                     |                     ||                     d{V }|                     |dg           }|                     ||||          S )a1  
        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>`
        NrJ  r-   	page_size   r  )rK  rJ  %v3PublicGetMarketsMarketTradesHistoryrM  r(  parse_trades	r  r  rg  r  r4  rJ  rO  r5  r  s	            r  fetch_tradeszfoxbit.fetch_trades  s       !!!!!!!!!V$$fTl
 #(GK s{{'*$ CCDKKPWY_D`D`aaaaaaaa~~h33  vue<<<r  r`   	timeframec                   K   |                                   d{V  |                     |          }|                     | j        ||          }|d         |d}||                     |          |d<   |||d<   |dk    rd|d<   |                     |                     ||                     d{V }	|                     |	||||          S )a  
        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
        Nr-   )rJ  interval
start_timer  r	  )rK  rJ  r,  r_   iso8601$v3PublicGetMarketsMarketCandlesticksrM  parse_ohlcvs)
r  r  ro  rg  r  r4  rJ  rq  rO  r5  s
             r  fetch_ohlcvzfoxbit.fetch_ohlcv  s       !!!!!!!!!V$$##DOY	JJTl 
 
 $(LL$7$7GL!$GGs{{#& BB4;;wX^C_C_````````    68UEJJJr  c                   K   |                                   d{V  |                     |           d{V }|                     |dg           }d|i}t          dt	          |                    D ]}||         }|                     |d          }|                     |          }|                     |d          }	|                     |d          }
|                     |d          }||
|	d	}|||<   |                     |          S )
a{  
        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>`
        Nr  r"  r   currency_symbolbalancebalance_lockedbalance_available)freeusedtotal)rK  v3PrivateGetAccountsr(  r)  r*  r,  r-  safe_balance)r  r4  r5  r   r6  r7  accountr9  currencyCoder~  r}  r|  
balanceObjs                r  fetch_balancezfoxbit.fetch_balance#  s@      !!!!!!!!!226:::::::: >>(FB77H
 q#h--(( 	. 	.AqkG))'3DEEJ22:>>L$$Wi88E##G-=>>D##G-@AAD J
 $.F<    (((r  c                 D   K   |                      d||||           d{V S )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>`
        ACTIVENfetch_orders_by_statusr  r  rg  r  r4  s        r  fetch_open_orderszfoxbit.fetch_open_ordersK  7       0065%QWXXXXXXXXXr  c                 D   K   |                      d||||           d{V S )a6  
        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>`
        FILLEDNr  r  s        r  fetch_closed_orderszfoxbit.fetch_closed_ordersY  r  r  c                 D   K   |                      d||||           d {V S )NCANCELEDr  r  s        r  fetch_canceled_orderszfoxbit.fetch_canceled_ordersg  s5      00VUESYZZZZZZZZZr  rp   c                   K   |                                   d {V  d }d|i}| |                     |          }|d         |d<   ||                     |          |d<   |||d<   |dk    rd|d<   |                     |                     ||                     d {V }|                     |dg           }	|                     |	          S )Nstater-   rX  rr  ri  r   r  rK  rJ  rs  v3PrivateGetOrdersrM  r(  parse_orders)
r  rp   r  rg  r  r4  rJ  rO  r5  r  s
             r  r  zfoxbit.fetch_orders_by_statusj  s      !!!!!!!!!V
 [[((F'-d|GO$$(LL$7$7GL!#(GK s{{'*$00Wf1M1MNNNNNNNN~~h33  &&&r  r  sider   pricec                   K   |                                   d{V  |                     |          }|                                }|dk    r-|dk    r'|dk    r!|dk    r|dk    rt          d|z   dz             |                     |d	          }|                     |d
d          }	|                     |d          }
|d         |                                |d}|dk    s|dk    r|
t          d|z   dz             ||dk    rd|d<   n||d<   |	rd|d<   |
|                     ||
          |d<   |dk    r|                     ||          |d<   n|                     ||          |d<   |dk    s|dk    r|                     ||          |d<   | 	                    |d          }|||d<   | 
                    |g d          }|                     |                     ||                     d{V }|                     ||          S )at  
        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>`
        N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-   rX  r  r  . Must have triggerPrice.r   T	post_onlytime_in_force
stop_pricer   quantityr  clientOrderIdclient_order_id)r   r  r   r  )rK  rJ  upperr#   safe_string_upperr3  r1  price_to_precisionamount_to_precisionr,  omitv3PrivatePostOrdersrM  parse_order)r  r  r  r  r   r  r4  rJ  r   r  r   rO  r  r5  s                 r  create_orderzfoxbit.create_order}  s     $ !!!!!!!!!V$$zz||7??tx//DM4I4IdVbNbNbgkoxgxgx5<  @D   D  E  E  E,,V]CC>>&*e<<''??#D\JJLL
 

 =  DL$8$8#"#9D#@C^#^___"d""'+$$+6( 	(#'GK #$($;$;FL$Q$QGL!9 $ 7 7 G GGH"&":":66"J"JGJ7??dl22#66vuEEGG((AA$)6G%&6#_#_#_``11$++gv2N2NOOOOOOOO &111r  r   c                   K   |                                   d{V  g }t          dt          |                    D ]+}|                     ||          }|                     |d          }|                     |          }|                     |d          }|                     |di           }	|dk    r-|dk    r'|dk    r!|d	k    r|d
k    rt          d|z   dz             |                     |	d          }
|                     |	dd          }| 	                    |	d          }|d         |                     |d          |d}|dk    s|d	k    r|t          d|z   dz             |
|
dk    rd|d<   n|
|d<   |	d= |rd|d<   |	d= || 
                    ||          |d<   |	d= |d
k    r.| 
                    ||                     |d                    |d<   n-|                     ||                     |d                    |d<   |dk    s|d	k    r-| 
                    ||                     |d                    |d<   |                    |                     ||	                     -d|i}|                     |                     ||                     d{V }|                     |dg           }|                     |          S )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>`
        Nr   r  r  r4  r  r  r  r  r  r  r  r   r  Fr   r-   r  r  r  r   Tr  r  r  r   r  r  r  )rK  r)  r*  r.  r,  rJ  r  r#   r3  r1  r  r  appendrM  v3PrivatePostOrdersBatchr(  r  )r  r   r4  ordersRequestsr7  orderr  rJ  r  orderParamsr   r  r   rO  createOrdersRequestr5  r  s                    r  create_orderszfoxbit.create_orders  sZ      !!!!!!!!!q#f++&& %	E %	EANN61--E%%eX66F[[((F))%88D.."==Kw48#3#38M8MRVZfRfRfkos|k|k|"#9D#@  DH  $H  I  I  I00mLLK~~k:uEEH++KHHL!'..uf== G
 }$$(<(<'&'='DGb'bccc&$&&+/GK((/:GO,. ,'+$
+'(,(?(?(U(U%/y  $($;$;FDDTDTUZ\dDeDe$f$f!!&*&>&>vtGWGWX]_gGhGh&i&i
#w$,"6"6#'#:#:64CSCSTY[bCcCc#d#d !!$++g{"C"CDDDD%~666t{{CVX^7_7_````````  ~~h33  &&&r  r-   c                 N  K   |                                   d{V  |                     |          dd}|                     |                     ||                     d{V }|                     |dg           }|                     |di           }|                     |          S )a  
        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>`
        NID)r-   r  r  r   )rK  r  v3PrivatePutOrdersCancelrM  r(  r.  r  )r  r-   r  r4  rO  r5  r  r6  s           r  cancel_orderzfoxbit.cancel_order   s       !!!!!!!!!##B''
 
 66t{{7F7S7STTTTTTTT ~~h33a,,'''r  c                   K   |                                   d{V  ddi}|%|                     |          }d|d<   |d         |d<   |                     |                     ||                     d{V }|                     d|i          gS )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>`
        Nr  ALLr  r-   rX  r"  )rK  rJ  r  rM  
safe_order)r  r  r4  rO  rJ  r5  s         r  cancel_all_orderszfoxbit.cancel_all_orders  s       !!!!!!!!!E
 [[((F&GFO'-d|GO$66t{{7F7S7STTTTTTTT H!
    	r  c                    K   |                                   d{V  d|i}|                     |                     ||                     d{V }|                     |d          S )a|  
        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>`
        Nr-   )rK  v3PrivateGetOrdersByOrderIdIdrM  r  )r  r-   r  r4  rO  r5  s         r  fetch_orderzfoxbit.fetch_order<  s       !!!!!!!!!"
 ;;DKKQW<X<XYYYYYYYY( $///r  c                   K   |                                   d{V  d}i }| |                     |          }|d         |d<   ||                     |          |d<   |||d<   |dk    rd|d<   |                     |                     ||                     d{V }|                     |dg           }|                     ||||          S )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-   rX  rr  ri  r   r  r  )	r  r  rg  r  r4  rJ  rO  r5  lists	            r  fetch_orderszfoxbit.fetch_ordersa  s       !!!!!!!!![[((F'-d|GO$$(LL$7$7GL!#(GK s{{'*$00Wf1M1MNNNNNNNN0 ~~h33  vue<<<r  c                   K   |t          | j        dz             |                                  d{V  |                     |          }d|d         i}||                     |          |d<   |||d<   |dk    rd|d<   |                     |                     ||                     d{V }|                     |dg           }|                     ||||          S )	ae  
        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>`
        Nz+ fetchMyTrades() requires a symbol argumentrX  r-   rr  ri  r   r  )	r   r-   rK  rJ  rs  v3PrivateGetTradesrM  r(  rl  rm  s	            r  fetch_my_tradeszfoxbit.fetch_my_trades  s      >#DG.[$[\\\!!!!!!!!!V$$VD\
 $(LL$7$7GL!#(GK s{{'*$00Wf1M1MNNNNNNNN ~~h33  vue<<<r  r  c                 h  K   |                                   d{V  |                     |          }d|d         i}|                     |          \  }}||                     ||          |d<   |                     |                     ||                     d{V }|                     ||          S )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>`
        Nrx  r-   network_code)rK  r8  handle_network_code_and_paramsnetwork_code_to_idv3PrivateGetDepositsAddressrM  parse_deposit_address)r  r  r4  r8  rO  r?  paramsOmitedr5  s           r  fetch_deposit_addresszfoxbit.fetch_deposit_address  s       !!!!!!!!!==&&x~
 %)$G$G$O$O!\"&*&=&=k4&P&PGN#99$++g|:\:\]]]]]]]] ))(H===r  c                   K   |                                   d{V  i }d}||                     |          }|||d<   |dk    rd|d<   ||                     |          |d<   |                     |                     ||                     d{V }|                     |dg           }|                     ||||          S )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>`
        Nri  r   rr  r  )rK  r8  rs  v3PrivateGetDepositsrM  r(  parse_transactions	r  r  rg  r  r4  rO  r8  r5  r  s	            r  fetch_depositszfoxbit.fetch_deposits  s       !!!!!!!!!}}T**H#(GK s{{'*$$(LL$7$7GL!224;;w3O3OPPPPPPPP" ~~h33&&tXueDDDr  c                   K   |                                   d{V  i }d}||                     |          }|||d<   |dk    rd|d<   ||                     |          |d<   |                     |                     ||                     d{V }|                     |dg           }|                     ||||          S )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>`
        Nri  r   rr  r  )rK  r8  rs  v3PrivateGetWithdrawalsrM  r(  r  r  s	            r  fetch_withdrawalszfoxbit.fetch_withdrawals  s       !!!!!!!!!}}T**H#(GK s{{'*$$(LL$7$7GL!55dkk'66R6RSSSSSSSS@ ~~h33&&tXueDDDr  c                    K   |                      ||||           d{V }|                     ||||           d{V }|                     ||          }|                     |d          }|S )a  
        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>`
        Nrb  )r  r  array_concatsort_by)	r  r  rg  r  r4  r   r   allTransactionsr6  s	            r  fetch_transactionszfoxbit.fetch_transactionsF  s       !224vNNNNNNNN,,T5%HHHHHHHH++KBBo{;;r  c                 0  K   |                      |           d{V }|                     |di           }|                     |di           }|                     |d          }ddd}|                     |||          |                     |d          dd|d	S )
a3  
        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>`
        Nr  
attributesrp   okmaintenance)NORMALUNDER_MAINTENANCE	updatedAt)rp   updatedetaurlr"  )statusPublicGetStatusr.  r,  )r  r4  r5  r  r  	statusRaw	statusMaps          r  fetch_statuszfoxbit.fetch_statusY  s       33F;;;;;;;; ~~h33^^D,;;
$$Z::	!.
 
	
 &&y)YGG''
K@@
 
 	
r  c                   K   |t          | j        dz             |                                }|dk    r'|dk    r!|dk    r|dk    rt          d|z   dz             |                                  d{V  |                     |          }d	d
|                     |          d||                                |d         dd}	|dk    s|dk    rD|                     ||          |	d         d<   |dk    r|                     ||          |	d         d<   |dk    r>|                     ||          |	d         d<   |                     ||          |	d         d<   |dk    r|                     ||          |	d         d<   | 	                    | 
                    |	|                     d{V }
|                     |
d         |          S )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>`
        Nz' 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  rX  )modecancelcreater  r  r  r  r   )r   r-   r  r#   rK  rJ  r  r  r   v3PrivatePostOrdersCancelReplacerM  r  )r  r-   r  r  r  r   r  r4  rJ  rO  r5  s              r  
edit_orderzfoxbit.edit_order  s      >#DG.W$WXXXzz||7??tx//DM4I4IdV_N_N_5<?wwxxx!!!!!!!!!V$$#''++ 
 

!' 
 
 7??dh..,0,D,DVV,T,TGHj)w-1-D-DVU-S-S!'*=  .2.E.Efe.T.TGHl+,0,D,DVV,T,TGHj)9*.*A*A&&*Q*QGHh'>>t{{7TZ?[?[\\\\\\\\  2F;;;r  addresstagc                   K   |                      ||          \  }}|                                  d{V  |                     |          }|d         |                     |          |d}|||d<   d}|                     |          \  }}||                     |          |d<   |                     |                     ||                     d{V }	|                     |	          S )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>`
        Nr-   )rx  r   destination_addressdestination_tagr  )	handle_withdraw_tag_and_paramsrK  r8  number_to_stringr  r  v3PrivatePostWithdrawalsrM  parse_transaction)
r  r  r   r  r  r4  r8  rO  r?  r5  s
             r  r]   zfoxbit.withdraw  s      99#vFFV!!!!!!!!!==&&'~++F33#*
 

 ?),G%&"AA&IIV"&*&=&=k&J&JGN#66t{{7F7S7STTTTTTTT %%h///r  c                   K   |                                   d{V  i }|t          | j        dz             |||d<   |dk    rd|d<   ||                     |          |d<   |                     |          }|d         |d<   |                     |                     ||                     d{V }|                     |dg           }|                     ||||          S )	ay  
        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>`
        Nz' fetchLedger() requires a code argumentri  r   rr  r-   r  r  )	rK  r   r-   rs  r8  &v3PrivateGetAccountsSymbolTransactionsrM  r(  parse_ledgerr  s	            r  fetch_ledgerzfoxbit.fetch_ledger  s      !!!!!!!!!<#DG.W$WXXX#(GK s{{'*$$(LL$7$7GL!==&&$TNDDT[[QXZ`EaEabbbbbbbb~~h33  x>>>r  rJ  c                 b   |                      |d          }|                     |d          }|                      |d          }|                     |d          }|                      |d          }|                     |          }|                     |          }|dz   |z   }	|                     |d          }
|                     i d|d|	d|d|d|d|d	d
dddd
dddddddddddd dd dd d d d d d d |                     |
d          |                     |
d          d
dd|                     |d          |                     |d          |                     |d          d|                     |d          d d|                     |d          d dd d dd d dd|d          S ) Nr  basequote/default_feesr-   baseIdquoteIdr$  Tr  r9   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,  r.  r-  safe_market_structurer1  r+  )r  rJ  r-   
baseAssetsr  quoteAssetsr  r  r  r  r   s              r  parse_marketzfoxbit.parse_market  s   fh//^^FF33
!!*h77nnVW55"";99&&v..''00e#~~fn5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4%%dG44**;DD++JDD))+{CC   ++FNCC 
  ++FK@@ 
   
    $ i5+
 5+
 5+
 5 5 5	r  r\  c                 p    ||d         |                      |d          |                      |d          dddS )Nr  r   r   T)r"  r  r   r   r   r   )r1  )r  r\  rJ  s      r  r[  zfoxbit.parse_trading_fee9  sH    X&%%eW55%%eW55
 
 	
r  tickerc                 F   |                      |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|          S )NrX  r9   rolling_24hbestaskbid
last_trader  r  rb  datedatetimehighlow	bidVolumevolume	askVolumevwapopencloser   previousClosechangeprice_changer   price_change_percentaveragequote_volume)
baseVolumequoteVolumer"  )r,  safe_symbolr.  safe_ticker
parse_daters  r1  )r  r  rJ  r]  r  r  r  bestAskbestBid	lastTrade	lastPrices              r  rN  zfoxbit.parse_tickerC  s   ##FO<<!!(FD&AA]+~~ff--..u--..u--<(	$$Y88	 !
f!
)9)9)V)L)LMM!
 T__T5E5EiQW5X5X%Y%YZZ!
 D$$[&99	!

 4##K77!
 4##GW55!
 ))'8<<!
 4##GW55!
 ))'8<<!
 D!
 D$$[&99!
 Y!
 I!
 T!
 d&&{NCC!
  $**;8NOO!!
" t#!
$ **;AA++KHH)!
 !
 !
* +  	r  c           	         |                      |d          |                     |d          |                     |d          |                     |d          |                     |d          |                     |d          gS )Nr   r  r   r      r   )r+  r1  )r  ohlcvrJ  s      r  parse_ohlcvzfoxbit.parse_ohlcvc  s~    eQ''UA&&UA&&UA&&UA&&UA&&
 	
r  c                 ~   |                      |                     |d                    }|                     |d          }|                     |d|                     |d                    }|                     |d          }|                     |d|          }t          j        ||          }|                     |                     |d                    |                     |d          d d	}	|                     |                     |d
          |||                     |          |d         d d |d ||||	d|          S )N
created_atr  r'  r  r  
taker_sidefee_currency_symbolr  )r8  r  rater-   r  )r-   r"  rb  r#  r  r  r  r  takerOrMakerr  r   r  r  )	r6  r,  r/  r(   
string_mulr4  r1  
safe_traders  )
r  traderJ  rb  r  r   privateSideFieldr  r  r  s
             r  parse_tradezfoxbit.parse_tradem  sR   OOD$4$4UL$I$IJJ	  00!!%43C3CE:3V3VWW11%@@%%e\;KLL!%00(()9)9%AV)W)WXX$$UE22
 

 ""5$//"Y//X&  
  
   	r  c                 B    ddddddd}|                      |||          S )Nr*  closedcanceled)PARTIALLY_CANCELEDr  PARTIALLY_FILLEDr  PENDING_CANCELr  r,  r  rp   statusess      r  parse_order_statuszfoxbit.parse_order_status  s:    "( &("
 
 &&999r  c                    |                      |d          }|||                     |          }||d         }|                     |                      |d                    }|                      |d          }|                      |d          }|                      |d          }d }||t          j        ||          }|                      |d          }	|	sB|                      |d          }
|                      |d|
          }t          j        ||          }	|                     |d	          }|                     |d
          }|dk    r|                     |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"          S )#NrX  r  r@  r  quantity_executedr  funds_received	price_avgr  r  buyr  r-   r"  r  r  rb  r#  lastTradeTimestamprp   r  r  r   r  r  r  
reduceOnlyr   r  r   r   fee_paid)r8  r  )r  r0  r   filled	remainingr   r  )r,  rJ  r6  r(   
string_addrE  r/  r  r  rs  rS  r3  r  r1  )r  r  rJ  r  rb  r  r\  r]  r   r  priceAveragepriceToCalculater  feeCurrencys                 r  r  zfoxbit.parse_order  s   !!%99>f0[[((FH%FOOD$4$4UL$I$IJJ	  00!!%)<==$$UJ77	 V%7'	6::F'788 	@++E;??L#//wMM%&6??D%%eV44,,VY??5==00BBK  
$""5$// 
E 
 T--e5FGG 
 	 

 Y// 
 !$ 
 d--d.>.>ug.N.NOO 
 d&&vx88 
 D$$UF33 
 4++E?CC 
 uk:: 
 $ 
 D 
 T&&u-- 
 D,,ULAA 
  t! 
" T# 
$ %%d++''{;;''//''//**955'((
;; 1 
  
  
   	r  r8  c                    |                      |d          }|                     |d          }|                     d |          }|                     ||          }|                     |d          |                     |d          |||dS )Nr#  r  r  r  )r  r  r8  r#  r"  )r.  r,  r-  r0  )r  depositAddressr8  r#  r>  r  unifiedNetworks          r  r  zfoxbit.parse_deposit_address  s    ..;;$$Wf55	..tX>>00LII''	BB##NE::$%"
 
 	
r  c                 N    ddddddddddddd}|                      |||          S )NpendingfailedrL  r  )
SUBMITTING	SUBMITTEDREJECTED	CANCELLEDACCEPTEDWARNING	UNBLOCKEDBLOCKED
PROCESSINGr  FAILEDDONErP  rQ  s      r  parse_transaction_statuszfoxbit.parse_transaction_status  sN     $" # " #"
 
" &&999r  c                 J   |                      |d          }|                     |dd          }|                     |d          }d}||d         dk    rd}|                     |d	d
          }	|                     |d          }
|                     |d          }|
}|                     |          }|                     |                     |d                    }|                     |d          }|                     |          }|                     |          }|	|
t          j        |
|	          }t          j	        |	|          }| 
                    |	          || 
                    |          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#S )$Ndetails_cryptoreceiving_addressr  sn
withdrawalr   Dr!  r  0r   rx  r  r@  )r  r8  rC  r"  r-   txidtransaction_idrb  r#  r#  r  r  	addressToaddressFromr  r  tagTotagFromr  r8  rp   r  )r  r4   internal)r.  safe_string_2r,  r-  rs  r6  rs  r(   
string_sub
string_divr  )r  transactionr8  rg  r  cryptoDetailsr  rw  r  r  r   currencySymbolactualAmountr  rp   r@  rb  r#  feeRatefeeObjs                       r  r  zfoxbit.parse_transaction  s   {4DEE$$]4GI^__k400>besllD{E377!!+x88))+7HII..~>>..t/?/?W/U/UVV%%k<@@
OOJ//	<<	**?v1"-fc::L$S,77%%c**$%%g..
 


K
$"";55
 D$$]4DEE
 	

 
 t''^DD
 w
 
 4
 4##K1BCC
 T%%k3DEE
 t
 D
 d''//
 
  f!
" t#
$ )
 
 
 	
r  c                 @    dddddd}|                      |||          S )Nr  rG  transfer)
DEPOSITINGWITHDRAWINGTRADINGINTERNAL_TRANSFERINGOTHERSrP  )r  r  typess      r  parse_ledger_entry_typezfoxbit.parse_ledger_entry_type  s7    '($.#
 
 tT222r  itemc                 ,   |                      |d          }|                      |d          }|                     |          }|                      |d          }|                     |          }|                      |d          }|                     |          }	d}
|                     |d          }|}|                     |d          }|                     |d          |	d	}|d
k     rd}
|dz  }||||                     |          |
d d d ||	|||z
  |d|dS )Nuuidr@  reason_typerx  inr   ry  r  )r  r8  r   outr  )r-   r"  rb  r#  	directionr  referenceIdreferenceAccountr  r8  r   beforeafterrp   r  )r,  	parse8601r  r-  r1  rs  )r  r  r8  r-   	createdAtrb  
reasonTyper  exchangeSymbolr  r  r   
realAmountry  r  s                  r  parse_ledger_entryzfoxbit.parse_ledger_entry$  sL    dF++$$T<88	NN9--	%%dM::
++J77))$0ABB00@@	!!$11
""433$$T511&
 
 A::I"J"Y//" $& &
 
 	
r  GETc                 H   |d         }|d         }d|z   dz   |                      ||          z   }	|dk    rd}	d}| j        d         |         |	z   }
|                     ||                     |                    }|                                 }d}d}|d	k    rt          |                                          }t          |          }|dk    r|                     |          }|
d
|z   z  }
t          dt          |                    D ];}||         }| 
                    ||          }|||dz   |z   z  }||dz
  k     r|dz  }<|dk    s|dk    r|                     |          }d}||}ddi}|dk    r|                                  |                     |          |z   |	z   |z   |z   }|                     |                     |          |                     | j                  t"          j        d          }| j        |d<   |                     |          |d<   ||d<   |
|||dS )Nr   r  z/rest/r  rp   z/statusrr    r  ?=&POSTPUTzContent-Typezapplication/jsonro   hexzX-FB-ACCESS-KEYzX-FB-ACCESS-TIMESTAMPzX-FB-ACCESS-SIGNATURE)r  methodbodyheaders)implode_paramsrm   r  extract_paramsmillisecondsr  keysr*  	urlencoder)  r,  jsoncheck_required_credentialsr  hmacencoder   hashlibsha256r   )r  pathrr   r  r4  r  r  r2   urlPathfullPathr  rb  querysignatureQuery	paramKeysparamKeysLengthr7  keyvaluebodyToSignaturepreHash	signatures                         r  signzfoxbit.signT  sd   a&a&g%+d.A.A$.O.OOh HGiw'(264#6#6t#<#<==%%''	U??V[[]]++I!)nnO""v..sU{"1c)nn-- * *l((55$"cCi%&77N***"c)NVv99V$$D"O.
 i++---++I66?(J^[^mmG		$++g"6"6DK8P8PRYR`bghhI)-G%&/3/D/DY/O/OG+,/8G+,fdwOOOr  httpCodereasonr  r  r  r  c
                 6   |d S |                      |d          }
|                     |
d          }|                     |
d          }|                     |
d          }d}|r.t          dt	          |                    D ]}|||         z   dz   }|
| j        dz   |z   dz   |z   }|                     | j        d	         ||           |                     | j        d	         ||           |                     | j        d
         ||           t          |          d S )Nerrorr  detailsmessager  r    z
 details: r   r   )
r.  r,  r(  r)  r*  r-   throw_broadly_matched_exceptionrv   throw_exactly_matched_exceptionr   )r  r  r  r  r  r  r  r5  requestHeadersrequestBodyr  r  r  r  detailsStringr7  feedbacks                    r  handle_errorszfoxbit.handle_errors~  s4   4x11v....	22""5)44 	A1c'll++ A A -
 :S @w}w.=MH001I7T\]]]001I=Zbccc001I4QYZZZ)))tr  )N)NNN)J__name__
__module____qualname__r   r  r   rD  r   r   rH  strr   rP  r   r   rV  r   r^  r
   r   rf  r   rn  r  rv  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  dictr  r   r[  rN  r>  rI  rS  r  r   r  rs  r  r  r  r  intr  __classcell__)r  s   @r  r*   r*      sr	       v# v v v v v vp	 -/ q q: q q q qf *, i+ i+V i+ i+ i+ i+V 68 11 11 11F 11 11 11 11f 6:" #1 #17 #1 #1 #1 #1 #1J /1  [    8 @DB ,B ,BS ,B ,BS\ ,B ,B ,B ,B\ <@d[]  =  =  =S  =  =bfglbm  =  =  =  =D ?CQUdhqs *K *K *K *K3 *K^a *Kx|  ~B  yC *K *K *K *KX *, &) &) &) &) &) &)P 59tZ^gi Y Yc Y YTW Ynrsxny Y Y Y Y 7;\`ik Y Y Y3 YVY Yptuzp{ Y Y Y Y 9=4^bkm [ [# [S [X[ [rvw|r} [ [ [ [ GKY]lpy{ ' '3 ' 'SV 'fi '  AE  FK  AL ' ' ' '& mqy{ ;2 ;2 ;2I ;2Y ;2X] ;2fi ;2  AF ;2 ;2 ;2 ;2z FH D' D'$|*< D' D' D' D'L 9=R ( (S (# ( ( ( (: 59  c    > 8<B #0 #0C #0 #05 #0 #0 #0 #0J 04$UYbd 3= 3= 3=C 3=s 3=imnsit 3= 3= 3= 3=j 37TX\eg )= )=C )=s )=RU )=lpqvlw )= )= )= )=V =? > > >> > > > >@ 04$UYbd )E )E )EC )Es )Eimnyiz )E )E )E )EV 37TX\eg 8E 8EC 8Es 8ERU 8Elpq|l} 8E 8E 8E 8Et 48dY]fh  S  SV mqr}m~    & )+ %
 %
 %
 %
N fjx|  FH 5< 5<3 5< 5<9 5<I 5<_b 5<ru 5<  MR 5< 5< 5< 5<n QU]_ #0 #03 #0 #0 #0# #0do #0 #0 #0 #0J .2SW`b ? ?s ?# ?S ? ? ? ?8?4 ?F ? ? ? ?B
 
t 
V 
GZ 
 
 
 
 4  6    @
 
 
4 
 
 
 
     8	: 	: 	: 	: 	:3 3 3 3 3 3j
 
h 
 
 
 
:s : : : :(.
 .
x .
s .
be .
q| .
 .
 .
 .
`3 3 3.
 .
t .
x .
 .
 .
 .
`  b$T (P (P (P (PTc 3 S # X\ dg        r  r*   )/ ccxt.async_support.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  <module>r     s   6 5 5 5 5 5 , , , , , ,  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m  m       * * * * * * 0 0 0 0 0 0 - - - - - - - - - - - - . . . . . . ' ' ' ' ' ' & & & & & & . . . . . . ) ) ) ) ) ) . . . . . . 1 1 1 1 1 1 * * * * * * 9 9 9 9 9 9 % % % % % %t t t t tX{ t t t t tr  