
    i                    $   d dl mZ d dlmZ d dlZd dlmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ d dlmZ d dlmZ d dlmZ d dlm Z  d d	lm!Z! d d
lm"Z" d dlm#Z# d dlm$Z$ d dlm%Z% d dl&m'Z' d dl(m)Z)  G d dee          Z*dS )    )Exchange)ImplicitAPIN)AccountBalancesBool
Conversion
CurrenciesCurrencyIntLeverageMarket
MarketTypeNumOrder	OrderBook	OrderSide	OrderTypeStrStringsTradeTradingFeesTransactionTransferEntry)List)ExchangeError)AuthenticationError)ArgumentsRequired)
BadRequest)InvalidOrder)NotSupported)RateLimitExceeded)OnMaintenance)	TICK_SIZE)Precisec                   V    e Zd Z fdZi fdZi fdZi fdee         fdZdefdZ	ddi fde
d	ed
edee         fdZdededefdZd Zi fdefdZi fdefdZi fde
defdZdddi fde
dededededefdZdddi fde
dededededefdZdi fde
dedededef
dZddi fde
de
dedededefdZdi fde
defdZdi fdefdZ di fde
defdZ!dddi fded	ed
edee         fdZ"dddi fded	ed
edee         fd Z#dddi fded	ed
edee         fd!Z$d" Z%dededefd#Z&d$ Z'di fde
d
ede(fd%Z)d&ddi fde
d	ed
edee*         fd'Z+dedede*fd(Z,dddi fde
ded	ed
efd)Z-dddi fded	ed
efd*Z.i fdee/         fd+Z0d, Z1i fde2fd-Z3de2fd.Z4i fd/e
fd0Z5dddi fd/ed	ed
efd1Z6dddi fd/ed	ed
efd2Z7ded3e8fd4Z9d5 Z:d6 Z;dddi fd/ed	ed
edee<         fd7Z=dddi fd/ed	ed
edee<         fd8Z>dddi fd/ed	ed
edee<         fd9Z?ded3e8de<fd:Z@d; ZAi fd/e
ded<e
d=e
deBf
d>ZCdddi fd/ed	ed
efd?ZDded3e8fd@ZEdA ZFdi fd/e
defdBZGdi fd/e
defdCZHded3e8fdDZIdE ZJdFdGi ddfdHZKdI ZLdedefdJZMdddi fded	ed
efdKZNdedefdLZOi fde
fdMZPdi fdNeQfdOZRdddi fded	ed
efdPZSdi fdQeTdefdRZUi fde
deVfdSZWdedeVfdTZXdi fdUedefdVZYdi fdefdWZZdi fdNeQfdXZ[dedefdYZ\di fdZe
d[e
dede]fd\Z^di fde
dZe
d[e
dede]f
d]Z_dfd^e8d_e8de]fd`Z`i fdefdaZadb ZbdceTf fddZc xZdS )gwooc                    |                      t          t          |                                           i ddddddgddd	d
dddddddi dd ddddddddddddddddddddddddddd dd!dd"di d#dd$dd%dd&dd'dd(dd)dd*dd+dd,dd-dd.dd/dd0dd1dd2dd3di d4dd5dd6dd7dd8dd9dd:dd;dd<dd=dd>dd?dd@ddAddBddCddDdi dEddFddGddHddIddJddKddLddMddNddOddPddQddRddSddTddUdddddVdddddddddWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdhdidjdkdkdidldmgdngdodpdqdrdsdtdudvdwidtdvdvdvdvdvdvdvdvdvdvdvdvdvdxii dydvdzdvd{dvd|dvd}dvd~dvddvddvddvddvddudddddddddduddddddddddddddddddddd	dvdvdvddddiddtddviiidtddiidvdvdvdddvdddvdvddvdvddddddddddvdvdvdvdddddddd|                     d          |                     d          didddddddddddddi ddidddi di dt
          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          t
          t          t          t          t          t          dddt                    S )Nidr&   namezWOO X	countriesKY	rateLimitd   versionv1	certifiedTprohostnamezwoo.orghasCORSspotmarginswapfutureFoption	addMargincancelAllOrders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fetchCurrenciesfetchDepositAddressfetchDepositsfetchDepositsWithdrawalsfetchFundingHistoryfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchIndexOHLCVfetchLedgerfetchLeveragefetchMarginAdjustmentHistoryfetchMarginModefetchMarketsfetchMarkOHLCVfetchMyTrades
fetchOHLCVfetchOpenInterestHistoryfetchOpenOrderfetchOpenOrders
fetchOrderfetchOrderBookfetchOrdersfetchOrderTradesfetchPositionfetchPositionModefetchPositionsfetchPremiumIndexOHLCVfetchStatusfetchTickerfetchTickers	fetchTimeemulated)fetchTradesfetchTradingFeefetchTradingFeesfetchTransactionsfetchTransfersfetchWithdrawalsreduceMargin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.woo.orgzhttps://api.{hostname})pubpublicprivatezhttps://api-pub.staging.woo.orgzhttps://api.staging.woo.orgzhttps://woo.org/zhttps://docs.woo.org/zFhttps://support.woo.org/hc/en-001/articles/4404611795353--Trading-Feesz'https://x.woo.org/register?ref=YWOWC96Bgffffff?)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   x   )	orderzasset/main_sub_transferz	asset/ltvasset/withdrawzasset/internal_withdrawr   zclient/account_modezclient/position_modezclient/leverage)r   zclient/orderr   r   )r   postdeleter   insuranceFund   )algo/order/{oid}zalgo/ordersbalancesaccountinfor   buypower	referralsreferral_rewardszconvert/exchangeInfozconvert/assetInfozconvert/rfqzconvert/tradezconvert/trades)
algo/orderzconvert/rft   )r   zorder/client/{client_order_id}r   z#algo/order/client/{client_order_id})z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optionsERC20ATOMZRX)HTOMGUATOMr   TRONETHBSC)TRXTRC20r   BEP20fillResponseFromRequest$bc830de7-50f3-460b-9ee0-f430f83f9dad)sandboxMode!createMarketBuyOrderRequiresPriceznetwork-aliases-for-tokensnetworksdefaultNetworkCodeForCurrenciesr   brokerId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#   )self	__class__s    N/var/www/html/crypto-bot/backend/venv/lib/python3.11/site-packages/ccxt/woo.pyr   zwoo.describe   s	   c4 0 0 9 9 ; ; x>
%x>
Gx>
 $x>
 	x>

 tx>
 x>
 4x>
 	x>
  QQQ $Q 	Q
 %Q %Q UQ "4Q tQ !%Q $UQ  Q %dQ 'Q /Q  $U!Q" ,U#Q Q$ 0%Q& t'Q( 7)Q* (+Q, '-Q. &t/Q0 (1Q2 "53Q4 (5Q6 ,T7Q8 -d9Q: %d;Q<  =Q> ?Q@ &uAQB #ECQD $TEQ Q QF )$GQH $TIQJ "4KQL &tMQN  OQP +DQQR &tSQT #DUQV *4WQX $TYQZ "5[Q\ t]Q^  _Q` /aQb "5cQd eQf !%gQ Q Qh  iQj dkQl +EmQn !%oQp "4qQr dsQt !$uQv twQx #DyQz  {Q| $U}Q~ !$Q@ )%AQB tCQD uEQF GQH TIQ QJ  $#($(%/"&$( %#"#'  aQ Q Qx>
v  wx>
P ~467  =;< 
 *+ ] E $ ' Qx>
@  *,+,    $%-.+,-.%&-.-.5645'(0123%&   $ *A )1  =a  %a	 
 1!  1!  ,Q  1!  4Q  -a  ,R  ,R  .r  1"  7   9"! " >r# $ /16802.035)-15:<3     8 &'79)+.079.03645/2
! 
! &',-&'.1	# #O-  - 1F FP ,a   +Q  12+,()+-)-())+024512+--../     +,+-! !
 ,->?01CD	    6734<=./	# #5     ' '_w wAx>
p !%"&!..x88!..x88	 qx>
@ $59 ""# 	/ / "#""	 4
 .t C1 Ax>
t ux>
v ]0 0 .	
 Z Z Z Z \ Z Z \ \ \ \  \!& &3#00:2<OY[e ' wx>
n	 Yo	x>
 x x x	    c                     |                      |          }|                     |di           }|                     |d          }|d}n|dk    rd}nd}|ddd|dS )	aX  
        the latest known information on the availability of the exchange API
        :see: https://docs.woo.org/#get-system-maintenance-status-public
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `status structure <https://docs.ccxt.com/#/?id=exchange-status-structure>`
        datastatusNerror0okr   )r   updatedetar   r   )v1PublicGetSystemInfo	safe_dictsafe_string)r   paramsresponser   r   s        r   fetch_statuszwoo.fetch_statusT  s     --f55 ~~h33!!$11>FFs]]FF"F
 
 	
r   c                 X    |                      |          }|                     |d          S )a[  
        fetches the current integer timestamp in milliseconds from the exchange server
        :see: https://docs.woo.org/#get-system-maintenance-status-public
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns int: the current integer timestamp in milliseconds from the exchange server
        	timestamp)r   safe_integer)r   r   r   s      r   
fetch_timezwoo.fetch_timev  s/     --f55   ;777r   returnc                     |                      |          }|                     |dg           }|                     |          S )z
        retrieves data on all markets for woo
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: an array of objects representing market data
        rows)v1PublicGetInfo	safe_listparse_marketsr   r   r   r   s       r   fetch_marketszwoo.fetch_markets  sB     ''//, ~~h33!!$'''r   c                    |                      |d          }|                    d          }|                      |d          }d}d}|dk    rd}d}n
|dk    rd}d	}|                      |d
          }|                      |d          }	|                     |          }
|                     |	          }d }d }|
dz   |z   }d }d }d}|}|rRd}|                      |d          }|                     |          }|
dz   |z   dz   |z   }|                     d          }d}i d|d|d|
d|d|d|d|	d|d|d|d|d	|dddddd d|d|d |d d d d |                     |d          |                     |d          dd d d |                     |d!          |                     |d"          d |                     |d#          |                     |d$          d |                     |d%          d d d&|                     |d'          |d(
S ))Nsymbol_r   FSPOTTr5   PERPr7   r   r   /:1r(   basequotesettlebaseIdquoteIdsettleIdtyper6   r8   r9   activecontractlinear	base_tick
quote_tick)amountpriceminmaxbase_minbase_max	quote_min	quote_maxmin_notional)leverager  r  costcreated_time)
inversecontractSizeexpiryexpiryDatetimestrike
optionType	precisionlimitscreatedr   )r   splitsafe_currency_coder   safe_numbersafe_timestamp)r   marketmarketIdpartsfirstr5   r7   
marketTyper  r  r  r  r  r  r  r(  r  r6   r  s                      r   parse_marketzwoo.parse_market  s0   ##FH55s##  **F??DJJf__DJ!!%++""5!,,&&v..''00e#  	F''q11H,,X66FCZ%'#-6F,,S11LF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
 d0
  !0
" f#0
$ ("**6;??))&,??    
  ++FJ??++FJ?? 
  ++FK@@++FK@@ 
  ++FNCC  $ **6>BB_0
 0
 0
 0	
r   Nr  sincelimitc                 &   |                                   |                     |          }d|d         i}|||d<   |                     |                     ||                    }|                     |dg           }|                     ||||          S )a  
        get the list of most recent trades for a particular symbol
        :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>`
        r  r(   Nr;  r   )load_marketsr4  v1PublicGetMarketTradesextendr  parse_trades)	r   r  r:  r;  r   r4  requestr   resultResponses	            r   fetch_tradeszwoo.fetch_trades  s     	V$$fTl
 $GG//GV0L0LMM< &"==  FFFr   r4  c                    d|v }|                      |d          }|                     |d          }|                     ||          }|d         }|                     |d          }|                     |d          }|                     |d          }	|                     |dd          }
t	          j        ||          }|                     |d	          }|                     |d          }d }|r |                     |d
          dk    }|rdnd}|                     |||                     |          ||||||	|d |
|d|          S )Nr(   executed_timestampr  executed_priceexecuted_quantityorder_id	fee_assetfeesideis_makerr  r   r   )r(   r   datetimer  rK  r  r  r%  r   takerOrMakerr  rJ  r   )	r3  r   safe_marketparse_token_and_fee_tempr$   
string_mulsafe_string_lower
safe_tradeiso8601)r   trader4  isFromFetchOrderr   r5  r  r  r  rH  rJ  r%  rK  r(   rN  isMakers                   r   parse_tradezwoo.parse_trade+  sy   8 !EM''/CDD	##E844!!(F33!  (899!!%)<==##E:66++E;FF!%00%%eV44eT**  	;&&uj99S@G&-:777L"Y//( 
  
   	r   c                     |                      ||          }d }|0|                      ||          }|                     |          }||d}|S )Nr%  currency)r   r1  )r   itemfeeTokenKeyfeeAmountKeyfeeCostrJ  feeCurrencyIdfeeCurrencyCodes           r   rP  zwoo.parse_token_and_fee_tempg  sc    ""466 ,,T;??M"55mDDO+ C 
r   c           
         |                                   |                     |          }|                     |di           }|                     |d          }|                     |d          }i }t	          dt          | j                            D ]g}| j        |         }|||                     t          j	        |d                    |                     t          j	        |d                    ddd||<   h|S )aP  
        fetch the trading fees for multiple markets
        :see: https://docs.woo.org/#get-account-information-new
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
        r   makerFeeRatetakerFeeRater   10000T)r   r  r   r   r   r   )
r=  v3PrivateGetAccountinfor   r   rangelensymbolsr   r$   
string_div)	r   r   r   r   r   r   resultir  s	            r   fetch_trading_feeszwoo.fetch_trading_feess  s     	//77: ~~h33  ~66  ~66q#dl++,, 		 		A\!_F  **7+=eW+M+MNN**7+=eW+M+MNN"! F6NN r   c                    i }|                      |          }|                     |dg           }|                     |d          }t          |                                          }t          dt          |                    D ];}||         }||         }	|                     |          }
d}d}i }t          dt          |	                    D ]}|	|         }|                     |d          }|                     |d          }|	                    d          }|d         }| 
                    |                     |d                    }|||nt          j        ||          }||ddd	ddd	d
dddd|                     |          |d	||<   |||
|                     |          dd|ddddd	ddd	d|	d||
<   =|S )z
        fetches all available currencies on an exchange
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an associative dictionary of currencies
        r   balance_tokenr   Nfullnamer   r  decimalsr  )r   deposit)	r(   networkr.  r  rr  r   rJ  r-  r   )rr  r   )r(   r)   coder-  r  rJ  r   rr  r   r.  r   )v1PublicGetTokenr  group_bylistkeysrg  rh  r1  r   r0  parse_precisionr$   
string_minr   )r   r   rk  tokenResponse	tokenRowsnetworksByCurrencyIdcurrencyIdsrl  
currencyIdr   rt  r)   minPrecisionresultingNetworksjrs  	networkIdsplittedunifiedNetworkr-  s                       r   fetch_currencieszwoo.fetch_currencies  sM    --f55z NN=&"==	#}}YHH/446677q#k**++ 9	 9	A$QJ+J7H**:66DDL "1c(mm,,  "1+''<< ,,Wg>>	$??3//!)! 001A1A':1V1VWW	(1=1E99GL^_hjvLwLwL#- $(#'% %
 $(#'$ $	 	 ## $!%!2!29!=!=#%5 5!.11* !!..|<<-   $#   
  $#! !	 	 !) F4LL, r   r%  c                     |                                   |                     |          }|d         st          | j        dz             d|d<   |                     |dd|d|          S )a  
        create a market buy order by providing the symbol and cost
        :see: https://docs.woo.org/#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>`
        r5   z9 createMarketBuyOrderWithCost() supports spot orders onlyFr   r4  buyN)r=  r4  r    r(   create_order)r   r  r%  r   r4  s        r   !create_market_buy_order_with_costz%woo.create_market_buy_order_with_cost+  ss     	V$$f~ 	ftw)ddeee6;23  5$fMMMr   r  rK  r  r  c	                     |t          | j        dz             |t          | j        dz             ||d<   ||d<   |                     ||||||          S )a  
        create a trailing order by providing the symbol, type, side, amount, price and trailingAmount
        :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 argumenttrailingAmounttrailingTriggerPricer   r(   r  )	r   r  r  rK  r  r  r  r  r   s	            r   create_trailing_amount_orderz woo.create_trailing_amount_order;  sp     !#DG.o$oppp'#DG.u$uvvv#1 )=%&  tVUFKKKr   c	                     |t          | j        dz             |t          | j        dz             ||d<   ||d<   |                     ||||||          S )a  
        create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
        :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 argumenttrailingPercentr  r  )	r   r  r  rK  r  r  r  r  r   s	            r   create_trailing_percent_orderz!woo.create_trailing_percent_orderP  sp     "#DG.q$qrrr'#DG.v$vwww$3 !)=%&  tVUFKKKr   c                    |                      |dd          }|                     |ddg          }|                                }|                                  |                     |          }	|                                }
|	d         |
d}|                     |dd          }|                     |d          }|                     |d          }|                     |d	          }|                     |d
d| 	                    |                    }|                     |dd          }|                     |dd          }|du}|du}|p|}|p#|dup|dup|dup|                     |d          du}|dk    }| 
                    |d          }|                     |d|          }|rdnd}|rdnd}|rdnd}|rdnd}|rdnd}|||<   |s|rd|d<   n|dk    rd|d<   n|dk    rd |d<   |r|||<   ||                     ||          ||<   |r|s|	d!         r|
d"k    rd}d#} |                     |d$d%d#          \  } }|                     |d&d'          }!|                     |d&d'g          }|!|                     ||!          }n| ro|t          | j        d(z             | 	                    |          }"| 	                    |          }#t#          j        |"|#          }$|                     ||$          }n|                     ||          }||d'<   n9|                     ||          |d<   n|d)k    r|                     ||          ||<   |                     |g d*          }%|%|%||<   |r]|t+          | j        d+z             |                     ||          |d<   d,|d	<   |r||d<   n|rt#          j        |d-          }&|&|d<   n|%|d,k    r|                     ||          |d<   d.|d	<   n||d/|d	<   |	d         d0d)g d1}'|
d"k    rd2nd"}(|O|                     |dd|          })|(d3|                     ||)          d4d#d5}*|'d                             |*           |O|                     |dd|          }+|(d6|                     ||+          d4d#d5},|'d                             |,           |'g|d<   |                     |g d7          }d}-|r*|                     |                     ||                    }-n)|                     |                     ||                    }-|                     |-d8          }.|.3|                     |.d9g           }/|                     |/d:         |	          S |                     |-|	          }0||0d<   |0S );aD  
        create a trade order
        :see: https://docs.woo.org/#send-order
        :see: https://docs.woo.org/#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 of currency you want to trade in units of base currency
        :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param 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
        :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        
reduceOnlyreduce_onlyr(   )r  rK  triggerPrice	stopPricestopLoss
takeProfitalgoTyper  activatedPricer  callbackValuer  callbackRateNchildOrdersMARKETtimeInForceclientOrderIdclient_order_idquantityorder_quantityr  order_pricer  
order_type	POST_ONLYfokFOKiocIOCr5   BUYTrF   r   r%  order_amounta	   createOrder() requires the price argument for market buy orders to calculate the total cost to spend(amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to False and pass the cost to spend(quote quantity) in the amount argumentPOSITIONAL_TP_SLclOrdIDr  r  zL createOrder() requires a trailingTriggerPrice parameter for trailing ordersTRAILING_STOP100STOPBRACKETF)r  r  r  r  SELL	STOP_LOSSCLOSE_POSITION)rK  r  r  r  r  TAKE_PROFIT)r  r  r  postOnlyr  r  r  r  r  r  r  r  r   r   r   )safe_bool_2omitupperr=  r4  safe_number_2
safe_valuer   safe_string_2number_to_stringrR  is_post_onlyprice_to_precisionhandle_option_and_paramscost_to_precisionr   r(   r$   rQ  amount_to_precisionsafe_string_nr   rj  appendv3PrivatePostAlgoOrderr?  v1PrivatePostOrderr   r  parse_order)1r   r  r  rK  r  r  r   r  	orderTyper4  	orderSiderA  r  r  r  r  r  r  r  isTrailingAmountOrderisTrailingPercentOrder
isTrailingisStopisMarketr  r  reduceOnlyKeyclientOrderIdKeyorderQtyKeypriceKeytypeKeyquoteAmountr   r%  amountStringpriceStringcostRequestr  convertedTrailingPercentoutterOrder	closeSidestopLossPricestopLossOrdertakeProfitPricetakeProfitOrderr   r   r   r   s1                                                    r   r  zwoo.create_ordere  si   . %%flMJJ
6L-#@AAJJLL	V$$JJLL	Tl
 
 &&v~{KK	??6:66__V\::
##FJ77#11&:PRbdhdydyz  eA  eA   B   B++F4DoVV,,V5FWW .d :!0!<*D.D
  _y4  _8L  _PZbfPf  _kokzkz  |B  DQ  lR  lR  Z^  l^(,,V]CC$$XtV<<(.AM.4K??:K$*@jj0@$777-"4&&$ 	. .(3%%%%(-%%%%(-% 	0%/GM" $ 7 7 F FGH 	LF 	Lf~ U)u"4"4"481<@<Y<YZ`bo  rU  W[  =\  =\916))&&.II6FN+CDD#"&"8"8"F"FKK6 	I}*47  6A  ,A  B  B  B'+'<'<V'D'D&*&;&;E&B&B&-&8{&S&S&*&<&<V[&Q&Q"&"8"8"H"HK*5'',0,D,DVV,T,T())+++#'#;#;FF#K#KGK **63b3b3bcc$(5G$% +	3#+'  3A  )A  B  B  B(,(?(?H\(](]G$%"1GJ$ C+9((' C+2+=ou+U+U(*B'"?***.*A*A&)*T*T'&,
#"
(>"+GJ ,#.!	 K $-#5#5EI# $ 2 28^WV^ _ _% +$($;$;FM$R$R,"&! ! M*11-@@@%"&"4"4ZQXZd"e"e% -$($;$;FO$T$T,"&# # M*11/BBB&1]GM"6  $b  $b  $b  c  c 	M224;;w3O3OPPHH..t{{7F/K/KLLH4 ~~h//>>$33D##DGV444  622fr   r(   c                    |                                   |                     |          }i }	||                     ||          |	d<   ||                     ||          |	d<   |                     |dd          }
|                     |d|
          }|du}|                     |g d          }||                     ||          |	d<   |                     |d	d
|                     |                    }|                     |dd          }|                     |dd          }|du}|du}|p|}|r?||                     ||          |	d
<   |r||	d<   n|rt          j	        |d          }||	d<   | 
                    |g d          }|p|dup|                     |d          du}d}|r[||	d<   |r*|                     |                     |	|                    }n|                     |                     |	|                    }nZ||	d<   |r*|                     |                     |	|                    }n)|                     |                     |	|                    }|                     |di           }|                     ||          S )a  
        edit a trade order
        :see: https://docs.woo.org/#edit-order
        :see: https://docs.woo.org/#edit-order-by-client_order_id
        :see: https://docs.woo.org/#edit-algo-order
        :see: https://docs.woo.org/#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 fullfilled, 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>`
        Nr  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  oidr   )r=  r4  r  r  r  r   safe_number_nr  r$   rj  r  r  (v3PrivatePutAlgoOrderClientClientOrderIdr?  $v3PrivatePutOrderClientClientOrderIdv3PrivatePutAlgoOrderOidv3PrivatePutOrderOidr   r  )r   r(   r  r  rK  r  r  r   r4  rA  clientOrderIdUnifiedclientOrderIdExchangeSpecificisByClientOrderr  r  r  r  r  r  r  r  r  r   r   s                           r   
edit_orderzwoo.edit_order  s   , 	V$$
 #66vuEEGG"&":":66"J"JGJ#11&)_UU(,(8(8ARTh(i(i%7tC&&v/p/p/pqq	 &*&=&=fi&P&PGN##11&:PRbdhdydyz  eA  eA   B   B++F4DoVV,,V5FWW .d :!0!<*D.D
 	C#/,0,C,CFL`,a,a()$ C+9((' C+2+=ou+U+U(*B'6  $Q  $Q  $Q  R  Rn	 5n4??6S`;a;aim;m 	S)FG%& cHHU\^dIeIeffDDT[[QXZ`EaEabbGEN S88Wf9U9UVV44T[[&5Q5QRR ~~h33f---r   c                 2   |                      |dd          }|                     |d          }|s|t          | j        dz             |                                  d}||                     |          }i }|                     |dd          }|                     |d|          }|du}	d}
|r/||d<   |                     | 	                    ||                    }
n|d	         |d
<   |	rG||d<   |                     |g d          }| 
                    | 	                    ||                    }
n.||d<   |                     | 	                    ||                    }
d
|i}|	r||d<   n||d	<   | 	                    |                     |
          |          S )a<  
        :see: https://docs.woo.org/#cancel-algo-order
        :see: https://docs.woo.org/#cancel-order
        :see: https://docs.woo.org/#cancel-order-by-client_order_id
        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.stop]: whether the order is a stop/algo order
        :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        stopFNz) cancelOrder() requires a symbol argumentr  r  r  rH  r(   r  r  )	safe_boolr  r   r(   r=  r4  r  r   v3PrivateDeleteAlgoOrderOrderIdr?  v1PrivateDeleteClientOrderv1PrivateDeleteOrderr  )r   r(   r  r   r  r4  rA  r  r  r  r   extendParamss               r   cancel_orderzwoo.cancel_orderf  s    ~~ffe4466** 	[#DG.Y$YZZZ[[((F#11&)_UU(,(8(8ARTh(i(i%7tC 	S"$GJ;;DKKQW<X<XYYHH &tGH S-J)*6+Z+Z+Z[[::4;;wPV;W;WXX&(
#44T[[&5Q5QRR !&) 	$.KL*++!#L{{4++H55|DDDr   c                 |   |                                   |                     |dd          }|                     |ddg          }|r|                     |          S |t	          | j        dz             |                     |          }d|d         i}|                     |                     ||                    }|S )a  
        :see: https://docs.woo.org/#cancel-all-pending-orders
        :see: https://docs.woo.org/#cancel-orders
        :see: https://docs.woo.org/#cancel-all-pending-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.stop]: whether the order is a stop/algo order
        :returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
        r  triggerNz* cancelOrders() requires a symbol argumentr  r(   )	r=  r  r   v3PrivateDeleteAlgoOrdersPendingr   r(   r4  v1PrivateDeleteOrdersr?  )r   r  r   r  r4  rA  r   s          r   cancel_all_orderszwoo.cancel_all_orders  s     		::6FI#677 	A88@@@>#DG.Z$Z[[[V$$fTl
 --dkk'6.J.JKK r   c                 j   |                                   ||                     |          nd}|                     |dd          }|                     |ddg          }i }|                     |dd          }d}|r/||d<   |                     |                     ||                    }n_|r/||d<   |                     |                     ||                    }n.||d<   |                     |                     ||                    }| 	                    |d|          }	| 
                    |	|          S )	a  
        :see: https://docs.woo.org/#get-algo-order
        :see: https://docs.woo.org/#get-order
        fetches information on an order made by the user
        :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.stop]: whether the order is a stop/algo order
        :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        Nr  r  r  r  r  r  r   )r=  r4  r  r  r  v3PrivateGetAlgoOrderOidr?  $v1PrivateGetClientOrderClientOrderIdv1PrivateGetOrderOidr   r  )
r   r(   r  r   r4  r  rA  r  r   r   s
             r   fetch_orderzwoo.fetch_order  sF    	)/);V$$$$	::6FI#677**69oNN 	OGEN44T[[&5Q5QRRHH 	O)6G%&@@WV\A]A]^^HHGEN00Wf1M1MNNHH &(;;///r   c           	      
   |                                   d}|                     |dd          \  }}|r|                     d||||dd          S i }d}|                     |dd          }|                     |d	d          }	|                     |g d
          }| |                     |          }|d         |d<   ||s|	r||d<   n||d<   |||d<   nd|d<   |rd|d<   n|	rd|d<   d}
|s|	r*|                     |                     ||                    }
n)| 	                    |                     ||                    }
| 
                    |
d|
          }|                     |d          }|                     ||||          S )  
        fetches information on multiple orders made by the user
        :see: https://docs.woo.org/#get-orders
        :see: https://docs.woo.org/#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.stop]: whether the order is a stop/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>`
        Frn   paginatepage  Nr  r  trailing)r  r  r  r(   r  createdTimeStartstart_tsizer  r  r   r   )r=  r   fetch_paginated_call_incrementalr  r  r  r4  v3PrivateGetAlgoOrdersr?  v1PrivateGetOrdersr  r  parse_orders)r   r  r:  r;  r   r  rA  r4  r  r  r   r   r   s                r   fetch_orderszwoo.fetch_orders  s     	88PZ[[& 	s88PUW\^dflnqrrr	::>>&*e<<6#B#B#BCC[[((F &tGH +x +.3*++%*	"#GFOO!GFO 	2"(GJ 	2"1GJ 	M8 	M224;;w3O3OPPHH..t{{7F/K/KLLH@ x::f--  >>>r   c                     |                                   |                     |ddi          }|                     ||||          S )r   r   
INCOMPLETEr=  r?  r  r   r  r:  r;  r   extendedParamss         r   fetch_open_orderszwoo.fetch_open_ordersF  sH      	Vh-EFF  ~FFFr   c                     |                                   |                     |ddi          }|                     ||||          S )r   r   	COMPLETEDr  r  s         r   fetch_closed_orderszwoo.fetch_closed_ordersZ  sH      	Vh-DEE  ~FFFr   c                 <    dddd}|                      ||d           S )Nr  r  PO)r  r  	post_onlyr   )r   r  timeInForcess      r   parse_time_in_forcezwoo.parse_time_in_forcen  s1    
 

 k4@@@r   c                    |                      |g d          }|                     |g d          }|                     |                     |dd                    }|                     |d          }|                     ||          }|d         }|                     |dd          }|                     |dd	          }	|                     |d
d          }
|                     |dd          }|                     |dd          }|                     |d          }|                     |                     |dd                    }|                     |                     |dd                    }t          j
        |
|          }|                     |dd          }|                     |dd          }|                     |d          }|                     |d          }d }d }|                     |d          }||                     |d          }|                     |dg           }t          |          }|dk    rX|                     |d          }|                     |d          }|                     |d          }|                     |d          }|                     |dd          }|                     i d |d|d!|d"|                     |          d#d d$|d|                     |          d|d|d%|                     |          d&d d'|                     |d(          d|d|d)|d|d*||||	|||
|||d+|d,	|          S )-N)r   r&  createdTime)rH  orderIdalgoOrderIdr  r  r  r  r  r  r  r  r  r  r  r   
algoStatusrK  executedtotalExecutedQuantityaverage_executed_priceaverageExecutedPrice	total_feetotalFeerI  feeAssetTransactionsr  r  r   r   updatedTimeupdated_timer(   r   rM  lastTradeTimestamplastUpdateTimestampr  r  r  r  r  r  rZ  )	r  averager  filled	remainingr%  tradesrJ  r   )safe_timestamp_nr  	omit_zeror  r   rO  safe_string_lower_2safe_value_2rR  r$   
string_subr  r2  rh  safe_timestamp_2
safe_orderrT  parse_order_statusr  r  )r   r   r4  r   r  r  r5  r  r  r  r%  r  r   rK  r.  r-  r/  rJ  feeCurrencytransactionsr  r  r  r  r7  innerChildOrdersinnerChildOrdersLengthr  r  r,  s                                 r   r  zwoo.parse_orderv  s   Z ))%1]1]1]^^	$$U,R,R,RSSt'9'9%ARTc'd'dee##E844!!(F33!""5-AA##E+;ZHH!!%BB,,UL&II	""5(LAA%%eV44 1 1%E\ ] ]^^..!3!3E;SUk!l!lmm&tV44	{J??((ZHHun==$$UN;;	#!ooe];;"OOK33E#umRHH%()9%:%:"%))"&//2BA"F"F $0@! D D"&"2"2?N"S"S $ 0 0 O O"33E=.YY  
' 
] 
  
 Y//	 

 !$ 
 "#6 
 d--f55 
 f 
 I 
 433I>> 
  
 $..>> 
 D 
 U 
  
  I! 
" # 
$ +""'  ; 
  
  
< =  	r   c           
      P    |#dddddddddd	}|                      |||          S |S )Nopenclosedcanceledrejected)	NEWFILLEDCANCEL_SENTCANCEL_ALL_SENT	CANCELLEDPARTIAL_FILLEDREJECTEDr  r  r  r   r   statusess      r   r8  zwoo.parse_order_status  sN    ")#-'"(&$%
 
H ##Hff===r   c           	      J   |                                   |                     |          }d|d         i}|t          |d          }||d<   |                     |                     ||                    }|                     |d          }|                     |||ddd	d
          S )a  
        fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
        :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
        r  r(   N  	max_levelr   bidsasksr  r  )r=  r4  r  v1PublicGetOrderbookSymbolr?  r   parse_order_book)r   r  r;  r   r4  rA  r   r   s           r   fetch_order_bookzwoo.fetch_order_book  s     	V$$fTl
 t$$E#(GK 224;;w3O3OPP" %%h<<	$$Xvy&&RY[efffr   r   c                    |                                   |                     |          }|d         |                     | j        ||          d}|du}|:|8|                     |          dz  dz  }	|                                 |	z
  }
||
k     }|r||d<   n|t          |d          |d<   d}|s*|                     |                     ||                    }n?| 	                    |                     ||                    }| 
                    |d          }|                     |d	g           }|                     |||||          S )
a  
        :see: https://docs.woo.org/#kline-public
        :see: https://docs.woo.org/#kline-historical-data-public
        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
        :returns int[][]: A list of candles ordered, open, high, low, close, volume
        r(   )r  r  NrL  i  
start_timer;  r   r   )r=  r4  r   r   parse_timeframemillisecondsr  v1PublicGetKliner?  v1PubGetHistKliner   r  parse_ohlcvs)r   r  	timeframer:  r;  r   r4  rA  useHistEndpointoneThousandCandlesstartWithLimitr   r   s                r   fetch_ohlcvzwoo.fetch_ohlcv  so    	V$$Tl$$T_iKK
 
  t+E$5!%!5!5i!@!@4!G#!M!..003EEN#n4O 	0$)GL!!"5$//GG 	8,,T[[&-I-IJJHH, --dkk'6.J.JKKH~~h77H. ~~h33  vy%GGGr   c           	         |                      |d          |                     |d          |                     |d          |                     |d          |                     |d          |                     |d          gS )Nstart_timestampr>  highlowclosevolume)r   r2  )r   ohlcvr4  s      r   parse_ohlcvzwoo.parse_ohlcve  s     e%677UF++UF++UE**UG,,UH--
 	
r   c                    |                                   d}||                     |          }d|i}|                     |                     ||                    }|                     |dg           }	|                     |	||||          S )a  
        fetch all the trades made from a single order
        :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>`
        Nr  r   )r=  r4  v1PrivateGetOrderOidTradesr?  r  r@  )
r   r(   r  r:  r;  r   r4  rA  r   r0  s
             r   fetch_order_tradeszwoo.fetch_order_tradesp  s     	[[((F2
 224;;w3O3OPP& &"55  vFFFr   c           	         |                                   d}|                     |dd          \  }}|r|                     d||||dd          S i }d}| |                     |          }|d         |d<   |||d	<   |||d
<   nd|d
<   |                     |                     ||                    }|                     |dg           }	|                     |	||||          S )aG  
        :see: https://docs.woo.org/#get-trades
        fetch all trades made by the user
        :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>`
        Frg   r  r  r  Nr(   r  r  r  r   )r=  r  r  r4  v1PrivateGetClientTradesr?  r  r@  )
r   r  r:  r;  r   r  rA  r4  r   r0  s
             r   fetch_my_tradeszwoo.fetch_my_trades  s    	88R\]]& 	u88&RWY^`fhnpsttt[[((F &tGH!&GI#GFOO!GFO00Wf1M1MNN0 &"55  vFFFr   c                     |                      |          }|                     |dg           }|                     ||          S )a  
        fetch all the accounts associated with a profile
        :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
        r   )v1PrivateGetSubAccountAssetsr  parse_accounts)r   r   r   r   s       r   fetch_accountszwoo.fetch_accounts  sD     44V<<" ~~h33""4000r   c                 n    |                      |d          }||                      |d          |d |dk    dS )Naccountapplication_idMainmain
subaccount)r   r(   r)   rt  r  r  )r   rr  	accountIds      r   parse_accountzwoo.parse_account  sM     $$Wi88	""7,<=='
 
 	
r   c                     |                                   |                     |          }|                     |d          }|                     |          S )ai  
        query for balance and get the amount of funds available for trading or funds locked in orders
        :see: https://docs.woo.org/#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>`
        r   )r=  v3PrivateGetBalancesr   parse_balancer  s       r   fetch_balancezwoo.fetch_balance  sR     	,,V440 ~~h//!!$'''r   c                    d|i}|                      |dg           }t          dt          |                    D ]~}||         }|                     |                     |d                    }|                                 }|                     |d          |d<   |                     |d          |d<   |||<   |                     |          S )Nr   holdingr   r   totalavailableBalancefree)r  rg  rh  r1  r   rr  safe_balance)r   r   rk  r   rl  balancert  rr  s           r   r{  zwoo.parse_balance  s    H
 >>(Ir::q#h--(( 	# 	#AqkG**4+;+;GW+M+MNNDllnnG#//CCGG"..w8JKKGFO"F4LL  (((r   rt  c                    |                                   |                     |          }|                     |          }|                     |d|          }|                     |d          }|dz   |d         z   }d|i}|                     |                     ||                    }|                     |d          }	|                     |d          }
|                     |
           ||
|	||dS )a9  
        fetch the deposit address for a currency associated with self account
        :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>`
        rs  r  rt  r   extraaddress)r[  r  tagrs  r   )r=  r[  !default_network_code_for_currencyr   r  v1PrivateGetAssetDepositr?  check_address)r   rt  r   r[  networkCodeDefaultnetworkCodecodeForExchangerA  r   r  r  s              r   fetch_deposit_addresszwoo.fetch_deposit_address)  s    	==&&!CCDII&&vy:LMM69--%+hv.>>_
 00Wf1M1MNN x11""8Y777###"
 
 	
r   c                 |   |                                   i }d }| |                     |          }|d         |d<   |||d<   |||d<   |                     |d          }|                     |d          }|||d<   |                     |                     ||                    }||                     |di           gS )Nr(   ro  r  pageSizer  r   )r=  r[  r   r  v1PrivateGetAssetHistoryr?  r  )	r   rt  r:  r;  r   rA  r[  transactionTyper   s	            r   get_asset_history_rowszwoo.get_asset_history_rowsK  s    !}}T**H'/~GO$!&GI"'GJ**66::66**&-GFO00Wf1M1MNNF $//(FB??@@r   c                 j    |                      ||||          \  }}|                     |||||          S )a  
        fetch the history of changes, actions done by the user or operations that altered balance of the user
        :param str code: unified currency code, default is None
        :param int [since]: timestamp in ms of the earliest ledger entry, default is None
        :param int [limit]: max number of ledger entrys to return, default is None
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
        )r  parse_ledger)r   rt  r:  r;  r   r[  r   s          r   fetch_ledgerzwoo.fetch_ledger  s=     44T5%PP$  xvFFFr   r[  c                    |                      |d          }|                     ||          }|d         }|                     |d          }|                      |d          }|dk    rdnd}|                     |d          }	|                     |d	d
          }
|                      |d          ||                      |d          d |                      |d          |                     |                      |d                    |d d |
||	|                     |	          |                     |                      |d                    |dS )Nr   rt  r  
token_sideDEPOSITinoutr&  	fee_token
fee_amountr(   rr  tx_idr   r  )r(   r[  rr  referenceAccountreferenceIdr   r  beforeafterrJ  	directionr   rM  r  r   )r   get_currency_from_chaincoder2  r3  rP  parse_transaction_statusrT  parse_ledger_entry_type)r   r\  r[  networkizedCodecurrencyDefinedrt  r  rK  r  r   rJ  s              r   parse_ledger_entryzwoo.parse_ledger_entry  sS   **499::?HUUv&!!$11l33!Y..DDU	''n==	++D+|LL""4..''i88 $++D'::33D4D4DT84T4TUU""Y//001A1A$1O1OPP
 
 	
r   c                 :    ddd}|                      |||          S )Ntransactionr   )BALANCE
COLLATERALr  )r   r  typess      r   r  zwoo.parse_ledger_entry_type  s.    $$
 
 tT222r   c                    ||S |                     d          }t          |          }|                     |d          }|                     |d|          }|dk    r|d|                     |d          z   z  }|                     |          }|S )Nr  r   r   r   )r0  rh  r   safe_currency)r   r  r[  r6  partsLength	firstPartr  s          r   r  zwoo.get_currency_from_chaincode  s    O#))#..Ee**K((22I))%I>>JQcD$4$4UA$>$>>>
))*55Hr   c           	      b    ddi}|                      ||||                     ||                    S )a  
        fetch all deposits made to an account
        :param str code: unified currency code
        :param int [since]: the earliest time in ms to fetch deposits for
        :param int [limit]: the maximum number of deposits structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
        r  r  fetch_deposits_withdrawalsr?  r   rt  r:  r;  r   rA  s         r   fetch_depositszwoo.fetch_deposits  s;     )
 ..tUE4;;wX^C_C_```r   c           	      b    ddi}|                      ||||                     ||                    S )a  
        fetch all withdrawals made from an account
        :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  WITHDRAWr  r  s         r   fetch_withdrawalszwoo.fetch_withdrawals  s;     *
 ..tUE4;;wX^C_C_```r   c           	          ddi}|                      ||||                     ||                    \  }}|                     |||||          S )a$  
        fetch history of deposits and withdrawals
        :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>`
        r  r  )r  r?  parse_transactions)r   rt  r:  r;  r   rA  r[  r   s           r   r  zwoo.fetch_deposits_withdrawals  s]     I
 44T5%U\^dIeIeff$ &&tXueVLLLr   c                    |                      |d          }|                     ||          }|d         }|                     |d          }|dk    rd}|                     |dd          }|                      |d          }|                      |d	          }	|                     |d
          }
i d|d|                     |dd          d|                      |d          d|
d|                     |
          dd d|	d|d|                      |d          dd dd d|d|                     |d          d|d|                     |                      |d                    d|                     |d          dd d |d d S )!Nr   rt  r  r   
withdrawalr  r  target_addresssource_addressr&  r   r(   withdraw_idtxidr  r   rM  r  addressFrom	addressTor  r  tagFromtagTor  r  r[  r   r   r*  comment)internalrJ  rs  )	r   r  rR  rP  r3  r  rT  r2  r  )r   r  r[  r  r  rt  movementDirectionrJ  r  r  r   s              r   parse_transactionzwoo.parse_transaction  s   **;@@::?HUUv& 22;MM
** ,++KlSS$$[2BCC	&&{4DEE''^DD	
K
$$$[$FF
 D$$['::
 	

 Y//
 t
 ;
 
 4##K99
 t
 T
 %
 d&&{H==
 
 d33D4D4D[RZ4[4[\\
  t**;GG!
" t#
$ )
 
 
 	
r   c                 @    dddddd}|                      |||          S Npendingr   r@  )rB  
CONFIRMING
PROCESSINGr  CANCELEDr  rI  s      r   r  zwoo.parse_transaction_status  7    ##"
 
 &&999r   fromAccount	toAccountc                    |                                   |                     |          }|d         |                     |          ||d}|                     |                     ||                    }|                     ||          }	|                     | j        di           }
|                     |
dd          }|r||	d<   ||	d<   ||	d<   |	S )	a  
        :see: https://docs.woo.org/#get-transfer-history
        transfer currency internally between wallets on the same account
        :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>`
        r(   )r   r  from_application_idto_application_idr   r   Tr  r  r  )	r=  r[  parse_to_numeric!v1PrivatePostAssetMainSubTransferr?  parse_transferr   r   r  )r   rt  r  r  r  r   r[  rA  r   r   transferOptionsr   s               r   r   zwoo.transfer  s     	==&&d^++F33#.!*	
 
 99$++gv:V:VWW &&x::..z2FF"&..B[]a"b"b" 	.!'HX&1H]#$-H[!r   c                 @   i }|||d<   |||d<   |                      |dd          }|                     |ddg          }|||d<   |                     |                     ||                    }|                     |dg           }|                     |d|||          S )az  
        fetch a history of internal transfers made on an account
        :see: https://docs.woo.org/#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  untiltillend_tr   )safe_integer_2r  'v1PrivateGetAssetMainSubTransferHistoryr?  r  parse_transfers)	r   rt  r:  r;  r   rA  r  r   r   s	            r   fetch_transferszwoo.fetch_transfers@  s     #GFO!&GI##FGV<<6GV#455$GG??GU[@\@\]]2 ~~h33##D$ufEEEr   c                    |                      |d          }|                     ||          }|d         }|                     |d          }|                     |d          }d }||rdnd}|                      |d          ||                     |          ||                     |d          |                      |d	          |                      |d
          |                     |                      |d|                    |d	S )Nr   rt  r&  successr   failedr(   r  r  r  r   )	r(   r   rM  r[  r  r  r  r   r   )r   r  r3  r  rT  r2  parse_transfer_status)	r   r   r[  r  r  rt  r   r  r   s	            r   r  zwoo.parse_transferp  s   , **8W==::?HUUv&''.AA	..955$2TT(F""8T22"Y//&&x::++H6KLL))(4GHH001A1A(HV\1]1]^^

 

 
	
r   c                 @    dddddd}|                      |||          S r  r  rI  s      r   r  zwoo.parse_transfer_status  r  r   c                    |                      ||          \  }}|                                  |                     |           |                     |          }||d}|||d<   |                     | j        di           }|                     |di           }	|                     |d          }
|                     ||
|
          }|                     |	|i           }|                     |d          }|t          | j	        dz             ||d<   | 
                    |                     ||                    }|                     ||          S )	a  
        make a withdrawal
        :param str code: unified currency code
        :param float amount: the amount to withdraw
        :param str address: the address to withdraw to
        :param str tag:
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
        )r  r  Nr  r   rs  r(   z% withdraw() require network parameterr   )handle_withdraw_tag_and_paramsr=  r  r[  r   r   safe_string_upperr   r   r(   v1PrivatePostAssetWithdrawr?  r  )r   rt  r  r  r  r   r[  rA  r   currencyNetworksrs  r  coinNetworkcoinNetworkIdr   s                  r   r   zwoo.withdraw  sZ    99#vFFV7###==&&
 
 ?"GG>>$,
B??>>(JCC((;;$$Xw@@	nn%5y"EE((d;; TW'NNOOO(224;;w3O3OPP %%h999r   c                    |                                   d}||                     |          }|d         }|                     |          }|d         |                     ||          d}|                     |                     ||                    }|                     ||          }	|                     |	||d          S )a  
        repay borrowed margin and interest
        :see: https://docs.woo.org/#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>`
        Nr  r(   )r   r  )r  r  )r=  r4  r[  currency_to_precisionv1PrivatePostInterestRepayr?  parse_margin_loan)
r   rt  r  r  r   r4  r[  rA  r   r  s
             r   repay_marginzwoo.repay_margin  s     	[[((FH%F==&&d^00v>>
 
 224;;w3O3OPP ,,Xx@@{{;)
 )
   	r   c                 >    d |                      d |          d d d d |dS )N)r(   r[  r  r  r   rM  r   )r1  )r   r   r[  s      r   r  zwoo.parse_margin_loan  s8     //h??
 
 	
r   c                 *    |                                  S N)rV  )r   s    r   noncez	woo.nonce  s      """r   r   GETc                 :   |d         }|d         }|                      ||          }	|                     | j        d         |                   }
|
d|z   dz   z  }
|                     ||                     |                    }|                     |          }|dk    r*|
|dz   |	z   z  }
|r|
d|                     |          z   z  }
n|                                  |dk    r|dk    s|d	k    rw|                     | j	        d
d          }|sDd}| 
                    | j	        d|          }|                    d          dk    }|r||d<   n||d<   |                     |          }d}t          |                                           }|
|	z  }
| j        |d}|dk    rk||z   dz   |z   dz   |	z   }|dk    s|dk    s|dk    r|                     |          }||z  }n'|r%|                     |          }|
d|z   z  }
|d|z   z  }d|d<   nA|                     |          }|dk    s|dk    s|dk    r|}n
|r|
d|z   z  }
|d|z   z  }d|d<   |                     |                     |          |                     | j                  t&          j                  |d<   |
|||dS )Nr   r   r   r  r   ?POSTr   r   r   Fr   r   algo	broker_id )z	x-api-keyzx-api-timestampr   PUTDELETEzapplication/jsonzcontent-type|z!application/x-www-form-urlencodedzx-api-signature)r   methodbodyheaders)implode_paramsimplode_hostnamer   r  extract_paramskeysort	urlencodecheck_required_credentialsr  r   r   findstrr  apiKeyjsonhmacencodesecrethashlibsha256)r   pathsectionr  r   r  r  r.   accesspathWithParamsr   isSandboxModeapplicationIdr   r  authtsquerys                     r   signzwoo.sign  s   !*,,T6::##DIe$4V$<==sW}s""64#6#6t#<#<==f%%X6C<.00C 4sT^^F3333++---T\%9%9TW__ $t|]E R R$ 7$JM#//j-XXH!YYv..3F 7-5z**.6{+f--DTZZ\\""B>!C![#% G $F{S(72S8>IV##v&H:L:L99V,,DDLDD , $v 6 6sU{*e+*<''~~f--V##v&H:L:LDD *sTz)b *M')-4;;t3D3DdkkRVR]F^F^`g`n)o)oG%&fdwOOOr   c
                 2   |sd S |                      |d          }
|                     |d          }|
sd| j        dz   |                     |          z   }|                     | j        d         ||           |                     | j        d         ||           d S )Nr  rt   r   r   )r  r   r(   r  throw_broadly_matched_exceptionr   throw_exactly_matched_exception)r   httpCodereasonr   r  r  r  r   requestHeadersrequestBodyr  	errorCodefeedbacks                r   handle_errorszwoo.handle_errors4	  s     	4
 ..955$$Xv66	 	`w}tyy':'::H001I4QYZZZ001I9V^___tr   c           	      p   |                      |d          }|                     ||          }|                     |d          }|                     d          }|                      |d          }|                     |d          }|                     |d          }	|||||                     |          |||	dS )Nr  funding_feeUSDr(   r*  funding_rate)r   r  rt  r   rM  r(   r  rate)r   safe_symbolr2  r1  r3  rT  )
r   incomer4  r5  r  r  rt  r(   r   r.  s
             r   parse_incomezwoo.parse_incomeC	  s     ##FH55!!(F33!!&-88&&u--fd++''??	77"Y//	
 	
 		
r   c                 4   |                                   i }d }| |                     |          }|d         |d<   |||d<   |                     |                     ||                    }|                     |dg           }|                     ||||          S )Nr(   r  r  r   )r=  r4  v1PrivateGetFundingFeeHistoryr?  r  parse_incomes)	r   r  r:  r;  r   rA  r4  r   rk  s	            r   fetch_funding_historyzwoo.fetch_funding_historyc	  s    [[((F &tGH!&GI55dkk'66R6RSS0 &"55!!&&%???r   c                 :   |                      |d          }|                     |          }|                     |d          }|                     |d          }|                     |d          }i d|d|d         dd dd d|                     d	          d
d d|d|                     |          d|                     |d          d|d|                     |          dd dd dd d|                     |d          d|d|                     |          S )Nr  next_funding_timeest_funding_rate_timestamplast_funding_rate_timestampr   	markPrice
indexPriceinterestRater   estimatedSettlePricer   rM  fundingRateest_funding_ratefundingTimestampfundingDatetimenextFundingRatenextFundingTimestampnextFundingDatetimepreviousFundingRatelast_funding_ratepreviousFundingTimestamppreviousFundingDatetime)r   r4  r   r   rT  r2  )r   r>  r4  r  rC  estFundingRateTimestamplastFundingRateTimestamps          r   parse_funding_ratezwoo.parse_funding_rate	  s    !!+x88V$$#00>QRR"&"3"3KA]"^"^#'#4#4[B_#`#` 
K
fX&
 
 $	

 D--c22
 #D
 0
 %<==
 4++K9KLL
  4
 t||,@AA
 t
 #D
 "4
 "4#3#3KAT#U#U
  '(@!
" &t||4L'M'M#
 	
r   c                     |                                   |                     |          }d|d         i}|                     |                     ||                    }|                     ||          S Nr  r(   )r=  r4  v1PublicGetFundingRateSymbolr?  rK  r   r  r   r4  rA  r   s         r   fetch_funding_ratezwoo.fetch_funding_rate	  sp    V$$fTl
 44T[[&5Q5QRR &&x888r   ri  c                    |                                   |                     |          }|                     |          }|                     |dg           }|                     |          }|                     |d|          S )Nr   r  )r=  market_symbolsv1PublicGetFundingRatesr  parse_funding_ratesfilter_by_array)r   ri  r   r   r   rk  s         r   fetch_funding_rateszwoo.fetch_funding_rates	  s|    %%g..//77" ~~h33))$//##FHg>>>r   c           
         |                                   d}|                     |dd          \  }}|r|                     d||||dd          S i }|(|                     |          }|d         }|d         |d<   ||                     |d	z            |d
<   |                     d||d          \  }}|                     |                     ||                    }|                     |d          }	g }
t          dt          |	                    D ]}|	|         }|                     |d          }|                     |d          }|
                    ||                     |          |                     |d          ||                     |          d           |                     |
d          }|                     ||||          S )a  
        fetches historical funding rate prices
        :see: https://docs.woo.org/#get-funding-rate-history-for-one-market-public
        :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>`
        Fr^   r  r     Nr  r(   rL  r  r  gMbP?r   r   funding_rate_timestampr-  )r   r  r>  r   rM  r   )r=  r  r  r4  parse_to_inthandle_until_optionv1PublicGetFundingRateHistoryr?  r  rg  rh  r   r   r  r/  r2  rT  sort_byfilter_by_symbol_since_limit)r   r  r:  r;  r   r  rA  r4  r   rk  ratesrl  entryr5  r   sorteds                   r   fetch_funding_rate_historyzwoo.fetch_funding_rate_history	  s    	88AZ\fgg& 	~889RTZ\achjprxz|}}}[[((FH%F &tGH!%!2!254<!@!@GI227GVUSS55dkk'66R6RSS( &11q#f++&& 
	 
	A1IE''x88H))%1IJJILL**844#//~FF& LL33      e[1100NNNr   hedgedc                 r    d}|rd}nd}d|i}|                      |                     ||                    }|S )a  
        set hedged to True or False for a market
        :see: https://docs.woo.org/#update-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position_mode)v1PrivatePostClientPositionModer?  )r   rc  r  r   	hedgeModerA  r   s          r   set_position_modezwoo.set_position_mode
  sS     	 	"$II!IY
 77GV8T8TUU r   c                     |                                   |                     |          }|                     |          }|                     |di           }|                     ||          S )aZ  
        fetch the set leverage for a market
        :see: https://docs.woo.org/#get-account-information-new
        :param str symbol: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `leverage structure <https://docs.ccxt.com/#/?id=leverage-structure>`
        r   )r=  r4  rf  r   parse_leverage)r   r  r   r4  r   r   s         r   fetch_leveragezwoo.fetch_leverage1
  sg     	V$$//77: ~~h33""4000r   c                 J    |                      |d          }||d         d ||dS )Nr$  r  )r   r  
marginModelongLeverageshortLeverage)r   )r   r$  r4  leverageValues       r   rl  zwoo.parse_leverage[
  s:    ))(J??X&)*
 
 	
r   r$  c                     |                                   |dk     s|dk    rt          | j        dz             d|i}|                     |                     ||                    S )Nr      z$ leverage should be between 1 and 20r$  )r=  r   r(   v1PrivatePostClientLeverager?  )r   r$  r  r   rA  s        r   set_leveragezwoo.set_leveragee
  sk    qLLhmmTW'MMNNN
 //GV0L0LMMMr   c                     |                                   |                     |          }d|d         i}|                     |                     ||                    }|                     ||          S rM  )r=  r4  v1PrivateGetPositionSymbolr?  parse_positionrO  s         r   fetch_positionzwoo.fetch_positionn
  sp    V$$fTl
 224;;w3O3OPP  ""8V444r   c                     |                                   |                     |          }|                     |di           }|                     |dg           }|                     ||          S )Nr   r   )r=  v3PrivateGetPositionsr   r  parse_positions)r   ri  r   r   rk  r   s         r   fetch_positionszwoo.fetch_positions
  si    --f550 &"55NN6;;;	##Iw777r   c                    |                      |d          }|                     ||          }|                      |d          }d }t          j        |d          rd}nd}|                      |d          }|                      |d          }|                     |d          }|                      |d	          }	t          j        ||	          }
t          j        |
|          }t          j        |          }t          j        ||          }|                     i d
|dd d|                      |d          d|d| 	                    |          dd dd dd dd dd d| 
                    |	          d| 
                    |          dd d| 
                    |          d| 
                    |          d| 
                    |          dd |                     |d          | 
                    |          d d dd |d d d d d          S )Nr  r~  r   longshortr(  r:  r   averageOpenPricer   r(   rM  r,  initialMargininitialMarginPercentagemaintenanceMarginmaintenanceMarginPercentage
entryPricenotionalr$  unrealizedPnl	contractsmarginRatioestLiqPricecross)liquidationPricer:  	lastPrice
collateralro  
marginTyperK  r   rc  r  r  )r   rO  r$   	string_gtr3  r5  rQ  
string_abssafe_positionrT  r   r2  )r   positionr4  r  r  rK  r(  r:  r   r  priceDifferenceunrealisedPnlr  s                r   ry  zwoo.parse_position
  s     ##Hh77!!(F33)44T3'' 	DDD''??$$X{;;	''+>>	%%h0BCC
!,Y
CC*?DAA!$''%dI66!! #
H#
$#
 d&&vx88#
 	#

 Y//#
 "4#
 T#
 &t#
  #
 *4#
 $++J77#
 ))(33#
 #
 T..}==#
 **400#
  D--l;;!#
" 4##
$ !% 0 0= I I**955!!#9#
 #
 #
   	r   fromCodetoCodec                    |                                   |                                |                                |                     |          d}|                     |                     ||                    }|                     |di           }|                     |d|          }|                     |          }	|                     |d|          }
|                     |
          }|                     ||	|          S )a,  
        fetch a quote for converting from one currency to another
        :see: https://docs.woo.org/#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>`
        )	sellTokenbuyTokensellQuantityr   r  r  )	r=  r  r  v3PrivateGetConvertRfqr?  r   r   r[  parse_conversion)r   r  r  r  r   rA  r   r   fromCurrencyIdfromCurrencytoCurrencyId
toCurrencys               r   fetch_convert_quotezwoo.fetch_convert_quote
  s     	!)) 11&99
 

 ..t{{7F/K/KLL" ~~h33))$XFF}}^44''j&AA]]<00
$$T<DDDr   c                     |                                   d|i}|                     |                     ||                    }|                     |di           }|                     |          S )aY  
        convert from one currency to another
        :see: https://docs.woo.org/#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>`
        r  r   )r=  v3PrivatePostConvertRftr?  r   r  )	r   r(   r  r  r  r   rA  r   r   s	            r   create_convert_tradezwoo.create_convert_trade  sp     	r
 //GV0L0LMM ~~h33$$T***r   r  r  c                    |                      |d          }|                     |d          }|                     ||          }|                     |d          }|                     ||          }|||                     |          |                     |d          ||                     |d          ||                     |d          |                     |d          d d
S )	NexpireTimestampr  r  r  r  buyQuantitybuyPrice)
r   r   rM  r(   r  
fromAmountr  toAmountr  rJ  )r   r   r1  rT  r2  )	r   
conversionr  r  r   fromCoinr  tor  s	            r   r  zwoo.parse_conversion(  s    0 %%j2CDD	##J<<**8\BBj*55((Z88"Y//"":y99$**:~FF ((]CC%%j*==
 
 	
r   c                    |                                   |                     |          }i }|                     |dg           }t          dt	          |                    D ]}}||         }|                     |d          }|                     |          }|||ddddddd|                     |d          dddddddddd|                     |d          d	||<   ~|S )
a  
        fetches all available currencies that can be converted
        :see: https://docs.woo.org/#get-quote-asset-info
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an associative dictionary of currencies
        r   r   r   Ntickr  )r  r   rr  r  )r   r(   rt  r   r  r)   r  rr  r   rJ  r-  r.  r/  )	r=  v3PrivateGetConvertAssetInfor  rg  rh  r   r1  r2  r3  )	r   r   r   rk  r   rl  r`  r(   rt  s	            r   fetch_convert_currencieszwoo.fetch_convert_currenciesR  s4    	44V<< ~~h33q#d))$$ 	 	AGE!!%11B**2..D  !--eV<<  $# 
  $#! !
  $#      ..umDD5 F4LL8 r   c                    |                      |          }|d         }t          |                                          }t          dt	          |                    D ]}||         }|dk    r|c S |                     |d          S )Nr   r   r   )r[  rw  rx  rg  rh  r  )r   rt  currencyItemr   networkKeysrl  rs  s          r   r  z%woo.default_network_code_for_currency  s    }}T**
+8==??++q#k**++ 	 	A!!nG%   {A...r   enablec                 l    t          t          |                               |           || j        d<   d S )Nr   )r   r&   set_sandbox_moder   )r   r  r   s     r   r  zwoo.set_sandbox_mode  s3    c4))&111&,]###r   r  )NN)e__name__
__module____qualname__r   r   r   r   r   r  r9  r  r   r   rC  rX  rP  r   rm  r	   r  floatr  r   r   r   r   r  r  r  r  r   r  r  r  r  r  r  r  r  r8  r   rR  rw  r^  rf  ri  rl  r   rp  rx  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)  r1  r5  rK  rP  r   rV  rb  boolrj  r   rm  rl  rv  rz  r~  ry  r   r  r  r  r  r  r  __classcell__)r   s   @r   r&   r&      s       y y y y yv	 #%  
  
  
  
D !# 8 8 8 8( $& ( ($v, ( ( ( (>O
f O
 O
 O
 O
b 6:UW /G /G3 /Gs /G# /G\`af\g /G /G /G /Gb: : :5 : : : :x
 
 
 )+ 3 3{ 3 3 3 3j ') A AZ A A A AF RT N N N5 N N N N  w{  LP  gk  tv L L3 Li Ly Lbg Lps L  {@ L L L L* x|  NR  im  vx L LC Ly LPY Lch Lqt L  }B L L L L* gksu m m3 mi my mRW m`c m m m m^ `drv  @B P. P.S P.# P.Y P.i P.Y\ P.lo P. P. P. P.d 37r -E -Es -EC -E -E -E -E^ /32      > 26b >0 >0c >03 >0 >0 >0 >0@ *.Dt\^ P? P?3 P?c P? P?cghmcn P? P? P? P?d /3TXac G G G3 Gc Ghlmrhs G G G G( 154VZce G G# GS GPS Gjnotju G G G G(A A Ak k k5 k k k kZ    :>b "g "gs "g3 "gY "g "g "g "gH 26DW[df LH LH# LHc LHQT LHkoptku LH LH LH LH\	
 	
 	
4 	
 	
 	
 	
 9=4^bkm %G %GS %G# %GS %GX[ %G %G %G %GN -1tRV_a 4G 4Gc 4G 4GC 4G 4G 4G 4Gl %' 1 14= 1 1 1 14
 
 
" $& !( !(( !( !( !( !(F) ) ) ) ) 79  
  
#  
  
  
  
D 26DW[df 2A 2A3 2Ac 2AQT 2A 2A 2A 2Ah (,$TZ\ 
G 
G 
GC 
Gs 
G 
G 
G 
G
 
 
 
 
 
63 3 3   *.Dt\^ a a3 ac a acghsct a a a a -1tRV_a a ac a aC afjkvfw a a a a 6:[_hj M Ms M# MUX Most  pA M M M M4!
 !
x !
; !
 !
 !
 !
F: : : [] ! !S !% !c !c !an ! ! ! !F +/TPT]_ .F .FC .Fs .F# .F .F .F .F`(
 (
 (
 (
 (
 (
T: : : ?C2 $: $:S $:% $: $: $: $:L =A   c    @
 
 
 
 
 
 # # # "*%DW[ 5P 5P 5P 5Pn  
 
6 
 
 
 
@ 37TX\eg "@ "@C "@s "@RU "@ "@ "@ "@H#
 #
f #
 #
 #
 #
J 68 9 9 9 9 9 9* 6:" ? ?7 ? ? ? ?0 8<$]ajl ;O ;O ;OC ;OWZ ;O ;O ;O ;Oz =A   c    6 24 (1 (1S (1 (1 (1 (1 (1T
 
x 
 
 
 
 9=R N NS N# N N N N ,0 5 5S 5 5 5 50 26b 8 8w 8 8 8 8<= =v = = = =~ MQY[ &E &EC &E &Ec &E`j &E &E &E &EP W[ce + +s +c +3 +PS +jt + + + +:(
 (
 (
V^ (
jt (
 (
 (
 (
T /1 8 8Z 8 8 8 8t	/ 	/ 	/-t - - - - - - - - - -r   r&   )+ccxt.base.exchanger   ccxt.abstract.woor   r  ccxt.base.typesr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   typingr   ccxt.base.errorsr   r   r   r   r   r    r!   r"   ccxt.base.decimal_to_precisionr#   ccxt.base.preciser$   r&    r   r   <module>r     sN   ( ' ' ' ' ' ) ) ) ) ) )  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d  d       * * * * * * 0 0 0 0 0 0 . . . . . . ' ' ' ' ' ' ) ) ) ) ) ) ) ) ) ) ) ) . . . . . . * * * * * * 4 4 4 4 4 4 % % % % % %B.- B.- B.- B.- B.-(K B.- B.- B.- B.- B.-r   