
    i$                         d dl mZ d dlm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 d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ d dlmZ  G d dee          Z dS )    )Exchange)ImplicitAPI)BalancesIntMarketNumOrder	OrderBook	OrderSide	OrderTypeStrStringsTickerTickersTradeTradingFees)List)ExchangeError)AuthenticationError)PermissionDenied)ArgumentsRequired)
BadRequest)InsufficientFunds)InvalidOrder)OrderNotFound)	TICK_SIZEc                       e Zd Z fdZi fdee         fdZdefdZi fdede	fdZ
di fdedefd	Zd-d
efdZdi fdededefdZddi fdedefdZddi fdedededee         fdZd-d
edefdZi fdZi fdefdZi fdZd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#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dee$         fd Z'd-d
ede(fd!Z)d"ddi fdedededee(         fd#Z*d-d
ede$fd$Z+d% Z,di fdede"fd&Z-di fde"fd'Z.di fde"fd(Z/d)d*i ddfd+Z0d, Z1 xZ2S ).oceanexc                    |                      t          t          |                                           dddgdddddid	d
ddi dd dddddd dd dd ddddddddddddddddddddddi d dd!dd"dd#dd$dd%dd&dd'dd(dd)dd*dd+dd,dd-dd.dd/dd0ddd d1d2d3d4d5d6d7d8d9d:d;d<d=d>g d?d@gdAg dBg dCdAdDdEdd|                     dF          |                     dF          dGidHdIit
          t          t          t          t          t          t          t          t          t          t          t          t          dJt          t          t          t          dKdLdM          S )NNr   OceanExBSv1i  zchttps://user-images.githubusercontent.com/1294454/58385970-794e2d80-8001-11e9-889c-0567cd79b78e.jpgrestzhttps://api.oceanex.prozhttps://www.oceanex.pro.comzhttps://api.oceanex.pro/doc/v1z*https://oceanex.pro/signup?referral=VE24QX)logoapiwwwdocreferralCORSspotTmarginFswapfutureoptioncancelAllOrderscancelOrdercancelOrderscreateMarketOrdercreateOrderfetchBalancefetchBorrowRateHistoriesfetchBorrowRateHistoryfetchClosedOrdersfetchCrossBorrowRatefetchCrossBorrowRatesfetchDepositAddressfetchDepositAddressesfetchDepositAddressesByNetworkfetchIsolatedBorrowRatefetchIsolatedBorrowRatesfetchMarkets
fetchOHLCVfetchOpenOrders
fetchOrderfetchOrderBookfetchOrderBooksfetchOrdersfetchTickerfetchTickers	fetchTimefetchTradesfetchTradingFee)fetchTradingFeesfetchTransactionFees151530601202403607201440432010080)1m5m15m30m1h2h4h6h12h1d3d1w)marketsztickers/{pair}tickers_multi
order_bookorder_book/multizfees/tradingtrades	timestampk)getpost)keyz
members/meorderszorders/filter)ro   zorders/multizorder/deletezorder/delete/multizorders/clear)publicprivatetradingz0.001)	tierBased
percentagemakertakerPLAPlair)z-1z-21001100410061008101010112001200220049003)z"market does not have a valid valuez side does not have a valid valuez(Account::AccountError: Cannot lock fundszThe account does not exist)codesexact)idname	countriesversion	rateLimiturlshas
timeframesr%   feescommonCurrenciesprecisionMode
exceptions)deep_extendsuperr   describeparse_numberr   r   r   r   r   r   r   r   )self	__class__s    `/var/www/html/crypto-bot/backend/venv/lib/python3.11/site-packages/ccxt/async_support/oceanex.pyr   zoceanex.describe   sb   gt 4 4 = = ? ?}5 57H %%% %% 	%
 $% $% "4% t% % $T% t% % +E% )%% $T%  '!%" (#% %$ &u%%& ('%( 1%)%* *5+%, +E-%. /%0 d1%2 "43%4 d5%6 !$7%8 "49%: t;%< t=%> ?%@ TA%B tC%D "5E% %F %)(,I% % %N   	 	 	        ! B !&"&!..w77!..w77	  w! ' %$&-///,/(),  ;E8B@Q2E	  _EB
 EB
 E E E	    returnc                    K   ddi}|                      |                     ||                     d{V }|                     |dg           }|                     |          S )a  
        retrieves data on all markets for oceanex
        :see: https://api.oceanex.pro/doc/v1/#markets-post
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: an array of objects representing market data
        show_detailsTNdata)publicGetMarketsextend
safe_valueparse_markets)r   paramsrequestresponsere   s        r   fetch_marketszoceanex.fetch_markets   sp       "4(..t{{7F/K/KLLLLLLLL //(FB77!!'***r   c                    |                      |d          }|                      |d          }|                    d          \  }}|                     |          }|                     |          }|                                }|                                }|dz   |z   }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 |                     |                     |                     |d                              |                     |                     |                     |d                              dd d dd d dd d d|                     |d          d ddd |d
S )Nr   r   /symbolbasequotesettlebaseIdquoteIdsettleIdtyper*   Tr+   Fr,   r-   r.   activecontractlinearamount_precisionprice_precision)amountprice)minmaxminimum_trading_amount)leverager   r   cost)
inversecontractSizeexpiryexpiryDatetimestrike
optionType	precisionlimitscreatedinfo)r   splitsafe_currency_codelowerr   parse_precisionsafe_stringsafe_number)	r   marketr   r   r   r   r   r   r   s	            r   parse_marketzoceanex.parse_market   sV   __VT**vv..**S//&&v..''00--//e#0
"0
f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
$  "++D,@,@AQAQRXZlAmAm,n,noo**4+?+?@P@PQWYj@k@k+l+lmm    
   
   
  ++F4LMM  $ _0
 0
 0
 0	
r   r   c                 0  K   |                                   d{V  |                     |          }d|d         i}|                     |                     ||                     d{V }|                     |di           }|                     ||          S )a  
        fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
        :see: https://api.oceanex.pro/doc/v1/#ticker-post
        :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>`
        Npairr   r   )load_marketsr   publicGetTickersPairr   	safe_dictparse_ticker)r   r   r   r   r   r   r   s          r   fetch_tickerzoceanex.fetch_ticker   s       !!!!!!!!!V$$F4L
 224;;w3O3OPPPPPPPP$ ~~h33  v...r   Nsymbolsc                 N  K   |                                   d{V  |                     |          }|| j        }|                     |          }d|i}|                     |                     ||                     d{V }|                     |dg           }i }t          dt          |                    D ]V}||         }	| 	                    |	d          }
| 
                    |
          }|d         }|                     |	|          ||<   W|                     |d|          S )a  
        fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
        :see: https://api.oceanex.pro/doc/v1/#multiple-tickers-post
        :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
        Nre   r   r   r   r   )r   market_symbolsr   
market_idspublicGetTickersMultir   r   rangelenr   safe_marketr   filter_by_array_tickers)r   r   r   	marketIdsr   r   r   resultitickermarketIdr   r   s                r   fetch_tickerszoceanex.fetch_tickers  sB      !!!!!!!!!%%g..?lGOOG,,	i(33DKK4P4PQQQQQQQQ$ x44q#d))$$ 	? 	?A!WF''99H%%h//FH%F!..vv>>F6NN++FHgFFFr   r   c                 d   |                      |di           }|                     |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|          S )Nr   atr   rj   datetimehighlowbidbuy	bidVolumeasksell	askVolumevwapopencloselastpreviousClosechangert   averagevolume)
baseVolumequoteVolumer   )r   safe_timestampsafe_symbolsafe_tickeriso8601r   )r   r   r   r   rj   r   s         r   r   zoceanex.parse_ticker?  s    x44''d33	!!$// !
f!
!
 Y//!
 D$$VV44	!

 4##FE22!
 4##FE22!
 !
 4##FF33!
 !
 D!
 D!
 T%%ff55!
 D$$VV44!
 T!
 d!
  $!!
" t#!
$ **68<<)!
 !
 !
* +  	r   limitc                 l  K   |                                   d{V  |                     |          }d|d         i}|||d<   |                     |                     ||                     d{V }|                     |di           }|                     |d          }|                     |||          S )a1  
        fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
        :see: https://api.oceanex.pro/doc/v1/#order-book-post
        :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   r   r   rj   )r   r   publicGetOrderBookr   r   r   parse_order_book)	r   r   r   r   r   r   r   	orderbookrj   s	            r   fetch_order_bookzoceanex.fetch_order_bookg  s       !!!!!!!!!V$$fTl
 $GG00Wf1M1MNNNNNNNN( OOHfb99	''	;??	$$Y	BBBr   c                 &  K   |                                   d{V  || j        }|                     |          }d|i}|||d<   |                     |                     ||                     d{V }|                     |dg           }i }t          dt          |                    D ]e}	||	         }
|                     |
d          }| 	                    |          }| 
                    |
d          }|                     |
||          ||<   f|S )aw  
        fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data for multiple markets
        :see: https://api.oceanex.pro/doc/v1/#multiple-order-books-post
        :param str[]|None symbols: list of unified market symbols, all symbols fetched if None, default is None
        :param int [limit]: max number of entries per orderbook to return, default is None
        :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 symbol
        Nre   r   r   r   r   rj   )r   r   r   publicGetOrderBookMultir   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   r   rj   s                 r   fetch_order_bookszoceanex.fetch_order_books  s?      !!!!!!!!!?lGOOG,,	y
 $GG55dkk'66R6RSSSSSSSS0 x44q#d))$$ 	Q 	QAQI''	8<<H%%h//F++I{CCI!229fiPPF6NNr   sincec                 \  K   |                                   d{V  |                     |          }d|d         i}|t          |d          |d<   |                     |                     ||                     d{V }|                     |d          }|                     ||||          S )a  
        get the list of most recent trades for a particular symbol
        :see: https://api.oceanex.pro/doc/v1/#trades-post
        :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   i  r   r   )r   r   r   publicGetTradesr   	safe_listparse_trades)	r   r   r  r   r   r   r   r   r   s	            r   fetch_tradeszoceanex.fetch_trades  s       !!!!!!!!!V$$fTl
 "5$//GG--dkk'6.J.JKKKKKKKK& ~~h//  vue<<<r   c                    |                      |d          }|dk    rd}n|dk    rd}|                      |d          }|                     ||          }|                     |d          }|)|                     |                     |d                    }|                     |d	          }|                     |d
          }|                     |||                     |          ||                     |d          d dd |||d d d|          S )Nsider   r   r   r   r   
created_on
created_atr   r   r   r   )r   rj   r   r   r   orderr   takerOrMakerr  r   r   r   fee)r   r   r   	parse8601r   
safe_trader   )	r   trader   r  r   r   rj   priceStringamountStrings	            r   parse_tradezoceanex.parse_trade  s+    uf--5==DDU]]D??5(33!!(F33''|<<	t'7'7|'L'LMMI&&ug66''x88"Y//""5$//  " 
  
   	r   c                 h   K   |                      |           d{V }|                     |d          S )aU  
        fetches the current integer timestamp in milliseconds from the exchange server
        :see: https://api.oceanex.pro/doc/v1/#api-server-time-post
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns int: the current integer timestamp in milliseconds from the exchange server
        Nr   )publicGetTimestampr   r   r   r   s      r   
fetch_timezoceanex.fetch_time  sE       0088888888 ""8V444r   c                   K   |                      |           d{V }|                     |dg           }i }t          dt          |                    D ]}||         }|                     |di           }|                     |di           }|                     |d          }	|                     |	          }
||
|                     |d          |                     |d          dd	||
<   |S )
aP  
        fetch the trading fees for multiple markets
        :see: https://api.oceanex.pro/doc/v1/#trading-fees-post
        :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   r   ask_feebid_feer   valueT)r   r   ru   rv   rt   )publicGetFeesTradingr   r   r   r   r   r   )r   r   r   r   r   r   groupru   rv   r   r   s              r   fetch_trading_feeszoceanex.fetch_trading_fees"  s	      226::::::::x44q#d))$$ 	 	AGEOOE9b99EOOE9b99E''x88H%%h//F ))%99))%99" F6NN r   c                 h   K   |                      |           d {V }|                     |d          S )Nr   )privateGetKeyr   r  s      r   	fetch_keyzoceanex.fetch_key;  s?      ++F33333333x000r   c                    |                      |d          }|                      |dg           }d|i}t          dt          |                    D ]}||         }|                      |d          }|                     |          }|                                 }	|                     |d          |	d<   |                     |d          |	d	<   |	||<   |                     |          S )
Nr   accountsr   r   currencybalancefreelockedused)r   r   r   r   accountr   safe_balance)
r   r   r   balancesr   r   r)  
currencyIdcoder-  s
             r   parse_balancezoceanex.parse_balance?  s    x00??4R88(#q#h--(( 	# 	#AqkG*==J**:66DllnnG"..w	BBGFO"..wAAGFO"F4LL  (((r   c                    K   |                                   d{V  |                     |           d{V }|                     |          S )aa  
        query for balance and get the amount of funds available for trading or funds locked in orders
        :see: https://api.oceanex.pro/doc/v1/#account-info-post
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
        N)r   privateGetMembersMer2  r  s      r   fetch_balancezoceanex.fetch_balanceM  se       !!!!!!!!!11&99999999!!(+++r   r   r  r   r   c                   K   |                                   d{V  |                     |          }|d         |||                     ||          d}|dk    r|                     ||          |d<   |                     |                     ||                     d{V }	|                     |	d          }
|                     |
|          S )a  
        create a trade order
        :see: https://api.oceanex.pro/doc/v1/#new-order-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 fullfilled, 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  ord_typer   r   r   r   )r   r   amount_to_precisionprice_to_precisionprivatePostOrdersr   r   parse_order)r   r   r   r  r   r   r   r   r   r   r   s              r   create_orderzoceanex.create_orderX  s       !!!!!!!!!V$$Tl..vv>>	
 
 7??#66vuEEGG//GV0L0LMMMMMMMM~~h//f---r   r   c                 ,  K   |                                   d{V  d}||                     |          }|g}d|i}|                     |                     ||                     d{V }|                     |d          }t          |          }	|t          | j        dz             t          |t                    r| 
                    ||          }
|
d         S |	dk    rt          | j        dz             |                     |d         |          S )a~  
        fetches information on an order made by the user
        :see: https://api.oceanex.pro/doc/v1/#order-status-get
        :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idsr   z could not found matching orderr   )r   r   privateGetOrdersr   r   r   r   r   
isinstancelistparse_ordersr;  )r   r   r   r   r   r>  r   r   r   
dataLengthro   s              r   fetch_orderzoceanex.fetch_orderr  s.      !!!!!!!!![[((Fd#,..t{{7F/K/KLLLLLLLLx00YY
<*K KLLLb$ 	&&tV44F!9??*K KLLLQ000r   c           	      t   K   ddgi}|                      ||||                     ||                     d{V S )a  
        fetch all unfilled currently open orders
        :see: https://api.oceanex.pro/doc/v1/#order-status-get
        :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>`
        stateswaitNfetch_ordersr   r   r   r  r   r   r   s         r   fetch_open_orderszoceanex.fetch_open_orders  sS       vh
 &&vueT[[RX=Y=YZZZZZZZZZr   c           	      v   K   dddgi}|                      ||||                     ||                     d{V S )a3  
        fetches information on multiple closed orders made by the user
        :see: https://api.oceanex.pro/doc/v1/#order-status-get
        :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>`
        rF  donecancelNrH  rJ  s         r   fetch_closed_orderszoceanex.fetch_closed_orders  sV       vx(
 &&vueT[[RX=Y=YZZZZZZZZZr   c           	        K   |t          | j        dz             |                                  d{V  |                     |          }|                     |dg d          }|                     |d          }|d         |dd}|||d<   |                     |                     ||                     d{V }	|                     |	d	g           }
g }t          d
t          |
                    D ]}|                     |
|         dg           }| 
                    |                     |
|         d                    }|                     ||||d|i          }|                     ||          }|S )a:  
        fetches information on multiple orders made by the user
        :see: https://api.oceanex.pro/doc/v1/#order-status-with-filters-post
        :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>`
        Nz) fetchOrders() requires a symbol argumentrF  rG  rM  rN  r   True)r   rF  
need_pricer   r   r   ro   statestatus)r   r   r   r   r   omitprivateGetOrdersFilterr   r   r   parse_order_statusrB  array_concat)r   r   r  r   r   r   rF  queryr   r   r   r   r   ro   rU  parsedOrderss                   r   rI  zoceanex.fetch_orders  s      >#DG.Y$YZZZ!!!!!!!!!V$$3M3M3MNN		&(++Tl 
 

 $GG44T[[%5P5PQQQQQQQQx44q#d))$$ 	= 	=A__T!Wh;;F,,T__T!Wg-N-NOOF,,VVUEHV\K]^^L&&v|<<FFr   c           	         |                      |d          |                     |d          |                     |d          |                     |d          |                     |d          |                     |d          gS )Nr                  )r   r   )r   ohlcvr   s      r   parse_ohlcvzoceanex.parse_ohlcv  s     q))UA&&UA&&UA&&UA&&UA&&
 	
r   rY   c                   K   |                                   d{V  |                     |          }|d         |                     | j        ||          d}|||d<   |t	          |d          |d<   |                     |                     ||                     d{V }|                     |dg           }	|                     |	||||          S )a  
        fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
        :see: https://api.oceanex.pro/doc/v1/#k-line-post
        :param str symbol: unified symbol of the market to fetch OHLCV data for
        :param str timeframe: the length of time each candle represents
        :param int [since]: timestamp in ms of the earliest candle to fetch
        :param int [limit]: the maximum amount of candles to fetch
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns int[][]: A list of candles ordered, open, high, low, close, volume
        Nr   )r   periodrj   i'  r   r   )	r   r   r   r   r   publicPostKr   r  parse_ohlcvs)
r   r   	timeframer  r   r   r   r   r   ohlcvss
             r   fetch_ohlcvzoceanex.fetch_ohlcv  s       !!!!!!!!!V$$Tl&&t	9MM
 
 #(GK "5%00GG))$++gv*F*FGGGGGGGG&"55  E5IIIr   c           	      L   |                      |                     |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|          S )NrT  r   	market_idr  r  r   	avg_pricer   remaining_volumeexecuted_volumer   r   clientOrderIdrj   r   lastTradeTimestampr   r   r7  timeInForcepostOnlyr  	stopPricetriggerPricer   r   	remaining)filledrU  r   ri   r  )	rX  r   safe_string_2r   r   r  r   
safe_orderr   )r   r  r   rU  r   r   rj   r   r   r   rv  rw  s               r   r;  zoceanex.parse_order  s8   $ (()H)HII%%eX{CC!!(F33''|<<	t'7'7|'L'LMMI  00""5+66!!%22$$U,>??	!!%):;;  
E 
$""5$// 
 T 
 	 

 Y// 
 !$ 
 f 
 DOOE:66 
 4 
  
 DOOE622 
 U 
  
 D 
 w 
  f! 
" # 
$ - 
  
  
. /  	r   c                 <    dddd}|                      |||          S )Nr   closedcanceledrQ  )r   )r   rU  statusess      r   rX  zoceanex.parse_order_status,  s1     
 

 &&999r   c                    K   |                                   d{V  |                     |                     d|i|                     d{V }|                     |d          }|                     |          S )as  
        cancels an open order
        :see: https://api.oceanex.pro/doc/v1/#cancel-order-post
        :param str id: order id
        :param str symbol: not used by oceanex cancelOrder()
        :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   privatePostOrderDeleter   r   r;  )r   r   r   r   r   r   s         r   cancel_orderzoceanex.cancel_order4  s       !!!!!!!!!44T[[$V5T5TUUUUUUUU~~h//%%%r   c                    K   |                                   d{V  |                     |                     d|i|                     d{V }|                     |d          }|                     |          S )a  
        cancel multiple orders
        :see: https://api.oceanex.pro/doc/v1/#cancel-multiple-orders-post
        :param str[] ids: order ids
        :param str symbol: not used by oceanex cancelOrders()
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
        Nr>  r   )r   privatePostOrderDeleteMultir   r  rB  )r   r>  r   r   r   r   s         r   cancel_orderszoceanex.cancel_ordersB  s       !!!!!!!!!99$++uclTZ:[:[\\\\\\\\~~h//  &&&r   c                    K   |                                   d{V  |                     |           d{V }|                     |d          }|                     |          S )a  
        cancel all open orders
        :see: https://api.oceanex.pro/doc/v1/#cancel-all-orders-post
        :param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
        Nr   )r   privatePostOrdersClearr  rB  )r   r   r   r   r   s        r   cancel_all_orderszoceanex.cancel_all_ordersP  sx       !!!!!!!!!44V<<<<<<<<~~h//  &&&r   rp   GETc                    | j         d         d         dz   | j        z   dz   |                     ||          z   }|                     ||                     |                    }|dk    r|dk    s|dk    rod}	|                     |d          }
t          d	t          |
                    D ]}|	d
|
|         z   dz   z  }	|                     |d          }||	d|z   z  }	||	z  }nz|r|d|                     |          z   z  }n\|dk    rV| 	                                 | j
        |d}	|                     |	|                     | j                  dd          }|d|z   z  }ddi}||||dS )Nr%   r#   r   rp   rf   rh   ?re   r   z
markets[]=&r   zlimit=rq   )uidr   sha256Tz
?user_jwt=zContent-Typezapplication/json)urlmethodbodyheaders)r   r   implode_paramsrV  extract_paramsr   r   r   	urlencodecheck_required_credentialsapiKeyjwtencodesecret)r   pathr%   r  r   r  r  r  rZ  r   re   r   r   	jwt_tokens                 r   signzoceanex.sign]  s   iv&,t|;cADDWDWX\^dDeDee		&$"5"5d";";<<(??&&$2D*D*D//&)<<q#g,,// ? ?A|gaj83>>GG88$x%//Gw 3sT^^E2222I++---{ G $++dk*B*BHdSSI<)++C!#56fdwOOOr   c
                 6   |d S |                      |d          }
|                      |d          }|
f|
dk    r`| j        dz   |z   }|                     | j        d         |
|           |                     | j        d         ||           t	          |          d S )Nr1  message0 r   r   )r   r   throw_exactly_matched_exceptionr   r   )r   r1  reasonr  r  r  r  r   requestHeadersrequestBody	errorCoder  feedbacks                r   handle_errorszoceanex.handle_errorsz  s     4$$Xv66	""8Y77!	S(8(8w}t+H001I9V^___001I7T\]]])))tr   )N)3__name__
__module____qualname__r   r   r   r   r   strr   r   r   r   r   r   r   r
   r  r  r   r
  r  r  r   r"  r%  r   r2  r5  r   r   floatr   r<  r   rD  r	   rK  rO  rI  rA  rc  rj  r;  rX  r  r  r  r  r  __classcell__)r   s   @r   r   r      sI       F F F F FP *, + +V + + + +29
f 9
 9
 9
 9
v 68  /  /  /F  /  /  /  /D 6:" (G (G7 (G (G (G (G (GT& & & & & &P @DB &C &CS &C &CS\ &C &C &C &CP :>DY[ 2 2w 2c 2 2 2 2h <@d[] %= %= %=S %= %=bfglbm %= %= %= %=N) ) )5 ) ) ) )V ') 5 5 5 5 /1  [    2 &( 1 1 1 1) ) ) ) ) *, 	, 	, 	, 	, 	, 	, mqy{ . . .I .Y .X] .fi . . . .4 8<B 1 1C 1 1 1 1 14 59tZ^gi [ [c [ [TW [nrsxny [ [ [ [ 7;\`ik [ [ [3 [VY [ptuzp{ [ [ [ [ 04$UYbd   C s imnsit    B
 
 
4 
 
 
 
$ 8<$]ajl J J JC JWZ Jquvzq{ J J J J24 4 45 4 4 4 4l: : : 9=R & &S &# & & & & 6:" ' 's ' ' ' ' 59 ' 'c ' ' ' ' &eBSW P P P P:      r   r   N)! ccxt.async_support.base.exchanger   ccxt.abstract.oceanexr   ccxt.base.typesr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   typingr   ccxt.base.errorsr   r   r   r   r   r   r   r   ccxt.base.decimal_to_precisionr   r    r   r   <module>r     s   6 5 5 5 5 5 - - - - - - R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R       * * * * * * 0 0 0 0 0 0 - - - - - - . . . . . . ' ' ' ' ' ' . . . . . . ) ) ) ) ) ) * * * * * * 4 4 4 4 4 4r r r r rh r r r r rr   