
    !:hu                    $   d dl mZ d dlmZ d dlmZmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZ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(  G d dee      Z)y)    )Exchange)ImplicitAPI)AnyBalances
CurrenciesCurrencyDepositAddressIntMarketNumOrder	OrderBook	OrderSide	OrderTypeStrStringsTickerTickersTradeTransactionTransferEntry)List)ExchangeError)AuthenticationError)PermissionDenied)ArgumentsRequired)
BadRequest)	BadSymbol)InsufficientFunds)InvalidOrder)NotSupported)RateLimitExceeded)	TICK_SIZE)Precisec                       e Zd Zdef fdZi fdefdZi fdee   fdZ	dKde
dedefdZi fd	edefd
Zdi fdedefdZi fdefdZdi fd	ededefdZd ZdKded	ededefdZdKde
dedefdZddi fd	edededee   fdZdKdedefdZdddi fd	edededee   fdZdefdZ i fdefdZ!defdZ"dKde
dede#fdZ$i fd	ed e%fd!Z&di fd	ede'd"e(d#e%d$e)f
d%Z*di fd&ed	e+fd'Z,di fd	e+fd(Z-di fd&ed	e+fd)Z.dddi fd	e+dededee#   fd*Z/dddi fd	e+dedefd+Z0d,e+fd-Z1dddi fd	e+dededee#   fd.Z2dddi fd	e+dededee#   fd/Z3d0 Z4d1d2i ddfd3Z5i fd4ede6fd5Z7d,e+fd6Z8dKd7e
d8e9de:fd9Z;dddi fd4e+dededee:   fd:Z<dddi fd4e+dededee:   fd;Z=i fd4ed#e%d<ed=ede>f
d>Z?dKd?e
d8e9de>fd@Z@d,e+de+fdAZAdi fd4ed#e%dBede:fdCZBdDeCdEedFedGedHe
dIefdJZD xZES )Lbigonereturnc                     | j                  t        t        |          i ddddddgddd	d
di dd dddddd dd ddddddddddddddddddddddddi ddd dd!dd"dd#dd$dd%dd&dd'dd(dd)dd*dd+dd,dd-dd.dd/dddddddddddd0
d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdEdFdGdHdIdJdKdLdMdNg dOig dPg dQdRdNg dSig dTdUdVgdWdXgdYdVgdZdNd[gidGd\| j	                  d]      | j	                  d]      d^d_i id`daddbdcdcdddddedfdidgddhddidjdkdlii dmdmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dddddddddddddddi ddddddddddddddddddddddddddddddddddi ddddddddddddddddddddddddēddƓddȓddʓdd̓ddΓdddddddddddddddݜdޜddddd dddd dddddddddddddd ddd d dddddddddddddddd d ddddddd d d ddddddid	ddiddddddidddddddddiddidd d dddt
        di dt        dt        dt        dt        dt        dt        dt        dt        dt        d t        dt        dt        dt        dt        dt        dt        dt        t        t        t        t        t        t        di d	d
dddddd      S (  Nidr&   nameBigONE	countriesCNversionv3	rateLimit   hasCORSspotTmarginFswapfutureoptioncancelAllOrderscancelOrdercreateMarketBuyOrderWithCostcreateMarketOrderWithCostcreateMarketSellOrderWithCostcreateOrdercreatePostOnlyOrdercreateStopLimitOrdercreateStopMarketOrdercreateStopOrderfetchBalancefetchClosedOrdersfetchCurrenciesfetchDepositAddressfetchDepositAddressesfetchDepositAddressesByNetworkfetchDepositsfetchFundingHistoryfetchFundingRatefetchFundingRateHistoryfetchFundingRatesfetchMarketsfetchMyTrades
fetchOHLCVfetchOpenOrders
fetchOrderfetchOrderBookfetchOrders)
fetchTickerfetchTickers	fetchTimefetchTradesfetchTradingFeefetchTradingFeesfetchTransactionFeesfetchWithdrawalstransferwithdraw
timeframesmin1min5min15min30hour1hour3hour4hour6hour12day1week1month1)1m5m15m30m1h3h4h6h12h1d1w1Mhostnamezbig.oneurlszOhttps://github.com/user-attachments/assets/4e5cfd53-98cc-4b90-92cd-0d7b512653d1zhttps://{hostname}/api/v3z https://{hostname}/api/v3/viewerz"https://{hostname}/api/contract/v2zhttps://{hostname}/api/)publicprivatecontractPubliccontractPrivatewebExchangezhttps://big.onez"https://open.big.one/docs/api.htmlzKhttps://bigone.zendesk.com/hc/en-us/articles/115001933374-BigONE-Fee-Policyz&https://b1.run/users/new?code=D3LLBVFT)logoapiwwwdocfeesreferralr   get)pingasset_pairsz#asset_pairs/{asset_pair_name}/depthz$asset_pairs/{asset_pair_name}/tradesz$asset_pairs/{asset_pair_name}/tickerz%asset_pairs/{asset_pair_name}/candleszasset_pairs/tickers)	accountszfund/accountszassets/{asset_symbol}/addressordersorders/{id}zorders/multitradeswithdrawalsdeposits)r   zorders/{id}/cancelzorders/cancelr   r]   )r   post)symbolsinstrumentszdepth@{symbol}/snapshotzinstruments/differencezinstruments/prices)r   r   r   zorders/openingzorders/countzorders/opening/countr   ztrades/countr   zorders/batchzpositions/{symbol}/marginzpositions/{symbol}/risk-limitr   )r   r   putdeletez	v3/assetsr   z0.001)makertakerr^   )tradingfundingoptionsSPOTFUNDCONTRACT)r4   fundr   r7   r6   fillResponseFromRequesti   )webApiEnablewebApiRetrieswebApiMuteFailureERC20USDTTRC20ABBCACAAcalaAE	AeternityALGOAlgorandAPTAptosARArweaveASTRAstarAVAXCAvaxAVAXX	AvaxChainBEAMBeamBEP20BinanceSmartChainBITCI
BitciChainBTCBitcoinBCHBitcoinCashBSV	BitcoinSVCELOCeloCKKBCKBATOMCosmosCRC20CRODASHDashDOGEDogecoinXECECashEOSETHEthereumETCEthereumClassicETHWEthereumPowFTMFantomFILFilecoinFSNFusionGRINGrinONEHarmonyHRC20	HecochainHBARHederaHNTHeliumZENHorizenIOSTIRISKLAYKlaytnKSMKusamaLTCLitecoinXMRMoneroGLMRMoonbeamNEARNearNEONeoNEON3NeoN3OASISOasisOKC	OkexchainONTOntologyOPTIMISMOptimismDOTPolkadotMATICPolygonQtumREIRippleSGBShidenSolanaStellarTeraTezosTronVechainVSystemsWAXZcash)QTUMr  XRPr	  SDNSOLXLMTERAXTZr   VETVSYSr  ZEC)!createMarketBuyOrderRequiresPriceaccountsByTyper]   exchangeMillisecondsCorrectionrE   defaultNetworkdefaultNetworksnetworksfeatures)IOCFOKPOGTD)
marginModetriggerPricetriggerPriceTypetriggerDirectionstopLossPricetakeProfitPriceattachedStopLossTakeProfittimeInForcehedgedtrailingleveragemarketBuyRequiresPricemarketBuyByCostselfTradePreventioniceberg   )r)  limitdaysBack	untilDayssymbolRequired)r)  triggerr2  r<  )r)  r9  r=  r2  r<  )r)  r9  r:  r;  r=  r2  r<  )r)  r9  r:  daysBackCanceledr;  r=  r2  r<  r9    )	sandboxr>   createOrdersrO   rR   rQ   rT   rD   rP   extendsdefaultr+  )markindexlasti )r:  r;  )rB  r>   rT   rD   forDerivatives)linearinverse)rC  r4   rG  r6   r7   precisionMode
exceptions1000110005z7Amount's scale must greater than AssetPair's base scalezFPrice mulit with amount should larger than AssetPair's min_quote_value10007100111001310014104031042940004401034010440301403024060140602)406034060440605401204012160100)exactbroadcommonCurrencies	CybereitsFXTTOKENFreeRossDAOzMobilian CoinzBigONE Token)CREFXTFREEMBNr   )deep_extendsuperr&   describeparse_numberr#   r   r   r    r   r   r   r"   r   )self	__class__s    E/var/www/html/turnos/venv/lib/python3.12/site-packages/ccxt/bigone.pyrm  zbigone.describe   sl	   fd < > fA
(fA
HfA
 $fA
 t	fA

 fA
  --- %- 	-
 $- %- "4- t- /- ,U- 0- t- &t- '- (-  "4!-" #-$ $T%-& "4'-( &t)-* (+-, 1%--.  /-0 &u1-2 #E3-4 *55-6 $U7-8 9-:  ;-< d=-> "4?-@ dA-B !$C-D tE-F  $ $!##($)(-$(  Y-fA
h ifA
D 	EfA
F i9A&J'K#< );eDGfA
b  

*  #	 !&
 47
 &&'$2 # CFcfA
p !..w7!..w7
 qfA
B 59""%(&# .t 37$(%&)-$
 #*G$`F`7` +` J	`
 7` )` G` V` [` F` 0` \` 9` =` ;`  F!`" E#`$ H%`& U'`( F)`* J+`, 7-`. 5/`0 :1`2 ,3`4 M5`6 87`8 :9`: 8;`< F=`> 9?`@ [A`B HC`D 8E`F 9G`H FI`J FK`L HM`N 8O`P :Q`R 8S`T JU`V FW`X 5Y`Z W[`\ W]`^ ;_`` :a`b 
c`d :e`f Yg`h # # ##$""#$& "C`-wCfA
r $&+(,,0,0).+06:#'#("&#(	( #($)$)26+//4#()$, %)&+!$$(%)*.& ',#($)*/	# ',!$#($)*.( ',!$$(%)#($)*.$ ',!$$(,0%)#($)*.	*  #ACJ y  ) +$(%)$(-$ %+%+$
 %+%+*#* "#3 "#3 	 ##GgsfA
B YCfA
D Z] N| ]^j	
 Z ] Y . - . 0 0 0 - ]  ]!" ]#$ /))))&/25EfA
~ "!%&%!fA
 f f	    c                 R   | j                  ddd      }|y| j                  |dg       }i }t        dt        |            D ]  }||   }| j	                  |d      }| j                  |      }| j	                  |d      }	i }
| j                  |d	g       }| j                  | j                  |d
d            }t        dt        |            D ]  }||   }| j	                  |d      }| j                  |      }| j                  |d      }| j                  |d      }| j	                  |d      }| j	                  |d      }| j	                  |d      }| j                  | j                  |d
d            }||d||d| j                  |      | j                  |      |dd|ddd|d
|
|<    t        |      }d}| j                  |d      rd}n|dk(  r| j                  |      rd}nd}nd}| j                  ||||	|dddd| j                  |      ddddddd|
d      ||<    |S )z
        fetches all available currencies on an exchange
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an associative dictionary of currencies
        rE   webExchangeGetV3AssetsTNdatar   symbolr*   binding_gatewayswithdrawal_scalescalegateway_nameis_deposit_enabledis_withdrawal_enabledmin_deposit_amountmin_withdrawal_amountwithdrawal_feeminmax)depositr^   )
r)   networkr5   r  r^   activefee	precisionlimitsinfois_fiatfiat	leveragedothercrypto)amountr^   )r)   coder  r*   typer  r  r^   r  r  r  r#  )fetch_web_endpoint	safe_listrangelensafe_stringsafe_currency_codeparse_precisionsafe_string_2network_id_to_code	safe_boolrn  is_leveraged_currencysafe_currency_structure)ro  paramsru  currenciesDataresulticurrencyr)   r  r*   r#  chainscurrencyMaxPrecisionjchain	networkIdnetworkCoder  r^   minDepositAmountminWithdrawalAmountwithdrawalFeer  chainLengthr  s                            rq  fetch_currencieszbigone.fetch_currencies  s    &&'8:RTXY<Z fb9q#n-. H	A%a(H!!(H5B**2.D##Hf5DH^^H.@"EF#'#7#78J8J8Ugip8q#r 1c&k* q	 ,,UNC	"55i@..0DE>>%1HI#'#3#3E;O#P &*&6&6u>U&V# $ 0 08H I 001C1CEK]_f1gh	#*"& (",,];!%!2!29!= $4#'$
 $7#'%	 "')%> f+KD~~h	2!--b1&D"D77  !../CD  $#
  $#!	 %+9 F4LeH	R rr  c                    | j                  |      | j                  |      g}|}|d   }|d   }| j                  |dg       }g }t        dt	        |            D ]  }||   }	| j                  |	di       }
| j                  |	di       }| j                  |
d      }| j                  |d      }| j                  |      }| j                  |      }|j                  | j                  i d| j                  |	d      d	| j                  |	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dddd| j                  | j                  | j                  |	d                  | j                  | j                  | j                  |	d                  dddddddddd| j                  |	d       | j                  |	d!      dd"d|	d#              t        dt	        |            D ]  }||   }	| j                  |	d$      }| j                  |	d%      }| j                  |	d&      }| j                  |	d      }| j                  |      }| j                  |      }| j                  |      }| j                  |	d'      }|j                  | j                  i d|d|d
z   |z   d(z   |z   d|d|d|d|d|d|ddddddddddddd| j                  |	d)      ddd*| || j                  |	d+      dddd| j                  | j                  | j                  |	d,                  | j                  | j                  | j                  |	d-                  ddddddd| j                  |	d.      | j                  |	d/      d| j                  |	d0      ddd"|	d1	              |S )2a  
        retrieves data on all markets for bigone

        https://open.big.one/docs/spot_asset_pair.html

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: an array of objects representing market data
        r      ru  
base_assetquote_assetrv  r)   r*   uuid/basequotesettleNbaseIdquoteIdsettleIdr  r4   Tr5   Fr6   r7   r8   r  contract
base_scalequote_scale)r  pricer  min_quote_valuemax_quote_value)r3  r  r  cost)rH  rI  contractSizeexpiryexpiryDatetimestrike
optionTyper  r  createdr  baseCurrencyquoteCurrencysettleCurrency	isInverse:enablerH  
multipliervaluePrecisionpricePrecisionpriceMinpriceMaxinitialMargin)	rI  r  r  r  r  r  r  r  r  )publicGetAssetPairscontractPublicGetSymbolsr  r  r  	safe_dictr  r  appendsafe_market_structurern  r  safe_numberr  )ro  r  promisespromisesResultresponsecontractResponsemarketsr  r  market	baseAsset
quoteAssetr  r  r  r  r  marketIdr  rI  s                       rq  fetch_marketszbigone.fetch_marketsF  s]    ,,V4d6S6STZ6[\!!!$)!,j ..626q#g,' 9	AQZFv|R@IrBJ%%i:F&&z8<G**62D++G4EMM$44 16d&&vv616((616 $*u,16 	16
 16 $16 &16 716 D16 16 16 %16 16 %16 %16  $!16" E#16$  $"&""//0D0DTEUEUV\^jEk0lm!..t/C/CDDTDTU[]jDk/lm  $#!
  $#
  $#
  $//8IJ#//8IJ$  a16 1 19	t q#./0 9	A%a(F%%fn=F&&v?G''0@AH''9H**62D++G4E,,X6FnnV[9GMM$44 /6h/6$*u,s2V;/6 /6 	/6
 &/6 &/6 7/6 H/6 /6 /6 %/6 /6 %/6 %/6 $..:/6  D!/6" g+#/6$ # $ 0 0 F"&""//0D0DTEUEUV\^nEo0pq!..t/C/CDDTDTU[]mDn/op  $#!
  $#
  $//
C#//
C
  $//H#$ ]/6 / /9	t rr  Ntickerr  c           
         d|v rdnd}| j                  |dd      }| j                  ||d|      }| j                  |dd      }| j                  |di       }| j                  |d	i       }| j                  i d|d
d dd d| j                  |dd      d| j                  |dd      d| j	                  |d      d| j	                  |d      d	| j	                  |d      d| j	                  |d      dd d| j	                  |d      d|d|dd d| j                  |dd      dd dd | j                  |dd      | j	                  |d      | j	                  |d       | j	                  |d!      |d"|      S )#Nasset_pair_namer4   r6   rv  -closelatestPricebidask	timestampdatetimehighlast24hMaxPricelowlast24hMinPricer  	bidVolumequantity	askVolumevwapopenrF  previousClosechangedaily_changelast24hPriceChange
percentageaveragevolume	volume24hvolume24hInUsd	markPrice
indexPrice)
baseVolumequoteVolumer  r   r  )r  safe_symbolr  safe_tickerr  )	ro  r  r  
marketTyper  rv  r  r  r  s	            rq  parse_tickerzbigone.parse_ticker  s   ^ !2V ;V&
%%f.?J!!(FCD""67MBnnVUB/nnVUB/ !
f!
!
 !
 D&&vv7HI	!

 4%%fe5FG!
 4##C1!
 ))#z:!
 4##C1!
 ))#z:!
 D!
 D$$VV4!
 U!
 E!
 T!
 d((AUV!
  $!!
" t#!
$ ,,VX{K++F4DE))&+>**6<@-!
. / 	rr  rv  c                 b   | j                          | j                  |      }d}| j                  d||      \  }}|dk(  rMd|d   i}| j                  | j	                  ||            }| j                  |di       }| j                  ||      S | j                  |g|      }| j                  ||      S )a  
        fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market

        https://open.big.one/docs/spot_tickers.html

        :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>`
        NrU   r4   r  r)   ru  )	load_marketsr  handle_market_type_and_params&publicGetAssetPairsAssetPairNameTickerextendr  r  fetch_tickers
safe_value)	ro  rv  r  r  r  requestr  r  tickerss	            rq  fetch_tickerzbigone.fetch_tickerM  s     	V$99-QWXf6>!6$<G BB4;;wX^C_`H" ^^Hfb9F$$VV44((&6:G??7F33rr  r   c                    | j                          d}| j                  |d      }|| j                  |      }d}| j                  d||      \  }}|dk(  }i }| j	                  |      }d}|r\|%| j                  |      }	dj                  |	      |d<   | j                  | j                  ||            }
| j                  |
dg       }n| j                  |      }| j                  ||      }| j                  |d|      S )	a  
        fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market

        https://open.big.one/docs/spot_tickers.html

        :param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
        Nr   rV   r4   ,
pair_namesru  rv  )r  r  r  r	  market_symbols
market_idsjoinpublicGetAssetPairsTickersr  r  contractPublicGetInstrumentsparse_tickersfilter_by_array_tickers)ro  r   r  r  rv  r  isSpotr  ru  idsr  r  s               rq  r  zbigone.fetch_tickersv  s    	!!'1-[[(F99.&RXYf%%g."oog.(+%66t{{7F7STH8 >>(FB7D44V<D4 $$T73++GXwGGrr  c                     | j                  |      }| j                  |di       }| j                  |d      }| j                  |dz        S )aE  
        fetches the current integer timestamp in milliseconds from the exchange server

        https://open.big.one/docs/spot_ping.html

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns int: the current integer timestamp in milliseconds from the exchange server
        ru  	Timestamp@B )publicGetPingr  safe_integerparse_to_int)ro  r  r  ru  r  s        rq  
fetch_timezbigone.fetch_time  sP     %%f- ~~h3%%dK8	  W!455rr  r9  c           	         | j                          | j                  |      }d}|d   r>d|d   i}| j                  | j                  ||            }| j	                  ||d   |      S d|d   i}|||d<   | j                  | j                  ||            }| j                  |di       }| j                  ||d   ddd	d
d      S )aA  
        fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data

        https://open.big.one/docs/contract_misc.html#get-orderbook-snapshot

        :param str symbol: unified symbol of the market to fetch the order book for
        :param int [limit]: the maximum amount of order book entries to return
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
        Nr  rv  r)   r  r9  ru  bidsasksr  r  )r  r  $contractPublicGetDepthSymbolSnapshotr  parse_contract_order_book%publicGetAssetPairsAssetPairNameDepthr  parse_order_book)ro  rv  r9  r  r  r  r  	orderbooks           rq  fetch_order_bookzbigone.fetch_order_book  s     	V$*&,G @@WV\A]^H8 11(F8<LeTT "6$<G  #( AA$++gW]B^_H x<I((F84DdFTZ\ceopprr  c                     t        |j                               }g }t        dt        |            D ]=  }||   }||   }|j	                  | j                  |      | j                  |      g       ? |S )Nr   )listkeysr  r  r  rn  )ro  bidsAsksbidsAsksKeysr  r  r  r  s          rq  parse_contract_bids_askszbigone.parse_contract_bids_asks&  st    HMMO,q#l+, 	QA OEe_FMM4,,U3T5F5Fv5NOP	Q rr  r+  c                 "   | j                  |d      }| j                  |d      }| j                  |      }| j                  |      }|| j                  | j                  |dd      |      | j                  | j                  |d      |      d d d dS )Nr%  r&  r   T)rv  r%  r&  r  r  nonce)r  r2  filter_by_limitsort_by)ro  r+  rv  r9  responseBidsresponseAsksr%  r&  s           rq  r(  z bigone.parse_contract_order_book/  s    y&9y&9,,\:,,\:((dAt)DeL((dA)>F
 	
rr  tradec                    | j                  | j                  |dd            }| j                  |d      }| j                  |d      }| j                  |d      }| j                  ||d      }| j                  |d      }| j                  |d      }d }	|||d	k7  r	||k(  rd
nd}	|
|dk(  rdnd}n|dk(  rd}n|dk(  rd}| j                  |d      }
| j                  |d      }d }|
|
}n||}| j                  |d      }||| j	                  |      |d   |d||	||d |d}|	;|dk(  r|	dk(  r|d   }|d   }nJ|d   }|d   }n?|	dk(  r|d   }|d   }n/|d   }|d   }n$|d	k(  r|dk(  r|d   }|d   }n|dk(  r
|d   }|d   }| j                  |d      }| j                  |d      }|||d|dg|d<   n|d|d<   n|	|d|d<   nd |d<   | j                  ||      S )N
created_atinserted_atr  r  r  r  side
taker_sideSELF_TRADINGr   r   ASKsellbuyBIDmaker_order_idtaker_order_idr)   rv  r9  )r)   r  r  rv  orderr  r=  takerOrMakerr  r  r  r  r  r  	maker_fee	taker_fee)r  r  r   r  )	parse8601r  r  safe_marketiso8601
safe_trade)ro  r9  r  r  priceStringamountStringr  r=  	takerSiderG  makerOrderIdtakerOrderIdorderIdr)   r  makerCurrencyCodetakerCurrencyCodemakerFeeCosttakerFeeCosts                      rq  parse_tradezbigone.parse_trade=  s   T NN4#5#5e\=#YZ	&&ug6''x8##E+<=!!(FC8v.$$UL9	 !(8t~?U'0D'87wL< (506uDu}''/?@''/?@#"G%"GeT*"Y/X&( "
  #u}7*(.v%(.w%(.w%(.v%7*(.w%(.v%(.v%(.w%^#E!$*7O!$*6N!e#$*6N!$*7O!''{;''{;#')7HI)7HI"v
 *6CT Uu%%1?PQF5M F5Mvv..rr  sincec                    | j                          | j                  |      }|d   rt        | j                  dz         d|d   i}| j	                  | j                  ||            }| j                  |dg       }| j                  ||||      S )a  
        get the list of most recent trades for a particular symbol

        https://open.big.one/docs/spot_asset_pair_trade.html

        :param str symbol: unified symbol of the market to fetch trades for
        :param int [since]: timestamp in ms of the earliest trade to fetch
        :param int [limit]: the maximum amount of trades to fetch
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
        r  z5 fetchTrades() can only fetch trades for spot marketsr  r)   ru  )r  r  r   r)   &publicGetAssetPairsAssetPairNameTradesr  r  parse_trades	ro  rv  rY  r9  r  r  r  r  r   s	            rq  fetch_tradeszbigone.fetch_trades  s     	V$*TWW'^^__vd|
 >>t{{7TZ?[\, &"5  >>rr  c           	          | j                  | j                  |d            | j                  |d      | j                  |d      | j                  |d      | j                  |d      | j                  |d      gS )Ntimer  r  r  r  r  )rJ  r  r  )ro  ohlcvr  s      rq  parse_ohlcvzbigone.parse_ohlcv  sw     NN4++E6:;UF+UF+UE*UG,UH-
 	
rr  rl   c                    | j                          | j                  |      }|d   rt        | j                  dz         | j	                  |d      }|du}|du}	||	r|rdnd}|d   | j                  | j                  ||      |d}
|	rb| j                  |      }| j                  |||z  d	z        }|r"| j                  t        ||d
z               |
d<   n.| j                  |      |
d<   n|r| j                  |d
z         |
d<   | j                  |d      }| j                  | j                  |
|            }| j                  |dg       }| j                  |||||      S )a  
        fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market

        https://open.big.one/docs/spot_asset_pair_candle.html

        :param str symbol: unified symbol of the market to fetch OHLCV data for
        :param str timeframe: the length of time each candle represents
        :param int [since]: timestamp in ms of the earliest candle to fetch
        :param int [limit]: the maximum amount of candles to fetch
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param int [params.until]: timestamp in ms of the earliest candle to fetch
        :returns int[][]: A list of candles ordered, open, high, low, close, volume
        r  z4 fetchOHLCV() can only fetch ohlcvs for spot marketsuntilNr?  d   r)   )r  periodr9    r  r`  ru  )r  r  r   r)   r!  r  r_   parse_timeframesumrL  r  omit'publicGetAssetPairsAssetPairNameCandlesr  r  parse_ohlcvs)ro  rv  	timeframerY  r9  r  r  rd  untilIsDefinedsinceIsDefinedr  duration
endByLimitr  ru  s                  rq  fetch_ohlcvzbigone.fetch_ohlcv  sk    	V$*TWW']]^^!!&'2t+t+=*~CCE%d|&&t	9M

 ++I6H%)9D)@AJ"&,,s:uqy/I"J"&,,z":"ll5195GFO67+??GU[@\]0 ~~h3  vy%GGrr  c                 X   |d d d}| j                  |dg       }t        dt        |            D ]i  }||   }| j                  |d      }| j	                  |      }| j                         }| j                  |d      |d<   | j                  |d      |d<   |||<   k | j                  |      S )	N)r  r  r  ru  r   asset_symbolbalancetotallocked_balanceused)r  r  r  r  r  accountsafe_balance)	ro  r  r  balancesr  ru  rv  r  ry  s	            rq  parse_balancezbigone.parse_balance:  s    

 >>(FB7q#h-( 	#AqkG%%g~>F**62DllnG#//CGG"..w8HIGFO"F4L	#   ((rr  c                     | j                          | j                  |dd      }| j                  |d      }d}|dk(  s|dk(  r| j                  |      }n| j	                  |      }| j                  |      S )a  
        query for balance and get the amount of funds available for trading or funds locked in orders

        https://open.big.one/docs/fund_accounts.html
        https://open.big.one/docs/spot_accounts.html

        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
        r   Nr   r   )r  r  rj  privateGetFundAccountsprivateGetAccountsr|  )ro  r  r  r  s       rq  fetch_balancezbigone.fetch_balanceK  sz     	366*9226:H..v6H !!(++rr  r  c                 6    ddddd}| j                  |||      S )Nr9  r  )
STOP_LIMITSTOP_MARKETLIMITMARKETr  )ro  r  typess      rq  
parse_typezbigone.parse_typei  s,    !#	
 tT22rr  rF  c           
         | j                  |d      }| j                  |d      }| j                  ||d      }| j                  | j                  |d            }| j                  |d      }|dk(  rd}nd}| j                  |d	      }t        j                  |d
      rd }| j                  |d      }	d }
|	rd}
| j                  | j                  |d            }| j                  |d      }d }d }d }|dk(  r|dk(  r| j                  |d      }n$| j                  |d      }| j                  |d      }| j                  i d|d|d| j                  |d      d|d| j                  |      d| j                  | j                  |d            d|d|d|
d| j                  |d      d|d|d|d|d|d| j                  |d       d!|d | j                  | j                  |d"            d d d#|      S )$Nr)   r  r  r;  r=  rC  rB  rA  
stop_price0immediate_or_cancelr%  r  r  r  filled_amountr  r  clientOrderIdclient_order_idr  r  lastTradeTimestamp
updated_atrv  r0  postOnly	post_onlyr*  r  r  avg_deal_pricefilledstate)	remainingstatusr  r   )
r  r  rJ  r$   	string_eqr  r  
safe_orderrL  parse_order_status)ro  rF  r  r)   r  rv  r  r=  r*  immediateOrCancelr0  r  r  r  r  r  s                   rq  parse_orderzbigone.parse_orderr  s   ( eT*##E+<=!!(FC8NN4#3#3E<#HI	v.5=DD''|<\3/L NN52GHKt//v>?  08##E?;D%%eX6F%%e_=F  
E 
" 
 T--e5FG 
 	 

 Y/ 
 !$..1A1A%1V"W 
 f 
 D 
 ; 
 uk: 
 D 
 U 
 L 
 f 
 D 
  t''/?@! 
" f# 
$ --d.>.>ug.NO+ 
, - 	rr  r  c                     | j                          | j                  |      }|d   st        | j                  dz         d|d<   | j	                  |dd|d|      S )a  
        create a market buy order by providing the symbol and cost

        https://open.big.one/docs/spot_orders.html#create-order

        :param str symbol: unified symbol of the market to create an order in
        :param float cost: how much you want to trade in units of the quote currency
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        r4   z9 createMarketBuyOrderWithCost() supports spot orders onlyFr  r  rB  N)r  r  r!   r)   create_order)ro  rv  r  r  r  s        rq  !create_market_buy_order_with_costz(bigone.create_market_buy_order_with_cost  s`     	V$f~tww)ddee6;23  5$fMMrr  r=  r  r  c                    | j                          | j                  |      }|dk(  }|rdnd}	|j                         }
|
dk(  }| j                  |dd      }d}| j	                  |
dk(  ||      \  }}| j                  |g d	      }|d
   |	| j                  ||      d}|s|
dk(  rP| j                  ||      |d<   |r#| j                  |d      }|dk(  rd|d<   |rd|d<   | j                  ||      |d<   n|rd}| j                  |ddd      \  }}| j                  |d      }| j                  |d      }|r||t        | j                  dz         | j                  |      }| j                  |      }| j                  t!        j"                  ||            }||n|}| j%                  ||      |d<   n+| j%                  ||      |d<   n| j                  ||      |d<   |*| j                  ||      |d<   |rdnd|d<   |rd}
n|
dk(  rd}
|
|d<   | j                  |d      }|||d<   | j                  |g d      }| j'                  | j)                  ||            }| j+                  |d       }| j-                  ||      S )!ax  
        create a trade order

        https://open.big.one/docs/spot_orders.html#create-order

        :param str symbol: unified symbol of the market to create an order in
        :param str type: 'market' or 'limit'
        :param str side: 'buy' or 'sell'
        :param float amount: how much of currency you want to trade in units of base currency
        :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :param float [params.triggerPrice]: the price at which a trigger order is triggered at
        :param bool [params.postOnly]: if True, the order will only be posted to the order book and not executed immediately
        :param str [params.timeInForce]: "GTC", "IOC", or "PO"
        :param float [params.cost]: *spot market buy only* the quote quantity that can be used alternative for the amount

 EXCHANGE SPECIFIC PARAMETERS
        :param str [params.operator]: *stop order only* GTE or LTE(default)
        :param str [params.client_order_id]: must match ^[a-zA-Z0-9-_]{1,36}$ self regex. client_order_id is unique in 24 hours, If created 24 hours later and the order closed, it will be released and can be reused
        :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        rB  rC  r@  r  r  FNr  )r*  	stopPricer  r)   )r  r=  r  r  r  r0  r%  Tr  r  r>   r  r  z createOrder() requires the price argument for market buy orders to calculate the total cost to spend(amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to False and pass the cost to spend in the amount argumentr  GTELTEoperatorr  r  r  r  )r  r  r*  r0  r  ru  )r  r  upperr  handle_post_onlysafe_string_namount_to_precisionprice_to_precisionr  handle_option_and_paramsr  rj  r    r)   number_to_stringparse_to_numericr$   
string_mulcost_to_precisionprivatePostOrdersr  r  r  )ro  rv  r  r=  r  r  r  r  isBuyrequestSideuppercaseTypeisLimitexchangeSpecificParamr  r*  r  r0  r  r  rO  rN  quoteAmountcostRequestr  r  rF  s                             rq  r  zbigone.create_order  s   , 	V$$e%

7* $v{E J00-82KNcekl&))&2]^%d|..vv>
 }4#66vuEGG"..v}E%'59G12+/GK( $ 8 8 HGH481<@<Y<YZ`bo  rU  W[  =\916''76624DL*477  6q  ,q  r  r'+'<'<V'D&*&;&;E&B&*&;&;G<N<N|]h<i&j/3/?dk,0,B,B6;,W)(,(>(>vv(NGH%$($<$<VV$L!#$($;$;FL$QGL!+0%eGJ ,(* -'((A$)6G%&6#no))$++gv*FG x0v..rr  r)   c                     | j                          d|i}| j                  | j                  ||            }| j                  |d      }| j	                  |      S )at  
        cancels an open order

        https://open.big.one/docs/spot_orders.html#cancel-order

        :param str id: order id
        :param str symbol: Not used by bigone cancelOrder()
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        r)   ru  )r  privatePostOrdersIdCancelr  r  r  ro  r)   rv  r  r  r  rF  s          rq  cancel_orderzbigone.cancel_order-  sW     	r
11$++gv2NO x0&&rr  c           	         | j                          | j                  |      }d|d   i}| j                  | j                  ||            }| j	                  |di       }| j                  |dg       }| j                  |dg       }g }	t        dt        |            D ]+  }
||
   }|	j                  | j                  ||dd             - t        dt        |            D ]+  }
||
   }|	j                  | j                  ||dd             - |	S )	a  
        cancel all open orders

        https://open.big.one/docs/spot_orders.html#cancel-all-orders

        :param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
        r  r)   ru  	cancelledfailedr   canceled)r  r)   r  )
r  r  privatePostOrdersCancelr  r  r  r  r  r  r  )ro  rv  r  r  r  r  ru  r  r  r  r  rS  s               rq  cancel_all_orderszbigone.cancel_all_ordersJ  s!    	V$vd|
 //GV0LM ~~h3NN4b9	h3q#i.) 	AlGMM$//$+  	 q#f+& 	AQiGMM$//"+  	 rr  c                     | j                          d|i}| j                  | j                  ||            }| j                  |di       }| j	                  |      S )a  
        fetches information on an order made by the user

        https://open.big.one/docs/spot_orders.html#get-one-order

        :param str id: the order id
        :param str symbol: not used by bigone fetchOrder
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
        r)   ru  )r  privateGetOrdersIdr  r  r  r  s          rq  fetch_orderzbigone.fetch_orderz  sW     	r
**4;;w+GHx4&&rr  c                 $   |t        | j                  dz         | j                          | j                  |      }d|d   i}|||d<   | j	                  | j                  ||            }| j                  |dg       }| j                  ||||      S )aD  
        fetches information on multiple orders made by the user

        https://open.big.one/docs/spot_orders.html#get-user-orders-in-one-asset-pair

        :param str symbol: unified market symbol of the market orders were made in
        :param int [since]: the earliest time in ms to fetch orders for
        :param int [limit]: the maximum number of order structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
        z) fetchOrders() requires a symbol argumentr  r)   r9  ru  )r   r)   r  r  privateGetOrdersr  r  parse_orders)	ro  rv  rY  r9  r  r  r  r  r   s	            rq  fetch_orderszbigone.fetch_orders  s     >#DGG.Y$YZZV$vd|
 $GG((Wf)EF* &"5  >>rr  c                 $   |t        | j                  dz         | j                          | j                  |      }d|d   i}|||d<   | j	                  | j                  ||            }| j                  |dg       }| j                  ||||      S )a  
        fetch all trades made by the user

        https://open.big.one/docs/spot_trade.html#trades-of-user

        :param str symbol: unified market symbol
        :param int [since]: the earliest time in ms to fetch trades for
        :param int [limit]: the maximum number of trades structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
        z+ fetchMyTrades() requires a symbol argumentr  r)   r9  ru  )r   r)   r  r  privateGetTradesr  r  r\  r]  s	            rq  fetch_my_tradeszbigone.fetch_my_trades  s     >#DGG.[$[\\V$vd|
 $GG((Wf)EFF &"5  >>rr  r  c                 2    dddd}| j                  ||      S )Nr  closedr  )PENDINGFILLED	CANCELLEDr  ro  r  statusess      rq  r  zbigone.parse_order_status  s'    #

 &11rr  c           	      R    ddi}| j                  |||| j                  ||            S )a  
        fetch all unfilled currently open orders

        https://open.big.one/docs/spot_orders.html#get-user-orders-in-one-asset-pair

        :param str symbol: unified market symbol
        :param int [since]: the earliest time in ms to fetch open orders for
        :param int [limit]: the maximum number of  open orders structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
        r  r  r  r  ro  rv  rY  r9  r  r  s         rq  fetch_open_orderszbigone.fetch_open_orders   s4     Y
   t{{7F7STTrr  c           	      R    ddi}| j                  |||| j                  ||            S )aK  
        fetches information on multiple closed orders made by the user

        https://open.big.one/docs/spot_orders.html#get-user-orders-in-one-asset-pair

        :param str symbol: unified market symbol of the market orders were made in
        :param int [since]: the earliest time in ms to fetch orders for
        :param int [limit]: the maximum number of order structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
        r  r  r  r  s         rq  fetch_closed_orderszbigone.fetch_closed_orders  s4     X
   t{{7F7STTrr  c                     | j                  | j                  dd      dz  }| j                  | j                         dz  |      S )Nr   r   r  rg  )r!  r   ri  microseconds)ro  exchangeTimeCorrections     rq  r4  zbigone.nonce"  sC    !%!2!24<<Aacd!eho!oxx))+d24JKKrr  rz   GETc                    | j                  || j                  |            }| j                  | j                  d   |         }|dz   | j	                  ||      z   }	i }|dk(  s
|dk(  s|dk(  r|r|	d| j                  |      z   z  }	n| j                          t        | j                               }
d| j                  |
d}| j                  || j                  | j                        d	      }d
|z   |d<   |dk(  r|r3|	d| j                  |      z   z  }	n|dk(  rd|d<   | j                  |      }d| j                  z   dz   | j                  z   |d<   |	|||dS )Nr   r  rz   r~   r|   ?	OpenAPIV2)r  subr4  sha256zBearer Authorizationr  POSTzapplication/jsonzContent-Typezccxt/r  z
User-Agent)urlmethodbodyheaders)rj  extract_paramsimplode_hostnamery   implode_params	urlencodecheck_required_credentialsstrr4  apiKeyjwtencodesecretjsonr)   r.   )ro  pathr   r  r  r  r  querybaseUrlr  r4  r  tokens                rq  signzbigone.sign&  s^   		&$"5"5d";<''		%(8(=>md11$??(?c]2c=M6MsT^^E222++-

%E#{{G HHWdkk$++&>IE'05'8GO$3!666C6!*<'yy' '$'' 1C 7$,, FfdwOOrr  r  c                 :   | j                          | j                  |      }d|d   i}| j                  |      \  }}| j                  | j	                  ||            }| j                  |dg       }t        |      }	|	dk  rt        | j                  dz         | j                  |d      }
| j                  |||
      }| j                  |
|i       }| j                  |d      }| j                  |d      }| j                  |       ||| j                  |      ||d	S )
a  
        fetch the deposit address for a currency associated with self account

        https://open.big.one/docs/spot_deposit.html#get-deposite-address-of-one-asset-of-user

        :param str code: unified currency code
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
        rt  r)   ru  r  z6 fetchDepositAddress() returned empty address responser  valuememo)r  r  r  addresstag)r  r  handle_network_code_and_params"privateGetAssetsAssetSymbolAddressr  r  r  r   r)   index_by#select_network_id_from_raw_networksr  r  check_addressr  )ro  r  r  r  r  r  paramsOmittedr  ru  
dataLengthchainsIndexedByIdselectedNetworkIdaddressObjectr  r  s                  rq  fetch_deposit_addresszbigone.fetch_deposit_addressB  s,    	==&HTN
 &*%H%H%P"]::4;;wP];^_$ ~~h3Y
>*b bcc MM$8 DDT;Xij'8:KRP""=':}f57#../@A
 	
rr  c                 8    dddddd}| j                  |||      S )Nokpending)WITHHOLDUNCONFIRMED	CONFIRMED	COMPLETEDr  r  r  s      rq  parse_transaction_statuszbigone.parse_transaction_statusv  s1     $ 
 &&99rr  transactionr  c                    | j                  |d      }| j                  |      }| j                  |d      }| j                  |d      }| j                  | j                  |d            }| j	                  | j                  |d            }| j	                  | j                  |dd            }	| j                  |d      }
| j                  |d	      }| j                  |d
      }d|v rdnd}| j                  |d      }i d|d|d|
d|d| j                  |      dd dd dd d|dd d|dd d|d|d|d|d|	d d |dS )Nrt  r)   r  r  r<  r  completed_attxidtarget_addressr  customer_id
withdrawalr  is_internalr  r  r  r  addressFromr  	addressTotagFromr  tagTor  r  r  updated)r  commentinternal)r  r  r  r  rJ  r  r  rL  )ro  r  r  
currencyIdr  r)   r  r  r  r  r  r  r  r  r  s                  rq  parse_transactionzbigone.parse_transaction  s   h %%k>B
&&z2k40!!+x8..t/?/?W/UVNN4#3#3K#OP	..!3!3K~!^_V4"";0@A{F3 - <|9>>+}=
K
"
 D
 	

 Y/
 t
 4
 t
 
 t
 3
 T
 D
 f
 
  f!
" w#
$  )
 	
rr  c                     | j                          i }d}|| j                  |      }|d   |d<   |||d<   | j                  | j                  ||            }| j	                  |dg       }| j                  ||||      S )a  
        fetch all deposits made to an account

        https://open.big.one/docs/spot_deposit.html#deposit-of-user

        :param str code: unified currency code
        :param int [since]: the earliest time in ms to fetch deposits for
        :param int [limit]: the maximum number of deposits structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
        Nr)   rt  r9  ru  )r  r  privateGetDepositsr  r  parse_transactions)	ro  r  rY  r9  r  r  r  r  r   s	            rq  fetch_depositszbigone.fetch_deposits  s     	
 }}T*H&.tnGN#$GG**4;;w+GH, >>(FB7&&x5%HHrr  c                     | j                          i }d}|| j                  |      }|d   |d<   |||d<   | j                  | j                  ||            }| j	                  |dg       }| j                  ||||      S )a#  
        fetch all withdrawals made from an account

        https://open.big.one/docs/spot_withdrawal.html#get-withdrawals-of-user

        :param str code: unified currency code
        :param int [since]: the earliest time in ms to fetch withdrawals for
        :param int [limit]: the maximum number of withdrawals structures to retrieve
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
        Nr)   rt  r9  ru  )r  r  privateGetWithdrawalsr  r  r$  )	ro  r  rY  r9  r  r  r  r  r   s	            rq  fetch_withdrawalszbigone.fetch_withdrawals
  s     	
 }}T*H&.tnGN#$GG--dkk'6.JK, nnXvr:&&{HeUKKrr  fromAccount	toAccountc                 8   | j                          | j                  |      }| j                  | j                  di       }| j	                  |||      }| j	                  |||      }	| j	                  |d| j                               }
|d   | j                  ||      ||	|
d}| j                  | j                  ||            }| j                  ||      }| j                  | j                  di       }| j                  |dd      }|r||d<   ||d	<   ||d
<   |
|d<   |S )a'  
        transfer currency internally between wallets on the same account

        https://open.big.one/docs/spot_transfer.html#transfer-of-user

        :param str code: unified currency code
        :param float amount: amount to transfer
        :param str fromAccount: 'SPOT', 'FUND', or 'CONTRACT'
        :param str toAccount: 'SPOT', 'FUND', or 'CONTRACT'
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `transfer structure <https://docs.ccxt.com/#/?id=transfer-structure>`
        r  guidr)   )rv  r  fromtor,  r]   r   Tr)  r*  r  )r  r  r  r   r  r  currency_to_precisionprivatePostTransferr  parse_transferr  )ro  r  r  r)  r*  r  r  r  fromIdtoIdr,  r  r  r]   transferOptionsr   s                   rq  r]   zbigone.transfer<  s)    	==&6FK!!.+{K	9E		<tn00v>
 ++DKK,HI &&x:..z2F"&..B[]a"b"&1H]#$-H[!!'HX!HTNrr  r]   c                 \    | j                  |d      }|d d d d d d d | j                  |      d	S )Nr  )	r  r)   r  r  r  r  r)  r*  r  )r  parse_transfer_status)ro  r]   r  r  s       rq  r1  zbigone.parse_transferi  sF     &1006

 
	
rr  c                 0    ddi}| j                  ||d      S )Nr  r
  r  r  r  s      rq  r6  zbigone.parse_transfer_status}  s%    
 &(;;rr  r  c                    | j                  ||      \  }}| j                          | j                  |      }|d   || j                  ||      d}|||d<   d}| j	                  |      \  }}|| j                  |      |d<   | j                  | j                  ||            }	| j                  |	di       }
| j                  |
|      S )a  
        make a withdrawal

        https://open.big.one/docs/spot_withdrawal.html#create-withdrawal-of-user

        :param str code: unified currency code
        :param float amount: the amount to withdraw
        :param str address: the address to withdraw to
        :param str tag:
        :param dict [params]: extra parameters specific to the exchange API endpoint
        :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
        r)   )rv  r  r  Nr  rz  ru  )
handle_withdraw_tag_and_paramsr  r  r/  r  network_code_to_idprivatePostWithdrawalsr  r  r!  )ro  r  r  r  r  r  r  r  r  r  ru  s              rq  r^   zbigone.withdraw  s     99#vFV==&tn%00v>

 ?!GFO"AA&IV"&*&=&=k&JGN#..t{{7F/KL, ~~h3%%dH55rr  httpCodereasonr  r  r  r  c
                 Z   |y | j                  |d      }
| j                  |d      }|
dk7  r|
}| j                  dz   |z   }| j                  | j                  d   ||       | j                  | j                  d   |
|       | j	                  | j                  d   ||       t        |      y )Nr  messager   ra  rb  )r  r)   throw_exactly_matched_exceptionrK  throw_broadly_matched_exceptionr   )ro  r<  r=  r  r  r  r  r  requestHeadersrequestBodyr  r?  feedbacks                rq  handle_errorszbigone.handle_errors  s    
 &1""8Y7CKd.ww}t+H001I7T\]001I4QYZ001I7T\]))rr  )N)F__name__
__module____qualname__r   rm  r   r  r   r   r  dictr   r  r  r  r   r   r  r
   r#  r   r,  r2  objectr(  r   rX  r^  r.  rb  rr  r   r|  r  r  r   r  floatr  r   r   r   r  r   r  r  r  r  r  r  r  r  r4  r  r	   r  r  r   r   r!  r%  r(  r   r]   r1  r6  r^   intrF  __classcell__)rp  s   @rq  r&   r&      s   g# gR ') AZ AF $& w$v, wrL4 L L6 L\ 02 '43 '4f '4R 04B RHW RH7 RHh !# 6s 6* :>b Eqs Eq3 EqY EqN
6 
3 
s 
^g 
y/ y/v y/ y/v 6:UW *?3 *?s *?# *?\`af\g *?X
 
4 
( 26DW[df @H# @Hc @HQT @Hkoptku @HD) )" $& ,( ,<3s 3D Dv D DL RT N N5 N$ gksu a/3 a/i a/y a/RW a/`c a/F 37r 's 'C ': /32 . .` 26b 'c '3 '" *.Dt\^ /?3 /?c /? /?cghmcn /?b -1tRV_a :?c :? :?C :?x2 2 /3TXac U U3 Uc Uhlmrhs U" 154VZce U# US UPS Ujnotju U"L &eBSW P8 79 2
# 2
^ 2
h	:s 	:U
T U
X U
Q\ U
n *.Dt\^ 0I3 0Ic 0I 0Icghsct 0Id -1tRV_a 0Lc 0L 0LC 0Lfjkvfw 0Ld [] +S +% +c +c +an +Z
t 
x 
= 
(<C <C < DHPR 36S 36% 36# 36Wb 36jc 3 S # X\ dg rr  r&   N)*ccxt.base.exchanger   ccxt.abstract.bigoner   ccxt.base.typesr   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"   ccxt.base.decimal_to_precisionr#   ccxt.base.preciser$   r&    rr  rq  <module>rW     sh    ( , L  L  L  L  L  L  * 0 - . ' & . ) ) . 4 %o"X{ o"rr  