
    ei                       d dl mZ d dlmZ d dlZd dlmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ d dlmZ d dlm Z  d dlm!Z! d dlm"Z" d d	lm#Z# d d
lm$Z$ d dlm%Z% d dlm&Z& d dlm'Z' d dlm(Z( d dlm)Z) d dlm*Z* d dlm+Z+ d dlm,Z, d dlm-Z- d dlm.Z. d dlm/Z/ d dlm0Z0 d dl1m2Z2  G d dee          Z3dS )    )Exchange)ImplicitAPIN)AccountAnyBalancesBool
CurrenciesCurrencyDepositAddressIntMarketNumOrder	OrderBook	OrderSide	OrderTypePositionStrStringsTickerOpenInterestTradeTransactionFundingRateHistoryTransferEntry)List)ExchangeError)AuthenticationError)PermissionDenied)ArgumentsRequired)
BadRequest)	BadSymbol)OperationRejected)MarketClosed)InsufficientFunds)InvalidAddress)InvalidOrder)OrderNotFound)OrderNotFillable)DuplicateOrderId)NotSupported)RateLimitExceeded)InvalidNonce)	TICK_SIZEc                   H    e Zd Zdef fdZi fdefdZi fdefdZi fde	e
         fdZdede
fdZdhd	ed
edefdZdi fdededefdZddi fdededede	e         fdZdddi fdededede	e         fdZdddi fdedededede	e         f
dZdhdede
defdZi fdedefdZdhdede
defdZddddi fdededededef
dZdddi fdededede	e         fdZdhde
defdZdddi fdededede	e         fdZ dddi fdededede	e!         fd Z"di fdeded!edefd"Z#di d#d$fded!ed%ed&edef
d'Z$dedefd(Z%dddi fdededede	e!         fd)Z&dddi fdededede	e!         fd*Z'dddi fdededede	e!         fd+Z(dddi fdededede	e!         fd,Z)di fdedede!fd-Z*di fded	e+d.e,d/e-d0e.de!fd1Z/ddi fdeded	e+d.e,d/e.d0e.fd2Z0di fdedede!fd3Z1di fdede	e!         fd4Z2dhd5ede
de!fd6Z3d7efd8Z4d	efd9Z5dddi fd:ededede	e6         fd;Z7di fd:ed/e-d<ed=ede6f
d>Z8dhd?ed@e9de6fdAZ:dB Z;d7efdCZ<i fdDZ=i fde	e>         fdEZ?dFede>fdGZ@i fd:edeAfdHZBdhd@e9deAfdIZCi fdeDfdJZEd:edeDfdKZFdeDfdLZGdi fdMeHde	eI         fdNZJdhdOede
fdPZKd.efdQZLdddi fd:ededede	eM         fdRZNi fd:ed/e-dSedTedeMf
dUZOdhd@e9fdVZPdW ZQddi fd:ededefdXZRdhd@e9fdYZSdZ ZTi fdedeUfd[ZVdhde
fd\ZWd]d^i ddfd_ZXi fd`ZYi fdaZZdbe[dceddededeedfefdgZ\ xZ]S )ibullishreturnc           !      
   |                      t          t          |                                           dddgdddi dd ddd	d
dd
dd
dd
dd
dd
dddddd
dd
ddddddddddi dddddddddd
ddddd dd!d
d"d
d#d
d$dd%dd&dd'd
d(dd)d
i d*d
d+dd,d
d-dd.d
d/d
d0d
d1dd2d
d3d
d4d
d5d
d6dd7d
d8d
d9d
d:d
i d;d
d<d
d=d
d>d
d?d
d@ddAd
dBddCddDddEd
dFd
dGd
dHddIddJddKd
i dLddMddNd
dOd
dPd
dQddRd
dSd
dTd
dUd
dVd
dWddXd
dYddZdd[d
d\d
i d]d
d^d
d_d
d`d
daddbd
dcd
ddd
ded
dfd
dgd
dhd
did
djd
dkddlddmddndidodpdqdrdsdtdudvdwdxdxdydzdzdyd{d|d}gd~di ddddddddddddddddddddddddddddddddddddiii ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
ddydd
d|                     d          |                     d          dit
          dd
dddddddid ddd
dd d
d
d
d dddd
dd
d
d
d
d
d
d
dd d
ddd
ddd
d
d
d
dd
dddd
d
d
dd
dddd
d
d
dd
dddd
d
d
dd
ddddd
d
d
dd
dddd
d
d
dddidddiddid dddid ddi dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          i dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt          dt           dt          dt          dt          dt          i dt          dt          dt          dt          dt"          dt"          dt          dt          dt          dt          dt          dt          dt$          dt&          dt          dt&          dt          i dt          dt          dt          dt          dt          dt          dt          dt(          dt          dt          dt          d t          dt          dt*          dt*          dt(          dt          t          t          t(          t          t          t          t(          t(          t          d	t          t          t          t          ddd	          S (
  Nr0   BullishDEv3   TCORSspotmarginFswapfutureoption	addMarginborrowMargincancelAllOrderscancelOrdercancelOrderscreateDepositAddresscreateLimitBuyOrdercreateLimitOrdercreateLimitSellOrdercreateMarketBuyOrdercreateMarketOrdercreateMarketSellOrdercreateOrdercreatePostOnlyOrdercreateTriggerOrderdeposit	editOrderfetchAccountsfetchBalancefetchBidsAsksfetchBorrowInterestfetchBorrowRateHistoriesfetchBorrowRateHistoryfetchCanceledAndClosedOrdersfetchCanceledOrdersfetchClosedOrderfetchClosedOrdersfetchCrossBorrowRatefetchCrossBorrowRatesfetchCurrenciesfetchDepositfetchDepositAddressfetchDepositAddressesfetchDepositAddressesByNetworkfetchDepositsfetchDepositsWithdrawalsfetchDepositWithdrawFeefetchDepositWithdrawFeesfetchFundingHistoryfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchIndexOHLCVfetchIsolatedBorrowRatefetchIsolatedBorrowRatesfetchL3OrderBookfetchLedgerfetchLeveragefetchLeverageTiersfetchMarketLeverageTiersfetchMarketsfetchMarkOHLCVfetchMyTrades
fetchOHLCVfetchOpenInterestfetchOpenInterestHistoryfetchOpenInterestsfetchOpenOrderfetchOpenOrders
fetchOrderfetchOrderBookfetchOrderBooksfetchOrdersfetchOrderTradesfetchPositionfetchPositionHistoryfetchPositionModefetchPositionsfetchPositionsForSymbolfetchPositionsHistoryfetchPositionsRiskfetchPremiumIndexOHLCVfetchStatusfetchTickerfetchTickers	fetchTimefetchTradesfetchTradingFeefetchTradingFeesfetchTradingLimitsfetchTransactionFeefetchTransactionFeesfetchTransactionsfetchTransfersfetchWithdrawalfetchWithdrawalsfetchWithdrawalWhitelistreduceMarginrepayMarginsetLeverage	setMarginsetMarginModesetPositionModesignIntransferwithdrawws1m5m30m1h6h12h1d)r   r   r   r   r   r   r   zOhttps://github.com/user-attachments/assets/68f0686b-84f0-4da9-a751-f7089af3a9edz,https://api.exchange.bullish.com/trading-api)publicprivatez0https://api.simnext.bullish-test.com/trading-apizhttps://bullish.com/ z/https://api.exchange.bullish.com/docs/api/rest/)logoapitestwwwreferraldocgetzv1/nonce   zv1/timez	v1/assetszv1/assets/{symbol}z
v1/marketszv1/markets/{symbol}zv1/history/markets/{symbol}z$v1/markets/{symbol}/orderbook/hybridzv1/markets/{symbol}/tradeszv1/markets/{symbol}/tickzv1/markets/{symbol}/candlez"v1/history/markets/{symbol}/tradesz(v1/history/markets/{symbol}/funding-ratezv1/index-priceszv1/index-prices/{assetSymbol}zv1/expiry-prices/{symbol}zv1/option-ladderzv1/option-ladder/{symbol}	v2/orderszv2/history/orderszv2/orders/{orderId}v2/amm-instructionsz#v2/amm-instructions/{instructionId}zv1/wallets/transactionszv1/wallets/limits/{symbol}z/v1/wallets/deposit-instructions/crypto/{symbol}z2v1/wallets/withdrawal-instructions/crypto/{symbol}z-v1/wallets/deposit-instructions/fiat/{symbol}z0v1/wallets/withdrawal-instructions/fiat/{symbol}z,v1/wallets/self-hosted/verification-attemptsz	v1/trades   zv1/history/tradeszv1/trades/{tradeId}z)v1/trades/client-order-id/{clientOrderId}zv1/accounts/asset)zv1/accounts/asset/{symbol}zv1/users/logoutv1/users/hmac/loginzv1/accounts/trading-accountsz/v1/accounts/trading-accounts/{tradingAccountId}zv1/derivatives-positionsz!v1/history/derivatives-settlementzv1/history/transferzv1/history/borrow-interestv2/mmp-configurationv2/otc-tradeszv2/otc-trades/{otcTradeId}zv2/otc-trades/unconfirmed-trade)
r   z
v2/commandr   zv1/wallets/withdrawalzv2/users/loginzv1/simulate-portfolio-marginzv1/wallets/self-hosted/initiater   r   zv2/otc-command)r   posttradingz0.001)	tierBased
percentagetakermakerr   BTCEOSETH)r   r   ERC20r   USDC)timeDifferenceadjustForTimeDifferencenetworksdefaultNetworkdefaultNetworkstradingAccountId)IOCFOKPOGTD)
marginModetriggerPricetriggerPriceTypetriggerDirectionstopLossPricetakeProfitPriceattachedStopLossTakeProfittimeInForcehedgedtrailingleveragemarketBuyByCostmarketBuyRequiresPriceselfTradePreventionicebergd   Z   )r   limitdaysBacksymbolRequired	untilDays)r   triggerr   r   )r   r   r   r   r   r   r   )r   r   r   daysBackCanceledr   r   r   r   r     )sandboxrI   createOrdersrq   rx   r{   rw   rT   rW   rU   rr   extendsdefault)linearinverse)r   r8   r:   r;   15613151810022001200220032004200520062007200820092010201120122013201520162017201820202021202920353001300230033004300530063007303130323033303430353047304830493051305230633064306530663067600760116012601383018305830683078310831183138315831683178318831983208322)	832783298331833283338334833583368399)HttpInvalidParameterExceptionUNAUTHORIZED_COMMANDQUERY_FILTER_ERRORINVALID_SYMBOL)exactbroad)idname	countriesversion	rateLimitprohas
timeframesurlsr   feesprecisionModeoptionsfeatures
exceptions)deep_extendsuperr0   describeparse_numberr.   r!   r'   r*   r   r"   r   r#   r   r-   r%   r(   r,   r)   r$   r&   r+   )self	__class__s    J/var/www/html/volatility/venv/lib/python3.11/site-packages/ccxt/bullish.pyrL  zbullish.describe!   sk   gt 4 4 = = ? ?hhh %h 	h
 %h %h Uh h "4h th h 'h &th #Dh 'h  '!h" $T#h h$ (%h& t'h( &t)h* %d+h, 5-h. T/h0  1h2 3h4  5h6 &u7h8 +E9h: )$;h< /=h> &t?h@ #EAhB $TChD 'Eh h hF (GhH "4IhJ KhL &tMhN (OhP 1%QhR  ShT +DUhV *5WhX +EYhZ &u[h\ #E]h^ *4_h` $Uahb "5chd *5ehf +Egh h hh #Eihj ukhl  mhn %eohp +Eqhr sht !%uhv  whx dyhz $T{h| +E}h~ %eh@ !%AhB "4ChD dEhF !$GhH "5Ih h hJ tKhL #DMhN  OhP 'QhR $UShT !$UhV *5WhX (YhZ %e[h\ )%]h^ u_h` tahb chd Tehf tghh "5ihj #Ekh h hl %emhn &uohp 'qhr $Usht !$uhv "5whx #Eyhz +E{h| }h~ uh@ uAhB UChD  EhF "5GhH $IhJ DKhL DMh hN dOh hT   jLM 
 QQ  .E $  "A!1 $Q -a	
 %a .q 6q ? 5a 3A 5a =a CA *1 8  4Q!" +A#$ 4Q% .#Q+Q .q .q	
 >q 21 5a J1 Ma H KA G $Q ,Q .q  DQ!" ,Q#$ 78+,/089KL45=>/06701)*67;<=  B &'&'/012*+89;<01)**+ C- -/E EN !&"&!..w77!..w77  ' #$+0  " 
 #*G$ %)    $&+(,,0,1).+06:#'#'"&#(	( ( #($)$)+027/4#()$ $, %)&+!$$&*/%'& & ',#($)*/	# # ',!$$&%'#($)*/$ $ ',!$$&%'#($)*/( ( ',!$$&%'#($)*/5 5 ',!$$%,-%&#($)*/	* 	* ',!$$%%&#($)*/, ,  #iW Wr y
 "9  $	  "9  $	 Eh hTNNN )N *	N
 *N *N JN JN JN JN JN MN JN JN JN  I!N" /#N N$ /%N& J'N( L)N* -+N, J-N. J/N0 J1N2 ,3N4 -5N6 L7N8 L9N: -;N< M=N> ,?N@ -ANB -CND -EN N NF ,GNH JINJ JKNL ,MNN -ONP -QNR -SNT -UNV -WNX -YNZ -[N\ J]N^ ,_N` LaNb McNd LeNf LgN N Nh LiNj LkNl LmNn MoNp MqNr MsNt MuNv NwNx JyNz J{N| -}N~ -N@ -ANB LCND LENF NGNH JIN NJ 0)*&&&**)[N N N` 6@,?*4&/	 aV Vc
hB
 hB
 h h h	    c                 X    |                      |          }|                     |d          S )ae  
        fetches the current integer timestamp in milliseconds from the exchange server

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#tag--time

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns int: the current integer timestamp in milliseconds from the exchange server
        	timestamp)publicGetV1Timesafe_integerrN  paramsresponses      rP  
fetch_timezbullish.fetch_time  s/     ''//   ;777rQ  c                    |                      |          }i }t          dt          |                    D ]}||         }|                     |d          }|                     |          }|                     |d          }|                     |d          }	|||ddd|                     |d          |                     |                     |	                    dddddddi d	|d
||<   |S )a-  
        fetches all available currencies on an exchange

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/assets

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an associative dictionary of currencies
        r   symbolr=  	precisionNminFeeminmax)amountr   crypto)r<  coder=  activerL   r   feer\  limitsr   typeinfo)publicGetV1Assetsrangelensafe_stringsafe_currency_codesafe_numberrM  parse_precision)
rN  rW  rX  resulticurrencyr<  rc  r=  r\  s
             rP  fetch_currencieszbullish.fetch_currencies  s!    ))&11Z q#h--(( 	 	A{H!!(H55B**2..D##Hf55D((;??I ''(;;!..t/C/CI/N/NOO&*488(,T : :     F4LL" rQ  c                     | j         d         r|                                  |                     |          }|                     |          S )a+  
        retrieves data on all markets for ace

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/markets

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: an array of objects representing market data
        r   )rG  load_time_differencepublicGetV1Marketsparse_marketsrV  s      rP  fetch_marketszbullish.fetch_markets.  sM     <12 	(%%'''**622!!(+++rQ  marketc                 	   |                      |d          }|                      |d          }|                      |d          }|                     |          }|                     |          }|dz   |z   }|                      |d          }|                      |d          }	|                      |d          }
|                      |d          }|                      |d	          }|                      |d
          }|                      |d          }|                      |d          }|                      |d          }|                      |d          }|                      |d          }|                      |d          }|                     |          }|                     |                      |d          d          }d}d}d}d}d}d }d }d }d }d }d } d}!|dk    rd}d}|                     |d          }!n|                     |d          }|d|z   z  }||k    }| }|dk    rd}n|                      |d          }|                    d          }"|                      |"d          }#|d|#z   z  }|dk    rd}n||dk    rvd}|                     |d          }|                     |                      |d                    } |d|                     |           z   dz   |                      |"d           z   z  }| 	                    i d!|d|d"|d#|d$|d%|d&|d'|d(|d|d)|!d|d|d|d*|d+|d,|| j
        d-         d.         | j
        d-         d/         ||                     |          || ||                     |          |                     |          d0|                     |          |                     |          d0|                     |          |                     |          d0d d d0d1|                     |                     |
                    |                     |                     |                    |                     |                     |                    |                     |                     |                    |                     |                     |	                    d2|                     |d3          d |d4          S )5Nr[  
baseSymbolquoteSymbol/basePrecisionquotePrecisionquantityPrecisionpricePrecisioncostPrecisionminQuantityLimitmaxQuantityLimitminPriceLimitmaxPriceLimitminCostLimitmaxCostLimitsettlementAssetSymbol
marketTyper8   FTmarginTradingEnabledcontractMultiplier:r:   expiryDatetime-   r;   r<   
optionTypeoptionStrikePrice   r<  basebaseIdquotequoteIdsettlesettleIdrg  r9   contractr   r   r   r   r   r^  )ra  pricecostr   )ra  r  r  r  r  marketEnabled)r   r   contractSizeexpiryr  striker  rf  r\  rd  createdrh  )rl  rm  parse_market_type	safe_boolrn  splitsafe_string_lowerparse_to_numericnumber_to_stringsafe_market_structurerE  	parse8601rM  ro  )$rN  ry  r<  r  r  r  r  r[  r~  r  amountPrecisionr  r  r  r  r  r  r  r  r  r  rg  r8   r:   r;   r<   r  r   r   r  r  r  r  r9   idPartsdateParts$                                       rP  parse_marketzbullish.parse_market<  s   p fh//!!&,77""6=99&&v..''00e#((AA))&2BCC**63FGG))&2BCC((AA++F4FGG++F4FGG((AA((AA''??''??##F,CDD((22%%d&6&6v|&L&LfUU" 
6>>DH^^F,BCCFF++F4HIILcFl"Fu_F jGv~~!%!1!1&:J!K!K((3--++GQ77#.(8##!FFX%%!F!%!7!7!M!MJ!2243C3CFL_3`3`aaFcD$9$9&$A$AACG$JZJZ[bdeJfJfffF)) 5+
"5+
f5+
 D5+
 f	5+

 U5+
 w5+
 f5+
 5+
 D5+
 D5+
 f5+
 D5+
 f5+
 f5+
 5+
  f!5+
" w#5+
$ Yy)'2Yy)'2(nn^44,$  ,,-=>>,,-=>> 
  ,,];;,,];; 
  ,,\::,,\:: 
    & ++D,@,@,Q,QRR**4+?+?+O+OPP))$*>*>}*M*MNN))$*>*>}*M*MNN**4+?+?+O+OPP  nnV_==i5+
 5+
 5+
 5 5 5	rQ  Nrg  defaultTypec                 >    ddddd}|                      |||          S )Nr8   r:   r;   r<   )SPOT	PERPETUALDATED_FUTUREOPTIONrl  )rN  rg  r  typess       rP  r  zbullish.parse_market_type  s4    $	
 
 t[999rQ  r[  r   c           	         |                                   |                     |          }d|d         i}|                     |                     ||                    }|                     |d          }|                     |||dddd          S )ay  
        fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/markets/-symbol-/orderbook/hybrid

        :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(not used by bullish)
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/?id=order-book-structure>` indexed by market symbols
        r[  r<  rS  bidsasksr  priceLevelQuantity)load_marketsry  'publicGetV1MarketsSymbolOrderbookHybridextendrU  parse_order_book)rN  r[  r   rW  ry  requestrX  rS  s           rP  fetch_order_bookzbullish.fetch_order_book  s     	V$$fTl
 ??GU[@\@\]]( %%h<<	$$Xvy&&RY[oppprQ  sincec                    |                                   d}d}|                     |dd          \  }}|r1|                     d||          }|                     d|||||          S |                     |          }d|d         i}|                     ||          }||                     |          |d	<   |                     |                     ||                    }	| 	                    |	|||          S )
a  
        get the list of most recent trades for a particular symbol

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/markets/-symbol-/trades
        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/history/markets/-symbol-/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(max 100)
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: timestamp in ms of the latest trade to fetch
        :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
        :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/?id=public-trades>`
        r   Fre   paginater   r[  r<  N	_pageSize)
r  handle_option_and_paramshandle_pagination_paramsfetch_paginated_call_dynamicry  handle_since_and_untilget_closest_limit%publicGetV1HistoryMarketsSymbolTradesr  parse_trades)
rN  r[  r  r   rW  maxLimitr  ry  r  rX  s
             rP  fetch_tradeszbullish.fetch_trades  s    	88AZ\fgg& 	l22=%PPF44]FESXZ`bjkkkV$$fTl
 ,,UF;;#'#9#9%#@#@GK ==dkk'SY>Z>Z[[    65%@@@rQ  c                    |                                  |                                 g |                     |          }d|i}d}| |                     |          }|d         |d<   |                     |d          }d}	|*|                     |                     ||                    }	nd}
|                     |dd          \  }
}|
r1|                     d||          }| 	                    d||||d	          S | 
                    ||          }||                     |          |d
<   |                     |                     ||                    }	|                     |	|||          S )aU  
        fetch all trades made by the user

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/history/trades

        :param str [symbol]: unified market symbol
        :param int [since]: the earliest time in ms to fetch trades for
        :param int [limit]: the maximum number of trades structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: the latest time in ms to fetch trades for
        :param str [params.orderId]: the order id to fetch trades for
        :param str [params.clientOrderId]: the client order id to fetch trades for
        :param str [params.tradingAccountId]: the trading account id to fetch trades for
        :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/?id=trade-structure>`
        r   Nr<  r[  clientOrderIdFrq   r  r   r  )r  handle_tokenload_accountry  rl  ,privateGetV1TradesClientOrderIdClientOrderIdr  r  r  r  r  r  privateGetV1HistoryTradesr  )rN  r[  r  r   rW  r   r  ry  r  rX  r  s              rP  fetch_my_tradeszbullish.fetch_my_trades  s     
				d//1122,,V44 0
 [[((F &tGH((AA$HHU\^dIeIeffHHH#<<V_V`aaHf m66vVV88&RWY^`fhklll00??F '+'='=e'D'D$* 55dkk'66R6RSSH  65%@@@rQ  r<  c                     |                                   |                     |d          }||                     d|i|          }|                     ||||          S )a  
        fetch all the trades made from a single order

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/history/trades

        :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
        :param str [params.clientOrderId]: the client order id to fetch trades for
        :returns dict[]: a list of `trade structures <https://docs.ccxt.com/?id=trade-structure>`
        r  NorderId)r  rl  r  r  )rN  r<  r[  r  r   rW  r  s          rP  fetch_order_tradeszbullish.fetch_order_trades  sb     	((AA [[)R&99F##FE5&AAArQ  tradec                    |                      |d          }|                     ||          }|d         }|                     |d          }|                      |d          }|                      |d          }|                     |d          }|                     |d          }	|d         }
|                     |
          }|                     |d          }d }|||d	}d }|	rd
}nd}|                      |d          }|                     |||                     |          ||                      |d          |d ||||d |d|          S )Nr[  createdAtTimestampr  quantitysideisTakerr  quoteFee)rr  r  r   r   r  tradeId)rh  rS  datetimer[  r<  orderrg  takerOrMakerr  r  ra  r  re  )	rl  safe_marketrU  r  r  rm  rn  
safe_tradeiso8601)rN  r  ry  marketIdr[  rS  r  ra  r  r  rr  rc  feeCostre  r  r  s                   rP  parse_tradezbullish.parse_trade2  s   d ##E844!!(F33!%%e-ABB	  00!!%44%%eV44..	22'?&&x00""5*55#W55C 	#"LL"L""5)44"Y//""5)44( 
  
   	rQ  c                     |                                   |                     |          }d|d         i}|                     |                     ||                    }|                     ||          S )a  
        fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/markets/-symbol-/tick

        :param str symbol: unified symbol of the market to fetch the ticker for
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `ticker structure <https://docs.ccxt.com/?id=ticker-structure>`
        r[  r<  )r  ry  publicGetV1MarketsSymbolTickr  parse_tickerrN  r[  rW  ry  r  rX  s         rP  fetch_tickerzbullish.fetch_ticker  ss     	V$$fTl
 44T[[&5Q5QRRN   6222rQ  tickerc           	         |                      |d          }|                     ||          }|                     |d          }|                     i d|d         d|d|                     |          d|                      |d          d|                      |d          d|                     |dd          d	|                      |d	          d
|                     |d
d          d|                      |d          d|                      |d          d|                      |d          d|                      |d          d|                      |d          dd d|                      |d          d|                      |d          d|                      |d          |                      |d          |                      |d          |                      |d          |d|          S )Nr[  r  rS  r  highlowbidbestBid	bidVolumeaskbestAsk	askVolumevwapopencloselastpreviousClosechanger   average
baseVolumequoteVolume	markPrice)r  r  r   rh  )rl  r  rU  safe_tickerr  safe_string_2)rN  r  ry  r  rS  s        rP  r  zbullish.parse_ticker  sa   N ##FH55!!(F33%%f.BCC	 !
fX&!
!
 Y//!
 D$$VV44	!

 4##FE22!
 4%%feY??!
 ))&+>>!
 4%%feY??!
 ))&+>>!
 D$$VV44!
 D$$VV44!
 T%%fg66!
 D$$VV44!
 T!
 d&&vx88!
  $**6<@@!!
" t''	::#!
$ **6<@@++FMBB))&+>>+!
 !
 !
, -  	rQ  method	timeframec                    d }|                      ||dd          \  }}d}|                     |d          }||k    r	 |r#|dk    r t          | |          |||||          S  t          | |          ||||          S # t          $ r.}	t	          |	t
                    r|	|dz  }||k    r|	Y d }	~	nd }	~	ww xY w||k    g S )N
maxRetries   r   untilre   r   )r  omitgetattr	Exception
isinstancer,   )
rN  r  r[  r  r   r  rW  r  errorses
             rP  safe_deterministic_callzbullish.safe_deterministic_call  s   
!::66<YZ[[
F67++ 
""
 O+D!D!D07400E5RXYYY07400vNNN   a!233 G!J&&G '&&&&	 
"" 	s   $A> "A> >
B6$B11B6r   c           	         |                                   |                     |          }d}d}|                     |dd          \  }}|r|                     d||||||          S |d         |                     | j        ||          |d}	|                     d|	|          \  }	}|                     |	d          }
|                     |          }d|z  |z  }|}||
| 	                                }
|
|z
  }n ||
|z
  }n|
| 
                    ||          }
|                     |          |	d
<   |                     |
          |	d<   |                     |                     |	|                    }|                     |||||          S )a  
        fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/markets/-symbol-/candle

        :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(max 100)
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: timestamp in ms of the latest entry
        :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
        :returns int[][]: A list of candles ordered, open, high, low, close, volume
        r   Frr   r  r<  )r[  
timeBucketr  createdAtDatetime[lte]r   NcreatedAtDatetime[gte])r  ry  r  "fetch_paginated_call_deterministicrl  rC  handle_until_optionrU  parse_timeframemillisecondssumr  publicGetV1MarketsSymbolCandler  parse_ohlcvs)rN  r[  r  r  r   rW  ry  r  r  r  r  durationmaxDelta	startTimerX  s                  rP  fetch_ohlcvzbullish.fetch_ohlcv  s    	V$$88zZZ& 	|::<QVX]_hjprz{{{Tl**4?IyQQ!
 

 223KWV\]]!!'+CDD''	22(?X-	%%''E(II(II]HHY11E,0LL,C,C(),0LL,?,?()66t{{7F7S7STT   69eUKKKrQ  c           	         |                      |d          |                     |d          |                     |d          |                     |d          |                     |d          |                     |d          gS )Nr  r  r  r  r  volume)rU  rn  )rN  ohlcvry  s      rP  parse_ohlcvzbullish.parse_ohlcvR  s    e%9::UF++UF++UE**UG,,UH--
 	
rQ  c           	         |t          | j        dz             |                                  d}d}|                     |dd          \  }}|r1|                     d||          }|                     d|||||          S |                     |          }|d         st          | j        dz             d	|d
         i}||                     |          |d<   | 	                    ||dd          }| 
                    |                     ||                    }	g }
|                     |	          }t          dt          |                    D ]b}||         }|                     |d          }|
                    |||                     |d          |                     |          |d           c|                     |
d          }|                     ||d	         ||          S )a  
        fetches historical funding rate prices

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/history/markets/-symbol-/funding-rate

        :param str symbol: unified symbol of the market to fetch the funding rate history for
        :param int [since]: not sent to exchange api, exchange api always returns the most recent data, only used to filter exchange response
        :param int [limit]: the maximum amount of funding rate structures to fetch
        :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-rate-history-structure>`
        Nz5 fetchFundingRateHistory() requires a symbol argumentr   Fre   r  r:   z5 fetchFundingRateHistory() supports swap markets onlyr[  r<  r  zupdatedAtDatetime[gte]zupdatedAtDatetime[lte]r   updatedAtDatetimefundingRate)rh  r[  r%  rS  r  rS  )r    r<  r  r  r  r  ry  r!   r  r  *publicGetV1HistoryMarketsSymbolFundingRater  to_arrayrj  rk  rl  appendrn  r  sort_byfilter_by_symbol_since_limit)rN  r[  r  r   rW  r  r  ry  r  rX  ratesrp  rq  entryr  sorteds                   rP  fetch_funding_rate_historyz"bullish.fetch_funding_rate_history\  s    >#DG.e$efff88AZ\fgg& 	x223LeU[\\F445NPVX]_dflnvwwwV$$f~ 	`TW'^^___fTl
 #'#9#9%#@#@GK ,,UF<TVnooBB4;;wX^C_C_`` x((q#f++&& 		 		A1IE''/BCCHLL #//}EE!^^H55$      e[11009I5RWXXXrQ  c                    |                                  |                                 g |                     |          }|                     |dd          }|r1|                     d||          }|                     d||||d          S d}d|i}| |                     |          }|d         |d<   |                     ||          }||                     |          |d	<   d
}	| 	                    |dd|	          \  }	}d}
|	dk    r*| 
                    |                     ||                    }
nG|	d
k    r*|                     |                     ||                    }
nt          | j        dz             |                     |
|||          S )aK  
        fetches information on multiple orders made by the user

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#tag--orders
        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#tag--history

        :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(5, 25, 50, 100, default is 25)
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: timestamp in ms of the latest order to fetch
        :param str [params.tradingAccountId]: the trading account id(mandatory parameter)
        :param str [params.orderId]: the id of the order to fetch for
        :param str [params.clientOrderId]: the client id of the order to fetch for
        :param str [params.status]: filter by order status, 'OPEN', 'CANCELLED', 'CLOSED', 'REJECTED'
        :param bool [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
        :returns Order[]: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
        r  Fr{   r   Nr   r<  r[  r  privateGetV2HistoryOrdersr  privateGetV2Orderszb fetchOrders() method parameter must be either "privateGetV2Orders" or "privateGetV2HistoryOrders")r  r  r  r  r  r  ry  r  r  r  r1  r  r0  r!   r<  parse_orders)rN  r[  r  r   rW  r   r  ry  r  r  rX  s              rP  fetch_orderszbullish.fetch_orders  s   & 
				d//1122,,V44>>&*e<< 	g22=%PPF44]FESXZ`befff 0
 [[((F &tGH,,UF;;#'#9#9%#@#@GK ,66v}hX^__)))< ..t{{7F/K/KLLHH22255dkk'66R6RSSHHTW  (L  L  M  M  M  65%@@@rQ  rW  c                 B   d}|                                  }||z
  }|#||k     rt          | j        dz   |z   dz             |                     |d          }|                     |ddi          }|                     |d          }||                     |d|i          }|S )N    X  z9() only allows fetching entries up to 90 days in the pastr  paginationDirectionbackwardr  )r  r!   r<  r	  r  rU  )rN  r  r  rW  
ninetyDaysnowallowedSincer  s           rP  r  z bullish.handle_pagination_params  s    -
!!Z'EL$8$8TWs]V36qqrrr6:..V&;Z%HII!!&'22=[['388FrQ  r  r  sinceKeyuntilKeyc                 J   |                      |d          }||d}|||z
  }|                     |d          }n4|2|                     ||          }|                                 }||k    r|}|                     |          }|                     |          }	|||<   |	||<   |S )Nr  i $)rU  r	  r  r  r  )
rN  r  rW  r<  r=  r  	timeDeltar:  	sinceDate	untilDates
             rP  r  zbullish.handle_since_and_until  s    !!&'225#4/I}	)6733	22''))3;;EU++IU++I(F8(F8rQ  c                 V    d}|dk    r	|dk     rd}n|dk    r	|dk     rd}n|dk    rd}|S )Nr         3   2   r    )rN  r   pageSizes      rP  r  zbullish.get_closest_limit   sJ    AIIEBJJHHbjjurzzHHRZZHrQ  c           	      b    ddi}|                      ||||                     ||                    S )a  
        fetch all unfilled currently open orders

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#tag--history

        :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
        :param str params['tradingAccountId']: the trading account id(mandatory parameter)
        :returns Order[]: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
        statusOPENr3  r  rN  r[  r  r   rW  r  s         rP  fetch_open_orderszbullish.fetch_open_orders
  s:     f
   t{{7F7S7STTTrQ  c           	      d    ddd}|                      ||||                     ||                    S )a  
        fetches information on multiple canceled orders made by the user

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#tag--orders

        :param str symbol: unified market symbol of the canceled orders
        :param int [since]: timestamp in ms of the earliest order
        :param int [limit]: the max number of canceled orders to return
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.tradingAccountId]: the trading account id(mandatory parameter)
        :returns dict: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
        	CANCELLEDr1  rJ  r  rL  rM  s         rP  fetch_canceled_orderszbullish.fetch_canceled_orders  s@     "*
 
   t{{7F7S7STTTrQ  c           	      d    ddd}|                      ||||                     ||                    S )a  
        fetches information on multiple closed orders made by the user

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#tag--orders

        :param str symbol: unified market symbol of the closed orders
        :param int [since]: timestamp in ms of the earliest order
        :param int [limit]: the max number of closed orders to return
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str params['tradingAccountId']: the trading account id(mandatory parameter)
        :returns dict: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
        CLOSEDr1  rQ  rL  rM  s         rP  fetch_closed_orderszbullish.fetch_closed_orders/  s@     *
 
   t{{7F7S7STTTrQ  c           	      d    ddd}|                      ||||                     ||                    S )a  
        fetches information on multiple canceled orders made by the user

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#tag--history

        :param str symbol: unified market symbol of the closed orders
        :param int [since]: timestamp in ms of the earliest order
        :param int [limit]: the max number of closed orders to return
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.tradingAccountId]: the trading account id(mandatory parameter)
        :returns dict[]: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
        rT  r0  rQ  rL  rM  s         rP   fetch_canceled_and_closed_ordersz(bullish.fetch_canceled_and_closed_ordersB  s@     1
 
   t{{7F7S7STTTrQ  c                 6   |                                  |                                 g |                     |          }d}||                     |          }||d}|                     |                     ||                    }|                     ||          S )a   
        fetches information on an order made by the user

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v2/orders/-orderId-

        :param str id: the 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 str [params.traidingAccountId]: the trading account id(mandatory parameter)
        :returns dict: An `order structure <https://docs.ccxt.com/?id=order-structure>`
        N)r  r   )r  r  r  ry  privateGetV2OrdersOrderIdr  parse_orderrN  r<  r[  rW  r   ry  r  rX  s           rP  fetch_orderzbullish.fetch_orderU  s     
				d//1122,,V44[[((F 0
 
 11$++gv2N2NOO8 &111rQ  r  ra  r  c                 |   |                                  |                                 g |                     |          }|                     |          }d|d         |                                |                     ||          |d}	|dk    p|dk    }
d}|                     |
|dk    |          \  }}|rd}d}|                     |d	d
|          \  }}|                                |d
<   |
s|                     ||          |	d<   | 	                    |d          }|J|
rt          | j        dz             |                     ||          |	d<   d}|                     |d          }|                                |	d<   |                     |                     |	|                    }|                     ||          S )a  
        create a trade order

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#post-/v2/orders

        :param str symbol: unified symbol of the market to create an order in
        :param str type: 'market' or 'limit' or 'STOP_LIMIT' or 'POST_ONLY'
        :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 str [params.clientOrderId]: a custom client order id
        :param float [params.triggerPrice]: the price at which a stop order is triggered at
        :param str [params.timeInForce]: the time in force for the order, either 'GTC'(Good Till Cancelled) or 'IOC'(Immediate or Cancel), default is 'GTC'
        :param bool [params.allowBorrow]: if True, the order will be allowed to borrow assets to fulfill the order(default is False)
        :param bool [params.postOnly]: if True, the order will only be posted to the order book and not executed immediately(default is False)
        :param str params['traidingAccountId']: the trading account id(mandatory parameter)
        :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
        V3CreateOrderr<  )commandTyper[  r  r  r   ry  MARKETF	POST_ONLYGTCrI   r   r  r   Nz5 createOrder() does not support market trigger orders	stopPrice
STOP_LIMITrg  )r  r  r  ry  upperamount_to_precisionhandle_post_onlyr  price_to_precisionrl  r+   r<  r	  privatePostV2Ordersr  rZ  )rN  r[  rg  r  ra  r  rW  r   ry  r  isMarketOrderpostOnlyr   r   rX  s                  rP  create_orderzbullish.create_order  s   ( 
				d//1122,,V44V$$*TlJJLL00@@ 0
 
 (*?tx/?00@SU[\\& 	D";;FMS`bmnnV + 1 1 3 3} 	F#66vuEEGG''??# f"47-d#deee#'#:#:6<#P#PGK DYYv~66F**,,++DKK,H,HII &111rQ  c                 |   |                                  |                                 g |                     |          }|                     |          }	d|	d         |d}
|                     |d          }|||
d<   ||                                |
d<   |                     |dd	          }|r|                     |d          }d
|
d<   ||                     ||          |
d<   || 	                    ||          |
d<   | 
                    |                     |
|                    }|                     ||	          S )aF  
        edit a trade limit order

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#post-/v2/command-amend

        :param str id: order id
        :param str [symbol]: unified symbol of the market to create an order in
        :param str [type]: 'limit' or 'POST_ONLY'
        :param str [side]: not used by bullish editOrder
        :param float [amount]: how much of the currency you want to trade in units of the base currency
        :param float [price]: the price for the order, in units of the quote currency, ignored in market orders
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.traidingAccountId]: the trading account id(mandatory parameter)
        :param bool [params.postOnly]: if True, the order will only be posted to the order book and not executed immediately(default is False)
        :param str [params.clientOrderId]: a unique identifier for the order, automatically generated if not sent
        :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
        V1AmendOrderr<  )r_  r[  r   r  Nr  rg  rk  Fra  r  r  )r  r  r  ry  rl  re  r  r	  rf  rh  privatePostV2Commandr  rZ  )rN  r<  r[  rg  r  ra  r  rW  r   ry  r  r  rk  rX  s                 rP  
edit_orderzbullish.edit_order  sS   $ 
				d//1122,,V44V$$)Tl 0
 

 ((AA !#GI"jjllGFO>>&*e<< 	*YYvz22F)GFO"&":":66"J"JGJ#66vuEEGG,,T[[&-I-IJJ&111rQ  c                    |                                  |                                 g |                     |          }|t          | j        dz             |                     |          }|d         ||                     |dd          |d}|                     |                     ||                    }| 	                    ||          S )as  
        cancels an open order

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#post-/v2/command-cancellations

        :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 str params['commandType']: the command type, default is 'V3CancelOrder'(mandatory parameter)
        :param str [params.traidingAccountId]: the trading account id(mandatory parameter)
        :returns dict: An `order structure <https://docs.ccxt.com/?id=order-structure>`
        Nz) cancelOrder() requires a symbol argumentr<  r_  V3CancelOrder)r[  r   r_  r  )
r  r  r  r    r<  ry  rl  ro  r  rZ  r[  s           rP  cancel_orderzbullish.cancel_order  s     
				d//1122,,V44>#DG.Y$YZZZV$$Tl 0++FM?SS	
 
 ,,T[[&-I-IJJ &111rQ  c                 f   |                                  |                                 g |                     |          }d|i}d}|&|                     |          }|d         |d<   d|d<   nd|d<   |                     |                     ||                    }|g}|                     ||          S )a  
        cancel all open orders in a market

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#post-/v2/command-cancellations

        :param str [symbol]: alpaca cancelAllOrders cannot setting symbol, it will cancel all open orders
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str params['traidingAccountId']: the trading account id(mandatory parameter)
        :returns dict[]: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
        r   Nr<  r[  V1CancelAllOrdersByMarketr_  V1CancelAllOrders)r  r  r  ry  ro  r  r2  )rN  r[  rW  r   r  ry  rX  orderss           rP  cancel_all_orderszbullish.cancel_all_orders  s     
				d//1122,,V44 0
 [[((F &tGH%@GM""%8GM",,T[[&-I-IJJ   000rQ  r  c                 v   |                      |d          }||                     |          }|                     ||          }|                      |d          }|                     |d          }|                      |d          }|                     |d          }|                      |d          }	|                      |d          }
|                      |d          }|                     |                      |d	                    }|d
k    r|                      |d          }|dk    rd}|                      |d          }|                      |d          }|                      |d          }i }|                     |d          }|||d<   |d         |d<   |                      |d          }|                     i d|d|                      |d          d|d|                     |          dd d	|d|d| 	                    |          d|d|dk    d|d|	d|d|
d|d d d|d |||d!|          S )"Nr[  r  r  rg  r  r  r  quantityFilledrJ  closedstatusReasonzUser cancelledcanceledr   rc  quoteAmountr  r  r  rr  averageFillPricer<  r  rS  r  lastTradeTimestamprk  ra  r   ra  filled	remaining)tradesre  rh  r  )
rl  r  safe_symbolrU  r  parse_order_statusrn  
safe_orderr  parse_order_type)rN  r  ry  r  r[  r<  rS  rg  r  r  ra  r  rJ  r|  r   rc  r  re  r  r  s                       rP  rZ  zbullish.parse_order1  s   d ##E844>%%h//F!!(F33eY//%%e-ABB	v..%%eV44  00!!%44!!%)9::(()9)9%)J)JKKX++E>BBL///#&&um<<$$UK88	}55##E:66"CK$WoC
O""5*<==  
" 
T--e_EE 
  
 Y//	 

 !$ 
 f 
 f 
 D))$// 
 ; 
 + 
 D 
 U 
 I 
 f 
 f 
  ! 
" D# 
$ + 
  
  
, -  	rQ  rJ  c                 >    ddddd}|                      |||          S )Nr  r{  r}  rejected)rK  rT  rP  REJECTEDr  rN  rJ  statusess      rP  r  zbullish.parse_order_status  s4    #"	
 
 &&999rQ  c                 >    ddddd}|                      |||          S )Nr   ry  )LMTMKTra  rd  r  rN  rg  r  s      rP  r  zbullish.parse_order_type  s4     !	
 
 tT222rQ  rc  c                     |                                  |                                 g i }|                     d||          \  }}|                     |d          }||                     |          |d<   ||                     |          |d<   |                     |                     ||                    }|                     |dg           }d}	||                     |          }	| 	                    ||	||          S )a  
        fetch history of deposits and withdrawals

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/wallets/transactions

        :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 is None
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a list of `transaction structure <https://docs.ccxt.com/?id=transaction-structure>`
        r  Nr  data)
r  r  r  rU  r  privateGetV1WalletsTransactionsr  	safe_listrr  parse_transactions)
rN  rc  r  r   rW  r  r  rX  r  rr  s
             rP  fetch_deposits_withdrawalsz"bullish.fetch_deposits_withdrawals  s    
				d//1122223KWV\]]!!'+CDD04U0C0CG,-04U0C0CG,-77GV8T8TUUF ~~h33}}T**H&&tXueDDDrQ  addresstagc                    |                                  |                                 g |                     |          }dd||d         |                     ||          di}d}|                     |          \  }}||                     |          |d<   nt          | j        dz             |                     | 	                    ||                    }	| 
                    |	|          S )a  
        make a withdrawal

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#post-/v1/wallets/withdrawal

        :param str code: unified currency code
        :param float amount: the amount to withdraw
        :param str address: the address to withdraw to
        :param str [tag]:
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str params['timestamp']: the timestamp of the withdrawal request(mandatory)
        :param str params['nonce']: the nonce of the withdrawal request(mandatory)
        :param str params['network']: network for withdraw(mandatory)
        :returns dict: a `transaction structure <https://docs.ccxt.com/?id=transaction-structure>`
        command
V1Withdrawr<  )r_  destinationIdr[  r  Nnetworkz( withdraw() requires a network parameter)r  r  rr  currency_to_precisionhandle_network_code_and_paramsnetwork_code_to_idr    r<  privatePostV1WalletsWithdrawalr  parse_transaction)
rN  rc  ra  r  r  rW  rr  r  networkCoderX  s
             rP  r   zbullish.withdraw  s      
				d//1122==&&+!("4. 66tVDD	 
  "AA&IIV"!%!8!8!E!EGI#DG.X$XYYY66t{{7F7S7STT %%h999rQ  transactionrr  c                 D   |                      |d          }|                      |d          }|                     |                      |d                    }|                     |                      |d                    }|                      |d          }|                     |d          }|                      |d          }	|                      |d          }
|                     |d	          }|                      |d
          }|                     ||          }|                      |d          }|                     |dg           }|                     |di           }|                      |d          }d d d d}|                     |d          }|
||d<   ||d<   i d|d|	d|d|                     |          d|                     |          d|d|
d|
d|d|                     |          d|d| 	                    |          d|dd dd dd dd d ||dS ) NcustodyTransactionId	directioncreatedAtDateTimeupdatedAtDateTimer  transactionDetailsblockchainTxIdr  r  r[  rJ  sourcesr   )rr  r  ratere  r  rr  r<  txidrS  r  addressFrom	addressTora  rg  updatedtagFromr  tagTocomment)internalre  rh  )
rl  r  	safe_dictrn  rm  r  r  network_id_to_codeparse_transaction_typeparse_transaction_status)rN  r  rr  r<  rg  rS  r  r  r  r  r  ra  
currencyIdrc  rJ  r  sourcesourceAddressre  r  s                       rP  r  zbullish.parse_transaction  s   4 k+ABB[99NN4#3#3KAT#U#UVV	..!1!1+?R!S!STT"";	::!^^K9MNN 24DEE""#5yAA!!+z::%%k8<<
&&z8<<!!+x88..!3YCCB//((;;
 

 "";66!CK"C
O
"
D
 
 Y//	

 t..w77
 =
 w
 
 f
 D//55
 
 d33F;;
 w
 t
 4
  T!
" t#
$ )
 
 
 	
rQ  c                 :    ddd}|                      |||          S )NrL   
withdrawal)DEPOSITWITHDRAWr  r  s      rP  r  zbullish.parse_transaction_typeZ  s.     $
 
 tT222rQ  c                 >    ddddd}|                      |||          S )Nokfailedpendingr}  )COMPLETEFAILEDPENDINGrP  r  r  s      rP  r  z bullish.parse_transaction_statusa  s4     #	
 
 &&999rQ  c                 j   d }|                      |dd          \  }}|q|                     |          }t          dt          |                    D ]>}||         }|                     |d          }|dk    r|                     |d          } n?|t          | j        dz             || j        d<   |S )Nrq   r   r   tradingAccountNamezPrimary Accountz loadAccount() requires a tradingAccountId parameter in options["tradingAccountId"] or params["tradingAccountId"], fetchAccounts() was not able to find the Primary account)r  #privateGetV1AccountsTradingAccountsrj  rk  rl  r    r<  rG  )rN  rW  r   rX  rq  accountr=  s          rP  r  zbullish.load_accountj  s     $#'#@#@Zl#m#m &#??GGH1c(mm,,  "1+''1EFF,,,'+'7'7AS'T'T$E - ##DG  /\  %\  ]  ]  ]+;'(rQ  c                     |                                  |                                 g |                     |          }|                     ||          S )a|  
        fetch all the accounts associated with a profile

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#tag--trading-accounts

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a dictionary of `account structures <https://docs.ccxt.com/?id=account-structure>` indexed by the account type
        )r  r  r  parse_accountsrV  s      rP  fetch_accountszbullish.fetch_accountsz  sS     
				d//1122;;FCC` ""8V444rQ  r  c                 8    |                      |d          d d |dS )Nr   )r<  rg  rc  rh  r  )rN  r  s     rP  parse_accountzbullish.parse_account  s.    ""7,>??	
 
 	
rQ  c                    |                                  |                                 g |                     |          }d|d         i}|                     |                     ||                    }|                     |          }t          |          }|                     |di           }d}	|                     |          \  }	}|	du}
|dk    s|
r|	| 	                    |          }	|	pt          dt          |                    D ]N}|                     ||i           }|                     |d          }|                     |          }|	|k    r|} nO|
ri }|                     ||          S )a  
        fetch the deposit address for a currency associated with self account

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/wallets/deposit-instructions/crypto/-symbol-

        :param str code: unified currency code
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str [params.network]: network for deposit address
        :returns dict: an `address structure <https://docs.ccxt.com/?id=address-structure>`
        r[  r<  r   Nr   r  )r  r  rr  2privateGetV1WalletsDepositInstructionsCryptoSymbolr  r'  rk  r  r  default_network_coderj  rl  r  parse_deposit_address)rN  rc  rW  rr  r  rX  safeResponselengthr  r  networkDefinedByUserrq  r,  	networkIdr  s                  rP  fetch_deposit_addresszbullish.fetch_deposit_address  s    
				d//1122==&&htn
 JJ4;;W^`fKgKghh }}X..\""~~lAr22==fEE&d2QJJ0J33D99"q#l"3"344  A NN<B??E $ 0 0	 B BI"&"9"9)"D"DK+--$ . ( D))$999rQ  c                     |                      |d          }|                      |d          }||                     ||          |                     |          |                      |d          d dS )Nr[  r  r  )rh  rr  r  r  r  )rl  rm  r  )rN  depositAddressrr  r<  r  s        rP  r  zbullish.parse_deposit_address	  sx    nh77"">9=="//H==..w77''	BB
 
 	
rQ  c                    |                                  |                                 g |                     |          }d|i}d}|                     |d          }|]|                     |          d         |d<   |                     |                     ||                    }|                     ||          S |                     |                     ||                    }| 	                    |          S )a  
        query for balance and get the amount of funds available for trading or funds locked in orders

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/accounts/asset
        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/accounts/asset/-symbol-

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str params['tradingAccountId']: the trading account id(mandatory parameter)
        :param str [params.code]: unified currency code, default is None
        :returns dict: a `balance structure <https://docs.ccxt.com/?id=balance-structure>`
        r   Nrc  r<  r[  )
r  r  r  rl  rr  privateGetV1AccountsAssetSymbolr  !parse_balance_for_single_currencyprivateGetV1AccountsAssetparse_balance)rN  rW  r   r  rX  rc  s         rP  fetch_balancezbullish.fetch_balance	  s     
				d//1122,,V44 0
 // $d 3 3D 9GH;;DKKQW<X<XYYH99(DIII55dkk'66R6RSSH" %%h///rQ  c                     d|i}|                                  }|                     |d          |d<   |                     |d          |d<   |||<   |                     |          S )Nrh  availableQuantityfreelockedQuantityused)r  rl  safe_balance)rN  rX  rc  rp  r  s        rP  r  z)bullish.parse_balance_for_single_currencyF	  sj    ),,..**85HII**85EFFt  (((rQ  c                 p   d|i}t          dt          |                    D ]}||         }|                     |d          }|                     |          }|                                 }|                     |d          |d<   |                     |d          |d<   |||<   |                     |          S )Nrh  r   assetSymbolr  totalr  r  )rj  rk  rl  rm  r  r  )rN  rX  rp  rq  balancer[  rc  r  s           rP  r  zbullish.parse_balanceN	  s    H
 q#h--(( 	# 	#AqkG%%g}==F**622DllnnG#//9LMMGG"..w8HIIGFO"F4LL  (((rQ  symbolsc                 2   |                                  |                                 g |                     |          }d|i}|                     |                     ||                    }|                     ||          }|                     |d|d          S )a  
        fetch all open positions

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/derivatives-positions

        :param str[]|None symbols: list of unified market symbols
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param str params['tradingAccountId']: the trading account id
        :returns dict[]: a list of `position structure <https://docs.ccxt.com/?id=position-structure>`
        r   r[  F)r  r  r   privateGetV1DerivativesPositionsr  parse_positionsfilter_by_array_positions)rN  r  rW  r   r  rX  resultss          rP  fetch_positionszbullish.fetch_positions\	  s     
				d//1122,,V44 0
 88Wf9U9UVV, &&x99--gx%PPPrQ  positionc                 ,   |                      |                     |d          |          }|d         }|                     |d          }|                     |d          }|                     i d|dd d|d|d|                     |          d|                     |d	          d
d d|                     |          d|                     |d          dd dd dd dd d|                     |d          dd dd dd d d d d d d d d d d d
          S )Nr[  r  r  rh  r<  rS  r  lastUpdateTimestampupdatedAtTimestampr   	contractsr  r  
entryPricer   	lastPricenotionalr   
collateralinitialMargin)
initialMarginPercentagemaintenanceMarginmaintenanceMarginPercentageunrealizedPnlliquidationPricer   marginRatior   r   r   )r  rl  rU  safe_positionr  parse_position_sidern  )rN  r  ry  r[  rS  r  s         rP  parse_positionzbullish.parse_position	  s   , !!$"2"28X"F"FOO!%%h0DEE	&11!! #
H#
$#
 f#
 	#

 Y//#
 "4#4#4X?S#T#T#
 d#
 D,,T22#
 ))(J??#
 D#
 $#
 #
 #
 ((:>>#
 #
  $!#
" T##
$ (,!%+/! $!#7#
 #
 #
   	rQ  c                 :    ddd}|                      |||          S )Nlongshort)BUYSELLr  )rN  r  sidess      rP  r  zbullish.parse_position_side	  s.    
 
 tT222rQ  c                    |                                  |                                 g |                     |          }d}d}|                     |dd          \  }}|r1|                     d||          }|                     d|||||          S d|i}d}	| |                     |          }	|	d         |d<   |                     |d	          }
|.|
,|                                 }| 	                    |d	|i          }| 
                    ||          }||                     |          |d
<   |                     | 	                    ||                    }|                     ||	||          S )a  
        fetch a history of internal transfers made on an account

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/history/transfer

        :param str code: unified currency code of the currency transferred
        :param int [since]: the earliest time in ms to fetch transfers for
        :param int [limit]: the maximum number of transfer structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int params['until']: the latest time in ms to fetch transfers for(default time now)
        :param str params['tradingAccountId']: the trading account id
        :returns dict[]: a list of `transfer structures <https://docs.ccxt.com/?id=transfer-structure>`
        r   Fr   r  r   Nr<  r  r  r  )r  r  r  r  r  r  rr  rU  r  r  r  r  privateGetV1HistoryTransferparse_transfers)rN  rc  r  r   rW  r   r  r  r  rr  r  r:  rX  s                rP  fetch_transferszbullish.fetch_transfers	  s    
				d//1122,,V4488AQS]^^& 	m223CUFSSF445EtUTY[acklll 0
 "}}T**H%-d^GM"!!&'22M##%%C[['388F,,UF;;#'#9#9%#@#@GK 33DKK4P4PQQ" ##HhuEEErQ  fromAccount	toAccountc                    |                                  |                                 g |                     |          }d|d         |                     ||          ||d}|                     |                     ||                    }|                     | j        di           }	|                     |	dd          }
| 	                    ||          }|
r||d<   ||d<   ||d	<   ||d
<   |S )uQ  
        transfer currency internally between wallets on the same account

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#post-/v1/command-commandType-V1TransferAsset

        :param str code: unified currency codeåå
        :param float amount: amount to transfer
        :param str fromAccount: account ID to transfer from
        :param str toAccount: account ID to transfer to
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `transfer structure <https://docs.ccxt.com/?id=transfer-structure>`
        V2TransferAssetr<  )r_  r  r  fromTradingAccountIdtoTradingAccountIdr   fillResponseFromRequestTr  r  ra  rr  )
r  r  rr  r  ro  r  r  rG  r  parse_transfer)rN  rc  ra  r  r  rW  rr  r  rX  transferOptionsr  r   s               rP  r   zbullish.transfer	  s    
				d//1122==&&,#D>224@@$/"+
 
 ,,T[[&-I-IJJ ..z2FF"&..B[]a"b"b&&x::" 	(&1H]#$-H[!!'HX#'HZ rQ  c           
         |                      |d          }|                     |d          }|                     |d          }||                     |d          }|                     |d          ||                     |          |                     ||          |                     |d          |                     |d          |                     |d          |                     |          |d		S )
Nr  r  rJ  message	requestIdr  r  r  )	r<  rS  r  rr  ra  r  r  rJ  rh  )rU  rl  r  rm  rn  parse_transfer_status)rN  r   rr  rS  r  rJ  s         rP  r  zbullish.parse_transfer$
  s    , %%h0DEE	%%h>>
!!(H55>%%h	::F""8[99"Y////
HEE&&x<<++H6LMM))(4HII0088

 

 
	
rQ  c                 >    ddddd}|                      |||          S )Nr  r  r  )rT  rK  r  z$Command acknowledged - TransferAssetr  r  s      rP  r  zbullish.parse_transfer_statusK
  s4     48	
 
 &&999rQ  c                 @   |                                  |                                 g |                     |          }|                     |          }|d         |d}|                                 }|}	|                     d||          \  }}|                     |d          }
|	|dz
  }	|
|}
|                     |	          |d<   |                     |
          |d<   |                     | 	                    ||                    }| 
                    ||||          S )a  
        retrieves a history of a currencies borrow interest rate at specific time slots

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/history/borrow-interest

        :param str code: unified currency code
        :param int [since]: timestamp for the earliest borrow rate
        :param int [limit]: the maximum number of `borrow rate structures <https://docs.ccxt.com/?id=borrow-rate-structure>` to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int params['until']: the latest time in ms to fetch entries for
        :param str params['tradingAccountId']: the trading account id
        :returns dict[]: an array of `borrow rate structures <https://docs.ccxt.com/?id=borrow-rate-structure>`
        r<  )r  r   r  Nr5  r  )r  r  r  rr  r  r  rU  r  !privateGetV1HistoryBorrowInterestr  parse_borrow_rate_history)rN  rc  r  r   rW  r   rr  r  r:  startTimestampr  rX  s               rP  fetch_borrow_rate_historyz!bullish.fetch_borrow_rate_historyT
  s3    
				d//1122,,V44==&&#D> 0
 
 !!223KWV\]]!!'+CDD! #;;N=E,0LL,H,H(),0LL,?,?()99$++gv:V:VWW --heUKKKrQ  c                     |                      |d          }|                     |d          }|                     ||          |                     |d          d||                     |          |dS )Nr  r  borrowedQuantity \&)rr  r  periodrS  r  rh  )rU  rl  rm  rn  r  )rN  rh  rr  rS  r  s        rP  parse_borrow_ratezbullish.parse_borrow_rate
  s}     %%d,@AA	%%dM::
//
HEE$$T+=>>"Y//
 
 	
rQ  c                 F    |                                  | j        d         z
  S )Nr   )r  rG  )rN  s    rP  get_timestampzbullish.get_timestamp
  s!      ""T\2B%CCCrQ  c                     |                                   |                     |          }d|d         i}|                     |                     ||                    }|                     ||          S )a  
        fetches the open interest of a specific market

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#get-/v1/markets/-symbol-/tick

        :param str symbol: unified symbol of the market to fetch the open interest for
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `open interest structure <https://docs.ccxt.com/?id=ticker-structure>`
        r[  r<  )r  ry  r  r  parse_open_interestr  s         rP  fetch_open_interestzbullish.fetch_open_interest
  ss     	V$$fTl
 44T[[&5Q5QRRN ''&999rQ  c                     |                      |d          }|                     ||                      |d          |d |                      |d          |                      |d          |d d|          S )NopenInterestr[  r  createdAtDatetime)rh  r[  openInterestAmountopenInterestValuerS  r  r  r  )rl  safe_open_interest)rN  interestry  r.  s       rP  r+  zbullish.parse_open_interest
  s    N ''.AA&&&&vx88".!%))(4HII((3FGG&	(
 	(
 	 	 		rQ  r   GETc                    |                      ||                     |                    }d|                     ||          z   }| j        d         |         |z   }	|dk    r|                                  t          |                                           }
t          |                                           }|dk    rb||
z   |z   dz   |z   }|                     | 	                    |          | 	                    | j
                  t          j        d          }||
|d}n|dk    r|                     |          }||
z   |z   dz   |z   |z   }|                     | 	                    |          d	d          }|                     | 	                    |          | 	                    | j
                  t          j        d          }||
|d
d}d
|d<   |                     |d          }|||d<   |dk    r| j        |d<   n(| j        }|t%          | j        dz             d|z   |d<   |dk    r,|                     |          }t+          |          r|	d|z   z  }	|	|||dS )Nr}  r   r   r4  z/trading-api/hex)BX-TIMESTAMPBX-NONCEBX-SIGNATUREPOSTsha256zapplication/json)r7  r8  r9  Content-Typer<  rateLimitTokenzBX-RATE-LIMIT-TOKENr   zBX-PUBLIC-KEYz- requires a token, please call signIn() firstzBearer Authorization?)urlr  bodyheaders)r	  extract_paramsimplode_paramsrD  check_required_credentialsstrmicrosecondsr)  hmacencodesecrethashlibr;  jsonhashrl  apiKeytokenr   r<  	urlencoderk  )rN  pathr   r  rW  rB  rA  r  endpointr@  noncerS  payload	signaturedigestr=  rO  querys                     rP  signzbullish.sign  s   ))FD$7$7$=$=>>,,T6:::is#h.)++---))++,,ED..0011I#e+f4FM IIdkk'&:&:DKK<T<TV]Vdfkll	$- %$- 
 6!!yy((#e+f4FMPTT4;;w#7#75II IIdkk&&9&94;;t{;S;SU\Ucejkk	$- %$-$6	  +='!%!1!1';K!L!L!-5CG12,,,+/;((
M-dg8g.ghhh+4u+<(U??NN7++E5zz #sU{"fdwOOOrQ  c                 
   |                      |          }|                     |d          }|                     |d          }|| j        d<   || _        |                     |                                 d          | j        d<   |S )aF  
        sign in, must be called prior to using other authenticated methods

        https://api.exchange.bullish.com/docs/api/rest/trading-api/v2/#overview--add-authenticated-request-header

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns: response from exchange
        rO  
authorizerr%  tokenExpires)privateGetV1UsersHmacLoginrl  rG  rO  r  r  )rN  rW  rX  rO  rZ  s        rP  sign_inzbullish.sign_in4  s     226::   733%%h==
%/\"
'+xx0A0A0C0CEX'Y'Y^$rQ  c                     |                                  }| j        }|                     | j        d          }||||k    r|                                 S | j        S )Nr[  )r  rO  rU  rG  r]  )rN  rW  r:  rO  r[  s        rP  r  zbullish.handle_tokenL  s[    !!
((~FFM|3|9K9K<<>>!:rQ  httpCodereasonr@  rB  rA  c
                    |d S |                      |d          }
|                      |d          }|
|
dk    r|
dk    s||dk    rd}|                      |d          }||}n|}| j        dz   |z   }|                     | j        d	         ||           |                     | j        d
         ||           |                     | j        d	         |
|           t          |          d S )N	errorCoderg  01001r6  r   errorCodeNamer6  r:  r;  )rl  r<  throw_exactly_matched_exceptionrI  throw_broadly_matched_exceptionr   )rN  r_  r`  r@  r  rB  rA  rX  requestHeadersrequestBodyrc  rg  r  re  feedbacks                  rP  handle_errorszbullish.handle_errorsU  s   4 +66&11TEUZ^  cB  [B  [BG ,,XGGM('w}t+H001I7T\]]]001I7T\]]]001I4QYZZZ)))trQ  )N)^__name__
__module____qualname__r   rL  r   rY  r	   rs  r   r   rx  dictr  rF  r   r  r   r  r   r  r  r  r  r   r  r  r  listr  r"  r   r.  r   r3  r  r  r  rN  rR  rU  rW  r\  r   r   floatr   rl  rp  rs  rx  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)  r   r,  r+  rX  r]  r  intrk  __classcell__)rO  s   @rP  r0   r0      s	       i# i i i i i iV !# 8 8s 8 8 8 8$ ') N NZ N N N N` $& , ,$v, , , , ,D4 DF D D D DL
: :c : :s : : : : :>b %q %qs %q3 %qY %q %q %q %qN 6:UW -A -A3 -As -A# -A\`af\g -A -A -A -A^ -1tRV_a ;A ;Ac ;A ;AC ;Afjkpfq ;A ;A ;A ;Az 9=4^bkm B BS B# BS BX[ Brvw|r} B B B B(T T Tv T T T T Tl 02 63 633 63f 63 63 63 63p@ @4 @ @6 @ @ @ @D BFTXgk  C  LN  c 3 c ad x{    * 26DW[df 9L 9L# 9Lc 9LQT 9Lkoptku 9L 9L 9L 9Lv
 
 
4 
 
 
 
 8<$]ajl 8Y 8Y 8YC 8YWZ 8Yqu  wI  rJ 8Y 8Y 8Y 8Yt *.Dt\^ IA IA3 IAc IA IAcghmcn IA IA IA IAV BFVX  s 3 t ]a     37r[s  F^  C  UX   @C   cg    $s s     /3TXac U U U3 Uc Uhlmrhs U U U U$ 37TX\eg U UC Us URU Ulpqvlw U U U U& 154VZce U U# US UPS Ujnotju U U U U& >BPTcgpr U Us U# U]` Uw{  }B  xC U U U U& 26b 12 12c 123 12U 12 12 12 12f gksu 92 923 92i 92y 92RW 92`c 92z 92 92 92 92v `drv  @B (2 (2S (2# (2Y (2i (2Y\ (2lo (2 (2 (2 (2T 37r !2 !2s !2C !2e !2 !2 !2 !2F /32 1 1 1$u+ 1 1 1 1Ba a av a a a a aF: : : : :3S 3 3 3 3 6:[_hj ;E ;Es ;E# ;EUX ;Eost  pA ;E ;E ;E ;Ez KOWY ,: ,:S ,:% ,:# ,:C ,:^i ,: ,: ,: ,:\G
 G
T G
X G
Q\ G
 G
 G
 G
R3 3 3:s : : : : #%          %' Z5 Z54= Z5 Z5 Z5 Z5x
T 
g 
 
 
 
 79 0: 0:# 0:^ 0: 0: 0: 0:d	
 	
h 	
R` 	
 	
 	
 	
 $& )0 )0( )0 )0 )0 )0V) ) ) ) ) )) ) ) ) ) 26b 'Q 'Qw 'QT(^ 'Q 'Q 'Q 'QR6 6t 6V 6 6 6 6p3 3 3 3 3 +/TPT]_ 6F 6FC 6Fs 6F# 6Fdhivdw 6F 6F 6F 6Fp [] & &S &% &c &c &an & & & &P%
 %
 %
 %
 %
 %
N: : : AESW`b -L -Lc -L# -LS -L -L -L -L^
 
 
 
 
 
,D D D 79 6: 6:# 6:\ 6: 6: 6: 6:p1 1F 1 1 1 1f &eBSW +P +P +P +PZ      0 #%    c 3 S # X\ dg        rQ  r0   )4ccxt.base.exchanger   ccxt.abstract.bullishr   rK  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   typingr   ccxt.base.errorsr   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   ccxt.base.decimal_to_precisionr.   r0   rG  rQ  rP  <module>rz     s   ( ' ' ' ' ' - - - - - -  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~       * * * * * * 0 0 0 0 0 0 - - - - - - . . . . . . ' ' ' ' ' ' & & & & & & . . . . . . ) ) ) ) ) ) . . . . . . + + + + + + ) ) ) ) ) ) * * * * * * - - - - - - - - - - - - ) ) ) ) ) ) . . . . . . ) ) ) ) ) ) 4 4 4 4 4 4T- T- T- T- T-h T- T- T- T- T-rQ  