
    eiZ                    h   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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/m0Z0  G d dee          Z1dS )    )Exchange)ImplicitAPIN)AnyBalances
CurrenciesCurrencyDepositAddressIntLedgerEntryMarketNumOrder	OrderBook	OrderSide	OrderTypeStrStringsTickerTickersFundingRateTradeTradingFeeInterfaceTradingFeesTransactionTransferEntry)List)ExchangeError)AuthenticationError)PermissionDenied)AccountSuspended)
BadRequest)InsufficientFunds)InvalidAddress)InvalidOrder)OrderNotFound)NotSupported)ExchangeNotAvailable)OnMaintenance)InvalidNonce)	TICK_SIZE)Precisec                       e Zd Zdef fdZi fdee         fdZd Zi fdZ	i fde
fdZdi fded	edefd
Zd]dededefdZi fdedefdZdi fdedefdZd Zd Zd]d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]d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defdZ i fdefdZ!i fdede"fdZ#d]dedede"fdZ$d  Z%i fde&fd!Z'di fd"efd#Z(d]d$Z)di fd%Z*d]d&Z+di fded'e,d(e-d)e.d*e/f
d+Z0ddi fd,eded'e,d(e-d)e/d*e/fd-Z1di fd,ede2fd.Z3di fde2fd/Z4d0e2fd1Z5di fd,ede2fd2Z6di fd,ede2fd3Z7dddi fde2ded	efd4Z8dddi fde2ded	efd5Z9d]defd6Z:dddi fd7e2ded	edee;         fd8Z<dddi fd7e2ded	edee;         fd9Z=d]d:ed;e>de;fd<Z?d0e2fd=Z@d]d>ededeAfd?ZBd@ ZCd]dAed;e>deDfdBZEdddi fd7e2ded	edeeD         fdCZFi fdedeGfdDZHd]dedeGfdEZIdddi fde2ded	edeeA         fdFZJdG ZKdH ZLi fd7edeMfdIZNdi fd7ed)e.dJedKe2de;f
dLZOi fd7ed)e.dMedNedePf
dOZQd]dPZRd0e2de2fdQZSdR ZTdSdTi ddfdUZUdVeVdWedXedYedZed[efd\ZW xZXS )^bitstampreturnc                    |                      t          t          |                                           i ddddddgddd	d
d| j        d         dddi ddddddddddddddddddddddddddddddd dd!di d"dd#dd$dd%dd&dd'dd(dd)dd*dd+dd,dd-dd.dd/dd0dd1dd2di d3dd4d5d6dd7dd8dd9dd:dd;dd<dd=dd>dd?dd@ddAddBddCddDdi dEddFddGddHddIddJddKddLddMddNddOddPddQddRddSddTddUdi dVddWddXddYddZdd[dd\dd]dd^dd_dd`ddaddbddcdddddeddfdi dgddhddiddjddkd5dlddmddnddoddpddqddrddsddtdduddvddwdxdydydzd{dyd|d}d~ddddddddddddddddddddddddddddddddiddddddd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ddddddddddddddddddddddi ddddddddddddddddddddddddddddddddddi ddddddddddddddddddddddddddddddddddi dddddddddddddddd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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d0dd1dd2dd3dd4dd5dd6dd7dd8dd9dd:d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i dMddNddOddPddQddRddSddTddUddVddWddXddYddZdd[dd\dd]di d^dd_dd`ddaddbddcdddddeddfddgddhddiddjddkddlddmddndi doddpddqddrddsddtdduddvddwddxddyddzdd{dd|dd}dd~ddddddddddddzdd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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ddi dddddddddd	dddt          dddiddi 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ʜidi dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          t          t           t"          t          dܜdݜddddd dddd dddddߜddddddddd ddd dddddddddd ddddd d ddid	d d dd d ddi          S (  Nidr-   nameBitstamp	countriesGB	rateLimitK   versionv2	userAgentchromeproThasCORSspotmarginFswapfutureoption	addMarginborrowCrossMarginborrowIsolatedMarginborrowMargincancelAllOrderscancelOrdercloseAllPositionsclosePositioncreateOrder$createOrderWithTakeProfitAndStopLoss&createOrderWithTakeProfitAndStopLossWscreateReduceOnlyOrdercreateStopLimitOrdercreateStopMarketOrdercreateStopOrderfetchBalancefetchBorrowInterestfetchBorrowRatefetchBorrowRateHistoriesfetchBorrowRateHistoryfetchBorrowRatesfetchBorrowRatesPerSymbolfetchCrossBorrowRatefetchCrossBorrowRatesfetchCurrenciesfetchDepositAddressfetchDepositAddressesfetchDepositAddressesByNetworkfetchDepositsWithdrawalsfetchDepositWithdrawFeeemulatedfetchDepositWithdrawFeesfetchFundingHistoryfetchFundingIntervalfetchFundingIntervalsfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchGreeksfetchIndexOHLCVfetchIsolatedBorrowRatefetchIsolatedBorrowRatesfetchIsolatedPositionsfetchLedgerfetchLeveragefetchLeveragesfetchLeverageTiersfetchLiquidationsfetchLongShortRatiofetchLongShortRatioHistoryfetchMarginAdjustmentHistoryfetchMarginModefetchMarginModesfetchMarketLeverageTiersfetchMarketsfetchMarkOHLCVfetchMarkPricesfetchMyLiquidationsfetchMySettlementHistoryfetchMyTrades
fetchOHLCVfetchOpenInterestfetchOpenInterestHistoryfetchOpenInterestsfetchOpenOrdersfetchOptionfetchOptionChain
fetchOrderfetchOrderBookfetchPositionfetchPositionHistoryfetchPositionModefetchPositionsfetchPositionsForSymbolfetchPositionsHistoryfetchPositionsRiskfetchPremiumIndexOHLCVfetchSettlementHistoryfetchTickerfetchTickersfetchTradesfetchTradingFeefetchTradingFeesfetchTransactionFeesfetchTransactionsfetchVolatilityHistoryfetchWithdrawalsreduceMarginrepayCrossMarginrepayIsolatedMarginsetLeverage	setMarginsetMarginModesetPositionModetransferwithdrawurlszOhttps://github.com/user-attachments/assets/d5480572-1fee-43cb-b900-d38c522d0024zhttps://www.bitstamp.net/api)publicprivatezhttps://www.bitstamp.net)logoapiwwwdoc
timeframes6018030090018003600720014400216004320086400259200)1m3m5m15m30m1h2h4h6h12h1d1wrequiredCredentials)apiKeysecretr   get   )zohlc/{pair}/zorder_book/{pair}/zticker/zticker_hour/{pair}/zticker/{pair}/ztransactions/{pair}/ztrading-pairs-info/zmarkets/zcurrencies/zeur_usd/ztravel_rule/vasps/zfunding_rate/{market_symbol}/zfunding_rate_history/{pair}/)travel_rule/contacts/zcontacts/{contact_uuid}/zearn/subscriptions/zearn/transactions/ztrade_history/ztrade_history/{pair}zaccount_balances/zaccount_balances/{currency}/zbalance/zbalance/{pair}/zbch_withdrawal/zbch_address/zuser_transactions/zuser_transactions/{pair}/zcrypto-transactions/
open_orderzopen_orders/all/zopen_orders/{pair}/zreplace_order/zorder_status/zcancel_order/zcancel_all_orders/zcancel_all_orders/{pair}/zbuy/{pair}/zbuy/market/{pair}/zbuy/instant/{pair}/zsell/{pair}/zsell/market/{pair}/zsell/instant/{pair}/ztransfer-to-main/ztransfer-from-main/zmy_trading_pairs/zfees/trading/zfees/trading/{market_symbol}zfees/withdrawal/zfees/withdrawal/{currency}/zwithdrawal-requests/zwithdrawal/open/zwithdrawal/status/zwithdrawal/cancel/zliquidation_address/new/zliquidation_address/info/zbtc_unconfirmed/zwebsockets_token/zrevoke_all_api_keys/zget_max_order_amount/zbtc_withdrawal/zbtc_address/zripple_withdrawal/zripple_address/zltc_withdrawal/zltc_address/zeth_withdrawal/zeth_address/zxrp_withdrawal/zxrp_address/zxlm_withdrawal/zxlm_address/zpax_withdrawal/zpax_address/zlink_withdrawal/zlink_address/zusdc_withdrawal/zusdc_address/zomg_withdrawal/zomg_address/zdai_withdrawal/zdai_address/zknc_withdrawal/zknc_address/zmkr_withdrawal/zmkr_address/zzrx_withdrawal/zzrx_address/zgusd_withdrawal/zgusd_address/zaave_withdrawal/zaave_address/zbat_withdrawal/zbat_address/zuma_withdrawal/zuma_address/zsnx_withdrawal/zsnx_address/zuni_withdrawal/zuni_address/zyfi_withdrawal/zyfi_address/zaudio_withdrawal/zaudio_address/zcrv_withdrawal/zcrv_address/zalgo_withdrawal/zalgo_address/zcomp_withdrawal/zcomp_address/zgrt_withdrawal/zgrt_address/zusdt_withdrawal/zusdt_address/zeurt_withdrawal/zeurt_address/zmatic_withdrawal/zmatic_address/zsushi_withdrawal/zsushi_address/zchz_withdrawal/zchz_address/zenj_withdrawal/zenj_address/zalpha_withdrawal/zalpha_address/zftt_withdrawal/zftt_address/zstorj_withdrawal/zstorj_address/zaxs_withdrawal/zaxs_address/zsand_withdrawal/zsand_address/zhbar_withdrawal/zhbar_address/zrgt_withdrawal/zrgt_address/zfet_withdrawal/zfet_address/zskl_withdrawal/zskl_address/zcel_withdrawal/zcel_address/zsxp_withdrawal/zsxp_address/zada_withdrawal/zada_address/zslp_withdrawal/zslp_address/zftm_withdrawal/zftm_address/zperp_withdrawal/zperp_address/zdydx_withdrawal/zdydx_address/zgala_withdrawal/zgala_address/zshib_withdrawal/zshib_address/zamp_withdrawal/zamp_address/zsgb_withdrawal/zsgb_address/zavax_withdrawal/zavax_address/zwbtc_withdrawal/zwbtc_address/zctsi_withdrawal/zctsi_address/zcvx_withdrawal/zcvx_address/zimx_withdrawal/zimx_address/znexo_withdrawal/znexo_address/zust_withdrawal/zust_address/zant_withdrawal/zant_address/zgods_withdrawal/zgods_address/zrad_withdrawal/zrad_address/zband_withdrawal/zband_address/zinj_withdrawal/zinj_address/zrly_withdrawal/zrly_address/zrndr_withdrawal/zrndr_address/zvega_withdrawal/zvega_address/z1inch_withdrawal/z1inch_address/zens_withdrawal/zens_address/zmana_withdrawal/zmana_address/zlrc_withdrawal/zlrc_address/zape_withdrawal/zape_address/zmpl_withdrawal/zmpl_address/zeuroc_withdrawal/zeuroc_address/zsol_withdrawal/zsol_address/zdot_withdrawal/zdot_address/znear_withdrawal/znear_address/zdoge_withdrawal/zdoge_address/zflr_withdrawal/zflr_address/zdgld_withdrawal/zdgld_address/zldo_withdrawal/zldo_address/r   zearn/subscribe/zearn/subscriptions/setting/zearn/unsubscribezwecan_withdrawal/zwecan_address/ztrac_withdrawal/ztrac_address/zeurcv_withdrawal/zeurcv_address/zpyusd_withdrawal/zpyusd_address/zlmwr_withdrawal/zlmwr_address/zpepe_withdrawal/zpepe_address/zblur_withdrawal/zblur_address/zvext_withdrawal/zvext_address/zcspr_withdrawal/zcspr_address/zvchf_withdrawal/zvchf_address/zveur_withdrawal/zveur_address/ztruf_withdrawal/ztruf_address/zwif_withdrawal/zwif_address/zsmt_withdrawal/zsmt_address/zsui_withdrawal/zsui_address/zjup_withdrawal/zjup_address/)zondo_withdrawal/zondo_address/zboba_withdrawal/zboba_address/zpyth_withdrawal/zpyth_address/)r   postfeesz0.004010000z0.003100000z0.002500000z0.00181500000z0.00165000000z0.001220000000z0.00150000000z0.0008	100000000z0.0006	250000000z0.0005
1000000000z0.0003z0.0001)takermaker)	tierBased
percentager   r   tiersr   g      @)	BTCBCHLTCETHXRPXLMPAXUSDEUR)r   r   r   deposit)tradingfundingprecisionModecommonCurrenciesUSTUSTCoptionsnetworksByIdzbitcoin-cashr   bitcoinr   ethereumERC20litecoinr   stellarr   xrplr   tronTRC20algorandALGOflareFLRhederaHBARcardanaADAsongbirdzavalanche-c-chainAVAXsolanaSOLpolkadotDOTnearNEARdogeDOGESUICSRP)suicasper
exceptionszNo permission foundzAPI key not foundzIP address not allowedzInvalid noncezInvalid signaturezAuthentication failedz+Missing key, signature and nonce parameterszWrong API key formatzYour account is frozenzIPlease update your profile with your FATCA information, before using API.zOrder not found.z*Price is more than 20% below market price.z@Bitstamp.net is under scheduled maintenance. We'll be back soon.zOrder could not be placed.zInvalid offset.z2Trading is currently unavailable for your account.)zMinimum order size isz'Check your account balance for details.zEnsure self value has at leastz"Ensure that there are no more than)exactbroadfeatures)IOCFOKPOGTD)
marginModetriggerPricetriggerPriceTypetriggerDirectionstopLossPricetakeProfitPriceattachedStopLossTakeProfittimeInForcehedgedtrailingleveragemarketBuyByCostmarketBuyRequiresPriceselfTradePreventioniceberg     )r  limitdaysBack	untilDayssymbolRequired)r  triggerr  r(  )r  r%  r)  r  r(  r%  )	sandboxrK   createOrdersr~   r   r   fetchOrdersfetchClosedOrdersr   )linearinverse)r>   r@   rA   )deep_extendsuperr-   describe
userAgentsparse_numberr*   r   r   r)   r%   r$   r(   r'   r!   r    r"   r#   )self	__class__s    Y/var/www/html/volatility/venv/lib/python3.11/site-packages/ccxt/async_support/bitstamp.pyr2  zbitstamp.describe   s   h 5 5 > > @ @ F	C
*F	C
JF	C
 $F	C

 F	C
 tF	C
 2F	C
 4F	C
  fff %f 	f
 %f %f Uf $Uf 'f f "4f tf $Uf  f tf  7!f" 9%#f f$ (%f& ''f( ()f* "5+f, -f. &u/f0 "51f2 +E3f4 )%5f6 #E7f8 ,U9f: ';f< (=f> "4?f@ &tAfB (CfD 1%Ef f fF +DGfH *:IfJ +DKfL &uMfN 'OfP (QfR #ESfT *5UfV $UWfX uYfZ "5[f\ *5]f^ +E_f` )%afb tcfd  eff !%gf f fh %eifj $Ukfl &umfn -eofp /qfr "5sft #Eufv +Ewfx yfz !%{f| "5}f~ &uf@ +EAfB  CfD dEfF $UGfH +EIf f fJ %eKfL "4MfN uOfP #EQfR dSfT !$UfV  WfX 'YfZ $U[f\ !%]f^ *5_f` (afb %ecfd )%eff )%gfh tifj kf f fl tmfn "4ofp #Dqfr 'sft $Zufv )%wfx #Dyfz {f| #E}f~ &uf@ uAfB UCfD  EfF "5GfH DIfJ DKf fF	C
` i<=  25 aF	C
r  sF	C
N "$ $OF	C
V ()./#$/0*+01/0$%'($%./9:89 & 2345/0./*+01 v+Qv6v #Av *1	v
 *1v 'v -av 4Qv /v %av +Av .qv )!v (v (v  -a!v" 4Q#v v$ &q%v& -a'v( .q)v* '+v, .q-v. //v0 ,Q1v2 .q3v4 ,Q5v6 (7v8 79v: +A;v< 6q=v> /?v@ +AAvB -aCvD -aEv v vF 3AGvH 4QIvJ +AKvL ,QMvN /OvP 0QvT *1UvV 'WvX -aYvZ *1[v\ *1]v^ '_v` *1avb 'cvd *1evf 'gvh *1iv v vj 'kvl *1mvn 'ovp +Aqvr (svt +Auvv (wvx *1yvz '{v| *1}v~ 'v@ *1AvB 'CvD *1EvF 'GvH *1IvJ 'Kv v vL +AMvN (OvP +AQvR (SvT *1UvV 'WvX *1YvZ '[v\ *1]v^ '_v` *1avb 'cvd *1evf 'gvh ,Qivj )!kvl *1mv v vn 'ovp +Aqvr (svt +Auvv (wvx *1yvz '{v| +A}v~ (v@ +AAvB (CvD ,QEvF )!GvH ,QIvJ )!KvL *1MvN 'Ov v vP *1QvR 'SvT ,QUvV )!WvX *1YvZ '[v\ ,Q]v^ )!_v` *1avb 'cvd +Aevf (gvh +Aivj (kvl *1mvn 'ovp *1qv v vr 'svt *1uvv 'wvx *1yvz '{v| *1}v~ 'v@ *1AvB 'CvD *1EvF 'GvH *1IvJ 'KvL +AMvN (OvP +AQvR (Sv v vT +AUvV (WvX +AYvZ ([v\ *1]v^ '_v` *1avb 'cvd +Aevf (gvh +Aivj (kvl +Amvn (ovp *1qvr 'svt *1uv v vv 'wvx +Ayvz ({v| *1}v~ 'v@ *1AvB 'CvD +AEvF (GvH *1IvJ 'KvL +AMvN (OvP *1QvR 'SvT *1UvV 'Wv v vX +AYvZ ([v\ +A]v^ (_v` ,Qavb )!cvd *1evf 'gvh +Aivj (kvl *1mvn 'ovp *1qvr 'svt *1uvv 'wvx ,Qyv v vz )!{v| *1}v~ 'v@ *1AvB 'CvD +AEvF (GvH +AIvJ (KvL *1MvN 'OvP +AQvR (SvT *1UvV 'WvX 0YvZ *1[v v v\ 6q]v^ +A_v` ,Qavb )!cvd +Aevf (gvh ,Qivj )!kvl ,Qmvn )!ovp +Aqvr (svt +Auvv (wvx +Ayvz ({v| +A}v v v~ (v@ +AAvB (CvD +AEvF (GvH +AIvJ (KvL +AMvN (OvP *1QvR 'SvT *1UvV 'WvX *1YvZ '[v\ *1]v^ '_v v` -.)*,-)*,-)*kv v v@ @%S SWF	C
~ !%"&!..w77!..w77 "..s33T5F5Fw5O5OP!..w779J9J79S9ST!..x88$:K:KG:T:TU!..x88$:K:KH:U:UV!..y994;L;LX;V;VW!..y994;L;LX;V;VW!..z::D<M<Mg<V<VW!..z::D<M<Mh<W<WX!..{;;T=N=Nx=X=XY!..{;;T=N=Nx=X=XY!..|<<d>O>OPX>Y>YZ" "..s33T5F5Fw5O5OP!..w779J9J79S9ST!..x88$:K:KG:T:TU!..x88$:K:KH:U:UV!..y994;L;LX;V;VW!..y994;L;LX;V;VW!..z::D<M<Mg<V<VW!..z::D<M<Mh<W<WX!..{;;T=N=Ns=S=ST!..{;;T=N=Ns=S=ST!..|<<d>O>OPS>T>TU" ! !F "'"' "       " 
  
 	 G3 3F	C
f YgF	C
h v!iF	C
p  !"E!u! ! 	!
 u! E! G! ! U! f! u! ! (! e! !  F!!" F#!$ !$'! ! !qF	C
^ )+;')< -.> $\	
 ()< ,-@ BCV +,? -.> `aq ' A, WXe 12F &z  IJZ!& .:?P6D:F	 ' _F	C
R $&+(-,0,1).+06:#'#'"&#'	( ( #($)$)+027/4#()$ $, %)&+!%$(%'*/& & ',#($)*/	# # ',!%#($)*/( ( $()-#_2 2h ## 
 ## q< <SF	C
 F	C
 F	 F	 F		    c                 $  K   |                      |           d{V }g }t          dt          |                    D ]Q}||         }|                     |d          |                     |d          g\  }}|                     |          }|                     |          }	d}
|                     |d          }|dz   |	z   }d}d}|dk    rd}n?|d	k    r9d
}|}
|dz   |	z   dz   |
z   }|                     |d          }|dk    rd}n|dk    rd}|dk    }|                    i d|                     |d          d|d|d|	d|
r|                     |
          ndd|d|d|
d|d|d|ddddd
| ddd |                     |d!          d"k    d#| |rdnd$|rdn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|S )/a-  
        retrieves data on all markets for bitstamp

        https://www.bitstamp.net/api/#tag/Market-info/operation/GetTradingPairsInfo

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: an array of objects representing market data
        Nr   base_currencycounter_currencymarket_type/SPOTr>   	PERPETUALr@   :payoff_typeLinearr.  Inverser/  r0   market_symbolsymbolbasequotesettlebaseIdquoteIdsettleIdtypesubTyper?   FrA   rB   activer   EnabledcontractTbase_decimalscounter_decimalsamountpriceminmaxminimum_order_amountmaximum_order_amountminimum_order_valuemaximum_order_value)r  rT  rU  cost)r.  r/  contractSizeexpiryexpiryDatetimestrike
optionType	precisionlimitscreatedinfo)	fetch_markets_from_cacherangelensafe_stringsafe_currency_codeappendr4  parse_precisionsafe_number)r5  paramsresponseresultimarketrI  rJ  rF  rG  rK  marketTypeRawrE  rL  rM  
payoffTypeisSpots                    r7  fetch_marketszbitstamp.fetch_marketsg  s      66v>>>>>>>>\ q#h--(( G	 G	Aa[F#//HH$JZJZ[acuJvJvwOFG**622D++G44E H ,,V]CCMCZ%'FDG&&+--"e+c1H<!--fmDD
))&GG9,,'GfnFMM 1d&&v??1&1 1 	1
 xQ$11(;;;T1 &1 71 H1 1 71 1 %1 %1 F
1 %1  4++FI>>)K!1" J#1$ #)2$$d#)444u $"&""//0D0DTEUEUV\^mEnEn0o0opp!..t/C/CDDTDTU[]oDpDp/q/qrr   $#! !
  $//8NOO#//8NOO 
  $# 
  $//8MNN#//8MNN  $  a1 1 1 1 1 1 1d r8  c                 ^   d}|                                  }|                     |          rd}|                     |                     |                     |                              }	|||||dd d |                     |d         d         d         |          |	|	d d|	d d|d dd d ddi d	S )
NcryptofiatTr   r   r   rV  )rT  rU  r]  r   )r0   coderf  rL  r1   rN  r   r   feerc  rd  networks)r2  is_fiatr4  rm  number_to_stringrn  )
r5  r0   r{  r1   rc  minCostoriginalPayloadcurrencyTypedescriptiontickSizes
             r7  construct_currency_objectz"bitstamp.construct_currency_object  s   mmoo<< 	"!L$$T%9%9$:O:OPY:Z:Z%[%[\\# ##K$7	$B:$NPTUU! $ 
 $ 
 # 
    $ ;
 
 	
r8  c                   K   |                      | j        di           }|                     |d          }|                     |dd          }|                                 }|	||z
  |k    r<|                     |           d {V }|                     |||d          | j        d<   |                      | j        d         d          S )Nry   	timestampexpiresr#  )rp  r  rp  )
safe_valuer   safe_integermillisecondspublicGetMarketsextend)r5  ro  r   r  r  nowrp  s          r7  rg  z!bitstamp.fetch_markets_from_cache  s       //$,CC%%g{;;	##GY==!!C)Ow#>#>!226::::::::H$ ,0;;w$ A A , ,DL( t|N;ZHHHr8  c           
        K   |                      |           d{V }i }t          dt          |                    D ]F}||         }|                     |d          |                     |d          g\  }}|                     |          }|                     |          }	|                     |d          }
|
                    d          \  }}|                     |d          }|                    d          }|d         }||vr3|                     |d	          }|                     ||||d|          ||<   |	|vrF|                     |d
          }|                     ||	|||                     |          |          ||	<   H|S )a+  
        fetches all available currencies on an exchange

        https://www.bitstamp.net/api/#tag/Market-info/operation/GetTradingPairsInfo

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an associative dictionary of currencies
        Nr   r:  r;  r  z / r[   rQ  rR  )	rg  rh  ri  rj  rk  splitr  r  r4  )r5  ro  rp  rq  rr  rs  rI  rJ  rF  rG  r  baseDescriptionquoteDescriptionminimumOrderpartsr]  baseDecimalscounterDecimalss                     r7  fetch_currencieszbitstamp.fetch_currencies/  s      66v>>>>>>>> q#h--(( 	S 	SAa[F#//HH$JZJZ[acuJvJvwOFG**622D++G44E**6=AAK0;0A0A%0H0H-O-++F4IJJL &&s++E8DFNN#00II#==fdO]ikoqwxxtVOO"&"3"3F<N"O"O $ > >wO_aprv  sD  sD  EI  sJ  sJ  LR  !S  !Sur8  NrE  r%  c                 z  K   |                                   d{V  |                     |          }d|d         i}|                     |                     ||                     d{V }|                     |d          }|                     |dz            }|                     ||d         |          }	||	d<   |	S )a?  
        fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data

        https://www.bitstamp.net/api/#tag/Order-book/operation/GetOrderBook

        :param str symbol: unified symbol of the market to fetch the order book for
        :param int [limit]: the maximum amount of order book entries to return
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/?id=order-book-structure>` indexed by market symbols
        Npairr0   microtimestampr#  rE  nonce)load_marketsrs  publicGetOrderBookPairr  r  parse_to_intparse_order_book)
r5  rE  r%  ro  rs  requestrp  r  r  	orderbooks
             r7  fetch_order_bookzbitstamp.fetch_order_bookZ  s       !!!!!!!!!V$$F4L
 44T[[&5Q5QRRRRRRRR" **85EFF%%nt&;<<	))(F84DiPP	+	'r8  tickerrs  c                    |                      |d          }|                     ||d           }|                     |d          }|                      |d          }|                      |d          }t          j        ||          }|                      |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|          S )Nr  r  vwapvolumelastrE  datetimehighlowbid	bidVolumeask	askVolumeopenclosepreviousClosechanger   average)
baseVolumequoteVolumerf  )rj  safe_symbolsafe_timestampr+   
string_mulsafe_tickeriso8601)
r5  r  rs  marketIdrE  r  r  r  r  r  s
             r7  parse_tickerzbitstamp.parse_ticker  s   " ##FF33!!(FD99''<<	//%%fh77
(T::// !
f!
!
 Y//!
 D$$VV44	!

 4##FE22!
 4##FE22!
 !
 4##FE22!
 !
 D!
 D$$VV44!
 T!
 D!
 T!
 d!
  $!!
" t#!
$ %&)!
 !
 !
* +  	r8  c                   K   |                                   d{V  |                     |          }d|d         i}|                     |                     ||                     d{V }|                     ||          S )a  
        fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market

        https://www.bitstamp.net/api/#tag/Tickers/operation/GetMarketTicker

        :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>`
        Nr  r0   )r  rs  publicGetTickerPairr  r  )r5  rE  ro  rs  r  r  s         r7  fetch_tickerzbitstamp.fetch_ticker  s       !!!!!!!!!V$$F4L
 //GV0L0LMMMMMMMM    000r8  symbolsc                    K   |                                   d{V  |                     |           d{V }|                     ||          S )a$  
        fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market

        https://www.bitstamp.net/api/#tag/Tickers/operation/GetCurrencyPairTickers

        :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/?id=ticker-structure>`
        N)r  publicGetTickerparse_tickers)r5  r  ro  rp  s       r7  fetch_tickerszbitstamp.fetch_tickers  si       !!!!!!!!!--f55555555" !!(G444r8  c                 r   |                      |d          }||S |                     |g d          }t          |                                          }t	          dt          |                    D ]E}||         }|                    d          dk     r"|                     ||          }|
|dk    r|c S Fd S )Ncurrency)r|  rU  r  rL  statusr0   r   _)safe_string_loweromitlistkeysrh  ri  findr  )r5  transaction
currencyIdidsrr  r0   values          r7   get_currency_id_from_transactionz)bitstamp.get_currency_id_from_transaction  s     ++KDD
!ii .
 .
 .
   ;##%%&&q#c((## 	 	AQBwws||a))+r::%EQJJIIItr8  c                    |                      |g d          }t          |                                          }t          |          }|dk    rFt	          | j        dz   |                     |          z   dz   |                     |          z             |dk    r^|d         |d         z   }|| j        v r|                     |          S |d         |d         z   }|| j        v r|                     |          S d S )N)r|  rU  r  tidrL  order_idside   z% getMarketFromTrade() too many keys: z in the trade: r   r   )	r  r  r  ri  r   r0   jsonmarkets_by_idsafe_market)r5  tradecurrencyIdsnumCurrencyIdsr  s        r7  get_market_from_tradezbitstamp.get_market_from_trade  s7   		% "
 "
 "
   5::<<(([))A*Q QTXT]T]^iTjTj jm~ ~  BF  BK  BK  LQ  BR  BR  !R  S  S  SQ"1~A6H4---''111"1~A6H4---''111tr8  r  c                 T   |                      |dd          }d }d }|                     |d          }|                     |d          }|                     |d          }d }	|                     |d          }
d }|t          |                                          }t	          dt          |                    D ]B}||         }|dk    r2|                    d          dk    r|}|                     ||d          }C||                     |          }|                     |d	          }|d
         }||n|d         }|                     |||          }|                     ||d         |          }|                     ||d         |
          }
|d         }|                      |dd          }d }|C|                    d          dk    r| 	                    |          }nt          |          }|dz  }d|v r3|0t          j        |d          }|rd}t          j        |          }n-d}n*|                     |d          }|dk    rd}n|dk    rd}nd }|
t          j        |
          }
d }|||d}|                     ||||                     |          |||	|d |||
|d|          S )Nr0   r  rU  rT  r  r]  r   r  r|  rG  rI  rJ  rE  dater  r  r#  r   sellbuyrL  1)r]  r  )r0   rf  r  r  rE  orderrL  r  takerOrMakerrU  rT  r]  r|  )safe_string_2rj  r  r  rh  ri  r  r  r  	parse8601intr+   	string_lt
string_neg
string_abs
safe_trader  )r5  r  rs  r0   rE  r  priceStringamountStringorderIdrL  
costStringrawMarketIdr  rr  
currentKeyfeeCostStringfeeCurrencypriceIddatetimeStringr  isAmountNegr|  s                         r7  parse_tradezbitstamp.parse_trade(  s   P tU33&&ug66''x88""5*55%%eV44
>

%%D1c$ii(( H H!!W
++
0D0D0I0I",K!--k63GGF >//66F((66Wo"-"9++t&&ug{CC''vh/?NN%%eVI->
KK
!++E6:FF	%""3''1,, NN>::		  //	%,	5=='%/cBB !!D#*#5l#C#CLL D##E622Ds{{! +J77J$%' C "Y//  " 
  
   	r8  sincec                   K   |                                   d{V  |                     |          }|d         dd}|                     |                     ||                     d{V }|                     ||||          S )a5  
        get the list of most recent trades for a particular symbol

        https://www.bitstamp.net/api/#tag/Transactions-public/operation/GetTransactions

        :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>`
        Nr0   hour)r  time)r  rs  publicGetTransactionsPairr  parse_trades)r5  rE  r  r%  ro  rs  r  rp  s           r7  fetch_tradeszbitstamp.fetch_trades  s       !!!!!!!!!V$$4L
 
 77GV8T8TUUUUUUUU&   65%@@@r8  c           	         |                      |d          |                     |d          |                     |d          |                     |d          |                     |d          |                     |d          gS )Nr  r  r  r  r  r  )r  rn  )r5  ohlcvrs  s      r7  parse_ohlcvzbitstamp.parse_ohlcv  s     {33UF++UF++UE**UG,,UH--
 	
r8  r   	timeframec                   K   |                                   d{V  |                     |          }|d         |                     | j        ||          d}|                     |          }|L|d|d<   nd}|                     |dz            }	|	|d<   |                     |	||dz
  z            |d<   ||d<   nQ|<|                     |dz            }	|	|d<   |                     |	||dz
  z            |d<   t          |d          |d<   |                     | 	                    ||                     d{V }
| 
                    |
d	i           }|                     |d
g           }|                     |||||          S )a  
        fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market

        https://www.bitstamp.net/api/#tag/Market-info/operation/GetOHLCData

        :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
        Nr0   )r  stepr#  r%  startr   enddataohlc)r  rs  rj  r   parse_timeframer  sumrW  publicGetOhlcPairr  r  	safe_listparse_ohlcvs)r5  rE  r  r  r%  ro  rs  r  durationr  rp  r	  r
  s                r7  fetch_ohlcvzbitstamp.fetch_ohlcv  s      !!!!!!!!!V$$4L$$T_iKK
 
 ''	22=}#'  ))%$,77#( !%%UQY1G!H!H#(   ))%$,77#( !%%UQY1G!H!H"5$//GG//GV0L0LMMMMMMMM x44~~dFB//  vy%GGGr8  c                    |d d d}|g }t          dt          |                    D ]}||         }|                     |d          }|                     |          }|                                 }|                     |d          |d<   |                     |d          |d<   |                     |d          |d<   |||<   |                     |          S )	N)rf  r  r  r   r  	availablefreereservedusedtotal)rh  ri  rj  rk  accountsafe_balance)r5  rp  rq  rr  currencyBalancer  currencyCoder  s           r7  parse_balancezbitstamp.parse_balance  s    
 

 Hq#h--(( 	+ 	+A&qkO))/:FFJ22:>>LllnnG"..LLGFO"..
KKGFO#//IIGG#*F<    (((r8  c                    K   |                                   d{V  |                     |           d{V }|                     |          S )ay  
        query for balance and get the amount of funds available for trading or funds locked in orders

        https://www.bitstamp.net/api/#tag/Account-balances/operation/GetAccountBalances

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `balance structure <https://docs.ccxt.com/?id=balance-structure>`
        N)r  privatePostAccountBalancesr  r5  ro  rp  s      r7  fetch_balancezbitstamp.fetch_balance   sg       !!!!!!!!!88@@@@@@@@ !!(+++r8  c                 f  K   |                                   d{V  |                     |          }d|d         i}|                     |                     ||                     d{V }|                     |d          }|                     ||d                   }|                     ||          S )ac  
        fetch the trading fees for a market

        https://www.bitstamp.net/api/#tag/Fees/operation/GetTradingFeesForCurrency

        :param str symbol: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `fee structure <https://docs.ccxt.com/?id=fee-structure>`
        NrD  r0   currency_pair)r  rs  privatePostFeesTradingr  index_by	safe_dictparse_trading_fee)r5  rE  ro  rs  r  rp  tradingFeesByMarketId
tradingFees           r7  fetch_trading_feezbitstamp.fetch_trading_fee8  s       !!!!!!!!!V$$VD\
 44T[[&5Q5QRRRRRRRR !%h H H^^$96$<HH
%%j&999r8  r|  c                     |                      |d          }|                     |di           }||                     ||          |                     |d          |                     |d          d d dS )Nrs  r   r   r   )rf  rE  r   r   r   r   )rj  r%  r  rn  )r5  r|  rs  r  r   s        r7  r&  zbitstamp.parse_trading_feeZ  s}    ##C22~~c62..&&x88%%dG44%%dG44
 
 	
r8  c                     d|i}t          dt          |                    D ]*}|                     ||                   }|d         }|||<   +|S )Nrf  r   rE  )rh  ri  r&  )r5  r   rq  rr  r|  rE  s         r7  parse_trading_feeszbitstamp.parse_trading_feesf  sZ    ~q#d))$$ 	! 	!A((a11C]F F6NNr8  c                    K   |                                   d{V  |                     |           d{V }|                     |          S )a[  
        fetch the trading fees for multiple markets

        https://www.bitstamp.net/api/#tag/Fees/operation/GetAllTradingFees

        :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
        N)r  r#  r,  r  s      r7  fetch_trading_feeszbitstamp.fetch_trading_feesn  sg       !!!!!!!!!44V<<<<<<<< &&x000r8  codesc                    K   |                                   d{V  |                     |           d{V }|                     |          S )an  
 @deprecated
        please use fetchDepositWithdrawFees instead

        https://www.bitstamp.net/api/#tag/Fees

        :param str[]|None codes: list of unified currency codes
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `fee structures <https://docs.ccxt.com/?id=fee-structure>`
        N)r  privatePostFeesWithdrawalparse_transaction_fees)r5  r/  ro  rp  s       r7  fetch_transaction_feeszbitstamp.fetch_transaction_fees  sg       !!!!!!!!!77???????? **8444r8  c                    i }|                      |d          }t          |                                          }t          dt	          |                    D ]}||         }|                     ||i           }|                     |          }	||                     |	|          sO|                     |d          i | 	                    ||          d||	<   |S )Nr  r   r|  )withdraw_feer   rf  )
r$  r  r  rh  ri  r  rk  in_arrayrn  r%  )
r5  rp  r/  rq  
currenciesr  rr  r0   r   r{  s
             r7  r2  zbitstamp.parse_transaction_fees  s    ]]8Z88
:??$$%%q#c((## 
	 
	AQB??8Q33D**2..D!4==u+E+E! $ 0 0u = =z266 F4LL
 r8  c                    K   |                                   d{V  |                     |           d{V }|                     |d          }|                     ||          S )at  
        fetch deposit and withdraw fees

        https://www.bitstamp.net/api/#tag/Fees/operation/GetAllWithdrawalFees

        :param str[]|None codes: list of unified currency codes
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `fee structures <https://docs.ccxt.com/?id=fee-structure>`
        Nr  )r  r1  group_byparse_deposit_withdraw_fees)r5  r/  ro  rp  responseByCurrencyIds        r7  fetch_deposit_withdraw_feesz$bitstamp.fetch_deposit_withdraw_fees  s~       !!!!!!!!!77????????  $}}XzBB//0DeLLLr8  c                 :   |                      |          }t          dt          |                    D ]g}||         }|                     |d          }|                     |          }|                     |d          }|d d|d<   |d dd d dd|d         |<   h|S )Nr   networkr|  )r|  r   r   )r   r   r}  )deposit_withdraw_feerh  ri  rj  network_id_to_codern  )	r5  r|  r  rq  jnetworkEntry	networkIdnetworkCodewithdrawFees	            r7  parse_deposit_withdraw_feez#bitstamp.parse_deposit_withdraw_fee  s    **3//q#c((## 	 	Aq6L((yAAI11)<<K**<??K""" "F: '"& 
  "& 	/ 	/F:{++ r8  rL  r  rT  rU  c                 "  K   |                                   d{V  |                     |          }|d         |                     ||          d}|                     |dd          }	|	|	|d<   |                     |dg          }d}
|                     |          }|dk    rg|dk    r1|                     |                     ||                     d{V }
n|                     |                     ||                     d{V }
n|dk    rf|dk    r0| 	                    |                     ||                     d{V }
n| 
                    |                     ||                     d{V }
n~|                     ||          |d	<   |dk    r0|                     |                     ||                     d{V }
n/|                     |                     ||                     d{V }
|                     |
|          }||d
<   |S )a6  
        create a trade order

        https://www.bitstamp.net/api/#tag/Orders/operation/OpenInstantBuyOrder
        https://www.bitstamp.net/api/#tag/Orders/operation/OpenMarketBuyOrder
        https://www.bitstamp.net/api/#tag/Orders/operation/OpenLimitBuyOrder
        https://www.bitstamp.net/api/#tag/Orders/operation/OpenInstantSellOrder
        https://www.bitstamp.net/api/#tag/Orders/operation/OpenMarketSellOrder
        https://www.bitstamp.net/api/#tag/Orders/operation/OpenLimitSellOrder

        :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>`
        Nr0   )r  rT  client_order_idclientOrderIdrs  BuyinstantrU  rL  )r  rs  amount_to_precisionr  r  
capitalizeprivatePostBuyMarketPairr  privatePostSellMarketPairprivatePostBuyInstantPairprivatePostSellInstantPairprice_to_precisionprivatePostBuyPairprivatePostSellPairparse_order)r5  rE  rL  r  rT  rU  ro  rs  r  rI  rp  capitalizedSider  s                r7  create_orderzbitstamp.create_order  sn     & !!!!!!!!!V$$4L..vv>>
 
 **63DoVV$)6G%&YYv'899F//$//8%''!%!>!>t{{7TZ?[?[!\!\\\\\\\!%!?!?GU[@\@\!]!]]]]]]]Y%''!%!?!?GU[@\@\!]!]]]]]]]!%!@!@WV\A]A]!^!^^^^^^^#66vuEEGG%''!%!8!8Wf9U9U!V!VVVVVVV!%!9!9$++gv:V:V!W!WWWWWWW  622fr8  r0   c                   K   |                                   d{V  |                     |          }|                     ||          |                     ||          d}	|                     |dd          }
|
|
|	d<   |                     |dg          }n||	d<   |                     |                     |	|                     d{V }|                     ||          }||d<   |S )a  
        edit a trade order

        https://www.bitstamp.net/api/#tag/Orders/operation/ReplaceOrder

        :param str id: order id
        :param str [symbol]: unified symbol of the market to create an order in
        :param str [type]: 'market', 'limit' or 'stop_limit'
        :param str [side]: 'buy' or 'sell'
        :param float [amount]: how much of the currency you want to trade in units of the base currency
        :param float [price]: the price for the order, in units of the quote currency, ignored in market orders
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.triggerPrice]: the price to trigger a stop order
        :param str [params.timeInForce]: for crypto trading either 'gtc' or 'ioc' can be used
        :param str [params.clientOrderId]: a unique identifier for the order, automatically generated if not sent
        :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
        NrS  rH  rI  r0   rL  )	r  rs  rL  rR  r  r  privatePostReplaceOrderr  rU  )r5  r0   rE  rL  r  rT  rU  ro  rs  r  rI  rp  r  s                r7  
edit_orderzbitstamp.edit_order  s     $ !!!!!!!!!V$$..vv>>,,VU;;
 
 **63DoVV$)6G%&YYv'899FFGDM55dkk'66R6RSSSSSSSS  622fr8  c                    K   |                                   d{V  d|i}|                     |                     ||                     d{V }|                     |          S )a  
        cancels an open order

        https://www.bitstamp.net/api/#tag/Orders/operation/CancelOrder

        :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>`
        Nr0   )r  privatePostCancelOrderr  rU  )r5  r0   rE  ro  r  rp  s         r7  cancel_orderzbitstamp.cancel_order9  s       !!!!!!!!!"
 44T[[&5Q5QRRRRRRRR )))r8  c                   K   |                                   d{V  d}i }d}|P|                     |          }|d         |d<   |                     |                     ||                     d{V }n/|                     |                     ||                     d{V }|                     |d          }|                     |          S )a  
        cancel all open orders

        https://www.bitstamp.net/api/#tag/Orders/operation/CancelAllOrders
        https://www.bitstamp.net/api/#tag/Orders/operation/CancelOrdersForMarket

        :param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
        Nr0   r  canceled)r  rs  privatePostCancelAllOrdersPairr  privatePostCancelAllOrdersr  parse_orders)r5  rE  ro  rs  r  rp  r_  s          r7  cancel_all_orderszbitstamp.cancel_all_ordersT  s       !!!!!!!!![[((F$TlGFO!@@WV\A]A]^^^^^^^^HH!<<T[[RX=Y=YZZZZZZZZH  >>(J77  ***r8  r  c                 @    dddddd}|                      |||          S )Nr  closedr_  	canceling)zIn QueueOpenFinishedCanceledzCancel pendingrj  r5  r  statusess      r7  parse_order_statuszbitstamp.parse_order_status{  s7     ")
 
 &&999r8  c                 f  K   |                                   d {V  |                     |dd          }i }|||d<   |                     |ddg          }n||d<   |                     |                     ||                     d {V }|                     |                     |d                    S )NrH  rI  r0   r  )r  safe_value_2r  privatePostOrderStatusr  rm  rj  )r5  r0   rE  ro  rI  r  rp  s          r7  fetch_order_statuszbitstamp.fetch_order_status  s      !!!!!!!!!))&2C_UU$)6G%&YYv(9?'KLLFFGDM44T[[&5Q5QRRRRRRRR&&t'7'7('K'KLLLr8  c                 r  K   |                                   d{V  d}||                     |          }|                     |dd          }i }|||d<   |                     |ddg          }n||d<   |                     |                     ||                     d{V }|                     ||          S )a  
        fetches information on an order made by the user

        https://www.bitstamp.net/api/#tag/Orders/operation/GetOrderStatus

        :param str id: the 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>`
        NrH  rI  r0   )r  rs  ro  r  rp  r  rU  )r5  r0   rE  ro  rs  rI  r  rp  s           r7  fetch_orderzbitstamp.fetch_order  s       !!!!!!!!![[((F))&2C_UU$)6G%&YYv(9?'KLLFFGDM44T[[&5Q5QRRRRRRRR& &111r8  c                 f  K   |                                   d{V  i }d}d}|%|                     |          }|d         |d<   |dz  }|||d<    t          | |          |                     ||                     d{V }|                     |dd          }	|                     |	|||          S )	ay  
        fetch all trades made by the user

        https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactions
        https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactionsForMarket

        :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>`
        NprivatePostUserTransactionsr0   r  Pairr%  rL  2)r  rs  getattrr  	filter_byr  )
r5  rE  r  r%  ro  r  methodrs  rp  rq  s
             r7  fetch_my_tradeszbitstamp.fetch_my_trades  s       !!!!!!!!!.[[((F$TlGFOfF$GG.v..t{{7F/K/KLLLLLLLL&#66  >>>r8  c                 J  K   d}|                      |dd          \  }}|r |                     d|||d|           d{V S |                                  d{V  i }d}| |                     |          }|d         |d<   |"t	          t          |dz                      |d	<   |                     d
||d          \  }}|||d<   |                     |                     ||                     d{V }| 	                    |dg           }	| 
                    |	|||          S )a  
        fetches historical funding rate prices

        https://www.bitstamp.net/api/#tag/Market-info/operation/GetFundingRateHistory

        :param str symbol: unified symbol of the market to fetch the funding rate history for
        :param int [since]: timestamp in ms of the earliest funding rate to fetch
        :param int [limit]: the maximum amount of `funding rate structures <https://docs.ccxt.com/?id=funding-rate-history-structure>` to fetch
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: timestamp in ms of the latest funding rate
        :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
        :param str [params.subType]: "linear" or "inverse"
        :returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/?id=funding-rate-history-structure>`
        Frg   paginate8hNr0   r  r#  since_timestampuntil_timestampMbP?r%  funding_rate_history)handle_option_and_params"fetch_paginated_call_deterministicr  rs  r  roundhandle_until_optionpublicGetFundingRateHistoryPairr  r  parse_funding_rate_histories)
r5  rE  r  r%  ro  r}  r  rs  rp  valuess
             r7  fetch_funding_rate_historyz#bitstamp.fetch_funding_rate_history  sv      88AZ\fgg& 	@@@AZ\bdikprvx~!!!!!!!!![[((F$TlGFO),U54<-@-@)A)AG%&223DgvW\]]$GG==dkk'SY>Z>Z[[[[[[[[ +A2FF00NNNr8  c                     |                      |dd          }|d |                     |d          ||                     |          dS )Nr  r  funding_rate)rf  rE  fundingRater  r  )safe_integer_productrn  r  )r5  rP  rs  r  s       r7  parse_funding_rate_historyz#bitstamp.parse_funding_rate_history  sU     --hUKK	++HnEE"Y//
 
 	
r8  r{  c                 @  K   |                                   d{V  i }|||d<   |                     |                     ||                     d{V }d}||                     |          }|                     |dddgd          }|                     ||||          S )a  
        fetch history of deposits and withdrawals

        https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactions

        :param str [code]: unified currency code for the currency of the deposit/withdrawals, default is None
        :param int [since]: timestamp in ms of the earliest deposit/withdrawal, default is None
        :param int [limit]: max number of deposit/withdrawals to return, default is None
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a list of `transaction structure <https://docs.ccxt.com/?id=transaction-structure>`
        Nr%  rL  r   r  F)r  ru  r  r  filter_by_arrayparse_transactions)	r5  r{  r  r%  ro  r  rp  r  transactionss	            r7  fetch_deposits_withdrawalsz#bitstamp.fetch_deposits_withdrawals  s       !!!!!!!!!$GG99$++gv:V:VWWWWWWWW6 }}T**H++HfsCj%PP&&|XueLLLr8  c                   K   |                                   d{V  i }||                                 |z
  |d<   nd|d<   |                     |                     ||                     d{V }|                     |d||          S )a(  
        fetch all withdrawals made from an account

        https://www.bitstamp.net/api/#tag/Withdrawals/operation/GetWithdrawalRequests

        :param str code: unified currency code
        :param int [since]: the earliest time in ms to fetch withdrawals for
        :param int [limit]: the maximum number of withdrawals structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/?id=transaction-structure>`
        N	timedeltai)r  r  privatePostWithdrawalRequestsr  r  )r5  r{  r  r%  ro  r  rp  s          r7  fetch_withdrawalszbitstamp.fetch_withdrawalsE  s       !!!!!!!!!#'#4#4#6#6#>GK  #+GK ;;DKKQW<X<XYYYYYYYY2 &&xueDDDr8  r  r  c                 ^   |                      |                     |d                    }|                     |          }|                     ||          }|                     |d          }d }d }d|v r|                     |d          }nE|&|                     ||d         |          }|d         }n|||                     |||          }|}|t	          j        |          }d}	d|v r)|                     |                     |d                    }	d }
d|v r(|                     |d          }|d	k    rd
}
n|dk    rd}
nd}
d }|                     |d          }|:|                    d          }t          |          }|dk    r|d         }|d         }d d d d}|||d d}i d|d|                     |d          d|                     |d          d|
d|dd d| 	                    |          d|	d|d| 
                    |          d|dd d|d|dd d|dd d d |dS )Nr  r|  rT  r0   r{  okr  rL  r   r   r  
withdrawaladdressz?dt=r   r   )r  r]  raterf  txidtransaction_idr  r>  r  addressFrom	addressTotagtagFromtagToupdated)commentinternalr|  )r  rj  r  rk  r+   r  parse_transaction_statusr  ri  r4  r  )r5  r  r  r  r  r{  feeCostr  rT  r  rL  rawTyper  r  addressPartsnumPartsr|  s                    r7  parse_transactionzbitstamp.parse_transactionr  s*   P NN4#3#3K#L#LMM	::;GG
&&z8<<"";66{""%%k8<<FF!%%k8D>6JJF"6*KKZ%;%%k:vFFFK'//F{""2243C3CKQY3Z3Z[[F[  &&{F;;G#~~ C#  D"";	::"==00L<((H!||&q/"1o
 

 ' C

K
$"";55
 D$$[2BCC
 D	

 
 t
 d''//
 f
 
 Y//
 w
 4
 
 3
 t
  S!
" t#
$ )
 
 
 	
r8  c                 @    dddddd}|                      |||          S )Npendingr  r_  failed)r   r  rw  34rj  rk  s      r7  r  z!bitstamp.parse_transaction_status  s9     
 
 &&999r8  r  c                    |                      |d          }|                      |d          }|                      |d          }|
|dk    rdnd}|                     |                      |d                    }|                     |d          }|                     ||d	          }|                     |                      |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|          S )Nr0   rH  rL  r  r  r  r  r"  r=  r  rT  r  rU  rI  r  lastTradeTimestamprE  r  postOnlyr  r  r]  filled	remaining)tradesr|  rf  r  )rj  r  r  r  rm  r  
safe_orderr  )r5  r  rs  r0   rI  r  r  r  rE  r  rT  r  rU  s                r7  rU  zbitstamp.parse_order  s   d eT**((0ABBv.."ckk66DNN4#3#3E:#F#FGG	))%AA!!(FC88(()9)9%)J)JKK!!%22unbAA  00  
" 
] 
 Y// 
 	 

 !$ 
 f 
 f 
 D 
 4 
  
 D 
 U 
 D 
 D 
 f 
  d! 
" # 
$ #+ 
  
  
, -  	r8  c                 >    ddddd}|                      |||          S )Nr  r  r   )r   r  rw  14rj  )r5  rL  typess      r7  parse_ledger_entry_typez bitstamp.parse_ledger_entry_typeI  s4    	
 
 tT222r8  itemc                    |                      |                     |d                    }|dk    r |                     |          }d }t          |                                          }t          dt          |                    D ]S}||                             d          dk    r2||                             dd          }| 	                    ||          }T|| 
                    |          }|d         dk    rdnd	}	|                     ||d
         |d         |d         |	d |d         d ||d         |d         d d d|d         d|          S |                     ||          }
d }	d|v r0|                     |d          }t          j        |d          rdnd	}	nld|
v rh|
d         `|                     |
d          }|                     |          }|                     ||d
                   }t          j        |d          rdnd	}	|                     ||
d
         |
d         |
d         |	d |
d         d ||
d         |
d         d d |
d         |
d         d|          S )NrL  r  r   r   r  r  inoutr0   r  r  r  rF  rT  r  r|  )rf  r0   r  r  	directionr  referenceIdreferenceAccountrL  r  rT  beforeafterr  r|  r   r  r  r  )r  rj  r  r  r  rh  ri  r  replacer  r  safe_ledger_entryr  r+   	string_gtr  )r5  r  r  rL  parsedTraders  r  rr  r  r  parsedTransactionrT  r  s                r7  parse_ledger_entryzbitstamp.parse_ledger_entryR  s   6 ++D,<,<T6,J,JKK7??**400KF		$$D1c$ii(( @ @7<<$$))#AwsB77H!--h??F ~33D99!,V!4!=!=EI))!$'(5'
3&*73$("6N%h/"5)+ +  !  $ !% 6 6tX F FI4))$99$+$5fc$B$BMDD		 1117H7T7`#//0A:NN==66))$??$+$5fc$B$BMDD	))'-.{;-j9&08$(-j9+H5+H5(/+ +  !  r8  c                   K   |                                   d{V  i }|||d<   |                     |                     ||                     d{V }d}||                     |          }|                     ||||          S )a~  
        fetch the history of changes, actions done by the user or operations that altered the balance of the user

        https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactions

        :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%  )r  ru  r  r  parse_ledger)r5  r{  r  r%  ro  r  rp  r  s           r7  fetch_ledgerzbitstamp.fetch_ledger  s       !!!!!!!!!$GG99$++gv:V:VWWWWWWWW}}T**H  8UEBBBr8  c                   K   |                                   d{V  |                     |          }d|d         i}|                     |                     ||                     d{V }|                     ||          S )an  
        fetch the current funding rate

        https://www.bitstamp.net/api/#tag/Market-info/operation/GetFundingRate

        :param str symbol: unified market symbol
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
        NrD  r0   )r  rs   publicGetFundingRateMarketSymbolr  parse_funding_rate)r5  rE  ro  rs  r  rp  s         r7  fetch_funding_ratezbitstamp.fetch_funding_rate  s       !!!!!!!!!V$$VD\
 >>t{{7TZ?[?[\\\\\\\\ &&x888r8  c                    |                      |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 iS )Nr  r#  next_funding_timers  rf  rE  	markPrice
indexPriceinterestRateestimatedSettlePricer  previousFundingRatenextFundingRatepreviousFundingTimestampnextFundingTimestamppreviousFundingDatetimenextFundingDatetimer  r  fundingTimestampfundingDatetimeinterval)r  rj  r  r  rn  )r5  r  rs  currentTimenextFundingRateTimestampr  s         r7  r  zbitstamp.parse_funding_rate  sg    //[$OO#'#<#<[J]_c#d#d ##K::
K
d&&x88
 
 $	

 D
 #D
 
 [11
 "4
 t
 '
 #D
 &t
 "4
 4++KHH
   8!
" t||,DEE#
$ %
 
 	
r8  c           	         K   d}|                                   d{V  ||                     |          }|                     |           d{V }|                     ||||ddd          S )af  
        fetch all unfilled currently open orders

        https://www.bitstamp.net/api/#tag/Orders/operation/GetAllOpenOrders
        https://www.bitstamp.net/api/#tag/Orders/operation/GetOpenOrdersForMarket

        :param str symbol: unified market symbol
        :param int [since]: the earliest time in ms to fetch open orders for
        :param int [limit]: the maximum number of  open orders structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns Order[]: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
        Nr  r%  )r  rL  )r  rs  privatePostOpenOrdersAllrb  )r5  rE  r  r%  ro  rs  rp  s          r7  fetch_open_orderszbitstamp.fetch_open_orders  s       !!!!!!!!![[((F66v>>>>>>>>   65%B
 B
   	r8  c                 *    |                                 S )zq
 @ignore
        :param str code: Unified currency code
        :returns str: lowercase version of code
        )lowerr5  r{  s     r7  get_currency_namezbitstamp.get_currency_name	  s     zz||r8  c                 &    |dk    p|dk    p|dk    S )Nr   r   GBP r  s     r7  r~  zbitstamp.is_fiat&	  s    u}>>>r8  c                   K   |                      |          rt          | j        dz   |z   dz             |                     |          }d|                     |          z   dz   } t          | |          |           d{V }|                     |d          }|                     |dd          }|                     |           ||d||d	S )
a  
        fetch the deposit address for a currency associated with self account

        https://www.bitstamp.net/api/#tag/Deposits/operation/GetCryptoDepositAddress

        :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>`
        z  fiat fetchDepositAddress() for z is not supported!privatePostAddressNr  memo_iddestination_tag)rf  r  r>  r  r  )	r~  r&   r0   r  rM  rx  rj  r  check_address)r5  r{  ro  r1   rz  rp  r  r  s           r7  fetch_deposit_addresszbitstamp.fetch_deposit_address)	  s       << 	ktw)KKdRUiijjj%%d++!6!66B.v..v66666666""8Y77  96GHH7###
 
 	
r8  r  r  c                 ^  K   |                      ||          \  }}|                                  d{V  |                     |           d|i}d}d}|                     |          sW|                     |          }	d|                     |	          z   dz   }|dk    r|||d<   n|dk    s|dk    r|||d	<   ||d
<   n'd}|                     |          }||d<   |d         |d<    t          | |          |                     ||                     d{V }
| 	                    |
|          S )a=  
        make a withdrawal

        https://www.bitstamp.net/api/#tag/Withdrawals/operation/RequestFiatWithdrawal
        https://www.bitstamp.net/api/#tag/Withdrawals/operation/RequestCryptoWithdrawal

        :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  r  
Withdrawalr   r  r   r   r  r  privatePostWithdrawalOpenibanr0   account_currency)
handle_withdraw_tag_and_paramsr  r  r~  r  rM  r  rx  r  r  )r5  r{  rT  r  r  ro  r  r  rz  r1   rp  s              r7  r   zbitstamp.withdrawC	  sw       99#vFFV!!!!!!!!!7###f
 ||D!! 	9))$//D"T__T%:%::\IFu}}?14G-.$&..?),GI&!(GI0F}}T**H%GFO*24.G&'.v..t{{7F/K/KLLLLLLLL%%h999r8  fromAccount	toAccountc                 X  K   |                                   d{V  |                     |          }|                     |                     ||                    |d                                         d}d}|dk    r5||d<   |                     |                     ||                     d{V }nR|dk    r5||d<   |                     |                     ||                     d{V }nt          | j	        dz             | 
                    ||          }	||	d<   ||	d<   ||	d	<   |	S )
a  
        transfer currency internally between wallets on the same account

        https://www.bitstamp.net/api/#tag/Sub-account/operation/TransferFromMainToSub
        https://www.bitstamp.net/api/#tag/Sub-account/operation/TransferFromSubToMain

        :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>`
        Nr0   )rT  r  main
subAccountz) transfer() only supports from or to mainrT  r  r  )r  r  parse_to_numericcurrency_to_precisionupperprivatePostTransferFromMainr  privatePostTransferToMainr!   r0   parse_transfer)
r5  r{  rT  r  r  ro  r  r  rp  r   s
             r7  r   zbitstamp.transferm	  sj      !!!!!!!!!==&&++D,F,FtV,T,TUU ,,..
 
 &  $-GL!!==dkk'SY>Z>Z[[[[[[[[HH&  $/GL!!;;DKKQW<X<XYYYYYYYYHHTW'RRSSS &&x::#"- )r8  c                 x    |                      |d          }|d d d |d         d d d |                     |          d	S )Nr  r{  )	rf  r0   r  r  r  rT  r  r  r  )rj  parse_transfer_status)r5  r   r  r  s       r7  r  zbitstamp.parse_transfer	  sV     !!(H55 (0088

 

 
	
r8  c                 :    ddd}|                      |||          S )Nr  r  )r  errorrj  rk  s      r7  r	  zbitstamp.parse_transfer_status	  s.    
 
 &&999r8  c                 *    |                                  S N)r  )r5  s    r7  r  zbitstamp.nonce	  s      """r8  r   GETc                 j   | j         d         |         dz   }|| j        dz   z  }||                     ||          z  }|                     ||                     |                    }|dk    r|r|d|                     |          z   z  }n#|                                  d| j        z   }	|                                 }
t          | 
                                          }d}d}|	|
||d}|d	k    r=|r|                     |          }d
}||d<   n|                     ddi          }d
}||d<   |r|nd}|	|z   |                    dd          z   |z   |
z   |z   |z   |z   }|                     |                     |          |                     | j                  t          j                  }||d<   ||||dS )Nr   r=  r   ?z	BITSTAMP r8   r  )zX-AuthzX-Auth-NoncezX-Auth-TimestampzX-Auth-VersionPOSTz!application/x-www-form-urlencodedzContent-Typefoobarzhttps://zX-Auth-Signature)urlrz  bodyheaders)r   r7   implode_paramsr  extract_params	urlencodecheck_required_credentialsr   uuidstrr  r  hmacencoder   hashlibsha256)r5  pathr   rz  ro  r  r  r  queryxAuth
xAuthNoncexAuthTimestampxAuthVersioncontentTypeauthBodyauth	signatures                    r7  signzbitstamp.sign	  s   is#c)t|c!!t""4000		&$"5"5d";";<<(?? 3sT^^E2222++---$+-EJ !2!2!4!455NLK *$2".	 G  :>>%00D"EK.9GN++  >>5%.99D"EK.9GN+#+ttH6>CKK
B$?$??+MPZZ]kknzz  ~F  FD		$++d"3"3T[[5M5Mw~^^I*3G&'fdwOOOr8  httpCodereasonr  rz  r  r  c
                    |d S |                      |d          }
|                     |d          }|
dk    s|g }t          |t                    r|                    |           n|t          |                                          }t          dt          |                    D ]a}||         }|                     ||          }t          |t
                    r| 	                    ||          }L|                    |           b|                     |di           }t          |t                    r|                    |           nR|                     |dg           }t          dt          |                    D ]}|                    ||                    |                      |d          }|dk    rt          | j        dz             | j        d	z   |z   }t          dt          |                    D ]N}||         }|                     | j        d
         ||           |                     | j        d         ||           Ot          |          d S )Nr  r  r   r-  __all__r{  API0005zL invalid signature, use the uid for the main account if you have subaccountsr  r  r  )rj  r  
isinstancer  rl  r  r  rh  ri  array_concatr   r0   throw_exactly_matched_exceptionr  throw_broadly_matched_exceptionr   )r5  r,  r-  r  rz  r  r  rp  requestHeadersrequestBodyr  r  errorsr  rr  keyr  reasonInnerallr{  feedbacks                        r7  handle_errorszbitstamp.handle_errors	  se   4 !!(H55'22g5#4F%%% 
-e$$$$"EJJLL))q#d)),, - -Aq'C OOE377E!%.. -!%!2!265!A!Ae,,,,//(HbAAK+s++ *k****ook9bAAq#c((++ * *AMM#a&))))##Hf55Dy  )$'  5C  +C  D  D  Dw}t+H1c&kk** ` `q	44T_W5MuV^___44T_W5MuV^____)))tr8  r  )Y__name__
__module____qualname__r   r2  r   r   rw  r  rg  r   r  r  r
   r   r  dictr   r  r  r   r   r  r  r  r   r  r   r  r  r  r   r  r   r   r)  r&  r,  r   r.  r3  r2  r<  rF  r   r   floatr   rW  rZ  r   r]  rc  rm  rq  rs  r{  r  r  r   r  r  r   r  r  r   rU  r  r   r  r  r   r  r  r  r  r~  r	   r  r   r   r   r  r	  r  r+  r  r<  __classcell__)r6  s   @r7  r-   r-      s
       G	# G	 G	 G	 G	 G	 G	R *, @ @V @ @ @ @D$
 $
 $
L 57 I I I I@ -/ ) ): ) ) ) )V @DB % %S % %S\ % % % %N- -4 - -6 - - - -^ 68 1 1 1F 1 1 1 1B 6:" 5 57 5 5 5 5 5<     D  .t t tv t t t t tl <@d[] %A %A %AS %A %Abfglbm %A %A %A %AN
 
 
4 
 
 
 
( ?CQUdhqs 2H 2H 2H 2H3 2H^a 2Hx|  ~B  yC 2H 2H 2H 2Hh) ) ) ) )& *, , , , , , ,0 ;=  :  :c  :AT  :  :  :  :D

 

T 

6 

EX 

 

 

 

   /1 1 1[ 1 1 1 16 =A 5 5' 5 5 5 52   " 7;2 M M M M2   . mqy{ 1 1 1I 1Y 1X] 1fi 1 1 1 1f fjx|  FH ! !3 ! !9 !I !_b !ru ! ! ! !F 9=R * *S *# * * * *6 59 %+ %+c %+ %+ %+ %+N: : : : : ?C2 
M 
M3 
M 
M 
M 
M 
M 8<B )2 )2C )2 )2 )2 )2 )2V 37TX\eg ? ?C ?s ?RU ? ? ? ?6 >BPTcgpr +O +Os +O# +O]` +O +O +O +OZ
 
6 
 
 
 
  <@daenp /M /MS /M /M[^ /Muy  {F  vG /M /M /M /Mb 37TX\eg +E +EC +Es +ERU +Elpq|l} +E +E +E +EZp
 p
T p
X p
Q\ p
 p
 p
 p
d:s : : : :U U Uv U U U U Un3 3 3U Ut Ux U; U U U Un .2SW`b C Cs C# CS Cgklwgx C C C C, <> 9 9s 9+ 9 9 9 94
 
f 
 
 
 
 
B 59tZ^gi " "c " "TW "nrsxny " " " "H  ? ? ? =? 
 
 
> 
 
 
 
4 QU]_ (: (:3 (: (: (:# (:do (: (: (: (:T ac $ $3 $ $C $TW $gt $ $ $ $L
 
 
 
":C :C : : : :# # # &eBSW &P &P &P &PP'c '3 'S '# 'X\ 'dg ' ' ' ' ' ' ' 'r8  r-   )2 ccxt.async_support.base.exchanger   ccxt.abstract.bitstampr   r  ccxt.base.typesr   r   r   r   r	   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-   r  r8  r7  <module>rJ     s   6 5 5 5 5 5 . . . . . .  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H  H       * * * * * * 0 0 0 0 0 0 - - - - - - - - - - - - ' ' ' ' ' ' . . . . . . + + + + + + ) ) ) ) ) ) * * * * * * ) ) ) ) ) ) 1 1 1 1 1 1 * * * * * * ) ) ) ) ) ) 4 4 4 4 4 4 % % % % % %a' a' a' a' a'x a' a' a' a' a'r8  