
    eio                    h   d dl mZ d dlmZ d dlZd dlmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZ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/m0Z0 d dl1m2Z2  G d dee          Z3dS )    )Exchange)ImplicitAPIN)AnyBalances
CurrenciesCurrencyDepositAddressIntLedgerEntryLeverageMarketNumOrder	OrderBook	OrderSide	OrderTypePositionStrStringsTickerTickersFundingRateFundingRatesTradeTradingFeesTransactionMarketInterfaceTransferEntry)List)ExchangeError)PermissionDenied)ArgumentsRequired)
BadRequest)	BadSymbol)OperationRejected)InsufficientFunds)InvalidOrder)OrderNotFound)NotSupported)OperationFailed)RateLimitExceeded)	TICK_SIZE)Precisec                       e Zd Zdef fdZi fdZi fdefdZi fdefdZ	de
defdZi fdee         fdZd	e
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ded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ded	edefdZdi fdedefdZdede
d	edefdZdi fdefdZ ded	efdZ!di fdefdZ"di fdedefdZ#d Z$di fdede%fdZ&ded	ede'fd Z(dddi fde)dedefd!Z*ded	efd"Z+i fde,fd#Z-de,fd$Z.di fded%e/d&e0d'e1d(e2f
d)Z3di fded%e/d&e0d'e1d(e2f
d*Z4di fded%e/d&e0d'e1d(e2f
d+Z5ded,e
d	ede6fd-Z7d.e)fd/Z8d0 Z9di fd1ede)fd2Z:di fde)fd3Z;di fd4ee         de)fd5Z<di fd1ede)fd6Z=dddi fde)dededee6         fd7Z>dddi fde)dededee6         fd8Z?dddi fde)dededee6         fd9Z@dddi fde)dedefd:ZAi fd;ed'e1d<ed=edeBf
d>ZCded?e
d@edeBfdAZDdddi fd;e)dededeeE         fdBZFdedCe
d@edeEfdDZGdE ZHi fdeIfdFZJded	efdGZKdddi fd;e)dededeeL         fdHZMdddi fd;e)dededeeL         fdIZNdJ ZOdedKe
d@edeLfdLZPd.e)fdMZQi fd;edeRfdNZSded@edeRfdOZTdi fd;ed'e1dPedQe)deLf
dRZUdi fdSede)fdTZVdi fdUeWde)fdVZXi fdedeYfdWZZdedUe
d	edeYfdXZ[di fdedee\         fdYZ]dedZe
d	efd[Z^d\d]i ddfd^Z_d;eWd_ed`edaedbe
dcefddZ` xZaS )ftoobitreturnc                    |                      t          t          |                                           i ddddddg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d.dd/dd0dd1di d2dd3dd4dd5dd6dd7dd8dd9dd:dd;dd<dd=dd>dd?dd@ddAddBdddddddCdDdEdFdFdGdHdIdJgdKdLdMdNdOdPdQi dRdSdTdSdUdSdVdSdWdSdXdSdYdSdZdSd[dSd\dSd]dSd^d_d`d_dadSdbdSdcdSdddSii dedfdgdSdhdidjdidkdidldmdndmdodmdpdfdqdfdrdfdsdSdtdfdudSdvdidwdmdxdfdmdfdfdfdydidididzdSdSdSdSdzd{dSdSdSd|dididmdmdmdmdSd}d~dSiddGdddddddddddddddddt          di dt
          dt
          dt          dt          dt          dt
          dt
          dt
          dt          dt          dt          dt          dt          dt          dt          dt          dt          i dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          i dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt
          dt
          dt          i dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt
          dt
          dt          dt          dt          dt          i dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt
          dt          t          t          t          di dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          ddi dddddi 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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$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 id d d-d d d-d.          S (/  Nidr/   nameToobit	countriesKYversionv1	rateLimit   	certifiedFproThasCORSspotmarginswapfutureoptionborrowCrossMarginborrowIsolatedMarginborrowMargincancelAllOrderscancelOrdercancelOrderscreateOrderfetchAllGreeksfetchBalancefetchBidsAsksfetchBorrowInterestfetchBorrowRatefetchBorrowRateHistoriesfetchBorrowRateHistoryfetchBorrowRatesfetchBorrowRatesPerSymbolfetchCrossBorrowRatefetchCrossBorrowRatesfetchCurrenciesfetchDepositAddressfetchDepositsfetchFundingRateHistoryfetchFundingRatesfetchGreeksfetchIndexOHLCVfetchIsolatedBorrowRatefetchIsolatedBorrowRatesfetchLastPricesfetchLedgerfetchMarketsfetchMarkOHLCVfetchMyTrades
fetchOHLCVfetchOpenOrdersfetchOptionfetchOptionChain
fetchOrderfetchOrderBookfetchOrdersfetchStatusfetchTickers	fetchTimefetchTradesfetchVolatilityHistoryfetchWithdrawals)repayCrossMarginrepayIsolatedMarginsetMarginModetransferwithdrawurlszOhttps://github.com/user-attachments/assets/0c7a97d5-182c-492e-b921-23540c868e0ezhttps://api.toobit.com)commonprivatezhttps://www.toobit.com/z1https://toobit-docs.github.io/apidocs/spot/v1/en/z6https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/z'https://www.toobit.com/en-US/r?i=IFFPy0g?)urldiscountzhttps://www.toobit.com/fee)logoapiwwwdocreferralfeesr|   getzapi/v1/time   zapi/v1/pingzapi/v1/exchangeInfozquote/v1/depthzquote/v1/depth/mergedzquote/v1/tradeszquote/v1/klineszquote/v1/index/klineszquote/v1/markPrice/klineszquote/v1/markPricezquote/v1/indexzquote/v1/ticker/24hr(   zquote/v1/contract/ticker/24hrzquote/v1/ticker/pricezquote/v1/ticker/bookTickerzapi/v1/futures/fundingRatez!api/v1/futures/historyFundingRatezapi/v1/account   zapi/v1/account/checkApiKeyapi/v1/spot/ordergQ?api/v1/spot/openOrderszapi/v1/futures/openOrderszapi/v1/spot/tradeOrdersg33333 @zapi/v1/futures/historyOrderszapi/v1/account/tradeszapi/v1/account/balanceFlowzapi/v1/account/depositOrderszapi/v1/account/withdrawOrderszapi/v1/account/deposit/addresszapi/v1/subAccountzapi/v1/futures/accountLeverageapi/v1/futures/orderzapi/v1/futures/positionszapi/v1/futures/balance)zapi/v1/futures/userTradeszapi/v1/futures/balanceFlowzapi/v1/futures/commissionRatezapi/v1/futures/todayPnlgQ
@g
ףp=
@)zapi/v1/spot/orderTestr   r   zapi/v1/spot/batchOrderszapi/v1/subAccount/transferzapi/v1/account/withdrawzapi/v1/futures/marginTypezapi/v1/futures/leverageapi/v1/futures/batchOrdersz$api/v1/futures/position/trading-stopzapi/v1/futures/positionMarginzapi/v1/userDataStreamapi/v1/listenKey)r   r   r   r   zapi/v1/spot/cancelOrderByIdszapi/v1/futures/cancelOrderByIdsr   r   )r   postdeleteput
timeframes1m3m5m15m30m1h2h4h6h8h12h1d1w1M)r   r   r   r   r   r   r   r   r   r   r   r   r   r   precisionMode
exceptionsz-1000z-1001z-1002z-1003z-1004z-1006z-1007z-1014z-1015z-1016z-1020z-1021z-1022z-1100z-1101z-1102z-1103z-1104z-1105z-1106z-1111z-1112z-1114z-1115z-1116z-1117z-1118z-1119z-1120z-1121z-1125z-1127z-1128z-1130z-1132z-1133z-1134z-1135z-1136z-1137z-1138z-1139z-1140z-1141z-1142z-1143z-1144z-1145z-1146z-1147z-1193z-1194z-1195z-1196z-1197z-1198z-1199z-1200z-1201z-1202z-1203z-1206z-2010z-2011z-2013z-2014z-2015z-2016z-3050z-3101z-3102z-3103z-3105z-3107z-3108z-3109z-3110z-3116z-3117z-3120z-3124z-3125z-3126z-3127z-3128)z-3129z-3130z-3131zUnknown order sentzDuplicate order sentzMarket is closedz5Account has insufficient balance for requested actionz/Market orders are not supported for self symbolz0Iceberg orders are not supported for self symbolz2Stop loss orders are not supported for self symbolz8Stop loss limit orders are not supported for self symbolz4Take profit orders are not supported for self symbolz:Take profit limit orders are not supported for self symbolzQTY is zero or lesszIcebergQty exceeds QTYz'This action disabled is on self accountzUnsupported order combinationzOrder would trigger immediatelyz6Cancel order is invalid. Check origClOrdId and orderIdz&Order would immediately match and take)exactbroadcommonCurrenciesoptionsMAINFUTURES)r?   rA   BTCERC20ETHBEP20BSCTRC20TRXSOLMATICARBONEARBITRUMBASETONAVAXCDOGEXRPDOTADALTCAPTATOMALGONEARXLMSUIETCEOSWAVESICPONE)
r   r   r   r   r   r   r   r   r   r   )r   r   )defaultTypeaccountsByTypenetworksnetworksByIdfeatures)IOCFOKPOGTD)
marginModetriggerPricetriggerPriceTypetriggerDirectionstopLossPricetakeProfitPriceattachedStopLossTakeProfittimeInForcehedgedtrailingleveragemarketBuyRequiresPricemarketBuyByCostselfTradePreventioniceberglimiti  i )r   r   daysBack	untilDayssymbolRequired)r   triggerr   r   )r   r   r   r   r   i  )r   r   r   r   r   r   r   )	sandboxrJ   createOrdersrd   rc   rh   re   rj   fetchClosedOrdersr   )linearinverse)r?   forDerivativesrA   rB   )deep_extendsuperr/   describer,   r*   r!   r+   r#   r%   r'   r    r&   r)   r(   )self	__class__s    I/var/www/html/volatility/venv/lib/python3.11/site-packages/ccxt/toobit.pyr   ztoobit.describe   s   fd 3 3 < < > > SA
(SA
HSA
 $SA
 t	SA

 SA
 SA
 4SA
  999 %9 	9
 %9 %9 $U9 '9 9 "49 t9 9 t9 !%9 9   !9" &u#9 9$ "5%9& +E'9( )%)9* #E+9, ,U-9. '/90 (192 "4394 &t596  798 *499: $T;9< u=9> "4?9@ *5A9B +EC9D "4E9 9 9F tG9H I9J !$K9L  M9N dO9P "4Q9R uS9T #EU9V dW9X !$Y9Z t[9\ t]9^ _9` Ta9b tc9d )%e9f #Dg9 9h %*',!%  q9 9 9SA
D i67  1GL
 E #  5 ESA
f  %q%q .q )!	
 0 *1 *1 0 4Q -a )! / 8 0 5a  5a!" <Q#,(!4a ,X 1(	
 4X 28 7 0 5a 7 8 9! ,Q 9!  /!" 3H#$ 1!%& 6>679:34-  2 2:-5083;673456346>@H9:12,- " .6082:6>8@;C,-  +Ae5 5-L LgSA
@  ASA
` YaSA
b Z_Z_Z -Z .	Z
 ZZ _Z _Z _Z .Z .Z .Z .Z .Z ZZ ZZ  Z!Z" Z#Z Z$ Z%Z& Z'Z( Z)Z* Z+Z, .-Z. Z/Z0 Z1Z2 Z3Z4 Z5Z6 \7Z8 \9Z: Z;Z< Z=Z> .?Z@ .AZB ZCZD ZEZ Z ZF .GZH .IZJ .KZL .MZN .OZP .QZR .SZT .UZV .WZX \YZZ \[Z\ \]Z^ ._Z` .aZb _cZd _eZf .gZ Z Zh .iZj .kZl .mZn .oZp .qZr .sZt .uZv .wZx .yZz .{Z| .}Z~ _Z@ _AZB \CZD -EZF -GZH ZIZ Z ZL ]MZN .OZP .QZR ZSZT .UZV .WZX .YZZ .[Z\ .]Z^ ._Z` .aZb .cZd .eZf .gZh .iZj _kZl .mZ Zn (.)sZ Z Zv(-*L '(9 LM^	
 FGX GHY IJ[ OPa KL] QRc *: -.? >?O 4Z 67H  MN_!" =>O#yo ocSA
B	 C	SA
D	 %"%# #5U 5 U	
 U 5 W j F 5 W F 5 5 5  5!" 5#$ #""    $  7  > #$! !I( (E	SA
V
 $&+(,,0,1).+06:#'#'"&#(	( ( #($)$)27+0/4#()$ $, %)# ',!%$*%+*.& & ',#($)*/	# # ',!%#($)*/( ( ',!$$*%+#($)*/$ $ *.s: :x #D# ## 
 ## GG GW
SA
 S S S	    c                 <    |                      |          }dddd|dS )a[  
        the latest known information on the availability of the exchange API

        https://toobit-docs.github.io/apidocs/spot/v1/en/#test-connectivity

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `status structure <https://docs.ccxt.com/?id=exchange-status-structure>`
        okN)statusupdatedetary   info)commonGetApiV1Pingr   paramsresponses      r   fetch_statusztoobit.fetch_status  s5     **622
 
 	
r   c                 X    |                      |          }|                     |d          S )a`  
        fetches the current integer timestamp in milliseconds from the exchange server

        https://toobit-docs.github.io/apidocs/spot/v1/en/#check-server-time

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns int: the current integer timestamp in milliseconds from the exchange server
        
serverTime)commonGetApiV1Timesafe_integerr   s      r   
fetch_timeztoobit.fetch_time  s/     **622   <888r   c                 
   |                      |          }|| j        d<   |                     |dg           }i }t          dt	          |                    D ],}||         }|                     |          }|d         }|||<   -|S )z
        fetches all available currencies on an exchange
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an associative dictionary of currencies
        exchangeInfocoinsr   code)commonGetApiV1ExchangeInfor   	safe_listrangelenparse_currency)	r   r   r   r   resulticoinparsedr   s	            r   fetch_currenciesztoobit.fetch_currencies  s     226::'/^$B x"55q#e**%% 	" 	"A8D((..F&>D!F4LLr   rawCurrencyc                    |                      |d          }|                     |          }i }|                     |d          }t          dt	          |                    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coinId
chainTypesr   	chainTypeallowDepositallowWithdrawwithdrawFeeminDepositQuantityminmaxminWithdrawQuantitymaxWithdrawQuantity)depositru   )
r2   networkr@   r  ru   activefee	precisionlimitsr   coinFullName)amountru   )r2   r   r3   typer  r  ru   r  r  r  r   r   )	safe_stringsafe_currency_coder  r  r  network_id_to_code	safe_boolsafe_numbersafe_currency_structure)
r   r
  r2   r   r   rawNetworksj
rawNetwork	networkIdnetworkCodes
             r   r  ztoobit.parse_currencyg  s   k844&&r**nn[,??q#k**++ 	 	A$QJ(([AAI11)<<K&>>*nEE NN:GG''
MBB!  $//
<PQQ#   
  $//
<QRR#//
<QRR! !	 	 #'% %H[!!* ++$$[.AA~~k>BB{ODD   
   	 	 !+-
 -
   	r   c                    |                      | j        d          }|d| j        d<   n|                     |          }|                     |dg           }|                     |dg           }|                     ||          }g }t          dt          |                    D ]4}||         }|                     |          }	|                    |	           5|S )az  
        retrieves data on all markets for toobit

        https://toobit-docs.github.io/apidocs/spot/v1/en/#exchange-information
        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#exchange-information

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: an array of objects representing market data
        r   Nsymbols	contractsr   )		safe_dictr   r   r  array_concatr  r  parse_marketappend)
r   r   r   r-  r.  allr  r  marketr  s
             r   fetch_marketsztoobit.fetch_markets  s     >>$,??+/DL((66v>>HB ..9b99NN8["==	33q#c((## 	" 	"AVF&&v..FMM&!!!!r   r4  c                    |                      |d          }|                      |d          }|                      |d          }|                    d          }|d         }|                     |          }|                     |          }|                      |d          }	|                     |	          }
|                      |d          }|dk    }|                     |d	g           }|                     |d
          }|                     |di           }|                     |di           }|                     |di           }|dz   |z   }d|v }|                     |dd          }|r|d|
z   z  }|                     i d|d|d|d|d|
d|d|d|	d|rdndd| ddd|ddd dd!|d"|d#|r| nd |r|n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symbol	baseAsset
quoteAsset-r   marginTokenr   TRADINGfilters
filterTypePRICE_FILTERLOT_SIZEMIN_NOTIONAL/contractMultiplier	isInverser   :r2   basequotesettlebaseIdquoteIdsettleIdr   rA   r?   r@   FrB   rC   r  contractr   stepSizetickSize)r  pricer  minQtymaxQtyminPricemaxPriceminNotional)r   r  rO  cost)
r   contractSizeexpiryexpiryDatetimestrike
optionTyper  r  createdr   )	r!  splitr"  r  index_byr/  safe_bool_2safe_market_structurer%  )r   r4  r2   rI  rJ  	basePartsbaseIdCleanrF  rG  rK  rH  r   r  r=  filtersByTypepriceFilterlotSizeFilterminNotionalFilterr7  
isContractr   s                        r   r1  ztoobit.parse_market6  s   fh//!!&+66""6<88LL%%	l&&{33''00##FM::((22!!&(33I%..B77g|<<nn]NBGG}j"EE NN=."MMe#*f4
""6;	BB 	#cFl"F)) 0+
"0+
f0+
 D0+
 U	0+

 f0+
 f0+
 w0+
 0+
 j4FFf0+
 
N0+
 e0+
 J0+
 e0+
 e0+
 f0+
  
!0+
" Z9'kkT#0+
$ #-6ww$ ,,V5IJJ"**=*EE))+zBB    
  ++M8DD++M8DD 
  ++KDD++KDD 
  ++,=}MM  $ _0+
 0+
 0+
 0 0 0	r   Nr7  r   c                 2   |                                   |                     |          }d|d         i}|||d<   |                     |                     ||                    }|                     |d          }|                     ||d         |dd          S )a  
        fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data

        https://toobit-docs.github.io/apidocs/spot/v1/en/#order-book
        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#order-book

        :param str symbol: unified symbol of the market to fetch the order book for
        :param int [limit]: the maximum amount of order book entries to return
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/?id=order-book-structure>` indexed by market symbols
        r7  r2   Nr   tba)load_marketsr4  commonGetQuoteV1Depthextendr   parse_order_book)r   r7  r   r   r4  requestr   	timestamps           r   fetch_order_bookztoobit.fetch_order_book~  s     	V$$fTl
 $GG--dkk'6.J.JKK8 %%h44	$$Xvh/?CQTUUUr   sincec                     |                                   |                     |          }d|d         i}|||d<   |                     |                     ||                    }|                     ||||          S )a~  
        get a list of the most recent trades for a particular symbol

        https://toobit-docs.github.io/apidocs/spot/v1/en/#recent-trades-list
        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#recent-trades-list

        :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 number 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>`
        r7  r2   Nr   )rk  r4  commonGetQuoteV1Tradesrm  parse_trades)r   r7  rr  r   r   r4  ro  r   s           r   fetch_tradesztoobit.fetch_trades  s     	V$$fTl
 $GG..t{{7F/K/KLL   65%@@@r   tradec                    |                      |dd          }|                     |dd          }|                     |dd          }|                     |d          }d }|                     |d          }||                     |d	          }	|	|	 }||rd
}n
d}n|rd}nd
}|                     |d          }
|                     |d          }d }||                     |
          |d}|                     |d          }d }||rdnd}|                     d |          }|d         }|                     |||                     |          ||                     |dd          |                     |d          d |||d ||d|          S )Nrh  timeprO  qqtyisBuyeribmmsellbuy	feeCoinId	feeAmount)currencyrU  isMakermakertakerr7  r2   vorderId)r   rp  datetimer7  r2   orderr   sider  rO  rU  takerOrMakerr  )safe_integer_2safe_string_2r$  r!  r"  safe_market
safe_tradeiso8601)r   rw  r4  rp  priceStringamountStringr}  r  isBuyerMakerisBuyerTakerfeeCurrencyIdr  r  r  r  r7  s                   r   parse_tradeztoobit.parse_trade  s   T ''sF;;	((W==))%e<<..	22~~eU33>>%55L'#//#  ((<<$$UK88	  33MBB! C ..	22&-:777L!!$//!"Y//$$UD#66%%eY77" ( 
  
   	r   r   c                    |                                   |                     |          }|d         |                     | j        ||          d}|||d<   |                     |d          }||                     |d          }||d<   |||d<   d}	d}
|                     |dd	          \  }
}|
d
k    r*|                     |                     ||                    }	nY|
dk    r*| 	                    |                     ||                    }	n)| 
                    |                     ||                    }	|                     |	||||          S )a  
        fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market

        https://toobit-docs.github.io/apidocs/spot/v1/en/#kline-candlestick-data
        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#kline-candlestick-data

        :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
        r2   )r7  intervalN	startTimeuntilendTimer   rd   rO  indexmark)rk  r4  r!  r   r   omithandle_option_and_paramscommonGetQuoteV1IndexKlinesrm  commonGetQuoteV1MarkPriceKlinescommonGetQuoteV1Klinesparse_ohlcvs)r   r7  	timeframerr  r   r   r4  ro  r  r   endpoints              r   fetch_ohlcvztoobit.fetch_ohlcv-  sq    	V$$Tl(()YOO
 
 #(GK !!&'22YYvw//F!&GI$GG88wWW&w77GV8T8TUUHH8 ;;DKKQW<X<XYYHH& 224;;w3O3OPPH$   69eUKKKr   c           
         |                      |g d          |                     |g d          |                     |g d          |                     |g d          |                     |g d          |                     |g d          gS )N)r   ry  rh  )r   openo)   highh)   lowl)   closec)r   volumer  )safe_integer_nsafe_number_n)r   ohlcvr4  s      r   parse_ohlcvztoobit.parse_ohlcv  s    '7'7'788u&6&6&677u&6&6&677uooo66u&7&7&788u&8&8&899
 	
r   r-  c                    |                                   |                     |          }d}d}i }|K|                     |d          }|                     |          }t	          |          }|dk    r|d         |d<   |                     d||          \  }}d}|dk    r*|                     |                     ||                    }n)|                     |                     ||                    }| 	                    |||          S )a  
        fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market

        https://toobit-docs.github.io/apidocs/spot/v1/en/#24hr-ticker-price-change-statistics
        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#24hr-ticker-price-change-statistics

        :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   r   r2   r7  rl   r?   )
rk  market_symbolsr!  r4  r  handle_market_type_and_paramscommonGetQuoteV1Ticker24hrrm  "commonGetQuoteV1ContractTicker24hrparse_tickers)	r   r-  r   r   r4  ro  r7  lengthr   s	            r   fetch_tickersztoobit.fetch_tickers  s    	%%g..%%gq11F[[((F\\F{{$*4L!99.&RXYYf6>>66t{{7F7S7STTHH>>t{{7TZ?[?[\\H" !!(GV<<<r   tickerc                    |                      |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|          S )Nsrh  r  r7  rp  r  r  r  r  r  bid	bidVolumeask	askVolumevwapr  r  r  lastpreviousClosechangepc
percentagepcpaverager  qv)
baseVolumequoteVolumer   )r!  r  r   safe_tickerr  )r   r  r4  marketIdrp  r  s         r   parse_tickerztoobit.parse_ticker  s   ##FC00!!(F33%%fc22	,, !
fX&!
!
 Y//!
 D$$VS11	!

 4##FC00!
 4!
 !
 4!
 !
 D!
 D$$VS11!
 T!
 D!
 T!
 d&&vt44!
  $**6599!!
" t#!
$ **6377++FD99)!
 !
 !
* +  	r   c                 P   |                                   |                     |          }i }|;t          |          }|dk    r&|                     |d                   }|d         |d<   |                     |                     ||                    }|                     ||          S )a  
        fetches the last price for multiple markets

        https://toobit-docs.github.io/apidocs/spot/v1/en/#symbol-price-ticker
        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#symbol-price-ticker

        :param str[]|None symbols: unified symbols of the markets to fetch the last prices
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a dictionary of lastprices structures
        Nr   r   r2   r7  )rk  r  r  r4  commonGetQuoteV1TickerPricerm  parse_last_pricesr   r-  r   ro  r  r4  r   s          r   fetch_last_pricesztoobit.fetch_last_prices  s     	%%g..\\F{{WQZ00$*4L!33DKK4P4PQQ %%h888r   c                     |                      |d          }|                     ||          }|d         d d |                     |d          d |dS )Nr  r7  rO  )r7  rp  r  rO  r  r   )r!  r  safe_number_omit_zero)r   entryr4  r  s       r   parse_last_priceztoobit.parse_last_price  sb    ##E3//!!(F33X&//w??
 
 	
r   c                 P   |                                   |                     |          }i }|;t          |          }|dk    r&|                     |d                   }|d         |d<   |                     |                     ||                    }|                     ||          S )aA  
        fetches the bid and ask price and volume for multiple markets

        https://toobit-docs.github.io/apidocs/spot/v1/en/#symbol-order-book-ticker
        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#symbol-order-book-ticker

        :param str[] [symbols]: unified symbols of the markets to fetch the bids and asks for, all markets 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   r   r2   r7  )rk  r  r  r4   commonGetQuoteV1TickerBookTickerrm  parse_bids_asks_customr  s          r   fetch_bids_asksztoobit.fetch_bids_asks  s     	%%g..\\F{{WQZ00$*4L!88Wf9U9UVV **8W===r   c                 *   g }t          dt          |                    D ]H}|                     ||                   }|                     ||          }|                    |           I|                     |          }|                     |d|          S )Nr   r7  )r  r  parse_bid_ask_customrm  r2  r  filter_by_array)r   tickersr-  r   resultsr  parsedTickerr  s           r   r  ztoobit.parse_bids_asks_custom0  s    q#g,,'' 	# 	#A44WQZ@@L[[v66FNN6""""%%g..##GXw???r   c           	         |                      |d          |                      |d          |                     |d          |                     |d          |                     |d          |                     |d          |dS )Nrh  r  ri  bqrj  aq)rp  r7  r  r  r  r  r   )r!  r%  )r   r  s     r   r  ztoobit.parse_bid_ask_custom9  s    ))&#66&&vs33##FC00))&$77##FC00))&$77
 
 	
r   c                 P   |                                   |                     |          }i }|;t          |          }|dk    r&|                     |d                   }|d         |d<   |                     |                     ||                    }|                     ||          S )a  
        fetch the funding rate for multiple markets

        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#funding-rate

        :param str[]|None symbols: list of unified market symbols
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `funding rates structures <https://docs.ccxt.com/?id=funding-rates-structure>`, indexe by market symbols
        Nr   r   r2   r7  )rk  r  r  r4   commonGetApiV1FuturesFundingRaterm  parse_funding_ratesr  s          r   fetch_funding_ratesztoobit.fetch_funding_ratesD  s     	%%g..\\F{{WQZ00$*4L!88Wf9U9UVV ''':::r   c                 J   |                      |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 iS )Nr7  ratenextFundingTimer   	markPrice
indexPriceinterestRateestimatedSettlePricerp  r  previousFundingRatenextFundingRatepreviousFundingTimestampnextFundingTimestamppreviousFundingDatetimenextFundingDatetimefundingRatefundingTimestampfundingDatetimer  )r!  safe_symbolr%  r   r  )r   rL  r4  r  r7  r  nextFundingRateTimestamps          r   parse_funding_rateztoobit.parse_funding_ratea  sI   ##Hh77!!(F33**8V<<#'#4#4X?P#Q#Q 
H
f
 
 $	

 D
 #D
 
 
 "4
 t
 '
 #D
 &t
 "4
 ?
   8!
" t||,DEE#
$ %
 
 	
r   c                 h   |                                   d}|                     |dd          \  }}|r|                     d|||d|          S |                     |          }d|d         i}|||d<   |                     |                     ||                    }|                     ||||          S )	a  
        fetches historical funding rate prices

        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#get-funding-rate-history

        :param str symbol: unified symbol of the market to fetch the funding rate history for
        :param int [since]: timestamp in ms of the earliest funding rate to fetch
        :param int [limit]: the maximum amount of `funding rate structures <https://docs.ccxt.com/?id=funding-rate-history-structure>` to fetch
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: timestamp in ms of the latest funding rate to fetch
        :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
        :returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/?id=funding-rate-history-structure>`
        FrY   paginater   r7  r2   Nr   )rk  r  "fetch_paginated_call_deterministicr4  'commonGetApiV1FuturesHistoryFundingRaterm  parse_funding_rate_histories)	r   r7  rr  r   r   r  r4  ro  r   s	            r   fetch_funding_rate_historyz!toobit.fetch_funding_rate_history{  s     	88AZ\fgg& 	z::;TV\^cejlprxyyyV$$fTl
 $GG??GU[@\@\]] 0065%PPPr   c                     |                      |d          }|                     |d          }||                     ||          |                     |d          ||                     |          dS )N
settleTimer7  
settleRate)r   r7  r  rp  r  )r   r!  r  r%  r  )r   rL  r4  rp  r  s        r   parse_funding_rate_historyz!toobit.parse_funding_rate_history  sv    %%h==	##Hh77&&x88++HlCC"Y//
 
 	
r   c                    |                                   d}d}|                     dd|          \  }}|                     |ddg          r|                                 }n|                                 }|                     |          S )a  
        query for balance and get the amount of funds available for trading or funds locked in orders

        https://toobit-docs.github.io/apidocs/spot/v1/en/#account-information-user_data
        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#futures-account-balance-user_data

        :param dict [params]: extra parameters specific to the exchange API endpointinvalid
        :returns dict: a `balance structure <https://docs.ccxt.com/?id=balance-structure>`
        NrL   rA   rB   )rk  r  in_arrayprivateGetApiV1FuturesBalanceprivateGetApiV1Accountparse_balance)r   r   r   
marketTypes       r   fetch_balanceztoobit.fetch_balance  s     	
!??PTV\]]
F==fh%788 	599;;HH 2244H  !!(+++r   c                    |d d d}|                      |d|          }t          dt          |                    D ]}||         }|                     |                     |d                    }|                                 }|                     |dd          |d<   |                     |dd          |d<   |                     |d	          |d
<   |||<   |                     |          S )N)r   rp  r  balancesr   assetfreeavailableBalancetotalbalancelockedused)r  r  r  r"  r!  accountr  safe_balance)r   r   r  r  r  r  r   r  s           r   r  ztoobit.parse_balance  s    
 

 >>(JAAq#h--(( 	# 	#AqkG**4+;+;GW+M+MNNDllnnG"00&BTUUGFO#11'7INNGG"..wAAGFO"F4LL  (((r   r   r  r  rO  c                    |                                   |                     |          }i }d}	|d         rG|                     ||||||          \  }}|                     |                     ||                    }	nF|                     ||||||          \  }}|                     |                     ||                    }	|                     |	|          S )a  
        create a trade order

        https://toobit-docs.github.io/apidocs/spot/v1/en/#new-order-trade
        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#new-order-trade

        :param str symbol: unified symbol of the market to create an order in
        :param str type: 'market', 'limit'
        :param str side: 'buy' or 'sell'
        :param float amount: how much of currency you want to trade in units of base currency
        :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
        Nr?   )rk  r4  create_order_requestprivatePostApiV1SpotOrderrm  create_contract_order_requestprivatePostApiV1FuturesOrderparse_order)
r   r7  r   r  r  rO  r   r4  ro  r   s
             r   create_orderztoobit.create_order  s     	V$$&> 	W"77dFTY[abbOGV55dkk'66R6RSSHH"@@tU[]bdjkkOGV88Wf9U9UVVH0 &111r   c                    |                      |          }|d         }||                                d}	||                     ||          |	d<   d }
|                     |d          \  }
}|dk    r9|
|dk    rt	          | j        dz             |                     ||
          |	d<   n|                     ||          |	d<   d }|                     |dk    d	|          \  }}|rd
|	d<   n|                                |	d<   |	|gS )Nr2   )r7  r  rO  rU  r4  r  z; createOrder() requires params["cost"] for market buy orderquantityFLIMIT_MAKERr   )	r4  upperprice_to_precisionhandle_param_stringr"   r2   cost_to_precisionamount_to_precisionhandle_post_only)r   r7  r   r  r  rO  r   r4  r2   ro  rU  
isPostOnlys               r   r!  ztoobit.create_order_request  s0   V$$D\JJLL
 
 #66vuEEGG//??f8|'2o(oppp&*&<&<VT&J&J
##"&":":66"J"JGJ
!22483CUFSS
F 	++GFOO"jjllGFO  r   c                    |                      |          }|d         |                     ||          d}d }	|                     |d          \  }	}|dk    r|	rdnd}n|dk    r|	rdnd	}||d
<   ||                     ||          |d<   |                     |ddg          r1|                                |d<   |                     ||          |d<   n|dk    r
d|d<   d|d<   d }
|                     |dk    d|          \  }
}|
rd|d<   |                     ||          }|d         }|d         }|||d<   |                     |d          }|                     |d          }|d u}|d u}ddd}|r| 	                    |d          |d<   | 	                    |d          }|d|d<   |                     ||          |d<   | 
                    |d           }|| 
                    |||          |d!<   |                     |d          }|r| 	                    |d          |d<   | 	                    |d          }|d|d"<   |                     ||          |d#<   | 
                    |d           }|| 
                    |||          |d$<   |                     |d          }d%|vr|                                 |d%<   ||gS )&Nr2   )r7  r(  
reduceOnlyr  
SELL_CLOSEBUY_OPENr  	BUY_CLOSE	SELL_OPENr  rO  r   LIMITr   r4  MARKET	priceTypeFr)  r   r   r  	stopPricestopLoss
takeProfit
MARK_PRICECONTRACT_PRICE)r  r  r   slOrderTypeslLimitPricer   slTriggerBytpOrderTypetpLimitPricetpTriggerBynewClientOrderId)r4  r.  handle_param_boolr+  r  r*  r/   handle_trigger_prices_and_paramsr/  
safe_valuer!  r  uuid)r   r7  r   r  r  rO  r   r4  ro  r2  r0  valuesr   r;  r<  hasStopLosshasTakeProfittriggerPriceTypes
limitPricer   s                       r   r#  z$toobit.create_contract_order_request7  sY   V$$Tl00@@
 
 
!33FLII
F5==#-=<<:DDV^^",=;;+D#66vuEEGG==122 	,"jjllGFO#66vuEEGGX%GFO#+GK 
!22483CUFSS
F 	3%2GM"66vvFFay##/GK >>&*55^^FL99
t+#4/ $
 
  		3"&//(N"K"KGJ7;;J%)0&*.*A*A&**U*U'#//:LMM+)-)9)9:KM]_o)p)p&YYvz22F 		5$(OOJ$O$OGL!W==J%)0&*.*A*A&**U*U'#//
<NOO+)-)9)9:KM]_o)p)p&YYv|44F"f,,*.))++G&'  r   r  c                 N   |                      |dd          }|                     |d          }|                     ||          }|                     |d          }|                     |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k    d|d|                     |                     |d                    d|d|                     |                     |d                    d|                     |d          |                     |d          |                     |d          d d d d d d d d	|          S )NtransactTimery  r7  r   r  r:  z0.0r   r2   r  clientOrderIdrp  r  lastTradeTimestamplastUpdateTimestamp
updateTimer   r   postOnlyr)  rO  r   rU  cumulativeQuoteQtyr  avgPriceorigQtyexecutedQty)	r  filled	remainingtradesr  r   r2  r   r   )
r  r!  r  safe_string_lower	omit_zero
safe_orderr  r   parse_order_statusparse_order_type)r   r  r4  rp  r  rawTyperawSideLowerr   s           r   r%  ztoobit.parse_orderu  s   v ''~vFF	##E844!!(F33""5&11--eV<<~~d&6&6uk&J&JKK5  L  
E 
$""5)44 
 T--e_EE 
 	 

 Y// 
 !$ 
 "4#4#4UL#I#I 
 d--d.>.>uh.O.OPP 
 fX& 
 D))'22 
 4++E=AA 
 M1 
 L 
 T^^D$4$4UG$D$DEE 
 L 
  DNN4#3#3E;O#P#PQQ! 
" t''z::# 
$ &&ui88&&um<<5 
  
  
6 7  	r   r   c                 D    dddddddd}|                      |||          S )Nr  closedcanceled)PENDING_NEWNEWPARTIALLY_FILLEDFILLEDPENDING_CANCELCANCELEDREJECTEDr!  r   r   statusess      r   r`  ztoobit.parse_order_status  s=    ! &(""
 
 &&999r   c                 <    dddd}|                      |||          S )Nr4  r   )r8  r7  r)  rn  ro  s      r   ra  ztoobit.parse_order_type  s1    "
 

 &&999r   r2   c                    i }|                      |d          ||d<   d}| |                     |          }|d         |d<   d}|                     d||d          \  }}|dk    rt          | j        dz             d}|d	k    r*|                     |                     ||                    }n)|                     |                     ||                    }|                     |                      |d
                    }|dk    r3t          | j        dz   |z   dz   | 
                    |          z             |                     ||          S )a  
        cancels an open order

        https://toobit-docs.github.io/apidocs/spot/v1/en/#cancel-order-trade
        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#cancel-order-trade

        :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>`
        rQ  Nr  r2   r7  rH   nonezf cancelOrder() requires a symbol argument or the "defaultType" parameter to be set to "spot" or "swap"r?   r   r  z order z can not be canceled, )r!  r4  r  r"   r2   privateDeleteApiV1SpotOrderrm  privateDeleteApiV1FuturesOrderr`  r(   jsonr%  )	r   r2   r7  r   ro  r4  r  r   r   s	            r   cancel_orderztoobit.cancel_order  sv    FO44<!#GI[[((F &tGH
!??vW]_eff
F#DG  /W  %W  X  X  X77GV8T8TUUHH::4;;wPV;W;WXXH(()9)9(H)M)MNNV) 3b 8;S SVZV_V_`hViVi ijjj&111r   c                    |                                   i }d}| |                     |          }|d         |d<   d}|                     d||d          \  }}|dk    rt          | j        dz             d}|dk    r*|                     |                     ||                    }n)|                     |                     ||                    }|                     d|i          gS )	a  
        cancel all open orders in a market

        https://toobit-docs.github.io/apidocs/spot/v1/en/#cancel-all-open-orders-trade
        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#cancel-orders-trade

        :param str symbol: unified symbol
        :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>`
        Nr2   r7  rG   rs  zj cancelAllOrders() requires a symbol argument or the "defaultType" parameter to be set to "spot" or "swap"r?   r   )	rk  r4  r  r"   r2    privateDeleteApiV1SpotOpenOrdersrm  $privateDeleteApiV1FuturesBatchOrdersr_  )r   r7  r   ro  r4  r  r   s          r   cancel_all_ordersztoobit.cancel_all_orders  s    	[[((F &tGH
!??@QSY[acijj
F#DG  /[  %[  \  \  \<<T[[RX=Y=YZZHH
 @@WV\A]A]^^H
 OO  
 	
r   idsc                    |                                   d                    |          }d|i}d}||                     |          }d}|                     d||d          \  }}|dk    rt	          | j        dz             d}|dk    r*|                     |                     ||                    }n)|                     |                     ||                    }| 	                    |dg           }	| 
                    |	|          S )	a  
        cancel multiple orders

        https://toobit-docs.github.io/apidocs/spot/v1/en/#cancel-multiple-orders-trade
        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#cancel-multiple-orders-trade

        :param str[] ids: order ids
        :param str [symbol]: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an list of `order structures <https://docs.ccxt.com/?id=order-structure>`
        ,r|  NrI   rs  zg cancelOrders() requires a symbol argument or the "defaultType" parameter to be set to "spot" or "swap"r?   r  )rk  joinr4  r  r"   r2   &privateDeleteApiV1SpotCancelOrderByIdsrm  )privateDeleteApiV1FuturesCancelOrderByIdsr  parse_orders)
r   r|  r7  r   	idsStringro  r4  r  r   r  s
             r   cancel_ordersztoobit.cancel_orders1  s+    	HHSMM	9
 [[((F
!??PVX^`fgg
F#DG  /X  %X  Y  Y  YBB4;;wX^C_C_``HH
 EEdkkRY[aFbFbccH" (B77  000r   c                 t   |t          | j        dz             |                                  d|i}|                     |          }d}|d         r*|                     |                     ||                    }n)|                     |                     ||                    }|                     ||          S )a  
        fetches information on an order made by the user

        https://toobit-docs.github.io/apidocs/spot/v1/en/#query-order-user_data
        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#query-order-user_data

        :param str id: the order id
        :param str symbol: unified symbol of the market the order was made in
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: An `order structure <https://docs.ccxt.com/?id=order-structure>`
        Nz( fetchOrder() requires a symbol argumentr  r?   )r"   r2   rk  r4  privateGetApiV1SpotOrderrm  privateGetApiV1FuturesOrderr%  )r   r2   r7  r   ro  r4  r   s          r   fetch_orderztoobit.fetch_orderd  s     >#DG.X$XYYYr
 V$$&> 	V44T[[&5Q5QRRHH77GV8T8TUUH: &111r   c                    |                                   i }d}| |                     |          }|d         |d<   |||d<   d}|                     d||          \  }}d}|dk    r*|                     |                     ||                    }n)|                     |                     ||                    }|                     ||||          S )a  
        fetches information on multiple orders made by the user

        https://toobit-docs.github.io/apidocs/spot/v1/en/#current-open-orders-user_data
        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#query-current-open-order-user_data

        :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>`
        Nr2   r7  r   rj   r?   )rk  r4  r  privateGetApiV1SpotOpenOrdersrm   privateGetApiV1FuturesOpenOrdersr  	r   r7  rr  r   r   ro  r4  r  r   s	            r   fetch_open_ordersztoobit.fetch_open_orders  s     	[[((F &tGH$GG
!??vW]^^
F99$++gv:V:VWWHH: <<T[[RX=Y=YZZH  65%@@@r   c                    |                                   i }|||d<   |||d<   |                     d||          \  }}d}| |                     |          }|d         |d<   d}|                     d||          \  }}d}|dk    r|                     |          }nt          | j        d	z   |z   d
z             |                     ||||          S )a<  
        fetches information on multiple orders made by the user

        https://toobit-docs.github.io/apidocs/spot/v1/en/#all-orders-user_data

        :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>`
        Nr   r  r  r2   r7  rj   r?   $ fetchOrders() is not supported for  markets)rk  handle_until_optionr4  r  privateGetApiV1SpotTradeOrdersr)   r2   r  r  s	            r   fetch_ordersztoobit.fetch_orders  s    	$GG#(GK 229gvNN[[((F &tGH
!??vW]^^
F::7CCHH: tw)OOR\\_iijjj  65%@@@r   c                    |                                   i }d}| |                     |          }|d         |d<   |||d<   |                     d||          \  }}d}|                     d||          \  }}d}|dk    rt	          | j        dz   |z   d	z             |                     |          }g }	t          d
t          |                    D ]}
|		                    d||
         i            | 
                    |	|||          S )aR  
        fetches information on multiple closed orders made by the user

        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#query-history-orders-user_data

        :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>`
        Nr2   r7  r  r  r   r?   r  r  r   r  )rk  r4  r  r  r)   r2   #privateGetApiV1FuturesHistoryOrdersr  r  r2  r  )r   r7  rr  r   r   ro  r4  r  r   
ordersListr  s              r   fetch_closed_ordersztoobit.fetch_closed_orders  s9    	[[((F &tGH#(GK 229gvNN
!??@SU[]cdd
Ftw)OOR\\_iijjj??HHH6 
q#h--(( 	7 	7Ax!56666  VUEBBBr   c                    |t          | j        dz             |                                  i }|||d<   |||d<   |                     |          }|d         |d<   d}|                     d||          \  }}|                     d||          \  }}d}|d	k    r*|                     |                     ||                    }n|                     |          }| 	                    ||||          S )
a  
        fetch all trades made by the user

        https://toobit-docs.github.io/apidocs/spot/v1/en/#account-trade-list-user_data
        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#account-trade-list-user_data

        :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
        :param int [params.until]: the latest time in ms to fetch trades for
        :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/?id=trade-structure>`
        Nz+ fetchMyTrades() requires a symbol argumentr  r   r2   r7  rc   r  r?   )
r"   r2   rk  r4  r  r  privateGetApiV1AccountTradesrm   privateGetApiV1FuturesUserTradesru  r  s	            r   fetch_my_tradesztoobit.fetch_my_tradesJ  s    >#DG.[$[\\\#(GK $GGV$$"4L
!??QWY_``
F229gvNN88Wf9U9UVVHH6 <<WEEH*   65%@@@r   r   fromAccount	toAccountc                    |                                   |                     |          }|                     | j        di           }|                     |||          }|                     |||          }	|d         |                     ||          ||	d}
|                     |                     |
|                    }|                     ||          S )a  
        transfer currency internally between wallets on the same account

        https://open.big.one/docs/spot_transfer.html#transfer-of-user

        :param str code: unified currency code
        :param float amount: amount to transfer
        :param str fromAccount: 'spot', 'swap'
        :param str toAccount: 'spot', 'swap'
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `transfer structure <https://docs.ccxt.com/?id=transfer-structure>`
        r   r2   )r  r(  fromAccountTypetoAccountType)	rk  r  r/  r   r!  currency_to_precision"privatePostApiV1SubAccountTransferrm  parse_transfer)r   r   r  r  r  r   r  r   fromIdtoIdro  r   s               r   rt   ztoobit.transfer  s     	==&&6FKK!!.+{KK	9EEd^224@@%!	
 
 ::4;;wPV;W;WXX ""8X666r   rt   r  c           
          |d d d d d d d d d	S )N)	r   r2   rp  r  r  r  r  r  r    )r   rt   r  s      r   r  ztoobit.parse_transfer  s.     

 

 
	
r   c                    |                                   d}i }| |                     |          }|d         |d<   |||d<   |                     d||          \  }}|||d<   d}|                     dd|          \  }}d}|dk    r*|                     |                     ||                    }n)|                     |                     ||                    }|                     ||||          S )	a1  
        fetch the history of changes, actions done by the user or operations that altered the balance of the user

        https://toobit-docs.github.io/apidocs/spot/v1/en/#get-account-transaction-history-list-user_data
        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#get-future-account-transaction-history-list-user_data

        :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 entries to return, default is None
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: end time in ms
        :returns dict: a `ledger structure <https://docs.ccxt.com/?id=ledger-entry-structure>`
        Nr2   r  r  r  r   rG   r?   )rk  r  r  r  !privateGetApiV1AccountBalanceFlowrm  !privateGetApiV1FuturesBalanceFlowparse_ledger)	r   r   rr  r   r   r  ro  r  r   s	            r   fetch_ledgerztoobit.fetch_ledger  s    	}}T**H&tnGFO#(GK 229gvNN$GG
!??@QSWY_``
F==dkk'SY>Z>Z[[HH==dkk'SY>Z>Z[[H&   8UEBBBr   itemc                 R   |                      |d          }|                     ||          }|                     |d          }|                     |d          }|                      |d          }|                     t          j        |                    }d}|                    d          rd}|                     ||                      |d          || 	                    |          |d d d | 
                    |                      |d	                    |d
         |d |d d d|          S )Nr  r[  r  r  inr:  outr2   flowTyper   )r   r2   rp  r  	directionr  referenceIdreferenceAccountr   r  r  beforeafterr   r  )r!  safe_currencyr   r%  parse_numberr-   
string_abs
startswithsafe_ledger_entryr  parse_ledger_type)	r   r  r  
currencyIdrp  r  	amountRawr  r  s	            r   parse_ledger_entryztoobit.parse_ledger_entry	  s<   %%dH55
%%j(;;%%dI66	  w//$$T844	""7#5i#@#@AA	$$ 	I%%""4.."Y//" $**4+;+;D*+M+MNN ('
 '
  !  	r   c                 :    ddd}|                      |||          S )Nrt   rebate)USER_ACCOUNT_TRANSFERAIRDROPrn  )r   r   typess      r   r  ztoobit.parse_ledger_type	  s.    %/
 
 tT222r   c                 ~   |                                   d}d}d}|                     dd|          \  }}|dk    rt          | j        dz   |z   dz             |                     |ddg          r|d}|                     |d          \  }}|t          | j        d	z             |                     |          }d|d
         i}|                     | 	                    ||                    }i }|}| 
                    |d          }	|                     |	|          }|                     ||          }
|
||d         <   |S )am  
        fetch the trading fees for multiple markets

        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#user-trade-fee-rate-user_data

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a dictionary of `fee structures <https://docs.ccxt.com/?id=fee-structure>` indexed by market symbols
        NfetchTradingFeesr?   z& fetchTradingFees(): does not support r  rA   rB   r7  z- fetchTradingFees requires a params["symbol"]r2   )rk  r  r)   r2   r  r,  r#   r4  $privateGetApiV1FuturesCommissionRaterm  r!  r  parse_trading_fee)r   r   r   r  r4  r7  ro  r  r  r  r  s              r   fetch_trading_feesztoobit.fetch_trading_fees$	  sj    	
!??@RTXZ`aa
Ftw)QQT^^akklll]]:'9:: 		_F!55fhGGNFF~ +Z!Z[[[[[((F&,G @@WV\A]A]^^H ##E844!!(F33$$UF33#&vh r   c                     |                      |d          }||                     ||          |                     |d          |                     |d          d d dS )Nr7  closeMakerFeecloseTakerFee)r   r7  r  r  r  	tierBased)r!  r  r%  )r   datar4  r  s       r   r  ztoobit.parse_trading_feeN	  sh    ##D(33&&x88%%dO<<%%dO<<
 
 	
r   c                 4    |                      d||||          S )a  
        fetch all deposits made to an account

        https://toobit-docs.github.io/apidocs/spot/v1/en/#deposit-history-user_data

        :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>`
        deposits$fetch_deposits_or_withdrawals_helperr   r   rr  r   r   s        r   fetch_depositsztoobit.fetch_depositsY	  s"     88T5RWY_```r   c                 4    |                      d||||          S )a*  
        fetch all withdrawals made from an account

        https://toobit-docs.github.io/apidocs/spot/v1/en/#withdrawal-records-user_data

        :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>`
        withdrawalsr  r  s        r   fetch_withdrawalsztoobit.fetch_withdrawalsg	  s"     88eUZ\bcccr   c                    |                                   d }i }| |                     |          }|d         |d<   |||d<   |                     d||          \  }}|||d<   d }|dk    r*|                     |                     ||                    }n/|dk    r)|                     |                     ||                    }|                     |||||          S )Nr2   r  r  r  r   r  r  )rk  r  r  #privateGetApiV1AccountDepositOrdersrm  $privateGetApiV1AccountWithdrawOrdersparse_transactions)	r   r   r   rr  r   r   r  ro  r   s	            r   r  z+toobit.fetch_deposits_or_withdrawals_helperu	  s    }}T**H&tnGFO#(GK 229gvNN$GG:??GU[@\@\]]HH, ]""@@WV\A]A]^^H8 &&x5%PPPr   transactionc                 f   |                      |d          }|                     |dd          }|                     ||          }|                     |d          }|                     |d          }d }|+|                     |          |                     |          d}|                     |dd          }	|                     |d	          }
|                     |d
          }|                     |d          }d|v }|rdn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 )"Nry  r  r  r  feeCoinName)rU  r  
addressTag
addressExtfromAddressTagaddressfromAddressarriveQuantity
withdrawalr  r   r2   txidtxIdrp  r  r  	addressToaddressFromtagtagTotagFromr   r  r(  r  r   r   )r  commentinternal)r   r  r"  r!  r  r  r%  parse_transaction_status)r   r  r  rp  r  r   	feeStringfeeCoinr  r  r  r  r  
isWithdrawr   s                  r   parse_transactionztoobit.parse_transaction	  sa   R %%k6::	''VXFF
&&z8<<$$[%88	"";>> )))44 33G<< C "";lKK"";0@AA$$[)<<	&&{MBB&+5
)8||y
K
$"";55
 D$$[&99
 	

 Y//
 t
 t
 
 ;
 4
 U
 w
 D
 d&&{J??
 
  d33D4D4D[RZ4[4[\\!
" t#
$ )
 
 
 	
r   c                 >    ddddd}|                      |||          S )Npendingfailedr   )212113rn  ro  s      r   r  ztoobit.parse_transaction_status	
  s4    	
 
 &&999r   c                    |                                   |                     |          }d|d         i}|                     |                     ||                    \  }}|t	          | j        dz             |                     |          |d<   |                     |                     ||                    }|                     ||          S )a  
        fetch the deposit address for a currency associated with self account

        https://toobit-docs.github.io/apidocs/spot/v1/en/#deposit-address-user_data

        :param str code: unified currency code
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `address structure <https://docs.ccxt.com/?id=address-structure>`
        r  r2   Nz5 fetchDepositAddress() : param["network"] is requiredr  )	rk  r  handle_network_code_and_paramsrm  r"   r2   network_code_to_id$privateGetApiV1AccountDepositAddressparse_deposit_address)r   r   r   r  ro  r+  paramsOmittedr   s           r   fetch_deposit_addressztoobit.fetch_deposit_address
  s     	==&&HTN
 &*%H%HU\^dIeIe%f%f"]#DG.e$efff#66{CC<<T[[R_=`=`aa ))(H===r   c                     |                      |d          }|                     |           ||                      |d          d ||                      |d          dS )Nr  r   r  )r   r  r  r  r  )r!  check_address)r   depositAddressr  r  s       r   r  ztoobit.parse_deposit_address3
  si    "">9==7###"((6::##NLAA
 
 	
r   r  r  c                    |                      |           d}|                     |          \  }}|t          | j        dz             |                                  |                     |          }|d         ||                     |d         |          ||                                 d}|||d<   |                     | 	                    ||                    }	| 
                    |	|          S )a  
        make a withdrawal

        https://toobit-docs.github.io/apidocs/spot/v1/en/#withdraw-user_data

        :param str code: unified currency code
        :param float amount: the amount to withdraw
        :param str address: the address to withdraw to
        :param str tag: a memo for the transaction
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `transaction structure <https://docs.ccxt.com/?id=transaction-structure>`
        Nz* withdraw() : param["network"] is requiredr2   r   )r  r  r(  r  rQ  r  )r  r  r"   r2   rk  r  r  millisecondsprivatePostApiV1AccountWithdrawrm  r  )
r   r   r  r  r  r   r+  r  ro  r   s
             r   ru   ztoobit.withdraw>
  s     	7###"AA&IIV#DG.Z$Z[[[==&&TN228F3CVLL$!..00
 
 ?$'GL!77GV8T8TUU %%h999r   r   c                 `   |t          | j        dz             |                                  |                     |          }|d         dk    rt	          | j        dz             |                                }|d         |d}|                     |                     ||                    }|S )a  
        set margin mode to 'cross' or 'isolated'

        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#change-margin-type-trade

        :param str marginMode: 'cross' or 'isolated'
        :param str symbol: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: response from the exchange
        Nz+ setMarginMode() requires a symbol argumentr   rA   z- setMarginMode() supports swap contracts onlyr2   )r7  
marginType)r"   r2   rk  r4  r$   r*  !privatePostApiV1FuturesMarginTyperm  )r   r   r7  r   r4  ro  r   s          r   set_margin_modeztoobit.set_margin_modeg
  s     >#DG.[$[\\\V$$&>V##DG&UUVVV%%''
Tl$
 
 99$++gv:V:VWW r   r   c                     |t          | j        dz             |                                  |                     |          }|d         |d}|                     |                     ||                    }|S )a  
        set the level of leverage for a market

        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#change-initial-leverage-trade

        :param float leverage: the rate of leverage
        :param str symbol: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: response from the exchange
        Nz) setLeverage() requires a symbol argumentr2   )r7  r   )r"   r2   rk  r4  privatePostApiV1FuturesLeveragerm  )r   r   r7  r   r4  ro  r   s          r   set_leverageztoobit.set_leverage
  s     >#DG.Y$YZZZV$$Tl 
 
 77GV8T8TUU r   c                    |                                   |                     |          }d|d         i}|                     |                     ||                    }|                     |di           }|                     ||          S )a  
        fetch the set leverage for a market

        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#get-the-leverage-multiple-and-position-mode-user_data

        :param str symbol: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `leverage structure <https://docs.ccxt.com/?id=leverage-structure>`
        r7  r2   r  )rk  r4  %privateGetApiV1FuturesAccountLeveragerm  r/  parse_leverage)r   r7  r   r4  ro  r   r  s          r   fetch_leverageztoobit.fetch_leverage
  s     	V$$fTl
 ==dkk'SY>Z>Z[[ ~~h33""4000r   c                     |                      |d          }|                     |d          }|                      |d          }|dk    rdnd}||                     ||          |||dS )Nr7  r   r	  crossedcrossisolated)r   r7  r   longLeverageshortLeverage)r!  r   r  )r   r   r4  r  leverageValuer	  r   s          r   r  ztoobit.parse_leverage
  s    ##Hh77))(J??%%h==
!+y!8!8WWz
&&x88$)*
 
 	
r   c                 |   |                                   i }d}|dt          |          }|dk    rt          | j        dz             |                     |d          }| |                     |          }|d         |d<   |                     |                     ||                    }|                     ||          S )a  
        fetch all open positions

        https://toobit-docs.github.io/apidocs/usdt_swap/v1/en/#query-position-user_data

        :param str[]|None symbols: list of unified market symbols
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `position structures <https://docs.ccxt.com/?id=position-structure>`
        Nr   zX fetchPositions() only accepts an array with a single symbol or without symbols argumentr   r2   r7  )	rk  r  r#   r2   r!  r4  privateGetApiV1FuturesPositionsrm  parse_positions)r   r-  r   ro  r4  r  firstSymbolr   s           r   fetch_positionsztoobit.fetch_positions
  s     	\\Fzz   ,F  "F  G  G  G**7A66K&[11$*4L!77GV8T8TUU0 ##Hg666r   positionc                    |                      |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 d d d d          S )Nr7  r  r  r   r   r2   
entryPricerW  r  	lastPricenotionalpositionValue
collateralunrealizedPnlunrealizedPnLr.  rV  rp  r  r   maintenanceMarginmaintenanceMarginPercentager@   )initialMargininitialMarginPercentager   liquidationPricemarginRatior   r  )r!  r  r]  r   safe_positionr  )r   r  r4  r  r  r(  r   s          r   parse_positionztoobit.parse_position
  s   ##Hh77!!(F33%%h77##Hj99$$Xz::!! #
H#
$""8T22#
 fX&#
 $**8Z@@	#

 ))(K@@#
 ))(K@@#
 ((?CC#
 $#
 T--hHH#
 D#
 **844#
 D#
 #
 #
 d#
   !#
" *4##
$ "--hAA'+  $1#
 #
 #
   	r   publicGETc                    | j         d         |         dz   |                     ||          z   }|dk    }|dk    }	i }
|                     ||                     |                    }|dk    r!|s|r|d|                     |          z   z  }n{|                                  |                                 }|                     | j        dd          |
d<   t          |          |
d	<   | 
                    ||
          }d
}|s|	rVt          |t                    s|                     |          }n@|                     |
          }|                     |          }n|                     |          }|}|||z   }|                     |                     |          |                     | j                  t"          j        d          }|d
k    r|d|z   z  }|d|z   z  }n|d|z   z  }d| j        |                     | j        dd          dd}||||dS )Nr|   rB  POSTDELETErx   ?
recvWindow5000rp   hexz&signature=CCXTbrokerId177321641268789z!application/x-www-form-urlencoded)ReferrerzX-BB-APIKEYzX-BB-API-PLATFORMzContent-Type)ry   methodbodyheaders)rv   implode_paramsr  extract_params	urlencodecheck_required_credentialsr  r!  r   strrm  
isinstancelistrv  hmacencodesecrethashlibsha256apiKey)r   pathr|   r>  r   r@  r?  ry   isPostisDelete
extraQueryqueryrp  queryExtendedqueryStringpayload	signatures                    r   signztoobit.sign  s8   is#c)D,?,?f,M,MM6!X%
		&$"5"5d";";<<) 7 73!6!666C++---))++I'+'7'7lTZ'['[J|$&))nnJ{# KKz::MK < <!&$// ,>>-88DD"&.."<"<K99U++DD"nn];;!G.		$++g"6"6DK8P8PRYR`bghhIb  }y88s[((	11"#{%)%5%5dlJPa%b%b C	 G fdwOOOr   reasonry   r>  r@  r?  c
                 B   |d S |                      |d          }
|                      |d          }|
rl|
dk    rf|
dk    r`| j        dz   |z   }|                     | j        d         |
|           |                     | j        d         ||           t          |          d S )Nr   msg2000 r   r   )r!  r2   throw_exactly_matched_exceptionr   throw_broadly_matched_exceptionr    )r   r   rX  ry   r>  r@  r?  r   requestHeadersrequestBody	errorCodemessagefeedbacks                r   handle_errorsztoobit.handle_errorsB  s    4$$Xv66	""8U33 	*e++	S0@0@w}t+H001I9V^___001I7T\]]])))tr   )N)b__name__
__module____qualname__r   r   r   r
   r   r   r	  dictr   r  r   r   r5  r   r1  rE  r   rq  r   rv  r  rG  r  r  r   r   r  r   r  r  r  r  r  r  r   r  r   r  r   r	  r  r   r  r  r   r   floatr   r&  r!  r#  r   r%  r`  ra  rw  r{  r  r  r  r  r  r  r   rt   r  r   r  r  r  r   r  r  r   r  r  r  r  r  r	   r  r  ru   r  intr  r   r  r  r   r  r/  rW  re  __classcell__)r   s   @r   r/   r/      s2       T# T T T T T Tl #% 
 
 
 
$ !# 9 9s 9 9 9 9" ') O OZ O O O Ob4$ 48 4 4 4 4l $& W W$*? W W W WrF4 FF F F F FP :>b 0V 0Vs 0V3 0VY 0V 0V 0V 0Vd 6:UW A A3 As A# A\`af\g A A A ABZ Z Zv Z Z Z Z Zx 26DW[df bL bL# bLc bLQT bLkoptku bL bL bL bLH
 
 
4 
 
 
 
 04B ,= ,=W ,=7 ,= ,= ,= ,=\ 4  6    8 48 9 9 9 9 9 9<

 

f 

 

 

 

 26b > >w > > > >B BFb @ @w @U\ @ @ @ @	
 	
 	
 6:" ; ;7 ; ; ; ; ;:
 
6 
[ 
 
 
 
4 8<$]ajl #Q #Q #QC #QWZ #Q #Q #Q #QJ	
 	
6 	
 	
 	
 	
 $& -, -,( -, -, -, -,^) ) ) ) )" gksu 02 023 02i 02y 02RW 02`c 02 02 02 02d os{} ! !3 !i !y !Z_ !hk ! ! ! !4 x|  EG <! <!C <!y <!PY <!ch <!qt <! <! <! <!|^ ^ ^v ^ ^ ^ ^ ^@
: 
: 
: 
: 
:: : : 37r  2  2s  2C  2  2  2  2D /32 $
 $
 $
 $
 $
 $
L ;?r 11 11c 11C 11 11 11 11f 26b 42 42c 423 42 42 42 42l /3TXac 7A 7A 7A3 7Ac 7Ahlmrhs 7A 7A 7A 7Ar *.Dt\^ 9A 9A3 9Ac 9A 9Acghmcn 9A 9A 9A 9Av 154VZce :C :C# :CS :CPS :Cjnotju :C :C :C :Cx -1tRV_a MA MAc MA MAC MA MA MA MA^ [] 7 7S 7% 7c 7c 7an 7 7 7 7B
 
t 
x 
= 
 
 
 
& (,$TZ\ 2C 2C 2CC 2Cs 2Caefqar 2C 2C 2C 2Ch t x ;    83 3 3 )+ ( ({ ( ( ( (T	
 	
f 	
 	
 	
 	
 *.Dt\^ a a3 ac a acghsct a a a a -1tRV_a d dc d dC dfjkvfw d d d dAQ AQ AQFO
 O
T O
X O
Q\ O
 O
 O
 O
b:s : : : : 79 > ># >^ > > > >B	
 	
h 	
R` 	
 	
 	
 	
 KOWY ': ':S ':% ':# ':C ':^i ': ': ': ':R >B"  # s    8 9=R  S #    2 24 1 1S 1 1 1 1 18
 
t 
V 
x 
 
 
 
 26b -7 -7w -7T(^ -7 -7 -7 -7^ t V    B &eBSW +P +P +P +PZ
# 
s 
 
c 
TX 
`c 
 
 
 
 
 
 
 
r   r/   )4ccxt.base.exchanger   ccxt.abstract.toobitr   rK  ccxt.base.typesr   r   r   r   r	   r
   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>rt     s   ( ' ' ' ' ' , , , , , ,  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f  f       * * * * * * - - - - - - . . . . . . ' ' ' ' ' ' & & & & & & . . . . . . . . . . . . ) ) ) ) ) ) * * * * * * ) ) ) ) ) ) , , , , , , . . . . . . 4 4 4 4 4 4 % % % % % %q, q, q, q, q,X{ q, q, q, q, q,r   