
    E#i8                         S SK Jr  S SKJ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    Q/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/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                 J   U R                  U5      nU R                  U5      nU R                  U5      nX#U/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$ )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
r   /r  symbolbasequotesettleN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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3Hbo2p/ 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 r  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)r9  r:  safe_stringr;  accountsafe_balance)r  responserD  rE  balance
currencyIdcoderQ  s           r  parse_balance independentreserve.parse_balance  s    )q#h-(AkG))'>BJ**:6DllnG"..w8JKGFO#//HGG"4L )   ((r  c                 f    U R                  5         U R                  U5      nU R                  U5      $ )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>`
)load_marketsprivatePostGetAccountsrW  )r  r>  rS  s      r  fetch_balance independentreserve.fetch_balance  s1     	..v6!!(++r  Nr  r   c           	         U R                  5         U R                  U5      nUS   US   S.nU R                  U R                  XS5      5      nU R	                  U R                  US5      5      nU R                  XdS   USSSS	5      $ )
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
r"  r#  primaryCurrencyCodesecondaryCurrencyCodeCreatedTimestampUtcr  	BuyOrders
SellOrdersPriceVolume)rZ  marketpublicGetGetOrderBookextend	parse8601rP  parse_order_book)r  r  r   r>  rg  requestrS  	timestamps           r  fetch_order_book#independentreserve.fetch_order_book  s     	V$#)(#3%+I%6
 --dkk'.JKNN4#3#3H>S#TU	$$Xh/?KYegnpxyyr  tickerrg  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      $ )Nrb  PrimaryCurrencyCodeSecondaryCurrencyCoder  r  	LastPricerm  datetimehighDayHighestPricelowDayLowestPricebidCurrentHighestBidPrice	bidVolumeaskCurrentLowestOfferPrice	askVolumevwapopencloselastpreviousClosechanger   averageDayAvgPrice DayVolumeXbtInSecondaryCurrrency)
baseVolumequoteVolumer5  )rj  rP  safe_marketsafe_tickeriso8601)	r  rp  rg  rm  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         U R                  U5      nUS   US   S.nU R                  U R                  XB5      5      nU R	                  XS5      $ )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>`
r"  r#  r_  )rZ  rg  publicGetGetMarketSummaryri  r  )r  r  r>  rg  rl  rS  s         r  fetch_tickerindependentreserve.fetch_ticker  sc     	V$#)(#3%+I%6
 11$++g2NO   22r  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      $ )/Nrr  rs  r  r  r  r   Typer   Bidr   buyOffersellr
   rg  Limitr   rb  VolumeFilled
FeePercentr5  r  	OrderGuidclientOrderIdrm  ru  lastTradeTimestampr%  r   postOnlysider)  re  r   r,  Valuer  AvgPricer(  VolumeOrderedrf  filledOutstandingStatus)rater,  currency)	remainingstatusfeetrades)
rP  r;  safe_string_2findrj  r   
string_mul
safe_orderr  parse_order_status)r  r  rg  r  r"  r#  r  r   	orderTyper  rm  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)rP  )r  r  statusess      r  r  %independentreserve.parse_order_statusj  s3    %+5#)3!
 &99r  r  c                     U R                  5         U R                  U R                  SU0U5      5      nSnUb  U R                  U5      nU R	                  XE5      $ )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>`
	orderGuidN)rZ  privatePostGetOrderDetailsri  rg  r  )r  r  r  r>  rS  rg  s         r  fetch_orderindependentreserve.fetch_orderv  se     	224;;@
4  [[(F11r  sincec                 6   U R                  5         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      nU R                  US
/ 5      nU R                  XX#5      $ )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"  r`  r#  ra  2      	pageIndexpageSizeData)rZ  orderedrg  privatePostGetOpenOrdersri  	safe_listparse_orders	r  r  r  r   r>  rl  rg  rS  datas	            r  fetch_open_orders$independentreserve.fetch_open_orders  s     	,,r"[[(F-3H-=G)*/5i/@G+,=E #
00W1MN~~h3  u<<r  c                 6   U R                  5         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      nU R                  US
/ 5      nU R                  XX#5      $ )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"  r`  r#  ra  r  r  r  r  r  )rZ  r  rg  privatePostGetClosedOrdersri  r  r  r  s	            r  fetch_closed_orders&independentreserve.fetch_closed_orders  s     	,,r"[[(F-3H-=G)*/5i/@G+,=E #
224;;w3OP~~h3  u<<r  r  c                    U R                  5         U R                  USS5      nUc  SnU R                  UUS.5      nU R                  U R	                  Xd5      5      nSnUb  U R                  U5      nU R                  US   XU5      $ )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>`
r  r  Nr  )r  r  r  )rZ  safe_integerr  privatePostGetTradesri  rg  parse_trades)	r  r  r  r   r>  r  rl  rS  rg  s	            r  fetch_my_trades"independentreserve.fetch_my_trades  s     	%%fk1=	=E,," 
  ,,T[[-IJ[[(F  &!16%HHr  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  re  SecondaryCurrencyTradePriceVolumeTradedPrimaryCurrencyAmountrr  rs  r  r   r  r   r  r  r  )r  r5  rm  ru  r  r  r%  r  takerOrMakerr)  r(  r,  r  )
rj  rP  r  r  r   r  safe_symbolr  
safe_trader  )r  r  rg  rm  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         U R                  U5      nUS   US   SS.nU R                  U R                  Xd5      5      nU R	                  US   XRU5      $ )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>`
r"  r#  r  )r`  ra  numberOfRecentTradesToRetrieveTrades)rZ  rg  publicGetGetRecentTradesri  r  )r  r  r  r   r>  rg  rl  rS  s           r  fetch_tradesindependentreserve.fetch_trades  sm     	V$#)(#3%+I%6.0

 00W1MN  (!3VEJJr  c                 4   U R                  5         U R                  U5      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	$ )
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
r   rK  Fee)r5  r  r  r5  r  T)r5  r  r   r   r   r   )
rZ  privatePostGetBrokerageFeesr9  r:  rP  r;  r<  symbolsrg  
safe_value)r  r>  rS  r  rE  r  rU  rV  
tradingFeerD  r  rg  s               r  fetch_trading_fees%independentreserve.fetch_trading_fees  s    	33F; q#h-(A+C))#~>J**:6D))#u5J!DJ ) q#dll+,A\\!_F[[(F//$v;CV4 ))#u5))#u5"!FN	 - r  r%  r  r(  r)  c                    U R                  5         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      n
O U R                  U R                  X5      5      n
U R                  U
U
S   S.U5      $ )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>`
r  r  r  r"  r#  )r`  ra  r  Nvolumer   r)  r  )r5  r  )rZ  rg  
capitalizer  privatePostPlaceLimitOrderri  privatePostPlaceMarketOrderr  )r  r  r%  r  r(  r)  r>  rg  r  rl  rS  s              r  create_orderindependentreserve.create_order0  s     	V$OOD)	We;	,,#)(#3%+I%6" 
 
 "7?$G66t{{77STH77G8TUH;' 
  	r  c                     U R                  5         SU0nU R                  U R                  XC5      5      nU R                  U5      $ )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>`
r  )rZ  privatePostCancelOrderri  r  )r  r  r  r>  rl  rS  s         r  cancel_orderindependentreserve.cancel_orderP  sJ     	
 ..t{{7/KL  ))r  rV  c                     U R                  5         U R                  U5      nSUS   0nU R                  U R                  XB5      5      nU R	                  U5      $ )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>`
r`  r  )rZ  r  +privatePostGetDigitalCurrencyDepositAddressri  parse_deposit_address)r  rV  r>  r  rl  rS  s         r  fetch_deposit_address(independentreserve.fetch_deposit_addressq  s]     	==&!8D>
 CCDKKPWD`a ))(33r  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   rV  Tag)r5  r  networkaddresstag)rP  check_address)r  depositAddressr  r  s       r  r  (independentreserve.parse_deposit_address  sX     "">3CD7#"((6:##NE:
 	
r  r  r  c                 j   U R                  XE5      u  pEU R                  5         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      n	U R                  X5      $ )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>`
       r  )r`  withdrawalAddressr(  NdestinationTagz1 withdraw() does not accept params["networkCode"])
handle_withdraw_tag_and_paramsrZ  r  currency_to_precisionhandle_network_code_and_paramsr   r  "privatePostWithdrawDigitalCurrencyri  parse_transaction)
r  rV  r(  r  r  r>  r  rl  networkCoderS  s
             r  r}   independentreserve.withdraw  s      99#F==&#+D>!(00>

 ?(+$%"AA&I"TWW'ZZ[[::4;;w;WX$ %%h99r  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Destinationrr  rb  Addressr  r5  r  TransactionGuidtxidr%  r}   r  r  r(  Totalr  r  rm  ru  r  addressFrom	addressTor  tagFromtagToupdatedr  )r  r,  r  F)commentr  internal)	safe_dictrP  r;  r<  rj  )
r  r$  r  r(  destinationrU  ru  r  r  rV  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keysr9  r:  r=  joinhmacencodesecrethashlibsha256r  upperjson)r  pathr   r?  r>  rA  r@  r>  r<  authrF  rE  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
   rH  r   rW  r\  rD  r	   r   rn  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!  rU  __static_attributes____classcell__)r  s   @r  r   r      s   g# gR	 $& N$v, N`
) 
) $& ,( , :>b zs z3 zY z$,4 , ,6 ,\ 02 33 3f 3:j jv j jX
: 
: 26b 2c 23 2" /3TXac = =3 =c =hlmrhs =0 154VZce =# =S =PS =jnotju =0 -1tRT]_ Ic I IC I.# #v # #J 6:UW K3 Ks K# K\`af\g K& )+ ({ (T gksu 3 i y RW `c @ 37r *s *C *B 79 4# 4^ 44
h 
R` 
& KOWY 0:S 0:% 0:# 0:C 0:^i 0:d2
T 2
X 2
Q\ 2
h &eBSW P Pr  r   )ccxt.base.exchanger    ccxt.abstract.independentreserver   rK  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   rW  r  r  <module>rg     sL    ( 8  l  l  l  l  l  ' 4 %QP; QPr  