
    ei                         d dl mZ d dlmZ d dl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 d dlmZ d dlmZ d dlmZ d dlmZ  G d	 d
ee          ZdS )    )Exchange)ImplicitAPIN)AnyBalancesCurrencyDepositAddressIntMarketNumOrder	OrderBook	OrderSide	OrderTypeStrTickerTradeTradingFeesTransaction)List)
BadRequest)	TICK_SIZE)Precisec                   X    e Zd Zdef fdZi fdee         fdZdefdZ	i fdefdZ
di fdededefd	Zd1d
ededefdZi fdedefdZd1dededefdZdefdZdefdZdi fdedefdZdddi fdedededee         fdZdddi fdedededee         fdZdddi fdededefdZd1dededefdZddi fdedededee         fdZi fdefdZ di fdede!d e"d!e#d"e$f
d#Z%di fdedefd$Z&i fd%ede'fd&Z(d1d'e)de'fd(Z*di fd%ed!e#d)ed*ede+f
d+Z,d1d,ed'e)de+fd-Z-d.d/i ddfd0Z. xZ/S )2independentreservereturnc                    |                      t          t          |                                           ddddgddi dd ddd	d
dd
dd
dd
dd
dd
dd
dd
dddd
dd
dddd
dd
dd
i dd
dd
dddd
dd
dd
dd
d d
d!d
d"dd#d
d$d
d%d
d&dd'd
d(d
d)d
i d*d
d+d
d,d
d-d
d.d
d/d
d0d
d1d
d2d
d3d
d4d
d5d
d6d
d7d
d8d
d9d
d:d
i d;d
d<d
d=d
d>dd?d
d@d
dAd
dBd
dCd
dDddEd
dFd
dGd
dHddId
dJd
dKdi dLddMd
dNd
dOd
dPd
dQd
dRd
dSd
dTd
dUd
dVd
dWd
dXddYddZd
d[dd\d
d
d
d
d
d
d
d
d
dd]	d^d_d`dadbdcdddeg dfidgg dhidadi|                     dj          |                     dj          dd
dkid
d
d
d d
d
d
d ddddd
dld
d
d
d
d
d
d
dmd d
dnd d d
dod
d
d
d
dpd
dnd
d
d
dqd d
dnd d d d
d
d
drd ds	d d dtd d dtdudvdwit
          i dxdydzdyd{d|d}d~ddyddddddyddddddyddddyddyddyddyddyi ddyddyddyddddyddddyddddddyddyddyddddddddyddyd|dyd~dddddddddddddd          S )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)GTC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[   rb   r_   fetchOrdersr9   
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    c/var/www/html/volatility/venv/lib/python3.11/site-packages/ccxt/async_support/independentreserve.pyr  zindependentreserve.describe   s'	   &8$ ? ? H H J 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 0d !..w77!..w77"&!&	   %&+(-,0,1).+06:#'#'#'"&#(( ( #(/4$)$)+027#(+$ $. %)&+!$$(%)*/& & ',#($)*/	# # ',!$#($)*/( ( $(&+!$$(,0%)#($)*/	* 	* #'s: :x ## 
 ## AD DL 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 5cgM
 gM
 g g g	    c                   K   |                      |          }|                     |          }|                     |          }t          j        |||g  d{V \  }}}g }t          dt          |                    D ]}	||	         }
|                     |
          }|                     ||
          }t          dt          |                    D ]}||         }|                     |          }|
dz   |z   }|	                    i d|d|dz   |z   d|d|ddd	|
d
|dddddddddddddddddddddddddddddddd|dddddddddd|d
           |S )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quoteCurrenciesr2  resultir!  r  	minAmountjr"  r  r  s                    r  fetch_marketsz independentreserve.fetch_markets=  s      !% J J6 R R!%!M!Mf!U!U<<VDD8?I^`v  yF  IG  9H  3H  3H  3H  3H  3H  3H/ q#n--.. 8	 8	A#A&F**622D((88I1c/2233 4 4)!,//8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 0 0 0 0 0	4j r  c                 p   d|i}t          dt          |                    D ]}||         }|                     |d          }|                     |          }|                                 }|                     |d          |d<   |                     |d          |d<   |||<   |                     |          S )Nr4  r   CurrencyCodeAvailableBalancefreeTotalBalancetotal)r:  r;  safe_stringr<  accountsafe_balance)r  responserE  rF  balance
currencyIdcoderQ  s           r  parse_balancez independentreserve.parse_balance  s    )q#h--(( 	# 	#AqkG))'>BBJ**:66DllnnG"..w8JKKGFO#//HHGG"F4LL  (((r  c                    K   |                                   d{V  |                     |           d{V }|                     |          S )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privatePostGetAccountsrW  )r  r?  rS  s      r  fetch_balancez independentreserve.fetch_balance  se       !!!!!!!!!44V<<<<<<<<!!(+++r  Nr  r   c           	      x  K   |                                   d{V  |                     |          }|d         |d         d}|                     |                     ||                     d{V }|                     |                     |d                    }|                     ||d         |ddd	d
          S )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)rY  marketpublicGetGetOrderBookextend	parse8601rP  parse_order_book)r  r  r   r?  re  requestrS  	timestamps           r  fetch_order_bookz#independentreserve.fetch_order_book  s       !!!!!!!!!V$$#)(#3%+I%6
 
 33DKK4P4PQQQQQQQQNN4#3#3H>S#T#TUU	$$Xvh/?KYegnpxyyyr  tickerre  c                    |                      |                     |d                    }|                     |d          }|                     |d          }d }|
||dz   |z   }|                     ||d          }|d         }|                     |d          }|                     i d|d|d|                     |          d	|                     |d
          d|                     |d          d|                     |d          dd d|                     |d          dd dd dd d|d|dd dd dd d|                     |d          |                     |d          d |d|          S )Nr`  PrimaryCurrencyCodeSecondaryCurrencyCoder  r  	LastPricerk  datetimehighDayHighestPricelowDayLowestPricebidCurrentHighestBidPrice	bidVolumeaskCurrentLowestOfferPrice	askVolumevwapopencloselastpreviousClosechanger   averageDayAvgPrice DayVolumeXbtInSecondaryCurrrency)
baseVolumequoteVolumer4  )rh  rP  safe_marketsafe_tickeriso8601)	r  rm  re  rk  r!  r"  defaultMarketIdr  r  s	            r  parse_tickerzindependentreserve.parse_ticker  s    NN4#3#3F<Q#R#RSS	!!&*?@@""6+BCCW%8$slW4O!!/63??!44 !
f!
!
 Y//!
 D$$V->??	!

 4##F,<==!
 4##F,DEE!
 !
 4##F,EFF!
 !
 D!
 D!
 T!
 D!
 T!
 d!
  $!!
" t''>>#!
$ **63UVV)!
 !
 !
* +  	r  c                   K   |                                   d{V  |                     |          }|d         |d         d}|                     |                     ||                     d{V }|                     ||          S )a  
        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"  r]  )rY  re  publicGetGetMarketSummaryrg  r  )r  r  r?  re  rj  rS  s         r  fetch_tickerzindependentreserve.fetch_ticker  s       !!!!!!!!!V$$#)(#3%+I%6
 
 77GV8T8TUUUUUUUU   6222r  orderc           
      V   d }|                      |d          }|                      |d          }d }d }|5|3|                     |          }|                     |          }|dz   |z   }n||d         }|d         }|d         }|                     |dd          }d }	|n|                    d	          d
k    rd}	n|                    d          d
k    rd}	|                    d          d
k    rd}n|                    d          d
k    rd}|                     |                      |d                    }
|                      |d          }|                      |d          }d }||t          j        ||          }|                     i d|d|                      |d          dd d|
d|                     |
          dd d|d|d| 	                    |                      |d                    dd d |	d!|                      |d"          d#d d$|                      |d%          d&|                      |d'          d(|                     |d)d*          d+||                      |d,          | 
                    |                      |d-                    |||d.d d/|          S )0Nro  rp  r  r  r  r  Typer   Bidr   buyOffersellr
   re  Limitr   r`  VolumeFilled
FeePercentr4  r  	OrderGuidclientOrderIdrk  rr  lastTradeTimestampr$  r   TimeInForcepostOnlysider(  rc  r   r+  Valuer  AvgPricer'  VolumeOrderedrd  filledOutstandingStatus)rater+  currency)	remainingstatusfeetrades)rP  r<  safe_string_2findrh  r   
string_mul
safe_orderr  parse_time_in_forceparse_order_status)r  r  re  r  r!  r"  r  r  	orderTyper  rk  r  feeRatefeeCosts                 r  parse_orderzindependentreserve.parse_order   sh   d !!%)>??""5*ABBW%8**622D++G44ECZ%'FFH%F&>D7OE&&ufkBB	 ~~e$$))((A--~~h''1,,$		((A--#	NN4#3#3E;P#Q#QRR	!!%88""5,776#5(&99G  
E 
$""5+66 
 T 
 	 

 Y// 
 !$ 
 f 
 I 
 433D4D4DUM4Z4Z[[ 
  
 D 
 T%%eW55 
 D 
 D$$UG44 
 t''z:: 
  d((JJ! 
" f# 
$ ))%??--d.>.>uh.O.OPP  
 3 
  
  
4 5  	r  r  c           	      F    ddddddddd}|                      |||          S )Nr~  closedcanceled)OpenPartiallyFilledFilledPartiallyFilledAndCancelled	CancelledPartiallyFilledAndExpiredExpiredFailedrP  )r  r  statusess      r  r  z%independentreserve.parse_order_statusl  s@    %+5#)3! 	
 	
 &&999r  r   c                 >    ddddd}|                      |||          S )Nr   r   r   r   )GtcMocFokIocr  )r  r   timeInForcess      r  r  z&independentreserve.parse_time_in_forcey  s4    	
 
 k;GGGr  r  c                    K   |                                   d{V  |                     |                     d|i|                     d{V }d}||                     |          }|                     ||          S )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)rY  privatePostGetOrderDetailsrg  re  r  )r  r  r  r?  rS  re  s         r  fetch_orderzindependentreserve.fetch_order  s       !!!!!!!!!88F
: :         [[((F&111r  sincec                 t  K   |                                   d{V  i }d}|+|                     |          }|d         |d<   |d         |d<   |d}d|d<   ||d	<   |                     |                     ||                     d{V }|                     |d
g           }|                     ||||          S )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"  r_  2      	pageIndexpageSizeData)rY  re  privatePostGetOpenOrdersrg  	safe_listparse_orders	r  r  r  r   r?  rj  re  rS  datas	            r  fetch_open_ordersz$independentreserve.fetch_open_orders  s       !!!!!!!!![[((F-3H-=G)*/5i/@G+,=E #
66t{{7F7S7STTTTTTTT~~h33  vue<<<r  c                 t  K   |                                   d{V  i }d}|+|                     |          }|d         |d<   |d         |d<   |d}d|d<   ||d	<   |                     |                     ||                     d{V }|                     |d
g           }|                     ||||          S )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"  r_  r  r  r  r  r  )rY  re  privatePostGetClosedOrdersrg  r  r  r  s	            r  fetch_closed_ordersz&independentreserve.fetch_closed_orders  s       !!!!!!!!![[((F-3H-=G)*/5i/@G+,=E #
88Wf9U9UVVVVVVVV~~h33  vue<<<r  r  c                 F  K   |                                   d{V  |                     |dd          }|d}||d}|                     |                     ||                     d{V }d}||                     |          }|                     |d         |||          S )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  )rY  safe_integerprivatePostGetTradesrg  re  parse_trades)	r  r  r  r   r?  r  rj  rS  re  s	            r  fetch_my_tradesz"independentreserve.fetch_my_trades  s       !!!!!!!!!%%fk1==	=E"
 
 224;;w3O3OPPPPPPPP[[((F  &!165%HHHr  tradec                 >   |                      |d                   }|                     |d          }|                     |d          }|                     |dd          }|                     |dd          }|                     |          }|                     |          }	|                     t	          j        ||                    }
|                     |d          }|                     |d	          }d }|
||d
z   |z   }|                     ||d
          }|                     |d          }|7|                    d          dk    rd}n|                    d          dk    rd}|                     |||| 	                    |          ||d |d ||	|
d d|          S )NTradeTimestampUtc	TradeGuidr  rc  SecondaryCurrencyTradePriceVolumeTradedPrimaryCurrencyAmountro  rp  r  r   r  r   r  r  r  )r  r4  rk  rr  r  r  r$  r  takerOrMakerr(  r'  r+  r  )
rh  rP  r  r  r   r  safe_symbolr  
safe_trader  )r  r  re  rk  r  orderIdpriceStringamountStringr(  r'  r+  r!  r"  marketIdr  r  s                   r  parse_tradezindependentreserve.parse_trade  s   NN5)<#=>>	e[11""5+66((9VWW))%AXYY!!+..""<00  !3K!N!NOO!!%)>??""5*ABBW%8|g-H!!(FC88{33yy1$$7##q(("Y//  
  
   	r  c                 "  K   |                                   d{V  |                     |          }|d         |d         dd}|                     |                     ||                     d{V }|                     |d         |||          S )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  )r^  r_  numberOfRecentTradesToRetrieveTrades)rY  re  publicGetGetRecentTradesrg  r  )r  r  r  r   r?  re  rj  rS  s           r  fetch_tradeszindependentreserve.fetch_trades  s       !!!!!!!!!V$$#)(#3%+I%6.0
 

 66t{{7F7S7STTTTTTTT  (!3VUEJJJr  c                   K   |                                   d{V  |                     |           d{V }i }t          dt          |                    D ]S}||         }|                     |d          }|                     |          }|                     |d          }||d||<   Ti }	t          dt          | j                            D ]}| j        |         }
|                     |
          }| 	                    ||d         i           }| 	                    |d          |
|                     |d          |                     |d          d	d	d
|	|
<   |	S )a  
        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   rK  Fee)r4  r  r  r4  r  T)r4  r  r   r   r   r   )
rY  privatePostGetBrokerageFeesr:  r;  rP  r<  r=  symbolsre  
safe_value)r  r?  rS  r  rF  r  rU  rV  
tradingFeerE  r  re  s               r  fetch_trading_feesz%independentreserve.fetch_trading_fees  s      !!!!!!!!!99&AAAAAAAA q#h--(( 	 	A1+C))#~>>J**:66D))#u55J! DJJ q#dl++,, 	 	A\!_F[[((F//$v;;CV44 ))#u55))#u55"! F6NN r  r$  r  r'  r(  c                   K   |                                   d{V  |                     |          }|                     |          }||dk    rdndz  }|d         |d         |d}	d}
||	d<   |d	k    r5||	d
<   |                     |                     |	|                     d{V }
n/|                     |                     |	|                     d{V }
|                     |
|
d         d|          S )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"  )r^  r_  r  volumer   r(  r  )r4  r  )rY  re  
capitalizeprivatePostPlaceLimitOrderrg  privatePostPlaceMarketOrderr  )r  r  r$  r  r'  r(  r?  re  r  rj  rS  s              r  create_orderzindependentreserve.create_order<  sA      !!!!!!!!!V$$OOD))	WWe;	#)(#3%+I%6"
 

 "7??$GG!<<T[[RX=Y=YZZZZZZZZHH!==dkk'SY>Z>Z[[[[[[[[H;' 
  
   	r  c                    K   |                                   d{V  d|i}|                     |                     ||                     d{V }|                     |          S )a  
        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  )rY  privatePostCancelOrderrg  r  )r  r  r  r?  rj  rS  s         r  cancel_orderzindependentreserve.cancel_order\  s       !!!!!!!!!
 44T[[&5Q5QRRRRRRRR  )))r  rV  c                    K   |                                   d{V  |                     |          }d|d         i}|                     |                     ||                     d{V }|                     |          S )a  
        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>`
        Nr^  r  )rY  r  +privatePostGetDigitalCurrencyDepositAddressrg  parse_deposit_address)r  rV  r?  r  rj  rS  s         r  fetch_deposit_addressz(independentreserve.fetch_deposit_address}  s       !!!!!!!!!==&&!8D>
 II$++V]_eJfJfgggggggg ))(333r  r  c                     |                      |d          }|                     |           ||                      |d          d ||                      |d          dS )Nr   rV  Tag)r4  r  networkaddresstag)rP  check_address)r  depositAddressr  r  s       r  r  z(independentreserve.parse_deposit_address  sl     "">3CDD7###"((6::##NE::
 
 	
r  r  r  c                   K   |                      ||          \  }}|                                  d{V  |                     |          }|d         ||                     ||          d}|||d<   d}|                     |          \  }}|t          | j        dz             |                     |                     ||                     d{V }	| 	                    |	|          S )aY  
        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  )r^  withdrawalAddressr'  destinationTagz1 withdraw() does not accept params["networkCode"])
handle_withdraw_tag_and_paramsrY  r  currency_to_precisionhandle_network_code_and_paramsr   r  "privatePostWithdrawDigitalCurrencyrg  parse_transaction)
r  rV  r'  r  r  r?  r  rj  networkCoderS  s
             r  r|   zindependentreserve.withdraw  s       99#vFFV!!!!!!!!!==&&#+D>!(00v>>
 

 ?(+G$%"AA&IIV"TW'ZZ[[[@@WV\A]A]^^^^^^^^$ %%h999r  transactionc                 z   |                      |d          }|                      |d          }|                     |d          }|                     |d          }|                     |d          }|                     |d          }|                     ||          }	i d|d|                     |d	          d
d ddd|	dd d|                     |d          d|                     |d          d|                     |          d|d|dd d|d|dd d|dd d |	|                     |d          d dddS ) NAmountDestinationro  r`  Addressr  r4  r  TransactionGuidtxidr$  r|   r  r  r'  Totalr  r  rk  rr  r  addressFrom	addressTor  tagFromtagToupdatedr  )r  r+  r  F)commentr  internal)	safe_dictrP  r<  r=  rh  )
r  r  r  r'  destinationrU  rr  r  r  rV  s
             r  r  z$independentreserve.parse_transaction  s   $ X66nn[-@@%%k3HII
##K1FGG"";	::{E22&&z8<<
K
$"";0ABB
 D
 J	

 
 t
 d&&vw77
 d&&{H==
 11
 
 w
 4
 
 3
 t
  S!
" t#
$  ((77 
 1
 
 
 	
r  r}   GETc                    | j         d         |         dz   |z   }|dk    r|r|d|                     |          z   z  }n|                                  |                                 }|d| j        z   dt          |          z   g}	t          |                                          }
t          dt          |
                    D ]:}|
|         }t          ||                   }|	
                    |dz   |z              ;d	                    |	          }|                     |                     |          |                     | j                  t          j                  }i }| j        |d
<   ||d<   |                                |d<   t          dt          |
                    D ]}|
|         }||         ||<   |                     |          }ddi}||||dS )Nr   r  r}   ?zapiKey=znonce=r   =,apiKeynonce	signaturezContent-Typezapplication/json)urlmethodbodyheaders)r  	urlencodecheck_required_credentialsr1  r0  strlistkeysr:  r;  r>  joinhmacencodesecrethashlibsha256upperjson)r  pathr   r4  r?  r6  r5  r3  r1  authr;  rF  keyvaluemessager2  querys                    r  signzindependentreserve.sign  s   is#c)D0(?? 4sT^^F3333++---JJLLEDK'3u::%D
 &&D1c$ii(( / /1gF3K((C#I-....hhtnnG		$++g"6"6DK8P8PRYR`aaIE"kE(O"E'N!*!2!2E+1c$ii(( ) )1g#C[c

99U##D%'9:GfdwOOOr  )N)0__name__
__module____qualname__r   r  r   r
   rI  r   rW  r[  r9  r	   r   rl  dictr   r  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  rJ  __classcell__)r  s   @r  r   r      s       h# h h h h h hT	 *, N NV N N N N`
) 
) 
) 
) 
) *, , , , , , , @DB z zS z zS\ z z z z$, ,4 , ,6 , , , ,\ 68 3 3 3F 3 3 3 3:j j jv j j j j jX: : : : :Hs H H H H 8<B 2 2C 2 2 2 2 2" 59tZ^gi = =c = =TW =nrsxny = = = =0 7;\`ik = = =3 =VY =ptuzp{ = = = =0 37TXZce I IC Is IRU I I I I.# # #v # # # # #J <@d[] K K KS K Kbfglbm K K K K& /1 ( ([ ( ( ( (T mqy{   I Y X] fi    @ 9=R * *S *# * * * *B =? 4 4 4> 4 4 4 44
 
h 
R` 
 
 
 
& QU]_ 0: 0:3 0: 0: 0:# 0:do 0: 0: 0: 0:d2
 2
T 2
X 2
Q\ 2
 2
 2
 2
h &eBSW P P P P P P P Pr  r   )  ccxt.async_support.base.exchanger    ccxt.abstract.independentreserver   r8  r@  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    r  r  <module>rY     s   6 5 5 5 5 5 8 8 8 8 8 8   l  l  l  l  l  l  l  l  l  l  l  l  l  l  l  l  l  l  l  l  l  l  l  l  l  l  l  l  l  l  l  l  l  l  l  l       ' ' ' ' ' ' 4 4 4 4 4 4 % % % % % %\P \P \P \P \P; \P \P \P \P \Pr  