
    !:hI                    $   d dl mZ d dlmZ d dlmZmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ d dlmZ d dlmZ d dlmZ d dlm Z  d dlm!Z! d d	lm"Z" d d
lm#Z# d dlm$Z$ d dlm%Z% d dlm&Z& d dl'm(Z( d dl)m*Z*  G d dee      Z+y)    )Exchange)ImplicitAPI)AnyBalances
CurrenciesCurrencyIntLedgerEntryLeverageMarketNumOrder	OrderBookOrderRequest	OrderSide	OrderTypePositionStrStringsFundingRateFundingRatesTradeTradingFeesTransaction)List)ExchangeError)AuthenticationError)ArgumentsRequired)
BadRequest)InsufficientFunds)InvalidOrder)NotSupported)NetworkError)RateLimitExceeded)	TICK_SIZE)Precisec                   p    e Zd Zdef fdZdef fdZi fdZi fdefdZ	de
defdZi fdee   fd	Zi fdefd
Zd Zdbde
dedefdZddi fdedededee   fdZdbdedefdZd Zi fdedefdZi fde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fdZi fde fdZ!di fdedede"fdZ#dbdede$fdZ%dddi fdedededee$   fdZ&dbde
dede'fd Z(d!efd"Z)d#efd$Z*d%efd&Z+di fded%e,d'e-d(e.d)e/f
d*Z0di fded%e,d'e-d(e.d)e/f
d+Z1i fd,ee2   fd-Z3ddi fd.eded%e,d'e-d(e/d)e/fd/Z4di fd.edefd0Z5di fd1ee   defd2Z6di fdefd3Z7di fd.edefd4Z8dddi fdedededee'   fd5Z9dddi fdedededee'   f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fd8Z<dddi fdededefd9Z=de>fd:Z?i fde>fd;Z@dddi fd<edededefd=ZAdbd>e
d?eBdeCfd@ZDdA ZEdddi fd<edededeeC   fdBZFdbdCe
d?eBdeGfdDZHd#efdEZIdddi fd<edededeeG   fdFZJdddi fd<edededeeG   fdGZKdddi fd<edededeeG   fdHZLi fdIZMdJ ZNdK ZOdL ZPdi fd<ed(e.dMedeGfdNZQdbdeRfdOZSi fdedeRfdPZTdi fdQedefdRZUdbdSe
defdTZVi fdefdUZWdi fdedeeX   fdVZYdW ZZdXdYi ddfdZZ[d[e\d\ed]ed^ed_e
d`efdaZ] xZ^S )cwoofiproreturnc                    | j                  t        t        |          i ddddddgddd	d
dddddddddi dd ddddddddddddddddddddddddd dd!d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d0dd1dd2dd3dd4di d5dd6dd7dd8dd9dd:dd;dd<dd=dd>dd?dd@ddAddBddCddDddEdi dFddGddHddIddJddKddLddMddNddOddPddQddRddSddTddUddVddddddddWdddddddddXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdhdidjdjdidkdlgdmgdndodpdqdrd
i dsdtdudtdvdtdwdtdxdtdydtdzdtd{dtd|dtd}dtd~dtddtddtddtddtddddi ddddddddtddtddtddtddtddtddtddtddtddtddtddtddtddtdtdtdtdtddtdtdtdtdtdtdtdddtidi ddddddtddtddtddtddtddtddtddtddtddtddtddddtddtddti ddtddddddddddddddddddddddddddddtddti ddtddddddtddddtddtddtddtddtdddddd͓dddddddddddddddddҜdtdtdӜdtdtdtdtdtdtdtdtdԜd՜diiddddddלdddd| j	                  dګ      | j	                  d۫      dܜidddddddddd dddd dddddddddddddddiddd ddddddddddddddd ddd d dddddddid	ddidd d ddddddid dd d ddi i dt
        dt        dt        dt        dt        dt        dt        dt        dt        dt        d t        dt        dt        dt        dt        dt        dt        t        t        t        t        t        t        t        di dt        d	      S (
  Nidr(   namez	WOOFI PRO	countriesKY	rateLimitd   versionv1	certifiedTprodexhostnamezdex.woo.orghasCORSspotFmarginswapfutureoption	addMargincancelAllOrderscancelOrdercancelOrders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fetchFundingIntervalfetchFundingIntervalsfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchIndexOHLCVfetchLedgerfetchLeveragefetchMarginAdjustmentHistoryfetchMarginModefetchMarketsfetchMarkOHLCVfetchMyTrades
fetchOHLCVfetchOpenInterestHistoryfetchOpenOrderfetchOpenOrders
fetchOrderfetchOrderBookfetchOrdersfetchOrderTradesfetchPositionfetchPositionModefetchPositionsfetchPremiumIndexOHLCVfetchStatusemulated)fetchTickerfetchTickers	fetchTime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   urlszOhttps://github.com/user-attachments/assets/9ba21b8a-a9c7-4770-b7f1-ce3bcbde68c1zhttps://api-evm.orderly.org)publicprivatez#https://testnet-api-evm.orderly.orgzhttps://dex.woo.orgz9https://orderly.network/docs/build-on-evm/building-on-evmzhttps://dex.woo.org/en/orderlyz%https://dex.woo.org/en/trade?ref=CCXTg?)urldiscount)logoapitestwwwdocfeesreferralr   zpublic/volume/stats   zpublic/broker/namezpublic/chain_info/{broker_id}zpublic/system_infozpublic/vault_balancezpublic/insurancefundzpublic/chain_infozfaucet/usdczpublic/accountget_accountregistration_nonceget_orderly_keyzpublic/liquidationzpublic/liquidated_positionszpublic/configzpublic/campaign/ranking
   zpublic/campaign/statszpublic/campaign/userzpublic/campaign/stats/detailszpublic/campaignszpublic/points/leaderboardzclient/pointszpublic/points/epochzpublic/points/epoch_dateszpublic/referral/check_ref_codezpublic/referral/verify_ref_codezreferral/admin_infozreferral/infozreferral/referee_infozreferral/referee_rebate_summaryzreferral/referee_historyzreferral/referral_historyzreferral/rebate_summaryzclient/distribution_historygQ?)z	tv/configz
tv/historyztv/symbol_infozpublic/funding_rate_historyzpublic/funding_rate/{symbol}zpublic/funding_rateszpublic/infozpublic/info/{symbol}zpublic/market_tradeszpublic/tokenzpublic/futureszpublic/futures/{symbol}register_account)getpostzclient/key_info   z!client/orderly_key_ip_restrictionzorder/{oid}zclient/order/{client_order_id}zalgo/order/{oid}z#algo/client/order/{client_order_id}ordersalgo/ordersztrade/{tid}tradeszorder/{oid}/tradeszclient/liquidator_liquidationsliquidationszasset/history<   zclient/holdingwithdraw_noncesettle_noncezpnl_settlement/historyzvolume/user/dailyzvolume/user/statszclient/statisticszclient/infozclient/statistics/daily	positionsgp=
ף
@zposition/{symbol}zfunding_fee/history   z notification/inbox/notificationsznotification/inbox/unreadzvolume/broker/dailybroker/fee_rate/defaultzbroker/user_infozorderbook/{symbol}klineorderly_keyz%client/set_orderly_key_ip_restrictionz'client/reset_orderly_key_ip_restrictionorderbatch-order
algo/orderliquidationclaim_insurance_fundwithdraw_request
settle_pnlznotification/inbox/mark_readz notification/inbox/mark_read_allzclient/leveragex   zclient/maintenance_configdelegate_signerdelegate_orderly_keydelegate_settle_pnl)delegate_withdraw_requestzbroker/fee_rate/setzbroker/fee_rate/set_defaultr   zreferral/createzreferral/updatezreferral/bindzreferral/edit_split)r   r   )r   r   zclient/orderzalgo/client/orderr   r   r   zclient/batch-order)r   r   putdeleterequiredCredentials)apiKeysecret	accountId
privateKeyr   tradingz0.0002z0.0005)	tierBased
percentagemakertakeroptionsCCXT*0x6F7a338F2aA472838dEFD3283eB360d4Dff5D203)sandboxModebrokerIdverifyingContractAddressfeatures)IOCFOKPOGTD)
marginModetriggerPricetriggerPriceTypetriggerDirectionstopLossPricetakeProfitPriceattachedStopLossTakeProfittimeInForcehedgedtrailingleveragemarketBuyByCostmarketBuyRequiresPriceselfTradePreventionicebergmax  i )r   limitdaysBack	untilDayssymbolRequired)r   triggerr   r   )r   r   r   r   r   )r   r   r   daysBackCanceledr   r   r   r   r     )	sandboxrK   createOrdersrn   rs   rr   ru   rZ   ro   extendsdefault)r   price)r   r   )r   rK   forDerivatives)linearinverse)r   r9   r   r;   r<   z-1000z-1001z-1002z-1003z-1004z-1005z-1006z-1007z-1008z-1009z-1011z-1012z-1101z-1102z-1103z-1104z-1105)z-1201z-12022993215)exactbroad)commonCurrencies
exceptionsprecisionMode)deep_extendsuperr(   describeparse_numberr   r   r$   r   r!   r    r#   r%   )self	__class__s    G/var/www/html/turnos/venv/lib/python3.12/site-packages/ccxt/woofipro.pyr	  zwoofipro.describe   s   h > @ UC
*UC
KUC
 $UC
 	UC

 tUC
 UC
 4UC
 4UC
 UC
  TTT %T 	T
 %T %T UT "4T tT T !%T $UT  T %eT 'T  /!T" $U#T$ ,U%T& 0'T( t)T* 7+T, (-T. '/T0 &t1T2 (3T4 "55T6 (7T8 ,U9T: -e;T< %d=T>  ?T@ ATB &uCTD #EETF $TGTH )%ITJ $UKTL "4MTN &uOTP  QTR +DSTT &tUTV 'WTX (YTZ #D[T\ *4]T^ $T_T` "5aTb tcTd  eTf /gTh "5iTj kTl !%mTn  oTp dqTr +EsTt !%uTv "4wTx dyTz !${T| t}T~ #DT@  ATB $UCTD !$ETF )%GTH tITJ  % %!##($(%/"'$( %#"#(! gTUC
~ UC
X i;<
 DD -O 5 C $#YUC
D / 11/ 0!/  <Q/  1!	/ 
 3A/  3A/  0/  *1/  -a/  *1/  1!/  .q/  1!/  :1/  ,Q/   6r!/ " 4R#/ $ 3B%/ & <R'/ ( /)/ * 8+/ , ,Q-/ . 21// 0 81/ 2 =a3/ 4 >q5/ 6 217/ 8 ,Q9/ : 4Q;/ < >q=/ > 7?/ @ 8A/ B 6qC/ D :1E/ F *+*+./;<<@45+,4545,-./78]/ b /!c4l" -q" ?"  *1"  =a	" 
 /"  B1"  %a"  *1"  *1"  %a"  1!"  =a"  +A"  ,R"  -a"   -a!" " +A#" $ 5a%" & 0'" ( 0)" * 0+" , *2-" . 6r/" 0 (1" 2 03" 4 225" 6 ?7" 8 89" : 22;" < 6r=" > /?" @ 1!A" B $QC" F!)1!CQ! Fq! $Q	!
 *2! )!! *1! 3A! /! )!! ;B! ?! .s! 8! .r!  3B!!" 22#!$ :<35;=79/1/1-/353!8 &'*+ 
 &'*+,-12+,&'+,23	#GM mDFEUC
R "!#	$SUC
^ !%"&!..x8!..x8	_UC
n $",XoUC
x #&+(,,0,1).+06:#'#'"&#(	( #($($(+027/4#')$. r% ',!$$(%+*/& ',#'$)*/	# ',!$#'$)*/( $(&+!$$(,0%+#'$)*/	*  #u=~ y  ) -1 15%*7$# "#3  $	 ##iXyUC
j !#]0 0 .	
 Z Z \ Z \ . \ Z . \ \  \!" \#$ ('$,,#$147< 'iUC
 U U	    enablec                 J    t         t        |   |       || j                  d<   y )Nr   )r  r(   set_sandbox_moder   )r  r  r  s     r  r  zwoofipro.set_sandbox_mode  s     h.v6&,]#r  c                     | j                  |      }| j                  |di       }| j                  |d      }|d}n
|dk(  rd}nd}|ddd|dS )	a|  
        the latest known information on the availability of the exchange API

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-system-maintenance-status

        :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okmaintenance)r  updatedetar   info)v1PublicGetPublicSystemInfo	safe_dictsafe_string)r  paramsresponser  r  s        r  fetch_statuszwoofipro.fetch_status  sn     33F; ~~h3!!$1>Fs]F"F
 	
r  c                 H    | j                  |      }| j                  |d      S )a  
        fetches the current integer timestamp in milliseconds from the exchange server

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-system-maintenance-status

        :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woofipro.fetch_time  s)     33F;   ;77r  marketc                    | j                  |d      }|j                  d      }d}| j                  |d      }| j                  |d      }| j                  |      }| j                  |      }| j                  |d      }	| j                  |	      }
|dz   |z   dz   |
z   }i d|d|d	|d
|d|
d|d|d|	d|dddddddddddd ddddd| j                  d      d d d d | j	                  |d      | j	                  |d      dd d d| j	                  |d      | j	                  |d      d| j	                  |d       | j	                  |d!      d| j	                  |d"      d dd#| j                  |d$      |d%
S )&Nsymbol_r;   r      /:r+   basequotesettlebaseIdquoteIdsettleIdtyper9   Fr:   Tr<   r=   activecontractr   1	base_tick
quote_tick)amountr   minr   base_minbase_max	quote_min	quote_maxmin_notional)r   r9  r   costcreated_time)
r   contractSizeexpiryexpiryDatetimestrike
optionType	precisionlimitscreatedr  )r  splitsafe_currency_coder
  safe_numberr$  )r  r&  marketIdparts
marketTyper0  r1  r-  r.  r2  r/  r(  s               r  parse_marketzwoofipro.parse_market  sR   8 ##FH5s#
!!%+""5!,&&v.''0((2--h7e#c)F20
(0
f0
 D0
 U	0

 f0
 f0
 w0
 0
 J0
 E0
 e0
 D0
 e0
 e0
 d0
  !0
" d#0
$  --c2"**6;?))&,?  
  ++FJ?++FJ?
  ++FK@++FK@
  ++FNC$ ((@_0
 0	
r  c                     | j                  |      }| j                  |di       }| j                  |dg       }| j                  |      S )a<  
        retrieves data on all markets for woofipro

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-available-symbols

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: an array of objects representing market data
        r  rows)v1PublicGetPublicInfor  	safe_listparse_markets)r  r  r   r  rS  s        r  fetch_marketszwoofipro.fetch_marketsG  sL     --f5H ~~h3~~dFB/!!$''r  c                    i }| j                  |      }| j                  |di       }| j                  |dg       }t        dt	        |            D ]  }||   }| j                  |d      }| j                  |d      }	| j                  |      }
d}i }t        dt	        |	            D ]  }|	|   }| j                  |d      }| j                  | j                  |d            }|||nt        j                  ||      }||ddd	ddd	d
ddd| j                  |d      | j                  |      |d	||<    |||
| j                  |      dd|ddddd	| j                  |d      dd	d|d||
<   " |S )a3  
        fetches all available currencies on an exchange

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-token-info

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an associative dictionary of currencies
        r  rS  r   tokenchain_detailsNchain_iddecimalsr:  )r   depositwithdrawal_fee)	r+   networkrI  r4  r]  r   feerH  r  minimum_withdraw_amount)r]  r   )r+   r,   coderH  r4  r`  networksr]  r   rI  r  )v1PublicGetPublicTokenr  rU  rangelenr  rL  parse_precisionr&   
string_minrM  r
  )r  r  resultr   r  	tokenRowsirY  
currencyIdrc  rb  minPrecisionresultingNetworksjr_  	networkIdrH  s                    r  fetch_currencieszwoofipro.fetch_currenciesx  s    ..v6. ~~h3NN44	q#i.) 7	AaLE))%9J~~e_=H**:6DL&(1c(m, "1+ ,,WjA	 001A1A':1VW	(1=1E9GL^L^_hjvLwL#( $(#'%
 $(#'$	 ## $++G5EF!%!2!29!=#%0!),8 !"!..|<-   $# 
  $//7PQ#!	 )F4LE7	p r  c                     | j                  ||      }d }|(| j                  ||      }| j                  |      }||d}|S )NrA  currency)r  rL  )r  itemfeeTokenKeyfeeAmountKeyfeeCostr`  feeCurrencyIdfeeCurrencyCodes           r  parse_token_and_fee_tempz!woofipro.parse_token_and_fee_temp  sU    ""46 ,,T;?M"55mDO+C 
r  Ntradec                 T   d|v }| j                  |d      }| j                  |d      }| j                  ||      }|d   }| j                  |d      }| j                  |d      }| j                  |d      }	| j                  |dd      }
| j                  |
d	      }|||
d	<   t	        j
                  ||      }| j                  |d
      }| j                  |d      }d }|r| j                  |d      dk(  }|rdnd}| j                  ||| j                  |      ||||||	|d |
|d|      S )Nr+   executed_timestampr(  executed_priceexecuted_quantityorder_id	fee_assetr`  rA  sideis_makerr6  r   r   )r+   r#  datetimer(  r  r   r9  rA  r   takerOrMakerr3  r`  r  )	r$  r  safe_marketr{  r&   
string_mulsafe_string_lower
safe_tradeiso8601)r  r|  r&  isFromFetchOrderr#  rN  r(  r   r9  r  r`  rx  rA  r  r+   r  isMakers                    r  parse_tradezwoofipro.parse_trade  se   8 !EM%%e-AB	##E84!!(F3!  (89!!%)<=##E:6++E;F""3/!CK!!%0%%eV4eT* &&uj9S@G&-77L"Y/( 
  	r  r(  sincer   c                    | j                          | j                  |      }d|d   i}|||d<   | j                  | j                  ||            }| j	                  |di       }| j                  |dg       }	| j                  |	|||      S )a>  
        get the list of most recent trades for a particular symbol

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-market-trades

        :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+   r   r  rS  )load_marketsr&  v1PublicGetPublicMarketTradesextendr  rU  parse_trades)
r  r(  r  r   r  r&  requestr   r  rS  s
             r  fetch_tradeszwoofipro.fetch_trades   s     	V$fTl
 $GG55dkk'66RS  ~~h3~~dFB/  vue<<r  c                 v   | j                  |d      }| j                  |      }| j                  |d      }| j                  |d      }| j                  |d      }| j                  |d      }| j                  |d      }t        j                  ||      }	i d|d|d   dd dd d| j                  d	      d
d d|d| j                  |      d| j                  |d      d|d| j                  |      dd dd dd d| j                  |d      d|d| j                  |      d| j                  |	      iS )Nr(  next_funding_timeest_funding_rate_timestamplast_funding_rate_timestampr  	markPrice
indexPriceinterestRater  estimatedSettlePricer#  r  fundingRateest_funding_ratefundingTimestampfundingDatetimenextFundingRatenextFundingTimestampnextFundingDatetimepreviousFundingRatelast_funding_ratepreviousFundingTimestamppreviousFundingDatetimeinterval)	r  r&  r$  r&   
string_subr
  r  rM  parse_funding_interval)
r  r  r&  r(  r  estFundingRateTimestamplastFundingRateTimestampfundingTimeStringnextFundingTimeStringmillisecondsIntervals
             r  parse_funding_ratezwoofipro.parse_funding_rateG  s    !!+x8V$#00>QR"&"3"3KA]"^#'#4#4[B_#`  ,,[:WX $ 0 0>Q R&112GIZ[
K
fX&
 
 $	

 D--c2
 #D
 0
 %<=
 4++K9KL
  4
 t||,@A
 t
 #D
 "4
 "4#3#3KAT#U
  '(@!
" &t||4L'M#
$ 334HI%
 	
r  c                 8    dddddd}| j                  |||      S )Nr   r   8h16h24h)360000014400000288000005760000086400000r  )r  r  	intervalss      r  r  zwoofipro.parse_funding_intervalp  s/    
	 	8X>>r  c                 &    | j                  ||      S )a  
        fetch the current funding rate interval

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rate-for-one-market

        :param str symbol: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
        )fetch_funding_rate)r  r(  r  s      r  fetch_funding_intervalzwoofipro.fetch_funding_intervalz  s     &&vv66r  c                     | j                          | j                  |      }d|d   i}| j                  | j                  ||            }| j	                  |di       }| j                  ||      S )a  
        fetch the current funding rate

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rate-for-one-market

        :param str symbol: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
        r(  r+   r  )r  r&  "v1PublicGetPublicFundingRateSymbolr  r  r  r  r(  r  r&  r  r   r  s          r  r  zwoofipro.fetch_funding_rate  ss     	V$fTl
 ::4;;wPV;WX  ~~h3&&tV44r  symbolsc                     | j                          | j                  |      }| j                  |      }| j                  |di       }| j	                  |dg       }| j                  ||      S )a  
        fetch the current funding rate for multiple markets

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rates-for-all-markets

        :param str[] symbols: unified market symbols
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: an array of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-structure>`
        r  rS  )r  market_symbolsv1PublicGetPublicFundingRatesr  rU  parse_funding_rates)r  r  r  r   r  rS  s         r  fetch_funding_rateszwoofipro.fetch_funding_rates  si     	%%g.55f=$ ~~h3~~dFB/''g66r  c           
         | j                          d}| j                  |dd      \  }}|r| j                  d||||dd      S i }|| j                  |      }|d   }|d   |d<   |||d<   | j	                  d	||d
      \  }}| j                  | j                  ||            }| j                  |di       }	| j                  |	dg       }
g }t        dt        |
            D ]p  }|
|   }| j                  |d      }| j                  |d      }|j                  || j                  |      | j                  |d      || j!                  |      d       r | j#                  |d      }| j%                  ||||      S )a   
        fetches historical funding rate prices

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-funding-rate-history-for-one-market

        :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>`
        Fre   paginatepage   r(  r+   start_tend_tgMbP?r  rS  r   funding_rate_timestampfunding_rate)r  r(  r  r#  r  r#  )r  handle_option_and_params fetch_paginated_call_incrementalr&  handle_until_option#v1PublicGetPublicFundingRateHistoryr  r  rU  re  rf  r  r$  appendsafe_symbolrM  r  sort_byfilter_by_symbol_since_limit)r  r(  r  r   r  r  r  r&  r   r  ri  ratesrk  entryrN  r#  sorteds                    r  fetch_funding_rate_historyz#woofipro.fetch_funding_rate_history  s    	88AZ\fg&889RTZ\achjprxz|}}[[(FH%F &tGH!&GI227GVUS;;DKKQW<XY( ~~h3fb1q#f+& 
	A1IE''x8H))%1IJILL**84#//~F& LL3 	
	 e[100NNr  c           
         | j                          | j                  |      }| j                  |di       }| j                  |d      }| j                  |d      }i }t	        dt        | j                              D ]c  }| j                  |   }||| j                  t        j                  |d            | j                  t        j                  |d            ddd||<   e |S )ax  
        fetch the trading fees for multiple markets

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-account-information

        :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  futures_maker_fee_ratefutures_taker_fee_rater   10000T)r  r(  r   r   r   r   )
r  v1PrivateGetClientInfor  r  re  rf  r  r
  r&   
string_div)	r  r  r   r  r   r   ri  rk  r(  s	            r  fetch_trading_feeszwoofipro.fetch_trading_fees
  s     	..v68 ~~h3  '?@  '?@q#dll+, 		A\\!_F  **7+=+=eW+MN**7+=+=eW+MN"!F6N		 r  c           	      2   | j                          | j                  |      }d|d   i}|t        |d      }||d<   | j                  | j	                  ||            }| j                  |di       }| j                  |d      }| j                  |||ddd	d
      S )aV  
        fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/orderbook-snapshot

        :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+   r   	max_levelr  r#  bidsasksr   quantity)r  r&  r;  v1PrivateGetOrderbookSymbolr  r  r$  parse_order_book)	r  r(  r   r  r&  r  r   r  r#  s	            r  fetch_order_bookzwoofipro.fetch_order_book@  s     	V$fTl
 t$E#(GK 33DKK4PQ$ ~~h3%%dK8	$$T69ffgWabbr  c           	          | j                  |d      | j                  |d      | j                  |d      | j                  |d      | j                  |d      | j                  |d      gS )Nstart_timestampopenhighlowclosevolume)r$  rM  )r  ohlcvr&  s      r  parse_ohlcvzwoofipro.parse_ohlcvi  sm    e%67UF+UF+UE*UG,UH-
 	
r  r   c                 d   | j                          | j                  |      }|d   | j                  | j                  ||      d}|t	        |d      |d<   | j                  | j                  ||            }| j                  |di       }	| j                  |	dg       }
| j                  |
||||      S )a  

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-kline

        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(  r3  r   r   r  rS  )
r  r&  r  r   r;  v1PrivateGetKliner  r  rU  parse_ohlcvs)r  r(  	timeframer  r   r  r&  r  r   r  rS  s              r  fetch_ohlcvzwoofipro.fetch_ohlcvs  s     	V$Tl$$T__iK
 "5$/GG))$++gv*FG~~h3* ~~dFB/  vy%GGr  r   c                    | j                  |g d      }| j                  |g d      }| j                  | j                  |dd            }| j	                  |d      }| j                  ||      }|d   }| j                  |dd      }| j                  |dd	      }	| j                  |d
d      }
| j                  |dd      }| j                  |dd      }| j                  |d      }||rdnd}| j                  |d      }| j                  | j                  |dd            }| j                  | j                  |dd            }t        j                  |
|      }| j                  |dd      }| j                  |dd      }| j                  |d      }| j                  |d      }d }d }| j                  |d      }|}| j                  |d      }| j                  |dg       }t        |      }|dkD  rH| j                  |d      }| j                  |d       }| j                  |d      }| j                  |d      }| j                  |d!d"      }| j!                  i d#|d|d$|d%| j#                  |      d&d d'|d| j%                  |      d|d| j'                  |      d(| j)                  |      d)d d*| j                  |d+      d|d|d|d,|d-|||	|||
|||d.|d/|      S )0N)r#  rB  createdTime)r  orderIdalgoOrderIdclient_order_idclientOrderIdr(  order_pricer   order_quantityr  order_amountr9  
order_typer3  r  
algoStatussuccessNEWREJECTEDr  executedtotalExecutedQuantityaverage_executed_priceaverageExecutedPrice	total_feetotalFeer  feeAssetTransactionsr   childOrdersr   r   updatedTimeupdated_timer+   r#  r  lastTradeTimestamplastUpdateTimestampr   postOnly
reduceOnlyreduce_onlyr   r   rs  )averager9  filled	remainingrA  r   r`  r  )safe_integer_nsafe_string_n	omit_zerosafe_string_2r  r  safe_string_lower_2safe_value_2	safe_boolr  r&   r  
safe_valuerM  rf  safe_integer_2
safe_orderr  parse_order_statusparse_order_typeparse_time_in_force)r  r   r&  r#  r  r   rN  r(  r   r9  rA  	orderTyper  r  r  r  r  r  r`  feeCurrencytransactionsr   r   r   r  firstinnerChildOrdersinnerChildOrdersLengthtakeProfitOrderstopLossOrderr  s                                  r  parse_orderzwoofipro.parse_order  s   \ ''/[\	$$U,RSt'9'9%ARTc'de##E84!!(F3!""5-A##E+;ZH!!%B,,UL&I	""5(LA..	2&UZF%%eV4 1 1%E\ ]^..!3!3E;SUk!lm&&tV4	{J?((ZHun=''~>#!ooe];"OOK3E#umRH%()9%:"%)"&//2BA"F $0@! D"&"2"2?N"S $ 0 0 O"11%W  
' 
] 
  
 Y/	 

 !$ 
 "#6 
 d--f5 
 f 
 D)))4 
 433I> 
  
 $..> 
 D 
 U 
 L 
  ! 
" ]# 
$ ""' 9 
: ; 	r  r   c                 4    dddd}| j                  ||d       S )Nr   r   r   )iocfok	post_onlyr  )r  r   timeInForcess      r  r(  zwoofipro.parse_time_in_force  s)    

 k4@@r  r  c           
      H    |dddddddddd	}| j                  |||      S |S )Nr  closedcanceledrejected)	r  FILLEDCANCEL_SENTCANCEL_ALL_SENT	CANCELLEDPARTIAL_FILLEDr  
INCOMPLETE	COMPLETEDr  r  r  statusess      r  r&  zwoofipro.parse_order_status  sF    ")#-'"(&$%
H ##Hff==r  r3  c                 4    dddd}| j                  |||      S )Nr   r&  )LIMITMARKET	POST_ONLY)r  r  r3  typess      r  r'  zwoofipro.parse_order_type)  s)     

 %%eT488r  r  r9  r   c                    | j                  |dd      }|j                         }| j                  |      }	|j                         }
|	d   |
d}| j                  |dd      }| j	                  |d      }| j	                  |d      }| j                  |d	      }|d
uxs  |d
uxs |d
uxs | j	                  |d      d
u}|dk(  }| j                  |d      }| j                  |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||d<   || j                  ||      ||<   |r|s| j                  ||      ||<   n|dk7  r| j                  ||      ||<   | j                  |g d      }|||d<   || j                  ||      |d<   d|d<   n||d|d<   |	d   d dg d!}|d"   }|
d#k(  rd$nd#}|=| j                  |dd|      }|d| j                  ||      d%d&d'}|j                  |       |=| j                  |dd|      }|d| j                  ||      d%d&d'}|j                  |       |g|d"<   | j                  |g d(      }| j                  ||      S ))aL  
 @ignore
        helper function to build the request
        :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
        :param float [price]: the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: request to be sent to the exchange
        r  r  r+   )r(  r  r   	stopPricestopLoss
takeProfitalgoTypeNr  rF  r   r  r  r   r  r3  r  rG  r4  r   r3  r   POSITIONAL_TP_SLclOrdIDr   r  r  trigger_priceSTOP	algo_typeTP_SLF)r(  r  rT  child_ordersrV  BUYSELLrE  T)r  rT  rR  r3  r  )r  r  rQ  r   r  r  r   rK  r   rL  rM  )safe_bool_2upperr&  r  r#  r  r  is_post_onlyprice_to_precisionamount_to_precisionr  safe_number_2r  omitr  )r  r(  r3  r  r9  r   r  r  r)  r&  	orderSider  r   rL  rM  rN  isConditionalisMarketr   r  orderQtyKeypriceKeytypeKeyr   outterOrderr  	closeSider   r0  r   r/  s                                  r  create_order_requestzwoofipro.create_order_request1  s>    %%flMJ
JJL	V$JJL	Tl
 ))&.+N??6:6__V\:
##FJ7$D0  [HD4H  [J^bLb  [gkgvgvw}  @M  hN  VZ  hZ(,,V]C$$XtV<$1j7G+7)&|$(3%%(-%%(-%%/GM" $ 7 7 FGHM#'#;#;FF#KGK ++#'#;#;FF#KGK **63bc$)6G%&#'+'>'>v|'TGO$#)GK "
(>#*GK  ,$/ "	!K &n5K#,#5EI# $ 2 28^WV^ _%!(%)%<%<V]%S##'' ""=1%"&"4"4ZQXZd"e%!(%)%<%<V_%U##') ""?3'2mGN#6  $B  C{{7F++r  c                    | j                          | j                  |      }| j                  ||||||      }| j                  |dd      }	| j	                  |d      }
| j	                  |d      }|	duxs  |
duxs |duxs | j	                  |d      du}d}|r| j                  |      }n| j                  |      }| j                  |d      }| j                  |d      |d<   | j                  ||      }||d	<   |S )
a  
        create a trade order

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/create-order
        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/create-algo-order

        :param str symbol: unified symbol of the market to create an order in
        :param str type: 'market' or 'limit'
        :param str side: 'buy' or 'sell'
        :param float amount: how much of currency you want to trade in units of base currency
        :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param 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 'TP_SL' or 'POSITIONAL_TP_SL'
        :param float [params.cost]: *spot market buy only* the quote quantity that can be used alternative for the amount
        :param str [params.clientOrderId]: a unique id for the order
        :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        r   rK  rL  rM  Nr  r  r#  r3  )
r  r&  rh  r  r#  v1PrivatePostAlgoOrderv1PrivatePostOrderr  r$  r1  )r  r(  r3  r  r9  r   r  r&  r  r   rL  rM  ra  r   r  r   s                   r  create_orderzwoofipro.create_order  s2   . 	V$++FD$vV))&.+N??6:6__V\:
$D0  [HD4H  [J^bLb  [gkgvgvw}  @M  hN  VZ  hZ227;H ..w7H  ~~h/ --hD[  v.fr  r   c           	      6   | j                          g }t        dt        |            D ]  }||   }| j                  |d      }| j                  |d      }| j                  |d      }| j	                  |d      }	| j	                  |d      }
| j                  |di       }| j                  |dd	      }| j	                  |d
      }| j	                  |d      }|duxs  |duxs |duxs | j	                  |d      du}|rt        | j                  dz         | j                  ||||	|
|      }|j                  |        d|i}| j                  | j                  ||            }| j                  |di       }| j                  |dg       }| j                  |      S )a  
        *contract only* create a list of trade orders

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/batch-create-order

        :param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        r   r(  r3  r  r9  r   r  r   rK  rL  rM  Nr  z+ createOrders() only support non-stop orderr   r  rS  )r  re  rf  r  r#  r  r  r"   r+   rh  r  v1PrivatePostBatchOrderr  rU  parse_orders)r  r   r  ordersRequestsrk  rawOrderrN  r3  r  r9  r   orderParamsr   rL  rM  ra  orderRequestr  r   r  rS  s                        r  create_orderszwoofipro.create_orders  s    	q#f+& 	0AayH''(;H##Hf5D##Hf5D__Xx8FOOHg6E..8R@K--k>;WL{J?HlCJ(4  d8L  dPZbfPf  dkokzkz  |G  IV  lW  _c  lcM"477-Z#Z[[44XtT6SXZefL!!,/	0" n
 //GV0LM$ ~~h3~~dFB/  &&r  r+   c                    | j                          | j                  |      }d|i}	| j                  |g d      }
|
| j                  ||
      |	d<   |
duxs | j	                  |d      du}|rdnd}|rdnd	}|| j                  ||      |	|<   || j                  ||      |	|<   | j                  |g d
      }d}|r"| j                  | j                  |	|            }n|d   |	d<   |j                         |	d<   |j                         }| j                  |d      }|dk(  }| j                  |d|      }|rd|	d<   n|dk(  rd|	d<   n|dk(  rd|	d<   n||	d<   | j                  |g d      }| j                  |g d      }|||	d<   | j                  | j                  |	|            }| j                  |di       }| j                  |d      |d<   | j                  ||      S )a.  
        edit a trade order

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/edit-order
        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/edit-algo-order

        :param str id: order id
        :param str symbol: unified symbol of the market to create an order in
        :param str type: 'market' or 'limit'
        :param str side: 'buy' or 'sell'
        :param float amount: how much of currency you want to trade in units of base currency
        :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param float [params.triggerPrice]: The price a trigger order is triggered at
        :param float [params.stopLossPrice]: price to trigger stop-loss orders
        :param float [params.takeProfitPrice]: price to trigger take-profit orders
        :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        r  )r   rK  r   r   Nr   r  r  r  r   r  )rK  r   r   r   trailingTriggerPricetrailingAmounttrailingPercentr+   r(  r  r   rF  rG  r  r4  r   r3  r   rP  )rQ  r   r  r  r   r  r  r#  )r  r&  r  r\  r#  r]  r_  v1PrivatePutAlgoOrderr  rZ  r  r[  v1PrivatePutOrderr  r$  r1  )r  r+   r(  r3  r  r9  r   r  r&  r  r   ra  rc  rd  r   r)  r   rb  r  r   r  s                        r  
edit_orderzwoofipro.edit_order  s&   & 	V$
 ))&2st#&*&=&=fl&SGN#%T1jtv}7]ei7i$1j7G+7 $ 7 7 FGH#'#;#;FF#KGK 6  $b  c11$++gv2NOH &tGH"jjlGFO

I00GK H,H((4@H(3%%(-%%(-%(1% ..v7fgMYYv'qrF(-:)* --dkk'6.JKH ~~h3 --hD[f--r  c                    | j                  |ddd      }| j                  |ddg      }|s|t        | j                  dz         | j	                          d}|| j                  |      }d|d   i}| j                  |dd	      }| j                  |d
|      }|du}	d}
|rd|	r;||d
<   | j                  |g d      }| j                  | j                  ||            }
n||d<   | j                  | j                  ||            }
nc|	r;||d
<   | j                  |g d      }| j                  | j                  ||            }
n&||d<   | j                  | j                  ||            }
d|i}|	r||d
<   n||d<   |r!| j                  | j                  |
      |      S | j                  |
di       }| j                  | j                  |      |      S )aw  

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-order
        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-order-by-client_order_id
        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-algo-order
        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-algo-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.trigger]: whether the order is a stop/algo order
        :param str [params.clientOrderId]: a unique id for the order
        :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        stopr   FNz) cancelOrder() requires a symbol argumentr(  r+   rQ  r   r  rP  r  r  )rY  r_  r   r+   r  r&  r  r  v1PrivateDeleteAlgoClientOrderr  v1PrivateDeleteAlgoOrderv1PrivateDeleteClientOrderv1PrivateDeleteOrderr1  r  )r  r+   r(  r  r   r&  r  clientOrderIdUnifiedclientOrderIdExchangeSpecificisByClientOrderr   extendParamsr  s                r  cancel_orderzwoofipro.cancel_orderJ  s     ""669eD6FI#67FN#DGG.Y$YZZ[[(FfTl
  $11&)_U(,(8(8ARTh(i%7tC-J)*6+Z[>>t{{7TZ?[\&(
#88Wf9UV-J)*6+Z[::4;;wPV;WX&(
#44T[[&5QR  '/.KL*+!#L;;t//9<HH~~h3{{4++D1<@@r  idsc                 |   | j                          | j                  |g d      }| j                  |g d      }i }d}|r6dj                  |      |d<   | j	                  | j                  ||            }n5dj                  |      |d<   | j                  | j                  ||            }| j                  d|i      gS )a  
        cancel multiple orders

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/batch-cancel-orders
        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/batch-cancel-orders-by-client_order_id

        :param str[] ids: order ids
        :param str [symbol]: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str[] [params.client_order_ids]: max length 10 e.g. ["my_id_1","my_id_2"], encode the double quotes. No space after comma
        :returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
        )clOrdIDsclientOrderIdsclient_order_idsN,r  	order_idsr  )r  safe_list_nr_  joinv1PrivateDeleteClientBatchOrderr  v1PrivateDeleteBatchOrderr%  )r  r  r(  r  r  r  r   s          r  cancel_orderszwoofipro.cancel_orders  s     	))&2de6#UV*-((>*BG&';;DKKQW<XYH#&88C=GK 55dkk'66RSH H!
   	r  c                 B   | j                          | j                  |dd      }| j                  |ddg      }i }|| j                  |      }|d   |d<   d}|r"| j	                  | j                  ||            }n!| j                  | j                  ||            }d|igS )a@  

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-all-pending-algo-orders
        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-orders-in-bulk

        cancel all open orders in a market
        :param str symbol: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param boolean [params.trigger]: whether the order is a stop/algo order
        :returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
        r}  r   Nr+   r(  r  )r  rY  r_  r&  v1PrivateDeleteAlgoOrdersr  v1PrivateDeleteOrders)r  r(  r  r   r  r&  r   s          r  cancel_all_orderszwoofipro.cancel_all_orders  s     	""669=6FI#67[[(F &tGH55dkk'66RSH11$++gv2NOH$ 
 	
r  c                 X   | j                          d}|| j                  |      }| j                  |ddd      }i }| j                  |g d      }| j	                  |g d      }d}|rP|r'||d<   | j                  | j                  ||            }nv||d<   | j                  | j                  ||            }nO|r'||d<   | j                  | j                  ||            }n&||d<   | j                  | j                  ||            }| j                  |d	|      }	| j                  |	|      S )
a  

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-order-by-order_id
        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-order-by-client_order_id
        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-order-by-order_id
        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-order-by-client_order_id

        fetches information on an order made by the user
        :param str id: the order id
        :param str symbol: unified symbol of the market the order was made in
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param boolean [params.trigger]: whether the order is a stop/algo order
        :param str [params.clientOrderId]: a unique id for the order
        :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        Nr}  r   FrP  )r}  r   rQ  r   r  r  oidr  )r  r&  rY  r  r_  (v1PrivateGetAlgoClientOrderClientOrderIdr  v1PrivateGetAlgoOrderOid$v1PrivateGetClientOrderClientOrderIdv1PrivateGetOrderOidr  r1  )
r  r+   r(  r  r&  r   r  r   r   r   s
             r  fetch_orderzwoofipro.fetch_order  s5     	[[(F""669eD**63bc6#ef-:)*HHU\^dIef!#88Wf9UV-:)*DDT[[QXZ`Eab!#44T[[&5QR8 &(;//r  c           	         | j                          d}| j                  |ddd      }|rdnd}| j                  |dd      \  }}|r| j                  d||||d|      S i }d	}	| j	                  |ddg      }|| j                  |      }	|	d
   |d<   |||d<   |||d<   n||d<   |rd|d<   | j                  d||      \  }}d	}
|r"| j                  | j                  ||            }
n!| j                  | j                  ||            }
| j                  |
d|
      }| j                  |d      }| j                  ||	||      S )a@  
        fetches information on multiple orders made by the user

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-orders
        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-orders

        :param str symbol: unified market symbol of the market orders were made in
        :param int [since]: the earliest time in ms to fetch orders for
        :param int [limit]: the maximum number of order structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param boolean [params.trigger]: whether the order is a stop/algo order
        :param boolean [params.is_triggered]: whether the order has been triggered(False by default)
        :param str [params.side]: 'buy' or 'sell'
        :param boolean [params.paginate]: set to True if you want to fetch orders with pagination
        :param int params['until']: timestamp in ms of the latest order to fetch
        :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
        Fr}  r   r0   r   ru   r  r  Nr+   r(  r  sizerS  rT  r  r  rS  )r  rY  r  r  r_  r&  r  v1PrivateGetAlgoOrdersr  v1PrivateGetOrdersr#  rU  ro  )r  r(  r  r   r  r  	isTriggermaxLimitr  r&  r   r  r   s                r  fetch_orderszwoofipro.fetch_orders)  s{   $ 	$$VVYF	$3388PZ[&88PUW\^dflnvww6FI#67[[(F &tGH!&GI#GFO&GFO#)GK 227GVL224;;w3OPH..t{{7F/KLHF x:f-  >>r  c                 r    | j                          | j                  |ddi      }| j                  ||||      S )@  
        fetches information on multiple orders made by the user

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-orders
        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-orders

        :param str symbol: unified market symbol of the market orders were made in
        :param int [since]: the earliest time in ms to fetch orders for
        :param int [limit]: the maximum number of order structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param boolean [params.trigger]: whether the order is a stop/algo order
        :param boolean [params.is_triggered]: whether the order has been triggered(False by default)
        :param str [params.side]: 'buy' or 'sell'
        :param int params['until']: timestamp in ms of the latest order to fetch
        :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>`
        r  r@  r  r  r  r  r(  r  r   r  extendedParamss         r  fetch_open_orderszwoofipro.fetch_open_orders|  s<    $ 	Vh-EF  ~FFr  c                 r    | j                          | j                  |ddi      }| j                  ||||      S )r  r  rA  r  r  s         r  fetch_closed_orderszwoofipro.fetch_closed_orders  s<    $ 	Vh-DE  ~FFr  c                    | j                          d}|| j                  |      }d|i}| j                  | j                  ||            }| j	                  |di       }	| j                  |	dg       }
| j                  |
||||      S )aG  
        fetch all the trades made from a single order

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-all-trades-of-specific-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  rS  )r  r&  v1PrivateGetOrderOidTradesr  r  rU  r  )r  r+   r(  r  r   r  r&  r  r   r  r   s              r  fetch_order_tradeszwoofipro.fetch_order_trades  s     	[[(F2
 224;;w3OP, ~~h3fb1  vFFr  c           	         | j                          d}| j                  |dd      \  }}|r| j                  d||||dd      S i }d}|| j                  |      }|d   |d<   |||d	<   |||d
<   nd|d
<   | j	                  d||      \  }}| j                  | j                  ||            }| j                  |di       }	| j                  |	dg       }
| j                  |
||||      S )a  

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/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
        :param int params['until']: timestamp in ms of the latest trade to fetch
        :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
        Frn   r  r  r   Nr+   r(  r  r  r  r  rS  )
r  r  r  r&  r  v1PrivateGetTradesr  r  rU  r  )r  r(  r  r   r  r  r  r&  r   r  r   s              r  fetch_my_tradeszwoofipro.fetch_my_trades  s    	88R\]&88&RWY^`fhnpstt[[(F &tGH!&GI#GFO!GFO227GVL**4;;w+GH6 ~~h3fb1  vFFr  c                 P   d|i}| j                  |dg       }t        dt        |            D ]g  }||   }| j                  | j	                  |d            }| j                         }| j	                  |d      |d<   | j	                  |d      |d<   |||<   i | j                  |      S )Nr  holdingr   rY  totalfrozen)rU  re  rf  rL  r  accountsafe_balance)r  r   ri  balancesrk  balancerb  r  s           r  parse_balancezwoofipro.parse_balance  s    H
 >>(Ir:q#h-( 	#AqkG**4+;+;GW+MNDllnG#//CGG $ 0 0( CGH"F4L	#   ((r  c                     | j                          | j                  |      }| j                  |d      }| j                  |      S )a  
        query for balance and get the amount of funds available for trading or funds locked in orders

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-current-holding

        :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  v1PrivateGetClientHoldingr  r  r  r  r   r  s       r  fetch_balancezwoofipro.fetch_balance"  sC     	11&9  ~~h/!!$''r  rb  c                 d   | j                          i }d }|| j                  |      }|d   |d<   |||d<   |||d<   | j                  |d      }| j                  |d      }|||d<   | j	                  | j                  ||            }| j                  |di       }	|| j                  |	dg       gS )Nr+   balance_tokenr  pageSizer3  r  rS  )r  rt  r  r_  v1PrivateGetAssetHistoryr  r  rU  )
r  rb  r  r   r  r  rt  transactionTyper   r  s
             r  get_asset_history_rowszwoofipro.get_asset_history_rows?  s    !}}T*H'/~GO$!&GI"'GJ**66:66*&-GFO00Wf1MN4 ~~h3$..vr:;;r  ru  rt  c                 P   | j                  |d      }| j                  ||      }| j                  ||      }| j                  |d      }| j                  |d      }|dk(  rdnd}| j	                  |d      }| j                  |dd	      }	| j                  | j                  |d
      || j                  |d      d | j                  |d      | j                  | j                  |d            |d d |	||| j                  |      | j                  | j                  |d            |d|      S )NrY  r9  
token_sideDEPOSITinoutrB  	fee_token
fee_amountr+   r  tx_idr  r3  )r+   rt  r  referenceAccountreferenceIdr  r9  beforeafterr`  	directionr#  r  r3  r  )
r  rL  safe_currencyrM  r$  r{  safe_ledger_entryparse_transaction_statusr  parse_ledger_entry_type)
r  ru  rt  rl  rb  r9  r  r  r#  r`  s
             r  parse_ledger_entryzwoofipro.parse_ledger_entryk  s:   %%dG4
&&z8<%%j(;!!$1l3!Y.DU	%%dN;	++D+|L%%""4.''i8 $++D':33D4D4DT84TU""Y/001A1A$1OP'
  ! 	r  c                 2    ddd}| j                  |||      S )Ntransactionr   )BALANCE
COLLATERALr  rH  s      r  r  z woofipro.parse_ledger_entry_type  s&    $$
 tT22r  c                     | j                  ||||      }| j                  |d      }| j                  |d      }| j                  |||||      S )as  
        fetch the history of changes, actions done by the user or operations that altered the balance of the user

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history

        :param str [code]: unified currency code, default is None
        :param int [since]: timestamp in ms of the earliest ledger entry, default is None
        :param int [limit]: max number of ledger entries to return, default is None
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
        r   r   )r  r#  rU  parse_ledger)r  rb  r  r   r  currencyRowsrt  rS  s           r  fetch_ledgerzwoofipro.fetch_ledger  sS     224vN??<3~~lA.  xvFFr  r  c                 ^   | j                  |d      }| j                  |d      }|dk(  rd}| j                  |dd      }| j                  |d      }| j                  |d      }| j                  |d	      }i d
|d| j	                  |dd      d| j                  |d      d|d| j                  |      dd d|d|d| j                  |d      dd dd d|d| j                  |d      d|d| j                  | j                  |d            d| j                  |d      dd d |d dS ) NrY  r  r   
withdrawalr  r  target_addresssource_addressrB  r  r+   withdraw_idtxidr  r#  r  addressaddressFrom	addressTotagextratagFromtagTor3  r9  rt  r  r  r  comment)internalr`  r_  )r  r  r{  r$  r  r  rM  r  )	r  r  rt  rb  movementDirectionr`  r  r  r#  s	            r  parse_transactionzwoofipro.parse_transaction  s   W5 22;M
* ,++KlS$$[2BC	&&{4DE%%k>B	
K
$$$[$F
 D$$[':
 	

 Y/
 t
 ;
 
 4##K9
 t
 T
 %
 d&&{H=
 
 d33D4D4D[RZ4[\
  t((nE!
" t#
$ )
 	
r  c                 8    dddddd}| j                  |||      S )Npendingr  r9  )r  
CONFIRMING
PROCESSINGrA  CANCELEDr  rB  s      r  r  z!woofipro.parse_transaction_status  s/    ##"
 &&99r  c           	      R    ddi}| j                  |||| j                  ||            S )a)  
        fetch all deposits made to an account

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history

        :param str code: unified currency code
        :param int [since]: the earliest time in ms to fetch deposits for
        :param int [limit]: the maximum number of deposits structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
        r  r  fetch_deposits_withdrawalsr  r  rb  r  r   r  r  s         r  fetch_depositszwoofipro.fetch_deposits  s5     I
 ..tUE4;;wX^C_``r  c           	      R    ddi}| j                  |||| j                  ||            S )a4  
        fetch all withdrawals made from an account

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history

        :param str code: unified currency code
        :param int [since]: the earliest time in ms to fetch withdrawals for
        :param int [limit]: the maximum number of withdrawals structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
        r  WITHDRAWr  r  s         r  fetch_withdrawalszwoofipro.fetch_withdrawals  s5     J
 ..tUE4;;wX^C_``r  c           	          i }| j                  |||| j                  ||            }| j                  |d      }| j                  |d      }| j	                  |||||      S )a  
        fetch history of deposits and withdrawals

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history

        :param str [code]: unified currency code for the currency of the deposit/withdrawals, default is None
        :param int [since]: timestamp in ms of the earliest deposit/withdrawal, default is None
        :param int [limit]: max number of deposit/withdrawals to return, default is None
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a list of `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
        r   r   )r  r  r#  rU  parse_transactions)	r  rb  r  r   r  r  r  rt  rS  s	            r  r  z#woofipro.fetch_deposits_withdrawals  sg     224t{{SZ\bGcd??<3~~lA. &&tXueVLLr  c                 n    | j                  |      }| j                  |di       }| j                  |d      S )Nr  r   )v1PrivateGetWithdrawNoncer  rM  r  s       r  get_withdraw_noncezwoofipro.get_withdraw_nonce	  s:    11&9 ~~h3&677r  c                 .    d| j                  |dd      z   S )N0xkeccakhex)hash)r  messages     r  hash_messagezwoofipro.hash_message	  s    dii5999r  c                     | j                  |dd  |dd  dd       }|d   }|d   }| j                  | j                  d|d               }d|j                  dd	      z   |j                  dd	      z   |z   S )
N	secp256k1rs   vr  @   r  )ecdsaint_to_base16sumrjust)r  r  r   	signaturer  r  r  s          r  	sign_hashzwoofipro.sign_hash	  s    JJtCDz:cd+;[$O	cNcNtxxIcN;<aggb#&&S)99A==r  c                 J    | j                  | j                  |      |dd        S )Nr  )r  r	  )r  r  r   s      r  sign_messagezwoofipro.sign_message 	  s%    ~~d//8*ST:JKKr  r  c           
         | j                          | j                  |       |-|j                         }|dk7  rt        | j                  dz         | j                  |      }| j                  | j                  d      }| j                  |d      }| j                  |di       }	| j                  |	|i       }
| j                  |
d      }|t        | j                  dz         | j                  |      }| 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dgi}| j                  | j                  dd      | j                  |      ||t        |      ||d}| j                  |||      }| j!                  || j"                        }||||d}| j%                  |d      }| j'                  | j)                  ||            }| j                  |di       }| j+                  ||      S )a  
        make a withdrawal

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/create-withdraw-request

        :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>`
        USDCz withdraw() only support USDCr   chainIdrc  r+   z% withdraw() require chainId parameterOrderlyr6  )r  r,   verifyingContractr1   Withdrawr   string)r,   r3  uint256receiverr  rY  r9  withdrawNonceuint64r#  keyBrokerId	woofi_pro)r   r  r"  rY  r9  r#  r#  )r  userAddressr  r  r  )r  check_addressrZ  r"   r+   rt  r  r   r  rM  r   r  nonceparse_to_intstreth_encode_structured_datar  r   r_  v1PrivatePostWithdrawRequestr  r  )r  rb  r9  r  r  r  rt  r   r  currencyNetworkscoinNetworkcoinNetworkIdr#  r)  domainmessageTypeswithdrawRequestmsgr  r  r   r  s                         r  r   zwoofipro.withdraw#	  s     	7#::<Dv~"477-L#LMM==&#'#3#3DLLB\#] ""695>>(JCnn%5wC((d; TWW'NNOO//7

!9	
 #X6"I6#Y7 (3!95((;$h7

 ((}kR((1&k*!
 --flOT%%c4??;	""!9&	
 69-44T[[&5QR ~~h3%%dH55r  c                 <    | j                  |d      }||d   d ||dS )Nmax_leverager(  )r  r(  r   longLeverageshortLeverage)r$  )r  r   r&  leverageValues       r  parse_leveragezwoofipro.parse_leveragep	  s2    ))(NCX&)*
 	
r  c                     | j                          | j                  |      }| j                  |      }| j                  |di       }| j	                  ||      S )a  
        fetch the set leverage for a market

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-account-information

        :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  r&  r  r  r:  )r  r(  r  r&  r   r  s         r  fetch_leveragezwoofipro.fetch_leveragez	  sU     	V$..v68 ~~h3""400r  r   c                     | j                          |dk  s|dkD  rt        | j                  dz         d|i}| j                  | j	                  ||            S )a  
        set the level of leverage for a market

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/update-leverage-setting

        :param int [leverage]: the rate of leverage
        :param str [symbol]: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: response from the exchange
        r   2   z$ leverage should be between 1 and 50r   )r  r   r+   v1PrivatePostClientLeverager  )r  r   r(  r  r  s        r  set_leveragezwoofipro.set_leverage	  s\     	qLhmTWW'MMNN
 //GV0LMMr  positionc                 h   | j                  |d      }| j                  ||      }| j                  |d      }d }t        j                  |d      rd}nd}| j                  |d      }| j                  |d      }| j	                  |d      }| j                  |d	      }	| j                  |d
      }
t        j
                  |      }t        j                  ||      }| j                  i d|dd d| j                  |d      d|d| j                  |      dd dd dd dd dd d| j                  |	      d| j                  |      dd d| j                  |
      d| j                  |      d| j                  |      dd | j                  |d      | j                  |      d d dd |d d d d d      S )Nr(  position_qtyr  longshortrC  
mark_pricer#  average_open_priceunsettled_pnlr  r+   r  r  initialMargininitialMarginPercentagemaintenanceMarginmaintenanceMarginPercentage
entryPricenotionalr   unrealizedPnl	contractsmarginRatioest_liq_pricecross)liquidationPricer  	lastPrice
collateralr   
marginTyper  r   r   r   r   )r  r  r&   	string_gtr$  
string_absr  safe_positionr  r
  rM  )r  rA  r&  r5  r  r  rC  r  r#  rM  unrealisedPnlrN  s               r  parse_positionzwoofipro.parse_position	  sC   . ##Hh7!!(F3.9T3'DD''?$$X|<	%%h<	%%h0DE
((?C!!$'%%dI6!! #
H#
$#
 d&&vx8#
 	#

 Y/#
 "4#
 T#
 &t#
  #
 *4#
 $++J7#
 ))(3#
 #
 T..}=#
 **40#
  D--l;!#
" 4##
$ !% 0 0? K**95!!#9#
  	r  c                     | j                          | j                  |      }d|d   i}| j                  | j                  ||            }| j	                  |d      }| j                  ||      S )a  

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-one-position-info

        fetch data on an open position
        :param str symbol: unified market symbol of the market the position is held in
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `position structure <https://docs.ccxt.com/#/?id=position-structure>`
        r(  r+   r  )r  r&  v1PrivateGetPositionSymbolr  r  r\  r  s          r  fetch_positionzwoofipro.fetch_position	  sp     	V$fTl
 224;;w3OP6 ~~h/""400r  c                     | j                          | j                  |      }| j                  |di       }| j                  |dg       }| j	                  ||      S )a  
        fetch all open positions

        https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-all-positions-info

        :param str[] [symbols]: list of unified market symbols
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
        r  rS  )r  v1PrivateGetPositionsr  rU  parse_positions)r  r  r  r   ri  r   s         r  fetch_positionszwoofipro.fetch_positions*
  sZ     	--f5N &"5NN6626	##Iw77r  c                 "    | j                         S N)milliseconds)r  s    r  r)  zwoofipro.nonce`
  s      ""r  r   GETc                 f   |d   }|d   }| j                  ||      }	| j                  | j                  d   |         }
|
d|z   dz   z  }
| j                  || j	                  |            }| j                  |      }|dk(  r!|
|	z  }
|r$|
d| j                  |      z   z  }
n| j                          |dk(  s|dk(  r|d	k(  s
|d
k(  s|dk(  r| j                  | j                  dd      }|s`| j                  | j                  dd      }|dk(  r9| j                  |dg       }t        dt        |            D ]  }||d   |   d<    n||d<   | j                  |      }d}t        | j                               }|
|	z  }
| j                   }|j#                  d      dk  rd|z   }| j$                  ||d}||z   dz   |z   dz   |	z   }|dk(  s|dk(  r| j'                  |      }||z  }d|d<   n<|r.|
d| j                  |      z   z  }
|d| j)                  |      z   z  }d|d<   |dk(  rd}| j*                  }|j#                  d      dk\  r|j-                  d      }|d   }| j/                  | j1                  |      | j3                  |      d      }| j5                  | j7                  |            |d<   |
|||dS )Nr   r   r   r+  r   ?POSTPUTr   r   r   r   Fr   r   r   	order_tag zed25519:)zorderly-account-idzorderly-keyzorderly-timestampzapplication/jsonzcontent-typez!application/x-www-form-urlencodedDELETEed25519zorderly-signature)r   methodbodyheaders)implode_paramsimplode_hostnamer   r_  extract_paramskeysort	urlencodecheck_required_credentialsr"  r   r  rU  re  rf  r+  r)  r   findr   json	rawencoder   rK  eddsaencodebase58_to_binaryurlencode_base64base64_to_binary)r  pathsectionrp  r  rr  rq  r1   accesspathWithParamsr   isSandboxModer   
ordersListrk  authtsr   r   rO  r  s                        r  signzwoofipro.signc
  s   !*,,T6:##DIIe$4V$<=sW}s""64#6#6t#<=f%X>!CsT^^F333++-& FeO$,:NRVZaRaeimzez $t||]E R$#//j&QH},%)^^FHb%I
!&q#j/!: HA?GF8,Q/<H /7{+f-DTZZ\"B>!C[[F{{:&*#f,&*nn%%'G
 ;$w.4~ED6U?yy(*<'3!777CC$.."888D*M'X%D[[F{{:&!+Z0q

4;;t#4d6K6KF6SU^_I+/+@+@AVAVW`Aa+bG'(fdwOOr  httpCodereasonr   rp  rr  rq  c
                 .   |sy | j                  |d      }
| j                  |d      }|
sl| j                  dz   | j                  |      z   }| j	                  | j
                  d   ||       | j                  | j
                  d   ||       t        |      y )Nr  rb   r  r  )r"  r  r+   rz  throw_broadly_matched_exceptionr  throw_exactly_matched_exceptionr   )r  r  r  r   rp  rr  rq  r   requestHeadersrequestBodyr  	errorCodefeedbacks                r  handle_errorszwoofipro.handle_errors
  s    
 ..95$$Xv6	ww}tyy'::H001I4QYZ001I9V^_))r  re  )___name__
__module____qualname__r   r	  boolr  r!  r	   r%  dictr   rQ  r   rW  r   rq  r{  r   r  r+  r  r   r  r  r  r  r   r   r  r   r  r   r  r   r  listr  r  r   r1  r(  r&  r'  r   r   floatr   rh  rl  r   rt  r{  r  r  r  r  r  r  r  r  r  r   r  r  r  r   r
   r  r  r  r   r  r  r  r  r  r  r	  r  r  r   r   r:  r<  r@  r\  r_  r   rc  r)  r  intr  __classcell__)r  s   @r  r(   r(      s(   V# Vp-t - #% "
H !# 8s 8,V
4 V
F V
p $& /($v, /(b ') [Z [z
= =v = =~ 6:UW %=3 %=s %=# %=\`af\g %=N'
f '
 '
R? :< 
7S 
7 
7 68  5  5K  5D 6:"  77  7  7D 8<$]ajl >O >OC >OWZ >O@ )+ 4{ 4l :>b 'cs 'c3 'cY 'cR
 
4 
 26DW[df ,H# ,Hc ,HQT ,Hkoptku ,H\n nv n n`As A  9S 9 os{} U,3 U,i U,y U,Z_ U,hk U,n gksu B3 Bi By BRW B`c BH @B 3'D$6 3'j `drv  @B G.S G.# G.Y G.i G.Y\ G.lo G.R 37r FAs FAC FAP ;?r #c #C #J /32 +
 +
Z 26b C0c C03 C0J *.Dt\^ Q?3 Q?c Q? Q?cghmcn Q?f /3TXac G G3 Gc Ghlmrhs G, 154VZce G# GS GPS Gjnotju G, 9=4^bkm ,GS ,G# ,GS ,GX[ ,G\ -1tRV_a <Gc <G <GC <G|) ) $& (( (: 26DW[df *<3 *<c *<QT *<kn *<Xt x ; 63 (,$TZ\ G GC Gs Gaefqar G"
T 
X 
Q\ 
B:s : *.Dt\^ a3 ac a acghsct a" -1tRV_a ac a aC afjkvfw a" 6:[_hj Ms M# MUX Most  pA M: )+ 8:>L DHPR K6S K6% K6# K6Wb K6Z
x 
 24 )1S )1 )1V 9=R NS N# N&Ct CV CJ 24 +1S +1Z 26b 48w 48T(^ 48l# "*%DW[ 6Ppc 3 S # X\ dg r  r(   N),ccxt.base.exchanger   ccxt.abstract.woofipror   ccxt.base.typesr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   typingr   ccxt.base.errorsr   r   r   r   r    r!   r"   r#   r$   ccxt.base.decimal_to_precisionr%   ccxt.base.preciser&   r(    r  r  <module>r     se    ( . s  s  s  s  s  s  * 0 . ' . ) ) ) . 4 %R*x R*r  