
    if                         d dl mZ d dlmZ d dlZd dlmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZ 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)BalancesIntMarketNumOrder	OrderBook	OrderSide	OrderTypeStrStringsTickerTickersTradeTradingFees)List)ExchangeError)AuthenticationError)ArgumentsRequired)InsufficientFunds)InvalidOrder)OrderNotFound)DDoSProtection)RateLimitExceeded)ExchangeNotAvailable)InvalidNonce)	TICK_SIZE)Precisec                       e Zd Z 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fdZd(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d(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 Z!d(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
fd!Z'i fd e
fd"Z(di fd e
defd#Z)d$d%i ddfd&Z*d' Z+ xZ,S ))yobitc                    |                      t          t          |                                           dddg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d)di d*d	d+dd,d	d-dd.d	d/d	d0d	d1d	d2dd3dd4dd5dd6dd7d	d8d	d9d	d:dd	dddddddddd	dd;d<d=d>d?d@dAdBdCdDdEdEdEdEdFidGdEdEdEdEdEdEdEdEdHid?dIdIdJdKi idLi dMdNdOdPdQdRdSdTdUdVdWdXdTdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmi dndodpdqdrdsdtdudvdwdxdydzd{d|d}d~d|dd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ddddddddddddddddi dddddddddddd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t          t
          t
          t
          t
          t
          t          t          t          d i d!t          d"t          d#t          d$t          d%t
          d&t
          d't
          d(t          d)t          d*t          d+t          d,t
          d-t
          d.t          d/t          d0t          d1t
          d2t          id3i d4          S (5  Nr!   YoBitRUi  3FCORSspotTmarginswapfutureoption	addMargincancelOrdercloseAllPositionsclosePositioncreateDepositAddresscreateMarketOrdercreateOrdercreateReduceOnlyOrdercreateStopLimitOrdercreateStopMarketOrdercreateStopOrderfetchBalancefetchBorrowRateHistoriesfetchBorrowRateHistoryfetchCrossBorrowRatefetchCrossBorrowRatesfetchDepositAddressfetchDepositsfetchFundingHistoryfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchIndexOHLCVfetchIsolatedBorrowRatefetchIsolatedBorrowRatesfetchLeveragefetchLeverageTiersfetchMarginModefetchMarketsfetchMarkOHLCVfetchMyTradesfetchOpenInterestHistoryfetchOpenOrders
fetchOrderfetchOrderBookfetchOrderBooksfetchPositionfetchPositionModefetchPositionsfetchPositionsRiskfetchPremiumIndexOHLCVfetchTickerfetchTickersfetchTradesfetchTradingFee)fetchTradingFeesfetchTransactionsfetchTransferfetchTransfersfetchWithdrawalsreduceMarginsetLeveragesetMarginModesetPositionModetransferwithdrawwszchttps://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feesget   )zdepth/{pair}infozticker/{pair}ztrades/{pair}post)ActiveOrdersCancelOrderGetDepositAddressgetInfo	OrderInfor   TradeHistoryWithdrawCoinsToAddressgMb`?)makertakerrc   )tradingfunding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)VOLXINXMTXRA   ERC20TRC20BEP20)ETHTRXBSC)maxUrlLengthfetchOrdersRequiresSymbolnetworks)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)idname	countries	rateLimitversionprohasurlsrh   rk   commonCurrenciesoptionsprecisionMode
exceptionsorders)deep_extendsuperr!   describer   r   r   r   r   r   r   r   r   r   )self	__class__s    ^/var/www/html/crypto-bot/backend/venv/lib/python3.11/site-packages/ccxt/async_support/yobit.pyrc  zyobit.describe   s   eT 2 2 ; ; = =@@@ %@ 	@
 %@ %@ U@ t@ $U@  @ '@ $U@ t@ (@ '@  (!@" "5#@ @$ %@& +E'@( )%)@* '+@, (-@. &t/@0  1@2 &u3@4 #E5@6 *57@8 $U9@: "5;@< *5=@> +E?@@  A@B %eC@D "5E@ @ @F G@H !%I@J  K@L +EM@N "4O@P dQ@R !$S@T "4U@V  W@X $UY@Z !%[@\ %e]@^ )%_@` ta@b c@d te@f "5g@ @h %)%*!&"'$) %$!&#(! @ @ @D ~57  /68	 	 () !)*)*	  ()'(-.#$%&!"()23	 	 0 #" 
  k!yk!yk! zk! %	k!
 {k! xk! |k! |k! wk! yk! uk! ~k! 	k! yk! +k!  y!k!" w#k! k!$ '%k!& z'k!( |)k!* z+k!, '-k!. {/k!0 
1k!2 |3k!4 5k!6 {7k!8 +9k!: m;k!< z=k!> {?k!@ ~Ak!B Ck!D Ek! k! k!F vGk!H Ik!J yKk!L yMk!N Ok!P 'Qk!R Sk!T 'Uk!V Wk!X Yk!Z 
[k!\ g]k!^ -_k!` zak!b ck!d xek!f 
gk! k! k!h }ik!j |kk!l hmk!n ok!p 'qk!r wsk!t &uk!v {wk!x }yk!z x{k!| |}k!~ k!@ Ak!B zCk!D Ek!F Gk!H {Ik! k! k!J Kk!L Mk!N zOk!P Qk!R ySk!T lUk!V |Wk!X {Yk!Z x[k!\ v]k!^ v_k!` 
ak!b 	ck!d 	ek!f gk!h ik!j {kk! k! k!l }mk!n vok!p }qk!r |sk!t wuk!v }wk!x uyk!z {k!| {}k!~ 
k!@ 
Ak!B 
Ck!D Ek!F }Gk!H |Ik!J zKk!L zMk! k!N $ #!Uk! k! k!Z !%-1"""   ' ('''',,(	 	'%': #$7 9:M	
 ( $\ A, ). $%9 '(< 34H / VWc )*; "#6  $\!" El#$ #$5%  @ OH@
 H@
 H H H	    returnc                    |                      |di           }|                     |d          }|||                     |          d}|                      |di           }|                      |di           }t          |                     ||                                                    }t          dt          |                    D ]j}||         }	|                     |	          }
| 	                                }| 
                    ||	          |d<   | 
                    ||	          |d<   |||
<   k|                     |          S )	Nrh  server_time)rn   	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)rd  responsebalancesrk  resultro  rp  currencyIdsi
currencyIdcoderz  s               rf  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  (((rg  c                    K   |                                   d{V  |                     |           d{V }|                     |          S )aH  
        :see: 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  )rd  paramsr}  s      rf  fetch_balancezyobit.fetch_balance:  sg       !!!!!!!!!00888888884 !!(+++rg  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
        :see: 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100rT  symbol/basequotesettlebaseIdquoteIdsettleIdtyper'   Tr(   Fr)   r*   r+   activecontractlineardecimal_places)amountprice)minmax
min_amount
max_amount	min_price	max_price	min_total)leverager  r  cost)inverserx   rw   contractSizeexpiryexpiryDatetimestrike
optionType	precisionlimitscreatedrn   )publicGetInforq  rt  rv  rw  rx  splitupperry  rr  r{  r   
string_divappendparse_numberparse_precisionsafe_number)rd  r  r}  marketsrv  r  r  rT  marketr  r  r  r  r  	feeStrings                  rf  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 rg  Nr  limitc                   K   |                                   d{V  |                     |          }d|d         i}|||d<   |                     |                     ||                     d{V }|d         |v }|s#t	          | j        dz   |d         z   dz             ||d                  }|                     ||          S )a  
        :see: 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pairrT  r   r  z% order book is empty or not available)r  r  publicGetDepthPairru  r   rT  parse_order_book)	rd  r  r  r  r  requestr}  market_id_in_reponse	orderbooks	            rf  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7rg  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 )	aV  
        :see: 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-r@  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idsrx  r   rT  str
market_idsr  ru  rt  rv  rw  safe_symbolr  )rd  r  r  r  r  numIdsr  r}  r  r  rT  r  s               rf  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rg  r  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  rk  rl  highlowbidbuy	bidVolumeasksell	askVolumevwapopenclosepreviousClosechange
percentageaverageavgvol_curvol)
baseVolumequoteVolumern   )safe_timestampr{  safe_tickerr  rs  )rd  tickerr  rk  r  s        rf  parse_tickerzyobit.parse_ticker  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::)!
 !
 !
* +  	rg  c                   K   |t          | j        dz             |                                  d{V  |                     |          }d}|| j        }n|                     |          }t          |          }d                    |          }|                     | j	        dd          }d}t          |          |z   }||k    rPt          | j        dz   t          |          z   dz   t          |          z   d	z   t          |          z   d
z             d|i}	|                     |                     |	|                     d{V }
i }t          |
                                          }t          dt          |                    D ]H}||         }|
|         }|                     |          }|d         }|                     ||          ||<   I|                     |d|          S )a  
        :see: 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
        :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
        Nz+ fetchTickers() requires "symbols" argumentr  rG  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  r   r  )r   rT  r  market_symbolsr  r  rx  r  rr  r]  r  publicGetTickerPairru  rt  rv  rw  safe_marketr  filter_by_array_tickers)rd  r  r  r  	idsLength	idsString	maxLengthlenghtOfBaseUrlactualLengthr  tickersr  rv  krT  r  r  r  s                     rf  fetch_tickerszyobit.fetch_tickers  sF      ?#DG.[$[\\\!!!!!!!!!%%g..?(CC//'**CHH	HHSMM	%%dlNDII	9~~7)###DG.W$WZ]^gZhZh$h  lR  %R  UX  Ye  Uf  Uf  %f  iX  %X  [^  _h  [i  [i  %i  ly  %y  z  z  z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++FHgFFFrg  c                 P   K   |                      |g|           d{V }||         S )a  
        :see: 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)r  )rd  r  r  r  s       rf  fetch_tickerzyobit.fetch_tickerD  s;       **F8V<<<<<<<<vrg  c                    |                      |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 )Nrk  r  r  r  r  r  rater  trade_idtidorder_idr  r  r  
commissioncommissionCurrency)r  currencyis_your_orderrx   r  r  r  r  r  )rT  orderrk  rl  r  r  sidetakerOrMakerr  r  r  r  rn   )
r  r{  safe_string_2r  r  r  ry  calculate_fee
safe_traders  )rd  trader  rk  r  priceStringrT  r  marketIdr  amountStringr  r  r  r  feeCostStringfeeCurrencyIdfeeCurrencyCodeisYourOrderfeeInNumberss                       rf  parse_tradezyobit.parse_tradeO  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//  " 
  
   	rg  sincec                   K   |                                   d{V  |                     |          }d|d         i}|||d<   |                     |                     ||                     d{V }t	          |t
                    rt          |          }|dk    rg S |                     ||d         g           }	|                     |	|||          S )a  
        :see: 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  rT  r  r   )	r  r  publicGetTradesPairru  
isinstancert  rx  	safe_listparse_trades)
rd  r  r  r  r  r  r  r}  numElementsr  s
             rf  fetch_tradeszyobit.fetch_trades  s       !!!!!!!!!V$$F4L
 $GG11$++gv2N2NOOOOOOOO h%% 	h--Ka	&,;;  >>>rg  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 )a7  
        :see: 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)rn   r  rx   rw   r  	tierBased)r  r  rq  rt  rv  rw  rx  r  r{  r  r   r  )rd  r  r}  r  	marketIdsr  r  r  r  r  takerStringmakerStringrx   rw   s                 rf  fetch_trading_feeszyobit.fetch_trading_fees  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 rg  r  r  r  r  c                   K   |dk    rt          | j        dz             |                                  d{V  |                     |          }|d         ||                     ||          |                     ||          d}|                     |                     ||                     d{V }	|                     |	d          }
| 	                    |
|          S )a  
        :see: 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 fullfilled, 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 onlyNrT  )r  r  r  r  rh  )
r   rT  r  r  amount_to_precisionprice_to_precisionprivatePostTraderu  rq  parse_order)rd  r  r  r  r  r  r  r  r  r}  r  s              rf  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///rg  rT  c                   K   |                                   d{V  dt          |          i}|                     |                     ||                     d{V }|                     |di           }|                     |          S )aX  
        :see: 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>`
        Nr   rh  )r  intprivatePostCancelOrderru  rq  r*  )rd  rT  r  r  r  r}  r  s          rf  cancel_orderzyobit.cancel_order  s       !!!!!!!!!B
 44T[[&5Q5QRRRRRRRR( (B77'''rg  c                 >    ddddd}|                      |||          S )Nr  closedcanceled)012r%   )r{  )rd  statusstatusess      rf  parse_order_statuszyobit.parse_order_statusC  s4    	
 
 &&999rg  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 d!|          S )"NrT  r   r6  r  r3  init_order_idr1  timestamp_createdrj  r  start_amountr  remainsreceivedz0.0r  r  r  rn   clientOrderIdr  rk  rl  lastTradeTimestamptimeInForcepostOnlyr  r  	stopPricetriggerPricer  	remaining)filledr6  r  r  trades)r	  r8  r{  safe_timestamp_2r  
safe_orderrs  )rd  r  r  rT  r6  rk  r  r  r  rE  rF  r  r  r  r  s                  rf  r*  zyobit.parse_orderL  s1   | 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! 
" # 
$ - 
  
  
. /  	rg  c                 h  K   |                                   d{V  dt          |          i}|                     |                     ||                     d{V }t	          |          }|                     |di           }|                     |                     d|i||                             S )aP  
        :see: https://yobit.net/en/api
        fetches information on an order made by the user
        :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>`
        Nr   rh  rT  )r  r-  privatePostOrderInforu  r  rq  r*  )rd  rT  r  r  r  r}  r`  s          rf  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Drg  c                 t  K   |t          | j        dz             |                                  d{V  i }d}| |                     |          }|d         |d<   |                     |                     ||                     d{V }|                     |di           }	|                     |	|||          S )a  
        :see: 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 argumentrT  r  rh  )r   rT  r  r  privatePostActiveOrdersru  rq  parse_orders)
rd  r  r  r  r  r  r  marketInnerr}  r  s
             rf  fetch_open_orderszyobit.fetch_open_orders  s       >#DG.]$]^^^!!!!!!!!!++f--K)$/GFO55dkk'66R6RSSSSSSSS0 (B77  >>>rg  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 ]Q}|	|         }|                     |                     ||         d
|i          |          }|
                    |           R|                     |
|d         ||          S )a  
        :see: 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  rT  counti  r  rh  r   r  r  )r   rT  r  r  parse_to_intprivatePostTradeHistoryru  rq  rt  rv  rw  rx  r  r  filter_by_symbol_since_limit)rd  r  r  r  r  r  r  r}  rG  r  r  r  rT  r  s                 rf  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Xrg  r  c                    K   ddi}|                      ||                     ||                     d{V }|                     |d          }|                     |           ||d|d         dS )ad  
        :see: 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_newrm   Naddressrn   )r  rZ  tagrn   )fetch_deposit_addressru  r{  check_address)rd  r  r  r  r}  rZ  s         rf  create_deposit_addresszyobit.create_deposit_address9  s       
 33D$++gv:V:VWWWWWWWW""8Y777###V$	
 
 	
rg  c                   K   |                                   d{V  |                     |          }|d         }|                     | j        di           }|                     |d          }|                     |||          }|3|dk    r||                                z   }|                     |d          }|dd}|                     | 	                    ||                     d{V }|                     |d         d	          }	| 
                    |	           i ddd
|d	|	ddddd|ddddddddddddddddddddddddddddS )a`  
        :see: https://yobit.net/en/api
        fetch the deposit address for a currency associated with self account
        :param str code: unified currency code
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
        NrT  rI  networkrA  r   )coinNamerY  rh  rZ  r  r[  rn   txidr  r  r6  rk  rl  addressFrom	addressTotagFromtagTor  r  commentr  )r  r  rq  r]  safe_string_upperr{  loweromitprivatePostGetDepositAddressru  r]  )
rd  r  r  r  r  rI  r`  r  r}  rZ  s
             rf  r\  zyobit.fetch_deposit_addressN  s.      !!!!!!!!!==&&d^
>>$,
B??((;;""8Wg>>'!!''--//9
YYvy11F"
 
 ::4;;wPV;W;WXXXXXXXX""8H#5yAA7###
$

 w
 4	

 t
 H
 D
 D
 d
 d
 
 
 4
 
 t
  T!
" t#
$   '
 
 
 	
rg  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  
        :see: 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>`
        NrT  )ra  r  rZ  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.rn   rb  r  r  r`  r  r6  rk  rl  rZ  rc  rd  r[  re  rf  r  r  rg  )handle_withdraw_tag_and_paramsr]  r  r  r   rT  !privatePostWithdrawCoinsToAddressru  )	rd  r  r  rZ  r[  r  r  r  r}  s	            rf  rc   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#
$   '
 
 
 	
rg  re   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 )Nrh   rf   )noncemethodz!application/x-www-form-urlencoded)Content-TypeKeySignre   r  ?rp  rt  zapplication/json)urlrs  bodyheaders)r[  rk  extract_paramscheck_required_credentialsrr  	urlencoderu  hmacencodesecrethashlibsha512apiKeyrX  implode_paramsjson)rd  pathrh   rs  r  rz  ry  rx  queryrr  	signatures              rf  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Org  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truer4  TFr  errorr  rR  rS  )	
safe_valuer  r  r{  rT  throw_exactly_matched_exceptionr_  throw_broadly_matched_exceptionr   )rd  httpCodereasonrx  rs  rz  ry  r}  requestHeadersrequestBodyr  r  messagefeedbacks                 rf  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---trg  )N)-__name__
__module____qualname__rc  r   r  r  r   r   r  r  r   r
   r  r   r  r   r  r   r  r  r   r  r  r   r%  r   r   floatr   r+  r   r/  r8  r	   r*  rL  rQ  rW  r^  r\  rc   r  r  __classcell__)re  s   @rf  r!   r!      sp       I I I I IV) ) ) ) )( *, ", ", ", ", ", ",H *, \ \V \ \ \ \| @DB 8 8S 8 8S\ 8 8 8 8. :>DY[ ! !w !c ! ! ! !F% %6 %V % % % %N 6:" %G %G7 %G %G %G %G %GN 68 	 	 	F 	 	 	 	H H H5 H H H HT <@d[] $? $? $?S $? $?bfglbm $? $? $? $?L /1 / /[ / / / /b mqy{ -0 -0 -0I -0Y -0X] -0fi -0 -0 -0 -0^ 9=R "( "(S "(# "( "( "( "(H: : :d d d5 d d d dL 8<B E EC E E E E EB 59tZ^gi +? +?c +? +?TW +?nrsxny +? +? +? +?Z 37TX\eg 7Y 7YC 7Ys 7YRU 7Y 7Y 7Y 7Yr >@ 
 
 
 
 
 
* =? 1
 1
 1
 1
 1
 1
f EIQS 0
 0
3 0
 0
 0
 0
 0
d &eBSW P P P PB, , , , , , ,rg  r!   )& ccxt.async_support.base.exchanger   ccxt.abstract.yobitr   r  ccxt.base.typesr   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!    rg  rf  <module>r     s   6 5 5 5 5 5 + + + + + +  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R       * * * * * * 0 0 0 0 0 0 . . . . . . . . . . . . ) ) ) ) ) ) * * * * * * + + + + + + . . . . . . 1 1 1 1 1 1 ) ) ) ) ) ) 4 4 4 4 4 4 % % % % % %g g g g gHk g g g g grg  