
    E#i                    P   S SK Jr  S SKJr  S SKrS SKrS SKJrJrJ	r	J
r
JrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJ r J!r!J"r"J#r#  S SK$J%r%  S SK&J'r'  S SK&J(r(  S SK&J)r)  S S	K&J*r*  S S
K&J+r+  S SK&J,r,  S SK&J-r-  S SK&J.r.  S SK&J/r/  S SK0J1r1  S SK2J3r3   " S S\\5      r4g)    )Exchange)ImplicitAPIN)AccountAny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                    	  ^  \ rS rSrS\4U 4S jjr0 4S jr0 4S\4S jjr0 4S\	\
   4S jjrS\S\
4S jrS	S	0 4S
\S\S\S\	\   4S jjrSS\S\
S\4S jjrS rSS\S\
S\4S jjr0 4S
\S\4S jjr0 4S\4S jjr0 4S\4S jjr0 4S
\S\4S jjr0 4S
\S\4S jjrS	S	S	0 4S
\S\S\S\S\S\S\S\ 4S jjr!S	S	S	0 4S
\S\S\S\S\S \S\S\ 4S! jjr"S	0 4S
\S\S\S\S\4
S" jjr#S# r$S	S	0 4S$\S
\S\S\S\S\4S% jjr%S	0 4S$\S
\&4S& jjr'S	0 4S
\&4S' jjr(0 4S(\4S) jjr)S	0 4S$\S
\&4S* jjr*S	S	S	0 4S
\&S\S\S\	\    4S+ jjr+S	S	S	0 4S
\&S\S\S\	\    4S, jjr,S	S	S	0 4S
\&S\S\S\	\    4S- jjr-S.\&4S/ jr.SS0\S\
S\ 4S1 jjr/S2\&4S3 jr0S	0 4S
\S\S\14S4 jjr2S5S	S	0 4S
\S6\S\S\S\	\3   4
S7 jjr4SS\
S\34S8 jjr5S	S	S	0 4S$\S
\&S\S\4S9 jjr6S	S	S	0 4S
\&S\S\4S: jjr70 4S\	\8   4S; jjr9S< r:0 4S\;4S= jjr<S\;4S> jr=0 4S?\S\>4S@ jjr?SA\S\4SB jr@SSC\AS\>4SD jjrBS	S	S	0 4S?\&S\S\S\4SE jjrCS	S	S	0 4S?\&S\S\S\	\D   4SF jjrESSG\SC\AS\D4SH jjrFSI rGSJ rHS	S	S	0 4S?\&S\S\S\	\I   4SK jjrJS	S	S	0 4S?\&S\S\S\	\I   4SL jjrKS	S	S	0 4S?\&S\S\S\	\I   4SM jjrLSSN\SC\AS\I4SO jjrMS2\&4SP jrN0 4S?\S\SQ\SR\S\O4
SS jjrPS	S	S	0 4S?\&S\S\S\	\O   4ST jjrQSSU\SC\AS\O4SV jjrRS2\&S\&4SW jrSS	0 4S?\S\SX\SY\&S\I4
SZ jjrTS	0 4S?\S\S
\&4S[ jjrUSSC\A4S\ jjrVS] rWS^S_0 S	S	4S` jrXSa\YSb\Sc\Sd\Se\Sf\4Sg jrZSS\
4Sh jjr[S	S	S	0 4S
\&S\S\4Si jjr\SS\
S\]4Sj jjr^0 4S
\S\]4Sk jjr_0 4S
\S\]4Sl jjr`S	0 4Sm\aS\b4Sn jjrcS	S	S	0 4S
\&S\S\4So jjrdS	0 4Sp\eS
\&4Sq jjrf0 4S
\S\g4Sr jjrhSSs\S\
S\g4St jjriS	0 4Ss\YS
\&4Su jjrj0 4S
\S\S\k4Sv jjrl0 4S
\S\S\k4Sw jjrm0 4S
\S\k4Sx jjrn0 4S
\&4Sy jjroS	0 4Sm\aS\	\p   4Sz jjrqSS{\S\
4S| jjrrS	0 4S}\S~\S\S\s4S jjrtS	0 4S$\S}\S~\S\S\s4
S jjruS	0 4S$\S?\&S\s4S jjrvS	S	S	0 4S?\&S\S\S\	\s   4S jjrwSS\S\AS\AS\s4S jjrx0 4S\4S jjryS rzS\e4U 4S jjr{Sr|U =r}$ )woo   returnc                   > U R                  [        [        U ]  5       0 SS_SS_SS/_SS_S	S
_SS_SS_SS_S0 SS _SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_S S_S!S_S"S_0 S#S_S$S_S%S_S&S_S'S_S(S_S)S_S*S_S+S_S,S_S-S_S.S_S/S_S0S_S1S_S2S_S3S_E0 S4S_S5S_S6S_S7S_S8S_S9S_S:S_S;S_S<S_S=S_S>S_S?S_S@S_SAS_SBS_SCS_SDS_E0 SES_SFS_SGS_SHS_SIS_SJS_SKS_SLS_SMS_SNS_SOS_SPS_SQS_SRS_SSS_STS_SUS_E0 SVS_SWS_SXS_SYS_SZS_S[S_S\S_S]S_S^S_S_S_S`S_SaS_SbSc_SdS_SeS_SfS_SgS_ESSSSSSh.E_SiSjSkSlSmSnSoSpSqSrSsStSu._SvSwSxSySySz.S{S|S|Sz.S}S~/S/SSS.S._SSSSS.0SSSSSSSSSSSSSSS.00 SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SSSSSSSSSS.	ESSSSSSSSSSS.
SSSSS.S.Sz.SSSS000SSSSSSSSSSSSSSSS.00 SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_0 SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_ESSS.ESSSSSSSSSSSS.SSSSSSSSS.SSSSSSSSSS.	S.S.S._SSSSU R	                  S5      U R	                  S5      S.0_SSSSSSSSSS.SSSSSS.SSS.0 SS0SS.
_SSSSSSSS.SSSS SSSSS.SSSSSSSS.S SSSSSS.SSSSS.SSSSSS.SSS SSSSS.SSS S SSSSS.SS0S.	SS0SSS0S.SS0S S.S S S.S._S0 _S0 S[
        _GS [        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS[        _GS	[        _GS
[        _GS[        _GS[        _GS[        _GS[        _[        [        [        [        [        [        GS.GS._GS[        0E5      $ (  Nidr/   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fetchPositionHistoryfetchPositionModefetchPositions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superr/   describeparse_numberr)   r$   r*   r&   r'   r#   r+   r,   )self	__class__s    P/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/async_support/woo.pyr0  woo.describe   s   c4 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 $UM[N !$O[P (Q[R )%S[T tU[V uW[X Y[Z T[[\ t][^ "4_[` #Da[b $Zc[d !$e[f #Dg[h i[j 4k[l  $"#'  u[^>
J K^>
d ~467 =;<
 *+ ] C $'e^>
T  *,+-  $%-.+,-.%&-.-.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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 ']coU^>
t	 !%"&!..x8!..x8	u	^>
D
 "#+0$59 ""# 	/ "#""% ##!
4
 .t C? E
^>
F #&*(,$($(%*-
 -2).+06:#'#'"&#'	( #($($)+/27/4#'1$4 %)&+!$$&%**/& ',#'$)*/	# ',!$#'$(*/( ',!$$(%+#'$(*/$ ',!$$(,0%+#'$(*/	*  #IGR y  ) $$ "9  $	 ##q\G^>
@ A^>
B _0 0 .	
 Z Z Z Z \ Z Z \ \ \ \  \!& &3#00:2<OY[e'C^>
z Y{^>
 ^ ^	    c                    #    U R                  U5      I Sh  vN nU R                  US0 5      nU R                  US5      nUc  SnOUS:X  a  SnOSnUSSSUS.$  NB7f)	a9  
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*  )r9  updatedetar   r   )v3PublicGetSystemInfo	safe_dictsafe_string)r2  paramsresponser8  r9  s        r4  fetch_statuswoo.fetch_status  sy      33F;; ~~h3!!$1>Fs]F"F
 	
) <s   AAAAc                 d   #    U R                  U5      I Sh  vN nU R                  US5      $  N7f)a<  
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)r2  rB  rC  s      r4  
fetch_timewoo.fetch_time!  s4      33F;;   ;77 <s   0.0c                 
  #    U R                   S   (       a  U R                  5       I Sh  vN   U R                  U5      I Sh  vN nU R                  US0 5      nU R	                  US/ 5      nU R                  U5      $  NT N=7f)z
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   Nr8  rows)r   load_time_differencev3PublicGetInstrumentsr@  	safe_listparse_markets)r2  rB  rC  r8  rL  s        r4  fetch_marketswoo.fetch_markets8  sz      <<12++---44V<<B ~~h3~~dFB/!!$''I .<s!   (BA?BB<BBmarketc                    U R                  US5      nUR                  S5      nU R                  US5      nSnSnUS:X  a  SnSnO
US:X  a  SnS	nU R                  US
5      nU R                  US5      n	U R                  U5      n
U R                  U	5      nS nS nU
S-   U-   nS nS nS nSnUnU(       aH  SnU R                  US5      nU R                  U5      nU
S-   U-   S-   U-   nU R                  S5      nSnSnU R                  US5      S:H  n0 SU_SU_SU
_SU_SU_SU_SU	_SU_SW_SU_SU_S	U_SS_SS_SU_SU_SU_UUS S S S U R	                  US5      U R	                  US 5      S!.S S S".U R	                  US#5      U R	                  US$5      S".U R	                  US%5      U R	                  US&5      S".U R	                  US'5      S S".S(.S US).
E$ )*Nsymbol_r   FSPOTTr@   PERPrB   r   r   /:1r9  TRADINGr3   basequotesettlebaseIdquoteIdsettleIdtyperA   rC   rD   activecontractr&  baseTick	quoteTick)amountpriceminmaxbaseMinbaseMaxquoteMinquoteMaxminNotional)r  rh  ri  cost)
r'  contractSizeexpiryexpiryDatetimestrike
optionType	precisionlimitscreatedr   )rA  splitsafe_currency_coder1  safe_number)r2  rS  marketIdpartsfirstr@   rB   
marketTyper`  ra  r]  r^  rb  r_  rU  rs  r&  r'  rA   re  rd  s                        r4  parse_marketwoo.parse_marketh  s   ##FH5s#  *F?DJf_DJ!!%+""5!,&&v.''0e# F''q1H,,X6FCZ%'#-6F,,S1LFG!!&(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$ _0
 0	
r6  NrU  sincer  c                 @  #    U R                  5       I Sh  vN   U R                  U5      nSUS   0nUb  X6S'   U R                  U R                  Xd5      5      I Sh  vN nU R	                  US0 5      nU R                  US/ 5      n	U R                  XX#5      $  N N>7f)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>`
NrU  r3   r  r8  rL  )load_marketsrS  v3PublicGetMarketTradesextendr@  rO  parse_trades)
r2  rU  r  r  rB  rS  requestrC  r8  rL  s
             r4  fetch_tradeswoo.fetch_trades  s      !!!V$fTl
 $G55dkk'6RSS& ~~h3~~dFB/  u<<9 	" Ts"   BBABB=BBtradec                    SU;   nU R                  USS5      nS nUb;  UR                  S5      S:  a  U R                  USS5      nOU R                  US5      nU R	                  US5      nU R                  Xb5      nUS   nU R                  USS5      nU R                  US	S
5      n	U R                  USS5      n
U R                  USS/S/5      nU R	                  US5      nUb  XS'   [        R                  " X5      nU R                  US5      nU R	                  US5      nS nU(       a!  U R                  USS5      S:H  nU(       a  SOSnU R                  UUU R                  U5      UUUU	UU
US UUS.U5      $ )Nr3   executed_timestampexecutedTimestamp.rU  executed_priceexecutedPriceexecuted_quantityexecutedQuantityorder_idorderId	fee_assetfeeAssetfeerr  sideis_makerisMakerr[  r   r   )r3   rG  datetimerU  r  ri  rh  rr  r   takerOrMakerrc  r  r   )safe_string_2findsafe_timestamp_2rH  rA  safe_marketparse_token_and_fee_tempr-   
string_mulsafe_string_lower
safe_tradeiso8601)r2  r  rS  isFromFetchOrdertimestampStringrG  r~  rU  ri  rh  r  r  feeCostrr  r  r3   r  r  s                     r4  parse_tradewoo.parse_trade  s   < !EM,,U4HJ]^	&##C(2- 11%9MObc	 --e5HI	##E84!!(3!""5*:OL##E+>@RS%%eZC++EK3LugV""3/!K!!%0%%eV4eT* ((
IF#MG&-77L"Y/( 
  	r6  c                     U R                  X5      nS nUb'  U R                  X5      nU R                  U5      nUUS.nU$ )Nrr  currency)safe_string_nr|  )r2  itemfeeTokenKeysfeeAmountKeysr  r  feeCurrencyIdfeeCurrencyCodes           r4  r  woo.parse_token_and_fee_temp-  sQ    $$T9 ..tBM"55mDO+C 
r6  r  c                 *   U R                  US5      nU R                  X25      nUUU R                  [        R                  " U R                  US5      S5      5      U R                  [        R                  " U R                  US5      S5      5      S S S.$ )NrU  makerFee100takerFeer   rU  r   r   r   r   )rA  safe_symbolr1  r-   
string_div)r2  r  rS  r~  rU  s        r4  parse_trading_feewoo.parse_trading_fee9  s    ##C2!!(3&&w'9'9$:J:J3PZ:[]b'cd&&w'9'9$:J:J3PZ:[]b'cd
 	
r6  c                 
  #    U R                  5       I Sh  vN   U R                  U5      nSUS   0nU R                  U R                  XB5      5      I Sh  vN nU R	                  US0 5      nU R                  Xc5      $  Nh N*7f)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>`
NrU  r3   r8  )r  rS  v3PrivateGetTradeTradingFeer  r@  r  )r2  rU  rB  rS  r  rC  r8  s          r4  fetch_trading_feewoo.fetch_trading_feeE  s      !!!V$fTl
 99$++g:VWW ~~h3%%d33% 	"
 Xs!   BA??BB)BBc           
        #    U R                  5       I Sh  vN   U R                  U5      I Sh  vN nU R                  US0 5      nU R                  US5      nU R                  US5      n0 n[	        S[        U R                  5      5       He  nU R                  U   nUUU R                  [        R                  " US5      5      U R                  [        R                  " US5      5      SSS.Xh'   Mg     U$  N N7f)	a<  
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
Nr8  makerFeeRatetakerFeeRater   10000Tr  )
r  v3PrivateGetAccountInfor@  rA  rangelensymbolsr1  r-   r  )	r2  rB  rC  r8  r   r   resultirU  s	            r4  fetch_trading_feeswoo.fetch_trading_feese  s      !!!55f==@ ~~h3  ~6  ~6q#dll+,A\\!_F  **7+=+=eW+MN**7+=+=eW+MN"!FN - _ 	"=s    C;C7C;C9CC;9C;c                   #    0 nU R                  U5      nU R                  U5      n[        R                  " X4/6 I Sh  vN u  pVU R	                  US/ 5      nU R	                  US/ 5      nU R                  US5      n	U R                  US5      n
[        U
R                  5       5      n[        S[        U5      5       GH  nX   nU R                  U5      nU R                  X   S5      nU R                  X   S5      n[        UR                  5       5      n0 n[        S[        U5      5       H  nUU   nU R                  UU0 5      nU R                  UU0 5      nU R                  UU5      nU R                  US5      nUUUSU R                  US5      S:H  U R                  US	5      S:H  U R                  US
5      U R!                  U R#                  U R                  US5      5      5      U R                  US5      SS.SSS.S.UU/S.
UU'   M     U R%                  USUSSSUSSSSSS.SSS.S.UU/S.5      X.'   GM     U$  GN7f)z
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
NrL  r   balance_tokenr   networkallow_depositr[  allow_withdrawwithdrawal_feedecimalsminimum_withdrawalrj  )r   deposit)
r3   currencyNetworkIdr  rd  r  r   r  rx  ry  r   crypto)r  r   )r3   r4   coderx  rd  r  r   r  r   rc  ry  r   )v1PublicGetTokenv1PublicGetTokenNetworkasynciogatherrO  group_bylistkeysr  r  r|  index_byr@  network_id_to_coderA  r}  r1  parse_precisionsafe_currency_structure)r2  rB  r  tokenResponsePromisetokenNetworkResponsePromisetokenResponsetokenNetworkResponse	tokenRowstokenNetworkRowsr   
tokensByIdcurrencyIdsr  
currencyIdr  tokensByNetworkIdchainsByNetworkIdr  resultingNetworksj	networkId
tokenEntrynetworkEntrynetworkCodespecialNetworkIds                            r4  fetch_currencieswoo.fetch_currencies  s     #44V<\ '+&B&B6&J#: 5<NNEYDw4x.x+NN=&"=	>>*>K}}%5w?]]9o>
:??,-q#k*+A$J**:6D $j.Di P $l.F	 R)..01D&(1c$i( G	!^^,=y"M
#~~.?BO"55iF#'#3#3J#H #)9*"#//oNRUU $ 0 0?O PTW W++L:JK!%!2!243G3GHXHXYceoHp3q!r $(#3#3LBV#W#'%
 $(#'$	 *:6'2!+. )6  77 !-    $# 
  $#!	 +,=>+9 FLE ,r  /ys   <IIHIrr  c                    #    U R                  5       I Sh  vN   U R                  U5      nUS   (       d  [        U R                  S-   5      eU R	                  USSUSU5      I Sh  vN $  NU N7f)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 onlyrS  buyr   r  rS  r(   r3   create_orderr2  rU  rr  rB  rS  s        r4  !create_market_buy_order_with_cost%woo.create_market_buy_order_with_cost5  sl      !!!V$f~tww)ddee&&vxaPPP	 	" Q"   A0A,AA0'A.(A0.A0c                    #    U R                  5       I Sh  vN   U R                  U5      nUS   (       d  [        U R                  S-   5      eU R	                  USSUSU5      I Sh  vN $  NU N7f)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 onlyrS  sellr   r  r  s        r4  "create_market_sell_order_with_cost&woo.create_market_sell_order_with_costF  sl      !!!V$f~tww)eeff&&vxq&QQQ	 	" Rr  rc  r  rh  ri  trailingAmounttrailingTriggerPricec	                    #    Uc  [        U R                  S-   5      eUc  [        U R                  S-   5      eXhS'   XxS'   U R                  XX4XX5      I Sh  vN $  N7f)aU  
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   )	r2  rU  rc  r  rh  ri  r	  r
  rB  s	            r4  create_trailing_amount_order woo.create_trailing_amount_orderW  sj       !#DGG.o$opp'#DGG.u$uvv#1 )=%&&&vT5QQQQ   AAAAtrailingPercentc	                    #    Uc  [        U R                  S-   5      eUc  [        U R                  S-   5      eXhS'   XxS'   U R                  XX4XX5      I Sh  vN $  N7f)aR  
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  )	r2  rU  rc  r  rh  ri  r  r
  rB  s	            r4  create_trailing_percent_order!woo.create_trailing_percent_ordero  sj       "#DGG.q$qrr'#DGG.v$vww$3 !)=%&&&vT5QQQQr  c                 L
  #    U R                  USS5      nU R                  USS/5      nUR                  5       nU R                  5       I Sh  vN   U R	                  U5      n	UR                  5       n
U	S   U
S.nSnU R                  SU5      u  pUb  U R                  U5      US'   U R                  USS	5      nU R                  US
5      nU R                  US5      nU R                  US5      nU R                  USSU R                  U5      5      nU R                  USS5      nU R                  USS5      nUSLnUSLnU=(       d    UnU=(       d5    USL=(       d*    USL=(       d    USL=(       d    U R                  US5      SLnUS:H  nU R                  US5      nU R                  USU5      nU(       a  SOSnXS'   U(       d$  U(       a  SUS'   OUS:X  a  SUS'   OUS:X  a  SUS'   U(       a  X{S'   U(       d  Ub  U R                  X5      US'   U(       a  U(       d  U R                  U/ SQ5      nU R                  U/ SQ5      nUSLnU	S    (       as  U(       d  Ubi  SnUb  U R                  UU5      nOKU R                  U5      nU R                  U5      n [         R"                  " UU 5      n!U R                  UU!5      nUUS!'   O/U R%                  X5      US"'   OUS#:w  a  U R%                  X5      US"'   U R                  U/ S$Q5      n"U"b  U"UU'   U(       af  Uc  ['        U R(                  S%-   5      eU R                  UU5      US'   S&US'   U(       a  UUS'   OU(       a  [         R*                  " US'5      n#U#US'   OUb   US&:w  a  U R                  X5      US'   S(US'   OUc  Ub  S)US'   U	S   S*S#/ S+.n$U$S   n%U
S,:X  a  S-OS,n&Ub<  U R                  USU5      n'U&S.U R                  UU'5      S/S0S1.n(U%R-                  U(5        Ub<  U R                  USU5      n)U&S2U R                  UU)5      S/S0S1.n*U%R-                  U*5        U$/US'   U R                  U/ S3Q5      nSn+U(       a)  U R/                  U R1                  X5      5      I Sh  vN n+O(U R3                  U R1                  X5      5      I Sh  vN n+U R5                  U+S40 5      n,U R5                  U R7                  U,S55      S6U,5      n,U R                  U+S75      U,S7'   U R9                  U,U	5      $  GN N Nf7f)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   )rU  r  rR   r
  r  	stopPricestopLoss
takeProfitalgoTyper
  activatedPricer	  callbackValuer  callbackRatechildOrdersMARKETr  clientAlgoOrderIdclientOrderIdrc  	POST_ONLYfokr  iocr  ri  )rr  order_amountorderAmountr@   rh  quantityPOSITIONAL_TP_SLclOrdIDr!  client_order_idzL createOrder() requires a trailingTriggerPrice parameter for trailing ordersTRAILING_STOPr  STOPBRACKETF)rU  r  r  r  BUYSELL	STOP_LOSSCLOSE_POSITIONT)r  r  r  rc  r  TAKE_PROFIT)r*  r!  r+  postOnlyr  r  r  r  r  r  r	  r
  r8  rL  r   rG  )safe_bool_2omitupperr  rS  handle_margin_mode_and_paramsencode_margin_moder  
safe_valuerA  number_to_stringr  is_post_onlyprice_to_precisionr  cost_to_precisionr-   r  amount_to_precisionr%   r3   r  appendv3PrivatePostTradeAlgoOrderr  v3PrivatePostTradeOrderr@  rO  parse_order)-r2  rU  rc  r  rh  ri  rB  r  	orderTyperS  	orderSider  r
  r  r  r  r  r
  r	  r  isTrailingAmountOrderisTrailingPercentOrder
isTrailingisConditionalisMarketr  r4  clientOrderIdKeyrr  isPriceProvidedquoteAmountamountStringpriceStringcostRequestr!  convertedTrailingPercentoutterOrderr  	closeSider  stopLossOrderr  takeProfitOrderrC  r8  s-                                                r4  r   woo.create_order  s    6 %%flMJ
6L-#@AJJL	!!!V$JJL	Tl
 
!??vV
!$($;$;J$GGL!))&.+N??6:6__V\:
##FJ7#11&:PRbdhdydyz  eA   B++F4DoV,,V5FW .d :!0!<*D.D
"  il$&>  i(RVBV  iZdlpZp  iuy  vE  vE  FL  N[  v\  dh  vh(,,V]C$$XtV<2?._#"-%"'%"'$.L!E-#66vEGGM%%f.UVDYYv'NOF#4/Of~?t7G"#"&"8"8"FK#'#8#8#@L"&"7"7">K")"4"4\;"OK"&"8"8"MK$/!&*&>&>v&N
#++"&":":6"JGJ**63bc$(5G$%#+'  3A  )A  B  B(,(?(?H\(]G$%"1GJ$+9('+2+=+=ou+U(*B'%?**.*A*A&*W'&,
#"
(>"+GJ ,#.!	!K &m4K#,#5EI# $ 0 0>8 T% +$($;$;FM$R,"&' ""=1%"&"2"2:~z"Z% -$($;$;FO$T,"&) ""?3&1]GM"6  $b  c!==dkk'>Z[[H$ "99$++g:VWWH  ~~h3~~dnnT6:AtD ,,X{C[f--c 	"X \$ Xs8   AT$TQT$T (T$;T"<A"T$ T$"T$c                 0    SSS.nU R                  X!U5      $ )NCROSSISOLATED)crossisolatedrA  )r2  modemodess      r4  r9  woo.encode_margin_mode8  s$    "
 T22r6  r3   c                   #    U R                  5       I Sh  vN   U R                  U5      n0 n	Ub  U R                  X&5      U	S'   Ub  U R                  X%5      U	S'   U R	                  USS5      n
U R                  USU
5      nUSLnU R                  U/ SQ5      nUb  U R                  X-5      U	S'   U R	                  US	S
U R                  U5      5      nU R	                  USS5      nU R	                  USS5      nUSLnUSLnU=(       d    UnU(       aF  Ub  U R                  X.5      U	S
'   U(       a  XS'   O#U(       a  [        R                  " US5      nUU	S'   U R                  U/ SQ5      nU=(       d    USL=(       d    U R                  US5      SLnSnU(       a]  XS'   U(       a)  U R                  U R                  X5      5      I Sh  vN nOU R                  U R                  X5      5      I Sh  vN nO\XS'   U(       a)  U R                  U R                  X5      5      I Sh  vN nO(U R!                  U R                  X5      5      I Sh  vN nU R#                  US0 5      nU R%                  UU5      $  GNg N N NY N27f)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>`
Nri  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  oidr8  )r  rS  r=  r?  r  rA  safe_number_nr;  r-   r  r6  r:  (v3PrivatePutAlgoOrderClientClientOrderIdr  $v3PrivatePutOrderClientClientOrderIdv3PrivatePutAlgoOrderOidv3PrivatePutOrderOidr@  rC  )r2  r3   rU  rc  r  rh  ri  rB  rS  r  clientOrderIdUnifiedclientOrderIdExchangeSpecificisByClientOrderr  r
  r	  r  rF  rG  rH  rQ  rI  rC  r8  s                           r4  
edit_orderwoo.edit_order?  s    0 !!!V$
 #66vEGG"&":":6"JGJ#11&)_U(,(8(8ARTh(i%7tC))&2st#&*&=&=f&SGN##11&:PRbdhdydyz  eA   B++F4DoV,,V5FW .d :!0!<*D.D
#/,0,C,CF,a()$+9('+2+=+=ou+U(*B'6  $Q  R"x|4'?xT__U[]jEkswEw)F%&!%!N!Nt{{[bOk!ll!%!J!J4;;W^Kg!hhEN!%!>!>t{{7?[!\\!%!:!:4;;w;W!XX ~~h3f--u 	"H mh ]XsX   JI=F6JJ (J6J73J*J+(JJ*J JJJJc                   #    U R                  USSS5      nU R                  USS/5      nU(       d  Uc  [        U R                  S-   5      eU R	                  5       I Sh  vN   SnUb  U R                  U5      n0 nU R                  USS5      nU R                  USU5      nU R                  U/ S	Q5      nUSLn	Sn
U(       a9  U	(       a  XS
'   OXS'   U R                  U R                  Xc5      5      I Sh  vN n
O@US   US'   U	(       a  XS'   OXS'   U R                  U R                  Xc5      5      I Sh  vN n
U R                  U
S0 5      nU R                  U
S5      US'   U	(       a  XS'   OXS'   U R                  X5      $  GN& N NR7f)a  

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   rU  r  r8  rG  )r5  r6  r%   r3   r  rS  r  rA  v3PrivateDeleteTradeAlgoOrderr  v3PrivateDeleteTradeOrderr@  rC  )r2  r3   rU  rB  	isTriggerrS  r  rg  rh  ri  rC  r8  s               r4  cancel_orderwoo.cancel_order  s     $$VYF	6Iv#67fn#DGG.Y$YZZ!!![[(F#11&)_U(,(8(8ARTh(i%6#RS7tC/L+,)+&!??G@\]]H &tGH+H(%'	"!;;DKK<XYYH ~~h3 ,,X{C[$A! O--M 	" ^ Zs9   AF F!BF7F	8A F8F9AF	FFc                   #    U R                  5       I Sh  vN   U R                  USS5      nU R                  USS/5      n0 nUb  U R                  U5      nUS   US'   SnU(       a  U R	                  U5      I Sh  vN nO(U R                  U R                  XB5      5      I Sh  vN nU R                  US0 5      nU R                  SU05      /$  N NV N/7f)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>`
Nrm  r  r3   rU  r8  r   )	r  r5  r6  rS  v3PrivateDeleteTradeAlgoOrdersv3PrivateDeleteTradeOrdersr  r@  
safe_order)r2  rU  rB  r  r  rS  rC  r8  s           r4  cancel_all_orderswoo.cancel_all_orders  s      !!!""669=6FI#67[[(F &tGH!@@HHH!<<T[[=YZZH ~~h3/00- 	" IZs4   CCA&C=C>(C&C',CCCtimeoutc                    #    U R                  5       I Sh  vN   SUS:  a  [        US5      OS0nU R                  U R                  X25      5      I Sh  vN nU$  ND N7f)a@  
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  rk   v3PrivatePostTradeCancelAllAfterr  )r2  rz  rB  r  rC  s        r4  cancel_all_orders_afterwoo.cancel_all_orders_after  sd      !!!Wq[C0q
 >>t{{7?[\\  	" ]s!   AA=AAAAc                   #    U R                  5       I Sh  vN   SnUb  U R                  U5      nU R                  USS5      nU R                  USS/5      n0 nU R	                  USS5      nSnU(       a5  Ub  XS'   OXS'   U R                  U R                  Xc5      5      I Sh  vN nO4Ub  XvS'   OXS'   U R                  U R                  Xc5      5      I Sh  vN nU R                  US	0 5      n	U R                  X5      $  N N_ N,7f)
a  

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>`
Nrm  r  r*  r!  r   rn  r  r8  )
r  rS  r5  r6  r  v3PrivateGetTradeAlgoOrderr  v3PrivateGetTradeOrderr@  rC  )
r2  r3   rU  rB  rS  r  r  r!  rC  r8  s
             r4  fetch_orderwoo.fetch_order
  s     !!![[(F""669=6FI#67**69oN(/1+,)+&!<<T[[=YZZHN (+8(%'	"!88W9UVVH> ~~h3--s 	" [V Ws4   D	DBD	%D&4D	D)D	D	D	c           	         #    U R                  5       I Sh  vN   SnU R                  USS5      u  pTU(       a  U R                  SXX4SS5      I Sh  vN $ 0 nSnU R                  USS5      nU R	                  USS/5      nUb  U R                  U5      nUS	   US
'   Ub  X&S'   U R                  US5      n	U R	                  US/5      nU	b  XS'   Ub  [        US5      US'   Sn
U(       a)  U R                  U R                  Xd5      5      I Sh  vN n
O(U R                  U R                  Xd5      5      I Sh  vN n
U R                  U
S0 5      nU R                  US/ 5      nU R                  XX#5      $  GN^ GN& Nk ND7f)ao  
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  rm  r  r3   rU  	startTimeuntilendTimesizer8  rL  )r  handle_option_and_params fetch_paginated_call_incrementalr5  r6  rS  rH  rk  v3PrivateGetTradeAlgoOrdersr  v3PrivateGetTradeOrdersr:  rO  parse_orders)r2  rU  r  r  rB  r  r  rS  r  r  rC  r8  r   s                r4  fetch_orderswoo.fetch_ordersr  s    " !!!88PZ[>>}f]blrtwxxx""669=6FI#67[[(F &tGH#(K !!&'26G9-!&I!%oGFO!==dkk'>Z[[H` "99$++g:VWWHP x4fb1  >>a 	" y$ \` XsF   E>E4:E>E7B<E>E:(E>7E<8=E>7E>:E><E>c                    #    U R                  5       I Sh  vN   U R                  USS05      nU R                  XX55      I Sh  vN $  N2 N7f)  
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>`
Nr9  
INCOMPLETEr  r  r  r2  rU  r  r  rB  extendedParamss         r4  fetch_open_orderswoo.fetch_open_orders  sL     $ !!!Vh-EF&&veLLL 	"L!   AA	-AAAAc                    #    U R                  5       I Sh  vN   U R                  USS05      nU R                  XX55      I Sh  vN $  N2 N7f)r  Nr9  	COMPLETEDr  r  s         r4  fetch_closed_orderswoo.fetch_closed_orders  sL     $ !!!Vh-DE&&veLLL 	"Lr  r  c                 2    SSSS.nU R                  X!S 5      $ )Nr  r  r  )r$  r#  	post_onlyr\  )r2  r  timeInForcess      r4  parse_time_in_forcewoo.parse_time_in_force!  s'    

 4@@r6  r   c                    S nU R                  US5      nUb:  UR                  S5      S:  a  U R                  US5      nOU R                  US5      nUc  U R                  US5      nU R	                  USS5      nU R                  U R	                  USS5      5      nU R                  US	5      nU R                  Xr5      nUS	   nU R                  US
5      n	U R                  US5      n
U R                  US5      nU R                  US5      nU R                  USS5      nU R                  US5      nU R                  U R                  USS5      5      nU R                  U R                  US5      5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      nS nUb:  UR                  S5      S:  a  U R                  US5      nOU R                  US5      nU R                  0 SU_SU_SU_SU R                  U5      _SS _SU_SU R                  U5      _S	U_SU_SU R                  U5      _SS _SU R                  US5      _SU_S
U	_SU_SS _S S _UU
US US UUS!.US".EU5      $ )#NcreatedTimer  r   rG  r  rn  r!  r   rU  ri  r'  rh  rc  r9  
algoStatusr  executedtotalExecutedQuantityaverageExecutedPricetotalFeer  r  updatedTimer3   r  lastTradeTimestamplastUpdateTimestampr  r4  r  r  r  r  )averagerh  filled	remainingrr  tradesr  r   )rA  r  safe_timestamprH  r  	omit_zeror  r  safe_value_2r}  rw  r  parse_order_statusr  	safe_bool)r2  r   rS  rG  timestrampStringr  r!  r~  rU  ri  rh  rr  rD  r9  r  r  r  r  feeCurrencyr  lastUpdateTimestampStringr  s                         r4  rC  woo.parse_order)  s=   d 	++E=A'$$S)Q. //}E	 --e]C	))%=I$$UI}Et'9'9%Re'fg##E84!!(3!  0!!%4x0**5&9	""5(LA%%eV4 1 1%E\ ]^..!1!1%9O!PQuj1&&uj9''~>$($4$4UM$J!"$0(--c2a7&*&9&9%&O#&*&7&7}&M#  
' 
] 
  
 Y/	 

 !$ 
 "#6 
 d--f5 
 f 
 I 
 433I> 
  
 $..= 
 D 
 U 
 L 
  t! 
" T# 
$ ' 9 
: ; 	r6  r9  c           
      H    Ub  SSSSSSSSSS.	nU R                  X!U5      $ U$ )Nopenclosedcanceledrejected)	NEWFILLEDCANCEL_SENTCANCEL_ALL_SENT	CANCELLEDPARTIAL_FILLEDREJECTEDr  r  r\  r2  r9  statusess      r4  r  woo.parse_order_status  sD    ")#-'"(&$%
H ##Hf==r6  c           	      F  #    U R                  5       I Sh  vN   U R                  U5      nSUS   0nUb  X%S'   U R                  U R                  XS5      5      I Sh  vN nU R	                  US0 5      nU R                  US5      nU R                  XqUSSS	S
5      $  N NA7f)a  
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
NrU  r3   maxLevelr8  rG  bidsasksri  r'  )r  rS  v3PublicGetOrderbookr  r@  rH  parse_order_book)	r2  rU  r  rB  rS  r  rC  r8  rG  s	            r4  fetch_order_bookwoo.fetch_order_book  s      !!!V$fTl
 "'J224;;w3OPP, ~~h3%%h<	$$T9ffgWabb? 	" Qs#   B!BAB!BA B!B!r   	timeframec                   #    U R                  5       I Sh  vN   U R                  U5      nUS   U R                  U R                  X"5      S.nUb  [	        US5      US'   Ub  X7S'   U R                  US5      nU R                  US5      nUb  XS'   U R                  U R                  Xu5      5      I Sh  vN n	U R                  U	S	0 5      n
U R                  U
S
/ 5      nU R                  XX#U5      $  N N?7f)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   )rU  rc  r!  r  afterr  beforer8  rL  )r  rS  rA  r   rk  rH  r6  v3PublicGetKlineHistoryr  r@  rO  parse_ohlcvs)r2  rU  r  r  r  rB  rS  r  r  rC  r8  rL  s               r4  fetch_ohlcvwoo.fetch_ohlcv  s     !!!V$Tl$$T__iK
 "5$/GG$G!!&'267+ %H55dkk'6RSS. ~~h3~~dFB/  yGGO 	" Ts"   C7C3BC75C56>C75C7c           	          U R                  US5      U R                  US5      U R                  US5      U R                  US5      U R                  US5      U R                  US5      /$ )NstartTimestampr  highlowclosevolume)rH  r}  )r2  ohlcvrS  s      r4  parse_ohlcvwoo.parse_ohlcv.  sm    e%56UF+UF+UE*UG,UH-
 	
r6  c                   #    U R                  5       I Sh  vN   SnUb  U R                  U5      nSU0nU R                  U R                  Xu5      5      I Sh  vN nU R	                  US/ 5      n	U R                  XX4U5      $  Nl N,7f)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>`
Nra  rL  )r  rS  v1PrivateGetOrderOidTradesr  rO  r  )
r2  r3   rU  r  r  rB  rS  r  rC  r  s
             r4  fetch_order_tradeswoo.fetch_order_trades8  s      !!![[(F2
 88W9UVV& &"5  vFF7 	" Ws"   BBABB+BBc           	      2  #    U R                  5       I Sh  vN   SnU R                  USS5      u  pTU(       a  U R                  SXX4SS5      I Sh  vN $ 0 nSnUb  U R                  U5      nUS   US'   Ub  X&S	'   U R	                  US
5      nU R                  US
/5      nUb  XS'   Ub  X6S'   U R                  U R                  Xd5      5      I Sh  vN n	U R                  U	S0 5      n
U R                  U
S/ 5      nU R                  XX#U5      $  N N NA7f)a$  
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   r  r  r  r3   rU  r  r  r  r  r8  rL  )r  r  r  rS  rH  r6  #v3PrivateGetTradeTransactionHistoryr  r@  rO  r  )r2  rU  r  r  rB  r  r  rS  r  rC  r8  r  s               r4  fetch_my_tradeswoo.fetch_my_tradesb  s<     !!!88R\]>>PV_dntvyzzz[[(F &tGH#(K !!&'26G9-!&I$GAA$++gB^__< ~~h3fb1  vFFe 	" { `s4   DD:DDBDD>DDDc                 J  #    U R                  U5      nU R                  U5      n[        R                  " X#/6 I Sh  vN u  pEU R	                  US0 5      nU/nU R	                  US0 5      nU R                  US/ 5      n	U R                  Xy5      n
U R                  X5      $  Nd7f)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
Nr8  rL  )r  !v3PrivateGetAccountSubAccountsAllr  r  r@  rO  array_concatparse_accounts)r2  rB  mainAccountPromisesubAccountPromisemainAccountResponsesubAccountResponsemainDatamainRowssubDatasubRowsrL  s              r4  fetch_accountswoo.fetch_accounts  s      "99&A< !BB6J  9@I[Ho8p2p/>>"5vrB:..!3VR@..&"5  3""400 3qs   :B#B!A%B#c           	      x    UU R                  US5      U R                  U/ SQ5      S U R                  USS5      S.$ )NapplicationId)r4   accountaliasaccountType
subaccount)r   r3   r4   r  rc  )rA  r  r  )r2  r  s     r4  parse_accountwoo.parse_account  sH    B ""7O<&&w0LM**7M<P
 	
r6  c                    #    U R                  5       I Sh  vN   U R                  U5      I Sh  vN nU R                  US5      nU R                  U5      $  N@ N)7f)a=  
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>`
Nr8  )r  v3PrivateGetAssetBalancesr@  parse_balance)r2  rB  rC  r8  s       r4  fetch_balancewoo.fetch_balance	  sW      !!!77??0 ~~h/!!$''5 	"?s   AAAA(AAc                 P   SU0nU R                  US/ 5      n[        S[        U5      5       Hf  nX4   nU R                  U R	                  US5      5      nU R                  5       nU R	                  US5      US'   U R	                  US5      US'   XrU'   Mh     U R                  U5      $ )Nr   holdingr   r   totalavailableBalancefree)rO  r  r  r|  rA  r  safe_balance)r2  rC  r  balancesr  balancer  r  s           r4  r  woo.parse_balance0	  s    H
 >>(Ir:q#h-(AkG**4+;+;GW+MNDllnG#//CGG"..w8JKGFO"4L )   ((r6  r  c                 T  #    U R                  5       I Sh  vN   U R                  U5      nSnU R                  U5      u  pBUS   U R                  U5      S.nU R	                  U R                  XR5      5      I Sh  vN nU R                  US0 5      nU R                  Xs5      $  N N*7f)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  r8  )r  r  handle_network_code_and_paramsnetwork_code_to_idv3PrivateGetAssetWalletDepositr  r@  parse_deposit_address)r2  r  rB  r  r  r  rC  r8  s           r4  fetch_deposit_addresswoo.fetch_deposit_address>	  s      !!!==&"AA&Id^..{;
 <<T[[=YZZ ~~h3))$99) 	" [s"   B(B$A$B(;B&<)B(&B(rB  c                 :   S nU R                  U5      u  p2U R                  X1S   5      nU R                  US   U5      nUcF  [        US   R	                  5       5      n[        U R                  S-   U R                  U5      -   5      eU R                  US5      nXb/$ )Nr  r   zd  can not determine a network code, please provide unified "network" param, one from the following: r  )	r  r  r@  r  r  r&   r3   jsonrA  )r2  r  rB  r  r  supportedNetworkscurrentyNetworkIds          r4  get_dedicated_network_idwoo.get_dedicated_network_id_	  s    "AA&I--kF;KL~~hz&:KH $Xj%9%>%>%@ ATWW  (N  N  QU  QZ  QZ  [l  Qm  m  n  n ,,\;NO!**r6  r  c                     U R                  US5      nU R                  U5        UU R                  US5      S UU R                  US5      S.$ )Naddressr  extra)r   r  r  r  tag)rA  check_address)r2  depositEntryr  r  s       r4  r  woo.parse_deposit_addressj	  sU    ""<;7# ((6:##L':
 	
r6  c                    #    U R                  5       I S h  vN   0 nS nUb  U R                  U5      nUS   US'   S nU R                  U5      u  ptUb  U R                  U5      US'   Ub  X%S'   Ub  [	        US5      US'   U R                  US5      nU R                  US5      nUb  XS'   U R                  U R                  XT5      5      I S h  vN n	U R                  U	S0 5      n
X`R                  U
S	/ 5      /$  N N-7f)
Nr3   r   r  r  r!  r  rc  r8  rL  )r  r  r  r  rk  rA  r6  v3PrivateGetAssetWalletHistoryr  r@  rO  )r2  r  r  r  rB  r  r  r  transactionTyperC  r8  s              r4  get_asset_history_rowswoo.get_asset_history_rowsu	  s    !!!!}}T*H'~GG"AA&I"!%!8!8!EGI#(K !%.GFO**66:66*&-FO<<T[[=YZZH ~~h3..vr:;;o 	"$ [s"   C>C:B7C>C<,C><C>c                    #    U R                  XX45      I Sh  vN nU R                  US5      nU R                  US5      nU R                  XvX#U5      $  N;7f)a"  
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>`
Nr   r   )r'  r:  rO  parse_ledger)r2  r  r  r  rB  currencyRowsr  rL  s           r4  fetch_ledgerwoo.fetch_ledger	  sW      "88eTT??<3~~lA.  vFF Us   AA<Ar  c                 R   U R                  US5      nU R                  X25      nU R                  XB5      nU R                  US5      nU R                  US5      nUS:X  a  SOSnU R	                  US5      nU R                  US/S	/5      n	U R                  UU R                  US
5      UU R                  US5      S U R                  US5      U R                  U R                  US5      5      US S UUU R                  U5      U R                  U R                  US5      5      U	S.U5      $ )Nr   rh  	tokenSideDEPOSITinoutr  feeToken	feeAmountr3   r  txIdr9  rc  )r   r3   r  r  referenceAccountreferenceIdr9  rh  r  r  	directionrG  r  rc  r  )
rA  r|  safe_currencyr}  r  r  safe_ledger_entryparse_transaction_statusr  parse_ledger_entry_type)
r2  r  r  networkizedCoder  rh  r  r8  rG  r  s
             r4  parse_ledger_entrywoo.parse_ledger_entry	  s<   . **49&&A%%d5!!$1k2!Y.DU	''m<	++D:,N%%""4.''i8 $++D&933D4D4DT84TU""Y/001A1A$1OP'
  ! 	r6  c                 0    SSS.nU R                  X!U5      $ )Ntransactionr   )BALANCE
COLLATERALr\  )r2  rc  typess      r4  r<  woo.parse_ledger_entry_type	  s$    $$
 T22r6  c                     Ub  U$ UR                  S5      n[        U5      nU R                  US5      nU R                  USU5      nUS:  a  USU R                  US5      -   -  nU R                  U5      nU$ )NrV  r   r   r   )r{  r  rA  r9  )r2  r=  r  r  partsLength	firstPartr  s          r4  get_currency_from_chaincodewoo.get_currency_from_chaincode	  s    O#))#.Ee*K((2I))%I>JQcD$4$4UA$>>>
))*5Hr6  c           	      h   #    SS0nU R                  XX0R                  XT5      5      I Sh  vN $  N7f)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/  r0  Nfetch_deposits_withdrawalsr  r2  r  r  r  rB  r  s         r4  fetch_depositswoo.fetch_deposits
  s8      
 44T%U\Ieffff   )202c           	      h   #    SS0nU R                  XX0R                  XT5      5      I Sh  vN $  N7f)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/  WITHDRAWNrL  rN  s         r4  fetch_withdrawalswoo.fetch_withdrawals
  s8      
 44T%U\IeffffrQ  c           	         #    SS0nU R                  XX0R                  XT5      5      I Sh  vN nU R                  US5      nU R                  US5      nU R	                  XX#U5      $  N;7f)a9  
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>`
rc  rB  Nr   r   )r'  r  r:  rO  parse_transactions)	r2  r  r  r  rB  r  r+  r  rL  s	            r4  rM  woo.fetch_deposits_withdrawals'
  so      I
 "88e[[Y`Mijj??<3~~lA.&&tuVLL ks   )A)A'<A)rA  c           	      
   U R                  US5      nU R                  X25      nUS   nU R                  U/ SQ5      nUS:X  a  SnU R                  USS/SS	/5      nU R	                  U/ S
Q5      nU R                  USS5      n	U R                  USS/U R                  US5      5      n
0 SU_SU R	                  U/ SQ5      _SU R                  USS5      _SU
_SU R                  U
5      _SS _SU	_SU_SU R                  USS5      _SS _SS _SU_SU R                  US5      _S U_S!U R                  U R                  US!5      5      _S"U R                  US#S$5      _S%S _S UU R                  U R                  US&5      5      S'.E$ )(Nr   r  )
token_sider/  rc  r   
withdrawal	fee_tokenr3  
fee_amountr4  )target_addresstargetAddress	addressTosource_addresssourceAddresscreated_timer  rG  r   r3   )r3   withdraw_id
withdrawIdtxidtx_idr5  r  r  addressFromr`  r   r  tagFromtagTorc  rh  r  r9  r=  updated_timer  commentr  )internalr  r  )rA  rI  safe_string_lower_nr  r  r  safe_timestamp_nrH  r  r}  r;  r  r  )r2  rA  r  r=  currencyDefinedr  movementDirectionr  r`  rh  rG  s              r4  parse_transactionwoo.parse_transaction;
  s3   . **;@::?Uv& 44[Bef
* ,++K+z9RUacnTop&&{4de	((6FX))+7VX\XiXiju  xC  YD  E	
K
$$$[2UV
 D&&{GVD
 	

 Y/
 t
 ;
 
 4%%k7EB
 t
 T
 %
 d&&{H=
 
 d33D4D4D[RZ4[\
  t,,[.-X!
" t#
$ ..t/?/?Y/WX)
 	
r6  c                 6    SSSSSS.nU R                  X!U5      $ Npendingr<  r  )r  
CONFIRMING
PROCESSINGr  CANCELEDr\  r  s      r4  r;  woo.parse_transaction_statuss
  -    ##"
 &99r6  fromAccount	toAccountc                   #    U R                  5       I Sh  vN   U R                  U5      nUS   U R                  U5      SU0SU0S.nU R                  U R	                  Xu5      5      I Sh  vN nU R                  US0 5      n	U R                  US5      U	S'   US   U	S'   SU	S	'   U R                  X5      n
U R                  U R                  S
0 5      nU R                  USS5      nU(       a  X*S'   X:S'   XJS'   U
$  N N7f)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   rh  fromtor8  rG  r   r<  r9  r   r   Trh  r|  r}  )
r  r  parse_to_numericv3PrivatePostAssetTransferr  r@  rH  parse_transferr   r  )r2  r  rh  r|  r}  rB  r  r  rC  r8  r   transferOptionsr   s                r4  r   woo.transfer}
  s     !!!==&d^++F3  	
 88W9UVV ~~h3 --hD[ WX&&t6..z2F"&..B[]a"b"!'X&1]#$-[!= 	" Ws#   D C<AD ,C>-BD >D c                 t  #    0 nSnUb  U R                  U5      nUb  X5S'   Ub  X%S'   U R                  US5      nU R                  US/5      nUb  XuS'   U R                  U R	                  XT5      5      I Sh  vN nU R                  US0 5      n	U R                  U	S/ 5      n
U R                  XX#U5      $  N=7f)aP  
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>`
Nr  r  r  r  r8  rL  )r  rH  r6   v3PrivateGetAssetTransferHistoryr  r@  rO  parse_transfers)r2  r  r  r  rB  r  r  r  rC  r8  rL  s              r4  fetch_transferswoo.fetch_transfers
  s      }}T*H#FO#(K !!&'26G9-!&I>>t{{7?[\\@ ~~h3~~dFB/##DE&IIE ]s   A6B88B69>B8r   c                    U R                  U R                  US5      U5      nU R                  USS5      nU R                  US5      nS nUb  U(       a  SOSnU R	                  US0 5      nU R	                  US0 5      nU R                  US	5      UU R                  U5      UU R                  US
5      U R                  US5      U R                  US5      U R                  U R                  USU5      5      US.	$ )Nr   r  rG  successr<  failedr  r  r3   rh  r  r9  )	r3   rG  r  r  rh  r|  r}  r9  r   )r|  rA  r  r  r@  r  r}  parse_transfer_status)	r2  r   r  r  rG  r  r9  r|  r}  s	            r4  r  woo.parse_transfer
  s    L &&t'7'7''JHU))(M;O	..95$T(FnnXvr:NN8T26	""8T2"Y/&&x:++KI)))_E001A1A(HV\1]^

 
	
r6  c                 6    SSSSSS.nU R                  X!U5      $ ru  r\  r  s      r4  r  woo.parse_transfer_status!  r{  r6  r  r   c                   #    U R                  XE5      u  pEU R                  5       I Sh  vN   U R                  U5        U R                  U5      nUUS.nUb  XGS'   U R	                  US5      nUc  [        U R                  S-   U-   5      eU R                  US5      nUS   US'   U R                  U5      US'   U R                  U R                  Xu5      5      I Sh  vN n	U R                  U	S0 5      n
U R                  U
U R	                  U
S	5      U R                  U	S
5      UUUUUSSS.	5      nU R                  X5      $  GN Ng7f)ay  
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)rh  r  r  r  z- withdraw() requires a network parameter for r3   r   r8  re  rG  r[  rv  )	r3   rG  r  rh  r`  r   r  rc  r9  )handle_withdraw_tag_and_paramsr  r!  r  rA  r%   r3   r6  r   v3PrivatePostAssetWalletWithdrawr  r@  rH  rr  )r2  r  rh  r  r   rB  r  r  r  rC  r8  transactionDatas               r4  r   woo.withdraw+  sa     99#F!!!7#==&
 ?"G""695?#DGG.]$]`d$dee69-#D>!44W=	>>t{{7?[\\ ~~h3++d""46**8[A  
-
 
 %%o@@E 	" ]s#   'EEB3EEA%EEc                 d  #    U R                  5       I Sh  vN   SnUb  U R                  U5      nUS   nU R                  U5      nUS   U R                  X5      S.nU R	                  U R                  Xt5      5      I Sh  vN nU R                  X5      n	U R                  U	UUS.5      $  N N,7f)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>`
NrU  r3   )r   rh  )rh  rU  )r  rS  r  currency_to_precisionv1PrivatePostInterestRepayr  parse_margin_loan)
r2  r  rh  rU  rB  rS  r  r  rC  rA  s
             r4  repay_marginwoo.repay_margin]  s      !!![[(FH%F==&d^00>
 88W9UVV ,,X@{{;)
  	# 	" Ws"   B0B,A*B0B.+B0.B0c                 6    S U R                  S U5      S S S S US.$ )N)r3   r  rh  rU  rG  r  r   )r|  )r2  r   r  s      r4  r  woo.parse_margin_loan  s0     //h?
 	
r6  c                 B    U R                  5       U R                  S   -
  $ )Nr   )millisecondsr   )r2  s    r4  nonce	woo.nonce  s       "T\\2B%CCCr6  r   GETc                 *   US   nUS   nU R                  X5      n	U R                  U R                  S   U   5      n
U
SU-   S-   -  n
U R                  X@R	                  U5      5      nU R                  U5      nUS:X  a*  XS-   U	-   -  n
U(       a  U
SU R                  U5      -   -  n
GOUS:X  a$  X-  n
U(       a  U
SU R                  U5      -   -  n
GOU R                  5         US:X  a  US	:X  d  US
:X  ax  U R                  U R                  SS5      nU(       dC  SnU R                  U R                  SU5      nUR                  S5      S:  nU(       a  XS'   OXS'   U R                  U5      nSn[        U R                  5       5      nX-  n
U R                  US.nUS:X  aa  UU-   S-   U-   S-   U	-   nUS:X  d  US:X  a  U R                  U5      nX-  nSUS'   OkU(       a!  U R                  U5      nU
SU-   -  n
USU-   -  nOBU R                  U5      nUS:X  d  US:X  d  US:X  a  UnOU(       a  U
SU-   -  n
USU-   -  nSUS'   U R!                  U R#                  U5      U R#                  U R$                  5      [&        R(                  5      US'   XXeS.$ )Nr   r   r   rY  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   r6  extract_paramskeysort	urlencodecheck_required_credentialsr  r   rA  r  strr  apiKeyr  hmacencodesecrethashlibsha256)r2  pathsectionr  rB  r  r  r9   accesspathWithParamsr   isSandboxModer  r  rq  authtsquerys                     r4  signwoo.sign  s   !*,,T:##DIIe$4V$<=sW}s""6#6#6t#<=f%XC<.00CsT^^F333u_!CsT^^F333++-T->%>$-BW $t||]E R$$JM#//j-XH $		& 1B 6I -5z*.6{+f-DTZZ\"B!C![[#%G $F{S(72S8>IV#v99V,DLD.@GN+ $v 6sU{*e+~~f-V#v&H:LDsTz)b *M')-4;;t3DdkkRVR]R]F^`g`n`n)oG%&dOOr6  httpCodereasonr   r  r  r  c
                 (   U(       d  g U R                  US5      n
U R                  US5      nU
(       d_  U R                  S-   U R                  U5      -   nU R	                  U R
                  S   Xl5        U R                  U R
                  S   X5        g )Nr  r   r,  r+  )r  rA  r3   r  throw_broadly_matched_exceptionr)  throw_exactly_matched_exception)r2  r  r  r   r  r  r  rC  requestHeadersrequestBodyr  	errorCodefeedbacks                r4  handle_errorswoo.handle_errors  s    
 ..95$$Xv6	ww}tyy'::H001I4Z001I9_r6  c           	         U R                  US5      nU R                  X25      nU R                  US5      nU R                  S5      nU R                  US5      nU R                  US5      nU R	                  US5      n	U R                  US5      n
U
S:X  a  [
        R                  " U5      OUnUUUUU R                  U5      UU R                  U5      U	S	.$ )
NrU  
fundingFeeUSDr3   r  r   paymentTypePay)r   rU  r  rG  r  r3   rh  rate)	rA  r  r|  rH  r}  r-   
string_negr  r1  )r2  incomerS  r~  rU  rh  r  r3   rG  r  r  s              r4  parse_incomewoo.parse_income  s     ##FH5!!(3!!&,7&&u-fd+%%fm<	6&&v}=0;u0D##F+6"Y/''/	
 		
r6  c           	      H  #    U R                  5       I Sh  vN   SnU R                  USS5      u  pTU(       a  U R                  SXX4SS5      I Sh  vN $ 0 nSnUb  U R                  U5      nUS   US'   Ub  X&S	'   U R	                  US
5      nU R                  US
/5      nUb  XS'   Ub  [        US5      US'   U R                  U R                  Xd5      5      I Sh  vN n	U R                  U	S0 5      n
U R                  U
S/ 5      nU R                  XX#5      $  GN N NA7f)a  
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   r  r  r  r3   rU  r  r  r  r  r8  rL  )r  r  r  rS  rH  r6  rk  $v3PrivateGetFuturesFundingFeeHistoryr  r@  rO  parse_incomes)r2  rU  r  r  rB  r  r  rS  r  rC  r8  rL  s               r4  fetch_funding_historywoo.fetch_funding_history  sL     !!!88AVXbc>>?TV\ejtz|  A  A  A[[(F &tGH#(K !!&'26G9-!&I!%oGFOBB4;;wC_``8 ~~h3~~dFB/!!$==a 	" A as4   D"D:D"DBD"D =D"D" D"c                    U R                  US5      nU R                  U5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      n0 SU_SUS   _SS _SS _S	U R                  S
5      _SS _SU_SU R	                  U5      _SU R                  US5      _SU_SU R	                  U5      _SS _SS _SS _SU R                  US5      _SU_SU R	                  U5      _SUS-   0E$ )NrU  nextFundingTimeestFundingRateTimestamplastFundingRateTimestampestFundingIntervalHoursr   	markPrice
indexPriceinterestRater;  estimatedSettlePricerG  r  r   estFundingRatefundingTimestampfundingDatetimenextFundingRatenextFundingTimestampnextFundingDatetimepreviousFundingRatelastFundingRatepreviousFundingTimestamppreviousFundingDatetimeintervalh)rA  rS  rH  r1  r  r}  )r2  r   rS  rU  r  r  r  intervalStrings           r4  parse_funding_ratewoo.parse_funding_rate>  s    !!+x8V$#00>OP"&"3"3KAZ"[#'#4#4[B\#] ))+7PQ
K
fX&
 
 $	

 D--c2
 #D
 0
 %<=
 4++K9IJ
  4
 t||,@A
 t
 #D
 "4
 "4#3#3KAR#S
  '(@!
" &t||4L'M#
$ ,%
 	
r6  c                 @   #    U R                  X5      I Sh  vN $  N7f)aI  
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)r2  rU  rB  s      r4  fetch_funding_intervalwoo.fetch_funding_intervalf  s      ,,V<<<<s   c                 V  #    U R                  5       I Sh  vN   U R                  U5      nSUS   0nU R                  U R                  XB5      5      I Sh  vN nU R	                  US0 5      nU R                  US/ 5      nU R	                  US0 5      nU R                  X5      $  N NP7f)a@  
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>`
NrU  r3   r8  rL  r   )r  rS  v3PublicGetFundingRater  r@  rO  r  )	r2  rU  rB  rS  r  rC  r8  rL  r  s	            r4  r  woo.fetch_funding_rater  s      !!!V$fTl
 44T[[5QRR* ~~h3~~dFB/tQ+&&u55; 	"
 S"   B)B%?B)B'AB)'B)r  c                   #    U R                  5       I Sh  vN   U R                  U5      nU R                  U5      I Sh  vN nU R                  US0 5      nU R	                  US/ 5      nU R                  XQ5      $  Ne N=7f)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
Nr8  rL  )r  market_symbolsr  r@  rO  parse_funding_rates)r2  r  rB  rC  r8  rL  s         r4  fetch_funding_rateswoo.fetch_funding_rates  s{      !!!%%g.44V<<* ~~h3~~dFB/''663 	"<s!   B A<)B  A><B >B c           
      b  #    U R                  5       I Sh  vN   SnU R                  USS5      u  pTU(       a  U R                  SXX4SS5      I Sh  vN $ Uc  [        U R                  S-   5      eU R                  U5      nUS   nSUS	   0nUb  X'S
'   U R                  SXt5      u  ptU R                  U R                  Xt5      5      I Sh  vN nU R                  US0 5      n	U R                  U	S/ 5      n
/ n[        S[        U
5      5       Hp  nX   nU R                  US5      nU R                  US5      nUR                  UU R!                  U5      U R#                  US5      UU R%                  U5      S.5        Mr     U R'                  US5      nU R)                  UXU5      $  GN GNY N7f)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   r  r  r0   z5 fetchFundingRateHistory() requires a symbol argumentrU  r3   r  r  r8  rL  r   fundingRateTimestampr   )r   rU  r   rG  r  rG  )r  r  r  r%   r3   rS  handle_until_optionv3PublicGetFundingRateHistoryr  r@  rO  r  r  rA  rH  r@  r  r}  r  sort_byfilter_by_symbol_since_limit)r2  rU  r  r  rB  r  rS  r  rC  r8  rL  ratesr  entryr~  rG  sorteds                    r4  fetch_funding_rate_historywoo.fetch_funding_rate_history  s     !!!88AZ\fg>>?XZ`inx~  AC  D  D  D>#DGG.e$effV$!fTl
 #(K 229gN;;DKK<XYY. ~~h3~~dFB/q#d)$AGE''x8H))%1GHILL**84#//}E& LL3 	 % e[100NNk 	" D Zs5   F/F':F/F*A:F/F-CF/*F/-F/r  c                    #    SnU(       a  SnOSnSU0nU R                  U R                  XS5      5      I Sh  vN nU$  N7f)ab  
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  )r2  r  rU  rB  	hedgeModer  rC  s          r4  set_position_modewoo.set_position_mode  sP      	$I!II
 ==dkk'>Z[[  \s   6A?Ac                   #    U R                  5       I Sh  vN   U R                  U5      nSnUS   (       a  U R                  U5      I Sh  vN nOUS   (       a[  SUS   0nSnU R                  SUS5      u  pbU R	                  U5      US'   U R                  U R                  XR5      5      I Sh  vN nO![        U R                  S	-   US
   -   S-   5      eU R                  US0 5      nU R                  Xs5      $  N N NN7f)a&  
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   rU  r3   rt   rZ  r
  & fetchLeverage() is not supported for rc   marketsr8  )r  rS  r  r8  r9  v3PrivateGetFuturesLeverager  r(   r3   r@  parse_leverage)r2  rU  rB  rS  rC  r  r
  r8  s           r4  fetch_leveragewoo.fetch_leverage!  s     !!!V$&>!99&AAH< F^&,G #J!%!C!COU[]d!eJ$($;$;J$GGL!!==dkk'>Z[[HT tww)QQTZ[aTbbeoopp~~h3""400k 	" BJ \s5   DC<5DC>A$D1D 2AD>D Dr  c                    U R                  US5      nU R                  X25      nU R                  US5      nU R                  US5      nUS:X  a  S nUnUnU R	                  US/ 5      n[        S[        U5      5       HY  n	U R                  X0 5      n
U R                  U
S5      nU R                  U
S5      nUS:X  a  UnUnME  US:X  a  UnMO  US	:X  d  MW  UnM[     UUS   UUUS
.$ )NrU  r
  r  r   detailspositionSideBOTHLONGSHORT)r   rU  r
  longLeverageshortLeverage)rA  r  r  rH  rO  r  r  r@  )r2  r  rS  r~  r
  spotLeverager'  r(  r"  r  positionpositionLeverager  s                r4  r  woo.parse_leverage  s   ##Hh7!!(3++HlC
((:>1L#$..9b9q#g,'A~~g"5H#00:F##Hn=Dv~/ 0/ 0 ( X&$(*
 	
r6  c                   #    U R                  5       I Sh  vN   SU0nSnUb  U R                  U5      nUb
  US   (       a(  U R                  U R                  XC5      5      I Sh  vN $ US   (       a[  US   US'   SnU R	                  SUS5      u  pcU R                  U5      US	'   U R                  U R                  XC5      5      I Sh  vN $ [        U R                  S
-   US   -   S-   5      e N N N)7f)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   rU  rt   rZ  r
  r  rc  r  )	r  rS  v3PrivatePostSpotMarginLeverager  r8  r9  v3PrivatePutFuturesLeverager(   r3   )r2  r  rU  rB  r  rS  r
  s          r4  set_leveragewoo.set_leverage  s     !!!
 [[(FNvf~==dkk'>Z[[[F^ &tGH"J!%!C!COU[]d!eJ$($;$;J$GGL!99$++g:VWWWtww)QQTZ[aTbbeoopp! 	" \ Xs5   C6C0AC6%C2&A$C6
C4&C62C64C6c                 D   #    U R                  XSU5      I Sh  vN $  N7f)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=add-margin-structure>`
ADDNmodify_margin_helperr2  rU  rh  rB  s       r4  
add_marginwoo.add_margin  s"      ..vufMMMM     c                 D   #    U R                  XSU5      I Sh  vN $  N7f)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=reduce-margin-structure>`
REDUCENr4  r6  s       r4  reduce_marginwoo.reduce_margin  s"      ..vxPPPPr9  c                    #    U R                  5       I S h  vN   U R                  U5      nUS   SUUS.nU R                  U R                  Xd5      5      I S h  vN $  NG N7f)Nr3   USDT)rU  adjust_tokenadjust_amountaction)r  rS  !v1PrivatePostClientIsolatedMarginr  )r2  rU  rh  rc  rB  rS  r  s          r4  r5  woo.modify_margin_helper  sf     !!!V$Tl"#	
 ;;DKK<XYYY 	" Zs"   A"AAA"A A" A"c                 V  #    U R                  5       I Sh  vN   U R                  U5      nSUS   0nU R                  U R                  XB5      5      I Sh  vN nU R	                  US0 5      nU R                  US/ 5      nU R	                  US0 5      nU R                  X5      $  N NP7f)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>`
NrU  r3   r8  r   r   )r  rS  v3PrivateGetFuturesPositionsr  r@  rO  parse_position)	r2  rU  rB  rS  r  rC  r  r   r  s	            r4  fetch_positionwoo.fetch_position  s      !!!V$fTl
 ::4;;w;WXX@ &"5NN6;;	y!R0""511Q 	"
 Yr  c                    #    U R                  5       I Sh  vN   U R                  U5      I Sh  vN nU R                  US0 5      nU R                  US/ 5      nU R	                  XQ5      $  NT N=7f)aH  
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>`
Nr8  r   )r  rF  r@  rO  parse_positions)r2  r  rB  rC  r  r   s         r4  fetch_positionswoo.fetch_positions  sm      !!!::6BB@ &"5NN6;;	##I77G 	"Bs   A/A+A/A-<A/-A/r*  c                    U R                  US5      nU R                  X25      nU R                  US5      nS n[        R                  " US5      (       a  SnOSnU R                  US5      nU R	                  USS5      nU R                  US	5      nS n	Ub:  UR                  S
5      S:  a  U R                  US	5      n	OU R                  US	5      n	U R	                  USS5      n
[        R                  " Xz5      n[        R                  " X5      n[        R                  " U5      n[        R                  " XG5      nU R                  US5      nU R                  0 SU_SS _SU R                  US5      _S	U	_SU R                  U	5      _SS _SS _SS _SS _SS _SU R                  U
5      _SU R                  U5      _SU R                  US5      _SU R                  U5      _SU R                  U5      _SU R                  U5      _SS _U R                  USS5      U R                  U5      S S U R!                  USS 5      US US!:g  S S S".
E5      $ )#NrU  r  r;  longshortrs  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  )rA  r  r-   	string_gtr  r  r  rH  
string_subr  
string_abssafe_positionr  r1  r}  safe_number_2safe_string_lower_2)r2  r*  rS  re  r  r  rs  r  r  rG  rX  priceDifferenceunrealisedPnlrY  r#  s                  r4  rG  woo.parse_positionL  s   b ##Hh7!!(3)4T3''DD''?&&xlK	**8[A	&##C(2- //+F	 --hD	''2DFZ[
!,,YC**?A!!$'%%d6''.A!! #
H#
$#
 d&&vx8#
 	#

 Y/#
 "4#
 T#
 &t#
  #
 *4#
 $++J7#
 ))(3#
 ((:>#
 T..}=#
 **40#
  D--l;!#
" 4##
$ !% 2 28]O \**95228\=Y"f,!#7#
  	r6  fromCodetoCodec                   #    U R                  5       I Sh  vN   UR                  5       UR                  5       U R                  U5      S.nU R                  U R	                  XT5      5      I Sh  vN nU R                  US0 5      nU R                  USU5      nU R                  U5      n	U R                  USU5      n
U R                  U
5      nU R                  XyU5      $  N Ns7f)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sellQuantityr8  ro  rp  )	r  r7  r;  v3PrivateGetConvertRfqr  r@  rA  r  parse_conversion)r2  rl  rm  rh  rB  r  rC  r8  fromCurrencyIdfromCurrencytoCurrencyId
toCurrencys               r4  fetch_convert_quotewoo.fetch_convert_quote  s      !!!!) 11&9

 44T[[5QRR" ~~h3))$XF}}^4''j&A]]<0
$$TDD9 	" Ss#   C%C!AC%/C#0A2C%#C%c                    #    U R                  5       I Sh  vN   SU0nU R                  U R                  Xe5      5      I Sh  vN nU R                  US0 5      nU R	                  U5      $  NT N*7f)a  
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>`
Nra  r8  )r  v3PrivatePostConvertRftr  r@  rs  )	r2  r3   rl  rm  rh  rB  r  rC  r8  s	            r4  create_convert_tradewoo.create_convert_trade  ss      !!!r
 55dkk'6RSS ~~h3$$T**! 	" Ts!   A/A++A/A-)A/-A/c                   #    U R                  5       I Sh  vN   SU0nU R                  U R                  XC5      5      I Sh  vN nU R                  US0 5      nU R	                  US5      nU R	                  US5      nSn	Sn
Ub  U R                  U5      n	Ub  U R                  U5      n
U R                  XiU
5      $  N N{7f)av  
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>`
Nra  r8  	sellAssetbuyAsset)r  v3PrivateGetConvertTrader  r@  rA  r  rs  )r2  r3   r  rB  r  rC  r8  rt  rv  ru  rw  s              r4  fetch_convert_tradewoo.fetch_convert_trade  s      !!!r
 66t{{77STT ~~h3))$<''j9
%==8L#|4J$$TDD9 	" Us"   C B<+C B>A:C >C c                 N  #    U R                  5       I Sh  vN   0 nU R                  SXT5      u  pTUb  X%S'   Ub  X5S'   U R                  U R                  XT5      5      I Sh  vN nU R	                  US0 5      nU R                  US/ 5      nU R                  XSSX#5      $  N N@7f)	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>`
Nr  r  r  r8  tradeVosr  r  )r  r	  v3PrivateGetConvertTradesr  r@  rO  parse_conversions)	r2  r  r  r  rB  r  rC  r8  rL  s	            r4  fetch_convert_trade_historywoo.fetch_convert_trade_history$  s      !!!229gN#(K #FO77G8TUU* ~~h3~~dJ3%%d+z5XX= 	" Vs"   B%B!AB%"B##?B%#B%
conversionru  rw  c                 t   U R                  USS5      nU R                  USS5      nU R                  XR5      nU R                  USS5      nU R                  Xs5      nUUU R                  U5      U R	                  US5      UU R                  USS	5      UU R                  US
S5      U R                  US5      S S.
$ )NexpireTimestampr  ro  r  rp  r  ra  rq  
sellAmountbuyQuantity	buyAmountbuyPrice)
r   rG  r  r3   ru  
fromAmountrw  toAmountri  r  )safe_integer_2r  r|  r  rA  rg  r}  )	r2  r  ru  rw  rG  fromCurrrl  r  rm  s	            r4  rs  woo.parse_conversionQ  s    H ''
4E}U	%%j+zJ**8B
JD((8"Y/"":y9$,,ZV **:}kR%%j*=
 	
r6  c                   #    U R                  5       I Sh  vN   U R                  U5      I Sh  vN n0 nU R                  US/ 5      n[        S[	        U5      5       Hi  nXE   nU R                  US5      nU R                  U5      nUUUSSSSSSSU R                  US5      SSS.SSS.SSS.S.U R                  US5      S	.X8'   Mk     U$  N N7f)
z
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
NrL  r   r   tickrj  )rh  r   r  r  )r   r3   r  r   rc  r4   rd  r  r   r  rx  ry  rz  )	r  v3PrivateGetConvertAssetInforO  r  r  rA  r|  r}  r  )	r2  rB  rC  r  r8  r  r  r3   r  s	            r4  fetch_convert_currencieswoo.fetch_convert_currencies  s	     !!!::6BB ~~h3q#d)$AGE!!%1B**2.D  !--eV<  $#
  $#!
  $#   ..umD5FL	 %@ c 	"Bs    CCCCBCCc                     U R                  U5      nUS   n[        UR                  5       5      n[        S[	        U5      5       H  nXE   nUS:X  d  M  Us  $    U R                  US5      $ )Nr   r   r   )r  r  r  r  r  r:  )r2  r  currencyItemr   networkKeysr  r  s          r4  !default_network_code_for_currency%woo.default_network_code_for_currency  sg    }}T*
+8==?+q#k*+A!nG% ,
 {A..r6  enablec                 H   > [         [        U ]  U5        XR                  S'   g )Nr   )r/  r/   set_sandbox_moder   )r2  r  r3  s     r4  r  woo.set_sandbox_mode  s    c4)&1&,]#r6   )N)NN)~__name__
__module____qualname____firstlineno__r   r0  rD  r   rI  r"   r   rQ  dictr  r  r   r  r  r  r   r  r  r   r  r
   r  floatr  r  r   r   r   r   r  r  r   r9  rj  r   rr  rx  r~  r  r  r  r  r  rC  r  r   r  r  r  r  r  r  r   r  r   r   r  r  r   r  r  r   r  r'  r   r,  r>  r<  rI  r    rO  rT  rM  rr  r;  r!   r   r  r  r  r   r  r  r  r  intr  r  r  r   r  r  r  r   r   r  r  boolr  r   r  r  r0  r   r7  r<  r5  rH  r   rL  rG  r	   rx  r|  r  r  rs  r  r  r  __static_attributes____classcell__)r3  s   @r4  r/   r/      s?   _# _B )+ #
J ') 8S 8. *, .(V .(`R
4 R
F R
h <@d[] (= (=S (= (=bfglbm (=TE Ev E EN


T 

6 

EX 

 ;= 4c 4AT 4@ /1 8[ 8t -/ T: Tl XZ Qc Q Q" Y[ Rs R% R" }A  Y]  {  HJ R RI RU^ Rhm Rvy R  SV R  ux R  OT R0 ~B  [_  }A  JL R# RY RV_ Rin Rwz R  UX R  wz R  QV R0 mqy{ o. o.I o.Y o.X] o.fi o.b3 fjx|  FH R.3 R. R.9 R.I R._b R.ru R.h 9=R 7.S 7.# 7.r 59 "1c "1H BD S 4 8<B f.C f. f.P 04$UYbd A? A?C A?s A?imnsit A?F 59tZ^gi Mc M MTW Mnrsxny M, 7;\`ik M M3 MVY Mptuzp{ M,As AP Pv P Pd   @DB *cS *c *cS\ *cX ?CQUdhqs 5H 5H 5H3 5H^a 5Hx|  ~B  yC 5Hn
 
4 
 ?CQUdhqs (G3 (G (G3 (G^a (GT 37TX\eg ?GC ?Gs ?GRU ?GB +- >1g >1@&
P *, #( #(J) ) =? : :> :B	+ 	+# 	+	
H 	
P^ 	
 8<$]ajl 8< 8<C 8<WZ 8<qt 8<t .2SW`b Gs G# GS Ggklwgx G"/t /x /; /b3 04$UYbd g gC gs gimnyiz g" 37TX\eg gC gs gRU glpq|l} g" <@daenp MS M M[^ Muy  {F  vG M(6
T 6
X 6
Q\ 6
p:s : ac +3 + +C +TW +gt +Z 154VZce ;J# ;JS ;JPS ;Jjno|j} ;Jz8
t 8
x 8
= 8
t:C :C : QU]_ 0A3 0A 0A 0A# 0Ado 0Ad JNVX  s  E  3  D
 
 D "*%DW[ 9Pvc 3 S # X\ dg !
6 !
F 9=4^bkm =># =>S =>X[ =>~&
f &
 &
P @B 
=3 
=k 
= <> '6s '6+ '6R <@ #7 #7| #7J >BPTcgpr COs CO# CO]` COJ CGr d C 8 8: b13 b1h b1H
t 
V 
x 
: ?C2 q3 q q@ CE Ns NE NI[ N FH Q# Qu QL^ Q LN 	Z 	ZRd 	Z 8: 223 22h 8<B -8W -84PX> -8^dt dV dL SW_a (E# (Es (EC (Efp (ET ]aik +S +C + +VY +pz +> >B" 'EC 'Es 'EQ[ 'ER =Atbfoq +Yc +Y +Y\_ +Yvz  |F  wG +YZ4
4 4
x 4
\d 4
pz 4
l 57 :: :x	/-t - -r6  r/   )5 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!   typingr"   ccxt.base.errorsr#   r$   r%   r&   r'   r(   r)   r*   r+   ccxt.base.decimal_to_precisionr,   ccxt.base.preciser-   r/   r  r6  r4  <module>r     sw    6 )   T  T  T  T  T  T  T  T  * 0 . ' ) ) , . * 4 %w>-(K w>-r6  