
    E#i                       S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
SSKJrJr  SSKJrJrJrJr  SSKJr  SSKJrJrJrJrJrJrJrJrJrJrJ r J!r!  SSKJ"r"J#r#J$r$J%r%J&r&J'r'  SSK(J)r*J+r+  SS	K,J-r-J.r.J/r/  SS
K0J1r1  SSK2J3r3  SSK4J5r5J6r6J7r7   SSK8J9r:  SS/r< SSK=J>r>  SSK?J@r@   " S S\*5      r)g! \; a    Sr: N'f = f! \; a    Sr>Sr@ N&f = f)z4.5.20    N)AnyList)IntStrNumStrings)	Throttler)	BaseError	BadSymbol
BadRequestBadResponseExchangeErrorExchangeNotAvailableRequestTimeoutNotSupportedNullResponseInvalidAddressRateLimitExceededOperationFailed)ConstructorArgs	OrderType	OrderSideOrderRequestCancellationRequestOrder)ExchangeArgumentsRequired)inflate	inflate64gunzip)Client)Future)	OrderBookIndexedOrderBookCountedOrderBook)ProxyConnectorBaseExchanger   )PushDataV3ApiWrapper_pb2)MessageToDictc                     ^  \ rS rSrSrSSS.rSrSr0 rSr	0 4S	\
4U 4S
 jjjrS rGSYS jrGSYS jrS rS r\R$                  S:  a  S rS rS rS rS rS rGSZS jrS rS0 4S jrS0 4S jrGS[S jr0 4S jr0 4S jrSSS0 4S  jr S0 4S! jr!S" r"S# r#S$ r$\%S% 5       r&\%S& 5       r'\%S' 5       r(0 S4S( jr)0 S4S) jr*0 S4S* jr+S+ r,S, r-S- r.GS\S. jr/GS\S/ jr0GSYS0 jr1S1 r2S2 r3S3 r4S0 4S4 jr5S5 r6S6 r7S7 r80 4S8 jr9SS0 4S9\:S:\;S;\;4S< jjr<SS0 4S9\:S:\;S;\;4S= jjr=SS0 4S9\:S:\;S;\;4S> jjr>SS0 4S?\?\:   S:\;S;\;4S@ jjr@SS0 4S9\:S:\;S;\;4SA jjrASS0 4S?\?\:   S:\;S;\;4SB jjrBSS0 4S9\:S:\;S;\;4SC jjrCS0 4S9\D4SD jjrE0 4S9\:4SE jjrFSS0 4S?\?\:   S:\;S;\;4SF jjrG0 4S?\?\:   4SG jjrHSS0 4S?\?\:   S:\;S;\;4SH jjrISS0 4S?\?\:   S:\;S;\;4SI jjrJSS0 4SJ\?\?\:      S:\;S;\;4SK jjrK0 4SJ\?\?\:      4SL jjrLS0 4S?\?\:   S;\;4SM jjrM0 4S?\?\:   4SN jjrNS0 4S?\O4SO jjrP0 4S9\:4SP jjrQ0 4S9\:4SQ jjrRS0 4S?\O4SR jjrSS0 4SS\O4ST jjrTS0 4S9\:S;\;4SU jjrUS0 4S9\:S;\;4SV jjrV0 4S9\:4SW jjrWS0 4S?\O4SX jjrXS0 4SY jrYS0 4S9\:S;\;4SZ jjrZ0 4S9\:4S[ jjr[0 4S\ jr\S0 4S?\O4S] jjr]0 4S^ jr^0 4S_ jr_S0 4S?\O4S` jjr`S0 4S?\O4Sa jjraS0 4S?\O4Sb jjrb0 4S9\:4Sc jjrc0 4S?\?\:   4Sd jjrd0 4S?\?\:   4Se jjre0 4Sf\:Sg\fSh\:Si\:4Sj jjrgS0 4Sf\:Sg\fSk\:Sl\D4Sm jjrh0 4Sf\:4Sn jjriS0 4So\jS9\D4Sp jjrk0 4S9\:4Sq jjrlS0 4S?\O4Sr jjrmS0 4Ss\nS9\D4St jjro0 4S9\:Sg\f4Su jjrp0 4S9\:Sg\f4Sv jjrq0 4S9\:Sg\f4Sw jjrrS0 4S9\:Sx\D4Sy jjrsSSSS0 4S9\DSx\DS:\;S;\;4Sz jjrtSSSS0 4S9\DS{\DS:\uS;\u4S| jjrvS0 4S}\:S9\D4S~ jjrw0 4Sf\:4S jjrxSSS0 4S9\:Sx\:S:\;S;\;4S jjry0 4S9\:4S jjrzS0 4S?\O4S jjr{0 4S jr|0 4S jr}0 4Sf\:Sg\f4S jjr~0 4Sf\:Sg\f4S jjr0 4S9\:Sf\:Sg\f4S jjr0 4Sf\:Sg\f4S jjr0 4S9\:Sf\:Sg\f4S jjrS0 4Sf\:Sg\fS9\D4S jjrS0 4Sf\:Sg\fS9\D4S jjrSSS0 4S9\:Sx\:S:\;S;\;4S jjrSSS0 4S9\:Sx\:S:\;S;\;4S jjrSSS0 4S9\:Sx\:S:\;S;\;4S jjrGS]S jrS0 4S9\:S;\;4S jjrSS0 4S?\O4S jjrSS0 SS0 4S\S\S\4S jjrSS0 SS0 4S\S\S\4S jjrS0 4S jrS0 4S\:S9\:Sg\fS\u4S jjrS0 4S\:S9\:Sg\fS\u4S jjrS0 4S\:S9\:S\Sg\fS\u4
S jjrSS0 4S\:S9\:S{\S\Sg\uS\u4S jjrSS0 4S\:S9\:S{\S\Sg\uS\u4S jjrSS0 4S\:S9\:S{\S\Sg\uS\u4S jjr0 4S9\:4S jjr0 4S9\:4S jjrS0 4S9\D4S jjrSSS0 4S?\OS:\;S;\;4S jjrSSS0 4S?\OS:\;S;\;4S jjr0 4S9\:4S jjr0 4S9\:4S jjrS0 4S?\O4S jjrS0 4S?\O4S jjrS0 4S?\O4S jjrS0 4S?\O4S jjrSSSS0 4Sf\DS9\DS:\;S;\;4S jjrSSS0 4Sf\DS:\;S;\;4S jjrS0 4S\:Sf\D4S jjr0 4S jr0 4S jr0 4S jr0 4S jr0 4S jr0 4S jr0 4S jr0 4S jr0 4Sf\:4S jjrS0 4SS\O4S jjrS0 4SS\O4S jjr0 4Sf\:4S jjr0 4Sf\:4S jjr0 4S9\:4S jjr0 4S9\:4S jjr0 4S9\:4S jjr0 4S9\:4S jjr0 4S9\:4S jjrS0 4S?\O4S jjrS0 4S?\O4S jjrS0 4S?\O4S jjrSS0 4S?\OS;\;4S jjrS0 4S?\O4S jjrS0 4S?\O4S jjrS0 4S?\O4S jjrS0 4S\:S9\D4S jjrS0 4S\:S9\D4S jjrS0 4S\:S9\D4S jjrS0 4S\:S9\D4S jjr0 4S jrS0 4S9\:S{\S\Sg\fS\u4
S jjrS0 4S\:S\:S\:Sg\u4S jjrS0 4S\:Sf\D4S jjrSSS0 4Sf\DS:\;S;\;4S jjrS0 4S9\D4S jjrSSS0 4S9\:S{\S\Sg\fS\uS\uS\u4S jjrSSS0 4S9\:S{\S\Sg\fS\uS\uS\u4S jjrSSS0 4S9\:S{\S\Sg\fS\uS\uS\u4S jjrSSS0 4S9\:S{\S\Sg\fS\uS\uS\u4S jjr0 4S9\:S\S\f4S jjr0 4S9\:S\f4S jjr0 4S9\:S\f4S jjr0 4S9\:S\S\f4S jjrSS0 4S9\:S{\S\Sg\fS\uS\u4S jjrSS0 4S9\:S{\S\Sg\fS\uS\u4S jjrSS0 4S9\:S{\S\Sg\fS\uS\u4S jjrSS0 4S9\:S{\S\Sg\fS\uS\u4S jjrSS0 4S9\:S{\S\Sg\fS\uS\u4S jjrSS0 4S9\:S{\S\Sg\fS\uS\u4S jjrSSS0 4S9\:S{\S\Sg\fS\uS\uS\u4S jjrSSS0 4S9\:S{\S\Sg\fS\uS\uS\u4S jjr0 4S\?\   4S jjr0 4S\?\   4S jjrS0 4S9\:S{\S\Sg\fS\u4
S jjrS0 4S\:S9\D4S jjrS0 4S\:S9\D4S jjrS0 4S\:S9\D4S jjrS0 4S\?\:   S9\D4S jjrS0 4S\?\:   S9\D4S jjrS0 4S\?\:   S9\D4S jjrS0 4S9\D4S jjr0 4S\;4S jjr0 4S\?\   4S jjrS0 4S9\D4GS  jjr0 4GS\4GS jjrSSS0 4S9\DS:\;S;\;4GS jjrSSS0 4S9\DS:\;S;\;4GS jjrSSS0 4S\:S9\DS:\;S;\;4GS jjrSSS0 4S9\DS:\;S;\;4GS jjrSSS0 4S9\DS:\;S;\;4GS jjrSSS0 4S9\DS:\;S;\;4GS jjrSSS0 4S9\DS:\;S;\;4GS	 jjrSSS0 4S9\DS:\;S;\;4GS
 jjrSSS0 4S9\DS:\;S;\;4GS jjrSSS0 4S9\DS:\;S;\;4GS jjrSSS0 4S9\DS:\;S;\;4GS jjrSS0 4S9\:S:\;S;\;4GS jjrSSS0 4S9\DS:\;S;\;4GS jjrSSS0 4S9\DS:\;S;\;4GS jjr0 4S9\:4GS jjrS0 4S?\O4GS jjr0 4Sf\:4GS jjr0 4S9\:4GS jjrS0 4S\:S\:Sg\u4GS jjrSSS0 4Sf\DS:\;S;\;4GS jjrSSS0 4Sf\DS:\;S;\;4GS jjrSSS0 4Sf\DS:\;S;\;4GS jjrSSS0 4Sf\DS:\;S;\;4GS jjrSSS0 4Sf\DS:\;S;\;4GS jjGr SSS0 4S9\DS:\;S;\;4GS jjGrSSS0 4S9\DS:\;S;\;4GS jjGrS0 4S9\:S\4GS jjGr0 4GS jGrS0 4S9\:S;\;4GS jjGr0 4Sf\:4GS  jjGr0 4S9\:S\Sg\fS\f4GS! jjGr0 4S9\:S\Sg\fS\f4GS" jjGrS0 4S9\:S\Sg\fS\u4GS# jjGr	S0 4S9\:S\Sg\fS\u4GS$ jjGr
0 4S9\:Sg\fS\f4GS% jjGr0 4S9\:Sg\fS\f4GS& jjGr0 4S9\:Sg\fS\f4GS' jjGr0 4S9\:Sg\fS\f4GS( jjGr0 4S9\:Sg\f4GS) jjGr0 4S9\:Sg\f4GS* jjGr0 4S9\:Sg\f4GS+ jjGr0 4S9\:Sg\f4GS, jjGr0 4GS- jGr0 4S9\:4GS. jjGrS0 4S9\:S{\S\Sg\fS\u4
GS/ jjGrS0 4S9\:S{\S\Sg\fS\u4
GS0 jjGrS0 4S9\:S{\S\Sg\fS\u4
GS1 jjGrS0 4S9\:S{\S\Sg\fS\u4
GS2 jjGrSS0 4S9\:S{\S\Sg\fS\uS\u4GS3 jjGrSS0 4S9\:S{\S\Sg\fS\uS\u4GS4 jjGr0 4S9\:S\Sg\fS\fS\f4
GS5 jjGr0 4S9\:S\Sg\fS\fS\f4
GS6 jjGr0 4S9\:S\Sg\fS\f4GS7 jjGr0 4S9\:S\Sg\fS\f4GS8 jjGrS0 4S?\O4GS9 jjGr0 4GS: jGr 0 4GS; jGr!0 4S9\:4GS< jjGr"0 4GS= jGr#0 4S9\:4GS> jjGr$0 4S9\:4GS? jjGr%SSS0 4S9\:Sx\:S:\;S;\;4GS@ jjGr&SSS0 4S9\:Sx\:S:\;S;\;4GSA jjGr'SSS0 4S9\:Sx\:S:\;S;\;4GSB jjGr(SSS0 4Sf\DS:\;S;\;4GSC jjGr)SSS0 SS4GSD\:S9\DS:\;S;\;GSE\;4
GSF jjGr*SSSS0 4GSD\:S9\DS:\;S;\;Sx\D4
GSG jjGr+SSSS0 S4GSD\:S9\DS:\;S;\;Sx\D4
GSH jjGr,SSS0 SSSS4GSD\:S9\D4GSI jjGr-SSS0 SS4GSD\:S9\D4GSJ jjGr.SS0 4S9\:S:\;S;\;4GSK jjGr/SSS0 4S?\OS:\;S;\;4GSL jjGr0S0 4S\:Sf\D4GSM jjGr1SSS0 4Sf\DS:\;S;\;4GSN jjGr2S0 4S9\:Sx\:4GSO jjGr30 4S9\:4GSP jjGr4S0 4S?\O4GSQ jjGr5S0 4Sf\:Sg\fSk\:Sl\D4GSR jjGr6S0 4S9\D4GSS jjGr70 4S\?\   4GST jjGr8SSS0 4GSU\:S9\DS:\;S;\;4GSV jjGr9S0 4S?\O4GSW jjGr:GSXGr;U =Gr<$ (^  r   D   F   i0u  )maxPingPongMisses	keepAliveNT   configc                 b  > SU;   a
  US   U l         UR                  SU R                  5      U l        UR                  SU R                  5      U l        SU;  U l        UR                  S[
        R                  " 5       5      U l        S U l        [        [        U ]/  U5        S U l        SU l        g )Nasyncio_loopaiohttp_trust_envverifysessioncafileF)r2   getr3   r4   own_sessioncertifiwherer6   	throttlersuperr   __init__markets_loadingreloading_markets)selfr0   	__class__s     Z/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/async_support/base/exchange.pyr=   Exchange.__init__O   s    V# &~ 6D!',?AWAW!Xjj4;;7$F2jj7==?;h&v.#!&    c                     U R                   $ N)r2   r@   s    rB   get_event_loopExchange.get_event_loop[   s       rD   c                 N    [        U R                  U R                  5      U l        g rF   )r	   tokenBucketr2   r;   r@   costs     rB   init_throttlerExchange.init_throttler^   s    "4#3#3T5F5FGrD   c                 @   #    U R                  U5      I S h  vN $  N7frF   )r;   rL   s     rB   throttleExchange.throttlea   s     ^^D))))   c                     U R                   $ rF   )r5   rG   s    rB   get_sessionExchange.get_sessiond   s    ||rD   c                     U R                   c  U R                  b)  U R                  R                  U R                  S-   5        g g )Na>   requires to release all resources with an explicit call to the .close() coroutine. If you are using the exchange instance with async coroutines, add `await exchange.close()` to your code into a place when you're done with the exchange and don't need the exchange instance anymore (at the end of your async coroutine).)r5   socks_proxy_sessionsloggerwarningidrG   s    rB   __del__Exchange.__del__g   sB    <<#t'@'@'LKK  +k  !k  l (MrD   )      c                 .   #    U R                  5         U $ 7frF   )openrG   s    rB   
__aenter__Exchange.__aenter__l   s     IIKKs   c                 @   #    U R                  5       I S h  vN   g  N7frF   )close)r@   exc_typeexctbs       rB   	__aexit__Exchange.__aexit__p   s     **,s   c                    U R                   cd  [        R                  S:  a  [        R                  " 5       U l         O[        R
                  " 5       U l         U R                   U R                  l        U R                  c  U R                  (       a  [        R                  " U R                  S9OU R                  U l        U R                  (       a  U R                  U R                  SS5      (       ac  [        R                  " 5       nUR                  (       a=  UR                  U R                  :w  a#  U R                  R!                  UR                  S9  U R"                  (       aw  U R$                  ci  [&        R(                  " U R                  U R                   SS9U l        [&        R,                  " U R                   U R*                  U R.                  S9U l        g g g )N)r^      )r6   include_OS_certificatesFT)sslloopenable_cleanup_closedro   	connector	trust_env)r2   sysversion_infoasyncioget_running_looprH   r;   ro   ssl_contextr4   rn   create_default_contextr6   	safe_booloptionsget_default_verify_pathsload_verify_locationsr8   r5   aiohttpTCPConnectortcp_connectorClientSessionr3   )r@   os_default_pathss     rB   ra   Exchange.opens   sa   $6)$+$<$<$>!$+$:$:$<!"&"3"3DNN#QUQ\Q\s99MbfbmbmD  T^^DLLB[]b%c%c#&#?#?#A #**/?/F/F$++/U$$::BRBYBY:Z 4!(!5!5$:J:JQUQbQbz~!D"00d6G6GSWSeSequ  rH  rH  IDL !5rD   c                   #    U R                  5       I S h  vN   U R                  b:  U R                  (       a"  U R                  R                  5       I S h  vN   S U l        U R	                  5       I S h  vN   U R                  5       I S h  vN   U R                  U R                  5      I S h  vN   g  N Na ND N. N7frF   )ws_closer5   r8   re   close_connectorclose_proxy_sessionssleeptimeout_on_exitrG   s    rB   re   Exchange.close   s     mmo<<#ll((***DL""$$$'')))jj--... 	 +$).sW   C B6?C B8C 5B:6C B<"C 0B>1C 8C :C <C >C c                    #    U R                   b)  U R                   R                  5       I S h  vN   S U l         U R                  b*  U R                  R                  5       I S h  vN   S U l        g g  NC N7frF   )r   re   aiohttp_socks_connectorrG   s    rB   r   Exchange.close_connector   sl     )$$**,,,!%D''3..44666+/D( 4 - 7s!   +A5A15A5#A3$A53A5c                    #    U R                   b@  U R                    H(  nU R                   U   R                  5       I S h  vN   M*     S U l         g g  N7frF   )rX   re   )r@   urls     rB   r   Exchange.close_proxy_sessions   sN     $$000//4::<<< 1(,D% 1<s   =AA AGETc                 
  #    U R                  U5      nXPl        U R                  XX45      nUb0  UR                  SU R                  05        X`R                  U5      -   nSnSnU R                  XX45      u  pnU	(       a  U	nOU
(       a  U
nOU(       ad  [        c  [        U R                  S-   5      eU R                  c  0 U l
        XR                  ;  a  U R                  5         U R                  U5      nOU R                  (       a  U R                  nUSL=(       d    USLnU R                  X5        U R                  b$  Uc	  U	c  U
c  Ub  [        U R                  S-   5      eU R                  (       a!  U R!                  SU R                  X!SUSU5        U R"                  R%                  SX!X45        UnU(       a  UR'                  5       OSnU R                  5         Ub  UOU R(                  n[+        XR-                  5       5      nSnSnSnSn U" [.        R0                  " US	S
9UUU R2                  S-  US9 ISh  vN nUR5                  SS9I Sh  vN nUR6                  n0 nU H$  nUU;   a  UU   S-   UU   -   UU'   M  UU   UU'   M&     UR8                  nUR:                  nU R=                  UUXUUX]5      nU R?                  U5      nU R@                  (       a  UU l!        U RD                  (       a  X0l#        U RH                  (       a  UU l%        U R                  (       a"  U R!                  SU R                  X!USUSU5	        U(       a+  [M        U[N        5      (       d  U RP                  (       a  UUS'   U R"                  R%                  SX!UUU5        SSS5      ISh  vN   U Rm                  UUXUUUX]5	        U Ro                  UUXU5        Ub  U$ U Rq                  U5      (       a  U$ US:X  d  Uc  U$ WRr                  $  GN GN Ni! , ISh  vN  (       d  f       N~= f! [R        RT                   a.  nSRW                  U R                  X!/5      n[Y        U5      UeSnAf[Z        R\                  R^                  [`        R^                  4 a.  nSRW                  U R                  X!/5      n[c        U5      UeSnAf[d        Rf                   a.  nSRW                  U R                  X!/5      n[Y        U5      UeSnAf[d        Rh                   a.  nSRW                  U R                  X!/5      n[k        U5      UeSnAff = f7f)z3Perform a HTTP request and return decoded JSON dataNOriginzu - to use SOCKS proxy with ccxt, you need "aiohttp_socks" module that can be installed by "pip install aiohttp_socks"z9 you have set multiple proxies, please use one or anotherz
fetch Request:zRequestHeaders:zRequestBody:z%s %s, Request: %s %sT)encoded  )dataheaderstimeoutproxyreplace)errorsz, z
fetch Response:zResponseHeaders:zResponseBody:responseHeadersz%s %s, Response: %s %s %s  ):prepare_request_headerslast_request_headerscheck_proxy_url_settingsupdateoriginurl_encoder_for_proxy_urlcheck_proxy_settingsSocksProxyConnectorr   r[   rX   ra   get_socks_proxy_sessionaiohttp_proxycheckConflictingProxiesverboselogrY   debugencoder5   getattrloweryarlURLr   textr   statusreasonon_rest_response
parse_jsonenableLastHttpResponselast_http_responseenableLastResponseHeaderslast_response_headersenableLastJsonResponselast_json_response
isinstancelistreturnResponseHeaderssocketgaierrorjoinr   
concurrentfuturesTimeoutErrorrv   r   r~   ClientConnectionErrorClientErrorr   handle_errorshandle_http_status_codeis_text_responsecontent)r@   r   methodr   bodyrequest_headersproxyUrlfinal_proxyproxy_session	httpProxy
httpsProxy
socksProxyproxyAgentSetrequest_bodyencoded_bodyfinal_sessionsession_methodhttp_responsehttp_status_codehttp_status_textjson_responseresponseraw_headersheaderedetailss                             rB   fetchExchange.fetch   s     66w?$3!00gL""Hdkk#:;;;C@@C,0,E,EcSZ,a)	z#K$K"*"477  .e  $e  f  f))1,.)";";;		 88DM,,K#4/I:T3I$$]= *1EI^blbx  }G  }Stww)ddee <<HH'&?PRacqswx16N (,t{{}$		)6)B ?-	0%dhhsD&A+7.=/3||d/B,7	9 9 =E&.mm9m&E E&..)F(*1&/D*@;vCV*V*5f*=	 *
 $,?? #+??  $ 5 56FHXZ]gnp}  @O  !^ $ >...;D+1118....;D+<<HH0$''6HXZlnu  xG  IV  W M4)H)HTMgMg7>M"34!!"=vL\^egtu99 9\ 	+-=sGUbdq  tC  	R$$%57GVcd$    ))  B-"7  m9
 !F9 9 9 9<  	7hh56G&w/Q6""//1E1EF 	1hh56G )q0,, 	7hh56G&w/Q6"" 	0hh56G(a/	0s   HU.P/  PP/ PPEPP/ )P*P/ .AUP/ PP/ P,PP,(P/ +U,P/ /U)Q,,1U)SU)TU)UUUc                    U R                   c  0 U l         XR                   ;  a  UR                  S5      nU(       d  UOUR                  SS5      n[        R                  " UU R
                  U R                  SU(       a  UOS S9U l        [        R                  " U R                  U R                  U R                  S9U R                   U'   U R                   U   $ )Nz
socks5h://z	socks5://T)rn   ro   rp   rdnsrq   )rX   
startswithr   r   from_urlrx   r2   r   r~   r   r3   )r@   r   reverse_dnssocks_proxy_selecteds       rB   r    Exchange.get_socks_proxy_session  s    %%-(*D%777$//=K5@:jFXFXYegrFs +>+G+G$$$&&&*$/[T,D( 5<4I4ItO`O`lp  mI  mI  UY  Uk  Uk  5lD%%j1((44rD   c                   #    U(       dI  U R                   (       a8  U R                  (       d  U R                  U R                   5      $ U R                   $ S nU R                  S   SL a&  U R	                  5       I S h  vN nX0R
                  S'   U R                  U5      I S h  vN nSU R
                  ;   a  U R
                  S	 U R                  XC5      $  NY N47f)NfetchCurrenciesTcachedCurrencies)marketsmarkets_by_idset_marketshasfetch_currenciesr{   fetch_markets)r@   reloadparams
currenciesr   s        rB   load_markets_helperExchange.load_markets_helper"  s     ||))++DLL99||#
88%&$.#4466J/9LL+,**622-/044 72s$   A8C:C;&C!C"3CCc                   #    U(       a  U R                   (       a  U R                  (       d3  SU l         U R                  X5      n[        R                  " U5      U l         U R                  I Sh  vN nSU l         U$  N! [        R
                   a  nSU l         SU l        UeSnAf[         a  nSU l         SU l        UeSnAff = f7f)a  
Loads and prepares the markets for trading.

Args:
    reload (bool): If True, the markets will be reloaded from the exchange.
    params (dict): Additional exchange-specific parameters for the request.

Returns:
    dict: A dictionary of markets.

Raises:
    Exception: If the markets cannot be loaded or prepared.

Notes:
    This method is asynchronous.
    It ensures that the markets are only loaded once, even if called multiple times.
    If the markets are already loaded and `reload` is False or not provided, it returns the existing markets.
    If a reload is in progress, it waits for completion before returning.
    If an error occurs during loading or preparation, an exception is raised.
TNF)r?   r>   r   rv   ensure_futureCancelledError	Exception)r@   r   r   	coroutineresultr   s         rB   load_marketsExchange.load_markets2  s     * 411$:N:N%)D"00@I#*#8#8#CD 		///F "' 0%% 	%*D"#'D G 	%*D"#'D G	sH   AC A? /A=0A? 4	C=A? ?CB##C0C  CCc                    #    U(       d*  U R                   [        R                   :w  a  U R                   $ U R                  U R                   U R                  5       I S h  vN 5      U l         U R                   $  N7frF   )loaded_feesr   deep_extend
fetch_fees)r@   r   s     rB   	load_feesExchange.load_feesY  s_     8#7#77'''++D,<,<DOODU>UV ?Vs   AA9A7
A9c                 @   #    U R                  U R                  5      $ 7frF   )to_arrayr   r@   r   s     rB   r   Exchange.fetch_markets`  s     
 }}T\\**s   c                 "   #    U R                   $ 7frF   )r   r
  s     rB   r   Exchange.fetch_currenciesg  s     
 s   1mc                 D   #    U R                  XX4U5      I S h  vN $  N7frF   )fetch_ohlcvcr@   symbol	timeframesincelimitr   s         rB   fetchOHLCVCExchange.fetchOHLCVCn  s      &&v%OOOOs     c                 @   #    U R                  X5      I S h  vN $  N7frF   )fetch_tickersr@   symbolsr   s      rB   fetch_full_tickersExchange.fetch_full_tickersq  s     ''8888rS   c                 P   #    [         R                  " US-  5      I S h  vN $  N7fNr   )rv   r   )r@   millisecondss     rB   r   Exchange.sleept  s     ]]<$#67777s   &$&c                 L   #     U" U6 I S h  vN   g  N! [          a     g f = f7frF   )r   )r@   r   argss      rB   spawn_asyncExchange.spawn_asyncw  s(     	$- 		s(   $  $ 
!$!$c                    ^ U4S jn[        5       mU R                  R                  U" U6 5      nUR                  U5        T$ )Nc                    > U R                  5       nUc   TR                  U R                  5       5        g TR                  U5        g rF   )	exceptionresolver   reject)asyncio_futurer(  futures     rB   callback Exchange.spawn.<locals>.callback  s8    &002I ~4467i(rD   )r"   r2   create_taskadd_done_callback)r@   r   r#  r-  taskr,  s        @rB   spawnExchange.spawn~  s>    	)   ,,VT];x(rD   c                     [        U 5      $ rF   )r   r   s    rB   r   Exchange.inflate  s    t}rD   c                     [        U 5      $ rF   )r   r5  s    rB   r   Exchange.inflate64  s    rD   c                     [        U 5      $ rF   )r    r5  s    rB   r    Exchange.gunzip  s    d|rD   c                     [        X5      $ rF   )r#   r@   snapshotdepths      rB   
order_bookExchange.order_book  s    ))rD   c                     [        X5      $ rF   )r$   r<  s      rB   indexed_order_bookExchange.indexed_order_book      00rD   c                     [        X5      $ rF   )r%   r<  s      rB   counted_order_bookExchange.counted_order_book  rD  rD   c                    U R                   =(       d    0 U l         XR                   ;  Ga+  U R                  nU R                  nU R                  nU R                  nU R                  U R                  S0 5      nU R                  U R                  [        U S5      [        U SS 5      U R                  [        U R                  U R                  5      U R                  U R                  U R                  SS5      S.U5      n[        XX4XW5      U R                   U'   U R!                  5       u  pn
U(       d  U	(       a  U(       a  UOU	U R                   U   l        U R                   U   $ )Nwsr   pingdecompressBinaryT)r   rJ  r   rQ   r2   rK  )clientshandle_messageon_erroron_closeon_connected
safe_valuer{   extend	streamingr   r   r	   rK   r2   rz   r!   check_ws_proxy_settingsr   )r@   r   
on_messagerN  rO  rP  
ws_optionsr{   r   r   r   s              rB   clientExchange.client  s   ||)rll",,J}}H}}H,,LtR@Jkk$..tU+fd3<<%d&6&68I8IJ $ 1 1$(NN4<<ASUY$Z3 G !'sL bDLL040L0L0N-I:Z7@)jS!'||C  rD   c                 Z    U R                   R                  " US-  U R                  U/UQ76 $ r  )r2   
call_laterr2  )r@   r   r   r#  s       rB   delayExchange.delay  s+      ++GdNDJJVQUVVrD   c                 H    SnU(       a  [        U R                  S-   5      e0 $ )NTz%.handle_message() not implemented yetr   r[   )r@   rW  messagealwayss       rB   rM  Exchange.handle_message  s$    tww)PPQQ	rD   c                 P  ^ ^^ T R                  5         SnT R                  U5      m[        R                  " U Vs/ s H  nTR	                  U5      PM     sn5      n/ n	UbD  U H>  n
U
TR
                  ;  d  M  U	R                  U
5        U=(       d    STR
                  U
'   M@     TR                  R                  5       (       a  TR                  O/[        R                  " TR                  T R                  U5      5      nUUU 4S jnU	(       a  UR                  U5        U$ s  snf )Nr   Tc                    >^ TR                  TR                  S5      nTR                  USS5      mT(       a%  UUUU4S jn[        R                  " U" 5       5        g g )NrI  rM      c                  4  >#    TR                   (       a  TR                  T5      I S h  vN    TR                  T5      I S h  vN   g  N N! [         a  n TR	                  U 5         S n A g S n A f[
         a  n TR	                  U 5         S n A g S n A ff = f7frF   enableRateLimitrQ   sendConnectionErrorrN  r   r   rW  rM   r_  r@   s    rB   send_message<Exchange.watch_multiple.<locals>.after.<locals>.send_message  v     ++$ood333+$kk'222 42* +**$ +**+\   &BA	BA AA BA 
BA-(B-B:BBBBrQ  r{   rv   r   futr{   rk  rM   rW  r_  r@   s      @rB   after&Exchange.watch_multiple.<locals>.after  M    oodllD9G??7FA6D+ + %%ln5 rD   )ra   rW  r"   racer,  subscriptionsappend	connecteddonerv   r   connectr5   r0  )r@   r   message_hashesr_  subscribe_hashessubscriptionbackoff_delaymessage_hashr,  missing_subscriptionssubscribe_hashrx  rr  rW  s   `  `         @rB   watch_multipleExchange.watch_multiple  s    		S!n]nlfmmL9n]^ "'"2!)=)==)00@;G;O4F((8 #3
 )/(8(8(=(=(?(?F$$&&v~~dllM'RS 		6  !''.? ^s   D#c                 z  ^ ^^ T R                  5         SnT R                  U5      mUc  UTR                  ;   a  TR                  U   $ TR                  U5      nTR                  R                  U5      nU(       d  U=(       d    STR                  U'   T R                  n	T R                  5       u  pnU(       a  T R                  U5      n	TR                  R                  5       (       a  TR                  O$[        R                  " TR                  X5      5      nUUU 4S jnU(       d  UR                  U5        U$ )Nr   Tc                    >^ TR                  TR                  S5      nTR                  USS5      mT(       a%  UUUU4S jn[        R                  " U" 5       5        g g )NrI  rM   rd  c                  4  >#    TR                   (       a  TR                  T5      I S h  vN    TR                  T5      I S h  vN   g  N N! [         a  n TR	                  U 5         S n A g S n A f[
         a  n TR	                  U 5         S n A g S n A ff = f7frF   rf  rj  s    rB   rk  3Exchange.watch.<locals>.after.<locals>.send_message  rm  rn  ro  rp  s      @rB   rr  Exchange.watch.<locals>.after  rt  rD   )ra   rW  r   r,  rv  r7   r5   rT  r   rx  ry  rv   r   rz  r0  )r@   r   r  r_  r  r}  r~  r,  
subscribedselected_sessionr   r   r   rx  rr  rW  s   `  `           @rB   watchExchange.watch  s   		S!!lfnn&D>>,//|,))--n=
3?3G4F  0<<,0,H,H,J)	z#;;JG(.(8(8(=(=(?(?F$$&&v~~6F'VW 		6  ''.rD   c                     g rF    )r@   rW  r_  s      rB   rP  Exchange.on_connected  s     	rD   c                     UR                   U R                  ;   aA  U R                  UR                      R                  (       a  U R                  UR                   	 g g g rF   )r   rL  errorr@   rW  r  s      rB   rN  Exchange.on_error  s@    ::%$,,vzz*B*H*HVZZ( +I%rD   c                     UR                   (       a  g UR                  U R                  ;   a  U R                  UR                  	 g g rF   )r  r   rL  r  s      rB   rO  Exchange.on_close   s3    << zzT\\)LL, *rD   c           	        #    U R                   (       a  [        R                  " U R                   R                  5        Vs/ s H'  n[        R                  " UR                  5       5      PM)     sn[        R                  S9I S h  vN   U R                   R                  5        H  nU R                   U	 M     g g s  snf  N97f)N)return_when)rL  rv   waitvaluesr/  re   ALL_COMPLETEDcopy)r@   rW  r   s      rB   r   Exchange.ws_close)  s     <<,,RVR^R^ReReRghRg 3 3FLLN CRghv}  wL  wL  M  M  M||((*LL% + h  Ms   >C .B:.CB?:Cc                   #    X0R                   ;  a)  UR                  [        U R                  S-   5      U5        g  U R	                  SSS5      nSnU R                   U   nXv:  a  UR
                  n	U R                  X4U5      I S h  vN n
U R                  X5      nUS:  aG  UR                  U
5        U R                  XUS  5        U	R                  5         UR                  X5        g US-  nXv:  a  M  UR                  [        U R                  S-   [        U5      -   S-   5      U5        U R                  UR                  	 g  N! [         a7  nUR                  X5        U R!                  XX4U5      I S h  vN     S nAg S nAff = f7f)	Nz+ loadOrderBook() orderbook is not initiatedwatchOrderBook
maxRetriesr^   r   rd  z nonce is behind cache after z tries.)
orderbooksr*  r   r[   handle_optioncachefetch_order_bookget_cache_indexresethandle_deltasclearr)  strrL  r   r
   load_order_book)r@   rW  messageHashr  r  r   r  triesstoredr  r?  indexr   s                rB   r  Exchange.load_order_book/  sa    (MM-2_(_`bmn	S++,<lANJE__V,F$#'#8#8#OO
,,Z?A:LL,&&vUV}=KKMNN67
 $ MM-2Q(QTWXbTc(cfo(opr}~VZZ( P  	SMM!)&&vF6RRR	Ssa   9F
A
E EA!E (F
)
E 5AE F
E 
F'F7E:8F=F
FF
c                 (    US:X  a  g[        US5      $ )Nr   z0e-00g)format)r@   ns     rB   format_scientific_notation_ftx'Exchange.format_scientific_notation_ftxH  s    6a~rD   c                     [         (       d  [        U R                  S-   5      e[        R                  " 5       nUR                  U5        [        U5      nU$ )Nz^ requires protobuf to decode messages, please install it with `pip install "protobuf==5.29.5"`)r)   r   r[   r(   PushDataV3ApiWrapperParseFromString)r@   r   r_  dict_msgs       rB   decode_proto_msgExchange.decode_proto_msgM  sU    }tww  *J   J  K  K*??A% )$ rD   c                    #    g 7frF   r  rG   s    rB   load_dydx_protosExchange.load_dydx_protosf  s     s   c                 :   #    [        U R                  S-   5      e7f)Nz% fetchAccounts() is not supported yetr^  r
  s     rB   fetch_accountsExchange.fetch_accounts       477%LLMM   r  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz# fetchTrades() is not supported yetr^  r@   r  r  r  r   s        rB   fetch_tradesExchange.fetch_trades       477%JJKKr  c                 :   #    [        U R                  S-   5      e7f)Nz% fetchTradesWs() is not supported yetr^  r  s        rB   fetch_trades_wsExchange.fetch_trades_ws  r  r  c                    #    U R                   S   (       a  U R                  U/X#U5      I S h  vN $ [        U R                  S-   5      e N7f)NwatchLiquidationsForSymbolsz) watchLiquidations() is not supported yet)r   watch_liquidations_for_symbolsr   r[   r  s        rB   watch_liquidationsExchange.watch_liquidations  sH     8812<<fXuU[\\\477%PPQQ ]s   ,AAAr  c                 :   #    [        U R                  S-   5      e7f)Nz3 watchLiquidationsForSymbols() is not supported yetr^  r@   r  r  r  r   s        rB   r  'Exchange.watch_liquidations_for_symbols  s     477%ZZ[[r  c                    #    U R                   S   (       a  U R                  U/X#U5      $ [        U R                  S-   5      e7f)NwatchMyLiquidationsForSymbolsz+ watchMyLiquidations() is not supported yet)r   !watch_my_liquidations_for_symbolsr   r[   r  s        rB   watch_my_liquidationsExchange.watch_my_liquidations  s?     8834996(ERXYY477%RRSSs   AAc                 :   #    [        U R                  S-   5      e7f)Nz5 watchMyLiquidationsForSymbols() is not supported yetr^  r  s        rB   r  *Exchange.watch_my_liquidations_for_symbols  s     477%\\]]r  c                 :   #    [        U R                  S-   5      e7f)Nz# watchTrades() is not supported yetr^  r  s        rB   watch_tradesExchange.watch_trades  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz% unWatchOrders() is not supported yetr^  r@   r  r   s      rB   un_watch_ordersExchange.un_watch_orders  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz% unWatchTrades() is not supported yetr^  r  s      rB   un_watch_tradesExchange.un_watch_trades  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz- watchTradesForSymbols() is not supported yetr^  r  s        rB   watch_trades_for_symbols!Exchange.watch_trades_for_symbols       477%TTUUr  c                 :   #    [        U R                  S-   5      e7f)Nz/ unWatchTradesForSymbols() is not supported yetr^  r  s      rB   un_watch_trades_for_symbols$Exchange.un_watch_trades_for_symbols       477%VVWWr  c                 :   #    [        U R                  S-   5      e7f)Nz/ watchMyTradesForSymbols() is not supported yetr^  r  s        rB   watch_my_trades_for_symbols$Exchange.watch_my_trades_for_symbols  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz- watchOrdersForSymbols() is not supported yetr^  r  s        rB   watch_orders_for_symbols!Exchange.watch_orders_for_symbols  r  r  symbolsAndTimeframesc                 :   #    [        U R                  S-   5      e7f)Nz, watchOHLCVForSymbols() is not supported yetr^  )r@   r  r  r  r   s        rB   watch_ohlcv_for_symbols Exchange.watch_ohlcv_for_symbols       477%SSTTr  c                 :   #    [        U R                  S-   5      e7f)Nz. unWatchOHLCVForSymbols() is not supported yetr^  )r@   r  r   s      rB   un_watch_ohlcv_for_symbols#Exchange.un_watch_ohlcv_for_symbols       477%UUVVr  c                 :   #    [        U R                  S-   5      e7f)Nz0 watchOrderBookForSymbols() is not supported yetr^  r@   r  r  r   s       rB   watch_order_book_for_symbols%Exchange.watch_order_book_for_symbols       477%WWXXr  c                 :   #    [        U R                  S-   5      e7f)Nz2 unWatchOrderBookForSymbols() is not supported yetr^  r  s      rB   un_watch_order_book_for_symbols(Exchange.un_watch_order_book_for_symbols       477%YYZZr  c                 :   #    [        U R                  S-   5      e7f)Nz( unWatchPositions() is not supported yetr^  r  s      rB   un_watch_positionsExchange.un_watch_positions       477%OOPPr  c                 :   #    [        U R                  S-   5      e7f)Nz% unWatchTicker() is not supported yetr^  r  s      rB   un_watch_tickerExchange.un_watch_ticker  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz( unWatchMarkPrice() is not supported yetr^  r  s      rB   un_watch_mark_priceExchange.un_watch_mark_price  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz) unWatchMarkPrices() is not supported yetr^  r  s      rB   un_watch_mark_pricesExchange.un_watch_mark_prices       477%PPQQr  codesc                 :   #    [        U R                  S-   5      e7f)Nz- fetchDepositAddresses() is not supported yetr^  r@   r  r   s      rB   fetch_deposit_addresses Exchange.fetch_deposit_addresses  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz& fetchOrderBook() is not supported yetr^  r@   r  r  r   s       rB   r  Exchange.fetch_order_book       477%MMNNr  c                 :   #    [        U R                  S-   5      e7f)Nz( fetchOrderBookWs() is not supported yetr^  r  s       rB   fetch_order_book_wsExchange.fetch_order_book_ws  r  r  c                    #    U R                   S   (       a,  U R                  U/U5      I S h  vN nU R                  X15      $ [        U R                  S-   5      e N-7f)NfetchMarginModesz' fetchMarginMode() is not supported yet)r   fetch_margin_modes	safe_dictr   r[   )r@   r  r   marginModess       rB   fetch_margin_modeExchange.fetch_margin_mode  sS     88&' $ 7 7& IIK>>+66tww)RRSS J   +AA.Ac                 :   #    [        U R                  S-   5      e7f)Nz( fetchMarginModes() is not supported yetr^  r  s      rB   r   Exchange.fetch_margin_modes  r  r  c                    #    U R                  SSS5      n[        SU5       H   n U R                  XU5      I S h  vN nUs  $    g  N! [         a  nUS-   U:X  a  Ue S nAMB  S nAff = f7f)Nr  r  r^   r   rd  )r  ranger  r   )r@   r  r  r   fetchSnapshotMaxRetriesi	orderBookr   s           rB   fetch_rest_order_book_safe#Exchange.fetch_rest_order_book_safe  s     "&"4"45E|UV"Wq12A"&"7"7v"NN	   3  O E55G 6s>   #A,A	AA	A,A		
A)A$A,$A))A,c                 :   #    [        U R                  S-   5      e7f)Nz& watchOrderBook() is not supported yetr^  r  s       rB   watch_order_bookExchange.watch_order_book  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz( unWatchOrderBook() is not supported yetr^  r  s      rB   un_watch_order_bookExchange.un_watch_order_book  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz! fetchTime() is not supported yetr^  r
  s     rB   
fetch_timeExchange.fetch_time       477%HHIIr  c                 :   #    [        U R                  S-   5      e7f)Nz* fetchTradingLimits() is not supported yetr^  r  s      rB   fetch_trading_limitsExchange.fetch_trading_limits       477%QQRRr  c                 :   #    [        U R                  S-   5      e7f)Nz- fetchCrossBorrowRates() is not supported yetr^  r
  s     rB   fetch_cross_borrow_rates!Exchange.fetch_cross_borrow_rates   r  r  c                 :   #    [        U R                  S-   5      e7f)Nz0 fetchIsolatedBorrowRates() is not supported yetr^  r
  s     rB   fetch_isolated_borrow_rates$Exchange.fetch_isolated_borrow_rates  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz* fetchLeverageTiers() is not supported yetr^  r  s      rB   fetch_leverage_tiersExchange.fetch_leverage_tiers  r<  r  c                 :   #    [        U R                  S-   5      e7f)Nz) fetchFundingRates() is not supported yetr^  r  s      rB   fetch_funding_ratesExchange.fetch_funding_rates	  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz- fetchFundingIntervals() is not supported yetr^  r  s      rB   fetch_funding_intervals Exchange.fetch_funding_intervals  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz( watchFundingRate() is not supported yetr^  r  s      rB   watch_funding_rateExchange.watch_funding_rate  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz) watchFundingRates() is not supported yetr^  r  s      rB   watch_funding_ratesExchange.watch_funding_rates  r  r  c                 @   #    U R                  X5      I S h  vN $  N7frF   )rP  r  s      rB   watch_funding_rates_for_symbols(Exchange.watch_funding_rates_for_symbols  s     --g>>>>rS   codeamountfromAccount	toAccountc                 :   #    [        U R                  S-   5      e7f)Nz  transfer() is not supported yetr^  )r@   rU  rV  rW  rX  r   s         rB   transferExchange.transfer       477%GGHHr  addresstagc                 :   #    [        U R                  S-   5      e7f)Nz  withdraw() is not supported yetr^  r@   rU  rV  r]  r^  r   s         rB   withdrawExchange.withdraw  r\  r  c                 :   #    [        U R                  S-   5      e7f)Nz, createDepositAddress() is not supported yetr^  r@   rU  r   s      rB   create_deposit_addressExchange.create_deposit_address  r  r  leveragec                 :   #    [        U R                  S-   5      e7f)Nz# setLeverage() is not supported yetr^  )r@   rg  r  r   s       rB   set_leverageExchange.set_leverage!  r  r  c                    #    U R                   S   (       a,  U R                  U/U5      I S h  vN nU R                  X15      $ [        U R                  S-   5      e N-7f)NfetchLeveragesz% fetchLeverage() is not supported yet)r   fetch_leveragesr!  r   r[   )r@   r  r   	leveragess       rB   fetch_leverageExchange.fetch_leverage$  sS     88$%"22F8VDDI>>)44tww)PPQQ Er%  c                 :   #    [        U R                  S-   5      e7f)Nz& fetchLeverages() is not supported yetr^  r  s      rB   rm  Exchange.fetch_leverages+  r  r  hedgedc                 :   #    [        U R                  S-   5      e7f)Nz' setPositionMode() is not supported yetr^  )r@   rs  r  r   s       rB   set_position_modeExchange.set_position_mode.       477%NNOOr  c                 :   #    [        U R                  S-   5      e7f)Nz! addMargin() is not supported yetr^  r@   r  rV  r   s       rB   
add_marginExchange.add_margin1  r8  r  c                 :   #    [        U R                  S-   5      e7f)Nz$ reduceMargin() is not supported yetr^  ry  s       rB   reduce_marginExchange.reduce_margin4       477%KKLLr  c                 :   #    [        U R                  S-   5      e7f)Nz! setMargin() is not supported yetr^  ry  s       rB   
set_marginExchange.set_margin7  r8  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz+ fetchLongShortRatio() is not supported yetr^  r@   r  r  r   s       rB   fetch_long_short_ratioExchange.fetch_long_short_ratio:       477%RRSSr  c                 :   #    [        U R                  S-   5      e7f)Nz2 fetchLongShortRatioHistory() is not supported yetr^  r  s         rB   fetch_long_short_ratio_history'Exchange.fetch_long_short_ratio_history=  r  r  typec                 :   #    [        U R                  S-   5      e7f)a  
fetches the history of margin added or reduced from contract isolated positions
:param str [symbol]: unified market symbol
:param str [type]: "add" or "reduce"
:param int [since]: timestamp in ms of the earliest change to fetch
:param int [limit]: the maximum amount of changes to fetch
:param dict params: extra parameters specific to the exchange api endpoint
:returns dict[]: a list of `margin structures <https://docs.ccxt.com/#/?id=margin-loan-structure>`
z4 fetchMarginAdjustmentHistory() is not supported yetr^  )r@   r  r  r  r  r   s         rB   fetch_margin_adjustment_history(Exchange.fetch_margin_adjustment_history@  s      477%[[\\r  
marginModec                 :   #    [        U R                  S-   5      e7f)Nz% setMarginMode() is not supported yetr^  )r@   r  r  r   s       rB   set_margin_modeExchange.set_margin_modeL  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz6 fetchDepositAddressesByNetwork() is not supported yetr^  rd  s      rB   "fetch_deposit_addresses_by_network+Exchange.fetch_deposit_addresses_by_networkO  s     477%]]^^r  1hc                 :   #    [        U R                  S-   5      e7f)Nz0 fetchOpenInterestHistory() is not supported yetr^  r  s         rB   fetch_open_interest_history$Exchange.fetch_open_interest_historyR  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz) fetchOpenInterest() is not supported yetr^  r  s      rB   fetch_open_interestExchange.fetch_open_interestU  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz* fetchOpenInterests() is not supported yetr^  r  s      rB   fetch_open_interestsExchange.fetch_open_interestsX  r<  r  c                 :   #    [        U R                  S-   5      e7f)Nz signIn() is not supported yetr^  r
  s     rB   sign_inExchange.sign_in[  s     477%EEFFr  c                 :   #    [        U R                  S-   5      e7f)Nz+ fetchPaymentMethods() is not supported yetr^  r
  s     rB   fetch_payment_methodsExchange.fetch_payment_methods^  r  r  c                 :   #    [        U R                  S-   5      e7f)Nzb fetchBorrowRate is deprecated, please use fetchCrossBorrowRate or fetchIsolatedBorrowRate insteadr^  r@   rU  rV  r   s       rB   fetch_borrow_rateExchange.fetch_borrow_ratea  s&     477  &J  J  K  	Kr  c                 :   #    [        U R                  S-   5      e7f)Nz$ repayCrossMargin is not support yetr^  r  s       rB   repay_cross_marginExchange.repay_cross_margind  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz' repayIsolatedMargin is not support yetr^  r@   r  rU  rV  r   s        rB   repay_isolated_marginExchange.repay_isolated_marging  rw  r  c                 :   #    [        U R                  S-   5      e7f)Nz% borrowCrossMargin is not support yetr^  r  s       rB   borrow_cross_marginExchange.borrow_cross_marginj  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz( borrowIsolatedMargin is not support yetr^  r  s        rB   borrow_isolated_marginExchange.borrow_isolated_marginm  r  r  c                 :   #    [        U R                  S-   5      e7f)NzY borrowMargin is deprecated, please use borrowCrossMargin or borrowIsolatedMargin insteadr^  r@   rU  rV  r  r   s        rB   borrow_marginExchange.borrow_marginp  s&     477  &A  A  B  	Br  c                 :   #    [        U R                  S-   5      e7f)NzV repayMargin is deprecated, please use repayCrossMargin or repayIsolatedMargin insteadr^  r  s        rB   repay_marginExchange.repay_margins  s     477%}}~~r  c                 p   #    SnU R                   S   (       a  Sn[        U R                  S-   U-   5      e7f)Nr   fetchTrades. If you want to build OHLCV candles from trade executions data, visit https://github.com/ccxt/ccxt/tree/master/examples/ and see "build-ohlcv-bars" filez" fetchOHLCV() is not supported yetr   r   r[   r@   r  r  r  r  r   r_  s          rB   fetch_ohlcvExchange.fetch_ohlcvv  s8     88M" rG477%IIGSTT   46c                 p   #    SnU R                   S   (       a  Sn[        U R                  S-   U-   5      e7f)Nr   fetchTradesWsr  zC fetchOHLCVWs() is not supported yet. Try using fetchOHLCV instead.r  r  s          rB   fetch_ohlcv_wsExchange.fetch_ohlcv_ws|  s9     88O$ rG477%jjmttuur  c                 :   #    [        U R                  S-   5      e7f)Nz" watchOHLCV() is not supported yetr^  r  s         rB   watch_ohlcvExchange.watch_ohlcv       477%IIJJr  c                   #    SnU R                  U R                  U0 5      nU R                  USS5      n U R                  USS5      SLa  g U R                  USS5      n	S n
SnSnX:  a   [        X5      " 0 5      I S h  vN n
Sn U
nUb  UR                  U5      nUS	   nUb  UR                  U5      nUS   nU(       aH  [        U[        5      (       a3  U R                  UR                  5       5      nU(       a  U$ [        S
5      eU$  N! [         a  nUS	-   nX:X  a  Ue S nAOS nAff = fU(       a  M  X:  a  M  N! [         a  nU R                  S-   U-   S-   n S nAOS nAff = fU(       a  g [        U5      e7f)Nr   webApiMuteFailureTwebApiEnablewebApiRetries
   r   Frd  z&could not parse the response into jsonr   zx() failed to fetch correct data from website. Probably webpage markup has been changed, breaking the page custom parser.)rQ  r{   rz   r   r   splitr   r  r   stripr   r[   )r@   r   endpointMethodreturnAsJson
startRegexendRegexerrorMessager{   muteOnFailurer  r   retryshouldBreakr   r   splitted_by_startsplitted_by_endjsoneds                     rB   fetch_web_endpointExchange.fetch_web_endpoint  s    //$,,;w0CTJ#	o~~g~t<DH/2FJHEK$ %,T%B2%FFH"&K G%$+MM*$=!+A.#")--"9)!,GS!9!99!M%&NOO/  G !  !AIE* +   $4  	o77S=61  5o  oL	ol++s   3FE FE ,D  DD A8E ?F E FD 
D/D*%E *D//E 
E,E'"F'E,,Fc           
         #    U R                  XU5      I S h  vN nU R                  UU R                  U R                  US   5      S5      U R                  U R                  US   5      SS5      S.5      $  N^7f)Nasksr   bidsT)r  r  )r  rR  sort_by	aggregate)r@   r  r  r   	orderbooks        rB   fetch_l2_order_bookExchange.fetch_l2_order_book  sr     //vFF	{{9LL	&0A!BAFLL	&0A!BAtL'
  	 Gs   A9A7AA9c                   #    U R                   S   (       a  U(       d  SU R                  ;  a  U R                  U5      I S h  vN n[        S[	        U5      5       H5  nX   nU R                  U R                  U   XF   5      U R                  U'   M7     U R                  5       U R                  S'   U R                  $  N{7f)NfetchTradingLimitslimitsLoadedr   )r   r{   r:  r)  lenr  r   r   )r@   r  r   r   r   r+  r  s          rB   load_trading_limitsExchange.load_trading_limits  s     88()n<!%!:!:7!CCq#g,/A$ZF+/+;+;DLL<PRZRb+cDLL( 0 04/@/@/B^,|| Ds   A C B>A<C publicapir   r   c           	      b  #    U R                   (       a,  U R                  X#XU5      nU R                  U5      I S h  vN   S n	U R                  XASS5      u  pS n
U R                  XASS5      u  pU R	                  5       U l        U R                  XX4XV5      nUS   U l        US   U l        US   U l	        [        SU	S-   5       H,  n U R                  US   US   US   US   5      I S h  vN s  $    g  N N! [         a  n[        U[        5      (       a  X:  a  U R                  (       aA  U R!                  S	[#        U5      -   S
-   U[#        S5      -   -   S-   [#        U	5      -   S-   5        U
b,  U
S:w  a   U R%                  U
5      I S h  vN     S nAM   S nAM   S nAM  UeUeS nAff = f7f)NmaxRetriesOnFailurer   maxRetriesOnFailureDelayr   r   r   rd  r   zRequest failed with the error: z, retrying z of z...)rg  calculate_rate_limiter_costrQ   handle_option_and_paramsr   lastRestRequestTimestampsignr   last_request_bodylast_request_urlr)  r   r   r   r   r   r   r  r   )r@   pathr  r   r   r   r   r0   rM   retries
retryDelayrequestr+  r   s                 rB   fetch2Exchange.fetch2  s    33CvVD--%%%77F[]^_
!::6Icefg
(,(9(9(;%))DvwE$+I$6!!( 'q'A+&A!ZZ8I7S\K]_fgm_nooo ' 1 & p 
a11{<< HH%FQ%OR_%_cdgjklgmcm%nqw%wz}  F  {G  &G  JO  &O  P&2q"&**Z"888 :I2  G
s_   9F/C4B
F/#C8*C6+C8.F/6C88
F,B	F'FF'F/#F''F,,F/c           	      F   #    U R                  XX4XVU5      I S h  vN $  N7frF   )r  )r@   r  r  r   r   r   r   r0   s           rB   r  Exchange.request  s      [[FG6RRRR   !!c                 .  #    U(       a  U R                  U5      I S h  vN U l        O;U R                  (       a  U R                  $ U R                  U5      I S h  vN U l        U R                  U R                  S5      U l        U R                  $  Nr N87f)Nr[   )r  accountsindex_byaccountsById)r@   r   r   s      rB   load_accountsExchange.load_accounts  so     "&"5"5f"==DM}}}}$&*&9&9&&A A MM$-->}} >
 !Bs!   BB;BB7BBr[   pricec                 F   #    U R                  XSX4U5      I S h  vN $  N7f)Nbuyedit_limit_orderr@   r[   r  rV  r
  r   s         rB   edit_limit_buy_orderExchange.edit_limit_buy_order  s"     **2ufVTTTTr  c                 F   #    U R                  XSX4U5      I S h  vN $  N7f)Nsellr  r  s         rB   edit_limit_sell_orderExchange.edit_limit_sell_order  s"     **2vvfUUUUr  sidec           	      F   #    U R                  XSX4XV5      I S h  vN $  N7fNr  )
edit_order)r@   r[   r  r  rV  r
  r   s          rB   r  Exchange.edit_limit_order  s      __R$VVVVr  c                 z   #    U R                  X5      I S h  vN   U R                  X#XEXg5      I S h  vN $  N N7frF   )cancel_ordercreate_orderr@   r[   r  r  r  rV  r
  r   s           rB   r  Exchange.edit_order  s9     +++&&vT5QQQ 	,Q   ;7;9;;clientOrderIdc                 j   #    U R                  SX#XEX`R                  SU0U5      5      I S h  vN $  N7f)Nr   r!  )r  rR  )r@   r!  r  r  r  rV  r
  r   s           rB   edit_order_with_client_order_id(Exchange.edit_order_with_client_order_id  sG     __RtUKKYhjwXx  {A  MB  C  C  	C  C   *313c                 z   #    U R                  X5      I S h  vN   U R                  X#XEXg5      I S h  vN $  N N7frF   )cancel_order_wscreate_order_wsr  s           rB   edit_order_wsExchange.edit_order_ws  s9     ""2...))&eTTT 	/Tr   c                 :   #    [        U R                  S-   5      e7f)Nz% fetchPosition() is not supported yetr^  r  s      rB   fetch_positionExchange.fetch_position  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz' fetchPositionWs() is not supported yetr^  r  s      rB   fetch_position_wsExchange.fetch_position_ws  rw  r  c                 :   #    [        U R                  S-   5      e7f)Nz% watchPosition() is not supported yetr^  r  s      rB   watch_positionExchange.watch_position  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz& watchPositions() is not supported yetr^  r  s        rB   watch_positionsExchange.watch_positions  r  r  c                 B   #    U R                  XX45      I S h  vN $  N7frF   )r5  r  s        rB   watch_position_for_symbols#Exchange.watch_position_for_symbols  s     ))'%HHHH   c                 :   #    [        U R                  S-   5      e7fa7  
fetches all open positions for specific symbol, unlike fetchPositions(which is designed to work with multiple symbols) so self method might be preffered for one-market position, because of less rate-limit consumption and speed
:param str symbol: unified market symbol
:param dict params: extra parameters specific to the endpoint
:returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>` with maximum 3 items - possible one position for "one-way" mode, and possible two positions(long & short) for "two-way"(a.k.a. hedge) mode
z/ fetchPositionsForSymbol() is not supported yetr^  r  s      rB   fetch_positions_for_symbol#Exchange.fetch_positions_for_symbol        477%VVWWr  c                 :   #    [        U R                  S-   5      e7fr<  r^  r  s      rB   fetch_positions_for_symbol_ws&Exchange.fetch_positions_for_symbol_ws  r?  r  c                 :   #    [        U R                  S-   5      e7fNz& fetchPositions() is not supported yetr^  r  s      rB   fetch_positionsExchange.fetch_positions#  r  r  c                 :   #    [        U R                  S-   5      e7frD  r^  r  s      rB   fetch_positions_wsExchange.fetch_positions_ws&  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz* fetchPositionsRisk() is not supported yetr^  r  s      rB   fetch_positions_riskExchange.fetch_positions_risk)  r<  r  c                 :   #    [        U R                  S-   5      e7f)Nz% fetchBidsAsks() is not supported yetr^  r  s      rB   fetch_bids_asksExchange.fetch_bids_asks,  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz+ fetchBorrowInterest() is not supported yetr^  )r@   rU  r  r  r  r   s         rB   fetch_borrow_interestExchange.fetch_borrow_interest/  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz# fetchLedger() is not supported yetr^  r@   rU  r  r  r   s        rB   fetch_ledgerExchange.fetch_ledger2  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz( fetchLedgerEntry() is not supported yetr^  r@   r[   rU  r   s       rB   fetch_ledger_entryExchange.fetch_ledger_entry5  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz$ fetchBalance() is not supported yetr^  r
  s     rB   fetch_balanceExchange.fetch_balance8  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz& fetchBalanceWs() is not supported yetr^  r
  s     rB   fetch_balance_wsExchange.fetch_balance_ws;  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz$ watchBalance() is not supported yetr^  r
  s     rB   watch_balanceExchange.watch_balance>  r  r  c                 H   #    U R                  U5      I S h  vN nX1   $  N7frF   )r\  )r@   partr   balances       rB   fetch_partial_balanceExchange.fetch_partial_balanceA  s%     **622} 3s   " 	"c                 B   #    U R                  SU5      I S h  vN $  N7f)Nfreerg  r
  s     rB   fetch_free_balanceExchange.fetch_free_balanceE       //????r:  c                 B   #    U R                  SU5      I S h  vN $  N7f)Nusedrk  r
  s     rB   fetch_used_balanceExchange.fetch_used_balanceH  rn  r:  c                 B   #    U R                  SU5      I S h  vN $  N7f)Ntotalrk  r
  s     rB   fetch_total_balanceExchange.fetch_total_balanceK  s     //@@@@r:  c                 :   #    [        U R                  S-   5      e7f)Nz# fetchStatus() is not supported yetr^  r
  s     rB   fetch_statusExchange.fetch_statusN  r  r  c                    #    U R                   S   (       d  [        U R                  S-   5      eU R                  U/U5      I S h  vN $  N7f)NfetchTransactionFeesz+ fetchTransactionFee() is not supported yet)r   r   r[   fetch_transaction_feesrd  s      rB   fetch_transaction_feeExchange.fetch_transaction_feeQ  sB     xx./tww)VVWW00$@@@@s   AAA
Ac                 :   #    [        U R                  S-   5      e7f)Nz, fetchTransactionFees() is not supported yetr^  r  s      rB   r|  Exchange.fetch_transaction_feesV  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz0 fetchDepositWithdrawFees() is not supported yetr^  r  s      rB   fetch_deposit_withdraw_fees$Exchange.fetch_deposit_withdraw_feesY  r  r  c                    #    U R                   S   (       d  [        U R                  S-   5      eU R                  U/U5      I S h  vN nU R	                  X15      $  N7f)NfetchDepositWithdrawFeesz/ fetchDepositWithdrawFee() is not supported yet)r   r   r[   r  rQ  )r@   rU  r   feess       rB   fetch_deposit_withdraw_fee#Exchange.fetch_deposit_withdraw_fee\  sS     xx23tww)ZZ[[55tffEEt** Fs   AAAAc                 .  #    U R                  5       I S h  vN   U R                  S   (       d  [        U R                  S-   5      eU R	                  U5      I S h  vN nU R                  X15      nUc  [        U R                  S-   U-   5      eU$  Nz N77f)NfetchBorrowRatesz, fetchCrossBorrowRate() is not supported yetzI fetchCrossBorrowRate() could not find the borrow rate for currency code )r   r   r   r[   r>  rQ  r   )r@   rU  r   borrowRatesrates        rB   fetch_cross_borrow_rate Exchange.fetch_cross_borrow_rateb  s     !!!xx*+tww)WWXX 99&AA{1<*u ux| |}} 	" B"   BBABB6BBc                 .  #    U R                  5       I S h  vN   U R                  S   (       d  [        U R                  S-   5      eU R	                  U5      I S h  vN nU R                  X15      nUc  [        U R                  S-   U-   5      eU$  Nz N77f)Nr  z/ fetchIsolatedBorrowRate() is not supported yetzL fetchIsolatedBorrowRate() could not find the borrow rate for market symbol )r   r   r   r[   rA  r!  r   )r@   r  r   r  r  s        rB   fetch_isolated_borrow_rate#Exchange.fetch_isolated_borrow_ratel  s     !!!xx*+tww)ZZ[[ <<VDD~~k2<*x x  |B  !B  C  C 	" Er  c                 ^  #    U R                   S   (       az  U R                  5       I S h  vN   U R                  U5      nUS   nU R                  U/U5      I S h  vN nU R	                  XA5      nUc  [        U R                  S-   U-   5      eU$ [        U R                  S-   5      e N~ NO7f)NfetchTickersr  z, fetchTickers() could not find a ticker for z# fetchTicker() is not supported yet)r   r   marketr  r!  r   r[   r   r@   r  r   r  tickerstickers         rB   fetch_tickerExchange.fetch_tickerv  s     88N###%%%[[(FH%F ..x@@G^^G4F~"477-[#[^d#deetww)NNOO & A"   (B-B)0B-B+AB-+B-c                 ^  #    U R                   S   (       az  U R                  5       I S h  vN   U R                  U5      nUS   nU R                  U/U5      I S h  vN nU R	                  XA5      nUc  [        U R                  S-   U-   5      eU$ [        U R                  S-   5      e N~ NO7f)NfetchMarkPricesr  z/ fetchMarkPrices() could not find a ticker for ' fetchMarkPrices() is not supported yet)r   r   r  fetch_mark_pricesr!  r   r[   r   r  s         rB   fetch_mark_priceExchange.fetch_mark_price  s     88%&##%%%[[(FH%F 22F8VDDG^^G4F~"477-^#^ag#ghhtww)RRSS & Er  c                 ^  #    U R                   S   (       az  U R                  5       I S h  vN   U R                  U5      nUS   nU R                  U/U5      I S h  vN nU R	                  XA5      nUc  [        U R                  S-   U-   5      eU$ [        U R                  S-   5      e N~ NO7f)NfetchTickersWsr  z- fetchTickerWs() could not find a ticker for z% fetchTickerWs() is not supported yet)r   r   r  fetch_tickers_wsr!  r   r[   r   r  s         rB   fetch_ticker_wsExchange.fetch_ticker_ws  s     88$%##%%%[[(FH%F 116(FCCG^^G4F~"477-\#\_e#efftww)PPQQ & Dr  c                 :   #    [        U R                  S-   5      e7f)Nz# watchTicker() is not supported yetr^  r  s      rB   watch_tickerExchange.watch_ticker  r  r  c                 :   #    [        U R                  S-   5      e7fNz$ fetchTickers() is not supported yetr^  r  s      rB   r  Exchange.fetch_tickers  r  r  c                 :   #    [        U R                  S-   5      e7f)Nr  r^  r  s      rB   r  Exchange.fetch_mark_prices  rw  r  c                 :   #    [        U R                  S-   5      e7fr  r^  r  s      rB   r  Exchange.fetch_tickers_ws  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz' fetchOrderBooks() is not supported yetr^  r  s       rB   fetch_order_booksExchange.fetch_order_books  rw  r  c                 :   #    [        U R                  S-   5      e7f)Nz% watchBidsAsks() is not supported yetr^  r  s      rB   watch_bids_asksExchange.watch_bids_asks  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz$ watchTickers() is not supported yetr^  r  s      rB   watch_tickersExchange.watch_tickers  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz& unWatchTickers() is not supported yetr^  r  s      rB   un_watch_tickersExchange.un_watch_tickers  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz" fetchOrder() is not supported yetr^  r@   r[   r  r   s       rB   fetch_orderExchange.fetch_order  r  r  c                 j   #    U R                  USU05      nU R                  SX$5      I Sh  vN $  N7faM  
create a market order by providing the symbol, side and cost
:param str clientOrderId: client order Id
:param str symbol: unified symbol of the market to create an order in
: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   N)rR  r  r@   r!  r  r   extendedParamss        rB    fetch_order_with_client_order_id)Exchange.fetch_order_with_client_order_id  s5      Vo}-MN%%b&AAAAr%  c                 :   #    [        U R                  S-   5      e7f)Nz$ fetchOrderWs() is not supported yetr^  r  s       rB   fetch_order_wsExchange.fetch_order_ws  r  r  c                 L   #    U R                  XU5      I S h  vN nUS   $  N	7f)Nr   )r  )r@   r[   r  r   orders        rB   fetch_order_statusExchange.fetch_order_status  s+      &&r6::X ;s   $"
$c                    #    U R                  U R                  US5      U R                  US5      U5      I S h  vN $  N7fNr[   r  )r  safe_stringr@   r  r   s      rB   fetch_unified_orderExchange.fetch_unified_order  s=     %%d&6&6ud&CTEUEUV[]eEfhnoooos   7A >A c                 :   #    [        U R                  S-   5      e7f)Nz# createOrder() is not supported yetr^  r@   r  r  r  rV  r
  r   s          rB   r  Exchange.create_order  r  r  fromCodetoCodec                 :   #    [        U R                  S-   5      e7f)Nz* createConvertTrade() is not supported yetr^  )r@   r[   r  r  rV  r   s         rB   create_convert_tradeExchange.create_convert_trade  r<  r  c                 :   #    [        U R                  S-   5      e7f)Nz) fetchConvertTrade() is not supported yetr^  rX  s       rB   fetch_convert_tradeExchange.fetch_convert_trade  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz0 fetchConvertTradeHistory() is not supported yetr^  rT  s        rB   fetch_convert_trade_history$Exchange.fetch_convert_trade_history  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz) fetchPositionMode() is not supported yetr^  r  s      rB   fetch_position_modeExchange.fetch_position_mode  r  r  trailingAmounttrailingTriggerPricec	                    #    Uc  [        U R                  S-   5      eXhS'   Ub  XxS'   U R                  S   (       a  U R                  XX4XX5      I Sh  vN $ [	        U R                  S-   5      e N7f)/  
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 argumentr  r  createTrailingAmountOrderz1 createTrailingAmountOrder() is not supported yetr   r[   r   r  r   	r@   r  r  r  rV  r
  r  r  r   s	            rB   create_trailing_amount_order%Exchange.create_trailing_amount_order  sz      !#DGG.o$opp#1 +-A)*88/0**6uUUU477%XXYY V   AA2A0A2c	                    #    Uc  [        U R                  S-   5      eXhS'   Ub  XxS'   U R                  S   (       a  U R                  XX4XX5      I Sh  vN $ [	        U R                  S-   5      e N7f)r  NzA createTrailingAmountOrderWs() requires a trailingAmount argumentr  r  createTrailingAmountOrderWsz3 createTrailingAmountOrderWs() is not supported yetr   r[   r   r(  r   r  s	            rB   create_trailing_amount_order_ws(Exchange.create_trailing_amount_order_ws  sz      !#DGG.q$qrr#1 +-A)*8812--fD%XXX477%ZZ[[ Yr  trailingPercentc	                    #    Uc  [        U R                  S-   5      eXhS'   Ub  XxS'   U R                  S   (       a  U R                  XX4XX5      I Sh  vN $ [	        U R                  S-   5      e N7f),  
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 argumentr  r  createTrailingPercentOrderz2 createTrailingPercentOrder() is not supported yetr  	r@   r  r  r  rV  r
  r  r  r   s	            rB   create_trailing_percent_order&Exchange.create_trailing_percent_order  sz      "#DGG.q$qrr$3 !+-A)*8801**6uUUU477%YYZZ Vr  c	                    #    Uc  [        U R                  S-   5      eXhS'   Ub  XxS'   U R                  S   (       a  U R                  XX4XX5      I Sh  vN $ [	        U R                  S-   5      e N7f)r  NzC createTrailingPercentOrderWs() requires a trailingPercent argumentr  r  createTrailingPercentOrderWsz4 createTrailingPercentOrderWs() is not supported yetr  r  s	            rB    create_trailing_percent_order_ws)Exchange.create_trailing_percent_order_ws#  sz      "#DGG.s$stt$3 !+-A)*8823--fD%XXX477%[[\\ Yr  rM   c                    #    U R                   S   (       d(  U R                   S   (       a1  U R                   S   (       a  U R                  USX#SU5      I Sh  vN $ [        U R                  S-   5      e N7f)  
create a market order by providing the symbol, side and cost
:param str symbol: unified symbol of the market to create an order in
:param str side: 'buy' or 'sell'
: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>`
createMarketOrderWithCostcreateMarketBuyOrderWithCostcreateMarketSellOrderWithCostr  rd  Nz1 createMarketOrderWithCost() is not supported yet)r   r  r   r[   r@   r  r  rM   r   s        rB   create_market_order_with_cost&Exchange.create_market_order_with_cost9  sn      88/0TXX>\5]bfbjbj  lK  cL**68TFSSS477%XXYY T   AA6A4A6c                    #    U R                   S   (       d  U R                  S   (       a  U R                  USSUSU5      I Sh  vN $ [        U R                  S-   5      e N7f)an  
create a market buy order by providing the symbol and cost
: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>`
!createMarketBuyOrderRequiresPricer  r  r  rd  Nz4 createMarketBuyOrderWithCost() is not supported yetr{   r   r  r   r[   r@   r  rM   r   s       rB   !create_market_buy_order_with_cost*Exchange.create_market_buy_order_with_costF  sY      <<;<Ig@h**68UD!VTTT477%[[\\ U   AA#A!A#c                    #    U R                   S   (       d  U R                  S   (       a  U R                  USSUSU5      I Sh  vN $ [        U R                  S-   5      e N7f)ao  
create a market sell order by providing the symbol and cost
: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>`
"createMarketSellOrderRequiresPricer  r  r  rd  Nz5 createMarketSellOrderWithCost() is not supported yetr
  r  s       rB   "create_market_sell_order_with_cost+Exchange.create_market_sell_order_with_costR  sY      <<<=JiAj**68VT1fUUU477%\\]] Vr  c                    #    U R                   S   (       d(  U R                   S   (       a1  U R                   S   (       a  U R                  USX#SU5      I Sh  vN $ [        U R                  S-   5      e N7f)r   createMarketOrderWithCostWscreateMarketBuyOrderWithCostWscreateMarketSellOrderWithCostWsr  rd  Nz3 createMarketOrderWithCostWs() is not supported yet)r   r(  r   r[   r  s        rB    create_market_order_with_cost_ws)Exchange.create_market_order_with_cost_ws^  sn      8812txx@`7afjfnfn  pQ  gR--fhAvVVV477%ZZ[[ Wr  triggerPricec                    #    Uc  [        U R                  S-   5      eXgS'   U R                  S   (       a  U R                  XX4XW5      I Sh  vN $ [	        U R                  S-   5      e N7f)  
create a trigger stop order(type 1)
: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 the number of contracts
:param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders
:param float triggerPrice: the price to trigger the stop order, 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>`
Nz6 createTriggerOrder() requires a triggerPrice argumentr  createTriggerOrderz* createTriggerOrder() is not supported yetr  r@   r  r  r  rV  r
  r  r   s           rB   create_trigger_orderExchange.create_trigger_orderk  sj      #DGG.f$fgg!-~88()**6uUUU477%QQRR V   A
A+A)A+c                    #    Uc  [        U R                  S-   5      eXgS'   U R                  S   (       a  U R                  XX4XW5      I Sh  vN $ [	        U R                  S-   5      e N7f)r  Nz8 createTriggerOrderWs() requires a triggerPrice argumentr  createTriggerOrderWsz, createTriggerOrderWs() is not supported yetr  r  s           rB   create_trigger_order_ws Exchange.create_trigger_order_ws~  sj      #DGG.h$hii!-~88*+--fD%XXX477%SSTT Yr   stopLossPricec                    #    Uc  [        U R                  S-   5      eXgS'   U R                  S   (       a  U R                  XX4XW5      I Sh  vN $ [	        U R                  S-   5      e N7f)  
create a trigger stop loss order(type 2)
: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 the number of contracts
:param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders
:param float stopLossPrice: the price to trigger the stop loss order, 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>`
Nz8 createStopLossOrder() requires a stopLossPrice argumentr%  createStopLossOrderz+ createStopLossOrder() is not supported yetr  r@   r  r  r  rV  r
  r%  r   s           rB   create_stop_loss_orderExchange.create_stop_loss_order  sj       #DGG.h$hii"/88)***6uUUU477%RRSS Vr   c                    #    Uc  [        U R                  S-   5      eXgS'   U R                  S   (       a  U R                  XX4XW5      I Sh  vN $ [	        U R                  S-   5      e N7f)r'  Nz: createStopLossOrderWs() requires a stopLossPrice argumentr%  createStopLossOrderWsz- createStopLossOrderWs() is not supported yetr  r)  s           rB   create_stop_loss_order_ws"Exchange.create_stop_loss_order_ws  sj       #DGG.j$jkk"/88+,--fD%XXX477%TTUU Yr   takeProfitPricec                    #    Uc  [        U R                  S-   5      eXgS'   U R                  S   (       a  U R                  XX4XW5      I Sh  vN $ [	        U R                  S-   5      e N7f)  
create a trigger take profit order(type 2)
: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 the number of contracts
:param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders
:param float takeProfitPrice: the price to trigger the take profit order, 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>`
Nz< createTakeProfitOrder() requires a takeProfitPrice argumentr0  createTakeProfitOrderz- createTakeProfitOrder() is not supported yetr  r@   r  r  r  rV  r
  r0  r   s           rB   create_take_profit_order!Exchange.create_take_profit_order  sk      "#DGG.l$lmm$3 !88+,**6uUUU477%TTUU Vr   c                    #    Uc  [        U R                  S-   5      eXgS'   U R                  S   (       a  U R                  XX4XW5      I Sh  vN $ [	        U R                  S-   5      e N7f)r2  Nz> createTakeProfitOrderWs() requires a takeProfitPrice argumentr0  createTakeProfitOrderWsz/ createTakeProfitOrderWs() is not supported yetr  r4  s           rB   create_take_profit_order_ws$Exchange.create_take_profit_order_ws  sk      "#DGG.n$noo$3 !88-.--fD%XXX477%VVWW Yr   
takeProfitstopLossc	           
         #    U R                  XX4XVXx5      nU R                  S   (       a  U R                  XX4XX5      I Sh  vN $ [        U R                  S-   5      e N7f)	  
create an order with a stop loss or take profit attached(type 3)
: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 the number of contracts
:param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders
:param float [takeProfit]: the take profit price, in units of the quote currency
:param float [stopLoss]: the stop loss price, in units of the quote currency
:param dict [params]: extra parameters specific to the exchange API endpoint
:param str [params.takeProfitType]: *not available on all exchanges* 'limit' or 'market'
:param str [params.stopLossType]: *not available on all exchanges* 'limit' or 'market'
:param str [params.takeProfitPriceType]: *not available on all exchanges* 'last', 'mark' or 'index'
:param str [params.stopLossPriceType]: *not available on all exchanges* 'last', 'mark' or 'index'
:param float [params.takeProfitLimitPrice]: *not available on all exchanges* limit price for a limit take profit order
:param float [params.stopLossLimitPrice]: *not available on all exchanges* stop loss for a limit stop loss order
:param float [params.takeProfitAmount]: *not available on all exchanges* the amount for a take profit
:param float [params.stopLossAmount]: *not available on all exchanges* the amount for a stop loss
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
$createOrderWithTakeProfitAndStopLossNz< createOrderWithTakeProfitAndStopLoss() is not supported yet)$set_take_profit_and_stop_loss_paramsr   r  r   r[   	r@   r  r  r  rV  r
  r;  r<  r   s	            rB   +create_order_with_take_profit_and_stop_loss4Exchange.create_order_with_take_profit_and_stop_loss  s_     * ::6W\jr{88:;**6uUUU477%ccdd V   ?A AA c	           
         #    U R                  XX4XVXx5      nU R                  S   (       a  U R                  XX4XX5      I Sh  vN $ [        U R                  S-   5      e N7f)r>  &createOrderWithTakeProfitAndStopLossWsNz> createOrderWithTakeProfitAndStopLossWs() is not supported yet)r@  r   r(  r   r[   rA  s	            rB   .create_order_with_take_profit_and_stop_loss_ws7Exchange.create_order_with_take_profit_and_stop_loss_ws  s_     * ::6W\jr{88<=--fD%XXX477%eeff YrD  ordersc                 :   #    [        U R                  S-   5      e7f)Nz$ createOrders() is not supported yetr^  r@   rI  r   s      rB   create_ordersExchange.create_orders  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz" editOrders() is not supported yetr^  rK  s      rB   edit_ordersExchange.edit_orders  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz% createOrderWs() is not supported yetr^  r  s          rB   r(  Exchange.create_order_ws  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz# cancelOrder() is not supported yetr^  r  s       rB   r  Exchange.cancel_order  r  r  c                 j   #    U R                  USU05      nU R                  SX$5      I Sh  vN $  N7fr  )rR  r  r  s        rB   !cancel_order_with_client_order_id*Exchange.cancel_order_with_client_order_id  s5      Vo}-MN&&r6BBBBr%  c                 :   #    [        U R                  S-   5      e7f)Nz% cancelOrderWs() is not supported yetr^  r  s       rB   r'  Exchange.cancel_order_ws(  r  r  idsc                 :   #    [        U R                  S-   5      e7f)Nz$ cancelOrders() is not supported yetr^  r@   rZ  r  r   s       rB   cancel_ordersExchange.cancel_orders+  r  r  clientOrderIdsc                 j   #    U R                  USU05      nU R                  / X$5      I Sh  vN $  N7f)aQ  
create a market order by providing the symbol, side and cost
:param str[] clientOrderIds: client order Ids
:param str symbol: unified symbol of the market to create an order in
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
r_  N)rR  r]  )r@   r_  r  r   r  s        rB   #cancel_orders_with_client_order_ids,Exchange.cancel_orders_with_client_order_ids.  s6      V.>-OP''FCCCCr%  c                 :   #    [        U R                  S-   5      e7f)Nz& cancelOrdersWs() is not supported yetr^  r\  s       rB   cancel_orders_wsExchange.cancel_orders_ws9  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz' cancelAllOrders() is not supported yetr^  r  s      rB   cancel_all_ordersExchange.cancel_all_orders<  rw  r  r   c                 :   #    [        U R                  S-   5      e7f)Nz, cancelAllOrdersAfter() is not supported yetr^  )r@   r   r   s      rB   cancel_all_orders_after Exchange.cancel_all_orders_after?  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz. cancelOrdersForSymbols() is not supported yetr^  rK  s      rB   cancel_orders_for_symbols"Exchange.cancel_orders_for_symbolsB  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz) cancelAllOrdersWs() is not supported yetr^  r  s      rB   cancel_all_orders_wsExchange.cancel_all_orders_wsE  r  r  r  c                 p   #    U R                  U R                  US5      U R                  US5      U5      $ 7fr  )r  r  r  s      rB   cancel_unified_orderExchange.cancel_unified_orderH  s7       !1!1%!>@P@PQVX`@acijjr  c                    #    U R                   S   (       a,  U R                   S   (       a  [        U R                  S-   5      e[        U R                  S-   5      e7f)NfetchOpenOrdersfetchClosedOrdersze fetchOrders() is not supported yet, consider using fetchOpenOrders() and fetchClosedOrders() insteadz# fetchOrders() is not supported yetr  r  s        rB   fetch_ordersExchange.fetch_ordersK  sT     88%&4884G+Htww  *Q   Q  R  R477%JJKKs   AAc                 :   #    [        U R                  S-   5      e7f)Nz% fetchOrdersWs() is not supported yetr^  r  s        rB   fetch_orders_wsExchange.fetch_orders_wsP  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz( fetchOrderTrades() is not supported yetr^  )r@   r[   r  r  r  r   s         rB   fetch_order_tradesExchange.fetch_order_tradesS  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz# watchOrders() is not supported yetr^  r  s        rB   watch_ordersExchange.watch_ordersV  r  r  c                    #    U R                   S   (       a-  U R                  XX45      I S h  vN nU R                  USS5      $ [        U R                  S-   5      e N/7f)NfetchOrdersr   ra   z' fetchOpenOrders() is not supported yetr   rx  	filter_byr   r[   r@   r  r  r  r   rI  s         rB   fetch_open_ordersExchange.fetch_open_ordersY  sT     88M",,VEJJF>>&(F;;477%NNOO K   *AA0Ac                    #    U R                   S   (       a-  U R                  XX45      I S h  vN nU R                  USS5      $ [        U R                  S-   5      e N/7f)NfetchOrdersWsr   ra   z) fetchOpenOrdersWs() is not supported yetr   r{  r  r   r[   r  s         rB   fetch_open_orders_wsExchange.fetch_open_orders_ws_  sT     88O$//uMMF>>&(F;;477%PPQQ Nr  c                    #    U R                   S   (       a-  U R                  XX45      I S h  vN nU R                  USS5      $ [        U R                  S-   5      e N/7f)Nr  r   closedz) fetchClosedOrders() is not supported yetr  r  s         rB   fetch_closed_ordersExchange.fetch_closed_orderse  sT     88M",,VEJJF>>&(H==477%PPQQ Kr  c                 :   #    [        U R                  S-   5      e7f)Nz4 fetchCanceledAndClosedOrders() is not supported yetr^  r  s        rB    fetch_canceled_and_closed_orders)Exchange.fetch_canceled_and_closed_ordersk  s     477%[[\\r  c                    #    U R                   S   (       a-  U R                  XX45      I S h  vN nU R                  USS5      $ [        U R                  S-   5      e N/7f)Nr  r   r  z+ fetchClosedOrdersWs() is not supported yetr  r  s         rB   fetch_closed_orders_wsExchange.fetch_closed_orders_wsn  sT     88O$//uMMF>>&(H==477%RRSS Nr  c                 :   #    [        U R                  S-   5      e7f)Nz% fetchMyTrades() is not supported yetr^  r  s        rB   fetch_my_tradesExchange.fetch_my_tradest  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz+ fetchMyLiquidations() is not supported yetr^  r  s        rB   fetch_my_liquidationsExchange.fetch_my_liquidationsw  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz) fetchLiquidations() is not supported yetr^  r  s        rB   fetch_liquidationsExchange.fetch_liquidationsz  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz' fetchMyTradesWs() is not supported yetr^  r  s        rB   fetch_my_trades_wsExchange.fetch_my_trades_ws}  rw  r  c                 :   #    [        U R                  S-   5      e7f)Nz% watchMyTrades() is not supported yetr^  r  s        rB   watch_my_tradesExchange.watch_my_trades  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz# fetchGreeks() is not supported yetr^  r  s      rB   fetch_greeksExchange.fetch_greeks  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz& fetchAllGreeks() is not supported yetr^  r  s      rB   fetch_all_greeksExchange.fetch_all_greeks  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz( fetchOptionChain() is not supported yetr^  rd  s      rB   fetch_option_chainExchange.fetch_option_chain  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz# fetchOption() is not supported yetr^  r  s      rB   fetch_optionExchange.fetch_option  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz) fetchConvertQuote() is not supported yetr^  )r@   r  r  rV  r   s        rB   fetch_convert_quoteExchange.fetch_convert_quote  r  r  c                 :   #    [        U R                  S-   5      e7f)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 structures <https://docs.ccxt.com/#/?id=transaction-structure>`
z0 fetchDepositsWithdrawals() is not supported yetr^  rT  s        rB   fetch_deposits_withdrawals#Exchange.fetch_deposits_withdrawals  s      477%WWXXr  c                 :   #    [        U R                  S-   5      e7f)Nz% fetchDeposits() is not supported yetr^  rT  s        rB   fetch_depositsExchange.fetch_deposits  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz( fetchWithdrawals() is not supported yetr^  rT  s        rB   fetch_withdrawalsExchange.fetch_withdrawals  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz' fetchDepositsWs() is not supported yetr^  rT  s        rB   fetch_deposits_wsExchange.fetch_deposits_ws  rw  r  c                 :   #    [        U R                  S-   5      e7f)Nz* fetchWithdrawalsWs() is not supported yetr^  rT  s        rB   fetch_withdrawals_wsExchange.fetch_withdrawals_ws  r<  r  c                 :   #    [        U R                  S-   5      e7f)Nz/ fetchFundingRateHistory() is not supported yetr^  r  s        rB   fetch_funding_rate_history#Exchange.fetch_funding_rate_history  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz+ fetchFundingHistory() is not supported yetr^  r  s        rB   fetch_funding_historyExchange.fetch_funding_history  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz% closePosition() is not supported yetr^  )r@   r  r  r   s       rB   close_positionExchange.close_position  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz) closeAllPositions() is not supported yetr^  r
  s     rB   close_all_positionsExchange.close_all_positions  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz( fetchL3OrderBook() is not supported yet)r   r[   r  s       rB   fetch_l3_order_bookExchange.fetch_l3_order_book  s     #MMNNr  c                 J  #    U R                   S   (       aO  U R                  U/U5      I S h  vN nU R                  X15      nUc  [        U R                  S-   U-   S-   5      eU$ U R                   S   (       a  U R                  US5      nU R                  US5      nU R                  X5      I S h  vN nUb  U R                  Xe5      $ [        UR                  5       5      nU R                  US5      nU R                  Xh5      $ [        U R                  S-   5      e N Nn7f)NfetchDepositAddressesz< fetchDepositAddress() could not find a deposit address for zc, make sure you have created a corresponding deposit address in your wallet on the exchange websitefetchDepositAddressesByNetworknetworkr   z+ fetchDepositAddress() is not supported yet)r   r  rQ  r   r[   r  omitr  r!  r   keysr   )	r@   rU  r   depositAddressesdepositAddressr  addressStructuresr  keys	            rB   fetch_deposit_addressExchange.fetch_deposit_address  s#    88+,%)%A%A4&&%QQ!__-=DN%$TWW/m%mpt%t  x]  &]  ^  ^%%XX67&&vy9GYYvy1F&*&M&Md&[ ["~~&7AA-2245&&tQ/~~&7==tww)VVWW#  R !\s#   +D#DBD#2D!3A-D#!D#c                 F   #    U R                  USX#XE5      I S h  vN $  N7fr  r  r@   r  r  rV  r
  r   s         rB   create_limit_orderExchange.create_limit_order  s"     &&vweTTTTr  c                 F   #    U R                  USX#XE5      I S h  vN $  N7fr  r(  r  s         rB   create_limit_order_wsExchange.create_limit_order_ws  s"     ))&'4WWWWr  c                 F   #    U R                  USX#XE5      I S h  vN $  N7fNr  r  r  s         rB   create_market_orderExchange.create_market_order  s"     &&vxuUUUUr  c                 F   #    U R                  USX#XE5      I S h  vN $  N7fr  r  r  s         rB   create_market_order_wsExchange.create_market_order_ws  s"     ))&(D%XXXXr  c                 H   #    U R                  USSX#U5      I S h  vN $  N7fNr  r  r  r@   r  rV  r
  r   s        rB   create_limit_buy_orderExchange.create_limit_buy_order  s$     &&vwvfUUUU   " "c                 H   #    U R                  USSX#U5      I S h  vN $  N7fr  r  r  s        rB   create_limit_buy_order_ws"Exchange.create_limit_buy_order_ws  s%     ))&'5&QWXXXXr  c                 H   #    U R                  USSX#U5      I S h  vN $  N7fNr  r  r  r  s        rB   create_limit_sell_order Exchange.create_limit_sell_order  s$     &&vwvVVVVr  c                 H   #    U R                  USSX#U5      I S h  vN $  N7fr  r  r  s        rB   create_limit_sell_order_ws#Exchange.create_limit_sell_order_ws  s%     ))&'66RXYYYYr  c                 J   #    U R                  USSUS U5      I S h  vN $  N7fNr  r  r  ry  s       rB   create_market_buy_order Exchange.create_market_buy_order  s&     &&vxfUUUU   #!#c                 J   #    U R                  USSUS U5      I S h  vN $  N7fr  r  ry  s       rB   create_market_buy_order_ws#Exchange.create_market_buy_order_ws  s'     ))&(E64QWXXXXr  c                 J   #    U R                  USSUS U5      I S h  vN $  N7fNr  r  r  ry  s       rB   create_market_sell_order!Exchange.create_market_sell_order  s&     &&vxvVVVVr  c                 J   #    U R                  USSUS U5      I S h  vN $  N7fr  r  ry  s       rB   create_market_sell_order_ws$Exchange.create_market_sell_order_ws  s'     ))&(FFDRXYYYYr  c                    #    U R                  U5      I S h  vN nU R                  5       nX2-
  U R                  S'   U R                  S   $  N47f)NtimeDifference)r6  r   r{   )r@   r   
serverTimerr  s       rB   load_time_differenceExchange.load_time_difference  sK     ??622
!!#).);%&||,-- 3s   AA5Ac                 "  #    U R                   S   (       a^  U R                  U5      nUS   (       d  [        U R                  S-   5      eU R	                  U/5      I S h  vN nU R                  XA5      $ [        U R                  S-   5      e N-7f)NfetchLeverageTierscontractz: fetchMarketLeverageTiers() supports contract markets onlyz0 fetchMarketLeverageTiers() is not supported yet)r   r  r   r[   rD  rQ  r   )r@   r  r   r  tierss        rB   fetch_market_leverage_tiers$Exchange.fetch_market_leverage_tiers  s{     88()[[(F*%*f fgg33VH==E??511tww)[[\\ >s   ABB .Bc                    #    U R                   S   (       d  [        U R                  S-   5      eU R                  USS05      nU R	                  XX4XW5      I S h  vN $  N7f)NcreatePostOnlyOrderz+ createPostOnlyOrder() is not supported yetpostOnlyTr   r   r[   rR  r  r@   r  r  r  rV  r
  r   querys           rB   create_post_only_orderExchange.create_post_only_order  sW     xx-.tww)VVWWFZ$67&&vT5PPPP   AA AA c                    #    U R                   S   (       d  [        U R                  S-   5      eU R                  USS05      nU R	                  XX4XW5      I S h  vN $  N7f)NcreatePostOnlyOrderWsz- createPostOnlyOrderWs() is not supported yetr  Tr   r   r[   rR  r(  r   s           rB   create_post_only_order_ws"Exchange.create_post_only_order_ws  sW     xx/0tww)XXYYFZ$67))&eSSSSr$  c                    #    U R                   S   (       d  [        U R                  S-   5      eU R                  USS05      nU R	                  XX4XW5      I S h  vN $  N7f)NcreateReduceOnlyOrderz- createReduceOnlyOrder() is not supported yet
reduceOnlyTr  r   s           rB   create_reduce_only_order!Exchange.create_reduce_only_order  sW     xx/0tww)XXYYF\4$89&&vT5PPPPr$  c                    #    U R                   S   (       d  [        U R                  S-   5      eU R                  USS05      nU R	                  XX4XW5      I S h  vN $  N7f)NcreateReduceOnlyOrderWsz/ createReduceOnlyOrderWs() is not supported yetr,  Tr'  r   s           rB   create_reduce_only_order_ws$Exchange.create_reduce_only_order_ws  sW     xx12tww)ZZ[[F\4$89))&eSSSSr$  c                    #    U R                   S   (       d  [        U R                  S-   5      eUc  [        U R                  S-   5      eU R	                  USU05      nU R                  XX4XX5      I S h  vN $  N7f)NcreateStopOrderz' createStopOrder() is not supported yetz2 create_stop_order() requires a stopPrice argument	stopPrice)r   r   r[   r   rR  r  	r@   r  r  r  rV  r
  r  r   r!  s	            rB   create_stop_orderExchange.create_stop_order  sr     xx)*tww)RRSS#DGG.b$bccF[,$?@&&vT5PPPP   A2A;4A95A;c                    #    U R                   S   (       d  [        U R                  S-   5      eUc  [        U R                  S-   5      eU R	                  USU05      nU R                  XX4XX5      I S h  vN $  N7f)NcreateStopOrderWsz) createStopOrderWs() is not supported yetz2 createStopOrderWs() requires a stopPrice argumentr5  )r   r   r[   r   rR  r(  r6  s	            rB   create_stop_order_wsExchange.create_stop_order_ws!  sr     xx+,tww)TTUU#DGG.b$bccF[,$?@))&eSSSSr9  c                    #    U R                   S   (       d  [        U R                  S-   5      eU R                  USU05      nU R	                  USX#XG5      I S h  vN $  N7f)NcreateStopLimitOrderz, createStopLimitOrder() is not supported yetr5  r  r  r@   r  r  rV  r
  r  r   r!  s           rB   create_stop_limit_order Exchange.create_stop_limit_order)  sY     xx./tww)WWXXF[,$?@&&vweSSSS   AA!AA!c                    #    U R                   S   (       d  [        U R                  S-   5      eU R                  USU05      nU R	                  USX#XG5      I S h  vN $  N7f)NcreateStopLimitOrderWsz. createStopLimitOrderWs() is not supported yetr5  r  r'  r@  s           rB   create_stop_limit_order_ws#Exchange.create_stop_limit_order_ws/  sY     xx01tww)YYZZF[,$?@))&'4VVVVrC  c                    #    U R                   S   (       d  [        U R                  S-   5      eU R                  USU05      nU R	                  USX#S U5      I S h  vN $  N7f)NcreateStopMarketOrderz- createStopMarketOrder() is not supported yetr5  r  r  r@   r  r  rV  r  r   r!  s          rB   create_stop_market_order!Exchange.create_stop_market_order5  s[     xx/0tww)XXYYF[,$?@&&vxtUSSSS   AA"A A"c                    #    U R                   S   (       d  [        U R                  S-   5      eU R                  USU05      nU R	                  USX#S U5      I S h  vN $  N7f)NcreateStopMarketOrderWsz/ createStopMarketOrderWs() is not supported yetr5  r  r'  rJ  s          rB   create_stop_market_order_ws$Exchange.create_stop_market_order_ws;  s\     xx12tww)ZZ[[F[,$?@))&(D$PUVVVVrM  c                 :   #    [        U R                  S-   5      e7f)Nz' fetchLastPrices() is not supported yetr^  r  s      rB   fetch_last_pricesExchange.fetch_last_pricesA  rw  r  c                 :   #    [        U R                  S-   5      e7f)Nz( fetchTradingFees() is not supported yetr^  r
  s     rB   fetch_trading_feesExchange.fetch_trading_feesD  r  r  c                 :   #    [        U R                  S-   5      e7f)Nz* fetchTradingFeesWs() is not supported yetr^  r
  s     rB   fetch_trading_fees_wsExchange.fetch_trading_fees_wsG  r<  r  c                    #    U R                   S   (       d  [        U R                  S-   5      eU R                  U5      I S h  vN nU R	                  X15      $  N7f)NfetchTradingFeesz' fetchTradingFee() is not supported yet)r   r   r[   rV  r!  )r@   r  r   r  s       rB   fetch_trading_feeExchange.fetch_trading_feeJ  sN     xx*+tww)RRSS,,V44~~d++ 5s   AAAAc                 :   #    [        U R                  S-   5      e7f)Nz. fetchConvertCurrencies() is not supported yetr^  r
  s     rB   fetch_convert_currencies!Exchange.fetch_convert_currenciesP  r  r  c                   #    U R                   S   (       a  U R                  5       I S h  vN   U R                  U5      nUS   nUS   (       d  [        U R                  S-   5      eU R                  U/U5      I S h  vN nU R                  XA5      nUc  [        U R                  S-   U-   5      eU$ [        U R                  S-   5      e N NO7f)NfetchFundingRatesr  r  z2 fetchFundingRate() supports contract markets onlyz) fetchFundingRate() returned no data for z( fetchFundingRate() is not supported yet)	r   r   r  r   r[   rG  rQ  r   r   r@   r  r   r  ratesr  s         rB   fetch_funding_rateExchange.fetch_funding_rateS  s     88'(##%%%[[(FH%F*%*^ ^__22F8VDDE??51D|"477-X#X[a#abbtww)SSTT &
 E#   (CCAC=C>ACCc                   #    U R                   S   (       a  U R                  5       I S h  vN   U R                  U5      nUS   nUS   (       d  [        U R                  S-   5      eU R                  U/U5      I S h  vN nU R                  XA5      nUc  [        U R                  S-   U-   5      eU$ [        U R                  S-   5      e N NO7f)NfetchFundingIntervalsr  r  z6 fetchFundingInterval() supports contract markets onlyz- fetchFundingInterval() returned no data for z, fetchFundingInterval() is not supported yet)	r   r   r  r   r[   rJ  rQ  r   r   rd  s         rB   fetch_funding_intervalExchange.fetch_funding_intervalc  s     88+,##%%%[[(FH%F*%*b bcc66xHHE??51D|"477-\#\_e#efftww)WWXX &
 Irh  c           
         #    U R                   S   (       a.  SS0nU R                  XX4U R                  Xe5      5      I Sh  vN $ [        U R                  S-   5      e N7f)a  
fetches historical mark price candlestick data containing the open, high, low, and close price 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]: the maximum amount of candles to fetch
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns float[][]: A list of candles ordered, open, high, low, close, None
fetchMarkOHLCVr
  markNz& fetchMarkOHLCV() is not supported yetr   r  rR  r   r[   r@   r  r  r  r  r   r  s          rB   fetch_mark_ohlcvExchange.fetch_mark_ohlcvs  s_      88$%G ))&U4;;W^Kghhhtww)QQRR i   >A AAc           
         #    U R                   S   (       a.  SS0nU R                  XX4U R                  Xe5      5      I Sh  vN $ [        U R                  S-   5      e N7f)a6  
       fetches historical index price candlestick data containing the open, high, low, and close price 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]: the maximum amount of candles to fetch
       :param dict [params]: extra parameters specific to the exchange API endpoint
@returns {} A list of candles ordered, open, high, low, close, None
       fetchIndexOHLCVr
  r  Nz' fetchIndexOHLCV() is not supported yetrp  rq  s          rB   fetch_index_ohlcvExchange.fetch_index_ohlcv  s_      88%&G ))&U4;;W^Kghhhtww)RRSS irt  c           
         #    U R                   S   (       a.  SS0nU R                  XX4U R                  Xe5      5      I Sh  vN $ [        U R                  S-   5      e N7f)a  
fetches historical premium index price candlestick data containing the open, high, low, and close price 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]: the maximum amount of candles to fetch
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns float[][]: A list of candles ordered, open, high, low, close, None
fetchPremiumIndexOHLCVr
  premiumIndexNz. fetchPremiumIndexOHLCV() is not supported yetrp  rq  s          rB   fetch_premium_index_ohlcv"Exchange.fetch_premium_index_ohlcv  s_      88,-G ))&U4;;W^Kghhhtww)YYZZ irt  c                    #    U R                   S   (       a  U R                  XX45      I Sh  vN $ [        U R                  S-   5      e N7f)a0  
@deprecated
       *DEPRECATED* use fetchDepositsWithdrawals instead
       :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 structures <https://docs.ccxt.com/#/?id=transaction-structure>`
       fetchDepositsWithdrawalsNz) fetchTransactions() is not supported yet)r   r  r   r[   rT  s        rB   fetch_transactionsExchange.fetch_transactions  sE      88./88eTTTtww)TTUU Us   *AA	Ar   maxEntriesPerRequestc                   #    S nU R                  XQSS5      u  pS n	U R                  XQSS5      u  pS n
U R                  XQSS5      u  pS nUnU R                  XQSU5      u  pSn/ nSnU R                  U/ S	Q5      nU R                  XU5      u  peU
S
:X  a  Uc  [        U R                  S-   5      eUnX:  Ga  US-  n U
S:X  a  Ub  US-
  US'   [        X5      " US Xe5      I S h  vN n[        U5      nU R                  (       aZ  SU R                  U5      -   S-   U-   S-   U R                  U5      -   nUb  USU R                  U5      -   -  nU R                  U5        US:X  a  GO*SnU R                  UU5      nU R                  US5      nU R                  USS5      nUb  X::  a  OO[        X5      " X+Xe5      I S h  vN n[        U5      nU R                  (       aZ  SU R                  U5      -   S-   U-   S-   U R                  U5      -   nUb  USU R                  U5      -   -  nU R                  U5        US:X  a  OPSnU R                  UU5      nU R                  UUS-
  5      nU R                  US5      S-   nUb  UU:  a  OX:  a  GM  UnU(       a  U R                  U5      nUS:X  a  SOSnU R!                  UX4U5      $  GN GN! [         a  nUS-  nX:  a  Ue S nAN`S nAff = f7f)NpaginationCallsr  r  r^   paginationDirectionbackwardremoveRepeatedr   )untiluntilltillforwardzM pagination requires a since argument when paginationDirection set to forwardrd  r  zDynamic pagination call  method  response length z timestamp 	timestamp
fetchOHLCV)r  safe_integer_n)handle_max_entries_per_request_and_paramsr   r[   r   r  r   number_to_stringr   array_concatrQ  safe_integer_2safe_integerr   #remove_repeated_elements_from_arrayfilter_by_since_limit)r@   r   r  r  r  r   r  r  maxCallsr  r  paginationTimestampremoveRepeatedOptioncallsr   r   r  r   responseLengthbackwardMessagefirstElementforwardMessagelastr   uniqueResultsr  s                             rB   fetch_paginated_call_dynamic%Exchange.fetch_paginated_call_dynamic  s    88IZ\^_
!::6<YZ[
"&*&C&CFTiku&v#"-'+'D'DVUegu'v$##F,GH'+'U'UV\tz'{$9,}'  3B  )B  C  C"'QJE)&*4 +6*=*Aw%,T%:64I]%ffH%(]N||*DtG\G\]bGc*cfp*psy*y  }P  +P  SW  Sh  Sh  iw  Sx  +x.:+}t?T?TUh?i/iiO1%*F!..vx@F#'??8Q#?L*.*=*=lKYZ*[')0C0L &-T%:6Xl%uuH%(]N||)CdF[F[\aFb)beo)orx)x  |O  *O  RV  Rg  Rg  hv  Rw  *w.:*md>S>STg>h.hhN0%*F!..vx@F??8^a5GHD*.*;*;D+*NQR*R')0Cu0LO X  DDVLMl*a))-sKKQ  g"  v  !&G 's   B;K2>'K %K	&B K &K2(AK )K2+K  KB K K2AK 	K27K2	K K 
K/K*%K2*K//K2c                 \  #    S nU R                  XaSS5      u  pvSnX::  aC   U(       a!  US:w  a  [        X5      " X%X4U5      I S h  vN $ [        X5      " X#XF5      I S h  vN $ / $  N  N! [         a-  n	[        U	[        5      (       a  U	eUS-  nX:  a  U	e S n	A	OS n	A	ff = fX::  a  M  NH7f)Nr  r^   r   fetchFundingRateHistoryrd  )r  r   r   r   r   )
r@   r   r  r  r  r  r   r  r   r   s
             rB   safe_deterministic_call Exchange.safe_deterministic_call  s     
!::6<YZ[
"
+D!D!(!6v%X^!___!(!6ve!TTT 	 `T a!233G!&G '	 "s^   B,#A* A&A* 	B,
A* A( A* #B,&A* (A* *
B!4#BB,B!!B,c                   #    S nU R                  XaSS5      u  pU R                  XU5      u  pvU R                  5       n	/ n
U R                  U5      S-  nX-  nXU-  -
  S-
  nUb  [	        X5      nO[	        US5      nU R                  USS5      nUb\  [        [        R                  " X-
  5      U-  5      nX:  a3  [        U R                  S-   [        U5      -   S	-   [        U5      -   5      e[        S
U5       HJ  nUb  X:  a    OAX:  a    O:U
R                  U R                  XXXV5      5        U R                  X5      S-
  nML     [         R"                  " U
6 I S h  vN n/ n[        S
[%        U5      5       H  nU R'                  UUU   5      nM     U R)                  U5      nUS:X  a  S
OSnU R+                  UX4U5      $  Ne7f)Nr  r  r   rd  l   82>r  r  z the number of required calls is greater than the max number of calls allowed, either increase the paginationCalls or decrease the since-until gap. Current paginationCalls limit is z required calls is r   r  r  )r  r  r   parse_timeframemaxr  intmathceilr   r[   r  r)  rw  r  sumrv   gatherr  r  r  r  )r@   r   r  r  r  r  r   r  r  currenttaskstimestepcurrentSincer  requiredCallsr+  resultsr   r  r  s                        rB   "fetch_paginated_call_deterministic+Exchange.fetch_paginated_call_deterministic  s    88IZ\^_'+'U'UV\tz'{$##%##I.5*T/2Q6|3L|];L##FGV<		5= :T ABM'   ,c  "c  fi  jr  fs  "s  vK  "K  NQ  R_  N`  "`  a  aq(#A!(=&LL55fljs|}88L7!;L $  ..q#g,'A&&vwqz:F (@@Hl*a))-sKK /s   EGG A&Gc
                 &  #    S n
U R                  XQSS5      u  pS nU R                  XQSS5      u  pU R                  XU5      u  pS nSnSn/ nU R                  US5      nU R                  US5      nX:  Ga   Ub  Ub  U R	                  U5      U-   nXU'   S nUS:X  a  [        X5      " U5      I S h  vN nOcUS:X  d  US	:X  a  [        X5      " X%5      I S h  vN nO=US
:X  a  [        X5      " UUX9U5      I S h  vN nO[        X5      " X#X5      I S h  vN nSn[        U5      nU R                  (       aF  Uc  SOUnUS-   nS[        U5      -   S-   U-   S-   [        U5      -   S-   U-   nU R                  U5        US:X  a  OU R                  UU5      nU R                  UUS-
  5      nS n[        SU5       HH  nUU-
  S-
  nU R                  UU5      nU R                  US5      nU R                  UU5      nUc  MF  Un  O   Uc  O)U R                  US5      nUb  UU:  a  OUS-  nX:  a  GM  U R!                  U5      nUS:X  a  SOSnU R#                  UX4U5      $  GN GN GNm GNU! [         a  nUS-  nX:  a  Ue S nANbS nAff = f7f)Nr  r  r  r^   r   r  fetchAccountsgetLeverageTiersPaginatedfetchPositionsfetchOpenInterestHistoryr   rd  zCursor pagination call r  r  z cursor infor  r  )r  r  r  r  parse_to_intr   r  r   r  r   r  r!  r)  rQ  r  r   sort_cursor_paginated_resultr  ) r@   r   r  r  r  r   cursorReceived
cursorSentcursorIncrementr  r  r  cursorValuer+  r   r   r  r   r  cursorString	iterationcursorMessager  jr  entryr  cursorlastTimestampr   sortedr  s                                    rB   fetch_paginated_call_cursor$Exchange.fetch_paginated_call_cursor0  s
    88IZ\^_
!::6<YZ[
'+'U'UV\tz'{$$$V[9	6;/l+*&2&*&7&7&D&V)4:&_,%,T%:6%BBH::fHX>X%,T%:6%JJH99%,T%:69ekq%rrH%,T%:6J^%ggH!$X<<*5*=2KL!"QI$=I$NQ[$[^d$dgz$z  ~A  BP  ~Q  %Q  T^  %^  am  %mMHH]+!Q&**68<~~h0BC"q.1A*Q.2E NN8U;E>>%8D!__T>BF)&, 2 & $ 1 1$ D ,1F
 FA[ l\ 226:l*a))&%DDQ  CJrg6  !&G 's   A5J8:I. 2I"3%I. I%"I. ;I(<I. I+A.I. JA7I. 	I. 
JI. &J4.J"I. %I. (I. +I. .
J8J	J	JJc                   #    S nU R                  XQSS5      u  pS n	U R                  XQSS5      u  pU R                  XU5      u  puSn
Sn/ nX:  a   U
S-   XV'   [        X5      " X#Xu5      I S h  vN nSn[        U5      nU R                  (       a9  U
[        S5      -   nSU-   S-   U-   S	-   [        U5      -   nU R                  U5        US:X  a  OU R                  X5      nU
S-  n
X:  a  M  U R                  U5      nUS
:X  a  SOSnU R                  UX4U5      $  N! [         a  nUS-  nX:  a  Ue S nANWS nAff = f7f)Nr  r  r  r^   r   rd  zIncremental pagination call r  r  r  r  )r  r  r   r  r   r  r   r  r   r  r  )r@   r   r  r  r  r   pageKeyr  r  r  r+  r   r   r   r  r  incrementalMessager   r  r  s                       rB    fetch_paginated_call_incremental)Exchange.fetch_paginated_call_incrementaln  s    88IZ\^_
!::6<YZ[
'+'U'UV\tz'{$l"#a%!(!6vFZ!cc!$X<<!"SVI)G))SV`)`ci)il)  CF  GU  CV  *V&HH/0!Q&**6<
 FA# l$ 226:l*a))&%DD# d  !&G 'sU   AE D -D.A!D E D !
E -.E D 
D='D83E 8D==E c                    #    U R                   S   (       a  U R                  U/X#U5      I Sh  vN nU$ [        U R                  S-   5      e N7f)  
fetches the history of margin added or reduced from contract isolated positions
:param str [symbol]: unified market symbol
:param int [since]: timestamp in ms of the position
:param int [limit]: the maximum amount of candles to fetch, default=1000
:param dict params: extra parameters specific to the exchange api endpoint
:returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
fetchPositionsHistoryNz, fetchPositionHistory() is not supported yet)r   fetch_positions_historyr   r[   )r@   r  r  r  r   	positionss         rB   fetch_position_historyExchange.fetch_position_history  sO      88+,"::F8USYZZItww)WWXX [s   ,AAAc                 :   #    [        U R                  S-   5      e7f)r  z- fetchPositionsHistory() is not supported yetr^  r  s        rB   r   Exchange.fetch_positions_history  s      477%TTUUr  c                 :   #    [        U R                  S-   5      e7f)z
fetches a transfer
:param str id: transfer id
:param [str] code: unified currency code
:param dict params: extra parameters specific to the exchange api endpoint
:returns dict: a `transfer structure <https://docs.ccxt.com/#/?id=transfer-structure>`
z% fetchTransfer() is not supported yetr^  rX  s       rB   fetch_transferExchange.fetch_transfer  s      477%LLMMr  c                 :   #    [        U R                  S-   5      e7f)aT  
fetches a transfer
:param str id: transfer id
:param int [since]: timestamp in ms of the earliest transfer to fetch
:param int [limit]: the maximum amount of transfers to fetch
:param dict params: extra parameters specific to the exchange api endpoint
:returns dict: a `transfer structure <https://docs.ccxt.com/#/?id=transfer-structure>`
z& fetchTransfers() is not supported yetr^  rT  s        rB   fetch_transfersExchange.fetch_transfers  s      477%MMNNr  c                 :   #    [        U R                  S-   5      e7f)a  
watches 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 dict [params]: extra parameters specific to the exchange API endpoint
:returns int[][]: A list of candles ordered, open, high, low, close, volume
z$ unWatchOHLCV() is not supported yetr^  r  s       rB   un_watch_ohlcvExchange.un_watch_ohlcv  s      477%KKLLr  c                 :   #    [        U R                  S-   5      e7f)a  
watches a mark price for a specific market
:param str symbol: unified symbol of the market to fetch the ticker for
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
z& watchMarkPrice() is not supported yetr^  r  s      rB   watch_mark_priceExchange.watch_mark_price        477%MMNNr  c                 :   #    [        U R                  S-   5      e7f)a  
watches the mark price for all markets
:param str[] symbols: unified symbol of the market to fetch the ticker for
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
z' watchMarkPrices() is not supported yetr^  r  s      rB   watch_mark_pricesExchange.watch_mark_prices        477%NNOOr  c                 :   #    [        U R                  S-   5      e7f)aN  
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 bitvavo api endpoint
:returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
z" withdrawWs() is not supported yetr^  r`  s         rB   withdraw_wsExchange.withdraw_ws  s      477%IIJJr  c                 :   #    [        U R                  S-   5      e7f)a/  
unWatches information on multiple trades made by the user
:param str symbol: unified market symbol of the market orders were made in
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
z' unWatchMyTrades() is not supported yetr^  r  s      rB   un_watch_my_tradesExchange.un_watch_my_trades  r  r  c                 :   #    [        U R                  S-   5      e7f)ad  
create a list of trade orders
: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>`
z& createOrdersWs() is not supported yetr^  rK  s      rB   create_orders_wsExchange.create_orders_ws  r  r  r   c                 :   #    [        U R                  S-   5      e7f)a  
watches 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
z- fetchOrdersByStatusWs() is not supported yetr^  )r@   r   r  r  r  r   s         rB   fetch_orders_by_status_ws"Exchange.fetch_orders_by_status_ws  s      477%TTUUr  c                 :   #    [        U R                  S-   5      e7f)a  
unWatches best bid & ask for symbols
:param str[] symbols: unified symbol of the market to fetch the ticker for
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
z' unWatchBidsAsks() is not supported yetr^  r  s      rB   un_watch_bids_asksExchange.un_watch_bids_asks 	  r  r  )r  r  r   r3   r2   r6   rL  r  r   r   r  r   r  r   r  r>   r8   r?   r5   rX   rx   r   r;   r4   rF   )r   NN)F)NNN)NN(=  __name__
__module____qualname____firstlineno__synchronousrS  rJ  
newUpdatesrL  r   r   r=   rH   rN   rQ   rU   r\   rt   ru   rb   ri   ra   re   r   r   r   r   r   r   r  r   r   r  r  r   r$  r2  staticmethodr   r   r    r?  rB  rF  rW  r[  rM  r  r  rP  rN  rO  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   r-  r0  r3  r6  r:  r>  rA  rD  rG  rJ  rM  rP  rS  floatrZ  ra  re  r  ri  ro  rm  boolru  rz  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#  r)  r,  r/  r2  r5  r8  r=  rA  rE  rH  rK  rN  rQ  rU  rY  r\  r_  rb  rg  rl  rq  ru  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  r  r  r  r  r  r  r  r  r  r#  r*  r.  r5  r9  rB  rG  r   rL  rO  r(  r  rV  r'  r]  ra  rd  rg  rj  r   rm  rp  r   rs  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  r  r  r  r  r  r  r  r  r  r   r  r  r  r  r  r  r"  r(  r-  r1  r7  r<  rA  rF  rK  rP  rS  rV  rY  r]  r`  rf  rk  rr  rw  r|  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  __static_attributes____classcell__)rA   s   @rB   r   r   D   s$   KI DJGO13 
' 
' 
'!H*l 6!		I*/0-o b5" 05R 5  ).b %N  *, + -/  37d$WY P 04B 98
       #%D * +-D 1 +-D 1!4W%N)V
)-& HLTV S2
2T +- N <@d[] L LS L L ?CQU^` NC N N3 N BFTXac Rs R3 Rc R
 UYgktv \DI \c \ad \ EIW[df T# Tc TQT T
 X\jnwy ^tCy ^QT ^dg ^ <@d[] L LS L L 37r NC N 9; NC N OSaenp Vd3i V V[^ V LN Xc X RVdhqs Xc X3 X^a X OSaenp Vd3i V V[^ V aesw  AC U$tCy/ UZ] Ump U ^` WT$s)_ W SW_a Y$s) YC Y PR [T#Y [ ;?r Q Q 9; NC N =? Q Q =A R' R >B" V7 V @DB OS O O CGr Q QC Q ;= Tc T ;?r Q Q >B" 	 @DB OS O O =? Q Q ') J =A S' S 57 V 8: Y =A S' S <@ R R @DB VW V <> Qs Q DF Rc R PR ?T#Y ? ac I3 I IC ITW I QU]_ I3 I I I# I >@ U U ?C2 L3 L L 8: R3 R 8<B OW O CGr Pd PC P CE Js JE J FH M# Mu M CE Js JE J JNVX T3 T3 T BFX\ko  C  LN [3 [RU [eh [x{ [ CGTXgkz~  HJ 
]C 
]c 
]ad 
]tw 
] DHPR N NS N JL _S _ OSaetx  BD Y Y Y[^ Ynq Y =? R R =A S' S $& G 24 T HJ KC K K IK MS M% M Y[ P# PS P% P JL Nc N5 N Z\ Q3 Qc Q5 Q KOWY B BU BC B JNVX s E 3  ?CQUdhqs U U U3 U^a U BFTXgktv v3 v3 vc vad v ?CQUdhqs K K K3 K^a K+,Z CGr  C  <@VX   -5U2^bpt} c X[ jm : .6eB_cqu  A Ss SY\ Skn S */r 	 \`hj US U# Uu UUX U ]aik Vc V3 V VVY V imuw W Wc W WTY Wbe W fjx|  FH R3 R R9 RI R_b Rru R FJ  Y]  fh C3 CPS C[d Clu C  @C C  SV C im{  IK Uc U3 Ui Uy Ube Uux U 8: N3 N ;= Pc P 26b N3 N 8<$]ajl OW OC OWZ O CGUYhluw I Is Ibe I DF Xs X GI X# X 8<B OW O ;?r O O =A S' S 8<B NW N 7;$]apt} T TC TWZ Tjm T .2SW`b Ls L# LS L =A Q3 Qc Q *, M -/ O *, M 8:  /1 @ /1 @ 02 A )+ L =? A A
 =A U' U BFb Yw Y BD +S + ?A #  DF s  68 P P :< TS T 9; RC R 68 L L 6:" M7 M :>b Pw P 9=R Mg M :>DY[ Pw Pc P 8<B NW N 6:" M7 M 9=R Og O 8<B KC K K X\df 	BC 	BQT 	B ;?r Ms MC M ?C2 3   79 p mqy{ L LI LY LX] Lfi L ]aik SS SC S SVY S >B" RC Rs R =Atbfoq Yc Y Y\_ Y 7;2 R R }A  Y]  {  HJ Z ZI ZU^ Zhm Zvy Z  SV Z  ux Z, @D  \`  ~B  KM \C \y \Xa \kp \y| \  VY \  x{ \, ~B  [_  }A  JL [# [Y [V_ [in [wz [  UX [  wz [, AE  ^b  @D  MO ]S ]	 ]Yb ]lq ]z} ]  X[ ]  z} ], eg Z# ZY ZV[ Z XZ 
]c 
] 
] Y[ 
^s 
^% 
^ hj \S \	 \Y^ \ uy  OS  \^ S SI SY S`e Snq S  IL S& x|  RV  _a UC Uy UPY Uch Uqt U  LO U& w{  RV  _a T3 Ti Ty Tbg Tps T  LO T& z~  UY  bd Vc V VR[ Vej Vsv V  OR V& y}  VZ  ce VS V	 VQZ Vdi Vru V  PS V& |@  Y]  fh X X9 XT] Xgl Xux X  SV X& LP  dh  z~  GI e eS\ edm ew| e  FI e  ^a e  tw e4 OS  gk  }A  JL g3 gV_ ggp gz g  IL g  ad g  wz g4 FH M$|*< M DF K\(: K pt|~ NC Ny N	 N[` Nil N 9=R LS L# L Y]eg 	CS 	CRU 	C <@ N NS N AER MtCy M# M bfnp 	DS	 	D[^ 	D DHPR O$s) OS O 59 Pc P BD US U Y[ Wd;N6O W 8<B R R ?A k k 04$UYbd L LC Ls L
 37TX\eg NC Ns NRU N ?CQUdhqs Q3 Q Q3 Q^a Q 04$UYbd L LC Ls L 59tZ^gi Pc P PTW P 8<$]ajl R RC RWZ R 7;\`ik R R3 RVY R DHVZimvx ]S ]PS ]cf ] :>D_cln T3 Tc TY\ T 37TX\eg NC Ns NRU N 9=4^bkm T# TS TX[ T BFTXac Rs R3 Rc R 6:[_hj Ps P# PUX P 37TX\eg NC Ns NRU N 68 L L 9=R Og O :< QS Q 68 L L SW_a R# Rs RC R <@daenp 	YS 	Y 	Y[^ 	Y 04$UYbd N NC Ns N 37TX\eg QC Qs QRU Q 37TX\eg PC Ps PRU P 6:[_hj Ss S# SUX S >BPTcgpr Xs X# X]` X 9=4^bkm T# TS TX[ T CGr N3 Ni N 02 R CGr O OC O =? X X* jl Us U) UU U[` U mo X# XY XPU X^c X cgoq V V9 Ve V\_ V fjrt Y3 Yi YQV Y_b Y ]_ V3 V Ve V `b Yc Y5 YQV Y ^` WC W Wu W ac Zs ZE ZRW Z PR VC V V SU Ys YE Y QS WS W% W TV Z ZU Z 13 . EG ] ] w{  DF Q3 Qi Qy Qbg Qps Q z~  GI Tc T TR[ Tej Tsv T y}  FH QS Q	 QQZ Qdi Qru Q |@  IK T T9 TT] Tgl Tux T rv  LP  Y[ Qc Q Q) Q]b Qkn Q  FI Q uy  OS  \^ T TI TY T`e Tnq T  IL T DF TC Ty TRW T`e Tuz T GI Ws W) WUZ Wch Wx} W wy TS T	 TSX Thm T z| W W9 WV[ Wkp W :>b Pw P /1 Q 24 S ;= ,c , 57 W <> Us U  @B Y3 Y  DHVZimvx SS SS SPS Scf S$ EIW[jnwy Tc Tc TQT Tdg T$ MQ_crv  @B [c [c [Y\ [lo [$ 48dY]fh VS V VSV V MQ_crv  @B  `d  uy CL CLc CLY\ CLlo CL  Z] CLJ HLZ^mq  EI  RT C  TW gj   B $ SWeix|  PT  ]_  vz Ls LC L_b Lru L  JM LB LPW[cgpr  DH  UY  ko  FJ <E <ES <E| QU\`hluw  BF  ]a ES E# E> FJX\eg Y3 Ys YRU Y @DRVeirt 	VW 	VC 	V_b 	V 9=R Ns N# N 154VZce 	O# 	OS 	OPS 	O BFb M3 M3 M :< OS O :>b Pw P TX`b 
Kc 
K5 
K3 
KS 
K 6:" Ps P IK OT,-? O JN\`os|~ Vc V3 VVY Vil V ;?r P P P PrD   )A__version__rv   concurrent.futuresr   r   r9   r~   rn   rt   r   r  typingr   r   ccxt.base.typesr   r   r   r   !ccxt.async_support.base.throttlerr	   ccxt.base.errorsr
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   ccxt.base.exchanger   r'   r   $ccxt.async_support.base.ws.functionsr   r   r    !ccxt.async_support.base.ws.clientr!   !ccxt.async_support.base.ws.futurer"   %ccxt.async_support.base.ws.order_bookr#   r$   r%   aiohttp_socksr&   r   ImportError__all__ccxt.protobuf.mexcr(   google.protobuf.json_formatr)   r  rD   rB   <module>r     s   
       
 
    2 2 8 P  P  P  P k k K L K 4 4 _ _
C ;9C#P| C#P-    #Ms$   B9 !C 9CC
CC