
    E#iC                    D   S SK Jr  S SKJr  S SKrS SKJrJrJrJ	r	J
r
JrJrJrJrJrJrJrJrJrJrJrJrJrJr  S SKJr  S SKJr  S SKJr  S SKJr  S S	KJr  S S
KJ r   S SKJ!r!  S SKJ"r"  S SKJ#r#  S SKJ$r$  S SKJ%r%  S SKJ&r&  S SKJ'r'  S SKJ(r(  S SK)J*r*   " S S\\5      r+g)    )Exchange)ImplicitAPIN)AnyBalances
CurrenciesCurrencyIntMarketNumOrder	OrderBook	OrderSide	OrderTypeStrStringsTickerTickersTradeTradingFeeInterfaceTransactionTransferEntry)List)ExchangeError)AuthenticationError)PermissionDenied)AccountSuspended)ArgumentsRequired)
BadRequest)	BadSymbol)InsufficientFunds)InvalidOrder)NotSupported)RateLimitExceeded)ExchangeNotAvailable)InvalidNonce)	TICK_SIZEc                     ^  \ rS rSrS\4U 4S jjrS r0 4S\4S jjr0 4S\	\
   4S jjr0 4S\4S jjr0 4S\4S jjrS	0 4S
\S\S\4S jjrSCS\S\
S\4S jjr0 4S
\S\4S jjrS	0 4S\S\4S jjrSCS\S\
S\4S jjrS	S	0 4S
\S\S\S\	\   4S jjr0 4S
\S\4S jjr0 4S
\4S jjr0 4S
\4S jjr S	S	S	0 4S
\!S\S\4S jjr"S\!4S jr#S r$S\!4S jr%SCS \S\
S\&4S! jjr'S	S	S	0 4S
\!S\S\S\	\&   4S" jjr(S	S	S	0 4S
\!S\S\S\	\&   4S# jjr)S	0 4S$\S
\!4S% jjr*S	0 4S
\S&\+S'\,S(\-S)\.4
S* jjr/S	0 4S$\S
\!4S+ jjr0S	0 4S
\!4S, jjr1S	S	S	0 4S-\!S\S\4S. jjr2SCS/\S0\3S\44S1 jjr5S\!4S2 jr6S3 r7S	S	S	0 4S-\!S\S\S\	\8   4S4 jjr90 4S-\S(\-S5\S6\S\84
S7 jjr:SCS8\S0\3S\84S9 jjr;S\!S\!4S: jr<SDS; jr=S-\>S<\S=\S>\S?\S@\4SA jr?SBr@U =rA$ )Elatoken   returnc           !        > U R                  [        [        U ]  5       SSS/SS0 SS _SS_S	S
_SS
_SS
_SS
_SS
_SS
_SS
_SS
_SS_SS_SS
_SS
_SS_SS
_SS_0 SS
_SS_SS
_SS_SS
_SS
_SS
_S S
_S!S
_S"S
_S#S
_S$S
_S%S_S&S
_S'S
_S(S
_S)S_E0 S*S
_S+S
_S,S
_S-S
_S.S
_S/S
_S0S
_S1S
_S2S
_S3S
_S4S
_S5S
_S6S
_S7S
_S8S
_S9S
_S:S
_E0 S;S
_S<S
_S=S
_S>S
_S?S
_S@S_SAS
_SBS
_SCS
_SDS
_SES
_SFS_SGS
_SHS
_SIS
_SJS_SKS
_E0 SLS
_SMS_SNS_SOS_SPS
_SQS
_SRS
_SSS
_STS
_SUS
_SVS
_SWS
_SXS
_SYS_SZS_S[S_S\S_ESS
S]S
SS
S
S
S
S
S
S
S
S
SS^.ES_S`Sa0SbSa/ScSdSe.Sf0 SgSh_SiSh_SjSh_SkSh_SlSh_SmSh_SnSh_SoSh_SpSh_SqSh_SrSh_SsSh_StSh_SuSh_SvSh_SwSh_00 SxSh_SySh_SzSh_S{Sh_S|Sh_S}Sh_S~Sh_SSh_SSh_SSh_SSh_SSh_SSh_SSh_SSh_SSh_SSh_SSh0E0 SSh_SSh_SSh_SSh_SSh_SSh_SSh_SSh_SSh_SSh_SSh_SSh_SSh_SSh_SSh_SSh_SSh_SSh0ES.S.[        SSfS
SU R                  S5      U R                  S5      S.00 SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_0 S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _S[        _[        [        [        [        [        S.E[        [        [        [        [         [         [         [        S.S.SSSSS.SSS.SS0SSS.S
S
SS S
S
S
S SSS
S
S.S
S
S
S
SS
S
S.S S
SSS S
S.S
SS
S
S.S
S S
S
SS.S S
SSShS SS
S
S.S S.	S S S.S S S.S.S.5      $ )Nr(   LatokenKYv2i  CORSspotTmarginFswapfutureoption	addMarginborrowCrossMarginborrowIsolatedMarginborrowMargincancelAllOrderscancelOrdercloseAllPositionsclosePositioncreateOrdercreatePostOnlyOrdercreateStopLimitOrdercreateStopMarketOrdercreateStopOrderfetchAllGreeksfetchBalancefetchBorrowInterestfetchBorrowRatefetchBorrowRateHistoriesfetchBorrowRateHistoryfetchBorrowRatesfetchBorrowRatesPerSymbolfetchCrossBorrowRatefetchCrossBorrowRatesfetchCurrenciesfetchDepositAddressfetchDepositAddressesfetchDepositAddressesByNetworkfetchDepositsWithdrawalsfetchDepositWithdrawFeesfetchFundingHistoryfetchFundingIntervalfetchFundingIntervalsfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchGreeksfetchIndexOHLCVfetchIsolatedBorrowRatefetchIsolatedBorrowRatesfetchIsolatedPositionsfetchLeveragefetchLeveragesfetchLeverageTiersfetchLiquidationsfetchLongShortRatiofetchLongShortRatioHistoryfetchMarginAdjustmentHistoryfetchMarginModefetchMarginModesfetchMarketLeverageTiersfetchMarketsfetchMarkOHLCVfetchMarkPricefetchMarkPricesfetchMyLiquidationsfetchMySettlementHistoryfetchMyTradesfetchOpenInterestfetchOpenInterestHistoryfetchOpenInterestsfetchOpenOrdersfetchOptionfetchOptionChain
fetchOrderfetchOrderBookfetchOrdersfetchPositionfetchPositionHistoryfetchPositionModefetchPositionsfetchPositionsForSymbolfetchPositionsHistoryfetchPositionsRiskfetchPremiumIndexOHLCVfetchSettlementHistoryfetchTickerfetchTickers	fetchTimefetchTradesemulated)fetchTradingFeefetchTradingFeesfetchTransactionsfetchTransferfetchTransfersfetchUnderlyingAssetsfetchVolatilityHistoryreduceMarginrepayCrossMarginrepayIsolatedMarginsetLeverage	setMarginsetMarginModesetPositionModetransferzchttps://user-images.githubusercontent.com/1294454/61511972-24c39f00-aa01-11e9-9f7c-471f1d6e5214.jpgrestzhttps://api.latoken.comzhttps://latoken.comzhttps://latoken.com/feesz%https://latoken.com/invite?r=mvgp2djk)logoapiwwwdocfeesreferralgetzbook/{currency}/{quote}   z
chart/weekzchart/week/{currency}/{quote}currencyzcurrency/availablezcurrency/quoteszcurrency/{currency}pairzpair/availabletickerzticker/{base}/{quote}timez trade/history/{currency}/{quote}ztrade/fee/{currency}/{quote}ztrade/feeLevelsztransaction/bindingszauth/accountz'auth/account/currency/{currency}/{type}z
auth/orderzauth/order/getOrder/{id}z"auth/order/pair/{currency}/{quote}z)auth/order/pair/{currency}/{quote}/activezauth/stopOrderzauth/stopOrder/getOrder/{id}z&auth/stopOrder/pair/{currency}/{quote}z-auth/stopOrder/pair/{currency}/{quote}/activez
auth/tradez"auth/trade/pair/{currency}/{quote}z!auth/trade/fee/{currency}/{quote}zauth/transactionzauth/transaction/bindingsz$auth/transaction/bindings/{currency}zauth/transaction/{id}zauth/transferzauth/order/cancelzauth/order/cancelAllz'auth/order/cancelAll/{currency}/{quote}zauth/order/placezauth/spot/depositzauth/spot/withdrawzauth/stopOrder/cancelzauth/stopOrder/cancelAllz+auth/stopOrder/cancelAll/{currency}/{quote}zauth/stopOrder/placezauth/transaction/depositAddresszauth/transaction/withdrawz auth/transaction/withdraw/cancelz!auth/transaction/withdraw/confirmz$auth/transaction/withdraw/resendCodezauth/transfer/emailzauth/transfer/idzauth/transfer/phone)r   post)publicprivatetradingz0.0049)feeSide	tierBased
percentagemakertakerBUXBuxcoinCBTzCommunity Business TokenCTCCyberTronchainDMDzDiamond CoinFRENFrenchieGDXGoldenXGECzGeco OneGEMNFTmallGMTz	GMT TokenIMCIMCoinMTMonarchTPAYz	Tetra PayTRADEzSmart Trade CoinTSLzTreasure SLUNO
UnobtaniumWARzWarrior TokenINTERNAL_ERRORSERVICE_UNAVAILABLENOT_AUTHORIZED	FORBIDDENBAD_REQUEST	NOT_FOUNDACCESS_DENIEDREQUEST_REJECTEDHTTP_MEDIA_TYPE_NOT_SUPPORTEDMEDIA_TYPE_NOT_ACCEPTABLEMETHOD_ARGUMENT_NOT_VALIDVALIDATION_ERRORACCOUNT_EXPIREDBAD_CREDENTIALSCOOKIE_THEFTCREDENTIALS_EXPIREDINSUFFICIENT_AUTHENTICATION)UNKNOWN_LOCATIONTOO_MANY_REQUESTSINSUFFICIENT_FUNDSORDER_VALIDATION	BAD_TICKS)z$invalid API key, signature or digestzThe API key was revokedzrequest expired or badzFor input stringz!Unable to resolve currency by tagzCan't find currency with tagz7Unable to place order because pair is in inactive statezAPI keys are not available for)exactbroadACCOUNT_TYPE_WALLETACCOUNT_TYPE_SPOT)walletfundingr0   r   )r   r   methodfetchPrivateTradingFeer   )defaultTypetypesaccountsr   timeDifferenceadjustForTimeDifference)IOCFOKPOGTD)
marginModetriggerPricetriggerPriceTypetriggerDirectionstopLossPricetakeProfitPriceattachedStopLossTakeProfittimeInForcehedgedselfTradePreventiontrailingleveragemarketBuyByCostmarketBuyRequiresPriceicebergi )r   limitdaysBack	untilDayssymbolRequired)r   triggerr   r   )r   r   r   r   r   )r   r   r   daysBackCanceledr   r   r   r   )	sandboxr=   createOrdersrm   rt   rq   rv   fetchClosedOrders
fetchOHLCV)linearinverse)r0   r2   r3   )idname	countriesversion	rateLimithasurlsr   precisionModer   commonCurrencies
exceptionsoptionsfeatures)deep_extendsuperr(   describer&   parse_numberr   r$   r   r   r   r   r#   r    r!   r%   r   )self	__class__s    T/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/async_support/latoken.pyr  latoken.describe   s   gt = ?eee %e 	e
 %e %e Ue $Ue 'e e "4e te $Ue  e te  &u!e" '#e$ (%e& "4'e( !%)e* +e, &u-e. "5/e0 +E1e2 )%3e4 #E5e6 ,U7e8 '9e: (;e< "4=e> &u?e@ (AeB 1%CeD +DEeF +EGeH &uIeJ 'KeL (MeN #EOeP *5QeR $USeT uUeV "5WeX *5YeZ +E[e\ )%]e^  _e` !%aeb %eced $Ueef &ugeh -eiej /kel "5men #Eoep +Eqer set !%uev !%wex "5yez &u{e| +E}e~  e@ $UAeB +ECeD %eEeF "4GeH uIeJ #EKeL dMeN !$OeP tQeR  SeT 'UeV $UWeX !%YeZ *5[e\ (]e^ %e_e` )%aeb )%ced teef geh Tiej tkel $($)%/!&"&).*/ %$)',$"!&#( IeN ~5 -- 3C  11$a 8 #A	
 -a *1 .q  )! !! 0  ;A 7 *1  /!*&A1 %a 3A	
 =a DQ )! 7 A! H %a =a <Q +A 4Q  ?!" 0#$ (%(+Q. B1 +A	
 ,Q -a 0 3A Fq / :1 4Q ;A <Q ?  .q!" +A#$ .q%+)+?@ '$!&"&!..x8!..x8!y!1! '! ~	!
 
! y! z! y! {! x! i! ! +! }! |!  !!&$m)+? %&9  !1	
 ":   $%5 ' 4Z 0 0 '
 &'7 &': #$7  *+;!" 23F#$ )<):*;(4!--2 =P/B.:(29B4=OX6F	3#J  &34/ ,4)/
 6$ #$+/&  %&+(,,0,1).+06:#'#'"'#(	( #(/4$)$)+/27#()$, %)&+!%$*%)*/& ',#'$)*/	# ',!%#($)*.( $(&+!%$*,-%)#'$)*/	* #'q9v ##
 ##CSMB
 M M	    c                 B    U R                  5       U R                  S   -
  $ )Nr   )millisecondsr  )r  s    r  noncelatoken.noncem  s       "T\\2B%CCCr  c                 d   #    U R                  U5      I Sh  vN nU R                  US5      $  N7f)a3  
fetches the current integer timestamp in milliseconds from the exchange server

https://api.latoken.com/doc/v2/#tag/Time/operation/currentTime

:param dict [params]: extra parameters specific to the exchange API endpoint
:returns int: the current integer timestamp in milliseconds from the exchange server
N
serverTime)publicGetTimesafe_integer)r  paramsresponses      r  
fetch_timelatoken.fetch_timep  s4      ++F33   <88 4s   0.0c                   #    U R                  U5      I Sh  vN nU R                  U R                  SS5      (       a  U R                  5       I Sh  vN   U R	                  U R                  S0 5      nU R                  US5      n/ n[        S[        U5      5       GH  nX&   nU R                  US5      nU R                  US5      n	U R                  US5      n
U R	                  XI5      nU R	                  XJ5      nU R	                  US	5      nU R	                  US	5      nUc  M  Uc  M  U R                  U R                  US
5      5      nU R                  U R                  US
5      5      nUR                  5       nU R                  U5      nU R                  US5      nUR                  0 SU_SUS-   U-   _SU_SU_SS_SU	_SU
_SS_SS_SS_SS_SS_SS_SS_SUS:H  _SS_SS_SSSSSSU R                  US5      U R                  US 5      S!.SSS".U R                  US#5      SS".SSS".U R                  US$U-   5      U R                  US%U-   5      S".S&.U R                  US'5      US(.
E5        GM     U$  GNc GN,7f))z
retrieves data on all markets for latoken

https://api.latoken.com/doc/v2/#tag/Pair/operation/getActivePairs

:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: an array of objects representing market data
Nr   FcachedCurrenciesr  r   baseCurrencyquoteCurrencyinfotagstatussymbol/basequotesettlebaseIdquoteIdsettleIdtyper0   Tr1   r2   r3   r4   activePAIR_STATUS_ACTIVEcontractr  quantityTick	priceTick)amountpriceminmaxminOrderQuantityminOrderCostmaxOrderCost)r   r:  r;  costcreated)
r  contractSizeexpiryexpiryDatetimestrike
optionType	precisionlimitsrC  r)  )publicGetPair	safe_boolr  load_time_difference	safe_dictindex_byrangelensafe_stringsafe_currency_codelower
capitalizeappendsafe_numberr   )r  r!  r"  
currenciescurrenciesByIdresultimarketr  r1  r2  r'  r(  baseCurrencyInfoquoteCurrencyInfor.  r/  lowercaseQuotecapitalizedQuoter+  s                       r  fetch_marketslatoken.fetch_markets  s4     ++F33* >>$,,(A5II++---^^DLL2DbI
z48q#h-(A[F!!&$/B%%fn=F&&v?G>>.AL NN>CM#~~lFC $}f E+0A0M..t/?/?@PRW/XY//0@0@ARTY0Z[!&#'??>#B ))&(; 0"0dSj500 D0 U	0
 d0 f0 w0 0 F0 D0 e0 E0 e0 e0 v)==0  !0" d#0$  $$("&*""&"&"2"26>"J!%!1!1&+!F" $(#'%
 $(#3#3F<N#O#'#
 $(#'"
 $(#3#3FNM]<]#^#'#3#3FNM]<]#^!$  $00C"_0 0! )B w 4, .s/   J I:9J I=CJ %J *EJ =J c                   #    U R                  U5      I Sh  vN n0 n[        S[        U5      5       GH  nX$   nU R                  US5      nU R                  US5      nU R	                  U5      nU R                  US5      n	U	S:H  =(       d    U	S:H  n
U R                  UUUU R                  US5      U
(       a  S	OS
U R                  US5      S:H  SSU R                  US5      U R                  U R                  U R                  US5      5      5      U R                  US5      SS.SSS.S.0 S.5      X8'   GM     U$  GN&7f)z
fetches all available currencies on an exchange
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: an associative dictionary of currencies
Nr   r  r*  r4  CURRENCY_TYPE_CRYPTOCURRENCY_TYPE_IEOr  cryptootherr+  CURRENCY_STATUS_ACTIVEfeedecimalsminTransferAmountr<  )r:  withdraw)r  coder)  r  r4  r5  depositrl  ri  rI  rJ  networks)	publicGetCurrencyrP  rQ  rR  rS  safe_currency_structurerW  r  parse_precision)r  r!  r"  rZ  r[  r   r  r*  rm  currencyTypeisCryptos              r  fetch_currencieslatoken.fetch_currencies  sd     //77B q#h-(A{H!!(D1B""8U3C**3/D++Hf=L$(>>e,ReBeH77 ((6:$,'**8X>BZZ ''%8!..t/C/CDDTDTU]_iDj/kl  $//:MN#
  $#!	 +9 FL )< A 8s   E D=D&E c                 0  #    U R                  5       I Sh  vN   U R                  U5      I Sh  vN nUSSS.nSnU R                  U R                  SSS5      nU R	                  USU5      nU R                  U R                  S0 5      nU R	                  XvU5      nU R                  US5      n	U R                  X/ 5      n
[        S[        U
5      5       H  nX   nU R	                  US	5      nU R                  US
5      nUb  Uc  UnO[        XN5      nU R                  U5      nU R                  5       nU R	                  US5      US'   U R	                  US5      US'   UX?'   M     XCS
'   U R                  U5      US'   U R                  U5      $  GNz GNd7f)aK  
query for balance and get the amount of funds available for trading or funds locked in orders

https://api.latoken.com/doc/v2/#tag/Account/operation/getBalancesByUser

:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
N)r)  	timestampdatetimerC   r   r0   r4  r   r   r   rx  	availablefreeblockedusedry  )load_marketsprivateGetAuthAccountsafe_string_2r  rR  
safe_valuegroup_byrP  rQ  r   r>  rS  accountiso8601safe_balance)r  r!  r"  rZ  maxTimestampr   r4  r   accountTypebalancesByTypebalancesr[  balance
currencyIdrx  rm  r  s                    r  fetch_balancelatoken.fetch_balance/  s     !!!33F;;0 

 ((~}V\]<gr:&&uD9x8??>Cq#h-(AkG))':>J))';?I$'#,L#&|#?L**:6DllnG"..wDGFO"..w	BGFO"FL ) +{!\\,7z  ((i 	";s    FFFFE!FFNr,  r   c           	        #    U R                  5       I Sh  vN   U R                  U5      nUS   US   S.nUb  X%S'   U R                  U R                  XS5      5      I Sh  vN nU R	                  XaSSSSS	5      $  Ne N7f)
a  
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data

https://api.latoken.com/doc/v2/#tag/Order-Book/operation/getOrderBook

: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
Nr1  r2  r   r/  r   bidaskr;  quantity)r~  r\  publicGetBookCurrencyQuoteextendparse_order_book)r  r,  r   r!  r\  requestr"  s          r  fetch_order_booklatoken.fetch_order_bookn  s      !!!V$x(I&
 $G88W9UVV" $$XtUE7T^__3 	" Ws"   B A<A
B !A>"B >B r   r\  c                     U R                  US5      nU R                  US5      nU R                  US5      nU R                  0 SU R                  X25      _SU_SU R	                  U5      _SS _SS _SU R                  US	5      _S
U R                  US5      _SU R                  US5      _SU R                  US5      _SS _SS _SU_SU_SS _SS _SU R                  US5      _SS _U R                  US5      U R                  US5      US.EU5      $ )Nr,  	lastPriceupdateTimestamprx  ry  lowhighr  bestBid	bidVolumebestBidQuantityr  bestAsk	askVolumebestAskQuantityvwapopencloselastpreviousClosechanger   	change24haverage	amount24h	volume24h)
baseVolumequoteVolumer)  )rR  safe_integer_omit_zerosafe_tickersafe_symbolr  )r  r   r\  marketIdr  rx  s         r  parse_tickerlatoken.parse_ticker  s   * ##FH54//8IJ	 !
d&&x8!
!
 Y/!
 4	!

 D!
 4##FI6!
 ))&2CD!
 4##FI6!
 ))&2CD!
 D!
 D!
 T!
 D!
 T!
 d!
  $**6;?!!
" t#!
$ **6;?++FK@)!
* + 	r  c                    #    U R                  5       I Sh  vN   U R                  U5      nUS   US   S.nU R                  U R                  XB5      5      I Sh  vN nU R	                  XS5      $  NY N7f)a  
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market

https://api.latoken.com/doc/v2/#tag/Ticker/operation/getTicker

: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>`
Nr1  r2  )r.  r/  )r~  r\  publicGetTickerBaseQuoter  r  r  r,  r!  r\  r  r"  s         r  fetch_tickerlatoken.fetch_ticker  sz      !!!V$8$I&
 66t{{77STT*   227 	" Us"   A4A0AA4A2A42A4symbolsc                    #    U R                  5       I Sh  vN   U R                  U5      I Sh  vN nU R                  X15      $  N. N7f)a  
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market

https://api.latoken.com/doc/v2/#tag/Ticker/operation/getAllTickers

:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
N)r~  publicGetTickerparse_tickers)r  r  r!  r"  s       r  fetch_tickerslatoken.fetch_tickers  sG      !!!--f55. !!(441 	"5s   A	AA	AA	A	tradec                    S nU R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      n	U	c  U(       a  SOSn	OU	S	:X  a  Sn	OU	S
:X  a  Sn	U	S:H  n
U(       a	  U
(       a  SOSnU R                  US5      nU R                  US5      nU R                  U5      nU R                  U5      nUS-   U-   nUU R                  ;   a  U R                  U5      nU R                  US5      nU R                  US5      nU R                  US5      nS nUb  UUS.nU R                  UUU R                  U5      UUUUUU	UUUUS.U5      $ )Nrx  r;  r  rB  
makerBuyer	directionsellbuyTRADE_DIRECTION_BUYTRADE_DIRECTION_SELLr   r   r'  r(  r-  r  orderri  )rB  r   )r)  rx  ry  r,  r  r  r4  takerOrMakersider;  r:  rB  ri  )r   rR  r  rS  marketsr\  
safe_trader  )r  r  r\  r4  rx  priceStringamountString
costStringr  r  isBuyr  r1  r2  r.  r/  r,  r  orderIdfeeCostri  s                        r  parse_tradelatoken.parse_trade  s   B %%e[9	&&ug6''z:%%eV4
__UL9
{3<'6UD,,//#-%wg!!%8""5/:&&v.''0e#T\\![[(FeT*""5'2""5%0!C "Y/( " 
  	r  sincec                   #    U R                  5       I Sh  vN   U R                  U5      nUS   US   S.nUb  [        US5      US'   U R                  U R	                  Xd5      5      I Sh  vN nU R                  XuX#5      $  Nl N7f)a  
get the list of most recent trades for a particular symbol

https://api.latoken.com/doc/v2/#tag/Trade/operation/getTradesByPair

:param str symbol: unified symbol of the market to fetch trades for
:param int [since]: timestamp in ms of the earliest trade to fetch
:param int [limit]: the maximum amount of trades to fetch
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
Nr1  r2  r  d   r   )r~  r\  r=  "publicGetTradeHistoryCurrencyQuoter  parse_trades)r  r,  r  r   r!  r\  r  r"  s           r  fetch_tradeslatoken.fetch_trades_  s      !!!V$x(I&
 "5#GG@@WA]^^   5@@% 	" _s"   BBAB,B-BBc                 h  #    U R                  U R                  S0 5      nU R                  USS5      nU R                  USU5      nU R                  US5      nUS:X  a  U R	                  X5      I Sh  vN $ US:X  a  U R                  X5      I Sh  vN $ [        U R                  S-   5      e N; N7f)ap  
fetch the trading fees for a market

https://api.latoken.com/doc/v2/#tag/Trade/operation/getFeeByPair
https://api.latoken.com/doc/v2/#tag/Trade/operation/getAuthFeeByPair

:param str symbol: unified market symbol
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
r   r   r   NfetchPublicTradingFeez not support self method)r  r  rR  omitfetch_private_trading_feefetch_public_trading_feer"   r  )r  r,  r!  r  defaultMethodr   s         r  fetch_trading_feelatoken.fetch_trading_fee  s      //$,,0A2F(((<TU!!&(MB68,--77GGG..66vFFFtww)CCDD	 HFs$   A0B22B.3B2B0B20B2c                 "  #    U R                  5       I S h  vN   U R                  U5      nUS   US   S.nU R                  U R                  XB5      5      I S h  vN nUUS   U R	                  US5      U R	                  US5      S S S.$  Nt N27fNr1  r2  r  r,  makerFeetakerFee)r)  r,  r   r   r   r   )r~  r\  publicGetTradeFeeCurrencyQuoter  rW  r  s         r  r   latoken.fetch_public_trading_fee  s     !!!V$x(I&
 <<T[[=YZZ X&%%h
;%%h
;
 	
 	" ["   BBABB1BBc                 "  #    U R                  5       I S h  vN   U R                  U5      nUS   US   S.nU R                  U R                  XB5      5      I S h  vN nUUS   U R	                  US5      U R	                  US5      S S S.$  Nt N27fr  )r~  r\  #privateGetAuthTradeFeeCurrencyQuoter  rW  r  s         r  r  !latoken.fetch_private_trading_fee  s     !!!V$x(I&
 AA$++gB^__ X&%%h
;%%h
;
 	
 	" `r  c                 n  #    U R                  5       I Sh  vN   0 nSnUb  X5S'   SnUbJ  U R                  U5      nUS   US'   US   US'   U R                  U R                  XT5      5      I Sh  vN nO(U R	                  U R                  XT5      5      I Sh  vN nU R                  XvX#5      $  N NA N7f)a  
fetch all trades made by the user

https://api.latoken.com/doc/v2/#tag/Trade/operation/getTradesByTrader
https://api.latoken.com/doc/v2/#tag/Trade/operation/getTradesByAssetAndTrader

:param str symbol: unified market symbol
:param int [since]: the earliest time in ms to fetch trades for
:param int [limit]: the maximum number of trades structures to retrieve
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
Nr   r1  r   r2  r/  )r~  r\  $privateGetAuthTradePairCurrencyQuoter  privateGetAuthTrader  )r  r,  r  r   r!  r  r\  r"  s           r  fetch_my_tradeslatoken.fetch_my_trades  s      !!!
 $G[[(F"("2GJ%i0GG!FFt{{SZGcddH!55dkk'6RSSH&   5@@I 	" eSs4   B5B/AB5/B10(B5B3B51B53B5r+  c                 2    SSSS.nU R                  X!U5      $ )Nr  closedcanceled)ORDER_STATUS_PLACEDORDER_STATUS_CLOSEDORDER_STATUS_CANCELLEDrR  r  r+  statusess      r  parse_order_statuslatoken.parse_order_status  s'    #)#+&0

 &99r  c                 0    SSS.nU R                  X!U5      $ )Nr\  r   )ORDER_TYPE_MARKETORDER_TYPE_LIMITr  r  s      r  parse_order_typelatoken.parse_order_type  s$    !) '
 &99r  r   c                 2    SSSS.nU R                  X!U5      $ )NGTCr   r   )#ORDER_CONDITION_GOOD_TILL_CANCELLED#ORDER_CONDITION_IMMEDIATE_OR_CANCELORDER_CONDITION_FILL_OR_KILLr  )r  r   timeInForcess      r  parse_time_in_forcelatoken.parse_time_in_force	  s'    3838,1

 ;GGr  r  c                    U R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  U5      nU R                  U5      nS n	Ub+  Ub(  US-   U-   n	XR                  ;   a  U R	                  U	5      nU R                  US5      n
S nU
b0  U
R                  S5      n[        U5      nU R                  XS-
  5      nU R                  U R                  US	5      5      nU R                  US
5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  U R                  US5      5      nU R                  US5      nUb/  UR                  S5      S:  a  SnOUR                  S5      S:  a  SnU R                  US5      nU R                  U R                  US5      5      nU R                  0 SU_SU_SU_SU_SU R                  U5      _SS _SU_SU	_S	U_SU_SS _SU_S
U_SU R                  US5      _SU_SU_SU_S S S S S .EU5      $ )!Nr  rx  r'  r(  r-  r  _r   r4  r;  r  filledrB  r+  messagecancelr   r  acceptr  clientOrderId	conditionr)  ry  lastTradeTimestampr,  r   postOnlyr   	stopPricer:  )r  	remainingri  trades)rR  r   rS  r  r\  splitrQ  safe_string_lowerr  r  findr
  
safe_orderr  )r  r  r\  r  rx  r1  r2  r.  r/  r,  	orderSider  partspartsLengthr4  r;  r:  r  rB  r+  r  r  r   s                          r  parse_orderlatoken.parse_order  s   X eT*%%e[9	!!%8""5/:&&v.''05#4CZ%'F%V,$$UF3	 OOC(Ee*K))%qAD$$T%5%5eV%DE  0!!%4!!%2v.(()9)9%)JK""5)4||H%*#h'1,((@..t/?/?{/ST  
" 
] 
 E 
 	 

 Y/ 
 !$ 
 f 
 f 
 D 
 ; 
  
 D 
 U 
 D,,UK@ 
 D 
  f! 
" f# 
$ + 
, - 	r  c                   #    Uc  [        U R                  S-   5      eU R                  5       I Sh  vN   SnU R                  USS5      nU R	                  US5      nU R                  U5      nUS   US   S.nU(       a)  U R                  U R                  X5      5      I Sh  vN nO(U R                  U R                  X5      5      I Sh  vN nU R                  XWX#5      $  N NA N7f)a{  
fetch all unfilled currently open orders

https://api.latoken.com/doc/v2/#tag/Order/operation/getMyActiveOrdersByPair
https://api.latoken.com/doc/v2/#tag/StopOrder/operation/getMyActiveStopOrdersByPair  # stop

:param str symbol: unified market symbol
:param int [since]: the earliest time in ms to fetch open orders for
:param int [limit]: the maximum number of  open orders structures to retrieve
:param dict [params]: extra parameters specific to the exchange API endpoint
:param boolean [params.trigger]: True if fetching trigger orders
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
Nz- fetchOpenOrders() requires a symbol argumentr   stopr1  r2  r  )
r   r  r~  safe_value_2r  r\  .privateGetAuthStopOrderPairCurrencyQuoteActiver  *privateGetAuthOrderPairCurrencyQuoteActiveparse_orders)	r  r,  r  r   r!  r"  	isTriggerr\  r  s	            r  fetch_open_orderslatoken.fetch_open_orderst  s      >#DGG.]$]^^!!!%%fi@	66*V$x(I&
 !PPQUQ\Q\]dQmnnH!LLT[[Y`MijjH.   5@@I 	" ojs4   /C)C#A1C)#C%$(C)C'C)%C)'C)c                   #    U R                  5       I Sh  vN   0 nSnU R                  USS5      nU R                  USS/5      nUb  X5S'   SnUbz  U R                  U5      nUS   US'   US   US'   U(       a)  U R	                  U R                  XT5      5      I Sh  vN nOU R                  U R                  XT5      5      I Sh  vN nOXU(       a)  U R                  U R                  XT5      5      I Sh  vN nO(U R                  U R                  XT5      5      I Sh  vN nU R                  XX#5      $  GN  N Nt NF N7f)	a)  
fetches information on multiple orders made by the user

https://api.latoken.com/doc/v2/#tag/Order/operation/getMyOrders
https://api.latoken.com/doc/v2/#tag/Order/operation/getMyOrdersByPair
https://api.latoken.com/doc/v2/#tag/StopOrder/operation/getMyStopOrders       # stop
https://api.latoken.com/doc/v2/#tag/StopOrder/operation/getMyStopOrdersByPair  # stop

:param str symbol: unified market symbol of the market orders were made in
:param int [since]: the earliest time in ms to fetch orders for
:param int [limit]: the maximum number of order structures to retrieve
:param dict [params]: extra parameters specific to the exchange API endpoint
:param boolean [params.trigger]: True if fetching trigger orders
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
Nr   r#  r   r1  r   r2  r/  )
r~  r$  r  r\  (privateGetAuthStopOrderPairCurrencyQuoter  $privateGetAuthOrderPairCurrencyQuoteprivateGetAuthStopOrderprivateGetAuthOrderr'  )	r  r,  r  r   r!  r  r\  r(  r"  s	            r  fetch_orderslatoken.fetch_orders  s:      !!!
 %%fi@	6FI#67$G[[(F"("2GJ%i0GG!%!N!Nt{{[bOk!ll!%!J!J4;;W^Kg!hh!%!=!=dkk'>Z![[!%!9!9$++g:V!WW.   5@@a 	"$ mh \WsX   ED6BED9(ED;/E6D=7(ED? E9E;E=E?Er  c                 r  #    U R                  5       I Sh  vN   SU0nU R                  USS5      nU R                  USS/5      nSnU(       a)  U R                  U R	                  XC5      5      I Sh  vN nO(U R                  U R	                  XC5      5      I Sh  vN nU R                  U5      $  N N@ N7f)a  
fetches information on an order made by the user

https://api.latoken.com/doc/v2/#tag/Order/operation/getOrderById
https://api.latoken.com/doc/v2/#tag/StopOrder/operation/getStopOrderById

:param str id: order id
:param str [symbol]: not used by latoken fetchOrder
:param dict [params]: extra parameters specific to the exchange API endpoint
:param boolean [params.trigger]: True if fetching a trigger order
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
Nr  r   r#  )r~  r$  r  !privateGetAuthStopOrderGetOrderIdr  privateGetAuthOrderGetOrderIdr   r  r  r,  r!  r  r(  r"  s          r  fetch_orderlatoken.fetch_order  s      !!!"
 %%fi@	6FI#67!CCDKKPWD`aaH!??G@\]]H* ))? 	" b]4   B7B1AB72B33(B7B5B73B75B7r4  r  r:  r;  c           
        #    U R                  5       I Sh  vN   U R                  U5      nUR                  5       nUS   US   UR                  5       SUU R                  5       U R	                  X5      U R                  5       S.n	US:X  a  U R                  X5      U	S'   U R                  USS	5      n
U R                  USS	/5      nSnU
b=  U R                  X5      U	S	'   U R                  U R                  X5      5      I Sh  vN nO(U R                  U R                  X5      5      I Sh  vN nU R                  X5      $  GN, NA N7f)
a(  
       create a trade order

       https://api.latoken.com/doc/v2/#tag/Order/operation/placeOrder
       https://api.latoken.com/doc/v2/#tag/StopOrder/operation/placeStopOrder  # stop

       :param str symbol: unified symbol of the market to create an order in
       :param str type: 'market' or 'limit'
       :param str side: 'buy' or 'sell'
       :param float amount: how much of currency you want to trade in units of base currency
       :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
       :param dict [params]: extra parameters specific to the exchange API endpoint
       :param float [params.triggerPrice]: the price at which a trigger order is triggered at

EXCHANGE SPECIFIC PARAMETERS
       :param str [params.condition]: "GTC", "IOC", or  "FOK"
       :param str [params.clientOrderId]: [0 .. 50] characters, client's custom order id(free field for your convenience)
       :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
       Nr1  r2  r  )r'  r(  r  r  r4  r  r  rx  LIMITr;  r   r  )r~  r\  upperuuidamount_to_precisionsecondsprice_to_precisionr  r  privatePostAuthStopOrderPlacer  privatePostAuthOrderPlacer   )r  r,  r4  r  r:  r;  r!  r\  uppercaseTyper  r   r"  s               r  create_orderlatoken.create_order  s<    ( !!!V$

"8,#I.JJL!!YY[ 00@
 G##66vEGG))&.+N6NK#@A##'#:#:6#PGK !??G@\]]H!;;DKK<XYYH 11K 	", ^Ys4   E	EC,E	E(E	,E-E	E	E	c                 r  #    U R                  5       I Sh  vN   SU0nU R                  USS5      nU R                  USS/5      nSnU(       a)  U R                  U R	                  XC5      5      I Sh  vN nO(U R                  U R	                  XC5      5      I Sh  vN nU R                  U5      $  N N@ N7f)a  
cancels an open order

https://api.latoken.com/doc/v2/#tag/Order/operation/cancelOrder
https://api.latoken.com/doc/v2/#tag/StopOrder/operation/cancelStopOrder  # stop

:param str id: order id
:param str symbol: not used by latoken cancelOrder()
:param dict [params]: extra parameters specific to the exchange API endpoint
:param boolean [params.trigger]: True if cancelling a trigger order
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
Nr  r   r#  )r~  r$  r  privatePostAuthStopOrderCancelr  privatePostAuthOrderCancelr   r5  s          r  cancel_orderlatoken.cancel_orderU  s      !!!"
 %%fi@	6FI#67!@@WA]^^H!<<T[[=YZZH ))) 	" _Zr8  c                 |  #    U R                  5       I Sh  vN   0 nSnU R                  USS5      nU R                  USS/5      nSnUbz  U R                  U5      nUS   US'   US   US'   U(       a)  U R	                  U R                  X25      5      I Sh  vN nOU R                  U R                  X25      5      I Sh  vN nOXU(       a)  U R                  U R                  X25      5      I Sh  vN nO(U R                  U R                  X25      5      I Sh  vN nU R                  SU05      /$  GN N Nv NH N!7f)	a  
cancel all open orders in a market

https://api.latoken.com/doc/v2/#tag/Order/operation/cancelAllOrders
https://api.latoken.com/doc/v2/#tag/Order/operation/cancelAllOrdersByPair

:param str symbol: unified market symbol of the market to cancel orders in
:param dict [params]: extra parameters specific to the exchange API endpoint
:param boolean [params.trigger]: True if cancelling trigger orders
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
Nr   r#  r1  r   r2  r/  r)  )
r~  r$  r  r\  .privatePostAuthStopOrderCancelAllCurrencyQuoter  *privatePostAuthOrderCancelAllCurrencyQuote!privatePostAuthStopOrderCancelAllprivatePostAuthOrderCancelAllr  )r  r,  r!  r  r\  r(  r"  s          r  cancel_all_orderslatoken.cancel_all_ordersx  s@     !!!
 %%fi@	6FI#67[[(F"("2GJ%i0GG!%!T!TUYU`U`ahUq!rr!%!P!PQUQ\Q\]dQm!nn!%!G!GT[Hd!ee!%!C!CDKKPWD`!aa OO 
 	
9 	" sn fasX   D<D1A?D<D4(D<?D6 /D</D80(D<D:D<4D<6D<8D<:D<rm  c                   #    U R                  5       I Sh  vN   0 nU R                  U R                  XT5      5      I Sh  vN nSnUb  U R                  U5      nU R	                  US/ 5      nU R                  XX#5      $  Ni NA7f)ad  
@deprecated
       use fetchDepositsWithdrawals instead

       https://api.latoken.com/doc/v2/#tag/Transaction/operation/getUserTransactions

       :param str code: unified currency code for the currency of the transactions, default is None
       :param int [since]: timestamp in ms of the earliest transaction, default is None
       :param int [limit]: max number of transactions to return, default is None
       :param dict [params]: extra parameters specific to the exchange API endpoint
       :returns dict: a list of `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
       Ncontent)r~  privateGetAuthTransactionr  r   	safe_listparse_transactions)	r  rm  r  r   r!  r  r"  r   rR  s	            r  fetch_transactionslatoken.fetch_transactions  s      !!!
 77G8TUU6 }}T*H..9b9&&w%GGI 	"
 Vs"   BB )B BA BBtransactionr   c                    U R                  US5      nU R                  US5      nU R                  US5      nU R                  XR5      nU R                  U R                  US5      5      nU R	                  US5      nU R                  US5      n	U R                  US5      n
U R                  US5      nU R                  US	5      nS S S S
.nU R	                  US5      nUb  XS'   XmS'   U R                  U R                  US5      5      n0 SU_SU_SU_SU_SU R                  U5      _SS _SU	_SU
_SU
_SS _SU_SU_SU_SU_SU_SU_SS _S S US.E$ )Nr  rx  r   r+  r:  senderAddressrecipientAddresstransactionHashmemo)r   rB  ratetransactionFeerB  r4  r)  txidry  networkaddressFrom	addressToaddresstagFromtagTor*  updated)commentinternalri  )rR  r   rS  parse_transaction_statusrW  parse_transaction_typer  )r  rX  r   r  rx  r  rm  r+  r:  rb  rc  r`  rf  ri  r  r4  s                   r  parse_transactionlatoken.parse_transaction  s   & k40%%k;?	%%k:>
&&z<..t/?/?X/VW!!+x8&&{OD$$[2DE	->?  f5

 "";0@A!K"
O**4+;+;K+PQ
K
"
 D
 	

 Y/
 t
 ;
 
 y
 t
 U
 5
 D
 f
 
  f!
" t#
$ )
 	
r  c                 8    SSSSSSS.nU R                  X!U5      $ )Nokpendingr  failedrejected)TRANSACTION_STATUS_CONFIRMEDTRANSACTION_STATUS_EXECUTEDTRANSACTION_STATUS_CHECKINGTRANSACTION_STATUS_CANCELLEDTRANSACTION_STATUS_FAILEDTRANSACTION_STATUS_REJECTEDr  r  s      r  rj   latoken.parse_transaction_status  s0    ,0+/+4,6)1+5
 &99r  c                 0    SSS.nU R                  X!U5      $ )Nrn  
withdrawal)TRANSACTION_TYPE_DEPOSITTRANSACTION_TYPE_WITHDRAWALr  )r  r4  r   s      r  rk  latoken.parse_transaction_type"  s$    (1+7
 T22r  c                    #    U R                  5       I Sh  vN   U R                  U5      nU R                  U5      I Sh  vN nU R                  US/ 5      nU R	                  XuX#5      $  NS N+7f)a  
fetch a history of internal transfers made on an account

https://api.latoken.com/doc/v2/#tag/Transfer/operation/getUsersTransfers

:param str code: unified currency code of the currency transferred
:param int [since]: the earliest time in ms to fetch transfers for
:param int [limit]: the maximum number of  transfers structures to retrieve
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: a list of `transfer structures <https://docs.ccxt.com/#/?id=transfer-structure>`
NrR  )r~  r   privateGetAuthTransferrT  parse_transfers)r  rm  r  r   r!  r   r"  	transferss           r  fetch_transferslatoken.fetch_transfers)  sk      !!!==&44V<<@ NN8Y;	##IFFG 	"<s!   A.A*)A. A,*A.,A.fromAccount	toAccountc                   #    U R                  5       I Sh  vN   U R                  U5      nUS   UU R                  X5      S.nSnUR                  S5      S:  a)  U R	                  U R                  Xu5      5      I Sh  vN nO`[        U5      S:X  a)  U R                  U R                  Xu5      5      I Sh  vN nO(U R                  U R                  Xu5      5      I Sh  vN nU R                  U5      $  N Nx NB N7f)ag  
transfer currency internally between wallets on the same account

https://api.latoken.com/doc/v2/#tag/Transfer/operation/transferByEmail
https://api.latoken.com/doc/v2/#tag/Transfer/operation/transferById
https://api.latoken.com/doc/v2/#tag/Transfer/operation/transferByPhone

:param str code: unified currency code
:param float amount: amount to transfer
:param str fromAccount: account to transfer from
:param str toAccount: account to transfer to
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `transfer structure <https://docs.ccxt.com/#/?id=transfer-structure>`
Nr  )r   	recipientvalue@r   $   )
r~  r   currency_to_precisionr  privatePostAuthTransferEmailr  rQ  privatePostAuthTransferIdprivatePostAuthTransferPhoneparse_transfer)	r  rm  r:  r  r  r!  r   r  r"  s	            r  r   latoken.transferZ  s      !!!==& "//=

 >>#!#!>>t{{7?[\\H^r!!;;DKK<XYYH!>>t{{7?[\\H. ""8,,I 	" ]Y\sF   C=C5A'C=>C7?7C=6C97(C=C; C=7C=9C=;C=r   c                    U R                  US5      nU R                  US5      nU R                  US5      nUU R                  US5      U R                  US5      U R                  U5      U R	                  XB5      U R                  US5      U R                  US5      U R                  US5      U R                  U5      S.	$ )	Nrx  r   r+  r  transferringFundsr  r  )	r)  r  rx  ry  r   r:  r  r  r+  )safe_timestamprR  r   r  rS  rW  parse_transfer_status)r  r   r   rx  r  r+  s         r  r  latoken.parse_transfer  s    . ''+>	%%h
;
!!(H5""8T2**8[AY///
E&&x1DE++HmD))(K@008

 
	
r  c                 6    SSSSSS.nU R                  X!U5      $ )Nro  rp  rq  r  )TRANSFER_STATUS_COMPLETEDTRANSFER_STATUS_PENDINGTRANSFER_STATUS_REJECTEDTRANSFER_STATUS_UNVERIFIEDTRANSFER_STATUS_CANCELLEDr  r  s      r  r  latoken.parse_transfer_status  s-    )-'0(0*3)3
 &99r  c                 2   SU R                   -   S-   U R                  X5      -   nUnU R                  X@R                  U5      5      n	U R	                  U	5      n
US:X  a  U	(       a  USU
-   -  nUS:X  a  U R                  5         X7-   U
-   nU R                  U R                  U5      U R                  U R                  5      [        R                  5      nU R                  USS.nUS:X  a  SUS	'   U R                  U	5      nU R                  S
   S   U-   nXXeS.$ )Nr-  GET?r   zHMAC-SHA512)zX-LA-APIKEYzX-LA-SIGNATUREzX-LA-DIGESTPOSTzapplication/jsonzContent-Typer   r   )urlr   bodyheaders)r  implode_paramsr  extract_params	urlencodecheck_required_credentialshmacencodesecrethashlibsha512apiKeyjsonr
  )r  pathr   r   r!  r  r  r  requestStringqueryurlencodedQueryauth	signaturer  s                 r  signlatoken.sign  s   $s*T-@-@-NN		&"5"5d";<../U?!66)++-#o5D		$++d"3T[[5Mw~~^I#{{"+,G
 *<'yy'iiv&6dOOr  reasonr  r   r  r  c
                    U(       d  g U R                  US5      n
U R                  S-   U-   nU
b>  U R                  U R                  S   X5        U R	                  U R                  S   X5        U R                  US5      nU R                  US5      nUc  UbI  U R                  U R                  S   X5        U R	                  U R                  S   Xk5        [        U5      eg )Nr   r   r   error)rR  r  throw_exactly_matched_exceptionr  throw_broadly_matched_exceptionr  r   )r  rm  r  r  r   r  r  r"  requestHeadersrequestBodyr  feedbackr  errorMessages                 r  handle_errorslatoken.handle_errors  s     ""8Y777S=4'001I7]001I7]'2''y9<#;001I5[001I4Z))r   )N)r   r  NNN)B__name__
__module____qualname____firstlineno__r   r  r  r	   r#  r   r
   ra  r   ru  r   r  strr   r  dictr   r  r  r   r   r  r   r  r  r   r  r  r  r   r  r  r  r
  r   r   r)  r0  r6  r   r   floatr   rC  rH  rO  rV  r   r   rl  rj  rk  r   r  r   r  r  r  intr  __static_attributes____classcell__)r  s   @r  r(   r(      s   N# N`
D ') 9S 9" *, dV dL -/ F: FP *, =) =)~ @DB $`S $` $`S\ $`L-4 - -6 -^ 68 %3 %3F %3N 6:" "57 "5 "5HO Ov O Ob <@d[] A AS A Abfglbm A@ ;= Ec EAT E, BD 
S 
2 CE 
c 
2 37TX\eg 1AC 1As 1ARU 1Af: ::Hs Ha av a aF 59tZ^gi 4Ac 4A 4ATW 4Anrsxny 4Al 04$UYbd @A @AC @As @Aimnsit @AD 8<B ,*C ,* ,*\ mqy{ 92 92I 92Y 92X] 92fi 92v 9=R !*S !*# !*F 59 ,
c ,
\ 48dY]fh 1HS 1H 1HSV 1Hf<
T <
X <
Q\ <
|	:s 	:3 154VZce /G# /GS /GPS /Gjno|j} /Gb ac 3-3 3- 3-C 3-TW 3-gt 3-j$
t $
x $
= $
L:C :C :P.# s  c TX `c  r  r(   ), ccxt.async_support.base.exchanger   ccxt.abstract.latokenr   r  ccxt.base.typesr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   typingr   ccxt.base.errorsr   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   ccxt.base.decimal_to_precisionr&   r(   r  r  r  <module>r     sq    6 -  Q  Q  Q  Q  Q  Q  * 0 - - . ' & . ) ) . 1 ) 4Oh Or  