
    !:hcw                    ,   d dl mZ d dlmZ d dlZd dlmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZ 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)ImplicitAPIN)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    S/var/www/html/turnos/venv/lib/python3.12/site-packages/ccxt/async_support/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                 p  K   | j                  d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 7 w)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     ,,->@XZ^__<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 u `s   H6H3HH6c                   K   | j                  |      | j                  |      g}t        j                  |  d{   }|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 7 w)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
        Nr      ru  
base_assetquote_assetrv  r)   r*   uuid/basequotesettle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contractPublicGetSymbolsasynciogatherr  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_marketsG  ss     ,,V4d6S6STZ6[\&~~x88!!$)!,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 [ 9s   8O!ON$O!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                   K   | j                          d{    | j                  |      }d}| j                  d||      \  }}|dk(  rUd|d   i}| j                  | j	                  ||             d{   }| j                  |di       }| j                  ||      S | j                  |g|       d{   }| j                  ||      S 7 7 X7 w)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_tickerN  s      !!!V$99-QWXf6>!6$<G "HHU\^dIeffH" ^^Hfb9F$$VV44 ..x@@G??7F33; 	" g( As4   CCAC4C5?C4C5CCCr   c                 B  K   | j                          d{    d}| j                  |d      }|| j                  |      }d}| j                  d||      \  }}|dk(  }i }| j	                  |      }d}|rd|%| j                  |      }	dj                  |	      |d<   | j                  | j                  ||             d{   }
| j                  |
dg       }n| j                  |       d{   }| j                  ||      }| j                  |d|      S 7 7 Y7 .w)	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_tickersw  s2     !!!!!'1-[[(F99.&RXYf%%g."oog.(+%!<<T[[RX=YZZH8 >>(FB7D::6BBD4 $$T73++GXwGGQ 	" [< Cs4   DDB*DD,D.D/*DDDc                    K   | j                  |       d{   }| j                  |di       }| j                  |d      }| j                  |dz        S 7 =w)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
        Nru  	Timestamp@B )publicGetPingr  safe_integerparse_to_int)ro  r  r  ru  r  s        rq  
fetch_timezbigone.fetch_time  s\      ++F33 ~~h3%%dK8	  W!455 4s   AA>Ar9  c           	        K   | j                          d{    | j                  |      }d}|d   rFd|d   i}| j                  | j                  ||             d{   }| j	                  ||d   |      S d|d   i}|||d<   | j                  | j                  ||             d{   }| j                  |di       }| j                  ||d   ddd	d
d      S 7 7 7 5w)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 "FFt{{SZ\bGcddH8 11(F8<LeTT "6$<G  #( !GGT[]cHdeeH x<I((F84DdFTZ\ceoppu 	" eF fs5   C#CAC#CAC#+C!,2C#C#!C#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  r4  filter_by_limitsort_by)ro  r-  rv  r9  responseBidsresponseAsksr'  r(  s           rq  r*  z bigone.parse_contract_order_book0  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  r;  r  r  priceStringamountStringr  r?  	takerSiderI  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                 L  K   | j                          d{    | j                  |      }|d   rt        | j                  dz         d|d   i}| j	                  | j                  ||             d{   }| j                  |dg       }| j                  ||||      S 7 7 -w)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>`
        Nr  z5 fetchTrades() can only fetch trades for spot marketsr  r)   ru  )r
  r  r   r)   &publicGetAssetPairsAssetPairNameTradesr  r  parse_trades	ro  rv  r[  r9  r  r  r  r  r   s	            rq  fetch_tradeszbigone.fetch_trades  s      !!!V$*TWW'^^__vd|
 DDT[[QXZ`Eabb, &"5  >>= 	" cs"   B$B AB$4B"5,B$"B$c           	          | j                  | j                  |d            | j                  |d      | j                  |d      | j                  |d      | j                  |d      | j                  |d      gS )Ntimer  r  r  r  r  )rL  r  r  )ro  ohlcvr  s      rq  parse_ohlcvzbigone.parse_ohlcv  sw     NN4++E6:;UF+UF+UE*UG,UH-
 	
rr  rl   c                   K   | j                          d{    | 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                  |
|             d{   }| j                  |dg       }| j                  |||||      S 7 [7 /w)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
        Nr  z4 fetchOHLCV() can only fetch ohlcvs for spot marketsuntilr?  d   r)   )r  periodr9    r  rb  ru  )r
  r  r   r)   r#  r  r_   parse_timeframesumrN  r  omit'publicGetAssetPairsAssetPairNameCandlesr  r  parse_ohlcvs)ro  rv  	timeframer[  r9  r  r  rf  untilIsDefinedsinceIsDefinedr  duration
endByLimitr  ru  s                  rq  fetch_ohlcvzbigone.fetch_ohlcv  s     !!!V$*TWW']]^^!!&'2t+t+=*~CCE%d|&&t	9M

 ++I6H%)9D)@AJ"&,,s:uqy/I"J"&,,z":"ll5195GFO67+EEdkkRY[aFbcc0 ~~h3  vy%GGe 	"2 ds"   E6E1D-E6E4-E64E6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  rw  rv  r  r{  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                 0  K   | j                          d{    | j                  |dd      }| j                  |d      }d}|dk(  s|dk(  r| j                  |       d{   }n| j	                  |       d{   }| j                  |      S 7 y7 17 w)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>`
        Nr   r   r   )r
  r  rl  privateGetFundAccountsprivateGetAccountsr~  )ro  r  r  r  s       rq  fetch_balancezbigone.fetch_balanceL  s      !!!366*9!88@@H!44V<<H !!(++% 	"
 A<s4   BBA	B B!B:B;BBB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_typej  s,    !#	
 tT22rr  rH  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?  rE  rD  rC  
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  rL  r$   	string_eqr  r  
safe_orderrN  parse_order_status)ro  rH  r  r)   r  rv  r  r?  r*  immediateOrCancelr0  r  r  r  r  r  s                   rq  parse_orderzbigone.parse_orders  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                    K   | j                          d{    | j                  |      }|d   st        | j                  dz         d|d<   | j	                  |dd|d|       d{   S 7 U7 w)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>`
        Nr4   z9 createMarketBuyOrderWithCost() supports spot orders onlyFr  r  rD  )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  sy      !!!V$f~tww)ddee6;23&&vxdFSSS 	"
 Ts"   A0A,AA0'A.(A0.A0r?  r  r  c                 6  K   | j                          d{    | 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)                  ||             d{   }| j+                  |d       }| j-                  ||      S 7 ~7 +w)!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>`
        NrD  rE  rB  r  r  Fr  )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  rl  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  rQ  rP  quoteAmountcostRequestr  r  rH  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//GV0LMM x0v..W 	"v Ns"   JJIJ+J,)JJr)   c                    K   | j                          d{    d|i}| j                  | j                  ||             d{   }| j                  |d      }| j	                  |      S 7 T7 )w)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>`
        Nr)   ru  )r
  privatePostOrdersIdCancelr  r  r  ro  r)   rv  r  r  r  rH  s          rq  cancel_orderzbigone.cancel_order.  sm      !!!r
77GV8TUU x0&&! 	"Us!   A/A+,A/A-(A/-A/c           	      L  K   | j                          d{    | j                  |      }d|d   i}| j                  | j                  ||             d{   }| 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 7 	7 ʭw)
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>`
        Nr  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  rU  s               rq  cancel_all_orderszbigone.cancel_all_ordersK  s;     !!!V$vd|
 55dkk'66RSS ~~h3NN4b9	h3q#i.) 	AlGMM$//$+  	 q#f+& 	AQiGMM$//"+  	 I 	"
 Ts#   D$DA D$D"CD$"D$c                    K   | j                          d{    d|i}| j                  | j                  ||             d{   }| j                  |di       }| j	                  |      S 7 U7 *w)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>`
        Nr)   ru  )r
  privateGetOrdersIdr  r  r  r  s          rq  fetch_orderzbigone.fetch_order{  sm      !!!r
00Wf1MNNx4&&	 	"Ns!   A0A,,A0A.)A0.A0c                 T  K   |t        | j                  dz         | j                          d{    | j                  |      }d|d   i}|||d<   | j	                  | j                  ||             d{   }| j                  |dg       }| j                  ||||      S 7 s7 -w)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>`
        Nz) fetchOrders() requires a symbol argumentr  r)   r9  ru  )r   r)   r
  r  privateGetOrdersr  r  parse_orders)	ro  rv  r[  r9  r  r  r  r  r   s	            rq  fetch_orderszbigone.fetch_orders  s      >#DGG.Y$YZZ!!!V$vd|
 $GG..t{{7F/KLL* &"5  >>C 	" M"   .B(B$AB(8B&9,B(&B(c                 T  K   |t        | j                  dz         | j                          d{    | j                  |      }d|d   i}|||d<   | j	                  | j                  ||             d{   }| j                  |dg       }| j                  ||||      S 7 s7 -w)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>`
        Nz+ 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..t{{7F/KLLF &"5  >>Y 	" Mr  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           	      n   K   ddi}| j                  |||| j                  ||             d{   S 7 w)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  Nr  r  ro  rv  r[  r9  r  r  s         rq  fetch_open_orderszbigone.fetch_open_orders  s?      Y
 &&vueT[[RX=YZZZZ   ,535c           	      n   K   ddi}| j                  |||| j                  ||             d{   S 7 w)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  Nr  r  s         rq  fetch_closed_orderszbigone.fetch_closed_orders  s?      X
 &&vueT[[RX=YZZZZr  c                     | j                  | j                  dd      dz  }| j                  | j                         dz  |      S )Nr   r   r!  ri  )r#  r   rk  microseconds)ro  exchangeTimeCorrections     rq  r6  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  subr6  sha256zBearer Authorizationr  POSTzapplication/jsonzContent-Typezccxt/r  z
User-Agent)urlmethodbodyheaders)rl  extract_paramsimplode_hostnamery   implode_params	urlencodecheck_required_credentialsstrr6  apiKeyjwtencodesecretjsonr)   r.   )ro  pathr   r  r  r  r  querybaseUrlr  r6  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                 l  K   | j                          d{    | j                  |      }d|d   i}| j                  |      \  }}| j                  | j	                  ||             d{   }| j                  |dg       }t        |      }	|	dk  rt        | j                  dz         | j                  |d      }
| j                  |||
      }| j                  |
|i       }| j                  |d      }| j                  |d	      }| j                  |       ||| j                  |      ||d
S 7 7 ƭw)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>`
        Nrv  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_addressC  sF     !!!==&HTN
 &*%H%H%P"]@@WVcAdee$ ~~h3Y
>*b bcc MM$8 DDT;Xij'8:KRP""=':}f57#../@A
 	
E 	" fs#   D4D/AD4+D2,CD42D4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_statusw  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 )Nrv  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  rL  r  r  rN  )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                 .  K   | j                          d{    i }d}|| j                  |      }|d   |d<   |||d<   | j                  | j                  ||             d{   }| j	                  |dg       }| j                  ||||      S 7 z7 -w)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)   rv  r9  ru  )r
  r  privateGetDepositsr  r  parse_transactions)	ro  r  r[  r9  r  r  r  r  r   s	            rq  fetch_depositszbigone.fetch_deposits  s      !!!
 }}T*H&.tnGN#$GG00Wf1MNN, >>(FB7&&x5%HHI 	" O"   BBAB%B&,BBc                 .  K   | j                          d{    i }d}|| j                  |      }|d   |d<   |||d<   | j                  | j                  ||             d{   }| j	                  |dg       }| j                  ||||      S 7 z7 -w)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)   rv  r9  ru  )r
  r  privateGetWithdrawalsr  r  r(  )	ro  r  r[  r9  r  r  r  r  r   s	            rq  fetch_withdrawalszbigone.fetch_withdrawals  s      !!!
 }}T*H&.tnGN#$GG33DKK4PQQ, nnXvr:&&{HeUKKI 	" Rr*  fromAccount	toAccountc                 j  K   | j                          d{    | j                  |      }| j                  | j                  di       }| j	                  |||      }| j	                  |||      }	| j	                  |d| j                               }
|d   | j                  ||      ||	|
d}| j                  | j                  ||             d{   }| j                  ||      }| j                  | j                  di       }| j                  |dd      }|r||d	<   ||d
<   ||d<   |
|d<   |S 7 7 aw)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>`
        Nr  guidr)   )rv  r  fromtor1  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toIdr1  r  r  r]   transferOptionsr   s                   rq  r]   zbigone.transfer=  sB     !!!==&6FK!!.+{K	9E		<tn00v>
 11$++gv2NOO &&x:..z2F"&..B[]a"b"&1H]#$-H[!!'HX!HTN= 	" Ps#   D3D.B8D3D1AD31D3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  r6  zbigone.parse_transferj  sF     &1006

 
	
rr  c                 0    ddi}| j                  ||d      S )Nr  r  r  r  r  s      rq  r;  zbigone.parse_transfer_status~  s%    
 &(;;rr  r   c                   K   | j                  ||      \  }}| j                          d{    | j                  |      }|d   || j                  ||      d}|||d<   d}| j	                  |      \  }}|| j                  |      |d<   | j                  | j                  ||             d{   }	| j                  |	di       }
| j                  |
|      S 7 7 +w)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>`
        Nr)   )rv  r  r  r  rz  ru  )
handle_withdraw_tag_and_paramsr
  r  r4  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#44T[[&5QRR, ~~h3%%dH55K 	" Ss"   )CCBC1C2*CC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  rA  rB  r  r  r  r  r  requestHeadersrequestBodyr  rD  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.  r4  objectr*  r   rZ  r`  r0  rd  rt  r   r~  r  r  r   r  floatr  r   r   r   r  r   r  r  r  r  r  r  r  r  r6  r  r	   r  r  r   r   r%  r)  r-  r   r]   r6  r;  r^   intrK  __classcell__)rp  s   @rq  r&   r&      s   g# gR -/ A: AF *, wV wrL4 L L6 L\ 68 '4 '4F '4R 6:" RH7 RH RHh ') 6S 6* @DB EqS Eq EqS\ EqN
6 
3 
s 
^g 
y/ y/v y/ y/v <@d[] *? *?S *? *?bfglbm *?X
 
4 
( 8<$]ajl @H @HC @HWZ @Hquvzq{ @HD) )" *, , ,<3s 3D Dv D DL XZ Tc T T$ mqy{ a/ a/I a/Y a/X] a/fi a/F 9=R 'S '# ': 59 .c .` 8<B 'C ' '" 04$UYbd /? /?C /?s /?imnsit /?b 37TX\eg :?C :?s :?RU :?x2 2 59tZ^gi [c [ [TW [nrsxny [" 7;\`ik [ [3 [VY [ptuzp{ ["L &eBSW P8 =? 2
 2
> 2
h	:s 	:U
T U
X U
Q\ U
n 04$UYbd 0I 0IC 0Is 0Iimnyiz 0Id 37TX\eg 0LC 0Ls 0LRU 0Llpq|l} 0Ld ac +3 + +C +TW +gt +Z
t 
x 
= 
(<C <C < JNVX 363 36 36 36]h 36jc 3 S # X\ dg rr  r&   )+ ccxt.async_support.base.exchanger   ccxt.abstract.bigoner   r  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>r\     sk    6 ,  L  L  L  L  L  L  * 0 - . ' & . ) ) . 4 %o"X{ o"rr  