
    E#i                    x   S SK Jr  S SKJr  S SKrS SKrS SKJrJrJ	r	J
r
JrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJ r J!r!J"r"J#r#J$r$  S SK%J&r&  S SK'J(r(  S SK'J)r)  S SK'J*r*  S S	K'J+r+  S S
K'J,r,  S SK'J-r-  S SK'J.r.  S SK'J/r/  S SK'J0r0  S SK'J1r1  S SK'J2r2  S SK'J3r3  S SK4J5r5  S SK6J7r7   " S S\\5      r8g)    )Exchange)ImplicitAPIN)AccountAnyBalancesBorrowInterestBool
ConversionCrossBorrowRate
CurrenciesCurrencyDepositAddressFundingHistoryIntMarket
MarketTypeNumOrder	OrderBook	OrderSide	OrderTypePositionStrStringsTickerTickersFundingRateFundingRatesTradeTradingFeesTransactionTransferEntry)List)ExchangeError)AuthenticationError)PermissionDenied)ArgumentsRequired)
BadRequest)	BadSymbol)InsufficientFunds)InvalidOrder)OrderNotFound)NotSupported)DDoSProtection)ExchangeNotAvailable)	TICK_SIZE)Precisec                   H  ^  \ rS rSrS\4U 4S jjr0 4S\\   4S jjrS\	S\4S jr
0 4S\4S jjrS0 4S	\4S
 jjrS0 4S	\4S jjrSyS jr0 4S\4S jjrS0 4S\S\4S jjrS0 4S	\4S jjr0 4S\S\4S jjrSzS\	S\S\4S jjrS0 4S\S\S\4S jjrS0 4S\S\4S jjrS0 4S\S\S\4S jjr SS0 4S\S\S\S\\!   4S jjr"SSS0 4S\S\S\4S jjr#SzS\	S\S\!4S jjr$SSS0 4S\S \S\S\S\\%   4
S! jjr&SzS\S\%4S" jjr'0 4S# jr(0 4S\4S$ jjr)0 4S\S%\*S&\+4S' jjr,0 4S\S&\+S\4S( jjr-S0 4S\S)\.S%\*S*\+S+\/4
S, jjr0SS0 4S\S\S)\.S%\*S*\/S+\/4S- jjr1S0 4S\S\4S. jjr2S0 4S\4S/ jjr3SSS0 4S\S\S\S\\   4S0 jjr40 4S1\4S2 jjr5S\64S3 jr70 4S\64S4 jjr8SSS0 4S\S\S\S\\   4S5 jjr9SSS0 4S\S\S\S\\   4S6 jjr:S)\4S7 jr;SzS8\	S\S\4S9 jjr<SSS0 4S\S\S\S\4S: jjr=SSS0 4S;\S\S\S\\>   4S< jjr?SSS0 4S;\S\S\S\\>   4S= jjr@0 4S;\S\A4S> jjrB0 4S;\S\A4S? jjrCSzS@\DS\A4SA jjrE0 4S\\F   4SB jjrGS0 4SC\HS\4SD jjrI0 4S;\S*\+SE\SF\S\J4
SG jjrKSzSH\	S@\DS\J4SI jjrLS0 4S;\S*\+SJ\SK\S\>4
SL jjrMSzSM\	S@\DS\>4SN jjrNSO\4SP jrOS0 4S\S;\4SQ jjrPSSS0 4S;\S\S\S\\>   4SR jjrQSSSS0 4S;\S\S\S\S\\R   4
SS jjrSSzST\	S\S\R4SU jjrT0 4S\S\U4SV jjrVS0 4S\S\W4SW jjrXSzS\S\U4SX jjrYSSS0 4S\S\S\S\\Z   4SY jjr[SzS\4SZ jjr\S{S\S\S\\Z   4S[ jjr]SSS0 4S;\S\S\S\\>   4S\ jjr^S0 4S]\S^\S*\/S\_4S_ jjr`S0 4S\S]\S^\S*\/S\_4
S` jjraSSS0 4S;\S\S\S\\_   4Sa jjrbSySb\	Sc\DSd\DS\_4Se jjrcSS0 4S\S\S\S\\d   4Sf jjreS0 4S\S\\d   4Sg jjrf0 4S\S\d4Sh jjrgSzSi\	S\S\d4Sj jjrh0 4S;\S\i4Sk jjrjSzS@\D4Sl jjrkS@\S\l4Sm jrmSn rnSoSp0 SS4Sq jroS;\HSr\Ss\St\Su\	Sv\4Sw jrpSxrqU =rr$ )|whitebit   returnc                    > U R                  [        [        U ]  5       SSSS/SS0 SS _SS_S	S_S
S_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_0 SS_SS_SS_SS_SS_SS_SS_S S_S!S_S"S_S#S_S$S_S%S_S&S_S'S_S(S_S)S_E0 S*S_S+S_S,S_S-S_S.S_S/S0_S1S_S2S_S3S_S4S_S5S_S6S_S7S_S8S_S9S_S:S_S;S_E0 S<S_S=S_S>S_S?S_S@S_SAS_SBS_SCS_SDS_SES_SFS_SGS_SHS_SIS_SJS_SKS_SLS_ESSSSSSSSSSSSSSSM.ESNSOSPSQSRSSSTSUSVSWSXSYSZS[S\S].S^S_S`Sa.SbSc0SdSeSa.Sf.SgShSiSjSk.SlSm/0Sl/ SnQ0So/ SpQ0Sa.SbSl/ SqQ00Sl/ SrQ0So/ SsQ0Sa.St.SuSSU R	                  Sv5      U R	                  Sv5      Sw.0SxS/ SyQSzS0S{S{SS|SS}.S~S0SSS.SSSSS SSS SSSSS.SSSSSSSS.S SSS S SS.SSSSSSS.SSSSSS.SSS S SSSS.SSS S S SSSS.SS0SSS S SS.S.
SS0SS0SS0S.S S S.S.[
        [        [        [        [        [        [        [        [        [        [        [        [        [        [        S.[        [        [        [        [        [        [        S.S.S.5      $ )Nr3   WhiteBitv4EE2   TCORSspotmarginswapfutureFoptioncancelAllOrderscancelAllOrdersAftercancelOrdercancelOrderscreateConvertTradecreateDepositAddresscreateMarketBuyOrderWithCostcreateMarketOrderWithCostcreateMarketSellOrderWithCostcreateOrdercreatePostOnlyOrdercreateStopLimitOrdercreateStopMarketOrdercreateStopOrdercreateTriggerOrder	editOrderfetchAccountsfetchBalancefetchBorrowRateHistoriesfetchBorrowRateHistoryfetchClosedOrdersfetchConvertQuotefetchConvertTradefetchConvertTradeHistoryfetchCrossBorrowRatefetchCrossBorrowRatesfetchCurrenciesfetchDepositfetchDepositAddressfetchDepositAddressesfetchDepositAddressesByNetworkfetchDepositsfetchDepositsWithdrawalsfetchDepositWithdrawFeeemulatedfetchDepositWithdrawFeesfetchFundingHistoryfetchFundingLimitsfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchIndexOHLCVfetchIsolatedBorrowRatefetchIsolatedBorrowRatesfetchLedgerfetchMarginModefetchMarketsfetchMarkOHLCVfetchMyTrades
fetchOHLCVfetchOpenInterestHistoryfetchOpenOrders
fetchOrderfetchOrderBookfetchOrdersfetchOrderTradesfetchPositionfetchPositionHistoryfetchPositionModefetchPositionsfetchPremiumIndexOHLCVfetchStatusfetchTicker)fetchTickers	fetchTimefetchTradesfetchTradingFeefetchTradingFeesfetchTradingLimitsfetchTransactionFeesfetchTransactionsfetchWithdrawalsrepayCrossMarginrepayIsolatedMarginsetLeveragetransferwithdraw1m3m5m15m30m1h2h4h6h8h12h1d3d1w1M)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   zchttps://user-images.githubusercontent.com/1294454/66732963-8eb7dd00-ee66-11e9-849b-10d9282bb9e0.jpgz"https://whitebit.com/api/v1/publiczhttps://whitebit.com/api/v1)publicprivater   z"https://whitebit.com/api/v2/publicz"https://whitebit.com/api/v4/publiczhttps://whitebit.com/api/v4)v1v2r8   zhttps://www.whitebit.comz-https://github.com/whitebit-exchange/api-docsz!https://whitebit.com/fee-schedulezBhttps://whitebit.com/referral/d9bdf40e-28f2-4b52-b2f9-cd1415d82963)logoapiwwwdocfeesreferralgetzv1/healthcheck)marketstickerstickersymbolszdepth/resulthistoryklinepost)zaccount/balance	order/neworder/cancelorderszaccount/order_historyzaccount/executed_historyzaccount/executed_history/allzaccount/order)r   r   assetsfeezdepth/{market}trades/{market})r   zcollateral/marketsr   zorderbook/depth/{market}zorderbook/{market}r   r   timepingr   futureszplatform/statuszmining-pool)Kzcollateral-account/balancez"collateral-account/balance-summaryz$collateral-account/positions/historyzcollateral-account/leveragez!collateral-account/positions/openzcollateral-account/summaryz"collateral-account/funding-historyzmain-account/addresszmain-account/balancezmain-account/create-new-addresszmain-account/codeszmain-account/codes/applyzmain-account/codes/myzmain-account/codes/historyzmain-account/fiat-deposit-urlzmain-account/historyzmain-account/withdrawzmain-account/withdraw-payzmain-account/transferzmain-account/smart/planszmain-account/smart/investmentz#main-account/smart/investment/closezmain-account/smart/investmentszmain-account/feez+main-account/smart/interest-payment-historyztrade-account/balanceztrade-account/executed-historyztrade-account/order/historyztrade-account/orderzorder/collateral/limitzorder/collateral/marketzorder/collateral/stop-limitzorder/collateral/trigger-marketzorder/collateral/bulkr   zorder/marketzorder/stock_marketzorder/stop_limitzorder/stop_marketr   zorder/cancel/allzorder/kill-switchzorder/kill-switch/statusz
order/bulkzorder/modifyzorder/conditional-cancelr   z
oco-orderszorder/collateral/ocozorder/oco-cancelzorder/oto-cancelzprofile/websocket_tokenzconvert/estimatezconvert/confirmzconvert/historyzsub-account/createzsub-account/deletezsub-account/editzsub-account/listzsub-account/transferzsub-account/blockzsub-account/unblockzsub-account/balanceszsub-account/transfer/historyzsub-account/api-key/createzsub-account/api-key/editzsub-account/api-key/deletezsub-account/api-key/listzsub-account/api-key/resetz#sub-account/api-key/ip-address/listz%sub-account/api-key/ip-address/createz%sub-account/api-key/ip-address/deletezmining/rewardsz
market/feezconditional-orders)webr   r   r8   tradingz0.001)	tierBased
percentagetakermakerr   )EURUSDRUBUAHaccountmain
collateral)fundingr   r<   r=   tradeBEP20BSCccxt)timeDifferenceadjustForTimeDifferencefiatCurrenciesrR   accountsByTypenetworksByIddefaultTypebrokerId)IOCFOKPOGTD)
marginModetriggerPricetriggerDirectiontriggerPriceTypestopLossPricetakeProfitPriceattachedStopLossTakeProfittimeInForcehedgedtrailingleveragemarketBuyByCostmarketBuyRequiresPriceselfTradePreventionicebergd   )r   limitdaysBack	untilDayssymbolRequired)checkActivecheckExecutedr   r   triggerr   )r   r   r   r   r   )r   r   r   r   r   r   r   )r   r   r   daysBackCanceledr   r   r   r   r     )
sandboxrJ   createOrdersrq   ru   rt   rw   rU   rr   r   extendsdefault)linearinverse)r   r<   r>   r?   )zUnauthorized request.zThe market format is invalid.zMarket is not availablezInvalid payload.zAmount must be greater than 0zNot enough balance.zThe order id field is required.zNot enough balancezThis action is unauthorized.z6This API Key is not authorized to perform self action.zUnexecuted order was not found.zThe selected from is invalid.503422)zThis action is unauthorizedz$Given amount is less than min amountzMin amount stepzTotal is less thanzfee must be no less thanzEnable your key in API settingsz'You don't have such amount for transfer)exactbroad)idnameversion	countries	rateLimitprohas
timeframesurlsr   r   optionsfeaturesprecisionMode
exceptions)deep_extendsuperr3   describeparse_numberr0   r%   r)   r(   r+   r*   r&   r,   r/   )self	__class__s    U/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/async_support/whitebit.pyr  whitebit.describe   s*   h > @SSS $S 	S
 %S %S "4S 'S tS S %dS 'S /S ,US 0S  t!S" &t#S$ '%S& ('S( "4)S* %d+S, T-S.  /S0 1S2 +E3S4 )%5S6 $T7S8 $T9S: $U;S< +D=S> '?S@ (ASB "4CSD ESF &tGSH (ISJ 1%KSL  MSN +DOSP *:QSR +DSST &tUSV %dWSX #DYSZ *5[S\ $T]S^ "5_S` *5aSb +EcSd ueSf "5gSh iSj !%kSl  mSn doSp +EqSr "4sSt duSv !$wSx tySz #D{S|  }S~ 'S@ $UASB !$CSD )%ESF tGSH tISJ !%!##($(&*(,%)$($)',#  eSj $ ~ #G#@
 !"F #G#@ 2F;`%, (   
  	! 4   	   $  L!N %aWM^ !&"&!..w7!..w7	 #$+0">v!  &""*## U!  &"%,  %&*(,,1,0).+06:#'#("&#(	( #($)$)+/27/4#()$, %)&+!$$(%)*/& (,)-*/&+#($)# ',!$#($)*/( ',!$$(%)#($)*/$ ',!$$(,0%)#($)*/	*  # ',!$$(%)*/)KL\ y
 "9 "9 	 ##s]| ' .A5>/8(25A+<7C*;4DN^7D5?/(" 4D<H'3*60<7G@Q#SdC
 d d	    c                    #    U R                   S   (       a  U R                  5       I Sh  vN   U R                  5       I Sh  vN nU R                  U5      $  N- N7f)z
retrieves data on all markets for whitebit

https://docs.whitebit.com/public/http-v4/#market-info

:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: an array of objects representing market data
r   N)r  load_time_differencev4PublicGetMarketsparse_markets)r	  paramsr   s      r  fetch_marketswhitebit.fetch_markets  sR      <<12++---//110 !!'**3 .1s!   (AAAAAAmarketc                    U R                  US5      nU R                  US5      nU R                  US5      nUS:X  a  SOUnU R                  U5      nU R                  U5      nU R                  US5      nU R                  US5      nU R                  US5      n	S n
S nUS	-   U-   nU	S
:H  nU=(       a    U(       + nSnU R                  U R	                  U R                  US5      5      5      nUnS nS nU(       a$  UnU R                  U5      n
US-   U
-   nSnSnSnSnOSnU R                  US5      n[
        R                  " US5      nU R                  US5      n[
        R                  " US5      n0 SU_SU_SU_SU_SU
_SU_SU_SU_SU_SU(       + _SU_SU_SS_SS_SU_S U_S!U_UU R                  U5      U R                  U5      US S S S UU R                  U R	                  U R                  US"5      5      5      S#.S S S$.U R                  US%5      S S$.S S S$.U R                  US&5      U R                  US'5      S$.S(.S US).E$ )*Nr   stockmoneyPERPUSDTtradesEnabledisCollateraltype/r   F	stockPrec:r>   Tr<   takerFee100makerFeer   symbolbasequotesettlebaseIdquoteIdsettleIdr=   r?   r@   activecontractr   	moneyPrec)amountpriceminmax	minAmountminTotalmaxTotal)r   r.  r/  cost)r   r   r   contractSizeexpiryexpiryDatetimestrike
optionType	precisionlimitscreatedinfo)safe_stringsafe_currency_code
safe_valuer  parse_precisionr1   
string_divsafe_number)r	  r  r   r(  r)  r%  r&  r+  r  typeIdr'  r*  r$  r>   r=   r,  amountPrecisionr7  r   r   r  takerFeeRater   makerFeeRater   s                            r  parse_marketwhitebit.parse_market  s-   ff-!!&'2""673$.&W&&v.''09v~>!!&&1e#"*d(++D,@,@AQAQRXZeAf,gh&H,,X6Fc\F*FDHFGD''
;""<7''
;""<72
"2
f2
 D2
 U	2

 f2
 f2
 w2
 2
 D2
 H2
 f2
 D2
 e2
 e2
 f2
  !2
" f#2
$ &&u-&&u-(")**4+?+?@P@PQWYd@e+fg  
  ++FK@
  
  ++FJ?++FJ?$ c2
 2	
r  c                   #    U R                  U5      I Sh  vN n[        UR                  5       5      n0 n[        S[	        U5      5       GH  nX5   nX&   nU R                  U5      nSU;   n	0 n
U R                  US0 5      nU R                  US/ 5      nU R                  US/ 5      nU R                  US0 5      nU R                  US0 5      nU R                  US	0 5      nU R                  X5      n[        S[	        U5      5       H  nUU   nU R                  U5      nUUSU R                  UU5      U R                  UU5      SSU R                  US
S5      U R                  USS5      S.U R                  US
S5      U R                  USS5      S.S.S.U
U'   M     U R                  UUUSSU R                  US5      U R                  US5      SSU	(       a  SOSU R                  U R                  U R!                  US5      5      5      SSS.U R                  US5      U R                  US5      S.U R                  US5      U R                  US5      S.S.S.5      XH'   GM     U$  GNT7f)z
fetches all available currencies on an exchange

https://docs.whitebit.com/public/http-v4/#asset-status-list

:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: an associative dictionary of currencies
Nr   	providersnetworksdeposits	withdrawsr=  depositr   r1  r2  r0  rQ  r   )r   networkr+  rQ  r   r   r<  r=  can_depositcan_withdrawfiatcryptocurrency_precisionmin_withdrawmax_withdrawmin_depositmax_deposit)r.  r   rQ  )r   coder?  r   r+  rQ  r   r   rN  r  r<  r=  )v4PublicGetAssetslistkeysrangelenrA  	safe_dict	safe_listarray_concatnetwork_id_to_codein_arrayrE  safe_currency_structure	safe_boolr  rC  r@  )r	  r  responseidsresultir   currencyr]  hasProviderrN  rawNetworksdepositsNetworkswithdrawsNetworksnetworkLimitsdepositLimitswithdrawLimitsallNetworksj	networkIdnetworkCodes                        r  fetch_currencieswhitebit.fetch_currenciesA  s     //77D 8==?#q#c(#AB|H**2.D&(2KH..:rBK#~~k:rJ ${K L NN8XrBM NN=)RHM!^^M:rJN++,<PK1c+./'N	"55i@#*"#}}Y8HI $i9J K!% $(#3#3M5$#O#'#3#3M5$#O$
 $(#3#3NE4#P#'#3#3NE4#P%	)% 0,  77 >>(MB NN8^D "-8!..t/C/CDDTDTU]_sDt/uv  $#
  $//.I#//.I!
  $//-H#//-H 9 FLI $~ G 8s   I.I+II.Ncodesc                   #    U R                  5       I Sh  vN   U R                  U5      I Sh  vN n[        UR                  5       5      n0 n0 n[	        S[        U5      5       Hj  nXG   nX8   n	U R                  U5      n
U R                  U	S0 5      nU R                  US5      XZ'   U R                  U	S0 5      nU R                  US5      Xj'   Ml     UUUS.$  N N7f)ar  
@deprecated
       please use fetchDepositWithdrawFees instead

       https://docs.whitebit.com/public/http-v4/#fee

       :param str[]|None codes: not used by fetchTransactionFees()
       :param dict [params]: extra parameters specific to the exchange API endpoint
       :returns dict: a list of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>`
       Nr   r   fixedrQ  )r   rQ  r?  )	load_marketsv4PublicGetFeer_  r`  ra  rb  rA  rB  r@  )r	  r|  r  rj  currenciesIdswithdrawFeesdepositFeesrm  rn  datar]  r   rQ  s                r  fetch_transaction_feeswhitebit.fetch_transaction_fees  s      !!!,,V444 X]]_-q#m,-A$'H%D**84DtZ<H!%!1!1(G!DLoodIr:G $ 0 0' BK . %"
 	
M 	"4s    CCCCB+CCc                    #    U R                  5       I Sh  vN   U R                  U5      I Sh  vN nU R                  X15      $  N. N7f)a4  
fetch deposit and withdraw fees

https://docs.whitebit.com/public/http-v4/#fee

:param str[]|None codes: not used by fetchDepositWithdrawFees()
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a list of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>`
N)r  r  parse_deposit_withdraw_fees)r	  r|  r  rj  s       r  fetch_deposit_withdraw_fees$whitebit.fetch_deposit_withdraw_fees  sI      !!!,,V44V //@@Y 	"4s   A	AA	AA	A	c                    0 nU R                  U5      n[        UR                  5       5      n[        S[	        U5      5       GH2  nXV   nUR                  S5      nUS   n	X   n
U R                  U	5      nUb  U R                  X5      (       d  MN  U R                  XK5      nUc  U R                  0 5      XK'   XU   S   U'   U R                  US5      nU R                  U
S5      nU R                  U
S5      nU R                  US5      nU R                  US5      nUUb  SOS S	.nUUb  SOS S	.nUb4  [	        U5      nUSUS-
   nU R                  U5      nUUS
.XK   S   U'   GM$  UXK   S'   UXK   S'   GM5     [        UR                  5       5      n[        S[	        U5      5       H/  nUU   nU R                  U5      nU R                  XK   U5      XK'   M1     U$ )Nr    r?     r   rQ  r~  F)r   r   )r   rQ  rN  )market_codesr_  r`  ra  rb  splitrA  rg  rB  deposit_withdraw_feer@  rE  rf  rn  $assign_default_deposit_withdraw_fees)r	  rj  r|  currencyIdKeydepositWithdrawFeescurrencyIdsrm  entry
splitEntry
currencyIdfeeInfor]  depositWithdrawFeerx  r   rQ  withdrawFee
depositFeewithdrawResultdepositResultnetworkLengthry  depositWithdrawCodesrn  s                           r  r  $whitebit.parse_deposit_withdraw_fees>  s   V %'!!%(8==?+q#k*+ANES)J#AJoG**:6D4==#=#=%)__5H%O"%-040I0I"0M'-;BD)&1%8 ,,Z;	??7J?//'9="..xA!--gw?
&,7,C%$(
 &,6,B%' ($'	NM )!MA,= >I"&"9"9)"DK$2#0J'-j9+F
 =K'-j9;H'-i8E ,F  $$7$<$<$>?q#234A'*D}}T*H(,(Q(QReRkmu(v% 5 #"r  c           	      .  #    U R                  5       I Sh  vN   U R                  U5      I Sh  vN n0 n[        S[        U R                  5      5       H  nU R                  U   nU R                  U5      nU R                  X&S   0 5      nU R                  US5      nU R                  US5      n	[        R                  " US5      n[        R                  " U	S5      n	UUS   SS	U R                  U5      U R                  U	5      S
.X5'   M     U$  N N7f)a.  
fetch the trading fees for multiple markets

https://docs.whitebit.com/public/http-v4/#asset-status-list

: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(  	maker_fee	taker_feer"  r$  TF)r?  r$  r   r   r   r   )r  r^  ra  rb  r   r  rB  r@  r1   rD  r  )
r	  r  rj  rl  rm  r$  r  r   r#  r!  s
             r  fetch_trading_feeswhitebit.fetch_trading_fees  s     !!!//77$ q#dll+,A\\!_F[[(F//(8,<bAC''[9H''[9H))(E:H))(E:H *""**84**84FN -  I 	"7s    DDDDC"DDr   c           	        #    U R                  5       I Sh  vN   0 n[        U R                  R                  5       5      n[	        S[        U5      5       GH  nXE   nU R                  U   nU(       a
  US   (       d  M*  US   nU(       a3  Sn	[	        S[        U5      5       H  n
X   U:X  d  M  Sn	  O   U	(       d  Mi  U R                  US5      nU R                  US5      nU R                  US5      nU R                  US	5      nU=(       a/    U R                  US
5      SL=(       a    U R                  US5      SLnU=(       a/    U R                  US
5      SL=(       a    U R                  US5      SLnU=(       a/    U R                  US
5      SL=(       a    U R                  US5      SLnU(       d  GMc  U(       d  GMm  U(       d  GMw  UU R                  US
5      U R                  US5      S.U R                  US
5      U R                  US5      S.U R                  US
5      U R                  US5      S.S.S.X8'   GM     U$  GN17f)a@  
fetch the trading limits for a market

https://docs.whitebit.com/public/http-v4/#market-info

:param str[]|None symbols: unified market symbol
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `trading limits structure <https://docs.ccxt.com/#/?id=trading-limits-structure>`
Nr   r$  FTr=  r.  r/  r6  r1  r2  r0  )r.  r/  r6  r?  r=  )r  r_  r   r`  ra  rb  rc  rE  )r	  r   r  rl  	marketIdsrm  marketIdr  r$  symbolFoundrw  r=  amountLimitspriceLimits
costLimitshasAmountLimitshasPriceLimitshasCostLimitss                     r  fetch_trading_limitswhitebit.fetch_trading_limits  s     !!!Z **,-	q#i.)A |H\\(+F!1H%F#q#g,/AzV+&* 0 #^^FH5F>>&(;L..9K7J*  Wt/?/?e/T\`/`  Weieueu  wC  EJ  fK  SW  fWO(  ST-=-=k5-QY]-]  Sbfbrbrs~  AF  cG  OS  cSN&  O4+;+;J+NVZ+Z  O_c_o_opz  }B  `C  KO  `OM>>mm" $(#3#3L%#H#'#3#3L%#H#
 $(#3#3K#G#'#3#3K#G"
 $(#3#3J#F#'#3#3J#F!"3 *T u 	"s*   I
IBI
/DI
8I
I
A<I
c                   #    U R                  5       I Sh  vN   [        R                  " U R                  5       U R	                  U5      /6 I Sh  vN u  p40 n[        UR                  5       5      n[        S[        U5      5       GH  nXg   nX8   n	U	(       d  M  Ub  U R                  X5      (       d  M0  Sn
[        UR                  5       5      n[        S[        U5      5       H!  nX   nXM   nU(       d  M  US   U:X  d  M  Un
  O   U	S   S   S   U	S   S   S   S.U	S   S	   S   U	S   S	   S   S.S
.nU
(       a  U
S   nU
S	   nU(       ah  SU R                  US5      0nUS   (       aB  U R                  US   S5      U R                  US   S5      U R                  US   S5      S.US'   UUS   S'   U(       ah  SU R                  US5      0nUS   (       aB  U R                  US   S5      U R                  US   S5      U R                  US   S5      S.US'   UUS	   S'   U	S   (       a  U	S   US'   U	US.XX'   GM     U$  GN4 GN7f)a  
fetch the deposit and withdrawal limits for a currency

https://docs.whitebit.com/public/http-v4/#asset-status-list
https://docs.whitebit.com/public/http-v4/#fee

:param str[]|None codes: unified currency codes
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `funding limits structure <https://docs.ccxt.com/#/?id=funding-limits-structure>`
Nr   r   r=  rQ  r1  r2  r0  r   rR  r~  flexmin_feemax_feepercent)r1  r2  r  r   rN  r  )r  asynciogatherrz  r  r_  r`  ra  rb  rg  rE  )r	  r|  r  currenciesDatafeesDatarl  currencyKeysrm  r]  rn  feeDatafeeKeysrw  feeKeyr   r=  r  r  depositFeeDatawithdrawFeeDatas                       r  fetch_funding_limitswhitebit.fetch_funding_limits+  s     !!!)0!!#':
 * $ x N//12q#l+,A?D%+H t)C)CG8==?+G1c'l+ &33x=D0!G , $H-i8?#H-i8?
 $H-j9%@#H-j9%@	F $Y/
%j1!1!1*g!F&N "&)#'#3#3Jv4F	#R#'#3#3Jv4F	#R'+'7'7
68JI'V2v.
 0>F9%e,!1!1+w!G'O #6*#'#3#3K4G#S#'#3#3K4G#S'+'7'7F8KY'W3/
 1@F:&u-
#%-j%9z"  FLu -| } 	"$s/   II
9IIB&I;IEIIr$  c                 
  #    U R                  5       I Sh  vN   U R                  U5      nSUS   0nU R                  U R                  XB5      5      I Sh  vN nU R	                  US0 5      nU R                  Xc5      $  Nh N*7f)a  
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market

https://docs.whitebit.com/public/http-v4/#market-activity

:param str symbol: unified symbol of the market to fetch the ticker for
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
Nr  r   rl  )r  r  v1PublicGetTickerextendrc  parse_ticker)r	  r$  r  r  requestrj  r   s          r  fetch_tickerwhitebit.fetch_ticker  s      !!!V$fTl
 //G0LMM$ (B7  001 	"
 N!   BA??BB)BBr   c           	      >   U R                  US5      nU R                  X25      nU R                  U/ SQ5      nU R                  USU5      nU R                  0 SUS   _SS _SS _SU R                  US5      _SU R                  US5      _S	U R	                  US	S
5      _SS _SU R	                  USS5      _SS _SS _SU R                  US5      _SU_SU_SS _SS _SU R                  US5      _SS _U R                  U/ SQ5      U R                  U/ SQ5      US.EU5      $ )NtradingPairs)last
last_price	lastPricecloser$  	timestampdatetimehighlowbid
highestBid	bidVolumeask	lowestAsk	askVolumevwapopenr  previousClosechanger   average)base_volumevolumebaseVolume24h)quote_volumedealquoteVolume24h)
baseVolumequoteVolumer?  )r@  safe_marketsafe_string_nsafe_tickersafe_string_2)r	  r   r  r  r  r  s         r  r  whitebit.parse_ticker  s   h ##FN;!!(3!!&*MN  $7 !
fX&!
!
 !
 D$$VV4	!

 4##FE2!
 4%%fe\B!
 !
 4%%fe[A!
 !
 D!
 D$$VV4!
 U!
 D!
 T!
 d!
  $**68<!!
" t#!
$ ,,V5_`--f6`a)!
* + 	r  r   c                   #    U R                  5       I Sh  vN   U R                  USS5      nU R                  USS5      nSU0nSnUb  U R                  U5      nUS   US'   U(       a   U R                  U R	                  Xc5      5      I Sh  vN n[        S[        U5      5       HV  n	X   n
U R                  U
S5      nX:X  d  M   U R                  U
S5      nU R                  USS	5      nU R                  X5      s  $    U(       a   U R                  U R	                  Xc5      5      I Sh  vN n[        UR                  5       5      n[        S[        U5      5       Hk  n	X   nU R                  USS	5      nX   n[        S[        U5      5       H4  nUU   n
U R                  U
S5      nX:X  d  M!  U R                  X5      s  s  $    Mm     [        U R                   S
-   U-   5      e GN GN_! [         a"  n[        U[        5      (       d  Ue SnAGNSnAff = f N! [         a!  n[        U[        5      (       d  Ue SnANxSnAff = f7f)aj  
fetches information on an order by the id

https://docs.whitebit.com/private/http-trade-v4/#query-unexecutedactive-orders
https://docs.whitebit.com/private/http-trade-v4/#query-executed-orders

:param str id: order id
:param str symbol: unified symbol of the market the order was made in
:param dict [params]: extra parameters specific to the exchange API endpoint
:param boolean [params.checkActive]: whether to check active orders(default: True)
:param boolean [params.checkExecuted]: whether to check executed orders(default: True)
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
Nr   Tr   orderIdr   r  r   _z fetchOrder() order not found: )r  ri  r  v4PrivatePostOrdersr  ra  rb  r@  r  parse_order	Exception
isinstancer,   %v4PrivatePostTradeAccountOrderHistoryr_  r`  r   )r	  r   r$  r  r   r   r  r  rj  rm  orderr  r  	marketNewerrorr  r   rw  s                     r  fetch_orderwhitebit.fetch_order+  s4     !!!nnV]DAvEr
 [[(F &tGH !%!9!9$++g:V!WWq#h-0A$KE"..ui@G}#'#3#3E8#D$($4$4XtS$I	#//AA 1  !%!K!KDKKX_Lh!ii 1	q#i.1A(|H $ 0 04 EI%/F"1c&k2 &q	"&"2"25$"?"=#'#3#3E#EE	 3	 2 DGG&GG"LMM[ 	" X   "5-88K 9  j   "5-88K 9 s   IG*AI+#G0 G-5G0 7G0 ?I G0 I
#H! -H.BH! 4H! I	H! I-G0 0
H:HIHIH! !
I+IIIIc                 T  #    U R                  5       I Sh  vN   U R                  U5      nSnU R                  USSU5      u  p2SnUS:X  a  U R                  U5      I Sh  vN nOU R	                  U5      I Sh  vN nU R                  US5      nUb  U R                  XQ5      $ [        UR                  5       5      n0 n[        S[        U5      5       H5  nXh   n	U R                  U	5      n
U R                  XI   U
5      nUS   nXU'   M7     U R                  USU5      $  GN N N7f)aI  
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market

https://docs.whitebit.com/public/http-v4/#market-activity

:param str[] [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
:param str [params.method]: either v2PublicGetTicker or v4PublicGetTicker default is v4PublicGetTicker
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
Nv4PublicGetTickerr   methodrl  r   r$  )r  market_symbolshandle_option_and_paramsr  v2PublicGetTickerrd  parse_tickersr_  r`  ra  rb  r  r  filter_by_array_tickers)r	  r   r  r  rj  
resultListr  rl  rm  r  r  r   r$  s                r  fetch_tickerswhitebit.fetch_tickersh  s/     !!!%%g.$66v~xY_`((!33F;;H!33F;;H ^^Hh7
!%%j::)	q#i.)A |H%%h/F&&x'96BFH%F#6N * ++FHgFF? 	" <;s5   D(D!A	D( D$!D(:D&;B'D($D(&D(r   c                   #    U R                  5       I Sh  vN   U R                  U5      nSUS   0nUb  X%S'   U R                  U R                  XS5      5      I Sh  vN nU R	                  US5      nU R                  XaU5      $  No N*7f)a  
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data

https://docs.whitebit.com/public/http-v4/#orderbook

: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  )r  r  v4PublicGetOrderbookMarketr  safe_timestampparse_order_book)r	  r$  r   r  r  r  rj  r  s           r  fetch_order_bookwhitebit.fetch_order_book  s      !!!V$fTl
 $G88W9UVV( ''+>	$$XyAA9 	" Ws"   B
BAB
B)B
B
sincec                    #    U R                  5       I Sh  vN   U R                  U5      nSUS   0nU R                  U R                  Xd5      5      I Sh  vN nU R	                  XuX#5      $  NV N7f)a  
get the list of most recent trades for a particular symbol

https://docs.whitebit.com/public/http-v4/#recent-trades

:param str symbol: unified symbol of the market to fetch trades for
:param int [since]: timestamp in ms of the earliest trade to fetch
:param int [limit]: the maximum amount of trades to fetch
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
Nr  r   )r  r  v4PublicGetTradesMarketr  parse_tradesr	  r$  r  r   r  r  r  rj  s           r  fetch_tradeswhitebit.fetch_trades  su      !!!V$fTl
 55dkk'6RSS   5@@% 	"
 Ts!   A1A-?A1A/A1/A1c                 t  #    U R                  5       I Sh  vN   Sn0 nUb  U R                  U5      nUS   US'   U R                  U R                  Xd5      5      I Sh  vN n[	        U[
        5      (       a  U R                  XuX#5      $ / n[        UR                  5       5      n	[        S[        U	5      5       HO  n
X   nU R                  USS5      nU R                  X{/ 5      nU R                  XX#5      nU R                  X5      nMQ     U R                  USS5      nU R                  XUS5      $  GN N7f)a  
fetch all trades made by the user

https://docs.whitebit.com/private/http-trade-v4/#query-executed-order-history

:param str symbol: unified symbol of the market to fetch trades for
:param int [since]: timestamp in ms of the earliest trade to fetch
:param int [limit]: the maximum amount of trades to fetch
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
Nr   r  r   r  r  )r  r  (v4PrivatePostTradeAccountExecutedHistoryr  r  r_  r  r`  ra  rb  r  rB  re  	sort_by_2filter_by_since_limit)r	  r$  r  r   r  r  r  rj  resultsr`  rm  r  r  	rawTradesparseds                  r  fetch_my_tradeswhitebit.fetch_my_trades  s1     !!![[(F &tGHFFt{{SZGcddL h%%$$XuDDG(D1c$i(7 ,,XtSA	 OOHC	**9N++G< ) nnWk4@G--ge[QQq 	" es#   D8D3AD8D6CD86D8r   c                 L   U R                  S U5      nU R                  USS5      nU R                  USS5      nU R                  US5      nU R                  US5      nU R                  USS5      nU R                  US	S
5      nU R                  USS5      n	US   n
U R	                  US5      nS nUb
  US:X  a  SOSnS nU R                  US5      nUb$  UU R                  U R                  US5      5      S.nU R                  UUU R                  U5      U
UUS UU	UUUUS.U5      $ )Nr   trade_timestampdealOrderIdr  r  r/  r.  r  r   tradeIDr  sider$  roler  r   r   r   feeAssetr6  rn  )r?  r  r  r$  r   r  r  takerOrMakerr   r/  r.  r6  r   )r  safe_timestamp_2r  r@  safe_integerrA  
safe_tradeiso8601)r	  r   r  r  r  r6  r/  r.  r   r   r$  r!  r$  r   feeCosts                  r  parse_tradewhitebit.parse_trade#  sc   X !!$/))%9JK	$$UM9Ev.  0##E8^DtY7!!%8!  / '+qy7wL""5%0 33D4D4DUJ4WXC "Y/( 
  	r  r   	timeframec                   #    U R                  5       I Sh  vN   U R                  U5      nUS   U R                  U R                  X"5      S.nUb*  SnUc  Un[	        XH5      nU R                  US-  5      n	XS'   Ub  [	        US5      US'   U R                  U R                  Xu5      5      I Sh  vN n
U R                  U
S/ 5      nU R                  XX#U5      $  N N,7f)	aC  
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market

https://docs.whitebit.com/public/http-v1/#kline

: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  intervalr     startr   rl  )
r  r  r@  r   r1  parse_to_intv1PublicGetKliner  rd  parse_ohlcvs)r	  r$  r,  r  r   r  r  r  maxLimitr0  rj  rl  s               r  fetch_ohlcvwhitebit.fetch_ohlcvs  s      !!!V$Tl(()O
 H} (E%%edl3E$G"5$/GG..t{{7/KLL (B7  5II9 	" Ms"   CCBC0C1+CCc           	          U R                  US5      U R                  US5      U R                  US5      U R                  US5      U R                  US5      U R                  US5      /$ )Nr   r              )r  rE  )r	  ohlcvr  s      r  parse_ohlcvwhitebit.parse_ohlcv  sn     q)UA&UA&UA&UA&UA&
 	
r  c                    #    U R                  U5      I Sh  vN nU R                  US5      nUS:X  a  SOUSSSUS.$  N&7f)a)  
the latest known information on the availability of the exchange API

https://docs.whitebit.com/public/http-v4/#server-status

:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `status structure <https://docs.ccxt.com/#/?id=exchange-status-structure>`
Nr   pongok)statusupdatedetaurlr?  )v4PublicGetPingr@  )r	  r  rj  rB  s       r  fetch_statuswhitebit.fetch_status  sU      --f55 !!(A.%/df
 	
 6s   A >'A c                 d   #    U R                  U5      I Sh  vN nU R                  US5      $  N7f)a*  
fetches the current integer timestamp in milliseconds from the exchange server

https://docs.whitebit.com/public/http-v4/#server-time

:param dict [params]: extra parameters specific to the exchange API endpoint
:returns int: the current integer timestamp in milliseconds from the exchange server
Nr   )v4PublicGetTimer&  )r	  r  rj  s      r  
fetch_timewhitebit.fetch_time  s4      --f55   622 6s   0.0r   r6  c                 p   #    SU0nU R                  USUSSU R                  XT5      5      I Sh  vN $  N7f)a  
create a market order by providing the symbol, side and cost
:param str symbol: unified symbol of the market to create an order in
:param str side: 'buy' or 'sell'
: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>`
r6  r  r   N)create_orderr  )r	  r$  r   r6  r  reqs         r  create_market_order_with_cost&whitebit.create_market_order_with_cost  s@      D
 &&vxq$TWH`aaaas   -646c                 D   #    U R                  USX#5      I Sh  vN $  N7f)an  
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>`
buyN)rP  )r	  r$  r6  r  s       r  !create_market_buy_order_with_cost*whitebit.create_market_buy_order_with_cost  s"      77tTTTTs     r  r.  r/  c                   #    U R                  5       I Sh  vN   U R                  U5      nUS   US.nSn	U R                  US5      u  pU	b9  US:w  d  US:w  a  [        U R                  S-   5      eU R                  X5      US'   OU R                  X5      US'   U R                  US	S
5      n
U
c5  U R                  U R                  S5      nUb  XR                  5       -   US
'   OXS
'   U R                  US
/5      nU R                  US5      nUS:H  nUS:H  nU R                  U/ SQ5      nUSLnU R                  USU5      nU R                  SU5      u  nnU(       a  SUS'   Ub  US:w  a  [        U R                  S-   5      eU R                  U/ SQ5      nUSL=(       d    US:H  nSnU(       a  U R!                  X5      US'   U(       a>  U R!                  X5      US'   U R#                  U R%                  X5      5      I Sh  vN nGORU(       a*  U R'                  U R%                  X5      5      I Sh  vN nGO!U R)                  U R%                  X5      5      I Sh  vN nOU(       am  U R!                  X5      US'   U(       a)  U R+                  U R%                  X5      5      I Sh  vN nOU R-                  U R%                  X5      5      I Sh  vN nOU(       a)  U R/                  U R%                  X5      5      I Sh  vN nOTU	b)  U R1                  U R%                  X5      5      I Sh  vN nO(U R3                  U R%                  X5      5      I Sh  vN nU R5                  U5      $  GNX GNm GN? GN N N Nz NP N)7f)a  
create a trade order

https://docs.whitebit.com/private/http-trade-v4/#create-limit-order
https://docs.whitebit.com/private/http-trade-v4/#create-market-order
https://docs.whitebit.com/private/http-trade-v4/#create-buy-stock-market-order
https://docs.whitebit.com/private/http-trade-v4/#create-stop-limit-order
https://docs.whitebit.com/private/http-trade-v4/#create-stop-market-order

:param str symbol: unified symbol of the market to create an order in
:param str type: 'market' or 'limit'
:param str side: 'buy' or 'sell'
:param float amount: how much of currency you want to trade in units of base currency
:param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
:param dict [params]: extra parameters specific to the exchange API endpoint
:param float [params.cost]: *market orders only* the cost of the order in units of the base currency
:param float [params.triggerPrice]: The price at which a trigger order is triggered at
:param bool [params.postOnly]: If True, the order will only be posted to the order book and not executed immediately
:param str [params.clientOrderId]: a unique id for the order
:param str [params.marginMode]: 'cross' or 'isolated', for margin trading, uses self.options.defaultMarginMode if not passed, defaults to None/None/None
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
Nr   )r  r   r6  rS  r  z; createOrder() cost is only supported for market buy ordersr.  clOrdIdclientOrderIdr   r  r   )r   	stopPriceactivation_priceFrJ   TpostOnlycrossz1 createOrder() is only available for cross margin)r[  r   rY  r>   rZ  r/  )r  r  handle_param_stringr+   r   cost_to_precisionamount_to_precisionr  r@  r  uuid16omitsafe_number_nis_post_onlyhandle_margin_mode_and_paramsr-   price_to_precisionv4PrivatePostOrderStopLimitr  )v4PrivatePostOrderCollateralTriggerMarketv4PrivatePostOrderStopMarket!v4PrivatePostOrderCollateralLimitv4PrivatePostOrderNew"v4PrivatePostOrderCollateralMarketv4PrivatePostOrderMarketv4PrivatePostOrderStockMarketr  )r	  r$  r  r   r.  r/  r  r  r  r6  rX  r   
marketTypeisLimitOrderisMarketOrderr   isStopOrderr[  r   queryuseCollateralEndpointrj  s                         r  rN  whitebit.create_order  sV    . !!!V$Tl
 //?48#3"477-j#jkk $ 6 6v DGH $ 8 8 HGH**69oN ''jAH#+3kkm+C('4O$YYv'89F%%ff5
w())&2cd#4/$$]E6B >>}fU
E"&GJ!jG&;tww)\\]]5"KL *$ 6 N*:N*.*A*A&*WG&'#'#:#:6#I !%!A!A$++gB^!__ )%)%S%STXT_T_`gTp%qqH%)%F%Ft{{SZGc%ddH#'#:#:6#I (%)%K%KDKKX_Lh%iiH%)%?%?G@\%]]H )%)%L%LT[[Y`Mi%jjH')-)F)Ft{{SZGc)d#d)-)K)KDKKX_Lh)i#i))C 	"R `  rd  j]  k $e#is   NM.G-NM10N5M46)NM7 A
N*M:+(NM</NM>+N/N 0(NNN1N4N7N:N<N>N NNc                 l  #    U R                  5       I Sh  vN   U R                  U5      nSUS   0n	U R                  US5      n
U
b  XS'   OXS'   U R                  U/ SQ5      nUSLnU(       a  U R	                  X+5      U	S'   US:H  nU R                  US	5      nUb  U R                  X.5      U	S	'   OTUbQ  U(       a  U R                  X%5      U	S
'   O5US:X  a  US:X  a  U R                  X%5      U	S	'   OU R                  X%5      U	S
'   Ub  U R	                  X&5      U	S'   USL=(       d    USL=(       d    USL=(       d    USLnU(       d  [        U R                  S-   5      eU R                  U/ SQ5      nU R                  U R                  X5      5      I Sh  vN nU R                  U5      $  GN N7f)ar  
edit a trade order

https://docs.whitebit.com/private/http-trade-v4/#modify-order

:param str id: cancel order id
:param str symbol: unified symbol of the market to create an order in
:param str type: 'market' or 'limit'
:param str side: 'buy' or 'sell'
:param float amount: how much of currency you want to trade in units of base currency
:param float price: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
Nr  r   rX  r  )r   rY  activationPricerZ  r   totalr.  rS  r/  zZ editOrder() requires at least one of: amount, price, activationPrice, or total parameters)rX  r   rY  rv  rw  )r  r  r@  rb  re  rE  r_  r'   r   ra  v4PrivatePostOrderModifyr  r  )r	  r   r$  r  r   r.  r/  r  r  r  rX  r   rq  ro  rw  hasModifiableParamrj  s                    r  
edit_orderwhitebit.edit_orderO  s     !!!V$fTl
 ((A$'4O$!#I))&2bc#4/*.*A*A&*WG&'w  1#77FGG$($<$<V$L!!dem#'#;#;F#K  %)$<$<V$L!#66vEGG$D0}e46G}\aeMe}kpx|k|!#DGG  /K  %K  L  L6#mn66t{{77STT))Q 	"N Us"   F4F/FF4F2F42F4c                 .  #    Uc  [        U R                  S-   5      eU R                  5       I Sh  vN   U R                  U5      nUS   [	        U5      S.nU R                  U R                  XS5      5      I Sh  vN nU R                  U5      $  N_ N7f)aT  
cancels an open order

https://docs.whitebit.com/private/http-trade-v4/#cancel-order

:param str id: order id
:param str symbol: unified symbol of the market the order was made in
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
Nz) cancelOrder() requires a symbol argumentr   )r  r  )r'   r   r  r  intv4PrivatePostOrderCancelr  r  )r	  r   r$  r  r  r  rj  s          r  cancel_orderwhitebit.cancel_order  s      >#DGG.Y$YZZ!!!V$Tl2w
 66t{{77STT( ))5 	" Us"   /BBA	B;B<BBc                 *  #    U R                  5       I Sh  vN   Sn0 nUb  U R                  U5      nUS   US'   SnU R                  SX25      u  pR/ nUS:X  aC  SnU R                  USSS5      u  prU(       a  UR	                  S5        OHUR	                  S5        O6US	:X  a  UR	                  S
5        O[        U R                  S-   U-   S-   5      eXdS'   U R                  U R                  XB5      5      I Sh  vN nU R                  X5      $  N N7f)a  
cancel all open orders

https://docs.whitebit.com/private/http-trade-v4/#cancel-all-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
:param str [params.type]: market type, ['swap', 'spot']
:param boolean [params.isMargin]: cancel all margin orders
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
Nr   r  rA   r<   isMarginFr=   r>   r   z$ cancelAllOrders() does not support z typer  )
r  r  handle_market_type_and_paramsr  appendr-   r   v4PrivatePostOrderCancelAllr  parse_orders)	r	  r$  r  r  r  r  requestTyper  rj  s	            r  cancel_all_orderswhitebit.cancel_all_orders  s"     !!![[(F &tGH99:KV\6>H#<<VEVXbdijH""8,""6*V^y)tww)OORVVY``aa%99$++g:VWW   223 	"* Xs"   DDC"D9D:DDc           	      :  #    U R                  5       I Sh  vN   [        R                  " U R                  XX45      U R	                  XX45      /6 I Sh  vN u  pVU R                  XV5      nU R                  USS5      nUb  [        U5      U:  a  USU $ U$  N NE7f)an  
fetches information on multiple orders made by the user(combines open and closed orders)

https://docs.whitebit.com/private/http-trade-v4/#query-unexecutedactive-orders
https://docs.whitebit.com/private/http-trade-v4/#query-executed-orders

:param str symbol: unified market symbol of the market orders were made in
:param int [since]: the earliest time in ms to fetch orders for
:param int [limit]: the maximum number of order structures to retrieve
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
Nr  Tr   )r  r  r  fetch_open_ordersfetch_closed_ordersre  sort_byrb  )	r	  r$  r  r   r  
openOrdersclosedOrders	allOrderssortedOrderss	            r  fetch_orderswhitebit.fetch_orders  s      !!!)0""6%@$$VEB:
 * $ 
 %%j?	||I{DA\!2U!:%(( 	"$s"   BB<BBABBtimeoutc                   #    U R                  5       I Sh  vN   U R                  US5      nUc  [        U R                  S-   5      eU R	                  U5      nU R                  US5      nUS:  nSUS   0nU(       a  U R                  US-  5      US'   OS	US'   U R                  U R                  Xb5      5      I Sh  vN nU$  N N7f)
a  
dead man's switch, cancel all orders after the given timeout

https://docs.whitebit.com/private/http-trade-v4/#sync-kill-switch-timer

:param number timeout: time in milliseconds, 0 represents cancel the timer
:param dict [params]: extra parameters specific to the exchange API endpoint
:param str [params.types]: Order types value. Example: "spot", "margin", "futures" or None
:param str [params.symbol]: symbol unified symbol of the market the order was made in
:returns dict: the api result
Nr$  z< cancelAllOrdersAfter() requires a symbol argument in paramsr   r  r   r/  r  null)	r  r@  r'   r   r  ra  number_to_stringv4PrivatePostOrderKillSwitchr  )r	  r  r  r$  r  isBiggerThanZeror  rj  s           r  cancel_all_orders_after whitebit.cancel_all_orders_after  s      !!!!!&(3>#DGG.l$lmmV$68,#aKfTl
 !%!6!6w~!FGI!'GI::4;;w;WXX 1 	" Ys"   C	CB'C	>C?C	C	c                    [        UR                  5       5      n0 n[        S[        U5      5       H  nX$   nU R	                  U5      nX   n[        U[        5      (       aY  UbV  U R                  5       nU R                  USS5      US'   U R                  US5      US'   U R                  US5      US'   XU'   M  U R                  5       nXxS'   XU'   M     U R                  U5      $ )Nr   	availablemain_balancefreefreezeusedrw  )r_  r`  ra  rb  rA  r  dictr   r  r@  safe_balance)	r	  rj  balanceKeysrl  rm  r   r]  balancer   s	            r  parse_balancewhitebit.parse_balance  s    8==?+q#k*+AB**2.DlG'4((W-@,,."&"4"4Wk>"Z"&"2"27H"E#'#3#3G^#L &t,,.#* &t ,   ((r  c                 
  #    U R                  5       I Sh  vN   SnU R                  SSU5      u  p!SnUS:X  a  U R                  U5      I Sh  vN nOU R                  U R                  S0 5      nU R                  US5      nU R                  USSU5      nU R                  USS/5      nUS:X  d  US:X  a  U R                  U5      I Sh  vN nOU R                  U5      I Sh  vN nU R                  U5      $  N N N3 N7f)a  
query for balance and get the amount of funds available for trading or funds locked in orders

https://docs.whitebit.com/private/http-main-v4/#main-balance
https://docs.whitebit.com/private/http-trade-v4/#trading-balance

:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
NrR   r>   r   r  r   r   )r  r  %v4PrivatePostCollateralAccountBalancerB  r  r@  r  ra  v4PrivatePostMainAccountBalance v4PrivatePostTradeAccountBalancer  )r	  r  rn  rj  r  defaultAccountr   s          r  fetch_balancewhitebit.fetch_balance,  s     !!!
!??PTV\]
!GGOOHoodllNBGG!--gyAN((FNSGYYv	6':;F& Gy$8!%!E!Ef!MM!%!F!Fv!NN. !!(++K 	"
 P NNsF   DC;7DC=A<DC?D%D&D=D?DDc                    #    U R                  5       I Sh  vN   Sn0 nUb  U R                  U5      nUS   US'   Ub  [        US5      US'   U R                  U R	                  Xd5      5      I Sh  vN nU R                  XuX#SS05      $  Ns N7f)a  
fetch all unfilled currently open orders

https://docs.whitebit.com/private/http-trade-v4/#query-unexecutedactive-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 order structures to retrieve
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
Nr   r  r   r   rB  r  )r  r  r1  r  r  r  r  s           r  r  whitebit.fetch_open_orders]  s      !!![[(F &tGH"5#GG11$++g2NOO*   5(FASTT; 	" Ps"   BB
AB0B1BBc           	        #    U R                  5       I Sh  vN   0 nSnUb  U R                  U5      nUS   nUS   US'   Ub  [        US5      US'   U R                  U R	                  XT5      5      I Sh  vN n[        UR                  5       5      n/ n	[        S[        U5      5       Hq  n
X   nU R                  USS5      nX{   n[        S[        U5      5       H:  nU R                  X   U5      nU	R                  U R	                  US	S
05      5        M<     Ms     U R                  U	S5      n	U R                  XX#5      n	U	$  GN/ N7f)a  
fetches information on multiple closed orders made by the user

https://docs.whitebit.com/private/http-trade-v4/#query-executed-orders

:param str symbol: unified market symbol of the market orders were made in
:param int [since]: the earliest time in ms to fetch orders for
:param int [limit]: the maximum number of order structures to retrieve
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
Nr$  r   r  r   r   r   r  rB  closedr  )r  r  r1  r  r  r_  r`  ra  rb  r  r  r  r  filter_by_symbol_since_limit)r	  r$  r  r   r  r  r  rj  r  r  rm  r  r  r   rw  r  s                   r  r  whitebit.fetch_closed_orders  sK     !!![[(FH%F &tGH"5#GGCCDKKPWD`aa$ )	q#i.)A |H((4=I'F1c&k*((I>t{{58X2FGH +	 * ,,w433GURM 	" bs#   E
EAE
5E6CE
E
c                 :    SSSSSSSS.nU R                  X!U5      $ )Nr   r  )r   r  stop marketz
stop limitzstock marketzmargin limitzmargin marketr@  )r	  r  typess      r  parse_order_typewhitebit.parse_order_type  s3    #!$#%
 T22r  r  c                    U R                  US5      nU R                  X2S5      nUS   nU R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      nUS:X  a  S nU R                  US	5      n	U R                  US
5      n
U R                  USS5      nU R                  US5      nU R	                  U5      nUS:X  a  S nU R                  US5      nU R                  US5      nUS:X  a  US:X  d  US:X  a  UnU R                  US5      nS nUb  U R                  U5      US   S.nU R                  USS5      nU R                  US5      nU R                  0 SU_SU_SU_SU_SU_SU R                  U5      _SU_SS _SS _SS _SU_S	U	_SU_SU
_SU_SU_S U_S UUS S!.EU5      $ )"Nr  r  r$  r   	dealStockleftrX   r/  rZ  r  r   r  r.  	dealMoneyrS  r  dealFeer&  r#  ctimer  ftimer?  r  lastTradeTimestampr   r[  rB  r   filled	remaining)r  r6  r   trades)
r@  r  rE  r  r  r  r%  r  
safe_orderr(  )r	  r  r  r  r$  r   r  r  rX  r/  r   r  r  	orderTyper.  r6  r  r   r  r  s                       r  r  whitebit.parse_order  s   P ##E84!!(C8!v.!!%5$$UF3	((@B M  0''/AB$$UIt<v.))$/	 I!!%2{3EM!1t}7LF""5)4))'2"7OC ))%+F	!00@  
E 
' 
 f 
 ]	 

  
 Y/ 
 !"4 
 4 
  
 d 
 D 
 U 
 I 
 L 
 f 
  f! 
" # 
$ + 
, - 	r  c                 T  #    U R                  5       I Sh  vN   S[        U5      0nSnUb  U R                  U5      nUS   US'   Ub  [        US5      US'   U R	                  U R                  Xe5      5      I Sh  vN nU R                  US/ 5      n	U R                  X5      $  N N*7f)a  
fetch all the trades made from a single order

https://docs.whitebit.com/private/http-trade-v4/#query-executed-order-deals

: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>`
Nr  r   r  r   r   records)r  r}  r  r1  v4PrivatePostTradeAccountOrderr  rd  r  )
r	  r   r$  r  r   r  r  r  rj  r  s
             r  fetch_order_tradeswhitebit.fetch_order_trades%	  s      !!!s2w
 [[(F &tGH"5#GG<<T[[=YZZ( ~~h	26  ..? 	" [s"   B(B$A$B(;B&<)B(&B(r]  c                 X  #    U R                  5       I Sh  vN   Sn0 nUb  U R                  U5      nUS   US'   Ub  U R                  US-  5      US'   Ub  US:  a  SnUb  X6S'   SUS	'   U R                  U R	                  Xd5      5      I Sh  vN nU R                  XuX#5      $  N N7f)
af  
fetch all withdrawals made from an account

https://docs.whitebit.com/private/http-main-v4/#get-depositwithdraw-history

: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
:param str [params.transactionMethod]: transaction method(1=deposit, 2=withdrawal) - automatically set to '2' for withdrawals
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
Nr   r   r/  	startDater   r   2transactionMethodr  rn  r1  v4PrivatePostMainAccountHistoryr  parse_transactionsr	  r]  r  r   r  rn  r  rj  s           r  fetch_withdrawalswhitebit.fetch_withdrawalsS	  s      !!!}}T*H (GH#'#4#4UT\#BGK =ECKE$G'*#$==dkk'>Z[[& &&x5HHC 	" \s"   B*B&A8B*B(B*(B*c                 N  #    U R                  5       I Sh  vN   Sn0 nUb  U R                  U5      nUS   US'   Ub  U R                  US-  5      US'   Ub  US:  a  SnUb  X6S'   U R                  U R	                  Xd5      5      I Sh  vN nU R                  XuX#5      $  N N7f)af  
fetch history of deposits and withdrawals

https://docs.whitebit.com/private/http-main-v4/#get-depositwithdraw-history

:param str [code]: unified currency code
:param int [since]: the earliest time in ms to fetch transactions for
:param int [limit]: the maximum number of transactions structures to retrieve
:param dict [params]: extra parameters specific to the exchange API endpoint
:param str [params.transactionMethod]: transaction method(1=deposit, 2=withdrawal) - automatically set to '1' for deposits
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
Nr   r   r/  r  r   r   r  r  s           r  fetch_transactionswhitebit.fetch_transactions	  s      !!!}}T*H (GH#'#4#4UT\#BGK =ECKE$G==dkk'>Z[[& &&x5HHA 	" \s"   B%B!A3B%
B#B%#B%c                 .  #    U R                  5       I Sh  vN   U R                  U5      nSUS   0nSnU R                  U5      (       a  U R                  US5      nUc  [	        U R
                  S-   5      eXdS'   U R                  US5      nUc  [	        U R
                  S-   5      eXtS'   U R                  US5      nUc  [	        U R
                  S	-   5      eU R                  U R                  XB5      5      I Sh  vN nO(U R                  U R                  XB5      5      I Sh  vN nU R                  US
5      n	U R                  US0 5      n
U R                  U
SU	5      nU R                  U
S5      nU R                  U5        UUSUUS.$  GNx N Nl7f)a  
fetch the deposit address for a currency associated with self account

https://docs.whitebit.com/private/http-main-v4/#get-fiat-deposit-address
https://docs.whitebit.com/private/http-main-v4/#get-cryptocurrency-deposit-address

:param str code: unified currency code
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
Nr   r   providerzB fetchDepositAddress() requires a provider when the ticker is fiatr.  zA fetchDepositAddress() requires an amount when the ticker is fiatuniqueIdzC fetchDepositAddress() requires an uniqueId when the ticker is fiatrE  r   addressmemor?  rn  rS  r  tag)r  rn  is_fiatr@  r'   r   rE  rB  &v4PrivatePostMainAccountFiatDepositUrlr  v4PrivatePostMainAccountAddresscheck_address)r	  r]  r  rn  r  rj  r  r.  r  rE  r   r  r  s                r  fetch_deposit_addresswhitebit.fetch_deposit_address	  s     !!!==&htn
 <<''
;H'2v(vww"*J%%fh7F~'2u(uvv &Hvz:H'2w(wxx!HHU\IeffH!AA$++gB^__H6 x///(Ir:""7Is;w/7#
 	
i 	"$ g_s5   FFC&F=F>(F&F'A(FFFc                 
  #    U R                  5       I Sh  vN   U R                  U5      nSUS   0nU R                  U R                  XB5      5      I Sh  vN nU R	                  US0 5      nU R                  Xc5      $  Nh N*7f)a  
create a currency deposit address

https://docs.whitebit.com/private/http-main-v4/#create-new-address-for-deposit

:param str code: unified currency code of the currency for the deposit address
:param dict [params]: extra parameters specific to the exchange API endpoint
:param str [params.network]: the blockchain network to create a deposit address on
:param str [params.type]: address type, available for specific currencies
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
Nr   r   r   )r  rn  (v4PrivatePostMainAccountCreateNewAddressr  rc  parse_deposit_addressr	  r]  r  rn  r  rj  r  s          r  create_deposit_addresswhitebit.create_deposit_address	  s      !!!==&htn
 FFt{{SZGcdd& ~~h	26))$993 	"
 er  rn  c                 r    UU R                  S U5      S U R                  US5      U R                  US5      S.$ )Nr  r  r  )rA  r@  )r	  depositAddressrn  s      r  r  whitebit.parse_deposit_address 
  sD     #//h?''	B##NF;
 	
r  c           	        #    U R                  5       I Sh  vN   / nU R                  U5      I Sh  vN nU(       a  [        U[        5      (       a}  [	        S[        U5      5       Hd  nU R                  X45      nU R                  US5      nU R                  US5      nU(       d  MA  UR                  USU=(       d    SU-   SUS.5        Mf     U$  N N7f)a"  
fetch all the accounts associated with a profile

https://docs.whitebit.com/private/http-main-v4/#sub-account-list

:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: a list of `account structures <https://docs.ccxt.com/#/?id=account-structure>`
Nr   r   r   
subaccountzSubAccount )r   r  r   r]  r?  )	r  v4PrivatePostSubAccountListr  r_  ra  rb  rB  r@  r  )r	  r  accountssubAccountsrm  
subAccount	accountIdaccountNames           r  fetch_accountswhitebit.fetch_accounts/
  s      !!! !<<VDD:k4881c+./!__[<
 ,,Z>	"..z6B9OO' , + H}y/H $ *%  0 7 	" Es&   CCCCA2C(*CCr   c                   #    U R                  5       I Sh  vN   Ub  [        U R                  S-   5      eUS:  d  US:  a  [        U R                  S-   5      eSU0nU R	                  U R                  XC5      5      I Sh  vN $  No N7f)aJ  
set the level of leverage for a market

https://docs.whitebit.com/private/http-trade-v4/#change-collateral-account-leverage

:param float leverage: the rate of leverage
:param str symbol: unified market symbol
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: response from the exchange
Nz/ setLeverage() does not allow to set per symbolr     z2 setLeverage() leverage should be between 1 and 20r   )r  r-   r   r(   &v4PrivatePostCollateralAccountLeverager  )r	  r   r$  r  r  s        r  set_leveragewhitebit.set_leverageU
  s      !!!tww)ZZ[[qLhmTWW'[[\\
 @@WA]^^^ 	" _s"   B
BA*B
BB
B
fromAccount	toAccountc                   #    U R                  5       I Sh  vN   U R                  U5      nU R                  U R                  S5      nU R	                  XsU5      nU R	                  XtU5      n	U R                  X5      n
US   U
UU	S.nU R                  U R                  X5      5      I Sh  vN nU R                  X5      $  N N7f)a   
transfer currency internally between wallets on the same account

https://docs.whitebit.com/private/http-main-v4/#transfer-between-main-and-trade-balances

:param str code: unified currency code
:param float amount: amount to transfer
:param str fromAccount: account to transfer from - main, spot, collateral
:param str toAccount: account to transfer to - main, spot, collateral
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `transfer structure <https://docs.ccxt.com/#/?id=transfer-structure>`
Nr   r   )r   r.  fromto)	r  rn  rB  r  r@  currency_to_precision v4PrivatePostMainAccountTransferr  parse_transfer)r	  r]  r.  r  r  r  rn  r   fromAccountIdtoAccountIdamountStringr  rj  s                r  r   whitebit.transferm
  s      !!!==&7GH((kR&&~)L11$?tn"!	
 >>t{{7?[\\ ""866! 	" ]s"   CC BC*C+CCr   c           
      :    US S S U R                  S U5      S S S S S.	$ )N)	r?  r   r  r  rn  r.  r  r  rB  )rA  )r	  r   rn  s      r  r  whitebit.parse_transfer
  s6    
 //h?

 
	
r  r  r  c                   #    U R                  5       I Sh  vN   U R                  U5      nUS   U R                  X5      US.nU R                  US5      nUc  U R	                  5       nXS'   Ub  XGS'   U R                  U5      (       a1  U R                  US5      n	U	c  [        U R                  S-   5      eXS'   U R                  U R                  Xu5      5      I Sh  vN n
U R                  SU0U R                  X5      5      $  N N)7f)a  
make a withdrawal

https://docs.whitebit.com/private/http-main-v4/#create-withdraw-request

: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>`
Nr   )r   r.  r  r  r  r  z7 withdraw() requires a provider when the ticker is fiat)r  rn  r  rB  uuid22r  r'   r    v4PrivatePostMainAccountWithdrawr  parse_transaction)r	  r]  r.  r  r  r  rn  r  r  r  rj  s              r  r   whitebit.withdraw
  s	     !!!==&tn00>

 ??6:6{{}H&
?!FO<<vz:H'2k(kll"*J>>t{{7?[\\ {{D(+T-C-CH-WXX3 	"$ ]s"   D
DCD
D(D
D
transactionc                    U R                  S U5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      n0 SU R                  US5      _SU R                  US	5      _S
U_SU R                  U5      _SU R                  US5      _SUS:X  a  UOS _SU_SUS:X  a  UOS _SU R	                  US5      _SUS:X  a  SOS_SU R                  XR5      _SU R                  U5      _SS _SS _SS _SS _SU R                  US5      _S U R	                  US5      U R                  XR5      S.US.E$ )Nr  	createdAtr   rB  r  r   r  txidtransactionIdr  r  rS  addressFrom1	addressTor  r.  r  rQ  
withdrawalrn  rC  tagFromr  tagTocommentdescriptionr   r#  )internalr   r?  )safe_currencyr@  r  r(  rE  rA  parse_transaction_status)r	  r  rn  r  r  r  rB  r  s           r  r  whitebit.parse_transaction
  s   @ %%dH5"";	:''[A	%%k8<
!!+x8!!+x8
$"";
;
D$$[/B
 
 Y/	

 t''Y?
 v}74
 w
 Vs]
 d&&{H=
 &C-Il
 //
E
 d33F;
 t
 t
 4
  T!
" t'']C#
$ ((e< 33JI  /
 	
r  rB  c                     0 SS_SS_SS_SS_SS_S	S_S
S_SS_SS_SS_SS_SS_SS_SS_SS_SS_nU R                  X!U5      $ )Nr  pendingr  3rA  4canceled56791011121314151617r  )r	  rB  statusess      r  r#  !whitebit.parse_transaction_status  s    


 
 	

 
 
 
 
 )
 )
 )
 )
 )
 )
 )
  )!
$ &99r  c                 J  #    U R                  5       I Sh  vN   SnSUSSS.nUb  U R                  U5      nUS   US'   U R                  U R                  XS5      5      I Sh  vN nU R	                  US/ 5      nU R                  US0 5      nU R                  X5      $  N N=7f)ag  
fetch information on a deposit

https://docs.whitebit.com/private/http-main-v4/#get-depositwithdraw-history

:param str id: deposit id
:param str code: not used by whitebit fetchDeposit()
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
Nr  r   )r  r  r   offsetr   r   r  )r  rn  r  r  rB  rc  r  )	r	  r   r]  r  rn  r  rj  r  firsts	            r  fetch_depositwhitebit.fetch_deposit  s      !!!!"	
 }}T*H (GH==dkk'>Z[[L //(Ir:w2.%%e66g 	" \s"   B#BAB##B!$<B#!B#c                 H  #    U R                  5       I Sh  vN   SnSSSS.nUb  U R                  U5      nUS   US'   Ub  [        US5      US'   U R                  U R	                  Xd5      5      I Sh  vN nU R                  US	/ 5      nU R                  XX#5      $  N N+7f)
a  
fetch all deposits made to an account

https://docs.whitebit.com/private/http-main-v4/#get-depositwithdraw-history

: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>`
Nr  r   r   )r  r   r9  r   r   r   r  )r  rn  r1  r  r  rd  r  )	r	  r]  r  r   r  rn  r  rj  r  s	            r  fetch_depositswhitebit.fetch_depositsY  s      !!!!"

 }}T*H (GH"5#GG==dkk'>Z[[L ..9b9&&w%GGg 	" \s"   B"BAB"4B 5*B" B"c                   #    U R                  5       I Sh  vN   0 nSnUb  U R                  U5      nUS   US'   U R                  U R                  Xe5      5      I Sh  vN nU R	                  X5      n	U R                  XX45      $  No N)7f)a)  
fetch the interest owed by the user for borrowing currency for margin trading

https://docs.whitebit.com/private/http-trade-v4/#open-positions

:param str code: unified currency code
:param str symbol: unified market symbol
:param int [since]: the earliest time in ms to fetch borrrow interest for
:param int [limit]: the maximum number of structures to retrieve
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: a list of `borrow interest structures <https://docs.ccxt.com/#/?id=borrow-interest-structure>`
Nr   r  )r  r  +v4PrivatePostCollateralAccountPositionsOpenr  parse_borrow_interestsfilter_by_currency_since_limit)
r	  r]  r$  r  r   r  r  r  rj  interests
             r  fetch_borrow_interestwhitebit.fetch_borrow_interest  s      !!![[(F &tGHII$++V]Jfgg, ..x@2285PP; 	" hs"   B
BAB
B(B
B
r?  c                     U R                  US5      nU R                  X2S5      nU R                  US5      nUUSU R                  US5      SU R                  US5      SUU R	                  U5      S	.	$ )
Nr  r  
modifyDater  unrealizedFundinggXjP?r.  r\  )	r?  r$  rn  rD  interestRateamountBorrowedr   r  r  )r@  safe_symbolr  rE  r(  )r	  r?  r  r  r$  r  s         r  parse_borrow_interestwhitebit.parse_borrow_interest  s    ( ##D(3!!(C8''l;	((/BC#"..tX>!"Y/

 
	
r  c                    #    U R                  5       I Sh  vN   U R                  U5      nU R                  U/U5      I Sh  vN nU R                  X15      $  NA N7f)a@  
fetch the current funding rate

https://docs.whitebit.com/public/http-v4/#available-futures-markets-list

:param str symbol: unified market symbol
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
N)r  r$  fetch_funding_ratesrB  )r	  r$  r  rj  s       r  fetch_funding_ratewhitebit.fetch_funding_rate  sU      !!!V$116(FCCx00 	"Cs!   AA+AAAAc                    #    U R                  5       I Sh  vN   U R                  U5      nU R                  U5      I Sh  vN nU R                  US/ 5      nU R	                  XA5      $  NR N*7f)a  
fetch the funding rate for multiple markets

https://docs.whitebit.com/public/http-v4/#available-futures-markets-list

:param str[]|None symbols: list of unified market symbols
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexed by market symbols
Nrl  )r  r  v4PublicGetFuturesrd  parse_funding_rates)r	  r   r  rj  r  s        r  rP  whitebit.fetch_funding_rates  sk      !!!%%g.0088Z ~~h"5''66a 	"8s!   A-A))A- A+)A-+A-c                    U R                  US5      nU R                  X25      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      nU R                  US5      n	0 SU_SU_SU_SU_SU_S	S _S
S _SU_SU	_SU R	                  U	5      _SS _SS _SS _SS _SS _SS _SS _$ )N	ticker_id	markPrice
indexPricerJ  funding_ratenext_funding_rate_timestampr?  r$  r  r  fundingRatefundingTimestampfundingDatetimenextFundingRatenextFundingTimestampnextFundingDatetimepreviousFundingRatepreviousFundingTimestamppreviousFundingDatetimer.  )r@  rL  rE  r&  r(  )
r	  r,  r  r  r$  rY  rZ  rJ  r]  fundingTimes
             r  parse_funding_ratewhitebit.parse_funding_rate4  s]   B ##Hk:!!(3$$X{;	%%h=
''.A&&x@''2OP
H
f
 
 *	

 L
 
 
 ;
 
 t||K8
 t
 #D
 "4
 "4
 '
  &t!
" #
 	
r  c                 h  #    U R                  5       I Sh  vN   Uc  [        U R                  S-   5      eU R                  U5      nSUS   0nUb  X&S'   Ub  X&S'   U R	                  SXd5      u  pdU R                  U5      I Sh  vN nU R                  US/ 5      nU R                  XX#5      $  N N+7f)	a1  
fetch the history of funding payments paid and received on self account

https://docs.whitebit.com/private/http-trade-v4/#funding-history

:param str [symbol]: unified market symbol
:param int [since]: the starting timestamp in milliseconds
:param int [limit]: the number of entries to return
:param dict [params]: extra parameters specific to the exchange API endpoint
:param int [params.until]: the latest time in ms to fetch funding history for
:returns dict[]: a list of `funding history structures <https://docs.ccxt.com/#/?id=funding-history-structure>`
Nz1 fetchFundingHistory() requires a symbol argumentr  r   r  r   endDater  )r  r'   r   r  handle_until_option,v4PrivatePostCollateralAccountFundingHistoryrd  parse_funding_histories)	r	  r$  r  r   r  r  r  rj  r  s	            r  fetch_funding_historywhitebit.fetch_funding_historyp  s      !!!>#DGG.a$abbV$fTl
 #(K $G229gNJJ7SS$ ~~h	26++D%GG? 	" Ts"   B2B.A-B2B0*B20B2c           
          U R                  US5      nU R                  US5      nUU R                  X2S S5      S UU R                  U5      S U R	                  US5      S.$ )Nr  rf  r>   fundingAmount)r?  r$  r]  r  r  r   r.  )r@  r&  rL  r(  rE  )r	  r,  r  r  r  s        r  parse_funding_historywhitebit.parse_funding_history  sl     ##Hh7%%h>	&&xvF"Y/&&xA
 	
r  c                     / n[        S[        U5      5       H'  nX   nUR                  U R                  Xr5      5        M)     U R	                  US5      nU R                  XU5      $ )Nr   r  )ra  rb  r  rr  r  r  )	r	  	contractsr  r  r   rl  rm  r,  sorteds	            r  rm   whitebit.parse_funding_histories  s_    q#i.)A |HMM$44XFG * fk2))&??r  c                 (  #    U R                  5       I Sh  vN   0 nSnUb  U R                  U5      nUS   US'   Ub  X5S'   U R                  U R                  XT5      5      I Sh  vN nU R	                  US5      nU R                  XX#5      $  Nw N*7f)a  
       fetch history of deposits and withdrawals

       https://github.com/whitebit-exchange/api-docs/blob/main/pages/private/http-main-v4.md#get-depositwithdraw-history

       :param str [code]: unified currency code for the currency of the deposit/withdrawals, default is None
       :param int [since]: timestamp in ms of the earliest deposit/withdrawal, default is None
       :param int [limit]: max number of deposit/withdrawals to return, default = 50, Min: 1, Max: 100
       :param dict [params]: extra parameters specific to the exchange API endpoint

EXCHANGE SPECIFIC PARAMETERS
       :param number [params.transactionMethod]: Method. Example: 1 to display deposits / 2 to display withdraws. Do not send self parameter in order to receive both deposits and withdraws.
       :param str [params.address]: Can be used for filtering transactions by specific address or memo.
       :param str[] [params.addresses]: Can be used for filtering transactions by specific addresses or memos(max: 20).
       :param str [params.uniqueId]: Can be used for filtering transactions by specific unique id
       :param int [params.offset]: If you want the request to return entries starting from a particular line, you can use OFFSET clause to tell it where it should start. Default: 0, Min: 0, Max: 10000
       :param str[] [params.status]: Can be used for filtering transactions by status codes. Caution: You must use self parameter with appropriate transactionMethod and use valid status codes for self method. You can find them below. Example: "status": [3,7]
       :returns dict: a list of `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
       Nr   r   r   r  )r  rn  r  r  rd  r  )	r	  r]  r  r   r  r  rn  rj  r  s	            r  fetch_deposits_withdrawals#whitebit.fetch_deposits_withdrawals  s     ( !!!}}T*H (GH$G==dkk'>Z[[N ..95&&w%GGa 	" \s"   BBAB%B&)BBfromCodetoCodec                 &  #    U R                  5       I Sh  vN   U R                  U5      nU R                  U5      nUUU R                  U5      SS.nU R                  U R	                  Xt5      5      I Sh  vN nU R                  XU5      $  Nv N7f)a  
fetch a quote for converting from one currency to another

https://docs.whitebit.com/private/http-trade-v4/#convert-estimate

:param str fromCode: the currency that you want to sell and convert from
:param str toCode: the currency that you want to buy and convert into
:param float amount: how much you want to trade in units of the from currency
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
Nr  )r  r  r.  	direction)r  rn  r  v4PrivatePostConvertEstimater  parse_conversion)	r	  r{  r|  r.  r  fromCurrency
toCurrencyr  rj  s	            r  fetch_convert_quotewhitebit.fetch_convert_quote  s      !!!}}X.]]6*
++F3	
 ::4;;w;WXX $$XZHH+ 	" Ys"   BBAB6B7BBc                   #    U R                  5       I Sh  vN   U R                  U5      nU R                  U5      nSU0nU R                  U R                  X5      5      I Sh  vN n	U R	                  XU5      $  Nd N7f)a)  
convert from one currency to another

https://docs.whitebit.com/private/http-trade-v4/#convert-confirm

:param str id: the id of the trade that you want to make
:param str fromCode: the currency that you want to sell and convert from
:param str toCode: the currency that you want to buy and convert into
:param float [amount]: how much you want to trade in units of the from currency
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
Nr)  )r  rn  v4PrivatePostConvertConfirmr  r  )
r	  r   r{  r|  r.  r  r  r  r  rj  s
             r  create_convert_tradewhitebit.create_convert_trade'  s      !!!}}X.]]6*
r
 99$++g:VWW $$XZHH 	" Xs"   A?A;AA?$A=%A?=A?c                   #    U R                  5       I Sh  vN   0 nUb  XS'   Ub(  U R                  US-  5      nU R                  U5      US'   Ub  X5S'   U R                  SXTS5      u  pTU R	                  U R                  XT5      5      I Sh  vN nU R                  US/ 5      nU R                  XS	S
X#5      $  N N-7f)a  
fetch the users history of conversion trades

https://docs.whitebit.com/private/http-trade-v4/#convert-history

:param str [code]: the unified currency code
:param int [since]: the earliest time in ms to fetch conversions for
:param int [limit]: the maximum number of conversion structures to retrieve, default 20, max 200
:param dict [params]: extra parameters specific to the exchange API endpoint
:param str [params.until]: the end time in ms
:param str [params.fromTicker]: the currency that you sold and converted from
:param str [params.toTicker]: the currency that you bought and converted into
:param str [params.quoteId]: the quote id of the conversion
:returns dict[]: a list of `conversion structures <https://docs.ccxt.com/#/?id=conversion-structure>`
N
fromTickerr/  r  r   r  gMbP?r  r  r  )r  r1  r  rk  v4PrivatePostConvertHistoryr  rd  parse_conversions)	r	  r]  r  r   r  r  r0  rj  rowss	            r  fetch_convert_trade_history$whitebit.fetch_convert_trade_historyC  s       !!!$(L!%%edl3E"33E:GFO$G224%P99$++g:VWW0 ~~h	26%%d.,PU]]G 	" Xs"   B>B:A7B>B<,B><B>
conversionr  r  c                    U R                  US/ 5      nU R                  US0 5      nU R                  US5      nU R                  US5      nU R                  USS5      nU R                  USU5      n	U R	                  X5      n
U R                  USU5      nU R	                  X5      nUUU R                  U5      U R                  US5      U
U R                  USS	5      UU R                  US
S5      U R                  US5      S S.
$ )Npathr   r  r  dateexpireAtr   give	finalGivereceivefinalReceiverate)
r?  r  r  r   r  
fromAmountr  toAmountr/  r   )rd  rc  r@  r%  rA  r(  safe_number_2rE  )r	  r  r  r  r  r:  fromPathtoPathr  fromCoinr{  toCoinr|  s                r  r  whitebit.parse_conversionx  s   L ~~j&"5tQ+##E62!!%.))*fjI	##JA**8B!!*dF;((<"Y/"":t4$,,ZM **:y.Q%%j&9
 	
r  c                 L  #    U R                  5       I Sh  vN   U R                  U5      nSUS   0nUb  X&S'   Ub  X&S'   U R                  SXd5      u  pdU R                  U R	                  Xd5      5      I Sh  vN nU R                  U5      nU R                  XX#5      $  N N)7f)a  
fetches historical positions

https://docs.whitebit.com/private/http-trade-v4/#positions-history

:param str symbol: unified contract symbol
:param int [since]: the earliest time in ms to fetch positions for
:param int [limit]: the maximum amount of records to fetch
:param dict [params]: extra parameters specific to the exchange api endpoint
:param int [params.positionId]: the id of the requested position
:returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
Nr  r   r  r   rj  )r  r  rk  .v4PrivatePostCollateralAccountPositionsHistoryr  parse_positionsr  )	r	  r$  r  r   r  r  r  rj  	positionss	            r  fetch_position_historywhitebit.fetch_position_history  s      !!!V$fTl
 #(K $G229gNLLT[[Y`Mijj0 ((2	00EQQG 	" ks"   B$B A!B$8B"9(B$"B$c                    #    U R                  5       I Sh  vN   U R                  U5      nU R                  U5      I Sh  vN nU R                  X15      $  N? N7f)aB  
fetch all open positions

https://docs.whitebit.com/private/http-trade-v4/#open-positions

:param str[] [symbols]: list of unified market symbols
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
N)r  r  rA  r  )r	  r   r  rj  s       r  fetch_positionswhitebit.fetch_positions  sW      !!!%%g.II&QQ, ##H661 	"Qs!   AA)A AAAc                 
  #    U R                  5       I Sh  vN   U R                  U5      nSUS   0nU R                  U R                  XB5      5      I Sh  vN nU R	                  US0 5      nU R                  Xc5      $  Nh N*7f)aj  
fetch data on a single open contract trade position

https://docs.whitebit.com/private/http-trade-v4/#open-positions

:param str symbol: unified market symbol of the market the position is held in
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `position structure <https://docs.ccxt.com/#/?id=position-structure>`
Nr$  r   r   )r  r  rA  r  rc  parse_position)r	  r$  r  r  r  rj  r  s          r  fetch_positionwhitebit.fetch_position
  s      !!!V$fTl
 II$++V]Jfgg, ~~h2.""4009 	"
 hr  positionc                    U R                  US5      nU R                  US5      nU R                  US0 5      nU R                  US0 5      nU R                  0 SU_SU R                  US5      _SU R	                  X25      _S	S _S
S _SU R                  US5      _SU R                  US5      _SU R                  US5      _SU R                  US5      _SU R                  US5      _SS _SS _SS _SS _SS _SS _SU_U R                  U5      U R                  US5      S S U R                  US5      S S S S U R                  US5      U R                  US5      S.E5      $ )Nr  openDatetpslorderDetailr?  r   
positionIdr$  notionalr   liquidationPrice
entryPrice	basePriceunrealizedPnlpnlrealizedPnlr   
pnlPercentru  r7  rY  r  r   r   r  rH  r=   stopLoss
takeProfit)r  lastUpdateTimestampmaintenanceMarginmaintenanceMarginPercentager   initialMargininitialMarginPercentager   marginRatior   r   )r@  r  rc  safe_positionrL  rE  r(  )r	  r  r  r  r  r  r  s          r  r  whitebit.parse_position2  s   X ##Hh7''*=	~~h3nnX}bA!! #
H#
$""8\:#
 d&&x8#
 	#

 $#
  0 0;M N#
 $**8[A#
 T--h>#
 4++KG#
 $**8\B#
 #
 D#
 #
 #
 D#
  d!#
" ##
$ Y/#'#6#6x#N!%+/**8X>!'+!--dJ?#//lC9#
  	r  c                 
  #    U R                  5       I Sh  vN   U R                  U5      nSUS   0nU R                  U R                  XB5      5      I Sh  vN nU R	                  US/ 5      nU R                  Xc5      $  Nh N*7f)aQ  
fetch the rate of interest to borrow a currency for margin trading

https://docs.whitebit.com/private/http-main-v4/#get-plans

:param str code: unified currency code
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a `borrow rate structure <https://docs.ccxt.com/#/?id=borrow-rate-structure>`
Nr   r   r   )r  rn  "v4PrivatePostMainAccountSmartPlansr  rd  parse_borrow_rater  s          r  fetch_cross_borrow_rate whitebit.fetch_cross_borrow_rate  s      !!!==&htn
 @@WA]^^ ~~h2.%%d55 	"
 _r  c                     U R                  US5      nU R                  US5      nU R                  X25      U R                  [        R                  " US5      5      U R                  US5      S S US.$ )Nr   r  r"  duration)rn  r  periodr  r  r?  )r@  rA  r  r1   rD  r&  )r	  r?  rn  r  r  s        r  r  whitebit.parse_borrow_rate  st     %%dH5
""43//
E%%g&8&8%&HI''j9
 	
r  c                 ^    U R                  U R                  S/ 5      nU R                  X5      $ )Nr   )rB  r  rg  )r	  rn  r   s      r  r  whitebit.is_fiat  s(    7GL}}X66r  c                 B    U R                  5       U R                  S   -
  $ )Nr   )millisecondsr  )r	  s    r  noncewhitebit.nonce  s       "T\\2B%CCCr  r   GETc                    U R                  X@R                  U5      5      nU R                  US5      nU R                  US5      n	Uc  0 nSU R                  -   S-   U R                  -   US'   SU R                  X5      -   n
U R                  S   U   U	   U
-   nU	S:X  a  U(       a  US	U R                  U5      -   -  nU	S
:X  a  U R                  5         [        U R                  5       5      nU R                  U R                  5      nSU-   U
-   nU R                  U R                  XS.U5      5      nU R                  U5      nU R!                  U R                  U5      U["        R$                  5      nSU R&                  UUS.nXXeS.$ )Nr   r  zccxt/-z
User-Agentr  r   r   ?r   z/api/)r  r  zapplication/json)zContent-TypezX-TXC-APIKEYzX-TXC-PAYLOADzX-TXC-SIGNATURE)rE  r  bodyheaders)ra  extract_paramsrB  r   r   implode_paramsr   	urlencodecheck_required_credentialsstrr  encodesecretjsonr  string_to_base64hmachashlibsha512apiKey)r	  r  r   r  r  r  r  rr  r   accessibilitypathWithParamsrE  r  r  r  payload	signatures                    r  signwhitebit.sign  so   		&"5"5d";<//#q)Q/?G '$'' 1C 7$,, Ft224@@iiw'6GH$sT^^E222I%++-

%E[[-F''1NBG99T[[W)MvVWD++D1G		$++g"6OI 2 $!(#,	G dOOr  reasonrE  r  r  r  c
                 b   US:X  d  US:X  a0  [        U R                  S-   [        U5      -   S-   U-   S-   U-   5      eUS:X  a'  [        U R                  S-   [        U5      -   S-   5      eUGbB  U R	                  US5      n
U R                  US5      nU R	                  US5      nU R                  US	5      nU
S L=(       a    U
S
:g  =(       a    US LnU(       d  Ub  U R                  S-   U-   nUnU(       a  U
nOmU R                  US0 5      n[        UR                  5       5      n[        U5      nUS:  a0  US   nU R                  UU/ 5      n[        U5      nUS:  a  US   OUnU R                  U R                  S   UU5        U R                  U R                  S   Xo5        [        U5      eg )Ni  i  r  i  z endpoint not foundrB  errorsmessager]  200r   r   r   )r.   r   r  r$   r@  rB  r&  rc  r_  r`  rb  throw_exactly_matched_exceptionr  throw_broadly_matched_exception)r	  r]  r  rE  r  r  r  rj  requestHeadersrequestBodyrB  r  r  codeNewhasErrorStatusfeedback	errorInfoerrorObject	errorKeyserrorsLengtherrorKeyerrorMessageArrayerrorMessageLengths                          r  handle_errorswhitebit.handle_errors  s   CKTS[ 3T!:S!@6!IC!ORV!VWW3;#D	 9<Q QRR %%h9F__Xx8F&&x;G ''&9G#4/ZFeOZVZHZN!477S=4/#	! &I"&..8R"HK $[%5%5%7 8I#&y>L#a'#,Q<,0OOKSU,V)-01B-C*=ORS=S$5a$8Z^	44T__W5MyZbc44T__W5Mt^#H--r   )NN)N)NNN)s__name__
__module____qualname____firstlineno__r   r  r#   r   r  r  rJ  r   rz  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_  r5  r=  rG  rK  r   floatrP  rT  r   r   rN  rz  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>  r   rE  rM  r   rQ  r   rP  rg  r   rn  rr  rm  ry  r
   r  r  r  r  r   r  r  r  r  r   r  r  boolr  r  r  r  __static_attributes____classcell__)r
  s   @r  r3   r3      s

   e# eN *, #+V #+JU
4 U
F U
n -/ L: L\ =A 5
' 5
n BFb 6Aw 6ApV#p /1 -[ -^ =A d' dPS dL ;?r I IV 68 "1 "1F "1HO4 O O6 Ob 8<B ;NC ;N ;N5 ;Nz 6:" *G7 *G *GX @DB 'BS 'B 'BS\ 'BR <@d[] A AS A Abfglbm A@ 37TX\eg DRC DRs DRRU DRLN Nv N N` ?CQUdhqs )J )J )J3 )J^a )Jx|  ~B  yC )JV
 
4 
* )+ 
0 ') 3S 3" eg b# bY bV[ b XZ Uc U U^c U mqy{ X* X*I X*Y X*X] X*fi X*t fjx|  FH 7*3 7* 7*9 7*I 7*_b 7*ru 7*r 9=R '*S '*# '*R 59 %3c %3N 04$UYbd  C s imnsit 6 BD $S $L) )& *, /, /,b 59tZ^gi )Uc )U )UTW )Unrsxny )UV 7;\`ik 2 23 2VY 2ptuzp{ 2h
3S 
3[ [v [ [z ?CQUdhqs ,/3 ,/ ,/3 ,/^a ,/\ 37TX\eg .IC .Is .IRU .Ilpq|l} .I` 48dY]fh -IS -I -ISV -Imqr}m~ -I^ =? E
 E
> E
N >@ %: %:N %:N
h 
R` 
 +- $g $L ?C2 _3 _ _0 ac 73 7 7C 7TW 7gt 7>
t 
x 
= 
  QU]_ &Y3 &Y &Y &Y# &Ydo &YP>
T >
X >
Q\ >
@:s :* 8<B >7c >7 >7@ 04$UYbd ?H ?HC ?Hs ?Himnyiz ?HB 7;$]apt} *Q *QC *QWZ *Qjm *Q  EI  JX  EY *QX!
$ !
 !
. !
F <> 1s 1+ 1 <@ :7 :7| :7x:
6 :
[ :
x 9=4^bkm ,H# ,HS ,HX[ ,Hrv  xF  sG ,H\
f 
0@S @X[ @gklzg{ @ <@daenp DHS DH DH[^ DHuy  {F  vG DHL SW_a !I# !Is !IC !Ifp !IF ]aik IS IC I IVY Ipz I8 =Atbfoq 3^c 3^ 3^\_ 3^vz  |F  wG 3^j:
4 :
x :
\d :
pz :
x FJX\eg 0R3 0Rs 0RRU 0Rlpqylz 0Rd 8<B "7W "74PX> "7H 8: &13 &1h &1PMt MV Mx M^ ?A 6# 6_ 6*
 
7 7 7D &eBSW P8!# !s ! !c !TX !`c ! !r  r3   )9 ccxt.async_support.base.exchanger   ccxt.abstract.whitebitr   r  r  ccxt.base.typesr   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"   typingr#   ccxt.base.errorsr$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   ccxt.base.decimal_to_precisionr0   ccxt.base.preciser1   r3   r  r  r  <module>r     s    6 .   V  V  V  V  V  V  V  V  * 0 - . ' & . ) * ) + 1 4 %L;x L;r  