
    ei[                    \   d dl mZ d dlmZ d dl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 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'm0Z0 d dl1m2Z2 d dl3m4Z4  G d dee          Z5dS )    )Exchange)ImplicitAPIN)AccountAnyADLBalancesBool
Conversion
CurrenciesCurrencyDepositAddressIntLedgerEntryLeverageMarginModificationMarket
MarketTypeNumOrder	OrderBook	OrderSide	OrderTypePositionStrStringsFundingRateFundingRatesTradeTradingFeeInterfaceTradingFeesTransactionTransferEntry)List)ExchangeError)AuthenticationError)ArgumentsRequired)
BadRequest)InvalidOrder)NotSupported)OperationFailed)RateLimitExceeded)OnMaintenance)	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e	         fdZ
dede	fdZddi fd	ed
ededee         fdZddede	defdZd Zddede	defdZi fd	edefdZi fdefdZi fdefdZi fd	ed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dedededefdZ dddi fd	edededededededefd Z!di fd	ededededef
d!Z"d" Z#ddi fd#ed	ededededefd$Z$di fd#ed	e%fd%Z&di fd	e%fd&Z'i fd'efd(Z(di fd#ed	e%fd)Z)dddi fd	e%d
ededee         fd*Z*d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-e%fd.Z-dd/ede	defd0Z.d1e%fd2Z/di fd	edede0fd3Z1d4ddi fd	ed5ed
ededee2         f
d6Z3dde	de2fd7Z4dddi fd#ed	e%d
edefd8Z5dddi fd	e%d
edefd9Z6i fdee7         fd:Z8d; Z9i fde:fd<Z;de:fd=Z<i fd>ede=fd?Z>d@edefdAZ?ddBe@de=fdCZAdddi fd>e%d
ededefdDZBdddi fd>e%d
ededeeC         fdEZDddFedBe@deCfdGZEdH ZFdI ZGdddi fd>e%d
ededeeH         fdJZIdddi fd>e%d
ededeeH         fdKZJdddi fd>e%d
ededeeH         fdLZKddMedBe@deHfdNZLd1e%fdOZMi fd>ededPedQedeNf
dRZOdddi fd>e%d
ededeeN         fdSZPddTedBe@deNfdUZQd1e%de%fdVZRdi fd>ededWedXe%deHf
dYZSdi fd>eded	e%fdZZTddBe@fd[ZUd\ ZVd]d^i ddfd_ZWd`eXdaedbedceddedeefdfZYdde	fdgZZdddi fd	e%d
edefdhZ[dde	de\fdiZ]i fd	ede\fdjZ^i fd	ede\fdkZ_di fdle`deafdmZbdddi fd	e%d
edefdnZcdi fdoedd	e%fdpZei fd	edeffdqZgddrede	deffdsZhdi fdreXd	e%fdtZii fd	ededejfduZki fd	ededejfdvZli fd	edejfdwZmi fd	e%fdxZndi fdle`deeo         fdyZpddzede	fd{Zqdi fd|ed}edederfd~Zsdi fd#ed|ed}edederf
dZtdi fd#ed>e%derfdZudddi fd>e%d
ededeer         fdZvddede@de@derfdZwi fdefdZxdi fdle`deey         fdZzddede	deyfdZ{d Z|dedf fdZ} xZ~S )wooreturnc                 J   |                      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i d4dd5dd6dd7dd8dd9dd:dd;dd<dd=dd>dd?dd@ddAddBddCddDdi dEddFddGddHddIddJddKddLddMddNddOddPddQddRddSddTddUdi dVddWddXddYddZdd[dd\dd]dd^dd_dd`ddaddbddcddddedfddgdddddddddhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydydzd{d|d|dzd}d~gdgdddddddddidddddddddddddddii dddddddddddddddddddddddddddddddddddddddddddd	ddddddddddd
dddddddzddddiiiddddddddddddddddii ddddddddddddddddddddddddddddddddddi dddddddddddddddddddddddddddddddddddddɜdddddddddddd˜ddddddddd̜dddddddddd͜	dΜdϜdМdddd|                     dӦ          |                     dԦ          d՜iddddddddddۜdddddddddi ddidd
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ddddddddddddddddddd dddddddd d dddddddid	ddidddidddid dd d dddi di dt
          d t          dt          dt          dt          dt          dt          dt          dt          dt          d	t          d
t          dt          dt          dt          dt          t          t          t          t          t          t          dddt          i          S (  Nidr0   namezWOO X	countriesKY	rateLimitd   versionv1	certifiedTprohostnamezwoox.iohasCORSspotmarginswapfutureFoption	addMargincancelAllOrderscancelAllOrdersAftercancelOrdercancelWithdrawcloseAllPositionsclosePositioncreateConvertTradecreateDepositAddresscreateMarketBuyOrderWithCostcreateMarketOrdercreateMarketOrderWithCostcreateMarketSellOrderWithCostcreateOrder$createOrderWithTakeProfitAndStopLosscreateReduceOnlyOrdercreateStopLimitOrdercreateStopLossOrdercreateStopMarketOrdercreateStopOrdercreateTakeProfitOrdercreateTrailingAmountOrdercreateTrailingPercentOrdercreateTriggerOrderfetchAccountsfetchBalancefetchCanceledOrdersfetchClosedOrderfetchClosedOrdersfetchConvertCurrenciesfetchConvertQuotefetchConvertTradefetchConvertTradeHistoryfetchCurrenciesfetchDepositAddressfetchDepositAddressesfetchDepositAddressesByNetworkfetchDepositsfetchDepositsWithdrawalsfetchFundingHistoryfetchFundingIntervalfetchFundingIntervalsfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchIndexOHLCVfetchLedgerfetchLeveragefetchMarginAdjustmentHistoryfetchMarginModefetchMarketsfetchMarkOHLCVfetchMyTrades
fetchOHLCVfetchOpenInterestHistoryfetchOpenOrderfetchOpenOrders
fetchOrderfetchOrderBookfetchOrdersfetchOrderTradesfetchPositionfetchPositionADLRankfetchPositionHistoryfetchPositionModefetchPositionsfetchPositionsADLRankfetchPositionsHistoryfetchPremiumIndexOHLCVfetchStatusfetchTickerfetchTickers	fetchTimefetchTradesfetchTradingFeefetchTradingFeesfetchTransactionsemulatedfetchTransfersfetchWithdrawals)reduceMarginsandboxsetLeverage	setMarginsetPositionModetransferwithdraw
timeframes1m5m15m30m1h4h12h1d1w1mon1y)r   r   r   r   r   r   r   r   r   1Mr   urlszdhttps://user-images.githubusercontent.com/1294454/150730761-1a00e5e0-d28c-480f-9e65-089ce3e6ef3b.jpgzhttps://api-pub.woox.iozhttps://api.{hostname})pubpublicprivatezhttps://api-pub.staging.woox.iozhttps://api.staging.woox.iozhttps://woox.io/zhttps://docs.woox.io/zFhttps://support.woox.io/hc/en-001/articles/4404611795353--Trading-Feesz%https://woox.io/register?ref=DIJT0CNLgffffff?)urldiscount)logoapitestwwwdocfeesreferralr   get
   )z
hist/klinezhist/trades   )infozinfo/{symbol}system_infomarket_tradestokentoken_networkfunding_rateszfunding_rate/{symbol}funding_rate_historyfutureszfutures/{symbol}zorderbook/{symbol}klinezclient/tokenorder/{oid}zclient/order/{client_order_id}orderszclient/trade/{tid}zorder/{oid}/tradeszclient/tradeszclient/hist_tradeszstaking/yield_historyzclient/holdingzasset/depositzasset/history<   zsub_account/allzsub_account/assetszsub_account/asset_detailzsub_account/ip_restrictionzasset/main_sub_transfer_history   gp=
ף
@)	token_interestztoken_interest/{token}zinterest/historyinterest/repayzfunding_fee/history	positionszposition/{symbol}zclient/transaction_historyclient/futures_leveragex      )
orderzorder/cancel_all_afterz	asset/ltvzasset/internal_withdrawr   zclient/account_modezclient/position_modezclient/leverager   zclient/isolated_margin)r   zclient/orderr   zasset/withdraw)r   postdeleter   )
systemInfoinstrumentsr   tokenNetwork	tokenInfomarketTradesmarketTradesHistory	orderbookr   klineHistoryr   fundingRatefundingRateHistoryinsuranceFundtrade/order   trade/orderstrade/algoOrdertrade/algoOrdersztrade/transactionztrade/transactionHistoryztrade/tradingFeezaccount/infozaccount/tokenConfigzaccount/symbolConfigzaccount/subAccounts/allzaccount/referral/summaryzaccount/referral/rewardHistoryzaccount/credentialszasset/balanceszasset/token/historyzasset/transfer/historyzasset/wallet/historyzasset/wallet/depositzasset/staking/yieldHistoryzfutures/positionsfutures/leveragezfutures/defaultMarginModezfutures/fundingFee/historyzspotMargin/interestRatezspotMargin/interestHistoryzspotMargin/maxMarginalgo/order/{oid}zalgo/ordersr   buypowerzconvert/exchangeInfozconvert/assetInfozconvert/rfq)zconvert/tradezconvert/trades   )r   r   ztrade/cancelAllAfterzaccount/tradingModezaccount/listenKeyzasset/transferzasset/wallet/withdrawzspotMargin/leveragezspotMargin/interestRepayz
algo/orderzconvert/rft)r   r   r   zfutures/positionModer   zorder/client/{client_order_id}r   z#algo/order/client/{client_order_id})	r   r   r   r   ztrade/allOrderszalgo/order/{order_id}zalgo/orders/pendingzalgo/orders/pending/{symbol}zorders/pending)r   r   putr   )r   r   )r:   v2v3r   tradingz0.0002z0.0005)	tierBased
percentagemakertakeroptionsr   ERC20ATOMZRX)HTOMGUATOMr   TRONETHBSCArbitrum)TRXTRC20r   BEP20ARBr   )r   r   fillResponseFromRequest$bc830de7-50f3-460b-9ee0-f430f83f9dad)
timeDifferenceadjustForTimeDifferencesandboxMode!createMarketBuyOrderRequiresPriceznetwork-aliases-for-tokensnetworksnetworksByIddefaultNetworkCodeForCurrenciesr   brokerIdfeatures)lastmarkindex)IOCFOKPOGTD)
marginModetriggerPricetriggerPriceTypetriggerDirectionstopLossPricetakeProfitPriceattachedStopLossTakeProfittimeInForcehedgedtrailingleveragemarketBuyByCostmarketBuyRequiresPriceselfTradePreventioniceberg  Z   i'  )r  limitdaysBack	untilDayssymbolRequired)r  triggerr  r   )r  r  r!  r  r   i )r  r  r  r  r!  r  r   )r  r  r  daysBackCanceledr  r!  r  r   r    )	r   rR   createOrdersry   r~   r}   r   ra   rz   extendsdefaultr  )r%  rR   forSwap)linearinverse)r&  r@   r'  rB   rC   commonCurrencies
exceptionsz-1000z-1001z-1002z-1003z-1004z-1005z-1006z-1007z-1008z-1009z-1012z-1101z-1102z-1103z-1104z-1105)zCan not placemaintenancezsymbol must not be blankzThe token is not supportedz7Your order and symbol are not valid or already canceledzCInsufficient WOO. Please enable margin trading for leverage trading)exactbroadprecisionMode)deep_extendsuperr0   describeparse_numberr*   r%   r+   r'   r(   r$   r,   r-   )self	__class__s    T/var/www/html/volatility/venv/lib/python3.11/site-packages/ccxt/async_support/woo.pyr2  zwoo.describe   s<   c4 0 0 9 9 ; ; `>
%`>
G`>
 $`>
 	`>

 t`>
 `>
 4`>
 	`>
  ]]] $] 	]
 %] %] T] "4] '] t] !%] $U]  ] %d] ']  /!]" $U#] ]$ ,U%]& 0']( t)]* 7+], (-]. '/]0 &t1]2 (3]4 "55]6 (7]8 ,T9]: -d;]< %d=]>  ?]@ A]B &uC]D #EE] ] ]F $TG]H )$I]J $TK]L $TM]N +DO]P "4Q]R &tS]T (U]V 1%W]X  Y]Z +D[]\ &t]]^ '_]` (a]b #Dc]d *4e]f $Tg] ] ]h "5i]j tk]l  m]n /o]p "5q]r s]t !%u]v  w]x dy]z +E{]| !%}]~ "4]@ dA]B !$C]D tE]F #DG]H  I] ] ]J 'K]L 'M]N $UO]P !$Q]R (S]T (U]V )%W]X tY]Z u[]\ ]]^ T_]` ta]b "4c]d #De]f $Zg]h !$i]j #Dk] ]l !&#"#'  y] ] ]`>
N  O`>
h ~467  =;< 
 *+ ] C $ ' i`>
X  *,+-    $%-.+,-.%&-.-.5645'(0123%&   $ *A )1  =a  %a	 
 1!  1!  ,Q  1!  4Q  -a  ,R  ,R  .r  1"  7   9"! " >r# $ /16802.035)-15:<795     : &'67)+79.03645/27968! ! &',-&'.1	# #S/  / 1H HT ,a   *++,%&,-)*,-34)*%&,-'(+,23-.   &% )1% *A%  .q%  /	% 
 0%  7%  /%  +B%  21%  3A%  6r%  7%  =b%  22%  -a%   22!% " 5b#%  % $ 3B%% & 3B'% ( 9")% * 0+% , /-% . 8/% 0 9"1% 2 6r3% 4 9"5% 6 3B7% 8 /9% : *1;% < (=% > '?% @ 3AA% B 0C% D *2E%  % F ././I%  %  % N ,-/0453613.057368:*++-! ! ,-/00247+,>?01CD	  	  ,-,-/001/05634<=./
# 
#}I  I '] ]co oY`>
x	 !%"&!..x88!..x88	 y	`>
H
 "#+0$59 ""# 	/ / "#""%  ##! !
4
 .t C?   I
`>
J #&*(,$($(%*- -
 -2).+06:#'#'"&#'	( ( #($($)+/27/4#'1$ $4 %)&+!$$&%**/& & ',#'$)*/	# # ',!$#'$(*/( ( ',!$$(%+#'$(*/$ $ ',!$$(,0%+#'$(*/	* 	*  #IG GR y  ) $$  "9  $	  ## q\ \K`>
D E`>
F _0 0 .	
 Z Z Z Z \ Z Z \ \ \ \  \!& &3#00:2<OY[e ' G`>
~ Y`>
 `>
 ` ` `	    c                    K   |                      |           d{V }|                     |di           }|                     |d          }|d}n|dk    rd}nd}|ddd|dS )	a_  
        the latest known information on the availability of the exchange API

        https://developer.woox.io/api-reference/endpoint/public_data/systemInfo

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `status structure <https://docs.ccxt.com/?id=exchange-status-structure>`
        Ndatastatuserror0okr,  )r:  updatedetar   r   )v3PublicGetSystemInfo	safe_dictsafe_string)r4  paramsresponser9  r:  s        r6  fetch_statuszwoo.fetch_status  s       33F;;;;;;;; ~~h33!!$11>FFs]]FF"F
 
 	
r7  c                 h   K   |                      |           d{V }|                     |d          S )ad  
        fetches the current integer timestamp in milliseconds from the exchange server

        https://developer.woox.io/api-reference/endpoint/public_data/systemInfo

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns int: the current integer timestamp in milliseconds from the exchange server
        N	timestamp)r@  safe_integer)r4  rC  rD  s      r6  
fetch_timezwoo.fetch_time#  sE       33F;;;;;;;;   ;777r7  c                   K   | j         d         r|                                  d{V  |                     |           d{V }|                     |di           }|                     |dg           }|                     |          S )a%  
        retrieves data on all markets for woo

        https://developer.woox.io/api-reference/endpoint/public_data/instruments

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: an array of objects representing market data
        r   Nr9  rows)r   load_time_differencev3PublicGetInstrumentsrA  	safe_listparse_markets)r4  rC  rD  r9  rK  s        r6  fetch_marketszwoo.fetch_markets:  s       <12 	.++---------44V<<<<<<<<B ~~h33~~dFB//!!$'''r7  marketc                 2   |                      |d          }|                    d          }|                      |d          }d}d}|dk    rd}d}n
|dk    rd}d	}|                      |d
          }|                      |d          }	|                     |          }
|                     |	          }d }d }|
dz   |z   }d }d }d }d}|}|rTd}|                      |d          }|                     |          }|
dz   |z   dz   |z   }|                     d          }d}d}|                      |d          dk    }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)
S )*Nsymbol_r   FSPOTTr@   PERPrB   r   r   /:1r:  TRADINGr3   basequotesettlebaseIdquoteIdsettleIdtyperA   rC   rD   activecontractr(  baseTick	quoteTick)amountpriceminmaxbaseMinbaseMaxquoteMinquoteMaxminNotional)r  rf  rg  cost)
r)  contractSizeexpiryexpiryDatetimestrike
optionType	precisionlimitscreatedr   )rB  splitsafe_currency_coder3  safe_number)r4  rQ  marketIdpartsfirstr@   rB   
marketTyper^  r_  r[  r\  r`  r]  rS  rq  r(  r)  rA   rc  rb  s                        r6  parse_marketzwoo.parse_marketj  sD   ##FH55s##  **F??DJJf__DJ!!%++""5!,,&&v..''00e#  	F''q11H,,X66FCZ%'#-6F,,S11LFG!!&(33y@0
(0
f0
 D0
 U	0

 f0
 f0
 w0
 0
 J0
 D0
 f0
 D0
 e0
 e0
 f0
  !0
" f#0
$ ("**6:>>))&+>>    
  ++FI>>++FI>> 
  ++FJ??++FJ?? 
  ++FMBB  $ _0
 0
 0
 0	
r7  NrS  sincer  c                 p  K   |                                   d{V  |                     |          }d|d         i}|||d<   |                     |                     ||                     d{V }|                     |di           }|                     |dg           }	|                     |	|||          S )a/  
        get the list of most recent trades for a particular symbol

        https://developer.woox.io/api-reference/endpoint/public_data/marketTrades

        :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>`
        NrS  r3   r  r9  rK  )load_marketsrQ  v3PublicGetMarketTradesextendrA  rN  parse_trades)
r4  rS  r  r  rC  rQ  requestrD  r9  rK  s
             r6  fetch_tradeszwoo.fetch_trades  s       !!!!!!!!!V$$fTl
 $GG55dkk'66R6RSSSSSSSS& ~~h33~~dFB//  vue<<<r7  tradec                 h   d|v }|                      |dd          }d }|G|                    d          dk    r|                     |dd          }n|                     |d          }|                     |d          }|                     ||          }|d         }|                      |dd          }|                      |d	d
          }	|                      |dd          }
|                     |ddgdg          }|                     |d          }|||d<   t          j        ||	          }| 	                    |d          }|                     |d          }d }|r!|                      |dd          dk    }|rdnd}| 
                    |||                     |          ||||	||
|d ||d|          S )Nr3   executed_timestampexecutedTimestamp.rS  executed_priceexecutedPriceexecuted_quantityexecutedQuantityorder_idorderId	fee_assetfeeAssetfeerp  sideis_makerisMakerrY  r   r   )r3   rG  datetimerS  r  rg  rf  rp  r   takerOrMakerra  r  r   )safe_string_2findsafe_timestamp_2rH  rB  safe_marketparse_token_and_fee_tempr.   
string_mulsafe_string_lower
safe_tradeiso8601)r4  r  rQ  isFromFetchOrdertimestampStringrG  r|  rS  rg  rf  r  r  feeCostrp  r  r3   r  r  s                     r6  parse_tradezwoo.parse_trade  s   < !EM,,U4HJ]^^	&##C((2-- 11%9MObcc		 --e5HII	##E844!!(F33!""5*:OLL##E+>@RSS%%eZCC++EK3LugVV""3//!CK!%00%%eV44eT**  	;((
IFF#MG&-:777L"Y//( 
  
   	r7  c                     |                      ||          }d }|0|                      ||          }|                     |          }||d}|S )Nrp  currency)safe_string_nrz  )r4  itemfeeTokenKeysfeeAmountKeysr  r  feeCurrencyIdfeeCurrencyCodes           r6  r  zwoo.parse_token_and_fee_temp/  sc    $$T=99 ..t\BBM"55mDDO+ C 
r7  r  c                 T   |                      |d          }|                     ||          }|||                     t          j        |                      |d          d                    |                     t          j        |                      |d          d                    d d dS )NrS  makerFee100takerFeer   rS  r   r   r   r   )rB  safe_symbolr3  r.   
string_div)r4  r  rQ  r|  rS  s        r6  parse_trading_feezwoo.parse_trading_fee;  s    ##C22!!(F33&&w'9$:J:J3PZ:[:[]b'c'cdd&&w'9$:J:J3PZ:[:[]b'c'cdd
 
 	
r7  c                 0  K   |                                   d{V  |                     |          }d|d         i}|                     |                     ||                     d{V }|                     |di           }|                     ||          S )a  
        fetch the trading fees for a market

        https://developer.woox.io/api-reference/endpoint/trading/get_tradingFee

        :param str symbol: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param boolean [params.portfolioMargin]: set to True if you would like to fetch trading fees in a portfolio margin account
        :param str [params.subType]: "linear" or "inverse"
        :returns dict: a `fee structure <https://docs.ccxt.com/?id=fee-structure>`
        NrS  r3   r9  )r  rQ  v3PrivateGetTradeTradingFeer  rA  r  )r4  rS  rC  rQ  r  rD  r9  s          r6  fetch_trading_feezwoo.fetch_trading_feeG  s       !!!!!!!!!V$$fTl
 99$++gv:V:VWWWWWWWW ~~h33%%dF333r7  c           
        K   |                                   d{V  |                     |           d{V }|                     |di           }|                     |d          }|                     |d          }i }t	          dt          | j                            D ]g}| j        |         }|||                     t          j	        |d                    |                     t          j	        |d                    ddd||<   h|S )	ab  
        fetch the trading fees for multiple markets

        https://developer.woox.io/api-reference/endpoint/account/get_account_info

        :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
        Nr9  makerFeeRatetakerFeeRater   10000Tr  )
r  v3PrivateGetAccountInforA  rB  rangelensymbolsr3  r.   r  )	r4  rC  rD  r9  r   r   resultirS  s	            r6  fetch_trading_feeszwoo.fetch_trading_feesg  s'      !!!!!!!!!55f========@ ~~h33  ~66  ~66q#dl++,, 		 		A\!_F  **7+=eW+M+MNN**7+=eW+M+MNN"! F6NN r7  c                   K   i }|                      |          }|                     |          }t          j        ||g  d{V \  }}|                     |dg           }|                     |dg           }|                     |d          }	|                     |d          }
t          |
                                          }t          dt          |                    D ]}||         }| 
                    |          }|                     |
|         d          }|                     |	|         d          }t          |                                          }i }t          dt          |                    D ]}||         }|                     ||i           }|                     ||i           }|                     ||          }|                     |d          }|||d|                     |d          dk    |                     |d	          dk    |                     |d
          |                     |                     |                     |d                              |                     |d          dddddd||gd
||<   |                     |d|ddd|dddddddddd||gd          ||<   |S )a  
        fetches all available currencies on an exchange

        https://docs.woox.io/#available-token-public

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an associative dictionary of currencies
        NrK  r   balance_tokenr   networkallow_depositrY  allow_withdrawwithdrawal_feedecimalsminimum_withdrawalrh  )r   deposit)
r3   currencyNetworkIdr  rb  r  r   r  rv  rw  r   crypto)r  r   )r3   r4   coderv  rb  r  r   r  r   ra  rw  r   )v1PublicGetTokenv1PublicGetTokenNetworkasynciogatherrN  group_bylistkeysr  r  rz  index_byrA  network_id_to_coderB  r{  r3  parse_precisionsafe_currency_structure)r4  rC  r  tokenResponsePromisetokenNetworkResponsePromisetokenResponsetokenNetworkResponse	tokenRowstokenNetworkRowsr  
tokensByIdcurrencyIdsr  
currencyIdr  tokensByNetworkIdchainsByNetworkIdr  resultingNetworksj	networkId
tokenEntrynetworkEntrynetworkCodespecialNetworkIds                            r6  fetch_currencieszwoo.fetch_currencies  sD      #44V<<\ '+&B&B6&J&J#: 5<NEY[vDw4x.x.x.x.x.x.x++NN=&"==	>>*>KK}}%5w??]]9o>>
:??,,--q#k**++ 8	 8	A$QJ**:66D $j.Di P P $l:.F	 R R)..0011D&(1c$ii((   G	!^^,=y"MM
#~~.?BOO"55iFF#'#3#3J#H#H #)9*"#//oNNRUU $ 0 0?O P PTW W++L:JKK!%!2!243G3GHXHXYceoHpHp3q3q!r!r $(#3#3LBV#W#W#'% %
 $(#'$ $	 	 *:6'2 2!+..*  77 !-    $#   
  $#! !	 	 +,=>+9 9  F4LL. r7  rp  c                    K   |                                   d{V  |                     |          }|d         st          | j        dz             |                     |dd|d|           d{V S )a  
        create a market buy order by providing the symbol and cost

        https://docs.woox.io/#send-order

        :param str symbol: unified symbol of the market to create an order in
        :param float cost: how much you want to trade in units of the quote currency
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
        Nr@   z9 createMarketBuyOrderWithCost() supports spot orders onlyrQ  buyr   r  rQ  r)   r3   create_orderr4  rS  rp  rC  rQ  s        r6  !create_market_buy_order_with_costz%woo.create_market_buy_order_with_cost7  s       !!!!!!!!!V$$f~ 	ftw)ddeee&&vxaPPPPPPPPPr7  c                    K   |                                   d{V  |                     |          }|d         st          | j        dz             |                     |dd|d|           d{V S )a  
        create a market sell order by providing the symbol and cost

        https://docs.woox.io/#send-order

        :param str symbol: unified symbol of the market to create an order in
        :param float cost: how much you want to trade in units of the quote currency
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
        Nr@   z: createMarketSellOrderWithCost() supports spot orders onlyrQ  sellr   r  r  s        r6  "create_market_sell_order_with_costz&woo.create_market_sell_order_with_costH  s       !!!!!!!!!V$$f~ 	gtw)eefff&&vxq&QQQQQQQQQr7  ra  r  rf  rg  trailingAmounttrailingTriggerPricec	                    K   |t          | j        dz             |t          | j        dz             ||d<   ||d<   |                     ||||||           d{V S )a  
        create a trailing order by providing the symbol, type, side, amount, price and trailingAmount

        https://docs.woox.io/#send-algo-order

        :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 you want to trade in units of the base currency, or number of contracts
        :param float [price]: the price for the order to be filled at, in units of the quote currency, ignored in market orders
        :param float trailingAmount: the quote amount to trail away from the current market price
        :param float trailingTriggerPrice: the price to activate a trailing order, default uses the price argument
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
        Nz? createTrailingAmountOrder() requires a trailingAmount argumentzE createTrailingAmountOrder() requires a trailingTriggerPrice argumentr  r  r&   r3   r  )	r4  rS  ra  r  rf  rg  r  r  rC  s	            r6  create_trailing_amount_orderz woo.create_trailing_amount_orderY  s        !#DG.o$oppp'#DG.u$uvvv#1 )=%&&&vtT65&QQQQQQQQQr7  trailingPercentc	                    K   |t          | j        dz             |t          | j        dz             ||d<   ||d<   |                     ||||||           d{V S )a  
        create a trailing order by providing the symbol, type, side, amount, price and trailingPercent

        https://docs.woox.io/#send-algo-order

        :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 you want to trade in units of the base currency, or number of contracts
        :param float [price]: the price for the order to be filled at, in units of the quote currency, ignored in market orders
        :param float trailingPercent: the percent to trail away from the current market price
        :param float trailingTriggerPrice: the price to activate a trailing order, default uses the price argument
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
        NzA createTrailingPercentOrder() requires a trailingPercent argumentzF createTrailingPercentOrder() requires a trailingTriggerPrice argumentr  r  r  )	r4  rS  ra  r  rf  rg  r  r  rC  s	            r6  create_trailing_percent_orderz!woo.create_trailing_percent_orderq  s        "#DG.q$qrrr'#DG.v$vwww$3 !)=%&&&vtT65&QQQQQQQQQr7  c                 
  K   |                      |dd          }|                     |ddg          }|                                }|                                  d{V  |                     |          }	|                                }
|	d         |
d}d}|                     d|          \  }}||                     |          |d<   |                     |dd	          }|                     |d
          }|                     |d          }|du}|du}| 	                    |d          }|                     |dd| 
                    |                    }|                     |dd          }|                     |dd          }|du}|du}|p|}|p|dup|p|p|                     |d          du}|dk    }|                     |d          }|                     |d|          }|rdnd}||d<   |s|rd|d<   n|dk    rd|d<   n|dk    rd|d<   |r||d<   |s||                     ||          |d<   |r|s|                     |g d          }|                     |g d          }|du}|	d          rz|s|vd} ||                     ||          } nU| 
                    |          }!| 
                    |          }"t!          j        |!|"          }#|                     ||#          } | |d!<   n9|                     ||          |d"<   n|d#k    r|                     ||          |d"<   |                     |g d$          }$|$|$||<   |r]|t'          | j        d%z             |                     ||          |d<   d&|d<   |r||d<   n|rt!          j        |d'          }%|%|d<   n|%|d&k    r|                     ||          |d<   d(|d<   n|s|rd)|d<   |	d         d*d#g d+}&|&d         }'|
d,k    rd-nd,}(|rH| 	                    |d|          })|(d.|                     ||)          d/d0d1}*|'                    |*           |rH| 	                    |d|          }+|(d2|                     ||+          d/d0d1},|'                    |,           |&g|d<   |                     |g d3          }d}-|r0|                     |                     ||                     d{V }-n/|                     |                     ||                     d{V }-|                     |-d4i           }.|                     |                     |.d5          d6|.          }.| 	                    |-d7          |.d7<   |                     |.|	          S )8a  
        create a trade order

        https://developer.woox.io/api-reference/endpoint/trading/post_order
        https://developer.woox.io/api-reference/endpoint/trading/post_algo_order

        :param str symbol: unified symbol of the market to create an order in
        :param str type: 'market' or 'limit'
        :param str side: 'buy' or 'sell'
        :param float amount: how much of currency you want to trade in units of base currency
        :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.marginMode]: *for swap markets only* 'cross' or 'isolated', default 'cross'
        :param float [params.triggerPrice]: The price a trigger order is triggered at
        :param dict [params.takeProfit]: *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered(perpetual swap markets only)
        :param float [params.takeProfit.triggerPrice]: take profit trigger price
        :param dict [params.stopLoss]: *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered(perpetual swap markets only)
        :param float [params.stopLoss.triggerPrice]: stop loss trigger price
        :param float [params.algoType]: 'STOP' or 'TRAILING_STOP' or 'OCO' or 'CLOSE_POSITION'
        :param float [params.cost]: *spot market buy only* the quote quantity that can be used alternative for the amount
        :param str [params.trailingAmount]: the quote amount to trail away from the current market price
        :param str [params.trailingPercent]: the percent to trail away from the current market price
        :param str [params.trailingTriggerPrice]: the price to trigger a trailing order, default uses the price argument
        :param str [params.position_side]: 'SHORT' or 'LONG' - if position mode is HEDGE_MODE and the trading involves futures, then is required, otherwise self parameter is not required
        :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
        
reduceOnlyreduce_onlyNr3   )rS  r  rR   r  r  	stopPricestopLoss
takeProfitalgoTyper  activatedPricer  callbackValuer  callbackRatechildOrdersMARKETr  clientAlgoOrderIdclientOrderIdra  	POST_ONLYfokr	  iocr  rg  )rp  order_amountorderAmountr@   rf  quantityPOSITIONAL_TP_SLclOrdIDr  client_order_idzL createOrder() requires a trailingTriggerPrice parameter for trailing ordersTRAILING_STOPr  STOPBRACKETF)rS  r  r
  r  BUYSELL	STOP_LOSSCLOSE_POSITIONT)r  r
  r  ra  r  TAKE_PROFIT)r  r  r  postOnlyr  r  r  r  r	  r  r  r  r9  rK  r   rG  )safe_bool_2omitupperr  rQ  handle_margin_mode_and_paramsencode_margin_moder  
safe_valuerB  number_to_stringr  is_post_onlyprice_to_precisionr  cost_to_precisionr.   r  amount_to_precisionr&   r3   r  appendv3PrivatePostTradeAlgoOrderr  v3PrivatePostTradeOrderrA  rN  parse_order)/r4  rS  ra  r  rf  rg  rC  r  	orderTyperQ  	orderSider  r  r  r  r	  hasStopLosshasTakeProfitr
  r  r  r  isTrailingAmountOrderisTrailingPercentOrder
isTrailingisConditionalisMarketr  r$  clientOrderIdKeyrp  isPriceProvidedquoteAmountamountStringpriceStringcostRequestr  convertedTrailingPercentoutterOrderr  	closeSider  stopLossOrderr  takeProfitOrderrD  r9  s/                                                  r6  r  zwoo.create_order  sB     6 %%flMJJ
6L-#@AAJJLL	!!!!!!!!!V$$JJLL	Tl
 
 
!??vVV
F!$($;$;J$G$GGL!))&.+NN??6:66__V\::
t+#4/##FJ77#11&:PRbdhdydyz  eA  eA   B   B++F4DoVV,,V5FWW .d :!0!<*D.D
"  Wl$&>  W+  WQ^  Wcgcrcrsy  |I  dJ  dJ  RV  dV(,,V]CC$$XtV<<2?T.._# 	( ("-%%"'%%"' 	/$.GL! 	FE-#66vuEEGG 	KM 	K%%f.U.U.UVVDYYv'N'N'NOOF#4/Of~ O? Ot7G"#"&"8"8"F"FKK#'#8#8#@#@L"&"7"7">">K")"4\;"O"OK"&"8"8"M"MK$/!!&*&>&>vv&N&N
##+++"&":":66"J"JGJ**63b3b3bcc$(5G$% ,	3#+'  3A  )A  B  B  B(,(?(?H\(](]G$%"1GJ$ C+9((' C+2+=ou+U+U(*B'%?***.*A*A&,*W*W'&,
# 	3M 	3"+GJ ,#.!	! !K &m4K#,#5#5EI 	2 $ 0 0>8 T T% +$($;$;FM$R$R,"&' ' ""=111 	4"&"2"2:~z"Z"Z% -$($;$;FO$T$T,"&) ) ""?333&1]GM"6  $b  $b  $b  c  c 	X!==dkk'SY>Z>Z[[[[[[[[HH$ "99$++gv:V:VWWWWWWWWH  ~~h33~~dnnT6::AtDD ,,X{CC[f---r7  c                 :    ddd}|                      |||          S )NCROSSISOLATED)crossisolatedrB  )r4  modemodess      r6  r)  zwoo.encode_margin_mode<  s.    "
 
 tT222r7  r3   c                 R  K   |                                   d{V  |                     |          }i }	||                     ||          |	d<   ||                     ||          |	d<   |                     |dd          }
|                     |d|
          }|du}|                     |g d          }||                     ||          |	d<   |                     |d	d
|                     |                    }|                     |dd          }|                     |dd          }|du}|du}|p|}|r?||                     ||          |	d
<   |r||	d<   n|rt          j	        |d          }||	d<   | 
                    |g d          }|p|dup|                     |d          du}d}|rg||	d<   |r0|                     |                     |	|                     d{V }n|                     |                     |	|                     d{V }nf||	d<   |r0|                     |                     |	|                     d{V }n/|                     |                     |	|                     d{V }|                     |di           }|                     ||          S )a  
        edit a trade order

        https://docs.woox.io/#edit-order
        https://docs.woox.io/#edit-order-by-client_order_id
        https://docs.woox.io/#edit-algo-order
        https://docs.woox.io/#edit-algo-order-by-client_order_id

        :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 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
        :param float [params.triggerPrice]: The price a trigger order is triggered at
        :param float [params.stopLossPrice]: price to trigger stop-loss orders
        :param float [params.takeProfitPrice]: price to trigger take-profit orders
        :param str [params.trailingAmount]: the quote amount to trail away from the current market price
        :param str [params.trailingPercent]: the percent to trail away from the current market price
        :param str [params.trailingTriggerPrice]: the price to trigger a trailing order, default uses the price argument
        :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
        Nrg  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  r  r  oidr9  )r  rQ  r-  r/  r  rB  safe_number_nr+  r.   r  r&  r*  (v3PrivatePutAlgoOrderClientClientOrderIdr  $v3PrivatePutOrderClientClientOrderIdv3PrivatePutAlgoOrderOidv3PrivatePutOrderOidrA  r3  )r4  r3   rS  ra  r  rf  rg  rC  rQ  r  clientOrderIdUnifiedclientOrderIdExchangeSpecificisByClientOrderr  r  r  r  r8  r9  r:  rC  r;  rD  r9  s                           r6  
edit_orderzwoo.edit_orderC  s|     0 !!!!!!!!!V$$
 #66vuEEGG"&":":66"J"JGJ#11&)_UU(,(8(8ARTh(i(i%7tC))&2s2s2stt#&*&=&=fl&S&SGN##11&:PRbdhdydyz  eA  eA   B   B++F4DoVV,,V5FWW .d :!0!<*D.D
 	C#/,0,C,CFL`,a,a()$ C+9((' C+2+=ou+U+U(*B'6  $Q  $Q  $Q  R  R"x|4'?xT__U[]jEkEkswEw 	Y)FG%& i!%!N!Nt{{[bdjOkOk!l!lllllll!%!J!J4;;W^`fKgKg!h!hhhhhhhGEN Y!%!>!>t{{7TZ?[?[!\!\\\\\\\!%!:!:4;;wPV;W;W!X!XXXXXXX ~~h33f---r7  c                 P  K   |                      |ddd          }|                     |ddg          }|s|t          | j        dz             |                                  d{V  d}||                     |          }i }|                     |dd          }|                     |d|          }|                     |g d	          }|du}	d}
|r=|	r||d
<   n||d<   |                     | 	                    ||                     d{V }
nG|d         |d<   |	r||d<   n||d<   | 
                    | 	                    ||                     d{V }
|                     |
di           }|                     |
d          |d<   |	r||d<   n||d<   |                     ||          S )a8  

        https://developer.woox.io/api-reference/endpoint/trading/cancel_order
        https://developer.woox.io/api-reference/endpoint/trading/cancel_algo_order

        cancels an open order
        :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
        :param boolean [params.trigger]: whether the order is a trigger/algo order
        :returns dict: An `order structure <https://docs.ccxt.com/?id=order-structure>`
        r!  stopFNz) cancelOrder() requires a symbol argumentr  r  r  r  r  algoOrderIdr3   rS  r  r9  rG  )r%  r&  r&   r3   r  rQ  r  rB  v3PrivateDeleteTradeAlgoOrderr  v3PrivateDeleteTradeOrderrA  r3  )r4  r3   rS  rC  	isTriggerrQ  r  rW  rX  rY  rD  r9  s               r6  cancel_orderzwoo.cancel_order  s!      $$VYFF	6Iv#677 	[fn#DG.Y$YZZZ!!!!!!!!![[((F#11&)_UU(,(8(8ARTh(i(i%6#R#R#RSS7tC 	Z ,/L+,,)+&!??GU[@\@\]]]]]]]]HH &tGH (+H((%'	"!;;DKKQW<X<XYYYYYYYYH ~~h33 ,,X{CC[ 	!$AD!! DOf---r7  c                   K   |                                   d{V  |                     |dd          }|                     |ddg          }i }| |                     |          }|d         |d<   d}|r|                     |           d{V }n/|                     |                     ||                     d{V }|                     |di           }|                     d|i          gS )a  

        https://developer.woox.io/api-reference/endpoint/trading/cancel_all_order
        https://developer.woox.io/api-reference/endpoint/trading/cancel_algo_orders

        cancel all open orders in a market
        :param str symbol: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param boolean [params.trigger]: whether the order is a trigger/algo order
        :returns dict: an list of `order structures <https://docs.ccxt.com/?id=order-structure>`
        Nr\  r!  r3   rS  r9  r   )	r  r%  r&  rQ  v3PrivateDeleteTradeAlgoOrdersv3PrivateDeleteTradeOrdersr  rA  
safe_order)r4  rS  rC  r!  r  rQ  rD  r9  s           r6  cancel_all_orderszwoo.cancel_all_orders  s      !!!!!!!!!""669==6FI#677[[((F &tGH 	[!@@HHHHHHHHHH!<<T[[RX=Y=YZZZZZZZZH ~~h33//00r7  timeoutc                    K   |                                   d{V  d|dk    rt          |d          ndi}|                     |                     ||                     d{V }|S )ap  
        dead man's switch, cancel all orders after the given timeout

        https://developer.woox.io/api-reference/endpoint/trading/cancel_all_after

        :param number timeout: time in milliseconds, 0 represents cancel the timer
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: the api result
        NtriggerAfterr   i )r  ri   v3PrivatePostTradeCancelAllAfterr  )r4  rg  rC  r  rD  s        r6  cancel_all_orders_afterzwoo.cancel_all_orders_after  s       !!!!!!!!!Wq[[C000q
 >>t{{7TZ?[?[\\\\\\\\ r7  c                 P  K   |                                   d{V  d}||                     |          }|                     |dd          }|                     |ddg          }i }|                     |dd          }d}|r=|||d<   n||d<   |                     |                     ||                     d{V }n<|||d<   n||d<   |                     |                     ||                     d{V }|                     |d	i           }	| 	                    |	|          S )
aQ  

        https://developer.woox.io/api-reference/endpoint/trading/get_order
        https://developer.woox.io/api-reference/endpoint/trading/get_algo_order

        fetches information on an order made by the user
        :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
        :param boolean [params.trigger]: whether the order is a trigger/algo order
        :returns dict: An `order structure <https://docs.ccxt.com/?id=order-structure>`
        Nr\  r!  r  r  r  r]  r  r9  )
r  rQ  r%  r&  r  v3PrivateGetTradeAlgoOrderr  v3PrivateGetTradeOrderrA  r3  )
r4  r3   rS  rC  rQ  r!  r  r  rD  r9  s
             r6  fetch_orderzwoo.fetch_order  su      !!!!!!!!![[((F""669==6FI#677**69oNN 0	W(/1+,,)+&!<<T[[RX=Y=YZZZZZZZZHHN (+8((%'	"!88Wf9U9UVVVVVVVVH> ~~h33f---r7  c           	      T  K   |                                   d{V  d}|                     |dd          \  }}|r!|                     d||||dd           d{V S i }d}|                     |dd          }|                     |ddg          }| |                     |          }|d	         |d
<   |||d<   |                     |d          }	|                     |dg          }|	|	|d<   |t          |d          |d<   d}
|r0|                     | 	                    ||                     d{V }
n/| 
                    | 	                    ||                     d{V }
|                     |
di           }|                     |dg           }|                     ||||          S )a  
        fetches information on multiple orders made by the user

        https://developer.woox.io/api-reference/endpoint/trading/get_orders
        https://developer.woox.io/api-reference/endpoint/trading/get_algo_orders

        :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 boolean [params.trigger]: whether the order is a trigger/algo order
        :param boolean [params.isTriggered]: whether the order has been triggered(False by default)
        :param str [params.side]: 'buy' or 'sell'
        :param boolean [params.paginate]: set to True if you want to fetch orders with pagination
        :returns Order[]: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
        NFr   paginatepager  r\  r!  r3   rS  	startTimeuntilendTimesizer9  rK  )r  handle_option_and_params fetch_paginated_call_incrementalr%  r&  rQ  rH  ri  v3PrivateGetTradeAlgoOrdersr  v3PrivateGetTradeOrdersr*  rN  parse_orders)r4  rS  r  r  rC  rq  r  rQ  r!  rt  rD  r9  r   s                r6  fetch_orderszwoo.fetch_ordersv  s     " !!!!!!!!!88PZ[[& 	y>>}fV[]bdjlrtwxxxxxxxxx""669==6FI#677[[((F &tGH#(GK !!&'226G9--!&GI!%ooGFO 1	X!==dkk'SY>Z>Z[[[[[[[[HH` "99$++gv:V:VWWWWWWWWHP x44fb11  >>>r7  c                    K   |                                   d{V  |                     |ddi          }|                     ||||           d{V S )0  
        fetches information on multiple orders made by the user

        https://developer.woox.io/api-reference/endpoint/trading/get_orders
        https://developer.woox.io/api-reference/endpoint/trading/get_algo_orders

        :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 boolean [params.trigger]: whether the order is a trigger/algo order
        :param boolean [params.isTriggered]: whether the order has been triggered(False by default)
        :param str [params.side]: 'buy' or 'sell'
        :param boolean [params.trailing]: set to True if you want to fetch trailing orders
        :param boolean [params.paginate]: set to True if you want to fetch orders with pagination
        :returns Order[]: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
        Nr:  
INCOMPLETEr  r  r|  r4  rS  r  r  rC  extendedParamss         r6  fetch_open_orderszwoo.fetch_open_orders  sp      $ !!!!!!!!!Vh-EFF&&vue^LLLLLLLLLr7  c                    K   |                                   d{V  |                     |ddi          }|                     ||||           d{V S )r~  Nr:  	COMPLETEDr  r  s         r6  fetch_closed_orderszwoo.fetch_closed_orders  sp      $ !!!!!!!!!Vh-DEE&&vue^LLLLLLLLLr7  r  c                 <    dddd}|                      ||d           S )Nr  r	  r
  )r  r  	post_onlyrM  )r4  r  timeInForcess      r6  parse_time_in_forcezwoo.parse_time_in_force%  s1    
 

 k4@@@r7  r   c                    d }|                      |d          }|F|                    d          dk    r|                     |d          }n|                     |d          }||                     |d          }|                     |dd          }|                     |                     |dd                    }|                      |d	          }|                     ||          }|d	         }|                      |d
          }	|                      |d          }
|                      |d          }|                     |d          }|                     |dd          }|                     |d          }|                     |                     |dd                    }|                     |                      |d                    }| 	                    |d          }|                      |d          }| 	                    |d          }|                      |d          }d }|F|                    d          dk    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"|          S )#NcreatedTimer  r   rG  r  r]  r  r  rS  rg  r  rf  ra  r:  
algoStatusr  executedtotalExecutedQuantityaverageExecutedPricetotalFeer  r  updatedTimer3   r  lastTradeTimestamplastUpdateTimestampr  r$  r  r  r  r  )averagerf  filled	remainingrp  tradesr  r   )rB  r  safe_timestamprH  r  	omit_zeror  r  safe_value_2r{  re  r  parse_order_statusr  	safe_bool)r4  r   rQ  rG  timestrampStringr  r  r|  rS  rg  rf  rp  r4  r:  r  r  r  r  feeCurrencyr  lastUpdateTimestampStringr  s                         r6  r3  zwoo.parse_order-  s   d 	++E=AA'$$S))Q.. //}EE		 --e]CC	))%==I$$UI}EEt'9'9%Re'f'fgg##E844!!(F33!  00!!%44x00**5&99	""5(LAA%%eV44 1 1%E\ ] ]^^..!1!1%9O!P!PQQuj11&&uj99''~>>$($4$4UM$J$J!"$0(--c22a77&*&9&9%&O&O##&*&7&7}&M&M#  
' 
] 
  
 Y//	 

 !$ 
 "#6 
 d--f55 
 f 
 I 
 433I>> 
  
 $..== 
 D 
 U 
 L 
  t! 
" T# 
$ '  9 
  
  
: ;  	r7  r:  c           
      P    |#dddddddddd	}|                      |||          S |S )Nopenclosedcanceledrejected)	NEWFILLEDCANCEL_SENTCANCEL_ALL_SENT	CANCELLEDPARTIAL_FILLEDREJECTEDr  r  rM  r4  r:  statusess      r6  r  zwoo.parse_order_status  sN    ")#-'"(&$%
 
H ##Hff===r7  c           	      t  K   |                                   d{V  |                     |          }d|d         i}|||d<   |                     |                     ||                     d{V }|                     |di           }|                     |d          }|                     |||ddd	d
          S )aB  
        fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data

        https://developer.woox.io/api-reference/endpoint/public_data/orderbook

        :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
        NrS  r3   maxLevelr9  rG  bidsasksrg  r  )r  rQ  v3PublicGetOrderbookr  rA  rH  parse_order_book)	r4  rS  r  rC  rQ  r  rD  r9  rG  s	            r6  fetch_order_bookzwoo.fetch_order_book  s       !!!!!!!!!V$$fTl
 "'GJ224;;w3O3OPPPPPPPP, ~~h33%%h<<	$$T69ffgWabbbr7  r   	timeframec                 >  K   |                                   d{V  |                     |          }|d         |                     | j        ||          d}|t	          |d          |d<   ||dz
  |d<   |                     |d          }|                     |d          }|||d	<   |                     |                     ||                     d{V }	| 	                    |	d
i           }
| 
                    |
dg           }|                     |||||          S )a&  

        https://developer.woox.io/api-reference/endpoint/public_data/klineHistory

        fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
        :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]: max=1000, max=100 when since is defined and is less than(now - (999 * (timeframe in ms)))
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: the latest time in ms to fetch entries for
        :returns int[][]: A list of candles ordered, open, high, low, close, volume
        Nr3   )rS  ra  r#  r  r   afterrt  beforer9  rK  )r  rQ  rB  r   ri  rH  r&  v3PublicGetKlineHistoryr  rA  rN  parse_ohlcvs)r4  rS  r  r  r  rC  rQ  r  rt  rD  r9  rK  s               r6  fetch_ohlcvzwoo.fetch_ohlcv  sJ      !!!!!!!!!V$$Tl$$T_iKK
 
 "5$//GG$qyGG!!&'2267++ %GH55dkk'66R6RSSSSSSSS. ~~h33~~dFB//  vy%GGGr7  c           	         |                      |d          |                     |d          |                     |d          |                     |d          |                     |d          |                     |d          gS )NstartTimestampr  highlowclosevolume)rH  r{  )r4  ohlcvrQ  s      r6  parse_ohlcvzwoo.parse_ohlcv2  s    e%566UF++UF++UE**UG,,UH--
 	
r7  c                 2  K   |                                   d{V  d}||                     |          }d|i}|                     |                     ||                     d{V }|                     |dg           }	|                     |	||||          S )a  
        fetch all the trades made from a single order

        https://docs.woox.io/#get-trades

        :param str id: order id
        :param str symbol: unified market symbol
        :param int [since]: the earliest time in ms to fetch trades for
        :param int [limit]: the maximum number of trades to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `trade structures <https://docs.ccxt.com/?id=trade-structure>`
        NrQ  rK  )r  rQ  v1PrivateGetOrderOidTradesr  rN  r  )
r4  r3   rS  r  r  rC  rQ  r  rD  r  s
             r6  fetch_order_tradeszwoo.fetch_order_trades<  s       !!!!!!!!![[((F2
 88Wf9U9UVVVVVVVV& &"55  vFFFr7  c           	      t  K   |                                   d{V  d}|                     |dd          \  }}|r!|                     d||||dd           d{V S i }d}| |                     |          }|d         |d<   |||d	<   |                     |d
          }|                     |d
g          }|||d<   |||d<   |                     |                     ||                     d{V }	|                     |	di           }
| 	                    |
dg           }| 
                    |||||          S )aj  
        fetch all trades made by the user

        https://developer.woox.io/api-reference/endpoint/trading/get_transactions

        :param str symbol: unified market symbol
        :param int [since]: the earliest time in ms to fetch trades for
        :param int [limit]: the maximum number of trades structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param boolean [params.paginate]: set to True if you want to fetch trades with pagination
        :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/?id=trade-structure>`
        NFry   rq  rr  r  r3   rS  rs  rt  ru  r  r9  rK  )r  rw  rx  rQ  rH  r&  #v3PrivateGetTradeTransactionHistoryr  rA  rN  r  )r4  rS  r  r  rC  rq  r  rQ  rt  rD  r9  r  s               r6  fetch_my_tradeszwoo.fetch_my_tradesf  s      !!!!!!!!!88R\]]& 	{>>PVX]_dflntvyzzzzzzzzz[[((F &tGH#(GK !!&'226G9--!&GI$GGAA$++gW]B^B^________< ~~h33fb11  vFFFr7  c                 t  K   |                      |          }|                     |          }t          j        ||g  d{V \  }}|                     |di           }|g}|                     |di           }|                     |dg           }	|                     ||	          }
|                     |
|          S )a  
        fetch all the accounts associated with a profile

        https://developer.woox.io/api-reference/endpoint/account/get_account_info
        https://developer.woox.io/api-reference/endpoint/account/sub_accounts

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a dictionary of `account structures <https://docs.ccxt.com/?id=account-structure>` indexed by the account type
        Nr9  rK  )r  !v3PrivateGetAccountSubAccountsAllr  r  rA  rN  array_concatparse_accounts)r4  rC  mainAccountPromisesubAccountPromisemainAccountResponsesubAccountResponsemainDatamainRowssubDatasubRowsrK  s              r6  fetch_accountszwoo.fetch_accounts  s       "99&AA< !BB6JJ  9@I[]nHo8p2p2p2p2p2p2p//>>"5vrBB:..!3VR@@..&"55  733""4000r7  c           	          ||                      |d          |                     |g d          d |                     |dd          dS )NapplicationId)r4   accountaliasaccountType
subaccount)r   r3   r4   r  ra  )rB  r  r  )r4  r  s     r6  parse_accountzwoo.parse_account  s\    B ""7O<<&&w0L0L0LMM**7M<PP
 
 	
r7  c                    K   |                                   d{V  |                     |           d{V }|                     |d          }|                     |          S )ac  
        query for balance and get the amount of funds available for trading or funds locked in orders

        https://docs.woox.io/#get-current-holding-get-balance-new

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `balance structure <https://docs.ccxt.com/?id=balance-structure>`
        Nr9  )r  v3PrivateGetAssetBalancesrA  parse_balance)r4  rC  rD  r9  s       r6  fetch_balancezwoo.fetch_balance	  sz       !!!!!!!!!77????????0 ~~h//!!$'''r7  c                    d|i}|                      |dg           }t          dt          |                    D ]~}||         }|                     |                     |d                    }|                                 }|                     |d          |d<   |                     |d          |d<   |||<   |                     |          S )Nr   holdingr   r   totalavailableBalancefree)rN  r  r  rz  rB  r  safe_balance)r4  rD  r  balancesr  balancer  r  s           r6  r  zwoo.parse_balance4	  s    H
 >>(Ir::q#h--(( 	# 	#AqkG**4+;+;GW+M+MNNDllnnG#//CCGG"..w8JKKGFO"F4LL  (((r7  r  c                   K   |                                   d{V  |                     |          }d}|                     |          \  }}|d         |                     |          d}|                     |                     ||                     d{V }|                     |di           }|                     ||          S )a  
        fetch the deposit address for a currency associated with self account

        https://developer.woox.io/api-reference/endpoint/assets/get_wallet_deposit

        :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>`
        Nr3   )r   r  r9  )r  r  handle_network_code_and_paramsnetwork_code_to_idv3PrivateGetAssetWalletDepositr  rA  parse_deposit_address)r4  r  rC  r  r  r  rD  r9  s           r6  fetch_deposit_addresszwoo.fetch_deposit_addressB	  s       !!!!!!!!!==&&"AA&IIVd^..{;;
 
 <<T[[RX=Y=YZZZZZZZZ ~~h33))$999r7  rC  c                    d }|                      |          \  }}|                     ||d                   }|                     |d         |          }|Tt          |d                                                   }t          | j        dz   |                     |          z             |                     |d          }||gS )Nr  r   zd  can not determine a network code, please provide unified "network" param, one from the following: r  )	r  r  rA  r  r  r'   r3   jsonrB  )r4  r  rC  r  r  supportedNetworkscurrentyNetworkIds          r6  get_dedicated_network_idzwoo.get_dedicated_network_idc	  s    "AA&IIV--k8F;KLL~~hz&:KHH $Xj%9%>%>%@%@ A ATW  (N  N  QU  QZ  QZ  [l  Qm  Qm  m  n  n  n ,,\;NOO!6**r7  r  c                     |                      |d          }|                     |           ||                      |d          d ||                      |d          dS )Naddressr  extra)r   r  r  r  tag)rB  check_address)r4  depositEntryr  r  s       r6  r  zwoo.parse_deposit_addressn	  si    ""<;;7### ((6::##L'::
 
 	
r7  c                 J  K   |                                   d {V  i }d }| |                     |          }|d         |d<   d }|                     |          \  }}||                     |          |d<   |||d<   |t	          |d          |d<   |                     |d          }|                     |d          }|||d<   |                     |                     ||                     d {V }	| 	                    |	di           }
|| 
                    |
d	g           gS )
Nr3   r   r  rs  r#  rv  ra  r9  rK  )r  r  r  r  ri  rB  r&  v3PrivateGetAssetWalletHistoryr  rA  rN  )r4  r  r  r  rC  r  r  r  transactionTyperD  r9  s              r6  get_asset_history_rowszwoo.get_asset_history_rowsy	  s[     !!!!!!!!!!}}T**H'~GG"AA&IIV"!%!8!8!E!EGI#(GK !%..GFO**66::66**&-GFO<<T[[RX=Y=YZZZZZZZZH ~~h33$..vr::;;r7  c                    K   |                      ||||           d{V }|                     |d          }|                     |d          }|                     |||||          S )ap  
        fetch the history of changes, actions done by the user or operations that altered balance of the user

        https://developer.woox.io/api-reference/endpoint/assets/get_wallet_history

        :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
        :returns dict: a `ledger structure <https://docs.ccxt.com/?id=ledger-entry-structure>`
        Nr   r   )r  r*  rN  parse_ledger)r4  r  r  r  rC  currencyRowsr  rK  s           r6  fetch_ledgerzwoo.fetch_ledger	  su       "88ueVTTTTTTTT??<33~~lA..  xvFFFr7  r  c                    |                      |d          }|                     ||          }|                     ||          }|                     |d          }|                      |d          }|dk    rdnd}|                     |d          }|                     |dgd	g          }	|                     ||                      |d
          ||                      |d          d |                      |d          |                     |                      |d                    |d d |||                     |          | 	                    |                      |d                    |	d|          S )Nr   rf  	tokenSideDEPOSITinoutr  feeToken	feeAmountr3   r  txIdr:  ra  )r   r3   r  r  referenceAccountreferenceIdr:  rf  r  r  	directionrG  r  ra  r  )
rB  rz  safe_currencyr{  r  r  safe_ledger_entryparse_transaction_statusr  parse_ledger_entry_type)
r4  r  r  networkizedCoder  rf  r  r  rG  r  s
             r6  parse_ledger_entryzwoo.parse_ledger_entry	  s|   . **499&&AA%%dH55!!$11k22!Y..DDU	''m<<	++D:,NN%%""4..''i88 $++D&9933D4D4DT84T4TUU""Y//001A1A$1O1OPP'
 '
  !  	r7  c                 :    ddd}|                      |||          S )Ntransactionr   )BALANCE
COLLATERALrM  )r4  ra  typess      r6  r  zwoo.parse_ledger_entry_type	  s.    $$
 
 tT222r7  c                    ||S |                     d          }t          |          }|                     |d          }|                     |d|          }|dk    r|d|                     |d          z   z  }|                     |          }|S )NrT  r   r   r   )ry  r  rB  r  )r4  r  r  r}  partsLength	firstPartr  s          r6  get_currency_from_chaincodezwoo.get_currency_from_chaincode	  s    O#))#..Ee**K((22I))%I>>JQcD$4$4UA$>$>>>
))*55Hr7  c           	      r   K   ddi}|                      ||||                     ||                     d{V S )a  
        fetch all deposits made to an account

        https://developer.woox.io/api-reference/endpoint/assets/get_wallet_history

        :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 deposits 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>`
        r  r  Nfetch_deposits_withdrawalsr  r4  r  r  r  rC  r  s         r6  fetch_depositszwoo.fetch_deposits	
  sR       
 44T5%U\^dIeIefffffffffr7  c           	      r   K   ddi}|                      ||||                     ||                     d{V S )a%  
        fetch all withdrawals made from an account

        https://developer.woox.io/api-reference/endpoint/assets/get_wallet_history

        :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 withdrawals 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>`
        r  WITHDRAWNr  r!  s         r6  fetch_withdrawalszwoo.fetch_withdrawals
  sR       
 44T5%U\^dIeIefffffffffr7  c           	         K   ddi}|                      ||||                     ||                     d{V }|                     |d          }|                     |d          }|                     |||||          S )aw  
        fetch history of deposits and withdrawals

        https://developer.woox.io/api-reference/endpoint/assets/get_wallet_history

        :param str [code]: unified currency code for the currency of the deposit/withdrawals, default is None
        :param int [since]: timestamp in ms of the earliest deposit/withdrawal, default is None
        :param int [limit]: max number of deposit/withdrawals to return, default is None
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a list of `transaction structure <https://docs.ccxt.com/?id=transaction-structure>`
        ra  r  Nr   r   )r  r  r*  rN  parse_transactions)	r4  r  r  r  rC  r  r  r  rK  s	            r6  r   zwoo.fetch_deposits_withdrawals+
  s       I
 "88ueT[[Y`bhMiMijjjjjjjj??<33~~lA..&&tXueVLLLr7  r  c           	         |                      |d          }|                     ||          }|d         }|                     |g d          }|dk    rd}|                     |ddgdd	g          }|                     |g d
          }|                     |dd          }	|                     |ddg|                     |d                    }
i d|d|                     |g 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   r  )
token_sider  ra  r   
withdrawal	fee_tokenr	  
fee_amountr
  )target_addresstargetAddress	addressTosource_addresssourceAddresscreated_timer  rG  r   r3   )r3   withdraw_id
withdrawIdtxidtx_idr  r  r  addressFromr/  r  r  tagFromtagTora  rf  r  r:  r>  updated_timer  commentr  )internalr  r  )rB  r  safe_string_lower_nr  r  r  safe_timestamp_nrH  r  r{  r  r  r  )r4  r  r  r  currencyDefinedr  movementDirectionr  r/  r7  rG  s              r6  parse_transactionzwoo.parse_transaction?
  s   . **;@@::?HUUv& 44[BeBeBeff
** ,++K+z9RUacnTopp&&{4d4d4dee	((6FXX))+7VX\XiXiju  xC  YD  YD  E  E	
K
$$$[2U2U2UVV
 D&&{GVDD
 	

 Y//
 t
 ;
 
 4%%k7EBB
 t
 T
 %
 d&&{H==
 
 d33D4D4D[RZ4[4[\\
  t,,[.-XX!
" t#
$ ..t/?/?Y/W/WXX)
 
 
 	
r7  c                 @    dddddd}|                      |||          S Npendingr=  r  )r  
CONFIRMING
PROCESSINGr  CANCELEDrM  r  s      r6  r  zwoo.parse_transaction_statusw
  7    ##"
 
 &&999r7  fromAccount	toAccountc                 B  K   |                                   d{V  |                     |          }|d         |                     |          d|id|id}|                     |                     ||                     d{V }|                     |di           }	|                     |d          |	d<   |d         |	d<   d|	d	<   |                     |	|          }
|                     | j        d
i           }| 	                    |dd          }|r||
d<   ||
d<   ||
d<   |
S )a  
        transfer currency internally between wallets on the same account

        https://docs.woox.io/#get-transfer-history

        :param str code: unified currency code
        :param float amount: amount to transfer
        :param str fromAccount: account to transfer from
        :param str toAccount: account to transfer to
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `transfer structure <https://docs.ccxt.com/?id=transfer-structure>`
        Nr3   r  )r   rf  fromtor9  rG  r   r=  r:  r   r   Trf  rI  rJ  )
r  r  parse_to_numericv3PrivatePostAssetTransferr  rA  rH  parse_transferr   r  )r4  r  rf  rI  rJ  rC  r  r  rD  r9  r   transferOptionsr   s                r6  r   zwoo.transfer
  sb      !!!!!!!!!==&&d^++F33  	
 	
 88Wf9U9UVVVVVVVV ~~h33 --hDD[ WX&&tX66..z2FF"&..B[]a"b"b" 	.!'HX&1H]#$-H[!r7  c                   K   i }d}||                      |          }|||d<   |||d<   |                     |d          }|                     |dg          }|||d<   |                     |                     ||                     d{V }|                     |di           }	|                     |	dg           }
|                     |
||||          S )a  
        fetch a history of internal transfers made on an account

        https://developer.woox.io/api-reference/endpoint/assets/get_transfer_history

        :param str code: unified currency code of the currency transferred
        :param int [since]: the earliest time in ms to fetch transfers for
        :param int [limit]: the maximum number of  transfers 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 entries for
        :returns dict[]: a list of `transfer structures <https://docs.ccxt.com/?id=transfer-structure>`
        Nrv  rs  rt  ru  r9  rK  )r  rH  r&   v3PrivateGetAssetTransferHistoryr  rA  rN  parse_transfers)r4  r  r  r  rC  r  r  rt  rD  r9  rK  s              r6  fetch_transferszwoo.fetch_transfers
  s       }}T**H#GFO#(GK !!&'226G9--!&GI>>t{{7TZ?[?[\\\\\\\\@ ~~h33~~dFB//##D(E5&IIIr7  r   c                 N   |                      |                     |d          |          }|                     |dd          }|                     |d          }d }||rdnd}|                     |di           }|                     |di           }|                     |d	          ||                     |          ||                     |d
          |                     |d          |                     |d          |                     |                     |d|                    |d	S )Nr   r  rG  successr=  failedrL  rM  r3   rf  r  r:  )	r3   rG  r  r  rf  rI  rJ  r:  r   )rz  rB  r  r  rA  r  r{  parse_transfer_status)	r4  r   r  r  rG  rW  r:  rI  rJ  s	            r6  rP  zwoo.parse_transfer
  s.   L &&t'7'7''J'JHUU))(M;OO	..955$2TT(FnnXvr::NN8T266	""8T22"Y//&&x::++KII)))_EE001A1A(HV\1]1]^^

 

 
	
r7  c                 @    dddddd}|                      |||          S rC  rM  r  s      r6  rY  zwoo.parse_transfer_status%  rH  r7  r  r  c                   K   |                      ||          \  }}|                                  d{V  |                     |           |                     |          }||d}|||d<   |                     |d          }|t          | j        dz   |z             |                     |d          }|d         |d<   |                     |          |d<   | 	                    | 
                    ||                     d{V }	|                     |	di           }
| 
                    |
|                     |
d	          |                     |	d
          |||||ddd	          }|                     ||          S )a  
        make a withdrawal

        https://docs.woox.io/#token-withdraw-v3

        :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>`
        N)rf  r  r  r  z- withdraw() requires a network parameter for r3   r   r9  r4  rG  r*  rD  )	r3   rG  r  rf  r/  r  r  ra  r:  )handle_withdraw_tag_and_paramsr  r  r  rB  r&   r3   r&  r   v3PrivatePostAssetWalletWithdrawr  rA  rH  rA  )r4  r  rf  r  r  rC  r  r  r  rD  r9  transactionDatas               r6  r   zwoo.withdraw/  s      99#vFFV!!!!!!!!!7###==&&
 
 ?"GG""6955?#DG.]$]`d$deee69--#D>!44W==	>>t{{7TZ?[?[\\\\\\\\ ~~h33++d""466**8[AA  
-
 
-
 
 
 %%ox@@@r7  c                   K   |                                   d{V  d}||                     |          }|d         }|                     |          }|d         |                     ||          d}|                     |                     ||                     d{V }|                     ||          }	|                     |	||d          S )a  
        repay borrowed margin and interest

        https://docs.woox.io/#repay-interest

        :param str code: unified currency code of the currency to repay
        :param float amount: the amount to repay
        :param str symbol: not used by woo.repayMargin()
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `margin loan structure <https://docs.ccxt.com/?id=margin-loan-structure>`
        NrS  r3   )r   rf  )rf  rS  )r  rQ  r  currency_to_precisionv1PrivatePostInterestRepayr  parse_margin_loan)
r4  r  rf  rS  rC  rQ  r  r  rD  r  s
             r6  repay_marginzwoo.repay_margina  s       !!!!!!!!![[((FH%F==&&d^00v>>
 
 88Wf9U9UVVVVVVVV ,,Xx@@{{;)
 )
   	r7  c                 >    d |                      d |          d d d d |dS )N)r3   r  rf  rS  rG  r  r   )rz  )r4  r   r  s      r6  rb  zwoo.parse_margin_loan  s8     //h??
 
 	
r7  c                 F    |                                  | j        d         z
  S )Nr   )millisecondsr   )r4  s    r6  noncez	woo.nonce  s!      ""T\2B%CCCr7  r   GETc                    |d         }|d         }|                      ||          }	|                     | j        d         |                   }
|
d|z   dz   z  }
|                     ||                     |                    }|                     |          }|dk    r*|
|dz   |	z   z  }
|r|
d|                     |          z   z  }
n|dk    r$|
|	z  }
|r|
d|                     |          z   z  }
n|                                  |dk    r|d	k    s|d
k    rw|                     | j	        dd          }|sDd}| 
                    | j	        d|          }|                    d          dk    }|r||d<   n||d<   |                     |          }d}t          |                                           }|
|	z  }
| j        |d}|dk    re||z   dz   |z   dz   |	z   }|dk    s|dk    r |                     |          }||z  }d|d<   ni|r%|                     |          }|
d|z   z  }
|d|z   z  }nA|                     |          }|dk    s|dk    s|dk    r|}n
|r|
d|z   z  }
|d|z   z  }d|d<   |                     |                     |          |                     | j                  t&          j                  |d<   |
|||dS )Nr   r   r   rW  r   ?r   POSTr   r   r   Fr   r  algor  	broker_id )z	x-api-keyzx-api-timestampr   PUTzapplication/jsonzcontent-typeDELETE|z!application/x-www-form-urlencodedzx-api-signature)r   methodbodyheaders)implode_paramsimplode_hostnamer   r&  extract_paramskeysort	urlencodecheck_required_credentialsr  r   rB  r  strrg  apiKeyr  hmacencodesecrethashlibsha256)r4  pathsectionrr  rC  rt  rs  r9   accesspathWithParamsr   isSandboxModer  r  r`  authtsquerys                     r6  signzwoo.sign  s;   !*,,T6::##DIe$4V$<==sW}s""64#6#6t#<#<==f%%X6C<.00C 4sT^^F3333u__>!C 4sT^^F3333++---T->%>%>$-BWBW $t|]E R R$ 7$JM#//j-XXH $		& 1 1B 6I  7-5z**.6{+f--DTZZ\\""B>!C![#% G $F{S(72S8>IV##v99V,,DDLD.@GN++ , $v 6 6sU{*e+~~f--V##v&H:L:LDD *sTz)b *M')-4;;t3D3DdkkRVR]F^F^`g`n)o)oG%&fdwOOOr7  httpCodereasonr   rr  rt  rs  c
                 2   |sd S |                      |d          }
|                     |d          }|
sd| j        dz   |                     |          z   }|                     | j        d         ||           |                     | j        d         ||           d S )NrW  r   r.  r-  )r  rB  r3   r  throw_broadly_matched_exceptionr+  throw_exactly_matched_exception)r4  r  r  r   rr  rt  rs  rD  requestHeadersrequestBodyrW  	errorCodefeedbacks                r6  handle_errorszwoo.handle_errors  s     	4
 ..955$$Xv66	 	`w}tyy':'::H001I4QYZZZ001I9V^___tr7  c           	         |                      |d          }|                     ||          }|                      |d          }|                     d          }|                      |d          }|                     |d          }|                     |d          }	|                      |d          }
|
dk    rt          j        |          n|}|||||                     |          ||                     |          |	d	S )
NrS  
fundingFeeUSDr3   r  r   paymentTypePay)r   rS  r  rG  r  r3   rf  rate)	rB  r  rz  rH  r{  r.   
string_negr  r3  )r4  incomerQ  r|  rS  rf  r  r3   rG  r  r  s              r6  parse_incomezwoo.parse_income  s
    ##FH55!!(F33!!&,77&&u--fd++%%fm<<	66&&v}==0;u0D0D#F+++6"Y//''//	
 	
 		
r7  c           	        K   |                                   d{V  d}|                     |dd          \  }}|r!|                     d||||dd           d{V S i }d}| |                     |          }|d         |d<   |||d	<   |                     |d
          }|                     |d
g          }|||d<   |t          |d          |d<   |                     |                     ||                     d{V }	| 	                    |	di           }
| 
                    |
dg           }|                     ||||          S )aB  
        fetch the history of funding payments paid and received on self account

        https://developer.woox.io/api-reference/endpoint/futures/get_fundingFee_history

        :param str [symbol]: unified market symbol
        :param int [since]: the earliest time in ms to fetch funding history for
        :param int [limit]: the maximum number of funding history structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :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 `funding history structure <https://docs.ccxt.com/?id=funding-history-structure>`
        NFrl   rq  rr  r  r3   rS  rs  rt  ru  rv  r9  rK  )r  rw  rx  rQ  rH  r&  ri  $v3PrivateGetFuturesFundingFeeHistoryr  rA  rN  parse_incomes)r4  rS  r  r  rC  rq  r  rQ  rt  rD  r9  rK  s               r6  fetch_funding_historyzwoo.fetch_funding_history  s      !!!!!!!!!88AVXbcc& 	A>>?TV\^cejlrtz|  A  A  A  A  A  A  A  A  A[[((F &tGH#(GK !!&'226G9--!&GI!%ooGFOBB4;;wX^C_C_````````8 ~~h33~~dFB//!!$u===r7  c                    |                      |d          }|                     |          }|                     |dd          }|                     |d          }|                     |d          }|                      |d          }d }||dz   }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S )NrS  nextFundingTime	fundingTsestFundingRateTimestamplastFundingRateTimestampestFundingIntervalHourshr   	markPrice
indexPriceinterestRater<  estimatedSettlePricerG  r  r   estFundingRatefundingTimestampfundingDatetimenextFundingRatenextFundingTimestampnextFundingDatetimepreviousFundingRatelastFundingRatepreviousFundingTimestamppreviousFundingDatetimeinterval)rB  rQ  safe_integer_2rH  r3  r  safe_number_2r{  )	r4  r   rQ  rS  r  r  r  intervalStringr  s	            r6  parse_funding_ratezwoo.parse_funding_rateB  s   * !!+x88V$$#22;@QS^__"&"3"3KAZ"["[#'#4#4[B\#]#] ))+7PQQ%%+H
K
fX&
 
 $	

 D--c22
 #D
 0
 %<==
 4--k;K][[
  4
 t||,@AA
 t
 #D
 "4
 "4#3#3KAR#S#S
  '(@!
" &t||4L'M'M#
$ %
 
 	
r7  c                 >   K   |                      ||           d{V S )aw  
        fetch the current funding rate interval

        https://developer.woox.io/api-reference/endpoint/public_data/fundingRate

        :param str symbol: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `funding rate structure <https://docs.ccxt.com/?id=funding-rate-structure>`
        N)fetch_funding_rate)r4  rS  rC  s      r6  fetch_funding_intervalzwoo.fetch_funding_intervalu  s0       ,,VV<<<<<<<<<r7  c                   K   |                                   d{V  |                     |          }d|d         i}|                     |                     ||                     d{V }|                     |di           }|                     |dg           }|                     |di           }|                     ||          S )an  
        fetch the current funding rate

        https://developer.woox.io/api-reference/endpoint/public_data/fundingRate

        :param str symbol: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `funding rate structure <https://docs.ccxt.com/?id=funding-rate-structure>`
        NrS  r3   r9  rK  r   )r  rQ  v3PublicGetFundingRater  rA  rN  r  )	r4  rS  rC  rQ  r  rD  r9  rK  r~  s	            r6  r  zwoo.fetch_funding_rate  s       !!!!!!!!!V$$fTl
 44T[[&5Q5QRRRRRRRR* ~~h33~~dFB//tQ++&&uf555r7  r  c                 "  K   |                                   d{V  |                     |          }|                     |           d{V }|                     |di           }|                     |dg           }|                     ||          S )a  
        fetch the funding rate for multiple markets

        https://developer.woox.io/api-reference/endpoint/public_data/fundingRate

        :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 rate structures <https://docs.ccxt.com/?id=funding-rates-structure>`, indexed by market symbols
        Nr9  rK  )r  market_symbolsr  rA  rN  parse_funding_rates)r4  r  rC  rD  r9  rK  s         r6  fetch_funding_rateszwoo.fetch_funding_rates  s       !!!!!!!!!%%g..44V<<<<<<<<* ~~h33~~dFB//''g666r7  c           
        K   |                                   d{V  d}|                     |dd          \  }}|r!|                     d||||dd           d{V S |t          | j        dz             |                     |          }|d         }d|d	         i}|||d
<   |                     d||          \  }}|                     |                     ||                     d{V }| 	                    |di           }	| 
                    |	dg           }
g }t          dt          |
                    D ]}|
|         }|                     |d          }|                     |d          }|                    ||                     |          |                     |d          ||                     |          d           |                     |d          }|                     ||||          S )a  
        fetches historical funding rate prices

        https://developer.woox.io/api-reference/endpoint/public_data/fundingRateHistory

        :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
        :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>`
        NFrp   rq  rr     z5 fetchFundingRateHistory() requires a symbol argumentrS  r3   rs  ru  r9  rK  r   fundingRateTimestampr   )r   rS  r   rG  r  rG  )r  rw  rx  r&   r3   rQ  handle_until_optionv3PublicGetFundingRateHistoryr  rA  rN  r  r  rB  rH  r0  r  r{  r  sort_byfilter_by_symbol_since_limit)r4  rS  r  r  rC  rq  rQ  r  rD  r9  rK  ratesr  entryr|  rG  sorteds                    r6  fetch_funding_rate_historyzwoo.fetch_funding_rate_history  sh      !!!!!!!!!88AZ\fgg& 	D>>?XZ`bginpvx~  AC  D  D  D  D  D  D  D  D  D>#DG.e$efffV$$!fTl
 #(GK 229gvNN;;DKKQW<X<XYYYYYYYY. ~~h33~~dFB//q#d))$$ 
	 
	AGE''x88H))%1GHHILL**844#//}EE& LL33      e[1100NNNr7  r  c                    K   d}|rd}nd}d|i}|                      |                     ||                     d{V }|S )a  
        set hedged to True or False for a market

        https://developer.woox.io/api-reference/endpoint/futures/position_mode

        :param bool hedged: set to True to use HEDGE_MODE, False for ONE_WAY
        :param str symbol: not used by woo setPositionMode
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: response from the exchange
        N
HEDGE_MODEONE_WAYpositionMode)v3PrivatePutFuturesPositionModer  )r4  r  rS  rC  	hedgeModer  rD  s          r6  set_position_modezwoo.set_position_mode  sj       	 	"$II!II
 ==dkk'SY>Z>Z[[[[[[[[ r7  c                 <  K   |                                   d{V  |                     |          }d}|d         r|                     |           d{V }n|d         rnd|d         i}d}|                     d|d          \  }}|                     |          |d<   |                     |                     ||                     d{V }n#t          | j        d	z   |d
         z   dz             | 	                    |di           }| 
                    ||          S )al  
        fetch the set leverage for a market

        https://developer.woox.io/api-reference/endpoint/account/get_account_info
        https://developer.woox.io/api-reference/endpoint/futures/get_leverage

        :param str symbol: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.marginMode]: *for swap markets only* 'cross' or 'isolated'
        :param str [params.positionMode]: *for swap markets only* 'ONE_WAY' or 'HEDGE_MODE'
        :returns dict: a `leverage structure <https://docs.ccxt.com/?id=leverage-structure>`
        Nr@   rB   rS  r3   rt   rK  r  & fetchLeverage() is not supported for ra   marketsr9  )r  rQ  r  r(  r)  v3PrivateGetFuturesLeverager  r)   r3   rA  parse_leverage)r4  rS  rC  rQ  rD  r  r  r9  s           r6  fetch_leveragezwoo.fetch_leverage0  s_      !!!!!!!!!V$$&> P	q!99&AAAAAAAAHH< F^ 1	q&,G #J!%!C!COU[]d!e!eJ$($;$;J$G$GGL!!==dkk'SY>Z>Z[[[[[[[[HHT tw)QQTZ[aTbbeooppp~~h33""4000r7  r  c                    |                      |d          }|                     ||          }|                     |d          }|                     |d          }|dk    rd }|}|}|                     |dg           }t          dt          |                    D ]a}	|                     ||	i           }
|                     |
d          }|                      |
d          }|dk    r|}|}P|dk    r|}Y|d	k    r|}b||d         |||d
S )NrS  r  r  r   detailspositionSideBOTHLONGSHORT)r   rS  r  longLeverageshortLeverage)rB  r  r  rH  rN  r  r  rA  )r4  r  rQ  r|  r  spotLeverager  r  r  r  positionpositionLeverager  s                r6  r  zwoo.parse_leverage  s;   ##Hh77!!(F33++HlCC
((:>>1L#$..9b99q#g,,'' 
	1 
	1A~~gq"55H#00:FF##Hn==Dv~~/ 0/ 0X&$(*
 
 	
r7  c                   K   |                                   d{V  d|i}d}||                     |          }||d         r/|                     |                     ||                     d{V S |d         rn|d         |d<   d}|                     d|d          \  }}|                     |          |d	<   |                     |                     ||                     d{V S t          | j        d
z   |d         z   dz             )a  
        set the level of leverage for a market

        https://developer.woox.io/api-reference/endpoint/spot_margin/set_leverage
        https://developer.woox.io/api-reference/endpoint/futures/set_leverage

        :param float leverage: the rate of leverage(1, 2, 3, 4 or 5 for spot markets, 1, 2, 3, 4, 5, 10, 15, 20 for swap markets)
        :param str [symbol]: unified market symbol(is mandatory for swap markets)
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.marginMode]: *for swap markets only* 'cross' or 'isolated'
        :param str [params.positionMode]: *for swap markets only* 'ONE_WAY' or 'HEDGE_MODE'
        :returns dict: response from the exchange
        Nr  r@   rB   r3   rS  rt   rK  r  r  ra  r  )	r  rQ  v3PrivatePostSpotMarginLeverager  r(  r)  v3PrivatePutFuturesLeverager)   r3   )r4  r  rS  rC  r  rQ  r  s          r6  set_leveragezwoo.set_leverage  sJ      !!!!!!!!!
 [[((FNvf~N==dkk'SY>Z>Z[[[[[[[[[F^ 	q &tGH"J!%!C!COU[]d!e!eJ$($;$;J$G$GGL!99$++gv:V:VWWWWWWWWWtw)QQTZ[aTbbeoopppr7  c                 B   K   |                      ||d|           d{V S )a  
        add margin

        https://docs.woox.io/#update-isolated-margin-setting

        :param str symbol: unified market symbol
        :param float amount: amount of margin to add
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.position_side]: 'LONG' or 'SHORT' in hedge mode, 'BOTH' in one way mode
        :returns dict: a `margin structure <https://docs.ccxt.com/?id=margin-structure>`
        ADDNmodify_margin_helperr4  rS  rf  rC  s       r6  
add_marginzwoo.add_margin  s4       ..vvufMMMMMMMMMr7  c                 B   K   |                      ||d|           d{V S )a  
        remove margin from a position

        https://docs.woox.io/#update-isolated-margin-setting

        :param str symbol: unified market symbol
        :param float amount: amount of margin to remove
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.position_side]: 'LONG' or 'SHORT' in hedge mode, 'BOTH' in one way mode
        :returns dict: a `margin structure <https://docs.ccxt.com/?id=margin-structure>`
        REDUCENr  r  s       r6  reduce_marginzwoo.reduce_margin  s4       ..vvxPPPPPPPPPr7  c                    K   |                                   d {V  |                     |          }|d         d||d}|                     |                     ||                     d {V S )Nr3   USDT)rS  adjust_tokenadjust_amountaction)r  rQ  !v1PrivatePostClientIsolatedMarginr  )r4  rS  rf  ra  rC  rQ  r  s          r6  r  zwoo.modify_margin_helper  s      !!!!!!!!!V$$Tl"#	
 
 ;;DKKQW<X<XYYYYYYYYYr7  c                   K   |                                   d{V  |                     |          }d|d         i}|                     |                     ||                     d{V }|                     |di           }|                     |dg           }|                     |di           }|                     ||          S )a  
        fetch data on an open position

        https://developer.woox.io/api-reference/endpoint/futures/get_positions

        :param str symbol: unified market symbol of the market the position is held in
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `position structure <https://docs.ccxt.com/?id=position-structure>`
        NrS  r3   r9  r   r   )r  rQ  v3PrivateGetFuturesPositionsr  rA  rN  parse_position)	r4  rS  rC  rQ  r  rD  r  r   r~  s	            r6  fetch_positionzwoo.fetch_position  s       !!!!!!!!!V$$fTl
 ::4;;wPV;W;WXXXXXXXX@ &"55NN6;;;	y!R00""5&111r7  c                    K   |                                   d{V  |                     |           d{V }|                     |di           }|                     |dg           }|                     ||          S )av  
        fetch all open positions

        https://developer.woox.io/api-reference/endpoint/futures/get_positions

        :param str[] [symbols]: list of unified market symbols
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `position structure <https://docs.ccxt.com/?id=position-structure>`
        Nr9  r   )r  r  rA  rN  parse_positionsr4  r  rC  rD  r  r   s         r6  fetch_positionszwoo.fetch_positions,  s       !!!!!!!!!::6BBBBBBBB@ &"55NN6;;;	##Iw777r7  r  c                 8   |                      |d          }|                     ||          }|                      |d          }d }t          j        |d          rd}nd}|                      |d          }|                     |dd          }|                      |d	          }d }	|F|                    d
          dk    r|                     |d	          }	n|                     |d	          }	|                     |dd          }
t          j        ||
          }t          j	        ||          }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          |                     |          d d |                     |dd           |d |d!k    d d d"
          S )#NrS  r  r<  longshortrq  r  
mark_pricerG  r  r  averageOpenPriceaverage_open_pricer  r   r3   r  r  initialMargininitialMarginPercentagemaintenanceMarginmaintenanceMarginPercentage
entryPricenotionalr  unrealizedPnl	contractsmarginRatioestLiqPriceest_liq_pricer  margin_moder  )
liquidationPricer  	lastPrice
collateralr  r  r   r  r  r  )rB  r  r.   	string_gtr  r  r  rH  
string_subr  
string_abssafe_positionr  r3  r{  r  safe_string_lower_2)r4  r  rQ  rc  rv  r  rq  r  r  rG  r  priceDifferenceunrealisedPnlr  r  s                  r6  r  zwoo.parse_position[  s,   b ##Hh77!!(F33)44T3'' 	DDD''??&&xlKK	**8[AA	&##C((2-- //+FF		 --hDD	''2DFZ[[
!,Y
CC*?DAA!$''%dI66''.AA!! #
H#
$#
 d&&vx88#
 	#

 Y//#
 "4#
 T#
 &t#
  #
 *4#
 $++J77#
 ))(33#
 ((:>>#
 T..}==#
 **400#
  D--l;;!#
" 4##
$ !% 2 28]O \ \**955228\=YY"f,!#7#
 #
 #
   	r7  fromCodetoCodec                   K   |                                   d{V  |                                |                                |                     |          d}|                     |                     ||                     d{V }|                     |di           }|                     |d|          }|                     |          }	|                     |d|          }
|                     |
          }|                     ||	|          S )a&  
        fetch a quote for converting from one currency to another

        https://docs.woox.io/#get-quote-rfq

        :param str fromCode: the currency that you want to sell and convert from
        :param str toCode: the currency that you want to buy and convert into
        :param float [amount]: how much you want to trade in units of the from currency
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `conversion structure <https://docs.ccxt.com/?id=conversion-structure>`
        N)	sellTokenbuyTokensellQuantityr9  r#  r$  )	r  r'  r+  v3PrivateGetConvertRfqr  rA  rB  r  parse_conversion)r4  r   r!  rf  rC  r  rD  r9  fromCurrencyIdfromCurrencytoCurrencyId
toCurrencys               r6  fetch_convert_quotezwoo.fetch_convert_quote  s      !!!!!!!!!!)) 11&99
 

 44T[[&5Q5QRRRRRRRR" ~~h33))$XFF}}^44''j&AA]]<00
$$T<DDDr7  c                    K   |                                   d{V  d|i}|                     |                     ||                     d{V }|                     |di           }|                     |          S )aS  
        convert from one currency to another

        https://docs.woox.io/#send-quote-rft

        :param str id: the id of the trade that you want to make
        :param str fromCode: the currency that you want to sell and convert from
        :param str toCode: the currency that you want to buy and convert into
        :param float [amount]: how much you want to trade in units of the from currency
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `conversion structure <https://docs.ccxt.com/?id=conversion-structure>`
        Nr_  r9  )r  v3PrivatePostConvertRftr  rA  r'  )	r4  r3   r   r!  rf  rC  r  rD  r9  s	            r6  create_convert_tradezwoo.create_convert_trade  s       !!!!!!!!!r
 55dkk'66R6RSSSSSSSS ~~h33$$T***r7  c                   K   |                                   d{V  d|i}|                     |                     ||                     d{V }|                     |di           }|                     |d          }|                     |d          }d}	d}
||                     |          }	||                     |          }
|                     ||	|
          S )a  
        fetch the data for a conversion trade

        https://docs.woox.io/#get-quote-trade

        :param str id: the id of the trade that you want to fetch
        :param str [code]: the unified currency code of the conversion trade
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `conversion structure <https://docs.ccxt.com/?id=conversion-structure>`
        Nr_  r9  	sellAssetbuyAsset)r  v3PrivateGetConvertTrader  rA  rB  r  r'  )r4  r3   r  rC  r  rD  r9  r(  r*  r)  r+  s              r6  fetch_convert_tradezwoo.fetch_convert_trade
  s       !!!!!!!!!r
 66t{{7F7S7STTTTTTTT ~~h33))$<<''j99
%==88L#|44J$$T<DDDr7  c                 |  K   |                                   d{V  i }|                     d||          \  }}|||d<   |||d<   |                     |                     ||                     d{V }|                     |di           }|                     |dg           }|                     ||dd||          S )	a[  
        fetch the users history of conversion trades

        https://docs.woox.io/#get-quote-trades

        :param str [code]: the unified currency code
        :param int [since]: the earliest time in ms to fetch conversions for
        :param int [limit]: the maximum number of conversion structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: timestamp in ms of the latest conversion to fetch
        :returns dict[]: a list of `conversion structures <https://docs.ccxt.com/?id=conversion-structure>`
        Nru  rs  rv  r9  tradeVosr1  r2  )r  r  v3PrivateGetConvertTradesr  rA  rN  parse_conversions)	r4  r  r  r  rC  r  rD  r9  rK  s	            r6  fetch_convert_trade_historyzwoo.fetch_convert_trade_history3  s       !!!!!!!!!229gvNN#(GK #GFO77GV8T8TUUUUUUUU* ~~h33~~dJ33%%dD+z5RWXXXr7  
conversionr)  r+  c                    |                      |dd          }|                     |dd          }|                     ||          }|                     |dd          }|                     ||          }|||                     |          |                     |d          ||                     |dd	          ||                     |d
d          |                     |d          d d
S )NexpireTimestampr  r#  r2  r$  r1  r_  r%  
sellAmountbuyQuantity	buyAmountbuyPrice)
r   rG  r  r3   r)  
fromAmountr+  toAmountrg  r  )r  r  rz  r  rB  r  r{  )	r4  r:  r)  r+  rG  fromCurrr   rM  r!  s	            r6  r'  zwoo.parse_conversion`  s    H ''
4E}UU	%%j+zJJ**8\BB
JDD((Z88"Y//"":y99$,,ZVV **:}kRR%%j*==
 
 	
r7  c                   K   |                                   d{V  |                     |           d{V }i }|                     |dg           }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	||<   ~|S )
a  
        fetches all available currencies that can be converted

        https://docs.woox.io/#get-quote-asset-info

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an associative dictionary of currencies
        NrK  r   r   tickrh  )rf  r   r  r  )r   r3   r  r   ra  r4   rb  r  r   r  rv  rw  rx  )	r  v3PrivateGetConvertAssetInforN  r  r  rB  rz  r{  r  )	r4  rC  rD  r  r9  r  r  r3   r  s	            r6  fetch_convert_currencieszwoo.fetch_convert_currencies  s\      !!!!!!!!!::6BBBBBBBB ~~h33q#d))$$ 	 	AGE!!%11B**2..D  !--eV<<  $# 
  $#! !
  $#      ..umDD5 F4LL8 r7  c                 *  K   |                                   d{V  |                     |dddd          }|                     |           d{V }|                     |di           }|                     |dg           }|                     ||          S )a  
        fetches the auto deleveraging rank and risk percentage for a list of symbols

        https://docs.woox.io/#get-all-position-info-new

        :param str[] [symbols]: a list of unified market symbols
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: an array of `auto de leverage structures <https://docs.ccxt.com/?id=auto-de-leverage-structure>`
        NTr9  r   )r  r  r  rA  rN  parse_adl_ranksr  s         r6  fetch_positions_adl_rankzwoo.fetch_positions_adl_rank  s       !!!!!!!!!%%gtT4FF::6BBBBBBBB@ &"55NN6;;;	##Iw777r7  r   c           	          |                      |d          }|                     |d          }||                     ||d d          |                     |d          d d ||                     |          dS )NrS  rG  rc  adlQuantile)r   rS  rankratingr   rG  r  )rB  rH  r  r{  r  )r4  r   rQ  r|  rG  s        r6  parse_adl_rankzwoo.parse_adl_rank  s    4 ##D(33%%dK88	&&xzJJ$$T=99"Y//
 
 	
r7  c                    |                      |          }|d         }t          |                                          }t          dt	          |                    D ]}||         }|dk    r|c S |                     |d          S )Nr   r   r   )r  r  r  r  r  r*  )r4  r  currencyItemr   networkKeysr  r  s          r6  !default_network_code_for_currencyz%woo.default_network_code_for_currency(  s    }}T**
+8==??++q#k**++ 	 	A!!nG%   {A...r7  enablec                 l    t          t          |                               |           || j        d<   d S )Nr   )r1  r0   set_sandbox_moder   )r4  rT  r5  s     r6  rV  zwoo.set_sandbox_mode3  s3    c4))&111&,]###r7  )N)NN)__name__
__module____qualname__r   r2  rE  r   rI  r#   r   rP  dictr  r{  r   r  r  r  r   r  r  r    r  r   r  floatr  r  r   r   r   r   r   r  r  r)  rZ  r   ra  rf  rk  ro  r|  r  r  r  r3  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  r!   r"  r%  r   rA  r  r"   r   rU  rP  rY  r   rc  rb  rg  r  intr  r  r  r   r  r  r  r   r   r  r  boolr  r   r  r  r  r   r  r  r  r  r   r  r  r
   r,  r/  r4  r9  r'  rG  r   rJ  rO  rS  rV  __classcell__)r5  s   @r6  r0   r0      s       a# a a a a a aF )+ #
 #
 #
 #
J ') 8 8S 8 8 8 8. *, .( .(V .( .( .( .(`R
4 R
F R
 R
 R
 R
h <@d[] (= (= (=S (= (=bfglbm (= (= (= (=TE E Ev E E E E EN
 
 


 

T 

6 

EX 

 

 

 

 ;= 4 4c 4AT 4 4 4 4@ /1 8 8[ 8 8 8 8t -/ T T: T T T Tl XZ Q Qc Q Q Q Q Q" Y[ R Rs R% R R R R" }A  Y]  {  HJ R R RI RU^ Rhm Rvy R  SV R  ux R  OT R R R R0 ~B  [_  }A  JL R R# RY RV_ Rin Rwz R  UX R  wz R  QV R R R R0 mqy{ q. q. q.I q.Y q.X] q.fi q. q. q. q.f3 3 3 fjx|  FH R. R.3 R. R.9 R.I R._b R.ru R. R. R. R.h 9=R 7. 7.S 7.# 7. 7. 7. 7.r 59 "1 "1c "1 "1 "1 "1H BD  S    4 8<B f. f.C f. f. f. f. f.P 04$UYbd A? A? A?C A?s A?imnsit A? A? A? A?F 59tZ^gi M Mc M MTW Mnrsxny M M M M, 7;\`ik M M M3 MVY Mptuzp{ M M M M,As A A A AP P Pv P P P P Pd      @DB *c *cS *c *cS\ *c *c *c *cX ?CQUdhqs 5H 5H 5H 5H3 5H^a 5Hx|  ~B  yC 5H 5H 5H 5Hn
 
 
4 
 
 
 
 ?CQUdhqs (G (G3 (G (G3 (G^a (G (G (G (GT 37TX\eg ?G ?GC ?Gs ?GRU ?G ?G ?G ?GB +- >1 >1g >1 >1 >1 >1@&
 &
 &
P *, #( #( #( #( #( #(J) ) ) ) ) =? : : :> : : : :B	+ 	+# 	+ 	+ 	+ 	+	
 	
H 	
P^ 	
 	
 	
 	
 8<$]ajl 8< 8< 8<C 8<WZ 8<qt 8< 8< 8< 8<t .2SW`b G Gs G# GS Ggklwgx G G G G"/ /t /x /; / / / /b3 3 3   04$UYbd g g gC gs gimnyiz g g g g" 37TX\eg g gC gs gRU glpq|l} g g g g" <@daenp M MS M M[^ Muy  {F  vG M M M M(6
 6
T 6
X 6
Q\ 6
 6
 6
 6
p:s : : : : ac + +3 + +C +TW +gt + + + +Z 154VZce ;J ;J# ;JS ;JPS ;Jjno|j} ;J ;J ;J ;Jz8
 8
t 8
x 8
= 8
 8
 8
 8
t:C :C : : : : QU]_ 0A 0A3 0A 0A 0A# 0Ado 0A 0A 0A 0Ad JNVX    s  E  3        D
 
 
 
 
 
 D D D "*%DW[ 9P 9P 9P 9Pvc 3 S # X\ dg    !
 !
6 !
 !
 !
 !
F 9=4^bkm => =># =>S =>X[ => => => =>~1
 1
f 1
 1
 1
 1
 1
f @B 
= 
=3 
=k 
= 
= 
= 
= <> '6 '6s '6+ '6 '6 '6 '6R <@ #7 #7 #7| #7 #7 #7 #7J >BPTcgpr CO COs CO# CO]` CO CO CO COJ CGr  d C    8 8: b1 b13 b1h b1 b1 b1 b1H
 
t 
V 
x 
 
 
 
: ?C2 q q3 q q q q q@ CE N Ns NE NI[ N N N N FH Q Q# Qu QL^ Q Q Q Q LN 	Z 	Z 	ZRd 	Z 	Z 	Z 	Z 8: 22 223 22 22 22 22h 8<B -8 -8W -84PX> -8 -8 -8 -8^d dt dV d d d dL SW_a (E (E# (Es (EC (Efp (E (E (E (ET ]aik + +S +C + +VY +pz + + + +> >B" 'E 'EC 'Es 'EQ[ 'E 'E 'E 'ER =Atbfoq +Y +Yc +Y +Y\_ +Yvz  |F  wG +Y +Y +Y +YZ4
 4
4 4
x 4
\d 4
pz 4
 4
 4
 4
l 57 : :: : : : :x AER .8 .8g .8TXY\T] .8 .8 .8 .8`$
 $
4 $
 $
3 $
 $
 $
 $
L	/ 	/ 	/-t - - - - - - - - - -r7  r0   )6 ccxt.async_support.base.exchanger   ccxt.abstract.woor   r  r  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   r   r    r!   r"   typingr#   ccxt.base.errorsr$   r%   r&   r'   r(   r)   r*   r+   r,   ccxt.base.decimal_to_precisionr-   ccxt.base.preciser.   r0    r7  r6  <module>rg     s   6 5 5 5 5 5 ) ) ) ) ) )   Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y  Y       * * * * * * 0 0 0 0 0 0 . . . . . . ' ' ' ' ' ' ) ) ) ) ) ) ) ) ) ) ) ) , , , , , , . . . . . . * * * * * * 4 4 4 4 4 4 % % % % % %\@- \@- \@- \@- \@-(K \@- \@- \@- \@- \@-r7  