
    E#i                       S SK Jr  S SKJ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  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!J"r"  S SK#J$r$   " S S\\5      r%g)    )Exchange)ImplicitAPI)AnyBalances
CurrenciesCurrencyIntMarketNumOrder	OrderBook	OrderSide	OrderTypeStrStringsTickerTickersTradeTransaction)List)ExchangeError)AuthenticationError)ArgumentsRequired)
BadRequest)	BadSymbol)InsufficientFunds)OrderNotFound)ExchangeNotAvailable)	TICK_SIZE)Precisec                     ^  \ 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S	S	0 4S
\S\S\S\S\\   4
S jjrS@S\S\4S jjrS	0 4S
\S\S\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\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S	S	S	0 4S
\S\S\4S jjrS	0 4S
\S\S\S\S\4
S jjrS	0 4S\S
\4S jjr S	0 4S
\4S jjr!S@S\	S\S\4S jjr"S \4S! jr#S" r$S# r%S	0 4S$\&S\'4S% jjr(0 4S
\S\)4S& jjr*S@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.S@S+\	S\S\,4S, jjr/0 4S\04S- jjr1S\04S. jr2S	S	S	0 4S/\S\S\S\\3   4S0 jjr4S@S1\	S2\5S\34S3 jjr6S4 r7S \4S5 jr8S6S70 S	S	4S8 jr9S/\:S9\S:\S;\S<\	S=\4S> jr;S?r<U =r=$ )Abitteam   returnc                 f  > U R                  [        [        U ]  5       0 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_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_S0S_S1S_E0 S2S_S3S_S4S_S5S_S6S_S7S_S8S_S9S_S:S_S;S_S<S_S=S_S>S_S?S_S@S_SAS_SBS_E0 SCS_SDS_SES_SFS_SGS_SHS_SIS_SJS_SKS_SLS_SMS_SNS_SOS_SPS_SQS_SRS_SSS_E0 STS_SUS_SVS_SWS_SXS_SYS_SZS_S[S_S\S_S]S_S^S_S_S_S`S_SaS_SbS_ScS_SdS_E0 SeS_SfS_SgS_ShS_SiS_SjS_SkS_SlS_SmS_SnS_SoS_SpS_SqS_SrS_SsS_StS_SuS_E0 SvS_SwS_SxS_SyS_SzS_S{S_S|S_S}S_S~S_SS_SS_SS_SS_SS_SS_SS_SS_ESSSSSSSSSS.	E_SSSSSSS._SSSSSS.SSS/S._SSSS
00S0 SS
_SS
_SS
_SS
_SS
_SS
_SS
_SS
_SS
_SS
_SS
_SS
_SS
_SS
_SS
_SS
_0S
S
S
S
S
S.S
S
S
S.S.S._SSSSSU R	                  S5      U R	                  S5      S.0_S[
        _S0 SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS0ESSS.S._SSSSS S SSS SSSSS.SSSSSSSS.S SSSSS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.	S S S.S S S.S._S[        [        [        [        S.[        [        [        [        [        [        [        [        [        [        [        [        S.S._5      $ )Nidr"   namezBIT.TEAM	countriesUKversionzv2.0.6	rateLimit   	certifiedFprohasCORSspotTmarginswapfutureoption	addMarginborrowCrossMarginborrowIsolatedMarginborrowMargincancelAllOrderscancelOrdercancelOrderscloseAllPositionsclosePositioncreateDepositAddresscreateOrder$createOrderWithTakeProfitAndStopLoss&createOrderWithTakeProfitAndStopLossWscreatePostOnlyOrdercreateReduceOnlyOrdercreateStopLimitOrdercreateStopMarketOrdercreateStopOrderdeposit	editOrderfetchAccountsfetchBalancefetchBidsAsksfetchBorrowInterestfetchBorrowRatefetchBorrowRateHistoriesfetchBorrowRateHistoryfetchBorrowRatesfetchBorrowRatesPerSymbolfetchCanceledOrdersfetchClosedOrderfetchClosedOrdersfetchCrossBorrowRatefetchCrossBorrowRatesfetchCurrenciesfetchDepositfetchDepositAddressfetchDepositAddressesfetchDepositAddressesByNetworkfetchDepositsfetchDepositsWithdrawalsfetchDepositWithdrawFeefetchDepositWithdrawFeesfetchFundingHistoryfetchFundingIntervalfetchFundingIntervalsfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchGreeksfetchIndexOHLCVfetchIsolatedBorrowRatefetchIsolatedBorrowRatesfetchIsolatedPositionsfetchL3OrderBookfetchLedgerfetchLeveragefetchLeveragesfetchLeverageTiersfetchLiquidationsfetchLongShortRatiofetchLongShortRatioHistoryfetchMarginAdjustmentHistoryfetchMarginModefetchMarginModesfetchMarketLeverageTiersfetchMarketsfetchMarkOHLCVfetchMarkPricesfetchMyLiquidationsfetchMySettlementHistoryfetchMyTrades
fetchOHLCVfetchOpenInterestfetchOpenInterestHistoryfetchOpenInterestsfetchOpenOrderfetchOpenOrdersfetchOptionfetchOptionChain
fetchOrderfetchOrderBookfetchOrderBooksfetchOrdersfetchOrderTradesfetchPositionfetchPositionHistoryfetchPositionModefetchPositionsfetchPositionsForSymbolfetchPositionsHistoryfetchPositionsRiskfetchPremiumIndexOHLCVfetchSettlementHistoryfetchStatusfetchTickerfetchTickers	fetchTimefetchTradesfetchTradingFeefetchTradingFeesfetchTradingLimitsfetchTransactionFeefetchTransactionFeesfetchTransactionsfetchTransfersfetchVolatilityHistoryfetchWithdrawalfetchWithdrawalsfetchWithdrawalWhitelistreduceMarginrepayCrossMarginrepayIsolatedMargin)	repayMarginsetLeverage	setMarginsetMarginModesetPositionModesignIntransferwithdrawws
timeframes1515601D)1m5m15m1h1durlszOhttps://github.com/user-attachments/assets/b41b5e0d-98e5-4bd3-8a6e-aeb230a4a135zhttps://history.bit.teamzhttps://bit.team)historypublicprivatezhttps://bit.team/z,https://bit.team/auth/sign-up?ref=bitboy2023z(https://bit.team/trade/api/documentation)logoapiwwwreferraldocr   getz&api/tw/history/{pairName}/{resolution}ztrade/api/assetztrade/api/currenciesztrade/api/orderbooks/{symbol}ztrade/api/ordersztrade/api/pair/{name}ztrade/api/pairsztrade/api/pairs/precisionsztrade/api/ratesztrade/api/trade/{id}ztrade/api/tradesztrade/api/ccxt/pairsztrade/api/cmc/assetsztrade/api/cmc/orderbook/{pair}ztrade/api/cmc/summaryztrade/api/cmc/tickerztrade/api/cmc/trades/{pair})ztrade/api/ccxt/balanceztrade/api/ccxt/order/{id}ztrade/api/ccxt/ordersOfUserztrade/api/ccxt/tradesOfUserztrade/api/transactionsOfUser)ztrade/api/ccxt/cancel-all-orderztrade/api/ccxt/cancelorderztrade/api/ccxt/ordercreate)r   postfeestradingz0.002)feeSide	tierBased
percentagetakermakerprecisionModeoptionsEthereumERC20ethereumTronTRC20tronBinanceBSCbinancezBinance Smart ChainbscscanBitcoinBTCbitcoinLitecoinLTClitecoinPolygonPOLYGONpolygonPRIZMDecimalufobjecttonchain)USDTBUSD)networksByIdcurrenciesValuedInUsdfeatures)IOCFOKPOGTD)
marginModetriggerPricetriggerPriceTypetriggerDirectionstopLossPricetakeProfitPriceattachedStopLossTakeProfittimeInForcehedgedtrailingleveragemarketBuyRequiresPricemarketBuyByCostselfTradePreventionicebergd   i )r   limitdaysBack	untilDayssymbolRequired)r   triggerr   r  )r   r   r  r   r  )r   r   r   r  r  r   r  )r   r   r   daysBackCanceledr  r  r   r  r   i  )	sandboxr@   createOrdersr}   r   r   r   rU   r~   )linearinverse)r1   r3   r4   
exceptions)400002401000403002404200)zis not allowedzInsufficient fundszInvalid request params inputzmust be a numberzmust be a stringzmust be of typezmust be one ofzOrder not foundzPair with pair namepairNamezService UnavailablezSymbol )exactbroad)deep_extendsuperr"   describeparse_numberr   r   r   r   r   r   r   )self	__class__s    F/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/bitteam.pyr  bitteam.describe   s   gt = ? PB
)PB
JPB
 $PB
 x	PB

 PB
 PB
 5PB
  AAA %A 	A
 %A %A UA $UA 'A A "4A tA A $UA  A  '!A" t#A$ 7%A& 9%'A( &u)A* (+A, '-A. (/A0 "51A2 53A4 U5A6  7A8 9A:  ;A< &u=A> "5?A@ +EAAB )%CAD #EEAF ,UGAH &tIAJ #EKAL $TMAN 'OAP (QAR "4SAT UAV &uWAX (YAZ 1%[A\  ]A^ +D_A` *5aAb +EcAd &ueAf 'gAh (iAj #EkAl *5mAn $UoAp uqAr "5sAt *5uAv +EwAx )%yAz #E{A| u}A~  A@ !%AAB %eCAD $UEAF &uGAH -eIAJ /KAL "5MAN #EOAP +EQAR SAT !%UAV "5WAX &uYAZ +E[A\  ]A^ d_A` $UaAb +EcAd %eeAf !%gAh "4iAj ukAl #EmAn doAp !$qAr "5sAt tuAv #EwAx  yAz '{A| $U}A~ !%A@ *5AAB (CAD %eEAF )%GAH )%IAJ uKAL tMAN OAP UQAR tSAT "5UAV #EWAX %eYAZ &u[A\ ']A^ $T_A` !%aAb )%cAd "5eAf #EgAh +EiAj kAl #EmAn &uoAp  %$"!&#(!!AAPB
T UPB
b i901
 +J>cPB
| @!  )1. 8 +A	
 0 *1 5a *1 / +A / / 9! 0 /  6q!, 3456787889 <=67675(}PB
N $!&"&!..w7!..w7OPB
` YaPB
d !!! G! G	!
 u! u! *5! u! u! u! ! ! y! y! W!  y!!" 
#!$ 
%!* ! *+ePB
X $&+(-,0,0).+06:#(#("'#(	( #($)$)27+0/4#()$, %)&+!$$*%+*/& ',#($)*/	# ',!$#($)*/( '+!$$(%)#($)*/$ ',!$$(,0%)#($)*/	*  #ACJ ##
 ##SMYPB
t	 '1('	 '1*;4>(2(2'1&0'4+4 )+?(u	PB
 P P	    c                     U R                  U5      nU R                  US0 5      nU R                  US/ 5      nU R                  U5      $ )z
retrieves data on all markets for bitteam

https://bit.team/trade/api/documentation#/CCXT/getTradeApiCcxtPairs

:param dict [params]: extra parameters specific to the exchange api endpoint
:returns dict[]: an array of objects representing market data
resultpairs)publicGetTradeApiCcxtPairs
safe_valueparse_markets)r  paramsresponser  marketss        r  fetch_marketsbitteam.fetch_marketsk  sL     226:n 8R8//&'26!!'**r  marketc                    U R                  US5      nU R                  US5      nUR                  S5      nU R                  US5      nU R                  US5      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
5      nS nU R	                  U R                  S0 5      nU R                  XS	5      nU(       a%  U R	                  US
0 5      nU R                  US5      nU R                  0 SU_SU_SUS-   U-   _SU_SU_SS _SU_SU_SS _SS_SS_SS	_SS	_SS	_SS	_SU	_SS	_S S S S S S S U R                  U R                  U R                  US5      5      5      U R                  U R                  U R                  US5      5      5      S.S S S .S S S .S S S .US S .S!.UUS".E5      $ )#Nr'   r&   _r   r,   active	timeStartr   Fsettings	limit_usd	numericIdsymbol/basequotesettlebaseIdquoteIdsettleIdtyper1   Tr2   r3   r4   r5   contractbaseStep	quoteStep)amountpriceminmax)r   r9  r:  cost)r  r  contractSizeexpiryexpiryDatetimestrike
optionType	precisionlimitscreatedinfo)safe_stringsafe_integersplitsafe_currency_coder  	parse8601r   	safe_boolsafe_numbersafe_market_structurer  parse_precision)r  r%  r&   r,  partsr2  r3  r/  r0  r(  r)  rF  minCostr   
quoteInUsdr*  s                   r  parse_marketbitteam.parse_market  s   ff-%%fd3	!!%+""5!,&&v.''02$$V[9	..+ $>UWY Z^^$9%H
vz2>H&&x=G)) 1+
"1+
1+
 dSj5(1+
 D	1+

 U1+
 d1+
 f1+
 w1+
 1+
 F1+
 D1+
 e1+
 E1+
 e1+
 e1+
  f!1+
" #1+
$  "++D,@,@AQAQRXZdAe,fg**4+?+?@P@PQWYd@e+fg  
  
  
 #$ a1+
 1 1	r  c                    U R                  U5      nU R                  US0 5      nU R                  US/ 5      nU R                  5       nU R                  US5      n0 n[	        S[        U5      5       GH  nXG   nU R                  US5      n	U R                  US5      n
U R                  U	5      nU R                  USS5      nU R                  U R                  U R                  US	5      5      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5      nSnU R                  US0 5      n0 nU R                  US5      nUb  US:w  a  U R                  U5      nUUU'   OUnU R                  XZ0 5      nU R                  US5      nU R                  US5      n[        UR                  5       5      n0 nU R                  U R                  U R                  US5      5      5      nU R                  US5      n[	        S[        U5      5       Hu  nUU   nU R                  UU5      nU R                  UU5      n UUUUUU USSS.U R                  U5      U R                  U5      S.U R                  U5      SS.S.US.	UU'   Mw     U	U
UUUUUUUUSSS.U R                  U5      U R                  U5      S.U R                  U5      SS.S.UUS.Xk'   GM     U$ )z
fetches all available currencies on an exchange

https://bit.team/trade/api/documentation#/PUBLIC/getTradeApiCurrencies

:param dict [params]: extra parameters specific to the bitteam api endpoint
:returns dict: an associative dictionary of currencies
r  
currenciesunified_cryptoasset_idr   r-  r&   r(  FrD  txLimitsminWithdrawmaxWithdraw
minDepositNwithdrawCommissionFixed
blockChain depositStatuswithdrawStatusdecimalsr5  r;  )r9  r   rH   )	r&   networkrH   r   r(  feerD  rE  rG  )r&   r,  coder'   rG  r(  rH   r   rd  rD  rE  r5  networks)publicGetTradeApiCurrenciesr  publicGetTradeApiCmcAssetsindex_byrangelenrH  rI  rK  rM  r  rP  listkeysnetwork_id_to_coderN  )!r  r   r!  responseResultrW  statusesResponser  icurrencyr&   r,  re  r(  rD  rY  rZ  r[  r\  rd  r]  feesByNetworkIdr^  statusesrH   r   
networkIdsrf  networkPrecisiontypeRawj	networkIdnetworkCode
networkFees!                                    r  fetch_currenciesbitteam.fetch_currencies  sY    33F;v 8R@__^\2F
::<*  ==)9;STq#j/*A!}H!!(H5B))(D9I**2.D^^Hh>F))$*>*>t?O?OPXZe?f*ghIxR@H**8]CK**8]CK))(LAJC&*ooh@Y[]&^#$&O))(LAJ&Z2-=''(?@.1
+"9'7BGHooh@Gx1ABHo2245JH#001E1EdFVFVW_akFl1mn&&x8G1c*o.&qM	"55iF!--oyI
#*& ($%!1 $(#'#
 $(#4#4[#A#'#4#4[#A%
 $(#4#4Z#@#'$ %-)%	 /: &  "$&  $#
  $00=#00=!
  $00<#   $5FLq +h r  r   Nr-  	timeframesincer   c                 >   U R                  5         U R                  U5      nU R                  U R                  X"5      nUS   US.nU R	                  U R                  X5      5      n	U R                  U	S0 5      n
U R                  U
S/ 5      nU R                  XX#U5      $ )a  
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
:param str symbol: unified symbol of the market to fetch OHLCV data for
:param str timeframe: the length of time each candle represents
:param int [since]: timestamp in ms of the earliest candle to fetch
:param int [limit]: the maximum amount of candles to fetch
:param dict [params]: extra parameters specific to the bitteam api endpoint
:returns int[][]: A list of candles ordered, open, high, low, close, volume
r&   )r  
resolutionr  data)	load_marketsr%  rH  r   (historyGetApiTwHistoryPairNameResolutionextendr  	safe_listparse_ohlcvs)r  r-  r~  r  r   r   r%  r  requestr!  r  r  s               r  fetch_ohlcvbitteam.fetch_ohlcv  s     	V$%%dooyL
t$
 @@WA]^8 8R8~~ffb1  yGGr  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      /$ )Ntohlcv)safe_timestamprN  )r  ohlcvr%  s      r  parse_ohlcvbitteam.parse_ohlcv  sn     s+UC(UC(UC(UC(UC(
 	
r  c                     U R                  5         U R                  U5      nSUS   0nU R                  U R                  XS5      5      nU R	                  US5      nU R                  XaU5      nU$ )a1  
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data

https://bit.team/trade/api/documentation#/CMC/getTradeApiCmcOrderbookPair

: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(default 100, max 200)
:param dict [params]: extra parameters specific to the bitteam api endpoint
:returns dict: A dictionary of `order book structures <https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure>` indexed by market symbols
pairr&   	timestamp)r  r%  !publicGetTradeApiCmcOrderbookPairr  rI  parse_order_book)	r  r-  r   r   r%  r  r!  r  	orderbooks	            r  fetch_order_bookbitteam.fetch_order_book,  su     	V$F4L
 99$++g:VW8 %%h<	))(IF	r  c                 J   U R                  5         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b  X6S'   U R                  U R	                  Xd5      5      nU R                  US0 5      n	U R                  U	S/ 5      n
U R                  XX#5      $ )	a  
fetches information on multiple orders made by the user

https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiCcxtOrdersofuser

: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  orde structures to retrieve(default 10)
:param dict [params]: extra parameters specific to the bitteam api endpoint
:param str [params.type]: the status of the order - 'active', 'closed', 'cancelled', 'all', 'history'(default 'all')
:returns Order[]: a list of `order structures <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
r5  allNr&   r  r   r  orders)r  rH  r%  "privateGetTradeApiCcxtOrdersOfUserr  r  r  parse_orders)r  r-  r  r   r   r5  r  r%  r!  r  r  s              r  fetch_ordersbitteam.fetch_orders\  s     	6D
 [[(F$TlGFO$G::4;;w;WXf 8R8"5  >>r  r&   c                     U R                  5         SU0nSnUb  U R                  U5      nU R                  U R                  XC5      5      nU R	                  US5      nU R                  Xu5      $ )ag  
fetches information on an order

https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiCcxtOrderId

:param int|str id: order id
:param str symbol: not used by bitteam fetchOrder()
:param dict [params]: extra parameters specific to the bitteam api endpoint
:returns dict: An `order structure <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
r&   Nr  )r  r%  privateGetTradeApiCcxtOrderIdr  	safe_dictparse_order)r  r&   r-  r   r  r%  r!  r  s           r  fetch_orderbitteam.fetch_order  st     	"
 [[(F55dkk'6RSL (3//r  c           	      l    U R                  5         SS0nU R                  XX0R                  XT5      5      $ )a  
fetch all unfilled currently open orders

https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiCcxtOrdersofuser

: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(default 10)
:param dict [params]: extra parameters specific to the bitteam api endpoint
:returns Order[]: a list of `order structures <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
r5  r(  r  r  r  r  r-  r  r   r   r  s         r  fetch_open_ordersbitteam.fetch_open_orders  :     	H
   {{77STTr  c           	      l    U R                  5         SS0nU R                  XX0R                  XT5      5      $ )a+  
fetches information on multiple closed orders made by the user

https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiCcxtOrdersofuser

: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 closed order structures to retrieve(default 10)
:param dict [params]: extra parameters specific to the bitteam api endpoint
:returns Order[]: a list of `order structures <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
r5  closedr  r  s         r  fetch_closed_ordersbitteam.fetch_closed_orders  r  r  c           	      l    U R                  5         SS0nU R                  XX0R                  XT5      5      $ )a,  
fetches information on multiple canceled orders made by the user

https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiCcxtOrdersofuser

: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 canceled order structures to retrieve(default 10)
:param dict [params]: extra parameters specific to the bitteam api endpoint
:returns dict: a list of `order structures <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
r5  	cancelledr  r  s         r  fetch_canceled_ordersbitteam.fetch_canceled_orders*  s:     	K
   {{77STTr  r5  sider9  r:  c                    U R                  5         U R                  U5      n[        US   5      UUU R                  X5      S.nUS:X  a5  Uc  [	        U R
                  S-   U-   S-   5      eU R                  X5      US'   U R                  U R                  X5      5      n	U R                  U	S0 5      n
U R                  X5      $ )as  
create a trade order

https://bit.team/trade/api/documentation#/PRIVATE/postTradeApiCcxtOrdercreate

: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 bitteam api endpoint
:returns dict: an `order structure <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
r,  )pairIdr5  r  r9  r   z/ createOrder() requires a price argument for a z orderr:  r  )r  r%  stramount_to_precisionr   r&   price_to_precision"privatePostTradeApiCcxtOrdercreater  r  r  )r  r-  r5  r  r9  r:  r   r%  r  r!  orders              r  create_orderbitteam.create_order<  s     	V$&-...v>	
 7?}'2c(cfj(jmu(uvv#'#:#:6#I ::4;;w;WX0 x26..r  c                     U R                  5         SU0nU R                  U R                  XC5      5      nU R                  US0 5      nU R	                  U5      $ )a_  
cancels an open order

https://bit.team/trade/api/documentation#/PRIVATE/postTradeApiCcxtCancelorder

:param str id: order id
:param str symbol: not used by bitteam cancelOrder()
:param dict [params]: extra parameters specific to the bitteam api endpoint
:returns dict: An `order structure <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
r&   r  )r  "privatePostTradeApiCcxtCancelorderr  r  r  )r  r&   r-  r   r  r!  r  s          r  cancel_orderbitteam.cancel_orderr  s\     	"
 ::4;;w;WX (B7''r  c                    U R                  5         Sn0 nUb#  U R                  U5      n[        US   5      US'   OSUS'   U R                  U R	                  XB5      5      nU R                  US0 5      nU/nU R                  Xs5      $ )aO  
cancel open orders of market

https://bit.team/trade/api/documentation#/PRIVATE/postTradeApiCcxtCancelallorder

:param str symbol: unified market symbol
:param dict [params]: extra parameters specific to the bitteam api endpoint
:returns dict[]: a list of `order structures <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
Nr,  r  0r  )r  r%  r  %privatePostTradeApiCcxtCancelAllOrderr  r  r  )r  r-  r   r%  r  r!  r  r  s           r  cancel_all_ordersbitteam.cancel_all_orders  s     	[[(F #F;$7 8GH #GH==dkk'>Z[ 8R8  00r  r  c           	         U R                  US5      nU R                  US5      nU R                  XB5      nU R                  US5      nS nU R                  US5      nUb  U R                  U5      nOU R                  US5      nU R                  US5      nU R                  U5      n	U R	                  U R                  US5      5      n
U R                  U R                  US5      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S nUb9  U R                  US5      nU R                  US5      nU R                  U5      US S.nU R                  0 SU_SU_SU_SU R                  U5      _SS _SU	_SU
_SUS   _SU_SS_S	U_SU_SU R                  US5      _SS _SU_SS _SU_S US USS.EU5      $ )Nr&   r  orderCid	createdAtr  	updatedAtstatusr5  r  rd  r:  quantityexecutedr9  r-  )rr  r>  rateclientOrderIddatetimelastTradeTimestamplastUpdateTimestampr   GTCr   	stopPriceaverager>  filledF)	remainingrd  tradesrG  postOnly)
rH  safe_marketrL  r  parse_order_statusparse_order_typer  rK  
safe_orderiso8601)r  r  r%  r&   marketIdr  r  r  r  r  r  r5  r  feeRawr:  r9  r  rd  feeCostfeeCurrencyIds                       r  r  bitteam.parse_order  s   l eT*##E62!!(3((
;	$$UK8	 y1I++E;?I$$UK8	"nnY7(()9)9%)JK$$T%5%5eV%DEv..  0!!%4!!%4&&vx8G ,,VX>M 33MBC
   
" 
] 
  
 Y/	 

 !$ 
 "#6 
 f 
 fX& 
 D 
 5 
 D 
 U 
 D,,UK@ 
 t 
 f 
  D! 
" f# 
$ - 
. / 	r  r  c           	      <    SSSSSSSSS.nU R                  X!U5      $ )Nopenr  canceledrejected)acceptedr  r  partiallyCancelleddeleteinactive	executingrF  rH  r  r  rt  s      r  r  bitteam.parse_order_status7  s6     #", "	
 &99r  c                 0    SSS.nU R                  X!U5      $ )Nr%  r   )r%  r   r  r  s      r  r  bitteam.parse_order_typeD  s$    
 &99r  c                     U R                  X5      nU R                  X45      nUb  Uc  g U R                  U5      n[        R                  " XW5      $ N)rH  rP  r    
string_mul)r  valueObjectvalueKeypreciseObjectprecisionKeyvalueRawStringprecisionRawStringprecisionStrings           r  parse_value_to_pricision bitteam.parse_value_to_pricisionK  sT    ))+@!--mJ!%7%?../AB!!.BBr  symbolsc                    U R                  5         U R                  5       n/ n[        U[        5      (       d  / n[	        S[        U5      5       H)  nX5   nU R                  U5      nUR                  U5        M+     U R                  USU5      $ )a  
fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market

https://bit.team/trade/api/documentation#/CMC/getTradeApiCmcSummary

:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
:param dict [params]: extra parameters specific to the bitteam api endpoint
:returns dict: a dictionary of `ticker structures <https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure>`
r   r-  )	r  publicGetTradeApiCmcSummary
isinstancerl  rj  rk  parse_tickerappendfilter_by_array_tickers)r  r  r   r!  tickersrq  	rawTickertickers           r  fetch_tickersbitteam.fetch_tickersS  s     	335@ (D))Hq#h-(A I&&y1FNN6" ) ++GXwGGr  c                     U R                  5         U R                  U5      nSUS   0nU R                  U R                  XB5      5      nU R	                  US0 5      nU R                  US0 5      nU R                  Xs5      $ )a  
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market

https://bit.team/trade/api/documentation#/PUBLIC/getTradeApiPairName

:param str symbol: unified symbol of the market to fetch the ticker for
:param dict [params]: extra parameters specific to the bitteam api endpoint
:returns dict: a `ticker structure <https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure>`
r'   r&   r  r  )r  r%  publicGetTradeApiPairNamer  r  r  r  )r  r-  r   r%  r  r!  r  r  s           r  fetch_tickerbitteam.fetch_ticker  s     	V$F4L
 11$++g2NOp 8R8~~ffb1  ..r  r  c                    U R                  US5      nU R                  X25      nS nS nS nS nU R                  US5      nU R                  US5      n	Ub  [        U[        5      (       a  U	b  [        U	[        5      (       ao  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5      nU R                  US5      nO$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 R                  USS5      nU R                  USS5      nU R                  USS5      nU R                  0 SUS   _SS _SS _SS _SU_SU_SU_SU_SU_SU_SU_S S _S!S _S"S _S#U_S$S _S%U_UUS&.EU5      $ )'Ntrading_pairsbidsasksr   r:  r  highest_bid
lowest_askvolume24base_volumequoteVolume24quote_volumehighPrice24highest_price_24h
lowPrice24lowest_price_24h	lastPrice
last_pricechange24price_change_percent_24hr-  r  r  r  highlowclosebid	bidVolumeask	askVolumevwappreviousClosechanger   r  
baseVolume)quoteVolumerG  )safe_string_lowerr  r  r  rl  rH  safe_string_2safe_ticker)r  r  r%  r  bestBidPricebestAskPricebestBidVolumebestAskVolumer  r  bestBidbestAskr/  r0  r%  r&  r'  
changePcnts                     r  r  bitteam.parse_tickerR  s   ` ))&/B!!(3vv.vv.:dD#9#9@PWabfhlWmWmoodAr2G++GW=L ,,WjAMoodAr2G++GW=L ,,WjAM++FMBL++FLAL''
MJ
((.Q!!&-9LM  7IJ""6;E''
<VW
 !
fX&!
!
 !
 D	!

 D!
 3!
 U!
 <!
 !
 <!
 !
 D!
 T!
 d!
 *!
  t!!
" *#!
$ ''!
( ) 	r  c                     U R                  5         U R                  U5      nSUS   0nU R                  U R                  Xd5      5      nU R	                  XuX#5      $ )a  
get the list of most recent trades for a particular symbol

https://bit.team/trade/api/documentation#/CMC/getTradeApiCmcTradesPair

: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 bitteam api endpoint
:returns Trade[]: a list of `trade structures <https://github.com/ccxt/ccxt/wiki/Manual#public-trades>`
r  r&   )r  r%  publicGetTradeApiCmcTradesPairr  parse_trades)r  r-  r  r   r   r%  r  r!  s           r  fetch_tradesbitteam.fetch_trades  s^     	V$F4L
 66t{{77ST,   5@@r  c                     U R                  5         0 nSnUb  U R                  U5      nUS   US'   Ub  X5S'   U R                  U R                  XT5      5      nU R	                  US0 5      nU R                  US/ 5      n	U R                  XX#5      $ )a  
fetch all trades made by the user

https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiCcxtTradesofuser

: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(default 10)
:param dict [params]: extra parameters specific to the bitteam api endpoint
:returns Trade[]: a list of `trade structures <https://github.com/ccxt/ccxt/wiki/Manual#trade-structure>`
Nr,  r  r   r  r  )r  r%  "privateGetTradeApiCcxtTradesOfUserr  r  r  r>  )
r  r-  r  r   r   r  r%  r!  r  r  s
             r  fetch_my_tradesbitteam.fetch_my_trades  s     	[[(F &{ 3GH$G::4;;w;WXL 8R8"5  >>r  tradec                 P   U R                  US5      nU R                  X25      nUS   nU R                  US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S	5      n	U R                  US
5      n
U	b  [        R                  " U
S5      n
U R                  USS5      nS nS nU	S:X  a7  US:X  a  SnOUS:X  a  SnU R                  US5      nU R                  US0 5      nO+U	S:X  a%  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5      US.nU R                  U
5      nU R                  UUUU R                  U5      US UU	UUUUUS.U5      $ )Nr  r-  r&   trade_idr:  r  r  r  isCurrentSider  1000r  r5  r   sellbuymakerOrderIdfeeMakerr   takerOrderIdfeeTakerr9  )rr  r>  )r&   r  r  r  r-  r5  r  takerOrMakerr:  r9  r>  rd  rG  )
rH  r  r2  r    r  r  rK  parse_to_int
safe_trader  )r  rE  r%  r  r-  r&   r:  r9  r>  rP  r  r  feeInfor  r  r  rd  intTss                     r  parse_tradebitteam.parse_trade  s   n ##E62!!(3!tZ8  0##E:}E~6''?$$UK8	#**9f=I!!%87"v~$$UN;EooeZ<GW$$$UN;EooeZ<G(((;""7H5//>
 !!),U+( 
  	r  c                 f    U R                  5         U R                  U5      nU R                  U5      $ )aX  
query for balance and get the amount of funds available for trading or funds locked in orders

https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiCcxtBalance

:param dict [params]: extra parameters specific to the betteam api endpoint
:returns dict: a `balance structure <https://github.com/ccxt/ccxt/wiki/Manual#balance-structure>`
)r  privateGetTradeApiCcxtBalanceparse_balance)r  r   r!  s      r  fetch_balancebitteam.fetch_balance  s1     	55f=!!(++r  c                 
   U R                  5       nUUU R                  U5      S.nU R                  US0 5      nU R                  U/ SQ5      n[	        UR                  5       5      n[        S[        U5      5       Hu  nXg   nU R                  XH5      n	U R                  U	S5      n
U R                  U	S5      nU R                  U	S5      nU R                  UR                  5       5      nU
UUS.X='   Mw     U R                  U5      $ )N)rG  r  r  r  )freeusedtotalr   r]  r^  r_  )millisecondsr  r  omitrl  rm  rj  rk  rH  rK  lowersafe_balance)r  r!  r  balancer  balanceByCurrenciesrawCurrencyIdsrq  rawCurrencyIdcurrencyBalancer]  r^  r_  currencyCodes                 r  rY  bitteam.parse_balance  s   T %%'	"Y/

 8R8"ii0IJ16689q#n-.A*-M"oofDO##OV<D##OV<D$$_g>E22=3F3F3HIL%G! /   ))r  re  c                     U R                  5         Sn0 nUb  U R                  U5      nUS   US'   Ub  X6S'   U R                  U R                  Xd5      5      nU R	                  US0 5      nU R                  US/ 5      n	U R                  XX#5      $ )av  
fetch history of deposits and withdrawals from external wallets and between CoinList Pro trading account and CoinList wallet

https://bit.team/trade/api/documentation#/PRIVATE/getTradeApiTransactionsofuser

:param str [code]: unified currency code for the currency of the deposit/withdrawals
:param int [since]: timestamp in ms of the earliest deposit/withdrawal
:param int [limit]: max number of deposit/withdrawals to return(default 10)
:param dict [params]: extra parameters specific to the bitteam api endpoint
:returns dict: a list of `transaction structure <https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure>`
Nr,  rr  r   r  transactions)r  rr  $privateGetTradeApiTransactionsOfUserr  r  r  parse_transactions)
r  re  r  r   r   rr  r  r!  r  rl  s
             r  fetch_deposits_withdrawals"bitteam.fetch_deposits_withdrawalsL  s     	}}T*H"*;"7GJ$G<<T[[=YZr 8R8~~fnbA&&|uLLr  transactionrr  c                    U R                  US5      nU R                  US5      nU R                  XB5      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
U
c8  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5      nU R                  US5      nU R	                  U R                  US5      5      nU R                  USUS5      nU R                  U R                  US5      5      n0 SU_SU_SU_SU	_SU R                  U	5      _SU R                  U
5      _SU_SS _SU_SS _SU_SS _SU_SU R                  U5      _SU_SU_SS _S U R                  US5      SS.E$ )Nrr  r-  r&   r   tx_idr  r^  linksr   sender	recipientmessager5  r9  rb  r  rG  txidr  rc  addressFromaddress	addressTotagFromtagtagToupdateddescriptionF)rd  commentinternal)
r  rH  rK  rI  parse_transaction_typer  parse_transaction_statusr  rn  r  )r  rq  rr  currencyObject
currencyIdre  r&   r   rx  r  ry  rt  r^  ry  r{  r}  r5  r9  r  s                      r  parse_transactionbitteam.parse_transaction  s^   ` jA%%nh?
&&z<k40h70%%k;?	$$[,?	OONGR@E26J((\BI&&{H=$$[+>	{I6**4+;+;K+PQ..{HnV`a..t{H/UV
K
"
 D
 	

 Y/
 t..y9
 ;
 t
 
 t
 3
 T
 D
 d''/
 
  f!
" t#
$ '']C)
 	
r  c                 0    SSS.nU R                  X!U5      $ )NrH   
withdrawal)rH   r   r  )r  r5  typess      r  r  bitteam.parse_transaction_type	  s$     $
 T22r  c                 0    SSS.nU R                  X!U5      $ )Npendingok)	approvingsuccessr  r  s      r  r   bitteam.parse_transaction_status	  s$    "
 &99r  r   GETc                    U R                  X@R                  U5      5      nSU R                  X5      -   nU R                  S   U   U-   n	U R	                  U5      n
US:X  aw  U R                  5         US:X  a  U R                  U5      nO[        U
5      S:w  a  U	SU
-   -  n	U R                  S-   U R                  -   nU R                  U5      nSU-   nUS	S
.nO[        U
5      S:w  a  U	SU
-   -  n	XXeS.$ )Nr.  r   r   POSTr   ?:zBasic zapplication/json)AuthorizationzContent-Type)urlmethodbodyheaders)ra  extract_paramsimplode_paramsr   	urlencodecheck_required_credentialsjsonrk  apiKeysecretstring_to_base64)r  pathr   r  r   r  r  r  endpointr  queryauthauth64	signatures                 r  signbitteam.sign$	  s    ))F$7$7$=>,,T::iis#h.w')++-yy)UqsU{";;$t{{2D**40F 6)I!* 2G Z1_3;CdOOr  reasonr  r  r  r  c
                    Uc  g US:w  Ga7  US:X  a  UR                  S5      S:  aG  US:X  aA  UR                  S5      n
U R                  U
S5      n[        U R                  S-   U-   S	-   5      eUR                  S
5      S:  aA  UR                  S
5      n
U R                  U
S5      n[        U R                  S-   U-   S	-   5      eU R                  S-   U-   nU R                  US5      nU R                  US5      nU R                  U R                  S   X5        U R                  U R                  S   X5        [        U5      eg )N   i  z/ccxt/order/r   r  z/order/r,   z order z
 not foundz/cmc/orderbook/z
 symbolId  rw  re  r  r  )
findrJ  rH  r   r&   r   throw_broadly_matched_exceptionr	  throw_exactly_matched_exceptionr   )r  re  r  r  r  r  r  r!  requestHeadersrequestBodyrQ  orderIdsymbolIdfeedbackrw  responseCodes                   r  handle_errorsbitteam.handle_errors:	  s5   3;s{HH^,1%IIi0E"..ua8G')(;g(E(TUU88-.!3II&78E#//q9H#DGGl$:X$E$TUUww}t+H&&x;G++Hf=L001I7]001I<b))r   r  )>__name__
__module____qualname____firstlineno__r   r  r   r
   r#  dictrT  r   r|  r  r	   rl  r  r  r   r  r   r   r  r  r  r  r  r   r   floatr   r  r  r  r  r  r  r  r   r   r  r   r  r  r   r?  rC  rU  r   rZ  rY  r   ro  r   r  r  r  r  intr  __static_attributes____classcell__)r  s   @r  r"   r"      s   Q# Qf
 $& b+$v, b+HB4 BF BH ') RZ Rh 9=4^bkm /H# /H# /HS /HX[ /Hrvw{r| /Hb
 
4 
( :>b .s .3 .Y .` *.Dt\^ m?3 m?c m? m?cghmcn m?^ 26b 90c 903 90U 90v /3TXac U U3 Uc Uhlmrhs U$ 154VZce U# US UPS Ujnotju U$ 37TX\eg UC Us URU U$ gksu 4/3 4/i 4/y 4/RW 4/`c 4/l 37r (s (C (6 /32 1 1>I Iv I IV: ::C 04B 2HW 2H7 2Hh 02 I/3 I/f I/V|4 | |6 || 6:UW 'A3 'As 'A# 'A\`af\g 'AR -1tRV_a \?c \? \?C \?|e ev e eN $& ,( ,?* ?*B 6:[_hj oMs oM# oMUX oMost  pA oMbW
T W
X W
Q\ W
r3:s : &eBSW P,# s  c TX `c  r  r"   N)&ccxt.base.exchanger   ccxt.abstract.bitteamr   ccxt.base.typesr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   typingr   ccxt.base.errorsr   r   r   r   r   r   r   r   ccxt.base.decimal_to_precisionr   ccxt.base.preciser    r"   r  r  r  <module>r     s\    ( - m  m  m  m  m  * 0 . ' & . * 1 4 %w$h w$r  