
    ei{                     8   d dl mZ d dlmZ d dlZd dlZd dlmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZ d dlmZ d dlmZ d dlmZ d dlmZ d d	lmZ d d
lm Z  d dlm!Z! d dlm"Z" d dlm#Z# d dlm$Z$ d dlm%Z% d dl&m'Z' d dl(m)Z)  G d dee          Z*dS )    )Exchange)ImplicitAPIN)AnyBalancesDepositAddressIntMarketNumOrder	OrderBook	OrderSide	OrderTypeStrStringsTickerTickers
OrderBooksTradeTradingFeesTransaction)List)ExchangeError)AuthenticationError)ArgumentsRequired)InsufficientFunds)InvalidOrder)OrderNotFound)DDoSProtection)RateLimitExceeded)ExchangeNotAvailable)InvalidNonce)	TICK_SIZE)Precisec                   p    e Zd Zdef fdZdefdZi fdefdZi fdee	         fdZ
di fdededefd	Zddi fd
ededefdZd6dede	defdZi fdedefdZdi fd
edefdZi fdedefdZd6dede	defdZddi fdedededee         fdZi fdefdZdi fdededede de!f
dZ"di fdede#fdZ$de#fd Z%d6d!ede	de&fd"Z'di fdede#fd#Z(dddi fde#dededee&         fd$Z)dddi fde#dedefd%Z*i fd&ede+fd'Z,i fd&ede+fd(Z-di fd&ede d)ed*e#de.f
d+Z/d,d-i ddfd.Z0d/e1d0ed1ed2ed3ed4efd5Z2 xZ3S )7yobitreturnc                 R	   |                      t          t          |                                           i ddddddgddd	d
dddi dd ddddddddddddddddddddddddddddddddi d dd!dd"dd#dd$dd%dd&dd'dd(dd)dd*dd+dd,dd-dd.dd/dd0di d1dd2dd3dd4dd5dd6dd7dd8dd9dd:dd;dd<dd=dd>dd?dd@ddAdi dBddCddDddEddFddGddHddIddJddKddLddMddNddOddPddQddRdi dSddTddUddVddWddXddYddZdd[dd\dd]dd^dd_dd`ddaddbddcdi ddddeddfddgddhddiddjddkddlddmddnddoddpddqddrddsddtddudidvdwdxdydzd{d|d}d~dddddddiddddddddddidzdddddti iddi ddddddddddddddddddddddddddddddddddi ddddddddddddddddddddddddddÓddœddǓddɓdd˓i dd͓ddϓddѓddӓddՓddדddٓddۓddݓddߓddddddddddddddi ddddddddddddddddddd ddddddddd	d
dddddi ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/i d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYddZd[d\d]d^d_t          d`t
          t
          t
          t
          t
          t          t          t          dai dbt          dct          ddt          det          dft
          dgt
          dht
          dit          djt          dkt          dlt          dmt
          dnt
          dot          dpt          dqt          drt
          dst          idtduddddd ddd dddddvddddddddwd ddxdydyddzddddd{dd dddd|d d d d}	d d d~d d d~ddi           S (  Nidr%   nameYoBit	countriesRU	rateLimiti  version3proFhasCORSspotTmarginswapfutureoption	addMarginborrowCrossMarginborrowIsolatedMarginborrowMargincancelOrdercloseAllPositionsclosePositioncreateDepositAddresscreateMarketOrdercreateOrdercreateReduceOnlyOrdercreateStopLimitOrdercreateStopMarketOrdercreateStopOrderfetchAllGreeksfetchBalancefetchBorrowInterestfetchBorrowRatefetchBorrowRateHistoriesfetchBorrowRateHistoryfetchBorrowRatesfetchBorrowRatesPerSymbolfetchCrossBorrowRatefetchCrossBorrowRatesfetchCurrenciesfetchDepositAddressfetchDepositAddressesfetchDepositAddressesByNetworkfetchDeposits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fetchOrderBooksfetchPositionfetchPositionHistoryfetchPositionModefetchPositionsfetchPositionsForSymbolfetchPositionsHistoryfetchPositionsRiskfetchPremiumIndexOHLCVfetchSettlementHistoryfetchTickerfetchTickersfetchTradesfetchTradingFeefetchTradingFeesfetchTransactionsfetchTransferfetchTransfersfetchUnderlyingAssetsfetchVolatilityHistoryfetchWithdrawalsreduceMarginrepayCrossMarginrepayIsolatedMarginrepayMarginsetLeverage	setMarginsetMarginModesetPositionModetransferwithdrawwsurlszchttps://user-images.githubusercontent.com/1294454/27766910-cdcbfdae-5eea-11e7-9859-03fea873272d.jpgzhttps://yobit.net/apizhttps://yobit.net/tapi)publicprivatezhttps://www.yobit.netzhttps://www.yobit.net/en/api/zhttps://www.yobit.net/en/fees/)logoapiwwwdocfeesr   get   )zdepth/{pair}infozticker/{pair}ztrades/{pair}post)ActiveOrdersCancelOrderGetDepositAddressgetInfo	OrderInfor   TradeHistoryWithdrawCoinsToAddressr   gMb`?)makertaker)tradingfundingcommonCurrenciesAIRAirCoinANIANICoinANTAntsCoinATMCHAATMASN	AscensionASTAstral
AutumncoinAUR
AuroraCoinBABBabelBANBANcoinBCCBCHBCSBitcoinStakeBITSBitstarBLNBulleonBNSzBenefit Bonus CoinBOTBOTcoinBONBONESBPCBitcoinPremiumBSTBitStoneBTS
Bitshares2CATBitClaveCBCCryptoBossCoinCMT	CometCoinCOINzCoin.comCOVz
Coven CoinCOVXCPC	CapricoinCREDIT	CreditbitCSCryptoSpotsDCTDiscountDFT	DraftCoinDGDDarkGoldCoinDIRTDIRTYDROP
FaucetCoinDSHDASHEGCEverGreenCoinEGGEggCoinEKOEkoCoinENTERENTRCEPCExperienceCoinESCEdwardSnowdenEUROPEEUROPEXTLifeExtensionFUND
FUNDChainsFUNKFUNKCoinFXFCoinGCCGlobalCryptocurrencyGENGenstakeGENEGenesiscoinGMRGimmerGOLDGoldMintGOTzGiotto CoinGSX
GlowSharesGTGTcoinHTML5HTMLHYPERXHYPERICNiCoinINSANEINSNJNT	JointCoinJPCJupiterCoinJWLJewelsKNCz
KingN CoinLBTCXLiteBitcoinLIZILiZiLOCLocoCoinLOCXLUNYRLUN	LunarCoinLUNAz	Luna CoinMASKz
Yobit MASKMDTMidnightMEMEzMemez TokenMISMIScoinMM
MasterMintNAV
NavajoCoinNBT	NiceBytesOMGOMGameONXOnixPACz$PACPLAYPlayCoinPIVXDarknetPUREPurePOSPUTIN	PutinCoinSPACE	SpacecoinSTK	StakeCoinSUBSubscriptioPAYEPAYPLCzPlatin CoinRAI
RaiderCoinRCNRCoinREPRepublicoinRURRUBSBTCzSuper BitcoinSMC	SmartCoinSOLOSoloCoinSOULSoulCoinSTARStarCoinSUPER	SuperCoinTNSTranscodiumTTC
TittieCoinUNIUniverseUSTUservice
VolumeCoinXINCoin
SummitCoinRatecoinBSV)VOLXINXMTXRABCHNoptions   ERC20TRC20BEP20)ETHTRXBSC)maxUrlLengthfetchOrdersRequiresSymbolnetworksprecisionMode
exceptions)803804805806807831832833zInvalid pair namezinvalid api keyzinvalid signz"api key dont have trade permissionzinvalid parameterzinvalid orderz*The given order has already been cancelledzRequests too oftenznot availablezdata unavailablezexternal service unavailablezTotal transaction amountz?The given order has already been closed and cannot be cancelledzInsufficient fundszinvalid keyzinvalid noncez.Total order amount is less than minimal amountzRate Limited)exactbroadfeatures)IOCFOKPOGTD)
marginModetriggerPricetriggerDirectiontriggerPriceTypestopLossPricetakeProfitPriceattachedStopLossTakeProfittimeInForcehedgedtrailingleveragemarketBuyByCostmarketBuyRequiresPriceselfTradePreventioniceberg  i )r  limitdaysBack	untilDayssymbolRequired)r  triggerr  r  )r  r  r  r  r  )	sandboxrA   createOrdersrp   rw   rt   fetchOrdersfetchClosedOrders
fetchOHLCV)linearinverse)r3   r5   r6   orders)deep_extendsuperr%   describer"   r   r   r   r   r   r   r    r!   r   )self	__class__s    V/var/www/html/volatility/venv/lib/python3.11/site-packages/ccxt/async_support/yobit.pyr  zyobit.describe   s   eT 2 2 ; ; = = l@
'l@
Gl@
 $l@
 	l@

 sl@
 5l@
  hhh %h 	h
 %h %h Uh $Uh 'h h th $Uh  h 'h $Uh  t!h" (#h h$ '%h& ('h( "5)h* !%+h, -h. &u/h0 "51h2 +E3h4 )%5h6 #E7h8 ,U9h: ';h< (=h> "5?h@ &tAhB (ChD 1%Eh h hF  GhH &uIhJ 'KhL (MhN #EOhP *5QhR $UShT uUhV "5WhX *5YhZ +E[h\ )%]h^  _h` !%ahb %echd $Uehf &ugh h hh -eihj /khl "5mhn #Eohp +Eqhr sht !%uhv !%whx "5yhz &u{h| +E}h~  h@ $UAhB +EChD %eEhF "4GhH uIh h hJ #EKhL dMhN !$OhP "4QhR  ShT 'UhV $UWhX !%YhZ *5[h\ (]h^ %e_h` )%ahb )%chd tehf ghh tihj "5kh h hl #Dmhn $Uohp  qhr !%sht (uhv )%whx #Eyhz {h| #E}h~ &uh@ uAhB uChD UEhF  GhH "5IhJ EKhL DMh hN eOh hl@
` }57  /68	 	al@
t () !)*)*	  ()'(-.#$%&!"()23	 	 ul@
` "" 
  al@
r  l!yl!yl! zl! %	l!
 {l! xl! |l! |l! wl! yl! ul! ~l! 	l! yl! +l!  y!l!" w#l! l!$ '%l!& z'l!( |)l!* z+l!, '-l!. {/l!0 
1l!2 |3l!4 5l!6 {7l!8 +9l!: m;l!< z=l!> {?l!@ ~Al!B Cl!D El! l! l!F vGl!H Il!J yKl!L yMl!N Ol!P 'Ql!R Sl!T 'Ul!V Wl!X Yl!Z 
[l!\ g]l!^ -_l!` zal!b cl!d xel!f 
gl! l! l!h }il!j |kl!l hml!n ol!p 'ql!r wsl!t &ul!v {wl!x }yl!z x{l!| |}l!~ l!@ Al!B zCl!D El!F Gl!H {Il! l! l!J Kl!L Ml!N zOl!P Ql!R ySl!T lUl!V |Wl!X {Yl!Z x[l!\ v]l!^ v_l!` 
al!b 	cl!d 	el!f gl!h il!j {kl! l! l!l }ml!n vol!p }ql!r |sl!t wul!v }wl!x uyl!z {l!| {}l!~ 
l!@ 
Al!B 
Cl!D El!F }Gl!H |Il!J zKl!L zMl! l!N $ #!Wl! l! l!sl@
L  $-1"""  Ml@
^ Y_l@
` ''''',,(	 	'%': #$7 9:M	
 ( $\ A, ). $%9 '(< 34H / VWc )*; "#6  $\!" El#$ #$5%  al@
`	 $&+(-,1,0).+06:#(#("'#(	( ( #($)$)+027/4#()$ $, %)&+!%$*%+*.& & ',#($)*/	# # ',!%#($)*.( ( $()-"&_0 0d ## 
 ## m: :a	l@
V bWl@
 l l l	    c                    |                      |di           }|                     |d          }|||                     |          d}|                      |di           }|                      |di           }t          |                     ||                                                    }t          dt          |                    D ]j}||         }	|                     |	          }
| 	                                }| 
                    ||	          |d<   | 
                    ||	          |d<   |||
<   k|                     |          S )	Nr&   server_time)r   	timestampdatetimefundsfunds_incl_ordersr   freetotal)	safe_dictsafe_integeriso8601listextendkeysrangelensafe_currency_codeaccountsafe_stringsafe_balance)r  responsebalancesr  resultr  r  currencyIdsi
currencyIdcoder  s               r  parse_balancezyobit.parse_balance  s=   >>(Hb99%%h>>	"Y//
 

 ~~h44x)<bAA4;;tU3388::;;q#k**++ 	# 	#A$QJ**:66DllnnG"..tZ@@GFO#//zBBGG"F4LL  (((r  c                    K   |                                   d{V  |                     |           d{V }|                     |          S )aB  

        https://yobit.net/en/api

        query for balance and get the amount of funds available for trading or funds locked in orders
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `balance structure <https://docs.ccxt.com/?id=balance-structure>`
        N)load_marketsprivatePostGetInfor  )r  paramsr  s      r  fetch_balancezyobit.fetch_balance  sg       !!!!!!!!!00888888884 !!(+++r  c                 T  K   |                      |           d{V }|                     |di           }t          |                                          }g }t	          dt          |                    D ]1}||         }||         }|                    d          \  }	}
|	                                }|
                                }|                     |          }|                     |          }| 	                    |d          }| 
                    |d          }t          j        |d          }|                    i d|d	|d
z   |z   d|d|ddd|	d|
ddddddddddddddd|dk    ddddd|                     |          |                     |          ddddd|                     |                     | 
                    |d                              |                     |                     | 
                    |d                              dddd|                     |d          |                     |d           d|                     |d!          |                     |d"          d|                     |d#          ddd$d|d%           3|S )&z

        https://yobit.net/en/api

        retrieves data on all markets for yobit
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: an array of objects representing market data
        Npairsr   _hiddenfee100r(   symbol/basequotesettlebaseIdquoteIdsettleIdtyper3   Tr4   Fr5   r6   r7   activecontractr  decimal_places)amountprice)minmax
min_amount
max_amount	min_price	max_price	min_total)r  r  r  cost)r  r   r   contractSizeexpiryexpiryDatetimestrike
optionType	precisionlimitscreatedr   )publicGetInfor  r  r  r  r  splitupperr  r  r  r#   
string_divappendparse_numberparse_precisionsafe_number)r  r  r  marketsr  r  r  r(   marketr  r  r  r  r  	feeStrings                  r  fetch_marketszyobit.fetch_markets  sw      ++F33333333& ..7B77GLLNN##q#d))$$ >	 >	AaBR[F hhsmmOFG<<>>DMMOOE**400D++E22E&&vx88F((77I*9e<<IMM 2b2$*u,2 2 	2
 $2 &2 72 D2 2 2 %2 2 %2 %2 6Q;2  E!2" $#2$  **955**955 $"&""//0D0DTEUEUV\^nEoEo0p0pqq!..t/C/CDDTDTU[]mDnDn/o/opp   $#! !
  $//EE#//EE 
  $//DD#//DD 
  $//DD#  $  c2 2 2 2 2 2 2f r  Nr  r  c                   K   |                                   d{V  |                     |          }d|d         i}|||d<   |                     |                     ||                     d{V }|d         |v }|s#t	          | j        dz   |d         z   dz             ||d                  }|                     ||          S )a  

        https://yobit.net/en/api

        fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
        :param str symbol: unified symbol of the market to fetch the order book for
        :param int [limit]: the maximum amount of order book entries to return
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/?id=order-book-structure>` indexed by market symbols
        Npairr(   r   r  z% order book is empty or not available)r  r  publicGetDepthPairr  r   r(   parse_order_book)	r  r  r  r  r  requestr  market_id_in_reponse	orderbooks	            r  fetch_order_bookzyobit.fetch_order_book%  s       !!!!!!!!!V$$F4L
 $GG00Wf1M1MNNNNNNNN &t 8# 	l#x0@ @Cj jkkkVD\*	$$Y777r  symbolsc                   K   |                                   d{V  d}|ld                    | j                  }t          |          dk    r>t          | j                  }t	          | j        dz   t          |          z   dz             n*|                     |          }d                    |          }d|i}|||d<   |                     | 	                    ||                     d{V }i }t          |                                          }t          dt          |                    D ]>}	||	         }
|                     |
          }|                     ||
         |          ||<   ?|S )	aP  

        https://yobit.net/en/api

        fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data for multiple markets
        :param str[]|None symbols: list of unified market symbols, all symbols fetched if None, default is None
        :param int [limit]: max number of entries per orderbook to return, default is None
        :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 symbol
        N-ry  z fetchOrderBooks() has zy symbols exceeding max URL length, you are required to specify a list of symbols in the first argument to fetchOrderBooksr
  r  r   )r  joinidsr  r   r(   str
market_idsr  r  r  r  r  safe_symbolr  )r  r  r  r  r  numIdsr  r  r  r  r(   r  s               r  fetch_order_bookszyobit.fetch_order_books>  s      !!!!!!!!!?((48$$C3xx$TX#DG.G$G#f++$U  YT  %T  U  U  U  //'**C((3--CC
 $GG00Wf1M1MNNNNNNNN8==??##q#c((## 	I 	IAQB%%b))F!228B<HHF6NNr  tickerr  c                 ^   |                      |d          }|                     |d          }|                     i d|                     d |          d|d|                     |          d|                     |d          d|                     |d          d|                     |d	          d
d d|                     |d          dd dd dd d|d|dd dd dd d|                     |d          |                     |d          |                     |d          |d|          S )Nupdatedlastr  r  r  highlowbidbuy	bidVolumeasksell	askVolumevwapopenclosepreviousClosechange
percentageaverageavgvol_curvol)
baseVolumequoteVolumer   )safe_timestampr  safe_tickerr  r  )r  r  r  r  r  s        r  parse_tickerzyobit.parse_tickerc  s    ''	::	// !
d&&tV44!
!
 Y//!
 D$$VV44	!

 4##FE22!
 4##FE22!
 !
 4##FF33!
 !
 D!
 D!
 T!
 D!
 T!
 d!
  $!!
" t''66#!
$ **69==++FE::)!
 !
 !
* +  	r  	idsStringc                   K   d|i}|                      |                     ||                     d {V }i }t          |                                          }t	          dt          |                    D ]H}||         }||         }	|                     |          }
|
d         }|                     |	|
          ||<   I|S )Nr
  r   r  )publicGetTickerPairr  r  r  r  r  safe_marketr6  )r  r7  r  r  tickersr  r  kr(   r  r  r  s               r  fetch_tickers_helperzyobit.fetch_tickers_helper  s      I
 00Wf1M1MNNNNNNNNGLLNN##q#d))$$ 	? 	?AaBR[F%%b))FH%F!..vv>>F6NNr  c                   K   d}|                      |dd          \  }}||st          | j        dz             |                                  d{V  g }|                     | j        dd          }d}|r| j        }d}t          d	t          | j	                            D ]_}| j	        |         }	|dk    rdnd
}
||
|	z   z  }t          |          |k    r+|
                    |                     ||                     d}`|dk    r)|
                    |                     ||                     n|                     |          }|                     |          }t          |          }d
                    |          }t          |          |z   }||k    rPt          | j        dz   t          |          z   dz   t          |          z   dz   t          |          z   dz             |
                    |                     ||                     t!          j        |  d{V }i }t          d	t          |                    D ]5}|                     ||         d|          }|                     ||          }6|S )a  

        https://yobit.net/en/api

        fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
        :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
        :param dict [params.all]: you can set to `true` for convenience to fetch all tickers from self exchange by sending multiple requests
        :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/?id=ticker-structure>`
        NallFzs fetchTickers() requires "symbols" argument or use `params["all"] = True` to send multiple requests for all marketsr  ry  (    r   r  z' fetchTickers() is being requested for z$ markets(which has an URL length of z- characters), but it exceedes max URL length(zK), please pass limisted symbols array to fetchTickers to fit in one requestr  )handle_param_boolr   r(   r  r  rx  r  r  r  r  r  r=  market_symbolsr  r  r  asynciogatherfilter_by_array_tickersr  )r  r  r  
allSymbolspromises	maxLengthlenghtOfBaseUrlr  r  r(   prefix	idsLengthr7  actualLength	resultAllfinalResultr  s                    r  fetch_tickerszyobit.fetch_tickers  s      
!33FE5II
F?:?#DG  /d  %d  e  e  e!!!!!!!!!%%dlNDII	 	JlGC1c$(mm,,  Xa[ #r		v{"s88i''OOD$=$=c6$J$JKKKCbyy 9 9#v F FGGG))'22G//'**C #CIIy>>O;Li'''2[([^abk^l^l(l  pV  )V  Y\  ]i  Yj  Yj  )j  m\  )\  _b  cl  _m  _m  )m  p}  )}  ~  ~  ~OOD55iHHIII!.(3333333	q#i..)) 	; 	;A11)A,'RRF++k6::KKr  c                 P   K   |                      |g|           d{V }||         S )a  

        https://yobit.net/en/api

        fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours 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>`
        N)rP  )r  r  r  r;  s       r  fetch_tickerzyobit.fetch_ticker  s;       **F8V<<<<<<<<vr  tradec                    |                      |d          }|                     |d          }|dk    rd}n|dk    rd}|                     |dd          }|                     |d	d
          }|                     |d          }|                     |d          }|                     ||          }	|                     |d          }
|                     |          }|                     |
          }d}d }|                     |d          }|0|                     |d          }|                     |          }||d}|                     |d          }|^|\|                     |	||||d          }|                     |d          |                     |d          |                     |d          d}|                     |||| 	                    |          |	||d ||
d ||d|          S )Nr  r  r%  r&  r"  r#  rater  trade_idtidorder_idr
  r  r  
commissioncommissionCurrency)r  currencyis_your_orderr   r[  r  r[  r  rU  )r(   orderr  r  r  r  sidetakerOrMakerr  r  r  r  r   )
r4  r  safe_string_2r  r  r  r  calculate_fee
safe_trader  )r  rS  r  r  r_  priceStringr(   r^  marketIdr  amountStringr  r  r  r  feeCostStringfeeCurrencyIdfeeCurrencyCodeisYourOrderfeeInNumberss                       r  parse_tradezyobit.parse_trade  s3   0 ''{;;	v..5==DDU]]D((@@z599  
33##E622!!(F33''x88!!+..""<00((==$ ,,U4HIIM"55mDDO%+ C &&uo>>"{#11&$feU\]] $ 0 0z J J ,,\6BB ,,\6BB 
 "Y//  " 
  
   	r  sincec                   K   |                                   d{V  |                     |          }d|d         i}|||d<   |                     |                     ||                     d{V }t	          |t
                    rt          |          }|dk    rg S |                     ||d         g           }	|                     |	|||          S )a  

        https://yobit.net/en/api

        get the list of most recent trades for a particular symbol
        :param str symbol: unified symbol of the market to fetch trades for
        :param int [since]: timestamp in ms of the earliest trade to fetch
        :param int [limit]: the maximum amount of trades to fetch
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/?id=public-trades>`
        Nr
  r(   r  r   )	r  r  publicGetTradesPairr  
isinstancer  r  	safe_listparse_trades)
r  r  rm  r  r  r  r  r  numElementsr  s
             r  fetch_tradeszyobit.fetch_trades   s       !!!!!!!!!V$$F4L
 $GG11$++gv2N2NOOOOOOOO h%% 	h--Ka	&,;;  >>>r  c                   K   |                                   d{V  |                     |           d{V }|                     |di           }t          |                                          }i }t          dt          |                    D ]}||         }|                     ||i           }|                     |dd          }	|                     |d          }
|                     |d          }| 	                    t          j        |
d                    }| 	                    t          j        |d                    }||	||dd	d
||	<   |S )a1  

        https://yobit.net/en/api

        fetch the trading fees for multiple markets
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a dictionary of `fee structures <https://docs.ccxt.com/?id=fee-structure>` indexed by market symbols
        Nr  r   r  	fee_buyer
fee_sellerr  TF)r   r  r   r   r-  	tierBased)r  r  r  r  r  r  r  r  r  r  r#   r   )r  r  r  r  	marketIdsr  r  re  r
  r  takerStringmakerStringr   r   s                 r  fetch_trading_feeszyobit.fetch_trading_feesH  sk      !!!!!!!!!++F33333333( x"55&&	q#i..)) 	 	A |H>>%266D%%hc::F**4==K**4>>K%%g&8e&L&LMME%%g&8e&L&LMME "" F6NN r  r  r_  r  r  c                   K   |dk    rt          | j        dz             |                                  d{V  |                     |          }|d         ||                     ||          |                     ||          d}|                     |                     ||                     d{V }	|                     |	d          }
| 	                    |
|          S )a|  

        https://yobit.net/en/api

        create a trade order
        :param str symbol: unified symbol of the market to create an order in
        :param str type: must be '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
        :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
        r  z' createOrder() allows limit orders onlyNr(   )r
  r  r  rU  r&   )
r   r(   r  r  amount_to_precisionprice_to_precisionprivatePostTrader  r  parse_order)r  r  r  r_  r  r  r  r  r  r  r  s              r  create_orderzyobit.create_order{  s       8*S STTT!!!!!!!!!V$$4L..vv>>++FE::	
 
 ..t{{7F/K/KLLLLLLLL, (33///r  r(   c                   K   |                                   d{V  dt          |          i}|                     |                     ||                     d{V }|                     |di           }|                     |          S )aR  

        https://yobit.net/en/api

        cancels an open order
        :param str id: order id
        :param str symbol: not used by yobit cancelOrder()
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: An `order structure <https://docs.ccxt.com/?id=order-structure>`
        NrX  r&   )r  intprivatePostCancelOrderr  r  r  )r  r(   r  r  r  r  r  s          r  cancel_orderzyobit.cancel_order  s       !!!!!!!!!B
 44T[[&5Q5QRRRRRRRR( (B77'''r  statusc                 >    ddddd}|                      |||          S )Nr)  closedcanceled)012r/   )r  )r  r  statusess      r  parse_order_statuszyobit.parse_order_status  s4    	
 
 &&999r  r^  c                    |                      |dd          }|                     |                     |dd                    }|dk    r|                     |d          }d}|                     |dd	          }|                     |d
          }|                     ||          }|                     |d          }|                      |dd          }	|                     |dd          }
|                     |d          }d }d}|                     |d          }|                     i d|d|dd d|d|d|                     |          dd d|dd dd d|d|dd dd d|d|	d |
||d d d!|          S )"Nr(   rX  r  r)  r  init_order_idr  timestamp_createdr  r
  start_amountr  remainsreceivedz0.0rU  r  r  r   clientOrderIdr  r  r  lastTradeTimestampr  postOnlyr_  r  r  r  	remainingfilled)r  r  r.  trades)ra  r  r  safe_timestamp_2r  
safe_orderr  )r  r^  r  r(   r  r  re  r  r  r  r  r  r  r  r_  s                  r  r  zyobit.parse_order  s.   | tZ88(()9)9%6)R)RSS99!!%99BF))%1DmTT	##E622!!(F33!!%88&&uh	BB	!!%U;;  //v..  
E 
" 
 T 
 f	 

  
 Y// 
 !$ 
 D 
 4 
  
 D 
 U 
 D 
 D 
 f 
  ! 
" f# 
$ + 
  
  
, -  	r  c                 h  K   |                                   d{V  dt          |          i}|                     |                     ||                     d{V }t	          |          }|                     |di           }|                     |                     d|i||                             S )aj  

        https://yobit.net/en/api

        fetches information on an order made by the user
        :param str id: order id
        :param str symbol: not used by yobit fetchOrder
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: An `order structure <https://docs.ccxt.com/?id=order-structure>`
        NrX  r&   r(   )r  r  privatePostOrderInfor  r  r  r  )r  r(   r  r  r  r  r  s          r  fetch_orderzyobit.fetch_order@  s       !!!!!!!!!B
 224;;w3O3OPPPPPPPPWW(B77" T2Jr
 C CDDDr  c                 t  K   |t          | j        dz             |                                  d{V  i }d}| |                     |          }|d         |d<   |                     |                     ||                     d{V }|                     |di           }	|                     |	|||          S )a  

        https://yobit.net/en/api

        fetch all unfilled currently open orders
        :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 order structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns Order[]: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
        Nz- fetchOpenOrders() requires a symbol argumentr(   r
  r&   )r   r(   r  r  privatePostActiveOrdersr  r  parse_orders)
r  r  rm  r  r  r  r  marketInnerr  r  s
             r  fetch_open_orderszyobit.fetch_open_ordersd  s       >#DG.]$]^^^!!!!!!!!!++f--K)$/GFO55dkk'66R6RSSSSSSSS0 (B77  >>>r  c                   K   |t          | j        dz             |                                  d{V  |                     |          }d|d         i}|||d<   ||                     |dz            |d<   |                     |                     ||                     d{V }|                     |di           }t          |	                                          }	g }
t          d	t          |	                    D ]_}|                     |	|          }|                     |                     ||         d
|i          |          }|
                    |           `|                     |
|d         ||          S )a  

        https://yobit.net/en/api

        fetch all trades made by the user
        :param str symbol: unified market symbol
        :param int [since]: the earliest time in ms to fetch trades for
        :param int [limit]: the maximum number of trades structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/?id=trade-structure>`
        Nz+ fetchMyTrades() requires a symbol argumentr
  r(   countr  rm  r&   r   rV  r  )r   r(   r  r  parse_to_intprivatePostTradeHistoryr  r  r  r  r  r  r  rl  r  filter_by_symbol_since_limit)r  r  rm  r  r  r  r  r  r  r  r  r  r(   rS  s                 r  fetch_my_tradeszyobit.fetch_my_trades  s      >#DG.[$[\\\!!!!!!!!!V$$ F4L	
 $GG#00>>GG55dkk'66R6RSSSSSSSS" (B776;;==!!q#c((## 	! 	!A!!#q))B$$T[[B> & & E MM%    009I5RWXXXr  r  c                    K   ddi}|                      ||                     ||                     d{V }|                     |d          }|                     |           ||dd|d         dS )a^  

        https://yobit.net/en/api

        create a currency deposit address
        :param str code: unified currency code of the currency for the deposit address
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `address structure <https://docs.ccxt.com/?id=address-structure>`
        need_newr   Naddressr   )r[  r  tagnetworkr   )fetch_deposit_addressr  r  check_address)r  r  r  r  r  r  s         r  create_deposit_addresszyobit.create_deposit_address  s       
 33D$++gv:V:VWWWWWWWW""8Y777###V$
 
 	
r  c                 J  K   |                                   d{V  |                     |          }|d         }|                     | j        di           }|                     |d          }|                     |||          }|3|dk    r||                                z   }|                     |d          }|dd}|                     | 	                    ||                     d{V }|                     |d         d	          }	| 
                    |	           ||d|	dd
S )aZ  
        fetch the deposit address for a currency associated with self account

        https://yobit.net/en/api

        :param str code: unified currency code
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `address structure <https://docs.ccxt.com/?id=address-structure>`
        Nr(   r  r  rz  r   )coinNamer  r&   r  )r   r[  r  r  r  )r  r[  r  rx  safe_string_upperr  loweromitprivatePostGetDepositAddressr  r  )
r  r  r  r[  r  r  r  r  r  r  s
             r  r  zyobit.fetch_deposit_address  sS      !!!!!!!!!==&&d^
>>$,
B??((;;""8Wg>>'!!''--//9
YYvy11F"
 
 ::4;;wPV;W;WXXXXXXXX""8H#5yAA7###
 
 	
r  r  r  c                   K   |                      ||          \  }}|                     |           |                                  d{V  |                     |          }|d         ||d}|t	          | j        dz             |                     |                     ||                     d{V }i d|ddddddddd	dd
dddddddddddddddddddddddddddS )a  

        https://yobit.net/en/api

        make a withdrawal
        :param str code: unified currency code
        :param float amount: the amount to withdraw
        :param str address: the address to withdraw to
        :param str tag:
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `transaction structure <https://docs.ccxt.com/?id=transaction-structure>`
        Nr(   )r  r  r  z withdraw() does not support the tag argument yet due to a lack of docs on withdrawing with tag/memo on behalf of the exchange.r   txidr  r[  r  r  r  r  r  r  addressFrom	addressTor  tagFromtagTor  r]  )commentr  )handle_withdraw_tag_and_paramsr  r  r[  r   r(   !privatePostWithdrawCoinsToAddressr  )	r  r  r  r  r  r  r[  r  r  s	            r  r   zyobit.withdraw	  s      99#vFFV7###!!!!!!!!!==&& 
 
 ?  +l  !l  m  m  m??GU[@\@\]]]]]]]]
H
$
 D
 D	

 
 t
 d
 d
 
 
 t
 4
 
 4
 t
  T!
" t#
$   '
 
 
 	
r  r   GETc                 8   | j         d         |         }|                     ||                     |                    }|dk    r|                                  |                                 }	|                     |                     |	|d|                    }|                     |                     |          |                     | j	                  t          j                  }
d| j        |
d}n|dk    rE|d| j        z   dz   |                     ||          z   z  }|r|d|                     |          z   z  }n[|d|                     ||          z   z  }|d	k    r|r|d|                     |          z   z  }n|r|                     |          }d
di}||||dS )Nr   r   )noncemethodz!application/x-www-form-urlencoded)Content-TypeKeySignr   r  ?r  r  zapplication/json)urlr  bodyheaders)r   r  extract_paramscheck_required_credentialsr  	urlencoder  hmacencodesecrethashlibsha512apiKeyr.   implode_paramsjson)r  pathr   r  r  r  r  r  queryr  	signatures              r  signz
yobit.sign=  s   is#		&$"5"5d";";<<)++---JJLLE>>$++/ / # #  D 		$++d"3"3T[[5M5Mw~^^I C{! GG
 H__3%+d.A.A$.O.OOOC 3sT^^E22223,,T6::::C 73!6!666C 99U++D&(:G fdwOOOr  httpCodereasonr  r  r  r  c
                    |d S d|v r|                      |d          }
t          |
t                    r|
dk    s|
dk    rd}
nd}
|
s|                     |d          }|                     |d          }| j        dz   |z   }|                     | j        d	         ||           |                     | j        d	         ||           |                     | j        d
         ||           t          |          d S )Nsuccesstruer  TFr  errorr  r  r  )	
safe_valuerp  r  r  r(   throw_exactly_matched_exceptionr  throw_broadly_matched_exceptionr   )r  r  r  r  r  r  r  r  requestHeadersrequestBodyr  r  messagefeedbacks                 r  handle_errorszyobit.handle_errors^  s   4  6 ooh	::G'3'' $v%%7c>>"GG#G .''&99**8W==7S=4/44T_W5MtU]^^^44T_W5MwX`aaa44T_W5MwX`aaa#H---tr  )N)4__name__
__module____qualname__r   r  r   r  r  r   r	   r  r  r   r   r  r   r   r  dictr   r6  r   r=  rP  rR  r   rl  rt  r   r|  r   r   floatr
   r  r   r  r  r   r  r  r  r  r   r  r  r   r   r  r  r  __classcell__)r  s   @r  r%   r%      s%       m# m m m m m m^) ) ) ) )( *, $, $, $, $, $, $,L *, ^ ^V ^ ^ ^ ^@ @DB 8 8S 8 8S\ 8 8 8 82 :>DY[ # #w #c #`j # # # #J% %4 % %6 % % % %N AC  C w     6:" . .7 . . . . .` 68   F    H H Hv H H H H HT <@d[] &? &? &?S &? &?bfglbm &? &? &? &?P /1 1 1[ 1 1 1 1f mqy{ /0 /0 /0I /0Y /0X] /0fi /0 /0 /0 /0b 9=R $( $(S $(# $( $( $( $(L: : : : :c c cv c c c c cJ 8<B "E "EC "E "E "E "E "EH 59tZ^gi -? -?c -? -?TW -?nrsxny -? -? -? -?^ 37TX\eg 9Y 9YC 9Ys 9YRU 9Y 9Y 9Y 9Yv >@ 
 
 
N 
 
 
 
0 =? !
 !
 !
> !
 !
 !
 !
F QU]_ 2
 2
3 2
 2
 2
# 2
do 2
 2
 2
 2
h &eBSW P P P PB,c ,3 ,S ,# ,X\ ,dg , , , , , , , ,r  r%   )+ ccxt.async_support.base.exchanger   ccxt.abstract.yobitr   rD  r  ccxt.base.typesr   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!   ccxt.base.decimal_to_precisionr"   ccxt.base.preciser#   r%    r  r  <module>r     sW   6 5 5 5 5 5 + + + + + +   @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @  @       * * * * * * 0 0 0 0 0 0 . . . . . . . . . . . . ) ) ) ) ) ) * * * * * * + + + + + + . . . . . . 1 1 1 1 1 1 ) ) ) ) ) ) 4 4 4 4 4 4 % % % % % %p p p p pHk p p p p pr  