
    E#ib                         S SK Jr  S SKJr  S SKrS SKrS SKJrJrJ	r	J
r
JrJrJrJrJrJrJrJrJrJrJrJr  S SKJr  S SKJr  S SKJr  S SKJr   " S	 S
\\5      rg)    )Exchange)ImplicitAPIN)AnyBalancesCurrencyDepositAddressIntMarketNumOrder	OrderBook	OrderSide	OrderTypeStrTickerTradeTradingFeesTransaction)List)
BadRequest)	TICK_SIZE)Precisec                     ^  \ rS rSrS\4U 4S jjr0 4S\\   4S jjrS\	4S jr
0 4S\	4S jjrS0 4S\S	\S\4S
 jjrS1S\S\S\4S jjr0 4S\S\4S jjrS1S\S\S\4S jjrS\4S jrS0 4S\S\4S jjrSSS0 4S\S\S	\S\\   4S jjrSSS0 4S\S\S	\S\\   4S jjrSSS0 4S\S\S	\4S jjrS1S\S\S\4S jjrSS0 4S\S\S	\S\\   4S jjr0 4S\4S jjr S0 4S\S\!S\"S \#S!\$4
S" jjr%S0 4S\S\4S# jjr&0 4S$\S\'4S% jjr(S1S&\)S\'4S' jjr*S0 4S$\S \#S(\S)\S\+4
S* jjr,S1S+\S&\)S\+4S, jjr-S-S.0 SS4S/ jr.S0r/U =r0$ )2independentreserve   returnc                   > U R                  [        [        U ]  5       SSSS/SS0 SS _SS_S	S
_SS
_SS
_SS
_SS
_SS
_SS
_SS
_SS_SS
_SS
_SS_SS
_SS
_SS
_0 SS
_SS
_SS_SS
_SS
_SS
_SS
_S S
_S!S
_S"S_S#S
_S$S
_S%S
_S&S_S'S
_S(S
_S)S
_E0 S*S
_S+S
_S,S
_S-S
_S.S
_S/S
_S0S
_S1S
_S2S
_S3S
_S4S
_S5S
_S6S
_S7S
_S8S
_S9S
_S:S
_E0 S;S
_S<S
_S=S
_S>S_S?S
_S@S
_SAS
_SBS
_SCS
_SDS_SES
_SFS
_SGS
_SHS_SIS
_SJS
_SKS_E0 SLS_SMS
_SNS
_SOS
_SPS
_SQS
_SRS
_SSS
_STS
_SUS
_SVS
_SWS
_SXS_SYS_SZS
_S[S_S\S
_ES
S
S
S
S
S
S
S
SS].	ES^S_S`Sa.SbScSd.Se/ SfQ0Sg/ ShQ0Sa.SiU R	                  Sj5      U R	                  Sj5      SS
Sk.0S
S
S
S S
S
S
S S
S
S
S
Sl.S
S
S
S
S
S
S
Sm.S S
SnS S S
So.S
S
S
S
Sp.S
SnS
S
S
Sq.S S
SnS S S S
S
S
Sr.S Ss.	S S St.S S St.Su.SvSw0[
        0 SxSy_SzSy_S{S|_S}S~_SSy_SS_SS_SSy_SS_SS_SSy_SS_SSy_SSy_SSy_SSy_SSy_0 SSy_SSy_SSy_SS_SSy_SS_SSy_SS_SS_SSy_SSy_SSy_SS_SS_SS_SSy_SSy_ES|SyS~SSSSSSSSSSSS.S.S.5      $ )Nr   zIndependent ReserveAUNZi  TCORSspotmarginFswapfutureoption	addMarginborrowCrossMarginborrowIsolatedMarginborrowMargincancelOrdercloseAllPositionsclosePositioncreateOrdercreateReduceOnlyOrdercreateStopLimitOrdercreateStopMarketOrdercreateStopOrderfetchAllGreeksfetchBalancefetchBorrowInterestfetchBorrowRatefetchBorrowRateHistoriesfetchBorrowRateHistoryfetchBorrowRatesfetchBorrowRatesPerSymbolfetchClosedOrdersfetchCrossBorrowRatefetchCrossBorrowRatesfetchCurrenciesfetchDepositAddressfetchDepositAddressesfetchDepositAddressesByNetworkfetchFundingHistoryfetchFundingIntervalfetchFundingIntervalsfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchGreeksfetchIndexOHLCVfetchIsolatedBorrowRatefetchIsolatedBorrowRatesfetchIsolatedPositionsfetchLeveragefetchLeveragesfetchLeverageTiersfetchLiquidationsfetchLongShortRatiofetchLongShortRatioHistoryfetchMarginAdjustmentHistoryfetchMarginModefetchMarginModesfetchMarketLeverageTiersfetchMarketsfetchMarkOHLCVfetchMarkPricefetchMarkPricesfetchMyLiquidationsfetchMySettlementHistoryfetchMyTradesfetchOpenInterestfetchOpenInterestHistoryfetchOpenInterestsfetchOpenOrdersfetchOptionfetchOptionChain
fetchOrderfetchOrderBookfetchPositionfetchPositionForSymbolWsfetchPositionHistoryfetchPositionModefetchPositionsfetchPositionsForSymbolfetchPositionsForSymbolWsfetchPositionsHistoryfetchPositionsRiskfetchPremiumIndexOHLCVfetchSettlementHistoryfetchTickerfetchTradesfetchTradingFeefetchTradingFeesfetchUnderlyingAssets)	fetchVolatilityHistoryreduceMarginrepayCrossMarginrepayIsolatedMarginsetLeverage	setMarginsetMarginModesetPositionModewithdrawzdhttps://user-images.githubusercontent.com/51840849/87182090-1e9e9080-c2ec-11ea-8e49-563db9a38f37.jpgz)https://api.independentreserve.com/Publicz*https://api.independentreserve.com/Private)publicprivatez"https://www.independentreserve.comz&https://www.independentreserve.com/API)logoapiwwwdocget)GetValidPrimaryCurrencyCodesGetValidSecondaryCurrencyCodesGetValidLimitOrderTypesGetValidMarketOrderTypesGetValidOrderTypesGetValidTransactionTypesGetMarketSummaryGetOrderBookGetAllOrdersGetTradeHistorySummaryGetRecentTrades
GetFxRatesGetOrderMinimumVolumesGetCryptoWithdrawalFeesGetCryptoWithdrawalFees2GetNetworksGetPrimaryCurrencyConfig2post)GetOpenOrdersGetClosedOrdersGetClosedFilledOrdersGetOrderDetailsGetAccountsGetTransactionsGetFiatBankAccounts GetDigitalCurrencyDepositAddress!GetDigitalCurrencyDepositAddress2"GetDigitalCurrencyDepositAddresses#GetDigitalCurrencyDepositAddresses2	GetTradesGetBrokerageFeesGetDigitalCurrencyWithdrawalPlaceLimitOrderPlaceMarketOrderCancelOrder0SynchDigitalCurrencyDepositAddressWithBlockchainRequestFiatWithdrawalWithdrawFiatCurrencyWithdrawDigitalCurrencyWithdrawCryptotradingz0.005)takermaker
percentage	tierBased)IOCFOKPOGTD)
marginModetriggerPricetriggerPriceTypetriggerDirectionstopLossPricetakeProfitPriceattachedStopLossTakeProfittimeInForcehedgedselfTradePreventiontrailingleveragemarketBuyByCostmarketBuyRequiresPriceicebergd   )r   limitdaysBack	untilDayssymbolRequired)r   triggerr   r   )r   r   r   r   r   )r   r   r   daysBackCanceledr   r   r   r   )	sandboxr-   createOrdersr\   rc   r`   fetchOrdersr:   
fetchOHLCV)linearinverse)r!   r#   r$   PLAPlayChipUSDTEthereumUSDCBTCBitcoinBCHBitcoinCashETHLTCLitecoinXRP	XrpLedgerZRXEOSEosIoXLMStellarBATETCEthereumClassicLINKMKRDAICOMPSNXYFIAAVEGRTDOTPolkadotUNIADACardanoMATICDOGEDogecoinSOLSolanaMANASANDSHIBTRXTronRENDERWIFRLUSDPEPE	BitcoinSV)r   r   r   r   r   r   r   r   BSVr   r   r   r   r   )defaultNetworksnetworks)idname	countries	rateLimitprohasurlsr   feesfeaturescommonCurrenciesprecisionModeoptions)deep_extendsuperr   describeparse_numberr   )self	__class__s    _/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/async_support/independentreserve.pyr  independentreserve.describe   sZ   &8$ H J&)___ %_ 	_
 %_ %_ U_ $U_ '_ _ t_ $U_  _ t_ (_  '!_" (#_$ "5%_& !%'_( )_* &u+_, "5-_. +E/_0 )%1_2 #E3_4 ,U5_6 $T7_8 '9_: (;_< "5=_> &t?_@ (A_B 1%C_D &uE_F 'G_H (I_J #EK_L *5M_N $UO_P uQ_R "5S_T *5U_V +EW_X )%Y_Z  [_\ !%]_^ %e__` $Ua_b &uc_d -ee_f /g_h "5i_j #Ek_l +Em_n o_p !%q_r !%s_t "5u_v &uw_x +Ey_z  {_| $U}_~ +E_@ %eA_B "4C_D uE_F #EG_H dI_J !$K_L  M_N +EO_P 'Q_R $US_T !%U_V *5W_X ,UY_Z ([_\ %e]_^ )%__` )%a_b tc_d te_f "5g_h #Di_j (k_l +0 %$)',$"!&#( }_B IK <?  ,  -0d !..w7!..w7"&!&	  %&+(-,0,1).+06:#(#("'#(	( #(/4$)$)+027#()$, %)&+!$$(%)*/& ',#($)*/	# ',!$#($)*/( $(&+!$$(,0%)#($)*/	* #'q9v ##
 ##CJ z! '#$J#$J#$ 9#$ =	#$
 :#$ :#$ ;#$ :#$ 7#$ 9#$ :#$ ,#$ J#$ :#$ :#$  J!#$" :##$$ :%#$& J'#$( :)#$* :+#$, :-#$. 9/#$0 Z1#$2 J3#$4 85#$6 J7#$8 J9#$: J;#$< 6=#$> h?#$@ 8A#$B ZC#$D JE#$J %%(%&"$,&&%$#!K5afM
 f f	    c                   #    U R                  U5      nU R                  U5      nU R                  U5      n[        R                  " X#U/6 I Sh  vN u  pVn/ n[        S[        U5      5       H  n	XY   n
U R                  U
5      nU R                  Xz5      n[        S[        U5      5       H  nXm   nU R                  U5      nU
S-   U-   nUR                  0 SU_SUS-   U-   _SU_SU_SS_S	U
_S
U_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SSSSSSSSS.SSS.USS.SSS.SSS.S.SUS.
E5        M     M     U$  N7f)z
retrieves data on all markets for independentreserve
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: an array of objects representing market data
Nr   /r  symbolbasequotesettlebaseIdquoteIdsettleIdtyper!   Tr"   Fr#   r$   r%   activecontractr   )amountprice)minmax)r   r(  r)  cost)
r   contractSizeexpiryexpiryDatetimestrike
optionType	precisionlimitscreatedinfo)
%publicGetGetValidPrimaryCurrencyCodes'publicGetGetValidSecondaryCurrencyCodespublicGetGetOrderMinimumVolumesasynciogatherrangelensafe_currency_codesafe_numberappend)r  paramsbaseCurrenciesPromisequoteCurrenciesPromiselimitsPromisebaseCurrenciesquoteCurrenciesr3  resultir"  r  	minAmountjr#  r   r  s                    r  fetch_markets independentreserve.fetch_markets<  s<     !% J J6 R!%!M!Mf!U<<VD8?I^  yF  IG  9H  3H/ q#n-.A#&F**62D((8I1c/23),//8c\G+ 0"0dSj500 D0 U	0
 d0 f0 w0 0 F0 D0 e0 E0 e0 e0 d0  !0" d#0$  $$("&*""&"&!%" $(#'%
 $-#'#
 $(#'"
 $(#'!$  $_0 0	 4	 /r G 3Hs   AEE C2Ec                 .   SU0n[        S[        U5      5       Hh  nX   nU R                  US5      nU R                  U5      nU R	                  5       nU R                  US5      US'   U R                  US5      US'   XrU'   Mj     U R                  U5      $ )Nr5  r   CurrencyCodeAvailableBalancefreeTotalBalancetotal)r;  r<  safe_stringr=  accountsafe_balance)r  responserF  rG  balance
currencyIdcoderS  s           r  parse_balance independentreserve.parse_balance  s    )q#h-(AkG))'>BJ**:6DllnG"..w8JKGFO#//HGG"4L )   ((r  c                    #    U R                  5       I Sh  vN   U R                  U5      I Sh  vN nU R                  U5      $  N. N7f)a  
query for balance and get the amount of funds available for trading or funds locked in orders
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
N)load_marketsprivatePostGetAccountsrY  )r  r@  rU  s      r  fetch_balance independentreserve.fetch_balance  sE      !!!44V<<!!(++ 	"<s   A	AA	AA	A	Nr  r   c           	      >  #    U R                  5       I Sh  vN   U R                  U5      nUS   US   S.nU R                  U R                  XS5      5      I Sh  vN nU R	                  U R                  US5      5      nU R                  XdS   USSS	S
5      $  N N@7f)a  
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
Nr"  r#  primaryCurrencyCodesecondaryCurrencyCodeCreatedTimestampUtcr  	BuyOrders
SellOrdersPriceVolume)r\  marketpublicGetGetOrderBookextend	parse8601rR  parse_order_book)r  r  r   r@  ri  requestrU  	timestamps           r  fetch_order_book#independentreserve.fetch_order_book  s      !!!V$#)(#3%+I%6
 33DKK4PQQNN4#3#3H>S#TU	$$Xh/?KYegnpxyy 	" Rs"   BBABB?BBtickerri  c                 r   U R                  U R                  US5      5      nU R                  US5      nU R                  US5      nS nUb  Ub  US-   U-   nU R                  XbS5      nUS   nU R                  US5      nU R                  0 SU_SU_SU R	                  U5      _S	U R                  US
5      _SU R                  US5      _SU R                  US5      _SS _SU R                  US5      _SS _SS _SS _SU_SU_SS _SS _SS _SU R                  US5      _U R                  US5      S US.EU5      $ )Nrd  PrimaryCurrencyCodeSecondaryCurrencyCoder  r  	LastPricero  datetimehighDayHighestPricelowDayLowestPricebidCurrentHighestBidPrice	bidVolumeaskCurrentLowestOfferPrice	askVolumevwapopencloselastpreviousClosechanger   averageDayAvgPrice DayVolumeXbtInSecondaryCurrrency)
baseVolumequoteVolumer5  )rl  rR  safe_marketsafe_tickeriso8601)	r  rr  ri  ro  r"  r#  defaultMarketIdr  r  s	            r  parse_tickerindependentreserve.parse_ticker  s    NN4#3#3F<Q#RS	!!&*?@""6+BCW%8$slW4O!!/3?!4 !
f!
!
 Y/!
 D$$V->?	!

 4##F,<=!
 4##F,DE!
 !
 4##F,EF!
 !
 D!
 D!
 T!
 D!
 T!
 d!
  $!!
" t''>#!
$ **63UV)!
* + 	r  c                    #    U R                  5       I Sh  vN   U R                  U5      nUS   US   S.nU R                  U R                  XB5      5      I Sh  vN nU R	                  XS5      $  NY N7f)ah  
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
:param str symbol: unified symbol of the market to fetch the ticker for
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
Nr"  r#  ra  )r\  ri  publicGetGetMarketSummaryrk  r  )r  r  r@  ri  rn  rU  s         r  fetch_tickerindependentreserve.fetch_ticker  sz      !!!V$#)(#3%+I%6
 77G8TUU   22) 	" Vs"   A4A0AA4A2A42A4orderc           
      L   S nU R                  US5      nU R                  US5      nS nS nUb.  Ub+  U R                  U5      nU R                  U5      nUS-   U-   nOUb  US   nUS   nUS   nU R                  USS5      nS n	Ub^  UR                  S	5      S
:  a  Sn	OUR                  S5      S
:  a  Sn	UR                  S5      S
:  a  SnOUR                  S5      S
:  a  SnU R	                  U R                  US5      5      n
U R                  US5      nU R                  US5      nS nUb  Ub  [
        R                  " X5      nU R                  0 SU_SU R                  US5      _SS _SU
_SU R                  U
5      _SS _SU_SU_SS _SS _SU	_S U R                  US!5      _S"S _S#U R                  US$5      _S%U R                  US&5      _S'U R                  US(S)5      _S*U_U R                  US+5      U R                  U R                  US,5      5      UUUS-.S S..EU5      $ )/Nrt  ru  r  r  r  r   Typer   Bidr   buyOffersellr
   ri  Limitr   rd  VolumeFilled
FeePercentr5  r  	OrderGuidclientOrderIdro  rw  lastTradeTimestampr%  r   postOnlysider)  rg  r   r,  Valuer  AvgPricer(  VolumeOrderedrh  filledOutstandingStatus)rater,  currency)	remainingstatusfeetrades)
rR  r=  safe_string_2findrl  r   
string_mul
safe_orderr  parse_order_status)r  r  ri  r  r"  r#  r  r   	orderTyper  ro  r  feeRatefeeCosts                 r  parse_orderindependentreserve.parse_order  s   d !!%)>?""5*ABW%8**62D++G4ECZ%'FH%F&>D7OE&&ufkB	 ~~e$)(A-~~h'1,$	(A-#	NN4#3#3E;P#QR	!!%8""5,76#5((9G  
E 
$""5+6 
 T 
 	 

 Y/ 
 !$ 
 f 
 I 
 4 
  
 D 
 T%%eW5 
 D 
 D$$UG4 
 t''z: 
  d((J! 
" f# 
$ ))%?--d.>.>uh.OP 
 3 
4 5 	r  r  c                 :    SSSSSSSS.nU R                  X!U5      $ )Nr  closedcanceled)OpenPartiallyFilledFilledPartiallyFilledAndCancelled	CancelledPartiallyFilledAndExpiredExpired)rR  )r  r  statusess      r  r  %independentreserve.parse_order_statusk  s3    %+5#)3!
 &99r  r  c                    #    U R                  5       I Sh  vN   U R                  U R                  SU0U5      5      I Sh  vN nSnUb  U R                  U5      nU R	                  XE5      $  NV N-7f)a/  
fetches information on an order made by the user
: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>`
N	orderGuid)r\  privatePostGetOrderDetailsrk  ri  r  )r  r  r  r@  rU  ri  s         r  fetch_orderindependentreserve.fetch_orderw  s}      !!!88F
:   [[(F11 	"s!   A1A-*A1A/,A1/A1sincec                 f  #    U R                  5       I Sh  vN   U R                  0 5      nSnUb!  U R                  U5      nUS   US'   US   US'   Uc  SnSUS'   X5S	'   U R                  U R	                  XT5      5      I Sh  vN nU R                  US
/ 5      nU R                  XX#5      $  N N+7f)a  
fetch all unfilled currently open orders
:param str symbol: unified market symbol
:param int [since]: the earliest time in ms to fetch open orders for
:param int [limit]: the maximum number of  open 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"  rb  r#  rc  2      	pageIndexpageSizeData)r\  orderedri  privatePostGetOpenOrdersrk  	safe_listparse_orders	r  r  r  r   r@  rn  ri  rU  datas	            r  fetch_open_orders$independentreserve.fetch_open_orders  s      !!!,,r"[[(F-3H-=G)*/5i/@G+,=E #
66t{{77STT~~h3  u<< 	" U"   B1B-A,B1B/*B1/B1c                 f  #    U R                  5       I Sh  vN   U R                  0 5      nSnUb!  U R                  U5      nUS   US'   US   US'   Uc  SnSUS'   X5S	'   U R                  U R	                  XT5      5      I Sh  vN nU R                  US
/ 5      nU R                  XX#5      $  N N+7f)a  
fetches information on multiple closed orders made by the user
:param str symbol: unified market symbol of the market orders were made in
:param int [since]: the earliest time in ms to fetch orders for
:param int [limit]: the maximum number of order structures to retrieve
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
Nr"  rb  r#  rc  r  r  r  r  r  )r\  r  ri  privatePostGetClosedOrdersrk  r  r  r  s	            r  fetch_closed_orders&independentreserve.fetch_closed_orders  s      !!!,,r"[[(F-3H-=G)*/5i/@G+,=E #
88W9UVV~~h3  u<< 	" Wr  r  c                 B  #    U R                  5       I Sh  vN   U R                  USS5      nUc  SnU R                  UUS.5      nU R                  U R	                  Xd5      5      I Sh  vN nSnUb  U R                  U5      nU R                  US   XU5      $  N N27f)a~  
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>`
Nr  r  r  )r  r  r  )r\  safe_integerr  privatePostGetTradesrk  ri  parse_trades)	r  r  r  r   r@  r  rn  rU  ri  s	            r  fetch_my_trades"independentreserve.fetch_my_trades  s      !!!%%fk1=	=E,," 
  224;;w3OPP[[(F  &!16%HH 	" Qs"   BBAB*B+1BBtradec                    U R                  US   5      nU R                  US5      nU R                  US5      nU R                  USS5      nU R                  USS5      nU R                  U5      nU R                  U5      n	U R                  [        R
                  " Xg5      5      n
U R                  US5      nU R                  US	5      nS nUb  Ub  US
-   U-   nU R                  XS
5      nU R                  US5      nUb/  UR                  S5      S:  a  SnOUR                  S5      S:  a  SnU R                  UUUU R                  U5      UUS US UU	U
S S.U5      $ )NTradeTimestampUtc	TradeGuidr  rg  SecondaryCurrencyTradePriceVolumeTradedPrimaryCurrencyAmountrt  ru  r  r   r  r   r  r  r  )r  r5  ro  rw  r  r  r%  r  takerOrMakerr)  r(  r,  r  )
rl  rR  r  r  r   r  safe_symbolr  
safe_trader  )r  r  ri  ro  r  orderIdpriceStringamountStringr)  r(  r,  r"  r#  marketIdr  r  s                   r  parse_tradeindependentreserve.parse_trade  s   NN5)<#=>	e[1""5+6((9VW))%AXY!!+.""<0  !3!3K!NO!!%)>?""5*ABW%8|g-H!!(C8{3yy1$7#q("Y/  
  	r  c                    #    U R                  5       I Sh  vN   U R                  U5      nUS   US   SS.nU R                  U R                  Xd5      5      I Sh  vN nU R	                  US   XRU5      $  N_ N7f)a  
get the list of most recent trades for a particular symbol
:param str symbol: unified symbol of the market to fetch trades for
:param int [since]: timestamp in ms of the earliest trade to fetch
:param int [limit]: the maximum amount of trades to fetch
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
Nr"  r#  r  )rb  rc  numberOfRecentTradesToRetrieveTrades)r\  ri  publicGetGetRecentTradesrk  r  )r  r  r  r   r@  ri  rn  rU  s           r  fetch_tradesindependentreserve.fetch_trades  s      !!!V$#)(#3%+I%6.0

 66t{{77STT  (!3VEJJ 	" Us"   A:A6AA:A8A:8A:c                 f  #    U R                  5       I Sh  vN   U R                  U5      I Sh  vN n0 n[        S[        U5      5       HC  nX$   nU R	                  US5      nU R                  U5      nU R                  US5      nUUS.X7'   ME     0 n	[        S[        U R                  5      5       Hs  nU R                  U   n
U R                  U
5      nU R                  X;S   0 5      nU R                  US5      U
U R                  US5      U R                  US5      S	S	S
.X'   Mu     U	$  GN N7f)z
fetch the trading fees for multiple markets
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
Nr   rM  Fee)r5  r  r  r5  r  T)r5  r  r   r   r   r   )
r\  privatePostGetBrokerageFeesr;  r<  rR  r=  r>  symbolsri  
safe_value)r  r@  rU  r  rG  r  rW  rX  
tradingFeerF  r  ri  s               r  fetch_trading_fees%independentreserve.fetch_trading_fees  s2     !!!99&AA q#h-(A+C))#~>J**:6D))#u5J!DJ ) q#dll+,A\\!_F[[(F//$v;CV4 ))#u5))#u5"!FN	 - E 	"As    D1D,D1D/C=D1/D1r%  r  r(  r)  c                   #    U R                  5       I Sh  vN   U R                  U5      nU R                  U5      nXS:X  a  SOS-  nU R                  US   US   US.5      n	Sn
XIS'   US	:X  a-  XYS
'   U R	                  U R                  X5      5      I Sh  vN n
O(U R                  U R                  X5      5      I Sh  vN n
U R                  U
U
S   S.U5      $  N NG N 7f)a  
create a trade 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>`
Nr  r  r  r"  r#  )rb  rc  r  volumer   r)  r  )r5  r  )r\  ri  
capitalizer  privatePostPlaceLimitOrderrk  privatePostPlaceMarketOrderr  )r  r  r%  r  r(  r)  r@  ri  r  rn  rU  s              r  create_orderindependentreserve.create_order1  s      !!!V$OOD)	We;	,,#)(#3%+I%6" 
 
 "7?$G!<<T[[=YZZH!==dkk'>Z[[H;' 
  	! 	" [[s4   C#CB C#C(C# C!C#C#!C#c                    #    U R                  5       I Sh  vN   SU0nU R                  U R                  XC5      5      I Sh  vN nU R                  U5      $  NA N7f)aR  
cancels an open order

https://www.independentreserve.com/features/api#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>`
Nr  )r\  privatePostCancelOrderrk  r  )r  r  r  r@  rn  rU  s         r  cancel_orderindependentreserve.cancel_orderQ  sa      !!!
 44T[[5QRR  ))) 	" Ss!   AA+AAAArX  c                    #    U R                  5       I Sh  vN   U R                  U5      nSUS   0nU R                  U R                  XB5      5      I Sh  vN nU R	                  U5      $  NU N7f)ad  
fetch the deposit address for a currency associated with self account

https://www.independentreserve.com/features/api#GetDigitalCurrencyDepositAddress

: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>`
Nrb  r  )r\  r  +privatePostGetDigitalCurrencyDepositAddressrk  parse_deposit_address)r  rX  r@  r  rn  rU  s         r  fetch_deposit_address(independentreserve.fetch_deposit_addressr  st      !!!==&!8D>
 II$++V]Jfgg ))(33 	"
 hs!   A0A,?A0A.A0.A0r  c                     U R                  US5      nU R                  U5        UU R                  US5      S UU R                  US5      S.$ )Nr   rX  Tag)r5  r  networkaddresstag)rR  check_address)r  depositAddressr  r  s       r  r  (independentreserve.parse_deposit_address  sX     "">3CD7#"((6:##NE:
 	
r  r  r  c                   #    U R                  XE5      u  pEU R                  5       I Sh  vN   U R                  U5      nUS   UU R                  X5      S.nUb  XGS'   SnU R	                  U5      u  pUb  [        U R                  S-   5      eU R                  U R                  Xu5      5      I Sh  vN n	U R                  X5      $  N N7f)aP  
       make a withdrawal

       https://www.independentreserve.com/features/api#WithdrawDigitalCurrency

       :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

EXCHANGE SPECIFIC PARAMETERS
       :param dict [params.comment]: withdrawal comment, should not exceed 500 characters
       :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
       Nr  )rb  withdrawalAddressr(  destinationTagz1 withdraw() does not accept params["networkCode"])
handle_withdraw_tag_and_paramsr\  r  currency_to_precisionhandle_network_code_and_paramsr   r  "privatePostWithdrawDigitalCurrencyrk  parse_transaction)
r  rX  r(  r  r  r@  r  rn  networkCoderU  s
             r  r}   independentreserve.withdraw  s       99#F!!!==&#+D>!(00>

 ?(+$%"AA&I"TWW'ZZ[[@@WA]^^$ %%h99? 	" _s"   'CCBC1C	2C	Ctransactionc                    U R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  XR5      n	0 SU_SU R                  US	5      _S
S _SS_SU	_SS _SU R                  US5      _SU R                  US5      _SU R	                  U5      _SU_SU_SS _SU_SU_SS _SU_SS _S U	U R                  US5      S S.SS.E$ ) NAmountDestinationrt  rd  Addressr  r5  r  TransactionGuidtxidr%  r}   r  r  r(  Totalr  r  ro  rw  r  addressFrom	addressTor  tagFromtagToupdatedr  )r  r,  r  F)commentr  internal)	safe_dictrR  r=  r>  rl  )
r  r'  r  r(  destinationrW  rw  r  r  rX  s
             r  r$  $independentreserve.parse_transaction  s   $ X6nn[-@%%k3HI
##K1FG"";	:{E2&&z<
K
$"";0AB
 D
 J	

 
 t
 d&&vw7
 d&&{H=
 1
 
 w
 4
 
 3
 t
  S!
" t#
$  ((7
 1
 	
r  r~   GETc                 Z   U R                   S   U   S-   U-   nUS:X  a   U(       a  USU R                  U5      -   -  nGOiU R                  5         U R                  5       nUSU R                  -   S[        U5      -   /n	[        UR                  5       5      n
[        S[        U
5      5       H+  nX   n[        XL   5      nU	R                  US-   U-   5        M-     S	R                  U	5      nU R                  U R                  U5      U R                  U R                  5      [        R                   5      nU R#                  0 5      nU R                  US
'   UUS'   UR%                  5       US'   [        S[        U
5      5       H  nX   nXL   UU'   M     U R'                  U5      nSS0nXsXeS.$ )Nr   r  r~   ?zapiKey=znonce=r   =,apiKeynonce	signaturezContent-Typezapplication/json)urlmethodbodyheaders)r  	urlencodecheck_required_credentialsr?  r>  strlistkeysr;  r<  r?  joinhmacencodesecrethashlibsha256r  upperjson)r  pathr   rB  r@  rD  rC  rA  r?  authrI  rG  keyvaluemessager@  querys                    r  signindependentreserve.sign  s   iis#c)D0(?sT^^F333++-JJLEDKK'3u:%D
 &D1c$i(gFK(C#I-. ) hhtnG		$++g"6DKK8PRYR`R`aILL$E"kkE(O"E'N!*!2E+1c$i(g#[c
 ) 99U#D%'9:GdOOr   )N)1__name__
__module____qualname____firstlineno__r   r  r   r
   rJ  r   rY  r^  rG  r	   r   rp  dictr   r  r  r   r  r   r  r  r  r  r  r   r  r  r   r  r   r   floatr   r
  r  r   r  r   r  r   r}   r$  rX  __static_attributes____classcell__)r  s   @r  r   r      s   g# gR	 *, NV N`
) 
) *, , , @DB zS z zS\ z$,4 , ,6 ,\ 68 3 3F 3:j jv j jX
: 
: 8<B 2C 2 2" 59tZ^gi =c = =TW =nrsxny =0 7;\`ik = =3 =VY =ptuzp{ =0 37TXZce IC Is IRU I.# #v # #J <@d[] K KS K Kbfglbm K& /1 ([ (T mqy{  I Y X] fi @ 9=R *S *# *B =? 4 4> 44
h 
R` 
& QU]_ 0:3 0: 0: 0:# 0:do 0:d2
T 2
X 2
Q\ 2
h &eBSW P Pr  r   )  ccxt.async_support.base.exchanger    ccxt.abstract.independentreserver   r9  rN  ccxt.base.typesr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   typingr   ccxt.base.errorsr   ccxt.base.decimal_to_precisionr   ccxt.base.preciser   r   rZ  r  r  <module>rj     sO    6 8   l  l  l  l  l  ' 4 %QP; QPr  