
    E#ikf                         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  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	OrderBook	OrderSide	OrderTypeStrStringsTickerTradeTransferEntry)List)ExchangeError)	TICK_SIZE)Precisec                     ^  \ rS rSrS\4U 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S2S
\S\S\4S jjr0 4S\	S\4S jjrS2S\S\S\4S jjrSS0 4S\	S\
S\
S\\   4S jjr0 4S\	S\4S jjr0 4S\	S\4S jjrS0 4S\S\\   4S jjrS2S\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\S \	S!\	S\$4
S" jjr%S2S#\S\S\$4S$ jjr&S%\"S\"4S& jr'S'S(0 SS4S) jr(S*\)S+\	S,\	S-\	S.\S/\	4S0 jr*S1r+U =r,$ )3paymium   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_SSSSSSSSSSS.
ESSS0SS/ S QS!S".S#/ S$Q0/ S%Q/ S&Q/ S'QS(.S).S*U R	                  S+S*S,S-S.S+S	SS/.5      0S0U R                  S15      U R                  S25      S3.0[        SSSSS SSS SSSSS4.SSSSSSSS5.S S S S S S S S6.	S S S7.S S S7.S8.S9.5      $ ):Nr   PaymiumFREUi  v1CORSTspotmarginswapFfutureoptioncancelOrdercreateDepositAddresscreateOrderfetchBalancefetchDepositAddressfetchDepositAddressesfetchDepositAddressesByNetworkfetchFundingHistoryfetchFundingRatefetchFundingRateHistoryfetchFundingRates)
fetchIndexOHLCVfetchMarkOHLCVfetchOpenInterestHistoryfetchOrderBookfetchPremiumIndexOHLCVfetchTickerfetchTradesfetchTradingFeefetchTradingFeestransferzdhttps://user-images.githubusercontent.com/51840849/87153930-f0f02200-c2c0-11ea-9c0a-40337375ae89.jpgrestzhttps://paymium.com/apizhttps://www.paymium.comz&https://www.paymium.com/page/help/fees)z,https://github.com/Paymium/api-documentationz'https://www.paymium.com/page/developersz,https://paymium.github.io/api-documentation/zBhttps://www.paymium.com/page/sign-up?referral=eDAzPoRQFMvaAB8sf-qj)logoapiwwwfeesdocreferralget)	countries
currencieszdata/{currency}/tickerzdata/{currency}/tradeszdata/{currency}/depthzbitcoin_charts/{id}/tradeszbitcoin_charts/{id}/depth)useruser/addresseszuser/addresses/{address}user/ordersuser/orders/{uuid}user/price_alertszmerchant/get_payment/{uuid})rG   rH   zuser/withdrawalszuser/email_transferszuser/payment_requestsrJ   zmerchant/create_payment)rI   zuser/orders/{uuid}/cancelzuser/price_alerts/{id})rC   postdelete)publicprivatezBTC/EUReurBTCEURbtc)idsymbolbasequotebaseIdquoteIdtyper"   tradingz-0.001z0.005)makertaker)IOCFOKPOGTD)
marginModetriggerPricetriggerDirectiontriggerPriceTypestopLossPricetakeProfitPriceattachedStopLossTakeProfittimeInForcehedgedtrailingleveragemarketBuyByCostmarketBuyRequiresPriceselfTradePreventioniceberg)	sandboxr)   createOrdersfetchMyTrades
fetchOrderfetchOpenOrdersfetchOrdersfetchClosedOrders
fetchOHLCV)linearinverse)r"   r$   r%   )rS   namerD   	rateLimitversionhasurlsr>   marketsr@   precisionModefeatures)deep_extendsuperr   describesafe_market_structureparse_numberr   )self	__class__s    F/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/paymium.pyr   paymium.describe   s{   gt = ? $ 	
 % % t ' t  &t ( 1% &u #E  *5!" $U#$ $)"',1"&*/###($) 7< 5 1@
 a   
'%N 455Uiafqv  CH  UZ  dj  tx  7y  z !..x8!..w7 '  %&+(-,1,0).+06:#(#("'#(	( #($)$)+/27/4#()$, %)%)"&'+#')-"&=B ##
 ##K)CKB
 K K	    c                 x   SU0n[        U R                  R                  5       5      n[        S[	        U5      5       Hj  nX4   nU R                  U5      nUS   nSU-   nX;   d  M)  U R                  5       n	SU-   n
U R                  X5      U	S'   U R                  X5      U	S'   XU'   Ml     U R                  U5      $ )Ninfor   rS   balance_locked_freeused)	listrE   keysrangelencurrencyaccountsafe_stringsafe_balance)r   responseresultrE   icoder   
currencyIdr   r   r   s              r   parse_balancepaymium.parse_balance   s    )$//..01
q#j/*A=D}}T*H!$J
*D,,. :-"&"2"28"B"&"2"28"B&t +   ((r   c                 f    U R                  5         U R                  U5      nU R                  U5      $ )aJ  
query for balance and get the amount of funds available for trading or funds locked in orders

https://paymium.github.io/api-documentation/#tag/User/paths/~1user/get

: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privateGetUserr   )r   paramsr   s      r   fetch_balancepaymium.fetch_balance   s1     	&&v.!!(++r   NrT   limitc           	          U R                  5         U R                  U5      nSUS   0nU R                  U R                  XS5      5      nU R	                  XdS   SSSSS5      $ )	a*  
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data

https://paymium.github.io/api-documentation/#tag/Public-data/paths/~1data~1%7Bcurrency%7D~1depth/get

: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   rS   rT   Nbidsaskspriceamount)r   marketpublicGetDataCurrencyDepthextendparse_order_book)r   rT   r   r   r   requestr   s          r   fetch_order_bookpaymium.fetch_order_book   sk     	V$t
 224;;w3OP$$Xh/?vvW^`hiir   tickerr   c                 V   U R                  S U5      nU R                  US5      nU R                  US5      nU R                  US5      n[        R                  " Xe5      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U_SU R                  US5      _SU_SU_SS _SS _SU R                  US5      _SS _UUUS.EU5      $ )Natvwapvolumer   rT   	timestampdatetimehighlowbid	bidVolumeask	askVolumeopencloselastpreviousClosechange
percentage	variationaverage)
baseVolumequoteVolumer   )safe_symbolsafe_timestampr   r   
string_mulsafe_tickeriso8601)	r   r   r   rT   r   r   r   r   r   s	            r   parse_tickerpaymium.parse_ticker   s   & !!$/''5	/%%fh7
((:0 !
f!
!
 Y/!
 D$$VV4	!

 4##FE2!
 4##FE2!
 !
 4##FE2!
 !
 D!
 D$$VV4!
 T!
 D!
 T!
 d!
  $**6;?!!
" t#!
$ %&)!
* + 	r   c                     U R                  5         U R                  U5      nSUS   0nU R                  U R                  XB5      5      nU R	                  XS5      $ )a  
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market

https://paymium.github.io/api-documentation/#tag/Public-data/paths/~1data~1%7Bcurrency%7D~1ticker/get

: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   rS   )r   r   publicGetDataCurrencyTickerr   r   )r   rT   r   r   r   r   s         r   fetch_tickerpaymium.fetch_ticker   s\     	V$t
 11$++g2NO&   00r   tradec                 h   U R                  US5      nU R                  US5      nU R                  S U5      nU R                  US5      nU R                  US5      nSUS   R                  5       -   nU R                  X5      nU R	                  UUS UU R                  U5      US   S US UUS S S.U5      $ )	Ncreated_at_intuuidsider   traded_rU   rT   )r   rS   orderr   r   rT   rY   r   takerOrMakerr   r   costfee)r   r   safe_marketlower
safe_trader   )	r   r   r   r   rS   r   r   amountFieldr   s	            r   parse_tradepaymium.parse_trade$  s    ''/?@	eV,!!$/v.  0&."6"6"88!!%5"Y/X&  
  	r   sincec                     U R                  5         U R                  U5      nSUS   0nU R                  U R                  Xd5      5      nU R	                  XuX#5      $ )a  
get the list of most recent trades for a particular symbol

https://paymium.github.io/api-documentation/#tag/Public-data/paths/~1data~1%7Bcurrency%7D~1trades/get

: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   rS   )r   r   publicGetDataCurrencyTradesr   parse_trades)r   rT   r   r   r   r   r   r   s           r   fetch_tradespaymium.fetch_trades<  s\     	V$t
 33DKK4PQ  5@@r   r   c                 f    U R                  5         U R                  U5      nU R                  U5      $ )aj  
create a currency deposit address

https://paymium.github.io/api-documentation/#tag/User/paths/~1user~1addresses/post

:param str code: unified currency code of the currency for the deposit address
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
)r   privatePostUserAddressesparse_deposit_address)r   r   r   r   s       r   create_deposit_addresspaymium.create_deposit_addressP  s3     	008 ))(33r   c                     U R                  5         SU0nU R                  U R                  X25      5      nU R                  U5      $ )at  
fetch the deposit address for a currency associated with self account

https://paymium.github.io/api-documentation/#tag/User/paths/~1user~1addresses~1%7Baddress%7D/get

: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>`
address)r   privateGetUserAddressesAddressr   r   )r   r   r   r   r   s        r   fetch_deposit_addresspaymium.fetch_deposit_addressf  sJ     	t
 66t{{77ST ))(33r   codesc                 f    U R                  5         U R                  U5      nU R                  X15      $ )a  
fetch deposit addresses for multiple currencies and chain types

https://paymium.github.io/api-documentation/#tag/User/paths/~1user~1addresses/get

:param str[]|None codes: list of unified currency codes, default is None
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a list of `address structures <https://docs.ccxt.com/#/?id=address-structure>`
)r   privateGetUserAddressesparse_deposit_addresses)r   r   r   r   s       r   fetch_deposit_addressespaymium.fetch_deposit_addresses  s3     	//7 ++H<<r   r   c                 x    U R                  US5      nU R                  US5      nUU R                  XB5      S US S.$ )Nr   r   )r   r   networkr   tag)r   safe_currency_code)r   depositAddressr   r   r   s        r   r   paymium.parse_deposit_address  sL     "">9=%%njA
"//
E
 	
r   rY   r   r   r   c                     U R                  5         U R                  U5      nU R                  U5      S-   US   UUS.nUS:w  a  XXS'   U R                  U R	                  X5      5      n	U R                  U	U	S   S.U5      $ )aj  
create a trade order

https://paymium.github.io/api-documentation/#tag/Order/paths/~1user~1orders/post

: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>`
OrderrS   )rY   r   	directionr   r   r   r   )r   rS   )r   r   
capitalizeprivatePostUserOrdersr   
safe_order)
r   rT   rY   r   r   r   r   r   r   r   s
             r   create_orderpaymium.create_order  s     	V$OOD)G3t	
 8$G--dkk'.JK6" 
  	r   rS   c                 p    SU0nU R                  U R                  XC5      5      nU R                  SU05      $ )a  
cancels an open order

https://paymium.github.io/api-documentation/#tag/Order/paths/~1user~1orders~1%7Buuid%7D/delete
https://paymium.github.io/api-documentation/#tag/Order/paths/~1user~1orders~1%7Buuid%7D~1cancel/delete

:param str id: order id
:param str symbol: not used by paymium cancelOrder()
: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   )!privateDeleteUserOrdersUuidCancelr   r  )r   rS   rT   r   r   r   s         r   cancel_orderpaymium.cancel_order  sF     B
 99$++g:VWH 
  	r   fromAccount	toAccountc                 x   U R                  5         U R                  U5      nUR                  S5      S:  a  [        U R                  S-   5      eUS:w  a  US:w  a  [        U R                  S-   5      eUS   U R                  X5      US.nU R                  U R                  Xu5      5      nU R                  X5      $ )	a  
transfer currency internally between wallets on the same account

https://paymium.github.io/api-documentation/#tag/Transfer/paths/~1user~1email_transfers/post

:param str code: unified currency code
:param float amount: amount to transfer
:param str fromAccount: account to transfer from
:param str toAccount: account to transfer to
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `transfer structure <https://docs.ccxt.com/#/?id=transfer-structure>`
@r   z5 transfer() only allows transfers to an email addressrP   rQ   z" transfer() only allows BTC or EURrS   )r   r   email)	r   r   findr   rS   currency_to_precisionprivatePostUserEmailTransfersr   parse_transfer)	r   r   r   r  r  r   r   r   r   s	            r   r;   paymium.transfer  s     	==&>>#"*a abb5=TU]*N NOO 00>
 55dkk'6RSB ""866r   r;   c                    U R                  US5      nU R                  US5      nU R                  U5      nU R                  US5      nU R                  US0 5      nU R                  US5      nUU R                  US5      UU R                  U5      U R	                  X25      U R                  US5      S U R                  US5      U R                  U5      S	.	$ )
Nr   
updated_ataccount_operationsr   stater   r   r   )	r   rS   r   r   r   r   r  r  status)r   
parse_date
safe_valuer   r   safe_numberparse_transfer_status)	r   r;   r   r   	updatedAt
timetstampaccountOperationsfirstOperationr  s	            r   r  paymium.parse_transfer  s    B %%h
;
$$X|<	__Y/
 OOH6JK):ArB!!(G4""8V4#Z0//
E&&x:)).)D008

 
	
r   r  c                 .    SS0nU R                  X!U5      $ )Nexecutedok)r   )r   r  statusess      r   r   paymium.parse_transfer_statusK  s#    
 &99r   rM   GETc                    U R                   S   S   S-   U R                  -   S-   U R                  X5      -   nU R                  X@R	                  U5      5      nUS:X  a  U(       a  USU R                  U5      -   -  nOU R                  5         [        U R                  5       5      n	X-   n
U R                  U	S.nUS:X  a"  U(       a  U R                  U5      nX-  n
SUS	'   O$U(       a  U R                  U5      nX-  n
USU-   -  nU R                  U R                  U
5      U R                  U R                  5      [        R                  5      US
'   XsXeS.$ )Nr>   r<   /rM   ?)zApi-Keyz	Api-NoncePOSTzapplication/jsonzContent-TypezApi-Signature)urlmethodbodyheaders)r~   r|   implode_paramsomitextract_params	urlencodecheck_required_credentialsstrnonceapiKeyjsonhmacencodesecrethashlibsha256)r   pathr>   r1  r   r3  r2  r0  queryr:  authqueryStrings               r   signpaymium.signR  s@   iiv&,t||;cADDWDWX\Dee		&"5"5d";<(?sT^^E222++-

%E;D;;"G 99U+DLD.@GN+"&.."7K'D3,,C'+yyT1BDKKPTP[P[D\^e^l^l'mGO$dOOr   httpCodereasonr0  r1  r3  r2  c
                     Uc  g U R                  US5      n
U
b*  [        U R                  S-   U R                  U5      -   5      eg )Nerrors )r  r   rS   r<  )r   rH  rI  r0  r1  r3  r2  r   requestHeadersrequestBodyrK  s              r   handle_errorspaymium.handle_errorsm  sE    84#		(0C CDDr    )N)-__name__
__module____qualname____firstlineno__r   r   r   r   r   r9  r	   r   r   dictr
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   floatr   r  r   r  r   r;   r  r   rF  intrO  __static_attributes____classcell__)r   s   @r   r   r      s4   L# L\) )  $& ,( , :>b js j3 jY j&.4 . .6 .` 02 "13 "1f "1H v  0 6:UW A3 As A# A\`af\g A( 8: 43 4n 4, 79 4# 4^ 42 8<B =W =4P^K_ =0
h 
R` 
& gksu 3 i y RW `c < 37r s C ( [] :7S :7% :7c :7c :7an :7x1
t 1
x 1
= 1
f:C :C : &eBSW P6c 3 S # X\ dg  r   r   )ccxt.base.exchanger   ccxt.abstract.paymiumr   r@  ccxt.base.typesr   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   rQ  r   r   <module>rb     sJ    ( -  c  c  c  c  c  * 4 %c	h c	r   