
    eiUN                    X   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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' 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CurrencyDepositAddressIntLedgerEntryMarketNumOrder	OrderBook	OrderSide	OrderTypeStrStringsTickerTickersTradeTransactionTransferEntry)List)ExchangeError)AuthenticationError)PermissionDenied)AccountSuspended)
BadRequest)	BadSymbol)InsufficientFunds)InvalidOrder)OrderNotFound)OrderImmediatelyFillable)RateLimitExceeded)OnMaintenance)InvalidNonce)	TICK_SIZE)Precisec                   0    e Zd Zdef fdZi fdee         fdZdefdZdddi fde	de
de
dee         fd	ZdEd
ededefdZdddi fde	de
de
fdZdefdZi fdefdZdi fdede
defdZdEdededefdZi f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dEdededefdZd Z dEdede!fdZ"dddi fdedede
de
dee!         f
dZ#dEd edede$fd!Z%ddi fdede
de
de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de-fd*Z.dEdede/fd+Z0i fdede/fd,Z1di fd-edee/         fd.Z2i fded%e)d/ed0ede3f
d1Z4dEd2edede3fd3Z5d4e	de	fd5Z6di fded%e)d6ed7e	de7f
d8Z8dEd9edede7fd:Z9d;d<i ddfd=Z:d>e;d?ed@edAedBedCefdDZ< xZ=S )Fzondareturnc           (         |                      t          t          |                                           dddg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	d/d	d0d	d1d	d2d	d3d	d4dd5d	d6d	d7d	d8d	d9d	i d:d	d;d	d<d	d=d	d>d	d?dd@d	dAd	dBd	dCd	dDd	dEddFddGd	dHd	dId	dJd	i dKddLd	dMd	dNddOd	dPd	dQd	dRd	dSd	dTd	dUd	dVd	dWd	dXd	dYddZdd[d	i d\dd]d	d^d	d_d	d`d	dad dbd	dcd	ddd	ded	dfd dgd	dhd	did	djd	dkd	dld	d	d	dddmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~ddddddddgddddg didg didg dig dg dddgdgdd|                     d          |                     d          dd	d|                     d          |                     d          dd|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          gg|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d          |                     d          g|                     d¦          |                     d          g|                     dæ          |                     d          g|                     dæ          |                     d          g|                     dĦ          |                     d          ggdŜdƜdi idȜddg dˢdd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 ddd	dќd d	dd	d	d	dӜd d dd id՜	d d d֜d d d֜dלt
          i dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          t          t          t          t          t           t          t"          t          t          t          t"          t          dddid          S )Nr)   ZondaEE  CORSTspotmarginFswapfutureoption	addMarginborrowCrossMarginborrowIsolatedMarginborrowMargincancelAllOrderscancelOrdercancelOrderscloseAllPositionsclosePositioncreateDepositAddresscreateOrdercreateReduceOnlyOrderfetchAllGreeksfetchBalancefetchBorrowInterestfetchBorrowRatefetchBorrowRateHistoriesfetchBorrowRateHistoryfetchBorrowRatesfetchBorrowRatesPerSymbolfetchCrossBorrowRatefetchCrossBorrowRatesfetchCurrenciesfetchDepositfetchDepositAddressfetchDepositAddressesfetchDepositAddressesByNetworkfetchDepositsfetchFundingHistoryfetchFundingIntervalfetchFundingIntervalsfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchGreeksfetchIndexOHLCVfetchIsolatedBorrowRatefetchIsolatedBorrowRatesfetchIsolatedPositionsfetchLedgerfetchLeveragefetchLeveragesfetchLeverageTiersfetchLiquidationsfetchLongShortRatiofetchLongShortRatioHistoryfetchMarginAdjustmentHistoryfetchMarginModefetchMarginModesfetchMarketLeverageTiersfetchMarketsfetchMarkOHLCVfetchMarkPricefetchMarkPricesfetchMyLiquidationsfetchMySettlementHistoryfetchMyTrades
fetchOHLCVfetchOpenInterestfetchOpenInterestHistoryfetchOpenInterestsfetchOpenOrderfetchOpenOrdersfetchOptionfetchOptionChainfetchOrderBookfetchOrderBooksfetchPositionfetchPositionHistoryfetchPositionModefetchPositionsfetchPositionsForSymbolfetchPositionsHistoryfetchPositionsRiskfetchPremiumIndexOHLCVfetchSettlementHistoryfetchTickerfetchTickers	fetchTimefetchTradesfetchTradingFeefetchTradingFeesfetchTransactionFeefetchTransactionFeesfetchTransactionsfetchTransferfetchUnderlyingAssetsfetchVolatilityHistoryfetchWithdrawalfetchWithdrawalsreduceMarginrepayCrossMarginrepayIsolatedMarginrepayMarginsetLeverage	setMargin)setMarginModesetPositionModetransferwithdraw6018030090018003600720014400216004320086400259200604800)1m3m5m15m30m1h2h4h6h12h1d3d1wzzondacrypto.exchangez-https://auth.zondaglobal.com/ref/jHlbB4mIkdS1zdhttps://user-images.githubusercontent.com/1294454/159202310-a0e38007-5e7c-4ba9-a32f-c8263a0291fe.jpgzhttps://zondaglobal.comzhttps://{hostname}/API/Publicz-https://{hostname}/API/Trading/tradingApi.phpzhttps://api.{hostname}/rest)publicprivatev1_01Publicv1_01Privatez"https://docs.zondacrypto.exchange/z https://github.com/BitBayNet/APIz2https://zondaglobal.com/en/helpdesk/zonda-exchangez1https://zondaglobal.com/legal/zonda-exchange/fees)referrallogowwwapidocsupportfeesget)z{id}/allz{id}/marketz{id}/orderbookz{id}/tickerz{id}/tradespost)	infotradecancel	orderbookordersr   r   historytransactions)ztrading/tickerztrading/ticker/{symbol}ztrading/statsztrading/stats/{symbol}ztrading/orderbook/{symbol}ztrading/transactions/{symbol}z,trading/candle/history/{symbol}/{resolution})z&api_payments/deposits/crypto/addresseszpayments/withdrawal/{detailId}zpayments/deposit/{detailId}ztrading/offerztrading/stop/offertrading/config/{symbol}ztrading/history/transactionszbalances/BITBAY/historybalances/BITBAY/balancez#fiat_cantor/rate/{baseId}/{quoteId}zfiat_cantor/historyz>client_payments/v2/customer/crypto/{currency}/channels/depositzAclient_payments/v2/customer/crypto/{currency}/channels/withdrawalz.client_payments/v2/customer/crypto/deposit/feez1client_payments/v2/customer/crypto/withdrawal/fee)
ztrading/offer/{symbol}ztrading/stop/offer/{symbol}r   r   z7balances/BITBAY/balance/transfer/{source}/{destination}zfiat_cantor/exchangezapi_payments/withdrawals/cryptozapi_payments/withdrawals/fiatz*client_payments/v2/customer/crypto/depositz-client_payments/v2/customer/crypto/withdrawalz*trading/offer/{symbol}/{id}/{side}/{price}z/trading/stop/offer/{symbol}/{id}/{side}/{price}zbalances/BITBAY/balance/{id})r   r   deleteputz0.0z0.001)makertaker
percentage	tierBasedz0.0030z0.00430z0.00421250z0.00413750z0.00407500z0.003910000z0.003815000z0.003720000z0.003625000z0.003537500z0.003450000z0.003375000z0.0032100000z0.0031150000200000z0.0029250000z0.0028375000z0.0027500000z0.0026625000z0.0025875000z0.0024z0.0023z0.0022z0.0021z0.0020z0.0019z0.0018z0.0017)r   r   )r   r   r   r   tiersr   )tradingfiatfunding!v1_01PublicGetTradingTickerSymbolv1_01PublicGetTradingTicker)EURUSDGBPPLNfillResponseFromRequest)fetchTickerMethodfetchTickersMethodfiatCurrenciesr   )IOCFOKPOGTD)
marginModetriggerPricetriggerDirectiontriggerPriceTypestopLossPricetakeProfitPriceattachedStopLossTakeProfittimeInForcehedgedtrailingleveragemarketBuyByCostmarketBuyRequiresPriceselfTradePreventionicebergi )r   limitdaysBack	untilDayssymbolRequiredd   )r   r  triggerr   r  r  )	sandboxr?   createOrdersrm   
fetchOrderrs   fetchOrdersfetchClosedOrdersrn   )linearinverse)r0   r2   r3   400401402403404405406408501502503504505506509510FUNDS_NOT_SUFFICIENT)"OFFER_FUNDS_NOT_EXCEEDING_MINIMUMSOFFER_NOT_FOUND&OFFER_WOULD_HAVE_BEEN_PARTIALLY_FILLEDACTION_LIMIT_EXCEEDEDUNDER_MAINTENANCEREQUEST_TIMESTAMP_TOO_OLDPERMISSIONS_NOT_SUFFICIENTINVALID_STOP_RATETIMEOUTRESPONSE_TIMEOUTACTION_BLOCKEDINVALID_HASH_SIGNATUREGGCzGlobal Game Coin)idname	countries	rateLimithas
timeframeshostnameurlsr   r   optionsfeaturesprecisionMode
exceptionscommonCurrencies)deep_extendsuperr)   describeparse_numberr&   r   r    r   r   r%   r   r   r!   r"   r#   r$   r   )self	__class__s    H/var/www/html/volatility/venv/lib/python3.11/site-packages/ccxt/zonda.pyr=  zzonda.describe   s   eT 2 2 ; ; = =kkk %k 	k
 %k %k Uk $Uk 'k k "5k tk k $Uk  k  '!k" t#k k$ (%k& !%'k( )k* &u+k, "5-k. +E/k0 )%1k2 #E3k4 ,U5k6 '7k8 (9k: "5;k< =k> &t?k@ (AkB 1%CkD  Ek k kF &uGkH 'IkJ (KkL #EMkN *5OkP $UQkR uSkT "5UkV *5WkX +EYkZ )%[k\ t]k^  _k` !%akb %eckd $Uekf &ugk k kh -eikj /kkl "5mkn #Eokp +Eqkr skt !%ukv !%wkx "5ykz &u{k| +E}k~  k@ dAkB $UCkD +EEkF %eGkH !%Ik k kJ "4KkL uMkN #EOkP !$QkR "5SkT  UkV 'WkX $UYkZ !%[k\ *5]k^ (_k` %eakb )%ckd )%ekf tgkh ikj Ukk k kl tmkn "5okp #Eqkr &uskt 'ukv $Twkx  ykz ({k| )%}k~ "5k@ #DAkB CkD #EEkF &uGkH uIkJ uKkL UMk kN "'#(  Uk k kZ   /K~0=N#@$A	  96 PK &      
 
 
    
   "   EI
 7E%! %!EH HV "..u55!..w77"&!&	  "..x88!..x88"&!% "..x88$:K:KC:P:PQ!..x88$:K:KF:S:ST!..x88$:K:KF:S:ST!..x88$:K:KF:S:ST!..x88$:K:KG:T:TU!..x88$:K:KG:T:TU!..x88$:K:KG:T:TU!..x88$:K:KG:T:TU!..x88$:K:KG:T:TU!..x88$:K:KG:T:TU!..x88$:K:KG:T:TU!..x88$:K:KH:U:UV!..x88$:K:KH:U:UV!..x88$:K:KH:U:UV!..x88$:K:KH:U:UV!..x88$:K:KH:U:UV!..x88$:K:KH:U:UV!..x88$:K:KH:U:UV!..x88$:K:KH:U:UV'", "..x88$:K:KC:P:PQ!..x88$:K:KF:S:ST!..x88$:K:KF:S:ST!..x88$:K:KF:S:ST!..x88$:K:KG:T:TU!..x88$:K:KG:T:TU!..x88$:K:KG:T:TU!..x88$:K:KG:T:TU!..x88$:K:KG:T:TU!..x88$:K:KG:T:TU!..x88$:K:KG:T:TU!..x88$:K:KH:U:UV!..x88$:K:KH:U:UV!..x88$:K:KH:U:UV!..x88$:K:KH:U:UV!..x88$:K:KH:U:UV!..x88$:K:KH:U:UV!..x88$:K:KH:U:UV!..x88$:K:KH:U:UV'"-+ +1 1f s< <| &I&C">">">-t	   %&+(,,1,0).+06:#'#'"&#(	( ( #($)$)+/27/4#()$ $, %)&+!%$*%+*/& & #'&+!$#($)*/( ( $()-#U- -^ ## 
 ## g7 7p ' } |  |  |	 
 |  |  (  |  *  *  |  }  *  ' " }# $ y% & '(9' ( 7C#0:R):%2-9.>%1($1"2*=?     D )!u}@
 }@
 } } }	    c                     |                      |          }|                     |di           }t          |                                          }|                     |          S )a  

        https://docs.zondacrypto.exchange/reference/ticker-1

        retrieves data on all markets for zonda
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: an array of objects representing market data
        items)r   
safe_valuelistvaluesparse_markets)r?  paramsresponserD  marketss        rA  fetch_marketszzonda.fetch_markets  sW     33F;;( '266u||~~&&!!'***rB  c                    |                      |di           }|                     |d          }|                      |di           }|                      |di           }|                     |d          }|                     |d          }|                     |          }|                     |          }	|                      | j        di           }
|                      | j        dg           }|                     ||          s|                     |	|          r|                      | j        di           }
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 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marketcodefirstsecondcurrencyr   r   r   r.  symbol/basequotesettlebaseIdquoteIdsettleIdtyper0   Tr1   Fr2   r3   r4   activecontractr  r   r   scale)amountprice)minmaxminOffer)r   r_  r`  cost)r  r   r   contractSizeexpiryexpiryDatetime
optionTypestrike	precisionlimitscreatedr   )	rE  safe_stringsafe_currency_coder   r6  in_arraysafe_numberr>  parse_precision)r?  itemrN  r.  rP  rQ  rX  rY  rU  rV  r   r   s               rA  parse_marketzzonda.parse_market  s   x44ff--44266!!%44""6:66&&v..''00ty)R887GLL==~.. 	:$--~2V2V 	:??49fb99D2
"2
dSj5(2
 D2
 U	2

 d2
 f2
 w2
 2
 F2
 D2
 e2
 E2
 e2
 e2
 d2
  !2
" d#2
$ %%dG44%%dG44 "++D,@,@AQAQRWY`AaAa,b,bcc**4+?+?@P@PQWY`@a@a+b+bcc    
  ++E:>> 
   
    $ c2
 2
 2
 2	
rB  NrS  sincer  c                     |                                   i }|                     |                     ||                    }|                     |dg           }|                     |d||ddi          S )a  

        https://docs.zondacrypto.exchange/reference/active-orders

        fetch all unfilled currently open orders
        :param str symbol: not used by zonda fetchOpenOrders
        :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
        :returns Order[]: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
        rD  Nstatusopen)load_marketsv1_01PrivateGetTradingOfferextend	safe_listparse_orders)r?  rS  rt  r  rI  requestrJ  rD  s           rA  fetch_open_orderszzonda.fetch_open_orders  sr     	33DKK4P4PQQx"55  eUXv<NOOOrB  orderrN  c                 r   |                      |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|          S )NrN  -timestartAmountcurrentAmountpostOnlyr.  clientOrderIdr   	timestampdatetimelastTradeTimestamprv  rS  r[  moder   side	offerTyper`  rater   r_  rd  filled)	remainingaveragefeetrades)rm  safe_symbolsafe_integerrE  
safe_orderiso8601safe_string_lower)	r?  r  rN  marketIdrS  r  r_  r  r  s	            rA  parse_orderzzonda.parse_order  s   4 ##E844!!(FC88%%eV44	!!%77$$UO<<	??5*55  
$""5$// 
T 
 E 
 	 

 Y// 
 !$ 
 d 
 f 
 D$$UF33 
 4 
  
 D**5+>> 
 T%%eV44 
 D 
 f 
  D! 
" d# 
$ #+ 
  
  
, -  	rB  c                    |                                   i }|r0|                     |          g}|                     |          }||d<   d|                     |                     ||                    i}|                     |          }|                     |d          }	|                     |	d||          }
||
S |                     |
|          S )a  

        https://docs.zondacrypto.exchange/reference/transactions-history

        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>`
        rK  queryrD  N)	rx  	market_idrS  jsonrz  )v1_01PrivateGetTradingHistoryTransactionsrE  parse_tradesfilter_by_symbol)r?  rS  rt  r  rI  r}  rK  r  rJ  rD  results              rA  fetch_my_tradeszzonda.fetch_my_tradesL  s     	 	)~~f--.G[[((F!(GI		$++gv*F*F G GHAA%HH* '22""5$u==>M$$VV444rB  c                    |                      |d          }|-t          | j        dz   |                     |          z             d|i}t	          dt          |                    D ]}||         }|                     |d          }|                     |          }|                                 }|                     |d          |d<   |                     |d          |d	<   |||<   | 	                    |          S )
Nbalancesz empty balance response r   r   rR  lockedFundsusedavailableFundsfree)
rE  r   r.  r  rangelenrm  rn  accountsafe_balance)	r?  rJ  r  r  ibalance
currencyIdrO  r  s	            rA  parse_balancezzonda.parse_balancez  s    ??8Z88*D DtyyQYGZGZ Z[[[)q#h--(( 	# 	#AqkG))':>>J**:66DllnnG"..wFFGFO"..w8HIIGFO"F4LL  (((rB  c                 ~    |                                   |                     |          }|                     |          S )ae  

        https://docs.zondacrypto.exchange/reference/list-of-wallets

        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>`
        )rx  $v1_01PrivateGetBalancesBITBAYBalancer  )r?  rI  rJ  s      rA  fetch_balancezzonda.fetch_balance  s=     	<<VDD!!(+++rB  c           	         |                                   |                     |          }d|d         i}|                     |                     ||                    }|                     |dg           }|                     |dg           }|                     |d          }	|d         |                     |dd          |                     |dd          |	|                     |	          |                     |d          d	S )
a3  

        https://docs.zondacrypto.exchange/reference/orderbook-2

        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
        rS  r.  buysellr  racaseqNo)rS  bidsasksr  r  nonce)rx  rN  $v1_01PublicGetTradingOrderbookSymbolrz  rE  r  parse_bids_asksr  )
r?  rS  r  rI  rN  r}  rJ  rawBidsrawAsksr  s
             rA  fetch_order_bookzzonda.fetch_order_book  s    	V$$fTl
 <<T[[RX=Y=YZZ$ //(E266//(FB77%%h<<	X&(($==(($=="Y//&&x99
 
 	
rB  tickerc                    |                      |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|          S )NrN  rO  mr  r  rS  r  r  highhlowlbid
highestBid	bidVolumeask	lowestAsk	askVolumevwaprw  r24hcloselastpreviousClosepreviousRatechanger   r  v)
baseVolumequoteVolumer   )	rE  safe_string_2safe_marketr  safe_tickerr  r  rm  rp  )r?  r  rN  tickerMarketr  r  r  s          rA  parse_tickerzzonda.parse_ticker  s   L vx88%%lFC@@!!(F33%%ff55	vv.. !
d&&x88!
!
 Y//!
 D$$VS11	!

 4##FC00!
 4##FL99!
 !
 4##FK88!
 !
 D!
 D$$VV44!
 T!
 D!
 T__V^DD!
 d!
  $!!
" t#!
$ **6377)!
 !
 !
* +  	rB  c                     |                                   |                     |          }d|d         i}d}|                     | j        d|          }|                     |dd|          }d}||k    r*|                     |                     ||                    }nG|dk    r*|                     |                     ||                    }nt          | j	        dz             | 
                    |d	d
          }	|                     |	|          S )a  
        v1_01PublicGetTradingTickerSymbol retrieves timestamp, datetime, bid, ask, close, last, previousClose, v1_01PublicGetTradingStatsSymbol retrieves high, low, volume and opening price of an asset

        https://docs.zondacrypto.exchange/reference/market-statistics

        :param str symbol: unified symbol of the market to fetch the ticker for
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.method]: v1_01PublicGetTradingTickerSymbol(default) or v1_01PublicGetTradingStatsSymbol
        :returns dict: a `ticker structure <https://docs.ccxt.com/?id=ticker-structure>`
        rS  r.  r   r   methodN v1_01PublicGetTradingStatsSymbolzo fetchTicker params["method"] must be "v1_01PublicGetTradingTickerSymbol" or "v1_01PublicGetTradingStatsSymbol"r  stats)rx  rN  rm  r6  r  r   rz  r  r   r.  safe_value_2r  )
r?  rS  rI  rN  r}  r  defaultMethodr   rJ  r  s
             rA  fetch_tickerzzonda.fetch_ticker  s.    	V$$fTl
 5((7JFSS ..vxATVcdd&&==dkk'SY>Z>Z[[HH: "DDD<<T[[RX=Y=YZZHH TW  (Y  Y  Z  Z  Z!!(Hg>>  ///rB  symbolsc                    |                                   d}|                     | j        d|          }|                     |dd|          }d}||k    r|                     |          }n3|dk    r|                     |          }nt          | j        dz             |                     |d          }| 	                    ||          S )a  
 @ignore
        v1_01PublicGetTradingTicker retrieves timestamp, datetime, bid, ask, close, last, previousClose for each market, v1_01PublicGetTradingStats retrieves high, low, volume and opening price of each market

        https://docs.zondacrypto.exchange/reference/market-statistics

        :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 str [params.method]: v1_01PublicGetTradingTicker(default) or v1_01PublicGetTradingStats
        :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/?id=ticker-structure>`
        r   r   r  Nv1_01PublicGetTradingStatszd fetchTickers params["method"] must be "v1_01PublicGetTradingTicker" or "v1_01PublicGetTradingStats"rD  )
rx  rm  r6  r  r   r  r   r.  	safe_dictparse_tickers)r?  r  rI  r  r  r   rJ  rD  s           rA  fetch_tickerszzonda.fetch_tickersK  s     	.((7KVTT!//BVXeff''77??HH@  #???66v>>HH" TW  (N  N  O  O  Ox11!!%111rB  rO  c                 N   g }|0|                      |          }|                    |d                    d|i}|||d<   |||d<   |                     ||          }|                     d|                     |          i          }|d         }	|                     |	d||          S )ah  
        fetch the history of changes, actions done by the user or operations that altered the balance of the user

        https://docs.zondacrypto.exchange/reference/operations-history

        :param str [code]: unified currency code, default is None
        :param int [since]: timestamp in ms of the earliest ledger entry, default is None
        :param int [limit]: max number of ledger entries to return, default is None
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `ledger structure <https://docs.ccxt.com/?id=ledger-entry-structure>`
        Nr.  balanceCurrenciesfromTimer  r  rD  )rR  appendrz  $v1_01PrivateGetBalancesBITBAYHistoryr  parse_ledger)
r?  rO  rt  r  rI  r  rR  r}  rJ  rD  s
             rA  fetch_ledgerzzonda.fetch_ledger  s     }}T**H$$Xd^444!2
 "'GJ$GG++gv..<<gtyyQXGYGY=Z[[!  eU;;;rB  rr  rR  c                 p   |                      |d          }|                     |di           }|                     |d          }|                     ||          }|                     |di           }|                     |d          }d}t	          j        |d          rd}t	          j        |          }|                     |d	i           }	|                     |d
i           }
|                     ||                     |d          |d |                     |d          d |                     |                     |d                    | 	                    |          | 
                    |          |                     |	d          |                     |
d          d||                     |          d d|          S )Nr  r  rR  r  totalinr   outfundsBefore
fundsAfter	historyIddetailIdr[  ok)r   r.  	directionr  referenceIdreferenceAccountr[  rR  r_  beforeafterrv  r  r  r  )r  rE  rm  safe_currencyr'   	string_lt
string_negsafe_ledger_entryparse_ledger_entry_typern  r>  rp  r  )r?  rr  rR  r  r  r  r  r_  r  r  r  s              rA  parse_ledger_entryzzonda.parse_ledger_entry  s   X %%dF33	//$	266%%gz::
%%j(;;x44!!&'22	VS)) 	0I'//F oodM2>>__T<<<
%%""455"++D*== $001A1A$1O1OPP//
;;''//&&{G<<%%j'::"Y//'
 '
  !  	rB  c                 R    ddddddddddddddd}|                      |||          S )Ntransactionr  r   )	ADD_FUNDSBITCOIN_GOLD_FORKCREATE_BALANCEFUNDS_MIGRATIONWITHDRAWAL_LOCK_FUNDSWITHDRAWAL_SUBTRACT_FUNDSWITHDRAWAL_UNLOCK_FUNDSTRANSACTION_COMMISSION_OUTCOMETRANSACTION_COMMISSION_RETURN TRANSACTION_OFFER_ABORTED_RETURN"TRANSACTION_OFFER_COMPLETED_RETURNTRANSACTION_POST_INCOMETRANSACTION_POST_OUTCOMETRANSACTION_PRE_LOCKINGrm  )r?  r[  typess      rA  r  zzonda.parse_ledger_entry_type  sR    &!.+,%2)6'4.3-20729'.(/'.
 
  tT222rB  c           	      0   |                      |di           }|                     |d          |                     |d          |                     |d          |                     |d          |                     |d          |                     |d          gS )N   r   or  r  cr  )rE  r  rp  )r?  ohlcvrN  rP  s       rA  parse_ohlcvzzonda.parse_ohlcv  s     q"--eQ''UC((UC((UC((UC((UC((
 	
rB  r   	timeframec                 h   |                                   |                     |          }|d         dz   |d         z   }||                     | j        ||          d}|d}nt	          |d          }|                     |          }	||	z  dz  }
|&|                                 |d	<   |d	         |
z
  |d
<   n$||d
<   |                     |d
         |
          |d	<   |                     | 	                    ||                    }| 
                    |dg           }|                     |||||          S )a  

        https://docs.zondacrypto.exchange/reference/candles-chart

        fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
        :param str symbol: unified symbol of the market to fetch OHLCV data for
        :param str timeframe: the length of time each candle represents
        :param int [since]: timestamp in ms of the earliest candle to fetch
        :param int [limit]: the maximum amount of candles to fetch
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns int[][]: A list of candles ordered, open, high, low, close, volume
        rX  r  rY  )rS  
resolutionNr  i*  r.   tofromrD  )rx  rN  rm  r3  ra  parse_timeframemillisecondssum2v1_01PublicGetTradingCandleHistorySymbolResolutionrz  r{  parse_ohlcvs)r?  rS  r  rt  r  rI  rN  tradingSymbolr}  duration	timerangerJ  rD  s                rA  fetch_ohlcvzzonda.fetch_ohlcv  sM    	V$$x(3.	1BB#**4?IyQQ
 
 =EEu%%E''	22H$t+	= --//GDM%dmi7GFOO#GFO HHWV_i@@GDMJJ4;;W^`fKgKghh x"55  	5%HHHrB  r   c                    |                      |dd          }|                     |dd          }|                     |d          }d }||rdnd}|                     |dd	          }|                     |d
d          }|                     |d          }	|                     |d          }
|                     |
|d          }|d         }d }|	|dk    r|d         n|d         }||	d}|                     |d          }d }||rdnd}|                     |                     |d          |||                     |          |||||d |||d|          S )Nr  t
userActiontywasTakerr   r   r  rr_  acommissionValuerN  r  rS  r  rU  rV  )rR  rd  offerIdr  r.  )r.  r  r  r  rS  r[  r  r`  r_  rd  takerOrMakerr  r   )safe_integer_2safe_string_lower_2rE  r  rm  r  
safe_trader  )r?  r   rN  r  r  r0  r5  priceStringamountStringfeeCostStringr  rS  r  feeCurrencyr  r[  s                   rA  parse_tradezzonda.parse_trade6  s   D ''vs;;	''|TBB??5*55 &.;77GL((<<))%3??((0ABB##E844!!(FC88!$-1U]]&..K'% C   	22#177D""5$//"Y// "( 
  
   	rB  c                 T   |                                   |                     |          }|d         dz   |d         z   }d|i}||dz
  |d<   |||d<   |                     |                     ||                    }|                     |d	          }	|                     |	|||          S )
a#  

        https://docs.zondacrypto.exchange/reference/last-transactions

        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>`
        rX  r  rY  rS  Nr  r  r  rD  )rx  rN  'v1_01PublicGetTradingTransactionsSymbolrz  r{  r  )
r?  rS  rt  r  rI  rN  r(  r}  rJ  rD  s
             rA  fetch_tradeszzonda.fetch_trades  s     	V$$x(3.	1BBm
 "'!)GJ$GG??GU[@\@\]]x11  u===rB  r[  r  r_  r`  c                 v   |                                   |                     |          }|d         dz   |d         z   }t          |                     ||                    }||                                |d}	|                     |dd          }
|
du}|dk    }|d	k    }|d
k    p|o|}|dk    p|o|}|p|}|s|r#|                     ||          |	d<   |rd
nd|	d<   n%|s|r
|rdnd	|	d<   nt          | j        dz             | 	                    |ddg          }d}|r\|st          | j        dz             |                     ||
          |	d<   | 
                    |                     |	|                    }n)|                     |                     |	|                    }|                     |dd          }|                     |dd          }|rdn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i          S )*a  
        create a trade order

        https://docs.zondacrypto.exchange/reference/new-order

        :param str symbol: unified symbol of the market to create an order in
        :param str type: 'market' or 'limit'
        :param str side: 'buy' or 'sell'
        :param float amount: how much of currency you want to trade in units of base currency
        :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
        rX  r  rY  )rS  r  r_  	stopPricer   Nr  rN  z
stop-limitzstop-marketr  r  z createOrder() invalid typez[ createOrder() zonda requires `triggerPrice` parameter for stop-limit or stop-market ordersstopRater4  stopOfferId	completedFclosedrw  r   r.  r   r  r  r  rv  rS  r[  r  r`  r_  rd  r  r  r  r  r  r  )rx  rN  floatamount_to_precisionupperr  price_to_precisionr   r.  omit&v1_01PrivatePostTradingStopOfferSymbolrz  "v1_01PrivatePostTradingOfferSymbolr  	safe_boolrE  r  )r?  rS  r[  r  r_  r`  rI  rN  r(  r}  r   isStopLossPriceisLimitOrderisMarketOrderisStopLimitisStopMarketisStopOrderrJ  r.  rE  rv  r   s                         rA  create_orderzzonda.create_order  sS    	V$$x(3.	1BBt//??@@#
 

 ))&+OO't3w(|+R1Q/},S1R?!1\ 	I; 	I"55feDDGFO.9FllwGFOO 	Il 	I/;ImmGFOO*G GHHH6K#ABB 	]" M#DG  /L  %L  M  M  M"&"9"9&-"P"PGJBB4;;wX^C_C_``HH>>t{{7TZ?[?[\\Hn )]CCNN8[%@@	&2Fx@@  
" 
H 
  
 	 

 !$ 
 f 
 f 
 D 
 D 
 U 
 f 
 D 
 d 
  
 t 
  4! 
" l# 
$ T% 
  
   	rB  r.  c                    |                      |d          }|t          | j        dz             |                     |d          }|t          | j        dz             |                                  |                     |          }|d         dz   |d         z   }||||d	}|                     |                     ||                    }	|                     |	          S )
a  

        https://docs.zondacrypto.exchange/reference/cancel-order

        cancels an open order
        :param str id: order id
        :param str symbol: unified symbol of the market the order was made in
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: An `order structure <https://docs.ccxt.com/?id=order-structure>`
        r  Nz; cancelOrder() requires a `side` parameter("buy" or "sell")r`  z< cancelOrder() requires a `price` parameter(float or string)rX  r  rY  )rS  r.  r  r`  )	rm  r   r.  rE  rx  rN  /v1_01PrivateDeleteTradingOfferSymbolIdSidePricerz  r  )
r?  r.  rS  rI  r  r`  rN  r(  r}  rJ  s
             rA  cancel_orderzzonda.cancel_order  s     //<*g ghhh00=*h hiiiV$$x(3.	1BB#	
 
 GGT[]cHdHdee )))rB  c                 <    dddd}|                      ||d          S )NT)r   r   r   F)rN  )r?  rR  r   s      rA  is_fiatzzonda.is_fiat6  s/     
  

 ~~nh>>>rB  c                     |                      |d          }|                      |d          }|                     |           ||                     ||          d ||                      |d          dS )NrR  addresstag)r   rR  networkr\  r]  )rm  check_addressrn  )r?  depositAddressrR  r  r\  s        rA  parse_deposit_addresszzonda.parse_deposit_address>  s     %%njAA
"">9==7###"//
HEE##NE::
 
 	
rB  c                 >   |                                   |                     |          }d|d         i}|                     |                     ||                    }|                     |d          }|                     |d          }|                     ||          S )a  

        https://docs.zondacrypto.exchange/reference/deposit-addresses-for-crypto

        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
        :param str [params.walletId]: Wallet id to filter deposit adresses.
        :returns dict: an `address structure <https://docs.ccxt.com/?id=address-structure>`
        rR  r.  datar   )rx  rR  1v1_01PrivateGetApiPaymentsDepositsCryptoAddressesrz  rE  r  ra  )r?  rO  rI  rR  r}  rJ  rc  rP  s           rA  fetch_deposit_addresszzonda.fetch_deposit_addressS  s     	==&&
 II$++V]_eJfJfgg x00tQ''))%:::rB  codesc                     |                                   |                     |          }|                     |d          }|                     ||          S )a  

        https://docs.zondacrypto.exchange/reference/deposit-addresses-for-crypto

        fetch deposit addresses for multiple currencies and chain types
        :param str[]|None codes: zonda does not support filtering filtering by multiple codes and will ignore self parameter.
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a list of `address structures <https://docs.ccxt.com/?id=address-structure>`
        rc  )rx  rd  r{  parse_deposit_addresses)r?  rf  rI  rJ  rc  s        rA  fetch_deposit_addresseszzonda.fetch_deposit_addressesu  sT     	II&QQ ~~h//++D%888rB  fromAccount	toAccountc                    |                                   |                     |          }||||                     ||          d}|                     |                     ||                    }|                     ||          }	|                     | j        di           }
|                     |
dd          }|r||	d<   |	S )a  

        https://docs.zondacrypto.exchange/reference/internal-transfer

        transfer currency internally between wallets on the same account
        :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>`
        )sourcedestinationrR  fundsr   r   Tr_  )	rx  rR  currency_to_precision>v1_01PrivatePostBalancesBITBAYBalanceTransferSourceDestinationrz  parse_transferrE  r6  rN  )r?  rO  r_  rj  rk  rI  rR  r}  rJ  r   transferOptionsr   s               rA  r   zzonda.transfer  s     	==&&!$//f==	
 
 VVW[WbWbcjlrWsWstt: &&x:://$,
BGG"&..B[]a"b"b" 	(!'HXrB  r   c                 t   |                      |d          }|                     |di           }|                      |d          }|                     |di           }|                      |d          }|                      |d          }|d d d |                     ||          d |||                     |          d	S )Nrv  r"  r.  r!  rR  )	r   r.  r  r  rR  r_  rj  rk  rv  )rm  rE  rn  parse_transfer_status)	r?  r   rR  rv  rj  fromIdr!  toIdr  s	            rA  rr  zzonda.parse_transfer  s    : !!(H55ooh;;!!+t44__XtR00D))%%k:>>
//
HEE!0088

 

 
	
rB  rv  c                 :    ddd}|                      |||          S )Nr  failed)OkFailr  )r?  rv  statusess      rA  ru  zzonda.parse_transfer_status  s.    
 
 &&999rB  r\  r]  c                    |                      ||          \  }}|                     |           |                                  d}|                     |          }|d         ||d}|                     |          r*|                     |                     ||                    }n0|||d<   |                     |                     ||                    }|                     |d          }	| 	                    |	|          S )a  

        https://docs.zondacrypto.exchange/reference/crypto-withdrawal-1

        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.  )rR  r_  r\  r]  rc  )
handle_withdraw_tag_and_paramsr_  rx  rR  rZ  *v1_01PrivatePostApiPaymentsWithdrawalsFiatrz  ,v1_01PrivatePostApiPaymentsWithdrawalsCryptor  parse_transaction)
r?  rO  r_  r\  r]  rI  rJ  rR  r}  rc  s
             rA  r   zzonda.withdraw   s
    99#vFFV7###==&& 
 
 << 	gFFt{{SZ\bGcGcddHH!$HHU\^dIeIeffH ~~h//%%dH555rB  r  c                     |                      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 )Nr.  txidr  r  r^  addressFromr\  	addressTor_  r[  rR  rO  rv  updatedtagFromr]  tagTocomment)internalr  r   )r   rm  )r?  r  rR  s      rA  r  zzonda.parse_transaction*  s    %%dH55
$"";55
D
 
 	

 t
 4
 t
 
 d
 D
 (
 d
 t
 t
 4
  T!
" t#
$ )
 
 
 	
rB  r   GETc           	         |                      | j        d         |                   }|dk    rg|                     ||                     |                    }|d|                     ||          z   dz   z  }|r|d|                     |          z   z  }nP|dk    rd|                     ||                     |                    }|d|                     ||          z   z  }|r|d|                     |          z   z  }n|dk    r8|                                  |                     ||                     |                    }|d|                     ||          z   z  }t          |                                           }	d }
|dk    r(|r|d|                     |          z   z  }| j	        |	z   }
n$|"| 
                    |          }| j	        |	z   |z   }
|	|                                 | j	        |                     |                     |
          |                     | j                  t          j                  d	d
}n|                                  |                     |                     ||                                 d|                    }d| j	        |                     |                     |          |                     | j                  t          j                  d}||||dS )Nr   r   rT  z.json?r   r   POSTzapplication/json)zRequest-TimestampzOperation-IdAPI-KeyAPI-HashContent-Type)r  momentz!application/x-www-form-urlencoded)r  r  r  )urlr  bodyheaders)implode_hostnamer5  rK  extract_paramsimplode_params	urlencodecheck_required_credentialsstrr$  apiKeyr  uuidhmacencodesecrethashlibsha512rz  r  )r?  pathr   r  rI  r  r  r  r  r  payloads              rA  signz
zonda.signJ  s   ##DIe$4S$9::(??IIfd&9&9$&?&?@@E3,,T6:::WDDC 3sT^^E2222M!!IIfd&9&9$&?&?@@E3,,T6::::C 3sT^^E2222N""++---IIfd&9&9$&?&?@@E3,,T6::::C))++,,EG 73!6!666C+-yy''+-4%* $		; IIdkk'&:&:DKK<T<TV]Vdee 2 GG ++--->>$++**,,/ / # #  D
 !D; IIdkk$&7&7T[9Q9QSZSabb G
 fdwOOOrB  httpCodereasonr  r  r  r  c
                    |d S d|v rN|                      |d          }
| j        dz   |z   }|                     | j        |
|           t	          |          d|v r|                      |d          }|dk    rv|                     |d          }| j        dz   |z   }t          dt          |                    D ]&}||         }|                     | j        ||           't	          |          d S )NrO   rv  r{  errorsr   )rm  r.  throw_exactly_matched_exceptionr9  r   rE  r  r  )r?  r  r  r  r  r  r  rJ  requestHeadersrequestBodyrO  feedbackrv  r  r  errors                   rA  handle_errorszzonda.handle_errorsw  s   4X4 ##Hf55Dw}t+H00$QQQ)))!! %%h99F8<<7S=4/q#f++.. [ [A"1IE88%QYZZZZ#H---trB  )N)>__name__
__module____qualname__r   r=  r   r   rL  rs  r   r	   r   r~  dictr  r  r   r  r  r  r   r  r   r  r  r   r   r  r
   r  r   r  r  rF  r  r+  r   r=  r@  r   r   rG  r   rU  rX  boolrZ  r   ra  re  ri  r   r   rr  ru  r   r   r  r  intr  __classcell__)r@  s   @rA  r)   r)      s       ~# ~ ~ ~ ~ ~ ~@ $& + +$v, + + + +B@
F @
 @
 @
 @
D /3TXac P P P3 Pc Phlmrhs P P P P&6 6 6v 6 6 6 6 6p -1tRV_a ,5 ,5c ,5 ,5C ,5 ,5 ,5 ,5\) ) ) ) ) $& , ,( , , , , :>b ,
 ,
s ,
3 ,
Y ,
 ,
 ,
 ,
\@ @4 @ @6 @ @ @ @D 02 C0 C03 C0 C0 C0 C0J 04B F2 F2W F27 F2 F2 F2 F2P (,$TZ\ < < <C <s <aefqar < < < <8j jt jx j; j j j jX	3 3 3&
 
 
4 
 
 
 
0 9=4^bkm .I .I# .I# .IS .IX[ .Irvw{r| .I .I .I .I`H H Hv H H H H HT 6:UW > >3 >s ># >\`af\g > > > >4 gksu { {3 {i {y {RW {`c { { { {z 37r * *s *C * * * *>? ? ? ? ? ?
 
h 
R` 
 
 
 
* 79  ;  ;#  ;^  ;  ;  ;  ;D 8<B 9 9W 94P^K_ 9 9 9 98 [] 7 7S 7% 7c 7c 7an 7 7 7 7r-
 -
t -
x -
= -
 -
 -
 -
^:C :C : : : : KOWY (6 (6S (6% (6# (6C (6^i (6 (6 (6 (6T
 
T 
X 
Q\ 
 
 
 
@ &eBSW +P +P +P +PZ-c -3 -S -# -X\ -dg - - - - - - - -rB  r)   ).ccxt.base.exchanger   ccxt.abstract.zondar   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&   ccxt.base.preciser'   r)    rB  rA  <module>r     s   ( ' ' ' ' ' + + + + + +  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M  M       * * * * * * 0 0 0 0 0 0 - - - - - - - - - - - - ' ' ' ' ' ' & & & & & & . . . . . . ) ) ) ) ) ) * * * * * * 5 5 5 5 5 5 . . . . . . * * * * * * ) ) ) ) ) ) 4 4 4 4 4 4 % % % % % %H H H H HHk H H H H HrB  