
    iW                    h   d dl mZ d dlm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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" 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)ImplicitAPIN)AccountBalances
CurrenciesCurrencyIntMarketNumOrder	OrderBook	OrderSide	OrderTypeStrStringsTickerTickersTradeTransaction)List)ExchangeError)AuthenticationError)PermissionDenied)ArgumentsRequired)
BadRequest)	BadSymbol)InsufficientFunds)InvalidOrder)OrderNotFound)NotSupported)NetworkError)ExchangeNotAvailable)OnMaintenance)RequestTimeout)TRUNCATE)	TICK_SIZE)Precisec                       e Zd Z fdZi fdZdi fdefdZi fdefdZdi fde	fd	Z
d
 Zi fdee         fdZdAdedefdZdi fdededefdZi fdedefdZdi fdedefdZdAdedefdZdddi fdede	dedefdZdddi fde	dedefdZddi fdedededee         fdZdAdedefdZdddi fdedededee         fdZi fdee         fdZ i fde!fdZ"de#fdZ$i fde#fdZ%dddi f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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-d' Z.dAdede(fd(Z/i fded)e0fd*Z1di fded+e2d,e3d-e0d.e4f
d/Z5di fdede	fd0Z6di fde	fd1Z7di fde	fd2Z8dAd3Z9d4 Z:dAd5e;fd6Z<dddi fd7e	dededee=         fd8Z>dddi fd7e	dededee=         fd9Z?dAd5e;de=fd:Z@d; ZAdi fd7ed-e0fd<ZBd=d>i ddfd?ZCd@ ZD xZES )Bhuobijpc                    |                      t          t          |                                           i ddddddgddd	| j        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d+dd,dd-dd.dd/dd0dd1dd2dd3dd4dd5ddddddddddddd6d7d8d9d:d;d<d=d>d?d@dAdB
dCdDdEdEdEdEdEdFdGdHdIdJdKdLdMdNdNdOii dPdNdQdNdRdNdSdNdTdUdVdNdWdXdYdUdZdNd[dNd\dNd]dNd^dNd_dNd`dNdadNdbdNdNdNdNdNdNdNdNdUdUdNdNdci dddNdTdUdedUdfdNdgdNdhdNdidNdjdNdkdNdldNdmdNdndNdodNdpdNdqdNdrdNdsdNdNdNdUdUdtdudvdwdMdNdNdNdNdNdNdNdNdxidMdNdNdNdNdNdyii dzdXd{dXd|dNd}d~ddNddNddNddddddddddddNddNddNddXddXdNdNdNdNdtdNdNdi dddNddNddddXddXddddXddddNddNddtddtddtddtddNddNddNdNdNdtddwddddMdd|                     d          |                     d          didt          dt          t          di dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          t          t          t          t          t           t           t          t           t           t          t          t          dddddddddddddddddddddidɜ
ddddddddќi          S )Nidr)   namezHuobi Japan	countriesJP	rateLimitd   	userAgentchrome39	certifiedFversionv1hostnamezapi-cloud.bittrade.co.jpproThasCORSspotmarginswapfutureoptioncancelAllOrderscancelOrdercancelOrderscreateMarketBuyOrderWithCostcreateMarketOrderWithCostcreateMarketSellOrderWithCostcreateOrdercreateStopLimitOrdercreateStopMarketOrdercreateStopOrderfetchAccountsfetchBalancefetchClosedOrdersfetchCurrenciesfetchDepositAddressfetchDepositAddressesByNetworkfetchDepositsfetchFundingHistoryfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchIndexOHLCVfetchMarketsfetchMarkOHLCVfetchMyTrades
fetchOHLCVfetchOpenOrders
fetchOrder)fetchOrderBookfetchOrdersfetchOrderTradesfetchPremiumIndexOHLCVfetchTickerfetchTickers	fetchTimefetchTradesfetchTradingLimitsfetchWithdrawalswithdraw
timeframes1min5min15min30min60min4hour1day1week1mon1year)
1m5m15m30m1h4h1d1w1M1yurlszchttps://user-images.githubusercontent.com/1294454/85734211-85755480-b705-11ea-8b35-0b7f1db33a2f.jpgzhttps://{hostname})marketpublicprivatev2Public	v2Privatezhttps://www.huobi.co.jpz3https://www.huobi.co.jp/register/?invite_code=znnq3zhttps://api-doc.huobi.co.jpz#https://www.huobi.co.jp/support/fee)logoapiwwwreferraldocfeesr   get   )zreference/currencieszmarket-statuszaccount/ledgerzaccount/withdraw/quotazaccount/withdraw/addresszaccount/deposit/addresszaccount/repayment   zreference/transact-fee-ratezaccount/asset-valuationg?zpoint/accountzsub-user/user-listzsub-user/user-statezsub-user/account-listzsub-user/deposit-addresszsub-user/query-depositzuser/api-keyzuser/uidzalgo-orders/openingzalgo-orders/history)zalgo-orders/specificz
c2c/offers	c2c/offerzc2c/transactionsc2c/repaymentzc2c/accountzetp/referencezetp/transactionszetp/transactionzetp/rebalancez	etp/limitzaccount/transferzpoint/transferzsub-user/managementzsub-user/creationzsub-user/tradable-marketzsub-user/transferabilityzsub-user/api-key-generationzsub-user/api-key-modificationzsub-user/api-key-deletionzsub-user/deduct-modezalgo-orderszalgo-orders/cancel-all-afterzalgo-orders/cancellationr   zc2c/cancellationzc2c/cancel-all
   2   )r   zc2c/transferzetp/creationzetp/redemptionzetp/{transactId}/cancelzetp/batch-cancel)r   post)zhistory/klinezdetail/mergeddepthtradezhistory/tradedetailtickersetp)zcommon/symbolszcommon/currencyszcommon/timestampzcommon/exchangezsettings/currencyszaccount/accountszaccount/accounts/{id}/balancezaccount/accounts/{sub-uid}zaccount/history   zcross-margin/loan-infozmargin/loan-infozfee/fee-rate/getzorder/openOrdersg?zorder/orderszorder/orders/{id}zorder/orders/{id}/matchresultszorder/orders/getClientOrderzorder/historyzorder/matchresultszquery/deposit-withdrawzmargin/loan-orderszmargin/accounts/balance)zcross-margin/loan-orderszcross-margin/accounts/balancezpoints/actionszpoints/orderszsubuser/aggregate-balancezstable-coin/exchange_ratezstable-coin/quotezfutures/transferzorder/batch-orderszorder/orders/placez$order/orders/submitCancelClientOrderz"order/orders/batchCancelOpenOrderszorder/orders/{id}/submitcancelzorder/orders/batchcancelzdw/withdraw/api/createzdw/withdraw-virtual/{id}/cancelzdw/transfer-in/marginzdw/transfer-out/marginzmargin/orderszmargin/orders/{id}/repayzcross-margin/transfer-inzcross-margin/transfer-outzcross-margin/orders)zcross-margin/orders/{id}/repayzstable-coin/exchangezsubuser/transfer)r   r   r|   r}   r~   r   trading0.002)feeSide	tierBased
percentagemakertakerprecisionMode
exceptions)zTcontract is restricted of closing positions on API.  Please contact customer servicemaintainzbad-requestzbase-date-limit-errorzapi-not-support-temp-addrtimeoutzgateway-internal-errorz)account-frozen-balance-insufficient-errorzinvalid-amountz!order-limitorder-amount-min-errorz!order-limitorder-amount-max-errorz"order-marketorder-amount-min-errorz order-limitorder-price-min-errorz order-limitorder-price-max-errorzorder-holding-limit-failedz order-orderprice-precision-errorzorder-etp-nav-price-max-errorzorder-orderstate-errorzorder-queryorder-invalid)zorder-update-errorzapi-signature-check-failedzapi-signature-not-validzbase-record-invalidzbase-symbol-trade-disabledzbase-symbol-errorzsystem-maintenancezinvalid symbolzsymbol trade not open nowzinvalid-addresszbase-currency-chain-errorzdw-insufficient-balance)broadexactoptionsERC20erc20trc20hrc20algo )ETHTRXHRC20HECOHTALGOOMNIprivate_get_order_ordersfetch_open_orders_v1publicGetCommonSymbols"privateGetAccountAccountsIdBalanceprivatePostOrderOrdersPlacezen-US
AA03022abc)
defaultNetworknetworksfetchOrdersByStatesMethodfetchOpenOrdersMethod!createMarketBuyOrderRequiresPricefetchMarketsMethodfetchBalanceMethodcreateOrderMethodlanguagebrokercommonCurrenciesThemiszGame.comHitChainPentazSuper BitcoinzBitcoin File)GETGTCHITPNTSBTCBIFI)deep_extendsuperr)   describe
userAgentsparse_numberr&   r#   r   r   r$   r"   r   r   r   r   r   )self	__class__s    R/var/www/html/crypto-bot/backend/venv/lib/python3.11/site-packages/ccxt/huobijp.pyr   zhuobijp.describe    s	   gt 4 4 = = ? ? yB
)yB
MyB
 $yB
 	yB

 4yB
 yB
 tyB
 2yB
 4yB
  ... $. 	.
 %. %. "4. t. . /. ,U. 0. t. '. (.  "5!."  #. .$ %.& $T'.( "4).* &u+., 1%-..  /.0 &u1.2 #E3.4 *55.6 $U7.8 "59.: ;.< !%=.>  ?.@ dA.B "4C.D dE. .F #'#$(*/# $!#&*$( [. . .yB
r  syB
J }223 4!5  1Q4= KyB
f 01)* (!0! 3A 21	
 ,Q 6q 23 ( -a .q 0 3A 1! ' #A  .q!" .q#$ 12&'%&,-)*'()*,-+,)*%&9  <*A+Q )! .q	
 ,Q 3A 3A 6q 8 4Q / &q 7 3A $Q  +A!" )!#$ *+()()*+35,./  ?8 8t )*)*!"!")*"##$ 	 	 *+,-,-+,./ *C7 5a *1	
 1! +A +A +C ' ,S 9# 6s ( -a  1!!$ -c%& 23'( 569:*+)*5756-.5  8*A*A -c -c	
 ? =c 9# 3C 1! :1  0!" 1"#$ (%& 3B'( 3A)* 4Q+, .q-. ;<01,.3  ;8 8kN NgyB
D $!&"&!..w77!..w77 EyB
V YWyB
X ly -  !:  ,Z  01A	 
 ~  -.B  @AR  %l  8  8  9,  7  7  1,  7   4\! " -m# $ /% & +?2E/B+82;)2*7&/1:'11;/@?     & &YyB
f ")""$#!"  .H)?59&>&J%B#,' gyB
T	   !!
 '&! !U	yB
 yB
 y y y	    c                 X    |                      |          }|                     |d          S )a  
        fetches the current integer timestamp in milliseconds from the exchange server
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns int: the current integer timestamp in milliseconds from the exchange server
        data)publicGetCommonTimestampsafe_integerr   paramsresponses      r   
fetch_timezhuobijp.fetch_time\  s-     0088  6222r   Nsymbolsc                     |                                   || j        }i }t          dt          |                    D ]6}||         }|                     |                     |          |          ||<   7|S )Nr   )load_marketsr   rangelenfetch_trading_limits_by_id	market_id)r   r   r   resultisymbols         r   fetch_trading_limitszhuobijp.fetch_trading_limitse  s~     	?lGq#g,,'' 	] 	]AQZF!<<T^^F=S=SU[\\F6NNr   r+   c                     d|i}|                      |                     ||                    }|                     |                     |di                     S )Nr   r   )publicGetCommonExchangeextendparse_trading_limits
safe_value)r   r+   r   requestr   s        r   r   z"huobijp.fetch_trading_limits_by_idr  sW    b
 //GV0L0LMM" ((62)N)NOOOr   r   c                 f    |d|                      |d          |                      |d          didS )Namountzlimit-order-must-greater-thanzlimit-order-must-less-thanminmax)infolimits)safe_number)r   r   r   r   s       r   r   zhuobijp.parse_trading_limits  sP    " ++F4STT++F4PQQ 
 
 	
r   c                 t    |                      |t          | j        |         d         d         | j                  S )N	precisioncost)decimal_to_precisionr%   marketsr   )r   r   r   s      r   cost_to_precisionzhuobijp.cost_to_precision  s2    ((xf9Mk9Z[a9bdhdvwwwr   returnc                 ~   | j         d         } t          | |          |          }|                     |dg           }t          |          }|dk     r-t	          | j        dz   |                     |          z             g }t          dt          |                    D ]}||         }|                     |d          }	|                     |d          }
| 	                    |	          }| 	                    |
          }|                     |d          }|                     |d	d
          }|                     |dd
          }t          j        |d
          pt          j        |d
          }|dk    r|                     d          n|                     d          }|                    i d|	|
z   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"k    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 )0z
        retrieves data on all markets for huobijp
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: an array of objects representing market data
        r   r   r   z) fetchMarkets() returned empty response: r   zbase-currencyzquote-currencystatezleverage-ratio1zsuper-margin-leverage-ratioOMG0r   r+   r   /basequotesettleNbaseIdquoteIdsettleIdtyper:   Tr;   r<   Fr=   r>   activeonlinecontractlinearzprice-precisionzamount-precisionzvalue-precision)pricer   r   )r   r   superMaxzmin-order-amtzmax-order-amtr   zmin-order-value)leverager   r  r   )inverser   r   contractSizeexpiryexpiryDatetimestrike
optionTyper   r   createdr   )r   getattrr   r   r!   r+   jsonr   safe_stringsafe_currency_coder'   	string_gtr   appendparse_precisionr   )r   r   methodr   r   
numMarketsr   r   r|   r  r  r  r  r   leverageRatiosuperLeverageRatior;   fees                     r   fetch_marketszhuobijp.fetch_markets  s    23(74((00B //(FB77\\
>>tw)TTW[W`W`ahWiWiijjjq#g,,'' ?	 ?	AQZF%%fo>>F&&v/?@@G**622D++G44E$$VW55E ,,V5EsKKM!%!1!1&:WY\!]!]&}c::hg>OPbdg>h>hF-1U]]$##C(((ARARSZA[A[CMM 4fw&4$*u,4 4 	4
 $4 &4 74 D4 4 4 &4 4 %4 %4 5H,4  E!4" $#4$   $"&"!..t/C/CDDTDTU[]nDoDo/p/pqq"//0D0DTEUEUV\^pEqEq0r0rss --d.B.B4CSCSTZ\mCnCn.o.opp   $0055#00??$($5$56H$I$I! !  $//HH#//HH 
  $# 
  $//8IJJ#  &  g4 4 4 4 4 4 4j r   r|   c                 >   |                      d |          }|                     |d          }d }d }d }d }d|v rt          |d         t                    r9|                     |d         d          }|                     |d         d          }n,|                     |d          }|                     |d          }d|v rt          |d         t                    r9|                     |d         d          }|                     |d         d          }n,|                     |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|          S )Ntsbidr   r   bidSizeaskaskSizeopencloser   volr   	timestampdatetimehighlow	bidVolume	askVolumevwaplastpreviousClosechanger   average)
baseVolumequoteVolumer   )safe_symbolr   
isinstancelistr  safe_tickeriso8601)r   tickerr|   r   r,  r%  r0  r'  r1  r)  r*  r7  r8  s                r   parse_tickerzhuobijp.parse_ticker  s   D !!$//%%fd33			F??&-.. @&&ve}a88 ,,VE]A>>		&&vu55 ,,VY??	F??&-.. @&&ve}a88 ,,VE]A>>		&&vu55 ,,VY??	//  11%%fh77
&&vu55 !
f!
!
 Y//!
 D$$VV44	!

 4##FE22!
 3!
 !
 3!
 !
 D!
 D!
 U!
 E!
 T!
 d!
  $!!
" t#!
$ %&)!
 !
 !
* +  	r   limitc                 n   |                                   |                     |          }|d         dd}|                     |                     ||                    }d|v r|d         s-t	          | j        dz   |                     |          z             |                     |d          }|                     |d|                     |d                    }| 	                    |||          }	|                     |d          |	d<   |	S t          | j        d	z   |                     |          z             )
a  
        fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
        :param str symbol: unified symbol of the market to fetch the order book for
        :param int [limit]: the maximum amount of order book entries to return
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
        r+   step0)r   r  tickz+ fetchOrderBook() returned empty response: r$  r4   noncez2 fetchOrderBook() returned unrecognized response: )r   r|   marketGetDepthr   r   r+   r  r   r   parse_order_bookr   )
r   r   r@  r   r|   r   r   rC  r,  r   s
             r   fetch_order_bookzhuobijp.fetch_order_bookf  sA    	V$$Tl
 
 &&t{{7F'C'CDD, XF# o*W WZ^ZcZcdlZmZm mnnn??8V44D))$d6G6GRV6W6WXXI**4CCF"//i@@F7OMDG&ZZ]a]f]fgo]p]ppqqqr   c                 \   |                                   |                     |          }d|d         i}|                     |                     ||                    }|                     |d         |          }|                     |d          }||d<   |                     |          |d<   |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>`
        r   r+   rC  r$  r,  r-  )r   r|   marketGetDetailMergedr   r?  r   r=  )r   r   r   r|   r   r   r>  r,  s           r   fetch_tickerzhuobijp.fetch_ticker  s     	V$$fTl
 --dkk'6.J.JKK* ""8F#3V<<%%h55	'{!\\)44zr   c                 8   |                                   |                     |          }|                     |          }|                     |dg           }|                     |d          }i }t          dt          |                    D ]y}|                     ||         d          }|                     |          }	|	d         }
| 	                    ||         |	          }||d<   | 
                    |          |d<   |||
<   z|                     |d|          S )a  
        fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
        :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>`
        r   r$  r   r   r,  r-  )r   market_symbolsmarketGetTickersr   r   r   r   r  safe_marketr?  r=  filter_by_array_tickers)r   r   r   r   r   r,  r   r   marketIdr|   r   r>  s               r   fetch_tickerszhuobijp.fetch_tickers  s    	%%g..((00//(FB77%%h55	q#g,,'' 	$ 	$A''
H==H%%h//FH%F&&wqz6::F"+F;!%i!8!8F:#F6NN++FHgFFFr   c                    |                      |d          }|                     ||          }|                     |dd          }|                      |d          }|                      |d          }|                      |d          }|%|                    d          }	|	d         }|	d	         }|                      |d
          }
|                      |d          }|                     |dd          }t          j        ||          }d }|                      |d          }|                     |                      |d                    }|                      |d          }|B|t          j        |d          r+|}|                     |                      |d                    }|||d}|                     |dd          }|                      |d|          }| 	                    |||||| 
                    |          |||
||||d          S )Nr   r$  
created-atzorder-id	directionr  -r   r   roler  filled-amountr   filled-feeszfee-currencyzfilled-pointsz0.0zfee-deduct-currencyr   currencyztrade-idtradeIdr+   )r   r+   r   orderr,  r-  r  sidetakerOrMakerr  r   r   r!  )r  r9  safe_integer_2splitsafe_string_2r'   
string_mulr  	string_eq
safe_trader=  )r   r   r|   rP  r   r,  r\  r]  r  	typePartsr^  r  r   r   r!  feeCostfeeCurrencyfilledPointsr[  r+   s                       r   parse_tradezhuobijp.parse_trade  s1   B ##E844!!(F33''t\BB	  
33{33v..

3IQ<DQ<D''v66  00##E?HEE!%00""5-88--d.>.>un.U.UVV''??#W%6w%F%F&"55d6F6FuNc6d6dee' C $$UJ	BBeT733"Y//( 
  
   	r   sincec                     |                                   d|i}|                     |                     ||                    }|                     |d         d||          S )a  
        fetch all the trades made from a single order
        :param str id: order id
        :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 to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
        r+   r   N)r   #privateGetOrderOrdersIdMatchresultsr   parse_trades)r   r+   r   rj  r@  r   r   r   s           r   fetch_order_tradeszhuobijp.fetch_order_trades   se     	"
 ;;DKKQW<X<XYY  &!14FFFr   c                     |                                   d}i }| |                     |          }|d         |d<   |||d<   |||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   sizez
start-timer   )r   r|   privateGetOrderMatchresultsr   rm  )r   r   rj  r@  r   r|   r   r   s           r   fetch_my_tradeszhuobijp.fetch_my_trades1  s     	[[((F &tGH#GFO$)GL!33DKK4P4PQQ  &!165%HHHr   i  c                    |                                   |                     |          }d|d         i}|t          |d          |d<   |                     |                     ||                    }|                     |dg           }g }	t          dt          |                    D ]p}
|                     ||
         dg           }t          dt          |                    D ]3}|                     ||         |          }|		                    |           4q| 
                    |	d          }	|                     |	|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>`
        r   r+   N  rp  r   r   r,  )r   r|   r   marketGetHistoryTrader   r   r   r   ri  r  sort_byfilter_by_symbol_since_limit)r   r   rj  r@  r   r|   r   r   r   r   r   tradesjr   s                 r   fetch_tradeszhuobijp.fetch_tradesH  sN    	V$$fTl
 !%..GFO--dkk'6.J.JKK2 x44q#d))$$ 	% 	%A__T!Wfb99F1c&kk** % %((F;;e$$$$% fk22009I5RWXXXr   c           	         |                      |d          |                     |d          |                     |d          |                     |d          |                     |d          |                     |d          gS )Nr+   r)  r.  r/  r*  r   )safe_timestampr   )r   ohlcvr|   s      r   parse_ohlcvzhuobijp.parse_ohlcv{  s     t,,UF++UF++UE**UG,,UH--
 	
r   rq   c                 z   |                                   |                     |          }|d         |                     | j        ||          d}|t	          |d          |d<   |                     |                     ||                    }|                     |dg           }	|                     |	||||          S )aQ  
        fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
        :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
        r+   )r   periodNrt  rp  r   )	r   r|   r  rf   r   marketGetHistoryKliner   	safe_listparse_ohlcvs)
r   r   	timeframerj  r@  r   r|   r   r   r   s
             r   fetch_ohlcvzhuobijp.fetch_ohlcv  s     	V$$Tl&&t	9MM
 
 !%..GFO--dkk'6.J.JKK ~~h33  vy%GGGr   c                 d    |                                   |                     |          }|d         S )a  
        fetch all the accounts associated with a profile
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a dictionary of `account structures <https://docs.ccxt.com/#/?id=account-structure>` indexed by the account type
        r   )r   privateGetAccountAccountsr   s      r   fetch_accountszhuobijp.fetch_accounts  s4     	11&99r   c                 ~   d| j         d         i}|                     |                     ||                    }|                     |dg           }i }t	          dt          |                    D ]L}||         }|                     |d          }|                     |          }	|                     |d          }
|                     |d          }|                     |d          }|                     |dd	          }|                     |d
          }|o|
o
|o|dk    o| }|                     |d          }| 	                    | 
                    |                     |d                              }||	d|||
|d||dd|                     |d          dd|                     |d          ddd|d||	<   N|S )z
        fetches all available currencies on an exchange
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an associative dictionary of currencies
        r   r   r   r,   zdeposit-enabledzwithdraw-enabledzcountry-disabledvisibleFr   r	  zdisplay-namezwithdraw-precisioncryptoNr   zdeposit-min-amountzwithdraw-min-amount)r   depositre   )r+   coder  r,   r  r  re   r!  r   r   r   )r   publicGetSettingsCurrencysr   r   r   r   r  	safe_boolr  r   r  r   )r   r   r   r   
currenciesr   r   rZ  r+   r  depositEnabledwithdrawEnabledcountryDisabledr  r   r  r,   r   s                     r   fetch_currencieszhuobijp.fetch_currencies  s    Z0
 224;;w3O3OPPR __Xvr::
q#j//** (	 (	A!!}H622B**2..D!__X7HIIN"ooh8JKKO"ooh8JKKOnnXy%@@G$$Xw77EssOsRZIZsds`sF##Hn==D))$*>*>t?O?OPXZn?o?o*p*pqqI   )+&  )# 
  $//:NOO#   
  $//:OPP#! !  !7 F4LL: r   c                    |                      |d         dg           }d|i}t          dt          |                    D ]}||         }|                     |d          }|                     |          }d }||v r	||         }n|                                 }|d         dk    r|                     |d          |d	<   |d         d
k    r|                     |d          |d<   |||<   |                     |          S )Nr   r;  r   r   rZ  r  r   balancefreefrozenused)r   r   r   r  r  accountsafe_balance)	r   r   balancesr   r   r  
currencyIdr  r  s	            r   parse_balancezhuobijp.parse_balance  s   ??8F#3VR@@(#q#h--(( 	# 	#AqkG))':>>J**:66DGv~~ ,,,..v'))"&"2"27I"F"Fv(**"&"2"27I"F"F"F4LL  (((r   c                    |                                   |                                  | j        d         }d| j        d         d         i} t	          | |          |                     ||                    }|                     |          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>`
        r   r+   r   )r   load_accountsr   accountsr  r   r  )r   r   r  r   r   s        r   fetch_balancezhuobijp.fetch_balance/  s     	23$-"4(
 )74((Wf)E)EFF!!(+++r   c                 H   |                                   d|i}d }| |                     |          }|d         |d<   |                     | j        dd          } t	          | |          |                     ||                    }	|                     |	d         |||          S )Nstatesr+   r   r   r   r   )r   r|   r  r   r  r   parse_orders)
r   r  r   rj  r@  r   r   r|   r  r   s
             r   fetch_orders_by_stateszhuobijp.fetch_orders_by_states>  s    f
 [[((F &tGH!!$,0KMghh(74((Wf)E)EFF$   &!165%HHHr   c                     |                                   d|i}|                     |                     ||                    }|                     |d          }|                     |          S )a?  
        fetches information on an order made by the user
        :param str symbol: unified symbol of the market the order was made in
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        r+   r   )r   privateGetOrderOrdersIdr   	safe_dictparse_order)r   r+   r   r   r   r   r\  s          r   fetch_orderzhuobijp.fetch_order\  sl     	"
 //GV0L0LMMx00&&&r   c                 4    |                      d||||          S )a  
        fetches information on multiple 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>`
        zGpre-submitted,submitted,partial-filled,filled,partial-canceled,canceledr  r   r   rj  r@  r   s        r   fetch_orderszhuobijp.fetch_ordersk  s:     **+tv|  D  FK  MS  T  T  	Tr   c                 r    |                      | j        dd          } t          | |          ||||          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>`
        r   r   )r  r   r  )r   r   rj  r@  r   r  s         r   fetch_open_orderszhuobijp.fetch_open_ordersv  s?     !!$,0GI_``$wtV$$VUE6BBBr   c                 f    |t          | j        dz             |                     d||||          S )Nz/ fetchOpenOrdersV1() requires a symbol argumentz&pre-submitted,submitted,partial-filled)r   r+   r  r  s        r   r   zhuobijp.fetch_open_orders_v1  s>    >#DG._$_```**+SU[]bdikqrrrr   c                 4    |                      d||||          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>`
        z filled,partial-canceled,canceledr  r  s        r   fetch_closed_orderszhuobijp.fetch_closed_orders  s$     **+MvW\^ceklllr   c                 r   |                                   i }d }| |                     |          }|d         |d<   |                     |d          }|l|                                  t	          dt          | j                            D ]5}| j        |         }	|	d         dk    r|                     |	d          }| n6||d<   |||d<   |                     |d          }
|                     | 	                    ||
                    }| 
                    |dg           }|                     ||||          S )	Nr+   r   
account-idr   r  r:   rp  r   )r   r|   r  r  r   r   r  omitprivateGetOrderOpenOrdersr   r  r  )r   r   rj  r@  r   r   r|   	accountIdr   r  omittedr   r   s                r   fetch_open_orders_v2zhuobijp.fetch_open_orders_v2  sM   [[((F &tGH$$V\::	   1c$-0011  -*6?f,, $ 0 0$ ? ?I , )#GFO))FL1111$++gw2O2OPP, ~~h33  vue<<<r   c                 @    dddddd}|                      |||          S )Nr)  canceledclosed)zpartial-filledzpartial-canceledfilledr  	submittedr  r   statusstatusess      r   parse_order_statuszhuobijp.parse_order_status  s7    $ *"
 
 &&999r   c           	         |                      |d          }d }d }d }d|v rT|d                             d          }|d         }|d         }|                     |                      |d                    }|                      |d          }|                     ||          }|                     |d          }	|                      |d	          }
|                      |d
          }|                     |dd          }|                      |d          }|                     |dd          }|                     |dd          }d }||dk    r|d         n|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"|          S )#Nr+   r  rU  r   r   r   r   rS  client-order-idr   rW  zfield-amountr  zfilled-cash-amountzfield-cash-amountrX  z
field-feessellr  r  rY  r   clientOrderIdr,  r-  lastTradeTimestamptimeInForcepostOnlyr]  	stopPricetriggerPricer6  r   )r  	remainingr  r!  rx  )r  r`  r  rN  r   ra  
safe_orderr=  )r   r\  r|   r+   r]  r  r  	orderTyperP  r,  r  r   r  r  r   rf  r!  rg  s                     r   r  zhuobijp.parse_order  s   @ eT**U??f++C00IQ<DQ<D,,T-=-=eW-M-MNNF##E844!!(F33%%e\::	((0ABB!!%22##E?NKK  00!!%)=?RSS$$UM<HH.2fnn&//6&>K' C   
E 
" 
 ] 
 	 

 Y// 
 !$ 
 fX& 
 D 
 4 
  
 D 
 U 
  
 D 
 t 
  D! 
" f# 
$ - 
  
  
. /  	r   r   c                     |                                   |                     |          }|d         st          | j        dz             d|d<   |                     |dd|d|          S )a  
        create a market buy order by providing the symbol and cost
        :param str symbol: unified symbol of the market to create an order in
        :param float cost: how much you want to trade in units of the quote currency
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        r:   z9 createMarketBuyOrderWithCost() supports spot orders onlyFr   r|   buyN)r   r|   r    r+   create_order)r   r   r   r   r|   s        r   !create_market_buy_order_with_costz)huobijp.create_market_buy_order_with_cost  ss     	V$$f~ 	ftw)ddeee6;23  5$fMMMr   r  r]  r   r  c                    |                                   |                                  |                     |          }| j        d         d         |d         |dz   |z   d}|                     |dd          }	|	M|                     | j        di           }
|                     |
d          }||                                 z   |d<   n|	|d<   | 	                    |ddg          }|d	k    r|d
k    rd}d}| 
                    |ddd          \  }}|                     |d          }| 	                    |d          }||                     ||          }n|rm|t          | j        dz             |                     |          }|                     |          }|                     |t!          j        ||                    }n|                     ||          }||d<   n|                     ||          |d<   |dk    s|dk    s|dk    s|dk    s|dk    r|                     ||          |d<   | j        d         } t'          | |          |                     ||                    }|                     |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i|          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 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>`
        r   r+   rU  )r  r   r  r  r  Nr   r|   r  TrE   r   r   z createOrder() requires the price argument for market buy orders to calculate the total cost to spend(amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to False and pass the cost to spend in the amount argumentr   r@  ioczlimit-makerz
stop-limitzstop-limit-fokr  r   r   r   r,  r-  r  r  r   r  r]  r  r  rx  r!  r6  )r   r  r|   r  ra  r   r   r  uuidr  handle_option_and_paramsr   amount_to_precisionr   r+   number_to_stringr'   rb  price_to_precisionr  r   r  )r   r   r  r]  r   r  r   r|   r   r  r   brokerIdquoteAmountr   r   amountStringpriceStringr  r   r+   s                       r   r  zhuobijp.create_order+  s    	V$$-*40Tl3J%
 

 **6?DUVV __T\8R@@F''55H)1DIIKK)?G%&&)6G%&6O5F#GHHH45==K04-8<8U8UV\^k  nQ  SW  9X  9X5-v##FF33DYYvv..F"66vtDD2 G=&tw  2m  (m  n  n  n $(#8#8#@#@L"&"7"7">">K"&":":67CUVbdoCpCp"q"qKK"66vvFF +GH $ 8 8 H HGH7??demmt}/D/DP\H\H\`dhx`x`x#66vuEEGG12(74((Wf)E)EFFh//  
H 
" 
  
 	 

 !$ 
 d 
 f 
 D 
 D 
 U 
 f 
 d 
  
 D 
 d 
  4! 
" T# 
$ t% 
  
& '  	r   c                     |                      d|i          }|                     |                     |          |dd          S )a3  
        cancels an open order
        :param str id: order id
        :param str symbol: not used by huobijp 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  )r+   r  )$privatePostOrderOrdersIdSubmitcancelr   r  )r   r+   r   r   r   s        r   cancel_orderzhuobijp.cancel_orderz  sS     <<dBZHH {{4++H55 8
 8
   	r   c                     |                                   |                     |dd          }|                     |ddg          }i }|||d<   n||d<   |                     |                     ||                    }|S )aB  
        cancel multiple orders
        :param str[] ids: order ids
        :param str symbol: not used by huobijp 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>`
        clientOrderIdszclient-order-idsNz	order-ids)r   safe_value_2r  !privatePostOrderOrdersBatchcancelr   )r   idsr   r   r  r   r   s          r   cancel_orderszhuobijp.cancel_orders  s     	**63CEWXX6$46H#IJJ!#&GK  *8G&'99$++gv:V:VWWB r   c                     |                                   i }d}| |                     |          }|d         |d<   |                     |                     ||                    }|S )ab  
        cancel all open orders
        :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   )r   r|   +privatePostOrderOrdersBatchCancelOpenOrdersr   )r   r   r   r   r|   r   s         r   cancel_all_orderszhuobijp.cancel_all_orders  ss     	
 [[((F &tGHCCDKKPWY_D`D`aa r   c                 ^    |                      |d| j        |         d         | j                  S )Nr   r   )r   r  r   )r   r  r!  networkCodes       r   currency_to_precisionzhuobijp.currency_to_precision  s,    ((a1F{1SUYUghhhr   c                     t          |          dz
  }||         }|dk    r
|d|         }i }|                     |||          S )Nr   r   r   )r   r  )r   	networkIdlastCharacterIndexlastCharacternetworksByIds        r   safe_networkzhuobijp.safe_network  sV     ^^a/!"45C!!$6"67IiCCCr   rZ  c                    |                      |d          }|                      |d          }|                      |d          }|                     ||          }|                     ||          }|                      |d          }|                     |di           }|                     |d          }	|                     |	||          }
|                      |
d          }|                     |           |||||dS )	Naddress
addressTagrZ  chainr   r+   network)rZ  r  tagr  r   )r  safe_currencyr  r   index_bycheck_address)r   depositAddressrZ  r  r  r  r  r  r   r  networkValuer  s               r   parse_deposit_addresszhuobijp.parse_deposit_address  s    "">9==~|<<%%njAA
%%j(;;&&z8<<$$^W==	??8Z<<}}Xt44|Y	JJ""<;;7###"
 
 	
r   r  c                 0   ||dk    rd}|                                   d}||                     |          }ddd}||d         |d<   |||d<   |                     |                     ||                    }|                     |d	         |||          S )
a  
        fetch all deposits made to an account
        :param str code: unified currency code
        :param int [since]: the earliest time in ms to fetch deposits for
        :param int [limit]: the maximum number of deposits structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
        Nr0   r  r   r  fromr+   rZ  rp  r   r   rZ  privateGetQueryDepositWithdrawr   parse_transactionsr   r  rj  r@  r   rZ  r   r   s           r   fetch_depositszhuobijp.fetch_deposits  s     =ECKKE}}T**H
 
 "*4.GJ#GFO66t{{7F7S7STT&&x'75%PPPr   c                 0   ||dk    rd}|                                   d}||                     |          }ddd}||d         |d<   |||d<   |                     |                     ||                    }|                     |d	         |||          S )
a  
        fetch all withdrawals made from an account
        :param str code: unified currency code
        :param int [since]: the earliest time in ms to fetch withdrawals for
        :param int [limit]: the maximum number of withdrawals structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
        Nr0   re   r   r  r+   rZ  rp  r   r  r  s           r   fetch_withdrawalszhuobijp.fetch_withdrawals#  s     =ECKKE}}T**H
 
 "*4.GJ#GFO66t{{7F7S7STT&&x'75%PPPr   c                 F   |                      |d          }|                     |                     |d                    }|                     |d          }|dk    r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 ddS )NrS  rZ  r  re   
withdrawalr!  r   r+   r   txidztx-hashr,  r-  r  r  r  	addressToaddressFromr  zaddress-tagtagTotagFromr   r  r   updatedz
updated-at)rZ  r   rate)commentinternalr!  )r   r  r  r'   
string_absra  r=  safe_string_upperr   parse_transaction_statusr   )r   transactionrZ  r,  r  r  rf  s          r   parse_transactionzhuobijp.parse_transaction>  s4   V %%k<@@	&&t'7'7Z'P'PQQV44:D"";66(11G
K
$$$[$??
 D$$[)<<
 	

 Y//
 t--k7CC
 t''Y??
 
 4
 4##K??
 T
 t
 D
 d&&{H==
 
  d33D4D4D[RY4Z4Z[[!
" t((lCC#
$  ))'22 )
 
 
 	
r   c                 T    dddddddddddddddd}|                      |||          S )Nfailedpendingokr  )unknown
confirming	confirmedsafeorphanr  r  	reexaminerejectpasszwallet-rejectzconfirm-errorrepealedzwallet-transferzpre-transferr  r  s      r   r  z huobijp.parse_transaction_status  sW      #"""%% (%%
 
( &&999r   c                    |                      ||          \  }}|                                  |                     |           |                     |          }|||d                                         d}|||d<   |                     | j        di           }|                     |d          }	|                     ||	|	          }	|	9|	dk    r|d         |	z   |d<   n|	|d         z   |d<   | 	                    |d          }| 
                    |                     ||                    }
|                     |
|          S )	a  
        make a withdrawal
        :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
        :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
        r+   )r  r   rZ  Nzaddr-tagr   r  r   r  )handle_withdraw_tag_and_paramsr   r  rZ  lowerr   r   r  safe_string_lowerr  privatePostDwWithdrawApiCreater   r  )r   r  r   r  r  r   rZ  r   r   r  r   s              r   re   zhuobijp.withdraw  sS    99#vFFV7###==&& ,,..
 

 ?"%GJ??4<R@@((;;((7GDD'!!#+D>G#;  #*Xd^#; YYvy11F66t{{7F7S7STT %%h999r   r}   r   c                 B   d}|dk    r||z  }n(|dk    s|dk    r|| j         z  }n|dk    s|dk    r|dz  }|d|                     ||          z   z  }|                     ||                     |                    }|dk    s|dk    rC|                                  |                     |                                 d          }	d	d
| j        |	d}
|dk    r|                     |
|          }
| 	                    |
          }| 
                    |          }d                    || j        ||g          }|                     |                     |          |                     | j                  t           j        d          }|d| 
                    d|i          z   z  }|d|z   z  }|dk    r|                     |          }ddi}n"ddi}n|r|d| 
                    |          z   z  }|                     | j        d         |         d| j        i          |z   }||||dS )Nr   r|   r}   r~   r   r   v2T
HmacSHA2562)SignatureMethodSignatureVersionAccessKeyId	TimestampPOST
base64&	Signature?zContent-Typezapplication/jsonz!application/x-www-form-urlencodedr   r6   )urlr  bodyheaders)r4   implode_paramsr  extract_paramscheck_required_credentialsymdhmsmillisecondsapiKeyr   keysort	urlencodejoinr6   hmacencodesecrethashlibsha256r  r{   )r   pathr   r  r   r?  r>  r=  queryr,  r   requestSortedauthpayload	signatures                  r   signzhuobijp.sign  sj   (??3JCCXoo3)#3#34<CCZSK%7%74KCsT((v6666		&$"5"5d";";<<)sk11++---D$5$5$7$7==I#/$'#{&	 G ++gu55 LL11M>>-00D iiT BCCG		$++g"6"6DK8P8PRYR`bjkkIC$..+y)ABBBBD3:Cyy''"$6
 #$G  4sT^^F3333!!$)E"23"7:
   fdwOOOr   c
                    |d S d|v r|                      |d          }
|
dk    r|                      |d          }| j        dz   |z   }|                     | j        d         ||           |                     | j        d         ||           |                      |d          }|                     | j        d         ||           t          |          d S )Nr  errorzerr-code r   r   zerr-msg)r  r+   throw_broadly_matched_exceptionr   throw_exactly_matched_exceptionr   )r   httpCodereasonr=  r  r?  r>  r   requestHeadersrequestBodyr  r  feedbackmessages                 r   handle_errorszhuobijp.handle_errors  s    4x %%h99F  ''*==7S=4/44T_W5MtU]^^^44T_W5MtU]^^^**8Y??44T_W5MwX`aaa#H---tr   )N)F__name__
__module____qualname__r   r   r   r   strr   r   r   r   r   r
   r"  r   r?  r	   r   rG  rJ  r   rQ  r   ri  rn  rr  rz  r;  r~  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  r   r  r   r	  r  r  r  re   rT  r`  __classcell__)r   s   @r   r)   r)      s       z z z z zx	 !# 3 3 3 3 7;2  G     :< P PS P P P P. :>b 
 
3 
 
 
 
4x x x $& m m$v, m m m m^O O6 OV O O O Ob :>b ,r ,rs ,r3 ,rY ,r ,r ,r ,r\ 02 % %3 %f % % % %N 04B G GW G7 G G G G.L L L5 L L L L\ 9=4^bkm G GS G# GS GX[ G G G G" -1tRV_a I Ic I IC I I I I. 6:UW 1Y 1Y3 1Ys 1Y# 1Y\`af\g 1Y 1Y 1Y 1Yf
 
 
4 
 
 
 
, 26DW[df  H  H#  Hc  HQT  Hkoptku  H  H  H  HD %'    4=         ') ] ]Z ] ] ] ]~) ) ) ) )& $& , ,( , , , , <@daenp I IS I I[^ I I I I< 26b ' 'c '3 ' ' ' ' *.Dt\^ 	T 	T3 	Tc 	T 	Tcghmcn 	T 	T 	T 	T /3TXac 
C 
C 
C3 
Cc 
Chlmrhs 
C 
C 
C 
C 26DW[df s s3 sc sQT s s s s
 154VZce 	m 	m# 	mS 	mPS 	mjnotju 	m 	m 	m 	m 26DW[df ,= ,=3 ,=c ,=QT ,= ,= ,= ,=\: : :P P P5 P P P Pd RT N N N5 N N N N gksu M M3 Mi My MRW M`c M M M M^ 37r  s C    ( 04B 1 1 1 1 1 1f /32      @i i i iD D D
 
h 
 
 
 
8 *.Dt\^ Q Q3 Qc Q Qcghsct Q Q Q Q6 -1tRV_a Q Qc Q QC Qfjkvfw Q Q Q Q6L
 L
x L
; L
 L
 L
 L
\: : :. ?C2 &: &:S &:% &: &: &: &:P &eBSW ,P ,P ,P ,P\      r   r)   ).ccxt.base.exchanger   ccxt.abstract.huobijpr   rL  ccxt.base.typesr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   typingr   ccxt.base.errorsr   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   ccxt.base.decimal_to_precisionr%   r&   ccxt.base.preciser'   r)    r   r   <module>ro     s   ( ' ' ' ' ' - - - - - -  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q  q       * * * * * * 0 0 0 0 0 0 - - - - - - . . . . . . ' ' ' ' ' ' & & & & & & . . . . . . ) ) ) ) ) ) * * * * * * ) ) ) ) ) ) ) ) ) ) ) ) 1 1 1 1 1 1 * * * * * * + + + + + + 3 3 3 3 3 3 4 4 4 4 4 4 % % % % % %k k k k kh k k k k kr   