1#![allow(unused, non_snake_case, clippy::all)]
9
10use crate::Value;
11use crate::ExchangeError;
12use crate::exchange::Exchange;
13use crate::exchange::ExchangeRuntime;
14use crate::exchange::CallDynamicChecked;
15
16
17
18use crate::runtime::*;
19
20pub trait ExchangeBase:
21 crate::exchange::DerivedExchange
22 + std::ops::DerefMut<Target = Exchange>
23 + Send
24 + Sized
25{
26 fn call_dynamic<'a>(&'a mut self, method: &'a str, args: Vec<crate::Value>)
30 -> std::pin::Pin<Box<dyn std::future::Future<Output = crate::Value> + Send + 'a>>;
31
32 fn dispatch_to_derived<'a>(&'a mut self, method: &'a str, args: Vec<crate::Value>)
37 -> std::pin::Pin<Box<dyn std::future::Future<Output = Option<crate::Value>> + Send + 'a>>
38 {
39 Box::pin(async move {
40 if !self.dispatch_guard_enter(method) { return None; }
41 let out = futures::FutureExt::catch_unwind(
42 std::panic::AssertUnwindSafe(self.call_dynamic(method, args))
43 ).await;
44 self.dispatch_guard_exit();
45 match out {
46 Ok(v) => Some(v),
47 Err(p) => std::panic::resume_unwind(p),
48 }
49 })
50 }
51
52 fn is_dictionary(&self, value: crate::Value) -> crate::Value {
57 crate::Value::Bool(
58 !crate::runtime::is_equal(&value, &crate::Value::Null)
59 && crate::runtime::is_object(&value)
60 && !crate::runtime::is_array(&value)
61 )
62 }
63
64
65 fn describe(&self) -> Value {
66 return Value::Map({
67 let mut m = indexmap::IndexMap::new();
68 m.insert("id".to_string(), self.id.clone());
69 m.insert("name".to_string(), self.name.clone());
70 m.insert("countries".to_string(), self.countries.clone());
71 m.insert("enableRateLimit".to_string(), self.enableRateLimit.clone());
72 m.insert("rateLimit".to_string(), self.rateLimit.clone());
73 m.insert("rateLimiterAlgorithm".to_string(), self.rateLimiterAlgorithm.clone());
74 m.insert("timeout".to_string(), self.timeout.clone());
75 m.insert("certified".to_string(), self.certified.clone());
76 m.insert("pro".to_string(), self.pro.clone());
77 m.insert("alias".to_string(), self.alias.clone());
78 m.insert("dex".to_string(), Value::Bool(false));
79 m.insert("has".to_string(), Value::Map({
80 let mut m = indexmap::IndexMap::new();
81 m.insert("publicAPI".to_string(), Value::Bool(true));
82 m.insert("privateAPI".to_string(), Value::Bool(true));
83 m.insert("CORS".to_string(), Value::Null);
84 m.insert("sandbox".to_string(), Value::Null);
85 m.insert("spot".to_string(), Value::Null);
86 m.insert("margin".to_string(), Value::Null);
87 m.insert("swap".to_string(), Value::Null);
88 m.insert("future".to_string(), Value::Null);
89 m.insert("option".to_string(), Value::Null);
90 m.insert("index".to_string(), Value::Null);
91 m.insert("addMargin".to_string(), Value::Null);
92 m.insert("borrowCrossMargin".to_string(), Value::Null);
93 m.insert("borrowIsolatedMargin".to_string(), Value::Null);
94 m.insert("borrowMargin".to_string(), Value::Null);
95 m.insert("cancelAllOrders".to_string(), Value::Null);
96 m.insert("cancelAllOrdersWs".to_string(), Value::Null);
97 m.insert("cancelOrder".to_string(), Value::Bool(true));
98 m.insert("cancelOrderWithClientOrderId".to_string(), Value::Null);
99 m.insert("cancelOrderWs".to_string(), Value::Null);
100 m.insert("cancelOrders".to_string(), Value::Null);
101 m.insert("cancelOrdersWithClientOrderId".to_string(), Value::Null);
102 m.insert("cancelOrdersWs".to_string(), Value::Null);
103 m.insert("closeAllPositions".to_string(), Value::Null);
104 m.insert("closePosition".to_string(), Value::Null);
105 m.insert("createDepositAddress".to_string(), Value::Null);
106 m.insert("createLimitBuyOrder".to_string(), Value::Null);
107 m.insert("createLimitBuyOrderWs".to_string(), Value::Null);
108 m.insert("createLimitOrder".to_string(), Value::Bool(true));
109 m.insert("createLimitOrderWs".to_string(), Value::Null);
110 m.insert("createLimitSellOrder".to_string(), Value::Null);
111 m.insert("createLimitSellOrderWs".to_string(), Value::Null);
112 m.insert("createMarketBuyOrder".to_string(), Value::Null);
113 m.insert("createMarketBuyOrderWs".to_string(), Value::Null);
114 m.insert("createMarketBuyOrderWithCost".to_string(), Value::Null);
115 m.insert("createMarketBuyOrderWithCostWs".to_string(), Value::Null);
116 m.insert("createMarketOrder".to_string(), Value::Bool(true));
117 m.insert("createMarketOrderWs".to_string(), Value::Bool(true));
118 m.insert("createMarketOrderWithCost".to_string(), Value::Null);
119 m.insert("createMarketOrderWithCostWs".to_string(), Value::Null);
120 m.insert("createMarketSellOrder".to_string(), Value::Null);
121 m.insert("createMarketSellOrderWs".to_string(), Value::Null);
122 m.insert("createMarketSellOrderWithCost".to_string(), Value::Null);
123 m.insert("createMarketSellOrderWithCostWs".to_string(), Value::Null);
124 m.insert("createOrder".to_string(), Value::Bool(true));
125 m.insert("createOrderWs".to_string(), Value::Null);
126 m.insert("createOrders".to_string(), Value::Null);
127 m.insert("createOrderWithTakeProfitAndStopLoss".to_string(), Value::Null);
128 m.insert("createOrderWithTakeProfitAndStopLossWs".to_string(), Value::Null);
129 m.insert("createPostOnlyOrder".to_string(), Value::Null);
130 m.insert("createPostOnlyOrderWs".to_string(), Value::Null);
131 m.insert("createReduceOnlyOrder".to_string(), Value::Null);
132 m.insert("createReduceOnlyOrderWs".to_string(), Value::Null);
133 m.insert("createStopLimitOrder".to_string(), Value::Null);
134 m.insert("createStopLimitOrderWs".to_string(), Value::Null);
135 m.insert("createStopLossOrder".to_string(), Value::Null);
136 m.insert("createStopLossOrderWs".to_string(), Value::Null);
137 m.insert("createStopMarketOrder".to_string(), Value::Null);
138 m.insert("createStopMarketOrderWs".to_string(), Value::Null);
139 m.insert("createStopOrder".to_string(), Value::Null);
140 m.insert("createStopOrderWs".to_string(), Value::Null);
141 m.insert("createTakeProfitOrder".to_string(), Value::Null);
142 m.insert("createTakeProfitOrderWs".to_string(), Value::Null);
143 m.insert("createTrailingAmountOrder".to_string(), Value::Null);
144 m.insert("createTrailingAmountOrderWs".to_string(), Value::Null);
145 m.insert("createTrailingPercentOrder".to_string(), Value::Null);
146 m.insert("createTrailingPercentOrderWs".to_string(), Value::Null);
147 m.insert("createTriggerOrder".to_string(), Value::Null);
148 m.insert("createTriggerOrderWs".to_string(), Value::Null);
149 m.insert("deposit".to_string(), Value::Null);
150 m.insert("editOrder".to_string(), Value::Str("emulated".to_string()));
151 m.insert("editOrderWithClientOrderId".to_string(), Value::Null);
152 m.insert("editOrders".to_string(), Value::Null);
153 m.insert("editOrderWs".to_string(), Value::Null);
154 m.insert("fetchAccounts".to_string(), Value::Null);
155 m.insert("fetchADLRank".to_string(), Value::Null);
156 m.insert("fetchBalance".to_string(), Value::Bool(true));
157 m.insert("fetchBalanceWs".to_string(), Value::Null);
158 m.insert("fetchBidsAsks".to_string(), Value::Null);
159 m.insert("fetchBorrowInterest".to_string(), Value::Null);
160 m.insert("fetchBorrowRate".to_string(), Value::Null);
161 m.insert("fetchBorrowRateHistories".to_string(), Value::Null);
162 m.insert("fetchBorrowRateHistory".to_string(), Value::Null);
163 m.insert("fetchBorrowRates".to_string(), Value::Null);
164 m.insert("fetchBorrowRatesPerSymbol".to_string(), Value::Null);
165 m.insert("fetchCanceledAndClosedOrders".to_string(), Value::Null);
166 m.insert("fetchCanceledOrders".to_string(), Value::Null);
167 m.insert("fetchClosedOrder".to_string(), Value::Null);
168 m.insert("fetchClosedOrders".to_string(), Value::Null);
169 m.insert("fetchClosedOrdersWs".to_string(), Value::Null);
170 m.insert("fetchConvertCurrencies".to_string(), Value::Null);
171 m.insert("fetchConvertQuote".to_string(), Value::Null);
172 m.insert("fetchConvertTrade".to_string(), Value::Null);
173 m.insert("fetchConvertTradeHistory".to_string(), Value::Null);
174 m.insert("fetchCrossBorrowRate".to_string(), Value::Null);
175 m.insert("fetchCrossBorrowRates".to_string(), Value::Null);
176 m.insert("fetchCurrencies".to_string(), Value::Str("emulated".to_string()));
177 m.insert("fetchCurrenciesWs".to_string(), Value::Str("emulated".to_string()));
178 m.insert("fetchDeposit".to_string(), Value::Null);
179 m.insert("fetchDepositAddress".to_string(), Value::Null);
180 m.insert("fetchDepositAddresses".to_string(), Value::Null);
181 m.insert("fetchDepositAddressesByNetwork".to_string(), Value::Null);
182 m.insert("fetchDeposits".to_string(), Value::Null);
183 m.insert("fetchDepositsWithdrawals".to_string(), Value::Null);
184 m.insert("fetchDepositsWs".to_string(), Value::Null);
185 m.insert("fetchDepositWithdrawFee".to_string(), Value::Null);
186 m.insert("fetchDepositWithdrawFees".to_string(), Value::Null);
187 m.insert("fetchFundingHistory".to_string(), Value::Null);
188 m.insert("fetchFundingRate".to_string(), Value::Null);
189 m.insert("fetchFundingRateHistory".to_string(), Value::Null);
190 m.insert("fetchFundingInterval".to_string(), Value::Null);
191 m.insert("fetchFundingIntervals".to_string(), Value::Null);
192 m.insert("fetchFundingRates".to_string(), Value::Null);
193 m.insert("fetchGreeks".to_string(), Value::Null);
194 m.insert("fetchIndexOHLCV".to_string(), Value::Null);
195 m.insert("fetchIsolatedBorrowRate".to_string(), Value::Null);
196 m.insert("fetchIsolatedBorrowRates".to_string(), Value::Null);
197 m.insert("fetchMarginAdjustmentHistory".to_string(), Value::Null);
198 m.insert("fetchIsolatedPositions".to_string(), Value::Null);
199 m.insert("fetchL2OrderBook".to_string(), Value::Bool(true));
200 m.insert("fetchL3OrderBook".to_string(), Value::Null);
201 m.insert("fetchLastPrices".to_string(), Value::Null);
202 m.insert("fetchLedger".to_string(), Value::Null);
203 m.insert("fetchLedgerEntry".to_string(), Value::Null);
204 m.insert("fetchLeverage".to_string(), Value::Null);
205 m.insert("fetchLeverages".to_string(), Value::Null);
206 m.insert("fetchLeverageTiers".to_string(), Value::Null);
207 m.insert("fetchLiquidations".to_string(), Value::Null);
208 m.insert("fetchLongShortRatio".to_string(), Value::Null);
209 m.insert("fetchLongShortRatioHistory".to_string(), Value::Null);
210 m.insert("fetchMarginMode".to_string(), Value::Null);
211 m.insert("fetchMarginModes".to_string(), Value::Null);
212 m.insert("fetchMarketLeverageTiers".to_string(), Value::Null);
213 m.insert("fetchMarkets".to_string(), Value::Bool(true));
214 m.insert("fetchMarketsWs".to_string(), Value::Null);
215 m.insert("fetchMarkOHLCV".to_string(), Value::Null);
216 m.insert("fetchMyLiquidations".to_string(), Value::Null);
217 m.insert("fetchMySettlementHistory".to_string(), Value::Null);
218 m.insert("fetchMyTrades".to_string(), Value::Null);
219 m.insert("fetchMyTradesWs".to_string(), Value::Null);
220 m.insert("fetchOHLCV".to_string(), Value::Null);
221 m.insert("fetchOHLCVWs".to_string(), Value::Null);
222 m.insert("fetchOpenInterest".to_string(), Value::Null);
223 m.insert("fetchOpenInterests".to_string(), Value::Null);
224 m.insert("fetchOpenInterestHistory".to_string(), Value::Null);
225 m.insert("fetchOpenOrder".to_string(), Value::Null);
226 m.insert("fetchOpenOrders".to_string(), Value::Null);
227 m.insert("fetchOpenOrdersWs".to_string(), Value::Null);
228 m.insert("fetchOption".to_string(), Value::Null);
229 m.insert("fetchOptionChain".to_string(), Value::Null);
230 m.insert("fetchOrder".to_string(), Value::Null);
231 m.insert("fetchOrderWithClientOrderId".to_string(), Value::Null);
232 m.insert("fetchOrderBook".to_string(), Value::Bool(true));
233 m.insert("fetchOrderBooks".to_string(), Value::Null);
234 m.insert("fetchOrderBookWs".to_string(), Value::Null);
235 m.insert("fetchOrders".to_string(), Value::Null);
236 m.insert("fetchOrdersByStatus".to_string(), Value::Null);
237 m.insert("fetchOrdersWs".to_string(), Value::Null);
238 m.insert("fetchOrderTrades".to_string(), Value::Null);
239 m.insert("fetchOrderWs".to_string(), Value::Null);
240 m.insert("fetchPosition".to_string(), Value::Null);
241 m.insert("fetchPositionADLRank".to_string(), Value::Null);
242 m.insert("fetchPositionsADLRank".to_string(), Value::Null);
243 m.insert("fetchPositionHistory".to_string(), Value::Null);
244 m.insert("fetchPositionsHistory".to_string(), Value::Null);
245 m.insert("fetchPositionWs".to_string(), Value::Null);
246 m.insert("fetchPositionMode".to_string(), Value::Null);
247 m.insert("fetchPositions".to_string(), Value::Null);
248 m.insert("fetchPositionsWs".to_string(), Value::Null);
249 m.insert("fetchPositionsForSymbol".to_string(), Value::Null);
250 m.insert("fetchPositionsForSymbolWs".to_string(), Value::Null);
251 m.insert("fetchPositionsRisk".to_string(), Value::Null);
252 m.insert("fetchPremiumIndexOHLCV".to_string(), Value::Null);
253 m.insert("fetchSettlementHistory".to_string(), Value::Null);
254 m.insert("fetchStatus".to_string(), Value::Null);
255 m.insert("fetchTicker".to_string(), Value::Bool(true));
256 m.insert("fetchTickerWs".to_string(), Value::Null);
257 m.insert("fetchTickers".to_string(), Value::Null);
258 m.insert("fetchMarkPrices".to_string(), Value::Null);
259 m.insert("fetchTickersWs".to_string(), Value::Null);
260 m.insert("fetchTime".to_string(), Value::Null);
261 m.insert("fetchTrades".to_string(), Value::Bool(true));
262 m.insert("fetchTradesWs".to_string(), Value::Null);
263 m.insert("fetchTradingFee".to_string(), Value::Null);
264 m.insert("fetchTradingFees".to_string(), Value::Null);
265 m.insert("fetchTradingFeesWs".to_string(), Value::Null);
266 m.insert("fetchTradingLimits".to_string(), Value::Null);
267 m.insert("fetchTransactionFee".to_string(), Value::Null);
268 m.insert("fetchTransactionFees".to_string(), Value::Null);
269 m.insert("fetchTransactions".to_string(), Value::Null);
270 m.insert("fetchTransfer".to_string(), Value::Null);
271 m.insert("fetchTransfers".to_string(), Value::Null);
272 m.insert("fetchUnderlyingAssets".to_string(), Value::Null);
273 m.insert("fetchVolatilityHistory".to_string(), Value::Null);
274 m.insert("fetchWithdrawAddresses".to_string(), Value::Null);
275 m.insert("fetchWithdrawal".to_string(), Value::Null);
276 m.insert("fetchWithdrawals".to_string(), Value::Null);
277 m.insert("fetchWithdrawalsWs".to_string(), Value::Null);
278 m.insert("fetchWithdrawalWhitelist".to_string(), Value::Null);
279 m.insert("reduceMargin".to_string(), Value::Null);
280 m.insert("repayCrossMargin".to_string(), Value::Null);
281 m.insert("repayIsolatedMargin".to_string(), Value::Null);
282 m.insert("setLeverage".to_string(), Value::Null);
283 m.insert("setMargin".to_string(), Value::Null);
284 m.insert("setMarginMode".to_string(), Value::Null);
285 m.insert("setPositionMode".to_string(), Value::Null);
286 m.insert("signIn".to_string(), Value::Null);
287 m.insert("transfer".to_string(), Value::Null);
288 m.insert("watchBalance".to_string(), Value::Null);
289 m.insert("watchMyTrades".to_string(), Value::Null);
290 m.insert("watchOHLCV".to_string(), Value::Null);
291 m.insert("watchOHLCVForSymbols".to_string(), Value::Null);
292 m.insert("watchOrderBook".to_string(), Value::Null);
293 m.insert("watchBidsAsks".to_string(), Value::Null);
294 m.insert("watchOrderBookForSymbols".to_string(), Value::Null);
295 m.insert("watchOrders".to_string(), Value::Null);
296 m.insert("watchOrdersForSymbols".to_string(), Value::Null);
297 m.insert("watchPosition".to_string(), Value::Null);
298 m.insert("watchPositions".to_string(), Value::Null);
299 m.insert("watchStatus".to_string(), Value::Null);
300 m.insert("watchTicker".to_string(), Value::Null);
301 m.insert("watchTickers".to_string(), Value::Null);
302 m.insert("watchTrades".to_string(), Value::Null);
303 m.insert("watchTradesForSymbols".to_string(), Value::Null);
304 m.insert("watchLiquidations".to_string(), Value::Null);
305 m.insert("watchLiquidationsForSymbols".to_string(), Value::Null);
306 m.insert("watchMyLiquidations".to_string(), Value::Null);
307 m.insert("unWatchOrders".to_string(), Value::Null);
308 m.insert("unWatchTrades".to_string(), Value::Null);
309 m.insert("unWatchTradesForSymbols".to_string(), Value::Null);
310 m.insert("unWatchOHLCVForSymbols".to_string(), Value::Null);
311 m.insert("unWatchOrderBookForSymbols".to_string(), Value::Null);
312 m.insert("unWatchPositions".to_string(), Value::Null);
313 m.insert("unWatchOrderBook".to_string(), Value::Null);
314 m.insert("unWatchTickers".to_string(), Value::Null);
315 m.insert("unWatchMyTrades".to_string(), Value::Null);
316 m.insert("unWatchTicker".to_string(), Value::Null);
317 m.insert("unWatchOHLCV".to_string(), Value::Null);
318 m.insert("watchMyLiquidationsForSymbols".to_string(), Value::Null);
319 m.insert("withdraw".to_string(), Value::Null);
320 m.insert("ws".to_string(), Value::Null);
321 m
322}));
323 m.insert("urls".to_string(), Value::Map({
324 let mut m = indexmap::IndexMap::new();
325 m.insert("logo".to_string(), Value::Null);
326 m.insert("api".to_string(), Value::Null);
327 m.insert("test".to_string(), Value::Null);
328 m.insert("www".to_string(), Value::Null);
329 m.insert("doc".to_string(), Value::Null);
330 m.insert("api_management".to_string(), Value::Null);
331 m.insert("fees".to_string(), Value::Null);
332 m.insert("referral".to_string(), Value::Null);
333 m
334}));
335 m.insert("api".to_string(), Value::Null);
336 m.insert("requiredCredentials".to_string(), Value::Map({
337 let mut m = indexmap::IndexMap::new();
338 m.insert("apiKey".to_string(), Value::Bool(true));
339 m.insert("secret".to_string(), Value::Bool(true));
340 m.insert("uid".to_string(), Value::Bool(false));
341 m.insert("accountId".to_string(), Value::Bool(false));
342 m.insert("login".to_string(), Value::Bool(false));
343 m.insert("password".to_string(), Value::Bool(false));
344 m.insert("twofa".to_string(), Value::Bool(false));
345 m.insert("privateKey".to_string(), Value::Bool(false));
346 m.insert("walletAddress".to_string(), Value::Bool(false));
347 m.insert("token".to_string(), Value::Bool(false));
348 m
349}));
350 m.insert("markets".to_string(), Value::Null);
351 m.insert("currencies".to_string(), Value::Map({
352 let mut m = indexmap::IndexMap::new();
353 m
354}));
355 m.insert("timeframes".to_string(), Value::Null);
356 m.insert("fees".to_string(), Value::Map({
357 let mut m = indexmap::IndexMap::new();
358 m.insert("trading".to_string(), Value::Map({
359 let mut m = indexmap::IndexMap::new();
360 m.insert("tierBased".to_string(), Value::Null);
361 m.insert("percentage".to_string(), Value::Null);
362 m.insert("taker".to_string(), Value::Null);
363 m.insert("maker".to_string(), Value::Null);
364 m
365}));
366 m.insert("funding".to_string(), Value::Map({
367 let mut m = indexmap::IndexMap::new();
368 m.insert("tierBased".to_string(), Value::Null);
369 m.insert("percentage".to_string(), Value::Null);
370 m.insert("withdraw".to_string(), Value::Map({
371 let mut m = indexmap::IndexMap::new();
372 m
373}));
374 m.insert("deposit".to_string(), Value::Map({
375 let mut m = indexmap::IndexMap::new();
376 m
377}));
378 m
379}));
380 m
381}));
382 m.insert("status".to_string(), Value::Map({
383 let mut m = indexmap::IndexMap::new();
384 m.insert("status".to_string(), Value::Str("ok".to_string()));
385 m.insert("updated".to_string(), Value::Null);
386 m.insert("eta".to_string(), Value::Null);
387 m.insert("url".to_string(), Value::Null);
388 m.insert("info".to_string(), Value::Null);
389 m
390}));
391 m.insert("exceptions".to_string(), Value::Null);
392 m.insert("httpExceptions".to_string(), Value::Map({
393 let mut m = indexmap::IndexMap::new();
394 m.insert("422".to_string(), Value::Str("ExchangeError".to_string()).clone());
395 m.insert("418".to_string(), Value::Str("DDoSProtection".to_string()).clone());
396 m.insert("429".to_string(), Value::Str("RateLimitExceeded".to_string()).clone());
397 m.insert("404".to_string(), Value::Str("ExchangeNotAvailable".to_string()).clone());
398 m.insert("409".to_string(), Value::Str("ExchangeNotAvailable".to_string()).clone());
399 m.insert("410".to_string(), Value::Str("ExchangeNotAvailable".to_string()).clone());
400 m.insert("451".to_string(), Value::Str("ExchangeNotAvailable".to_string()).clone());
401 m.insert("500".to_string(), Value::Str("ExchangeNotAvailable".to_string()).clone());
402 m.insert("501".to_string(), Value::Str("ExchangeNotAvailable".to_string()).clone());
403 m.insert("502".to_string(), Value::Str("ExchangeNotAvailable".to_string()).clone());
404 m.insert("520".to_string(), Value::Str("ExchangeNotAvailable".to_string()).clone());
405 m.insert("521".to_string(), Value::Str("ExchangeNotAvailable".to_string()).clone());
406 m.insert("522".to_string(), Value::Str("ExchangeNotAvailable".to_string()).clone());
407 m.insert("525".to_string(), Value::Str("ExchangeNotAvailable".to_string()).clone());
408 m.insert("526".to_string(), Value::Str("ExchangeNotAvailable".to_string()).clone());
409 m.insert("400".to_string(), Value::Str("ExchangeNotAvailable".to_string()).clone());
410 m.insert("403".to_string(), Value::Str("ExchangeNotAvailable".to_string()).clone());
411 m.insert("405".to_string(), Value::Str("ExchangeNotAvailable".to_string()).clone());
412 m.insert("503".to_string(), Value::Str("ExchangeNotAvailable".to_string()).clone());
413 m.insert("530".to_string(), Value::Str("ExchangeNotAvailable".to_string()).clone());
414 m.insert("408".to_string(), Value::Str("RequestTimeout".to_string()).clone());
415 m.insert("504".to_string(), Value::Str("RequestTimeout".to_string()).clone());
416 m.insert("401".to_string(), Value::Str("AuthenticationError".to_string()).clone());
417 m.insert("407".to_string(), Value::Str("AuthenticationError".to_string()).clone());
418 m.insert("511".to_string(), Value::Str("AuthenticationError".to_string()).clone());
419 m
420}));
421 m.insert("commonCurrencies".to_string(), Value::Map({
422 let mut m = indexmap::IndexMap::new();
423 m.insert("XBT".to_string(), Value::Str("BTC".to_string()));
424 m.insert("BCHSV".to_string(), Value::Str("BSV".to_string()));
425 m
426}));
427 m.insert("precisionMode".to_string(), Value::Int(crate::runtime::TICK_SIZE));
428 m.insert("paddingMode".to_string(), Value::Int(crate::runtime::NO_PADDING));
429 m.insert("limits".to_string(), Value::Map({
430 let mut m = indexmap::IndexMap::new();
431 m.insert("leverage".to_string(), Value::Map({
432 let mut m = indexmap::IndexMap::new();
433 m.insert("min".to_string(), Value::Null);
434 m.insert("max".to_string(), Value::Null);
435 m
436}));
437 m.insert("amount".to_string(), Value::Map({
438 let mut m = indexmap::IndexMap::new();
439 m.insert("min".to_string(), Value::Null);
440 m.insert("max".to_string(), Value::Null);
441 m
442}));
443 m.insert("price".to_string(), Value::Map({
444 let mut m = indexmap::IndexMap::new();
445 m.insert("min".to_string(), Value::Null);
446 m.insert("max".to_string(), Value::Null);
447 m
448}));
449 m.insert("cost".to_string(), Value::Map({
450 let mut m = indexmap::IndexMap::new();
451 m.insert("min".to_string(), Value::Null);
452 m.insert("max".to_string(), Value::Null);
453 m
454}));
455 m
456}));
457 m.insert("rollingWindowSize".to_string(), Value::Int(60000));
458 m
459});
460
461 Value::Null
462}
463
464 fn clean_rest_data(&mut self) {
465 self.ids = Value::Null;
466 self.markets = Value::Null;
467 self.markets_by_id = Value::Null;
468 self.symbols = Value::List(vec![]);
469 self.codes = Value::Null;
470 { let __t = self.create_safe_dictionary(&[]); self.currencies = __t; }
471 self.currencies_by_id = Value::Null;
472 self.baseCurrencies = Value::Null;
473 self.quoteCurrencies = Value::Null;
474 self.last_http_response = Value::Null;
475 self.last_response_headers = Value::Null;
477 self.last_request_headers = Value::Null;
478}
479
480 fn clean_ws_data(&mut self) {
481 { let __t = self.create_safe_dictionary(&[Value::Bool(true)]); self.balance = __t; }
482 { let __t = self.create_safe_dictionary(&[Value::Bool(true)]); self.orderbooks = __t; }
483 { let __t = self.create_safe_dictionary(&[Value::Bool(true)]); self.tickers = __t; }
484 self.liquidations = Value::Null;
485 self.myLiquidations = Value::Null;
486 self.orders = Value::Null;
487 { let __t = self.create_safe_dictionary(&[Value::Bool(true)]); self.trades = __t; }
488 { let __t = self.create_safe_dictionary(&[]); self.transactions = __t; }
489 { let __t = self.create_safe_dictionary(&[Value::Bool(true)]); self.ohlcvs = __t; }
490 self.myTrades = Value::Null;
491 self.positions = Value::Null;
492}
493
494 fn safe_bool_n(&self, mut dictionaryOrList: Value, mut keys: Value, optional_args: &[Value]) -> Value {
495 let mut defaultValue = get_arg(optional_args, 0, Value::Null);
496 let mut value: Value = self.safe_value_n(dictionaryOrList.clone(), keys.clone(), &[defaultValue.clone()]);
503 if is_bool(&value) {
504 return value;
505 }
506 return defaultValue;
507
508 Value::Null
509}
510
511 fn safe_bool2(&self, mut dictionaryOrList: Value, mut key1: Value, mut key2: Value, optional_args: &[Value]) -> Value {
512 let mut defaultValue = get_arg(optional_args, 0, Value::Null);
513 let mut value: Value = self.safe_value(dictionaryOrList.clone(), key1.clone(), &[]);
520 if is_bool(&value) {
521 return value;
522 }
523 let mut value2: Value = self.safe_value(dictionaryOrList.clone(), key2.clone(), &[]);
524 if is_bool(&value2) {
525 return value2;
526 }
527 return defaultValue;
528
529 Value::Null
530}
531
532 fn safe_bool(&self, mut dictionaryOrList: Value, mut key: Value, optional_args: &[Value]) -> Value {
533 let mut defaultValue = get_arg(optional_args, 0, Value::Null);
534 let mut value: Value = self.safe_value(dictionaryOrList.clone(), key.clone(), &[defaultValue.clone()]);
541 if is_bool(&value) {
542 return value;
543 }
544 return defaultValue;
545
546 Value::Null
547}
548
549 fn safe_dict_n(&self, mut dictionaryOrList: Value, mut keys: Value, optional_args: &[Value]) -> Value {
550 let mut defaultValue = get_arg(optional_args, 0, Value::Null);
551 let mut value: Value = self.safe_value_n(dictionaryOrList.clone(), keys.clone(), &[defaultValue.clone()]);
558 if is_equal(&value, &Value::Null) {
559 return defaultValue;
560 }
561 if is_true(&self.is_dictionary(value.clone())) {
562 return value;
563 }
564 return defaultValue;
565
566 Value::Null
567}
568
569 fn safe_dict(&self, mut dictionaryOrList: Value, mut key: Value, optional_args: &[Value]) -> Value {
570 let mut defaultValue = get_arg(optional_args, 0, Value::Null);
571 let mut value: Value = self.safe_value(dictionaryOrList.clone(), key.clone(), &[defaultValue.clone()]);
578 if is_equal(&value, &Value::Null) {
579 return defaultValue;
580 }
581 if is_true(&self.is_dictionary(value.clone())) {
582 return value;
583 }
584 return defaultValue;
585
586 Value::Null
587}
588
589 fn safe_dict2(&self, mut dictionaryOrList: Value, mut key1: Value, mut key2: Value, optional_args: &[Value]) -> Value {
590 let mut defaultValue = get_arg(optional_args, 0, Value::Null);
591 let mut value: Value = self.safe_value(dictionaryOrList.clone(), key1.clone(), &[]);
598 if is_true(&self.is_dictionary(value.clone())) {
599 return value;
600 }
601 let mut value2: Value = self.safe_value(dictionaryOrList.clone(), key2.clone(), &[]);
602 if is_true(&self.is_dictionary(value2.clone())) {
603 return value2;
604 }
605 return defaultValue;
606
607 Value::Null
608}
609
610 fn safe_list_n(&self, mut dictionaryOrList: Value, mut keys: Value, optional_args: &[Value]) -> Value {
611 let mut defaultValue = get_arg(optional_args, 0, Value::Null);
612 let mut value: Value = self.safe_value_n(dictionaryOrList.clone(), keys.clone(), &[defaultValue.clone()]);
619 if is_equal(&value, &Value::Null) {
620 return defaultValue;
621 }
622 if is_true(&Value::Bool(is_array(&value))) {
623 return value;
624 }
625 return defaultValue;
626
627 Value::Null
628}
629
630 fn safe_list2(&self, mut dictionaryOrList: Value, mut key1: Value, mut key2: Value, optional_args: &[Value]) -> Value {
631 let mut defaultValue = get_arg(optional_args, 0, Value::Null);
632 let mut value: Value = self.safe_value(dictionaryOrList.clone(), key1.clone(), &[]);
639 if is_true(&(!is_equal(&value, &Value::Null))) && is_true(&Value::Bool(is_array(&value))) {
640 return value;
641 }
642 let mut value2: Value = self.safe_value(dictionaryOrList.clone(), key2.clone(), &[]);
643 if is_true(&(!is_equal(&value2, &Value::Null))) && is_true(&Value::Bool(is_array(&value2))) {
644 return value2;
645 }
646 return defaultValue;
647
648 Value::Null
649}
650
651 fn safe_list(&self, mut dictionaryOrList: Value, mut key: Value, optional_args: &[Value]) -> Value {
652 let mut defaultValue = get_arg(optional_args, 0, Value::Null);
653 let mut value: Value = self.safe_value(dictionaryOrList.clone(), key.clone(), &[defaultValue.clone()]);
660 if is_equal(&value, &Value::Null) {
661 return defaultValue;
662 }
663 if is_true(&Value::Bool(is_array(&value))) {
664 return value;
665 }
666 return defaultValue;
667
668 Value::Null
669}
670
671 fn store_by_key(&self, mut dict: Value, mut key: Value, mut value: Value) {
672 let mut k: Value = key.clone();
678 if !is_equal(&k, &Value::Null) {
679 add_element_to_object(&mut dict, &k, value.clone());
680 }
681}
682
683 fn handle_deltas(&self, mut orderbook: Value, mut deltas: Value) {
684 {
685 let mut i: Value = Value::Int(0);
686 let mut __for_first_71: bool = true;
687 while { if !__for_first_71 { i = add(&i, &Value::Int(1)); } __for_first_71 = false; is_less_than(&i, &get_array_length(&deltas)) } {
688 self.handle_delta(orderbook.clone(), get_value(&deltas, &i));
689 }
690 }
691}
692
693 fn handle_delta(&self, mut bookside: Value, mut delta: Value) {
694 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" handleDelta not supported yet".to_string()))));
695}
696
697 fn handle_deltas_with_keys(&self, mut bookSide: Value, mut deltas: Value, optional_args: &[Value]) {
698 let mut priceKey = get_arg(optional_args, 0, Value::Int(0));
699 let mut amountKey = get_arg(optional_args, 1, Value::Int(1));
700 let mut countOrIdKey = get_arg(optional_args, 2, Value::Int(2));
701 {
702 let mut i: Value = Value::Int(0);
703 let mut __for_first_72: bool = true;
704 while { if !__for_first_72 { i = add(&i, &Value::Int(1)); } __for_first_72 = false; is_less_than(&i, &get_array_length(&deltas)) } {
705 let mut bidAsk: Value = self.parse_order_book_bid_ask(get_value(&deltas, &i), &[priceKey.clone(), amountKey.clone(), countOrIdKey.clone()]);
706 bookSide.store_array(bidAsk);
707 }
708 }
709}
710
711 fn get_cache_index(&self, mut orderbook: Value, mut deltas: Value) -> Value {
712 return negate(&Value::Int(1));
713
714 Value::Null
715}
716
717 fn arrays_concat(&self, mut arraysOfArrays: Value) -> Value {
718 let mut result: Value = Value::List(vec![]);
719 {
720 let mut i: Value = Value::Int(0);
721 let mut __for_first_73: bool = true;
722 while { if !__for_first_73 { i = add(&i, &Value::Int(1)); } __for_first_73 = false; is_less_than(&i, &get_array_length(&arraysOfArrays)) } {
723 result = self.array_concat(result.clone(), get_value(&arraysOfArrays, &i));
724 }
725 }
726 return result;
727
728 Value::Null
729}
730
731 fn find_timeframe(&self, mut timeframe: Value, optional_args: &[Value]) -> Value {
732 let mut timeframes = get_arg(optional_args, 0, Value::Null);
733 if is_equal(&timeframes, &Value::Null) {
734 timeframes = self.timeframes.clone();
735 }
736 let mut keys: Value = object_keys(&timeframes);
737 {
738 let mut i: Value = Value::Int(0);
739 let mut __for_first_74: bool = true;
740 while { if !__for_first_74 { i = add(&i, &Value::Int(1)); } __for_first_74 = false; is_less_than(&i, &get_array_length(&keys)) } {
741 let mut key: Value = get_value(&keys, &i);
742 let mut key: Value = get_value(&keys, &i);
743 if is_equal(&get_value(&timeframes, &key), &timeframe) {
744 return key;
745 }
746 }
747 }
748 return Value::Null;
749
750 Value::Null
751}
752
753 fn check_proxy_url_settings(&self, optional_args: &[Value]) -> Value {
754 let mut url = get_arg(optional_args, 0, Value::Null);
755 let mut method = get_arg(optional_args, 1, Value::Null);
756 let mut headers = get_arg(optional_args, 2, Value::Null);
757 let mut body = get_arg(optional_args, 3, Value::Null);
758 let mut usedProxies: Value = Value::List(vec![]);
759 let mut proxyUrl: Value = Value::Null;
760 if !is_equal(&self.proxyUrl, &Value::Null) {
761 append_to_array(&mut usedProxies, Value::Str("proxyUrl".to_string()));
762 proxyUrl = self.proxyUrl.clone();
763 }
764 if !is_equal(&self.proxy_url, &Value::Null) {
765 append_to_array(&mut usedProxies, Value::Str("proxy_url".to_string()));
766 proxyUrl = self.proxy_url.clone();
767 }
768 if !is_equal(&self.proxyUrlCallback, &Value::Null) {
769 append_to_array(&mut usedProxies, Value::Str("proxyUrlCallback".to_string()));
770 proxyUrl = self.proxy_url_callback_fn(url.clone(), method.clone(), headers.clone(), body.clone());
771 }
772 if !is_equal(&self.proxy_url_callback, &Value::Null) {
773 append_to_array(&mut usedProxies, Value::Str("proxy_url_callback".to_string()));
774 proxyUrl = self.proxy_url_callback_fn(url.clone(), method.clone(), headers.clone(), body.clone());
775 }
776 if !is_equal(&self.proxy, &Value::Null) {
778 append_to_array(&mut usedProxies, Value::Str("proxy".to_string()));
779 if is_function(&self.proxy) {
780 proxyUrl = self.proxy_fn(url.clone(), method.clone(), headers.clone(), body.clone());
781 } else {
782 proxyUrl = self.proxy.clone();
783 }
784 }
785 let mut length: Value = get_array_length(&usedProxies);
786 if is_greater_than(&length, &Value::Int(1)) {
787 let mut joinedProxyNames: Value = join(&usedProxies, &Value::Str(",".to_string()));
788 panic!("{}", crate::exchange_errors::invalid_proxy_settings(add(&add(&add(&self.id, &Value::Str(" you have multiple conflicting proxy settings (".to_string())), &joinedProxyNames), &Value::Str("), please use only one from : proxyUrl, proxy_url, proxyUrlCallback, proxy_url_callback".to_string()))));
789 }
790 return proxyUrl;
791
792 Value::Null
793}
794
795 fn url_encoder_for_proxy_url(&self, mut targetUrl: Value) -> Value {
796 let mut includesQuery: bool = is_greater_than_or_equal(&get_index_of(&targetUrl, &Value::Str("?".to_string())), &Value::Int(0));
798 let mut finalUrl: Value = ternary(is_true(&includesQuery), self.encode_uri_component(targetUrl.clone()), targetUrl.clone());
799 return finalUrl;
800
801 Value::Null
802}
803
804 fn check_proxy_settings(&self, optional_args: &[Value]) -> Value {
805 let mut url = get_arg(optional_args, 0, Value::Null);
806 let mut method = get_arg(optional_args, 1, Value::Null);
807 let mut headers = get_arg(optional_args, 2, Value::Null);
808 let mut body = get_arg(optional_args, 3, Value::Null);
809 let mut usedProxies: Value = Value::List(vec![]);
810 let mut httpProxy: Value = Value::Null;
811 let mut httpsProxy: Value = Value::Null;
812 let mut socksProxy: Value = Value::Null;
813 let mut isHttpProxyDefined: Value = self.value_is_defined(self.httpProxy.clone());
815 let mut isHttp_proxy_defined: Value = self.value_is_defined(self.http_proxy.clone());
816 if is_true(&isHttpProxyDefined) || is_true(&isHttp_proxy_defined) {
817 append_to_array(&mut usedProxies, Value::Str("httpProxy".to_string()));
818 httpProxy = ternary(is_true(&isHttpProxyDefined), self.httpProxy.clone(), self.http_proxy.clone());
819 }
820 let mut ishttpProxyCallbackDefined: Value = self.value_is_defined(self.httpProxyCallback.clone());
821 let mut ishttp_proxy_callback_defined: Value = self.value_is_defined(self.http_proxy_callback.clone());
822 if is_true(&ishttpProxyCallbackDefined) || is_true(&ishttp_proxy_callback_defined) {
823 append_to_array(&mut usedProxies, Value::Str("httpProxyCallback".to_string()));
824 httpProxy = ternary(is_true(&ishttpProxyCallbackDefined), self.http_proxy_callback_fn(url.clone(), method.clone(), headers.clone(), body.clone()), self.http_proxy_callback_fn(url.clone(), method.clone(), headers.clone(), body.clone()));
825 }
826 let mut isHttpsProxyDefined: Value = self.value_is_defined(self.httpsProxy.clone());
828 let mut isHttps_proxy_defined: Value = self.value_is_defined(self.https_proxy.clone());
829 if is_true(&isHttpsProxyDefined) || is_true(&isHttps_proxy_defined) {
830 append_to_array(&mut usedProxies, Value::Str("httpsProxy".to_string()));
831 httpsProxy = ternary(is_true(&isHttpsProxyDefined), self.httpsProxy.clone(), self.https_proxy.clone());
832 }
833 let mut ishttpsProxyCallbackDefined: Value = self.value_is_defined(self.httpsProxyCallback.clone());
834 let mut ishttps_proxy_callback_defined: Value = self.value_is_defined(self.https_proxy_callback.clone());
835 if is_true(&ishttpsProxyCallbackDefined) || is_true(&ishttps_proxy_callback_defined) {
836 append_to_array(&mut usedProxies, Value::Str("httpsProxyCallback".to_string()));
837 httpsProxy = ternary(is_true(&ishttpsProxyCallbackDefined), self.https_proxy_callback_fn(url.clone(), method.clone(), headers.clone(), body.clone()), self.https_proxy_callback_fn(url.clone(), method.clone(), headers.clone(), body.clone()));
838 }
839 let mut isSocksProxyDefined: Value = self.value_is_defined(self.socksProxy.clone());
841 let mut isSocks_proxy_defined: Value = self.value_is_defined(self.socks_proxy.clone());
842 if is_true(&isSocksProxyDefined) || is_true(&isSocks_proxy_defined) {
843 append_to_array(&mut usedProxies, Value::Str("socksProxy".to_string()));
844 socksProxy = ternary(is_true(&isSocksProxyDefined), self.socksProxy.clone(), self.socks_proxy.clone());
845 }
846 let mut issocksProxyCallbackDefined: Value = self.value_is_defined(self.socksProxyCallback.clone());
847 let mut issocks_proxy_callback_defined: Value = self.value_is_defined(self.socks_proxy_callback.clone());
848 if is_true(&issocksProxyCallbackDefined) || is_true(&issocks_proxy_callback_defined) {
849 append_to_array(&mut usedProxies, Value::Str("socksProxyCallback".to_string()));
850 socksProxy = ternary(is_true(&issocksProxyCallbackDefined), self.socks_proxy_callback_fn(url.clone(), method.clone(), headers.clone(), body.clone()), self.socks_proxy_callback_fn(url.clone(), method.clone(), headers.clone(), body.clone()));
851 }
852 let mut length: Value = get_array_length(&usedProxies);
854 if is_greater_than(&length, &Value::Int(1)) {
855 let mut joinedProxyNames: Value = join(&usedProxies, &Value::Str(",".to_string()));
856 panic!("{}", crate::exchange_errors::invalid_proxy_settings(add(&add(&add(&self.id, &Value::Str(" you have multiple conflicting proxy settings (".to_string())), &joinedProxyNames), &Value::Str("), please use only one from: httpProxy, httpsProxy, httpProxyCallback, httpsProxyCallback, socksProxy, socksProxyCallback".to_string()))));
857 }
858 return Value::List(vec![httpProxy.clone(), httpsProxy.clone(), socksProxy.clone()]);
859
860 Value::Null
861}
862
863 fn check_ws_proxy_settings(&self) -> Value {
864 let mut usedProxies: Value = Value::List(vec![]);
865 let mut wsProxy: Value = Value::Null;
866 let mut wssProxy: Value = Value::Null;
867 let mut wsSocksProxy: Value = Value::Null;
868 let mut isWsProxyDefined: Value = self.value_is_defined(self.wsProxy.clone());
870 let mut is_ws_proxy_defined: Value = self.value_is_defined(self.ws_proxy.clone());
871 if is_true(&isWsProxyDefined) || is_true(&is_ws_proxy_defined) {
872 append_to_array(&mut usedProxies, Value::Str("wsProxy".to_string()));
873 wsProxy = ternary(is_true(&(isWsProxyDefined)), self.wsProxy.clone(), self.ws_proxy.clone());
874 }
875 let mut isWssProxyDefined: Value = self.value_is_defined(self.wssProxy.clone());
877 let mut is_wss_proxy_defined: Value = self.value_is_defined(self.wss_proxy.clone());
878 if is_true(&isWssProxyDefined) || is_true(&is_wss_proxy_defined) {
879 append_to_array(&mut usedProxies, Value::Str("wssProxy".to_string()));
880 wssProxy = ternary(is_true(&(isWssProxyDefined)), self.wssProxy.clone(), self.wss_proxy.clone());
881 }
882 let mut isWsSocksProxyDefined: Value = self.value_is_defined(self.wsSocksProxy.clone());
884 let mut is_ws_socks_proxy_defined: Value = self.value_is_defined(self.ws_socks_proxy.clone());
885 if is_true(&isWsSocksProxyDefined) || is_true(&is_ws_socks_proxy_defined) {
886 append_to_array(&mut usedProxies, Value::Str("wsSocksProxy".to_string()));
887 wsSocksProxy = ternary(is_true(&(isWsSocksProxyDefined)), self.wsSocksProxy.clone(), self.ws_socks_proxy.clone());
888 }
889 let mut length: Value = get_array_length(&usedProxies);
891 if is_greater_than(&length, &Value::Int(1)) {
892 let mut joinedProxyNames: Value = join(&usedProxies, &Value::Str(",".to_string()));
893 panic!("{}", crate::exchange_errors::invalid_proxy_settings(add(&add(&add(&self.id, &Value::Str(" you have multiple conflicting proxy settings (".to_string())), &joinedProxyNames), &Value::Str("), please use only one from: wsProxy, wssProxy, wsSocksProxy".to_string()))));
894 }
895 return Value::List(vec![wsProxy.clone(), wssProxy.clone(), wsSocksProxy.clone()]);
896
897 Value::Null
898}
899
900 fn check_conflicting_proxies(&self, mut proxyAgentSet: Value, mut proxyUrlSet: Value) {
901 let mut proxyAgentIsSet: bool = is_true(&(!is_equal(&proxyAgentSet, &Value::Null))) && is_true(&(!is_equal(&proxyAgentSet, &Value::Null))) && is_true(&(!is_equal(&proxyAgentSet, &Value::Str("".to_string()))));
902 let mut proxyUrlIsSet: bool = is_true(&(!is_equal(&proxyUrlSet, &Value::Null))) && is_true(&(!is_equal(&proxyUrlSet, &Value::Null))) && is_true(&(!is_equal(&proxyUrlSet, &Value::Str("".to_string()))));
903 if is_true(&proxyAgentIsSet) && is_true(&proxyUrlIsSet) {
904 panic!("{}", crate::exchange_errors::invalid_proxy_settings(add(&self.id, &Value::Str(" you have multiple conflicting proxy settings, please use only one from : proxyUrl, httpProxy, httpsProxy, socksProxy".to_string()))));
905 }
906}
907
908 fn check_address(&self, optional_args: &[Value]) -> Value {
909 let mut address = get_arg(optional_args, 0, Value::Null);
910 if is_equal(&address, &Value::Null) {
911 panic!("{}", crate::exchange_errors::invalid_address(add(&self.id, &Value::Str(" address is undefined".to_string()))));
912 }
913 let mut uniqChars: Value = (self.unique(self.string_to_chars_array(address.clone())));
915 let mut length: Value = get_array_length(&uniqChars); if is_equal(&length, &Value::Int(1)) || is_less_than(&get_array_length(&address), &self.minFundingAddressLength) || is_greater_than(&get_index_of(&address, &Value::Str(" ".to_string())), &negate(&Value::Int(1))) {
917 panic!("{}", crate::exchange_errors::invalid_address(add(&add(&add(&add(&add(&self.id, &Value::Str(" address is invalid or has less than ".to_string())), &to_string_val(&self.minFundingAddressLength)), &Value::Str(" characters: \"".to_string())), &to_string_val(&address)), &Value::Str("\"".to_string()))));
918 }
919 return address;
920
921 Value::Null
922}
923
924 fn find_message_hashes(&self, mut client: Value, mut element: Value) -> Value {
925 let mut result: Value = Value::List(vec![]);
926 let mut messageHashes: Value = object_keys(&get_value(&client, &Value::Str("futures".to_string())));
927 {
928 let mut i: Value = Value::Int(0);
929 let mut __for_first_75: bool = true;
930 while { if !__for_first_75 { i = add(&i, &Value::Int(1)); } __for_first_75 = false; is_less_than(&i, &get_array_length(&messageHashes)) } {
931 let mut messageHash: Value = get_value(&messageHashes, &i);
932 let mut messageHash: Value = get_value(&messageHashes, &i);
933 if is_greater_than_or_equal(&get_index_of(&messageHash, &element), &Value::Int(0)) {
934 append_to_array(&mut result, messageHash.clone());
935 }
936 }
937 }
938 return result;
939
940 Value::Null
941}
942
943 fn filter_by_limit(&self, mut array: Value, optional_args: &[Value]) -> Value {
944 let mut limit = get_arg(optional_args, 0, Value::Null);
945 let mut key = get_arg(optional_args, 1, Value::Str("timestamp".to_string()));
946 let mut fromStart = get_arg(optional_args, 2, Value::Bool(false));
947 if is_true(&self.value_is_defined(limit.clone())) {
948 let mut arrayLength: Value = get_array_length(&array);
949 if is_greater_than(&arrayLength, &Value::Int(0)) {
950 let mut ascending: bool = true;
951 if is_true(&(Value::Bool(in_op(&get_value(&array, &Value::Int(0)), &key)))) {
952 let mut first: Value = get_value(&get_value(&array, &Value::Int(0)), &key);
953 let mut last: Value = get_value(&get_value(&array, &subtract(&arrayLength, &Value::Int(1))), &key);
954 if !is_equal(&first, &Value::Null) && !is_equal(&last, &Value::Null) {
955 ascending = is_less_than_or_equal(&first, &last); }
957 }
958 if is_true(&fromStart) {
959 if is_greater_than(&limit, &arrayLength) {
960 limit = arrayLength.clone();
961 }
962 if is_true(&ascending) {
964 array = self.array_slice(array.clone(), Value::Int(0), &[limit.clone()]);
965 } else {
966 array = self.array_slice(array.clone(), negate(&limit), &[]);
967 }
968 } else {
969 if is_true(&ascending) {
971 array = self.array_slice(array.clone(), negate(&limit), &[]);
972 } else {
973 array = self.array_slice(array.clone(), Value::Int(0), &[limit.clone()]);
974 }
975 }
976 }
977 }
978 return array;
979
980 Value::Null
981}
982
983 fn filter_by_since_limit(&self, mut array: Value, optional_args: &[Value]) -> Value {
984 let mut since = get_arg(optional_args, 0, Value::Null);
985 let mut limit = get_arg(optional_args, 1, Value::Null);
986 let mut key = get_arg(optional_args, 2, Value::Str("timestamp".to_string()));
987 let mut tail = get_arg(optional_args, 3, Value::Bool(false));
988 if is_equal(&array, &Value::Null) {
989 return Value::List(vec![]);
990 }
991 let mut sinceIsDefined: Value = self.value_is_defined(since.clone());
992 let mut parsedArray: Value = self.to_array(array.clone());
993 let mut result: Value = parsedArray.clone();
994 if is_true(&sinceIsDefined) {
995 result = Value::List(vec![]);
996 {
997 let mut i: Value = Value::Int(0);
998 let mut __for_first_76: bool = true;
999 while { if !__for_first_76 { i = add(&i, &Value::Int(1)); } __for_first_76 = false; is_less_than(&i, &get_array_length(&parsedArray)) } {
1000 let mut entry: Value = get_value(&parsedArray, &i);
1001 let mut entry: Value = get_value(&parsedArray, &i);
1002 let mut value: Value = self.safe_value(entry.clone(), key.clone(), &[]);
1003 if is_true(&(!is_equal(&value, &Value::Null))) && is_true(&(!is_equal(&value, &Value::Null))) && is_true(&(!is_equal(&value, &Value::Int(0)))) && is_true(&(is_greater_than_or_equal(&value, &since))) {
1004 append_to_array(&mut result, entry.clone());
1005 }
1006 }
1007 }
1008 }
1009 if is_true(&tail) && !is_equal(&limit, &Value::Null) {
1010 return self.array_slice(result.clone(), negate(&limit), &[]);
1011 }
1012 let mut shouldFilterFromStart: Value = Value::Bool(!is_true(&tail) && is_true(&sinceIsDefined));
1015 return self.filter_by_limit(result.clone(), &[limit.clone(), key.clone(), shouldFilterFromStart.clone()]);
1016
1017 Value::Null
1018}
1019
1020 fn filter_by_value_since_limit(&self, mut array: Value, mut field: Value, optional_args: &[Value]) -> Value {
1021 let mut value = get_arg(optional_args, 0, Value::Null);
1022 let mut since = get_arg(optional_args, 1, Value::Null);
1023 let mut limit = get_arg(optional_args, 2, Value::Null);
1024 let mut key = get_arg(optional_args, 3, Value::Str("timestamp".to_string()));
1025 let mut tail = get_arg(optional_args, 4, Value::Bool(false));
1026 let mut valueIsDefined: Value = self.value_is_defined(value.clone());
1027 let mut sinceIsDefined: Value = self.value_is_defined(since.clone());
1028 let mut parsedArray: Value = self.to_array(array.clone());
1029 let mut result: Value = parsedArray.clone();
1030 if is_true(&valueIsDefined) || is_true(&sinceIsDefined) {
1032 result = Value::List(vec![]);
1033 {
1034 let mut i: Value = Value::Int(0);
1035 let mut __for_first_77: bool = true;
1036 while { if !__for_first_77 { i = add(&i, &Value::Int(1)); } __for_first_77 = false; is_less_than(&i, &get_array_length(&parsedArray)) } {
1037 let mut entry: Value = get_value(&parsedArray, &i);
1038 let mut entry: Value = get_value(&parsedArray, &i);
1039 let mut entryFiledEqualValue: Value = Value::Bool(is_equal(&self.safe_value(entry.clone(), field.clone(), &[]), &value));
1042 let mut firstCondition: Value = ternary(is_true(&valueIsDefined), entryFiledEqualValue.clone(), Value::Bool(true));
1043 let mut entryKeyValue: Value = self.safe_value(entry.clone(), key.clone(), &[]);
1044 let mut entryKeyGESince: Value = Value::Bool(is_true(&(!is_equal(&entryKeyValue, &Value::Null))) && is_true(&(!is_equal(&entryKeyValue, &Value::Null))) && is_true(&(!is_equal(&entryKeyValue, &Value::Int(0)))) && is_true(&(!is_equal(&since, &Value::Null))) && is_true(&(is_greater_than_or_equal(&entryKeyValue, &since))));
1045 let mut secondCondition: Value = ternary(is_true(&sinceIsDefined), entryKeyGESince.clone(), Value::Bool(true));
1046 if is_true(&firstCondition) && is_true(&secondCondition) {
1047 append_to_array(&mut result, entry.clone());
1048 }
1049 }
1050 }
1051 }
1052 if is_true(&tail) && !is_equal(&limit, &Value::Null) {
1053 return self.array_slice(result.clone(), negate(&limit), &[]);
1054 }
1055 return self.filter_by_limit(result.clone(), &[limit.clone(), key.clone(), sinceIsDefined.clone()]);
1056
1057 Value::Null
1058}
1059
1060fn set_sandbox_mode(&mut self, mut enabled: Value) {
1067 if is_true(&enabled) {
1068 if is_true(&Value::Bool(in_op(&self.urls, &Value::Str("test".to_string())))) {
1069 if is_string(&get_value(&self.urls, &Value::Str("api".to_string()))) {
1070 { let __be_tmp = get_value(&self.urls, &Value::Str("api".to_string())); add_element_to_object(&mut self.urls, &Value::Str("apiBackup".to_string()), __be_tmp); };
1071 { let __be_tmp = get_value(&self.urls, &Value::Str("test".to_string())); add_element_to_object(&mut self.urls, &Value::Str("api".to_string()), __be_tmp); };
1072 } else {
1073 { let __be_tmp = self.clone_value(get_value(&self.urls, &Value::Str("api".to_string()))); add_element_to_object(&mut self.urls, &Value::Str("apiBackup".to_string()), __be_tmp); };
1074 { let __be_tmp = self.clone_value(get_value(&self.urls, &Value::Str("test".to_string()))); add_element_to_object(&mut self.urls, &Value::Str("api".to_string()), __be_tmp); };
1075 }
1076 } else {
1077 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" does not have a sandbox URL".to_string()))));
1078 }
1079 self.isSandboxModeEnabled = Value::Bool(true);
1081 } else if is_true(&Value::Bool(in_op(&self.urls, &Value::Str("apiBackup".to_string())))) {
1082 if is_string(&get_value(&self.urls, &Value::Str("api".to_string()))) {
1083 { let __be_tmp = get_value(&self.urls, &Value::Str("apiBackup".to_string())); add_element_to_object(&mut self.urls, &Value::Str("api".to_string()), __be_tmp); };
1084 } else {
1085 { let __be_tmp = self.clone_value(get_value(&self.urls, &Value::Str("apiBackup".to_string()))); add_element_to_object(&mut self.urls, &Value::Str("api".to_string()), __be_tmp); };
1086 }
1087 let mut newUrls: Value = self.omit(self.urls.clone(), Value::Str("apiBackup".to_string()), &[]);
1088 self.urls = newUrls.clone();
1089 self.isSandboxModeEnabled = Value::Bool(false);
1091 }
1092}
1093
1094fn enable_demo_trading(&mut self, mut enable: Value) {
1101 if is_true(&self.isSandboxModeEnabled) {
1102 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" demo trading does not support in sandbox environment. Please check https://www.binance.com/en/support/faq/detail/9be58f73e5e14338809e3b705b9687dd to see the differences".to_string()))));
1103 }
1104 if is_true(&enable) {
1105 { let __be_tmp = get_value(&self.urls, &Value::Str("api".to_string())); add_element_to_object(&mut self.urls, &Value::Str("apiBackupDemoTrading".to_string()), __be_tmp); };
1106 { let __be_tmp = get_value(&self.urls, &Value::Str("demo".to_string())); add_element_to_object(&mut self.urls, &Value::Str("api".to_string()), __be_tmp); };
1107 } else if is_true(&Value::Bool(in_op(&self.urls, &Value::Str("apiBackupDemoTrading".to_string())))) {
1108 { let __be_tmp = get_value(&self.urls, &Value::Str("apiBackupDemoTrading".to_string())); add_element_to_object(&mut self.urls, &Value::Str("api".to_string()), __be_tmp); };
1109 let mut newUrls: Value = self.omit(self.urls.clone(), Value::Str("apiBackupDemoTrading".to_string()), &[]);
1110 self.urls = newUrls.clone();
1111 }
1112 add_element_to_object(&mut self.options, &Value::Str("enableDemoTrading".to_string()), enable.clone());
1113}
1114
1115 fn sign(&self, mut path: Value, optional_args: &[Value]) -> Value {
1116 { let __v = crate::exchange::DerivedExchange::sign(self, path.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null), crate::runtime::get_arg(optional_args, 1, crate::Value::Null), crate::runtime::get_arg(optional_args, 2, crate::Value::Null), crate::runtime::get_arg(optional_args, 3, crate::Value::Null), crate::runtime::get_arg(optional_args, 4, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
1118
1119 let mut api = get_arg(optional_args, 0, Value::Str("public".to_string()));
1120 let mut method = get_arg(optional_args, 1, Value::Str("GET".to_string()));
1121 let mut params = get_arg(optional_args, 2, Value::Map({
1122 let mut m = indexmap::IndexMap::new();
1123 m
1124}));
1125 let mut headers = get_arg(optional_args, 3, Value::Null);
1126 let mut body = get_arg(optional_args, 4, Value::Null);
1127 return Value::Map({
1128 let mut m = indexmap::IndexMap::new();
1129 m.insert("url".to_string(), Value::Null);
1130 m.insert("method".to_string(), Value::Null);
1131 m.insert("headers".to_string(), Value::Null);
1132 m.insert("body".to_string(), Value::Null);
1133 m
1134});
1135
1136 Value::Null
1137}
1138
1139 fn fetch_accounts(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1140 let mut params = get_arg(optional_args, 0, Value::Map({
1141 let mut m = indexmap::IndexMap::new();
1142 m
1143}));
1144 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchAccounts() is not supported yet".to_string()))));
1145
1146 Value::Null
1147} }
1148
1149 fn watch_liquidations(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1150 let mut since = get_arg(optional_args, 0, Value::Null);
1151 let mut limit = get_arg(optional_args, 1, Value::Null);
1152 let mut params = get_arg(optional_args, 2, Value::Map({
1153 let mut m = indexmap::IndexMap::new();
1154 m
1155}));
1156 if !is_equal(&get_value(&self.has, &Value::Str("watchLiquidationsForSymbols".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("watchLiquidationsForSymbols".to_string())), &Value::Bool(false)) {
1157 return self.watch_liquidations_for_symbols(Value::List(vec![symbol.clone()]), &[since.clone(), limit.clone(), params.clone()]).await;
1158 }
1159 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchLiquidations() is not supported yet".to_string()))));
1160
1161 Value::Null
1162} }
1163
1164 fn watch_liquidations_for_symbols(&mut self, mut symbols: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1165 let mut since = get_arg(optional_args, 0, Value::Null);
1166 let mut limit = get_arg(optional_args, 1, Value::Null);
1167 let mut params = get_arg(optional_args, 2, Value::Map({
1168 let mut m = indexmap::IndexMap::new();
1169 m
1170}));
1171 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchLiquidationsForSymbols() is not supported yet".to_string()))));
1172
1173 Value::Null
1174} }
1175
1176 fn watch_my_liquidations(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1177 let mut since = get_arg(optional_args, 0, Value::Null);
1178 let mut limit = get_arg(optional_args, 1, Value::Null);
1179 let mut params = get_arg(optional_args, 2, Value::Map({
1180 let mut m = indexmap::IndexMap::new();
1181 m
1182}));
1183 if !is_equal(&get_value(&self.has, &Value::Str("watchMyLiquidationsForSymbols".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("watchMyLiquidationsForSymbols".to_string())), &Value::Bool(false)) {
1184 return self.watch_my_liquidations_for_symbols(Value::List(vec![symbol.clone()]), &[since.clone(), limit.clone(), params.clone()]).await;
1185 }
1186 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchMyLiquidations() is not supported yet".to_string()))));
1187
1188 Value::Null
1189} }
1190
1191 fn watch_my_liquidations_for_symbols(&mut self, mut symbols: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1192 let mut since = get_arg(optional_args, 0, Value::Null);
1193 let mut limit = get_arg(optional_args, 1, Value::Null);
1194 let mut params = get_arg(optional_args, 2, Value::Map({
1195 let mut m = indexmap::IndexMap::new();
1196 m
1197}));
1198 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchMyLiquidationsForSymbols() is not supported yet".to_string()))));
1199
1200 Value::Null
1201} }
1202
1203 fn un_watch_orders(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1204 let mut symbol = get_arg(optional_args, 0, Value::Null);
1205 let mut params = get_arg(optional_args, 1, Value::Map({
1206 let mut m = indexmap::IndexMap::new();
1207 m
1208}));
1209 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" unWatchOrders() is not supported yet".to_string()))));
1210
1211 Value::Null
1212} }
1213
1214 fn un_watch_trades(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1215 let mut params = get_arg(optional_args, 0, Value::Map({
1216 let mut m = indexmap::IndexMap::new();
1217 m
1218}));
1219 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" unWatchTrades() is not supported yet".to_string()))));
1220
1221 Value::Null
1222} }
1223
1224 fn un_watch_trades_for_symbols(&mut self, mut symbols: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1225 let mut params = get_arg(optional_args, 0, Value::Map({
1226 let mut m = indexmap::IndexMap::new();
1227 m
1228}));
1229 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" unWatchTradesForSymbols() is not supported yet".to_string()))));
1230
1231 Value::Null
1232} }
1233
1234 fn watch_ohlcv_for_symbols(&mut self, mut symbolsAndTimeframes: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1235 let mut since = get_arg(optional_args, 0, Value::Null);
1236 let mut limit = get_arg(optional_args, 1, Value::Null);
1237 let mut params = get_arg(optional_args, 2, Value::Map({
1238 let mut m = indexmap::IndexMap::new();
1239 m
1240}));
1241 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchOHLCVForSymbols() is not supported yet".to_string()))));
1242
1243 Value::Null
1244} }
1245
1246 fn un_watch_ohlcv_for_symbols(&mut self, mut symbolsAndTimeframes: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1247 let mut params = get_arg(optional_args, 0, Value::Map({
1248 let mut m = indexmap::IndexMap::new();
1249 m
1250}));
1251 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" unWatchOHLCVForSymbols() is not supported yet".to_string()))));
1252
1253 Value::Null
1254} }
1255
1256 fn un_watch_order_book_for_symbols(&mut self, mut symbols: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1257 let mut params = get_arg(optional_args, 0, Value::Map({
1258 let mut m = indexmap::IndexMap::new();
1259 m
1260}));
1261 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" unWatchOrderBookForSymbols() is not supported yet".to_string()))));
1262
1263 Value::Null
1264} }
1265
1266 fn un_watch_positions(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1267 let mut symbols = get_arg(optional_args, 0, Value::Null);
1268 let mut params = get_arg(optional_args, 1, Value::Map({
1269 let mut m = indexmap::IndexMap::new();
1270 m
1271}));
1272 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" unWatchPositions() is not supported yet".to_string()))));
1273
1274 Value::Null
1275} }
1276
1277 fn un_watch_ticker(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1278 let mut params = get_arg(optional_args, 0, Value::Map({
1279 let mut m = indexmap::IndexMap::new();
1280 m
1281}));
1282 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" unWatchTicker() is not supported yet".to_string()))));
1283
1284 Value::Null
1285} }
1286
1287 fn un_watch_mark_price(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1288 let mut params = get_arg(optional_args, 0, Value::Map({
1289 let mut m = indexmap::IndexMap::new();
1290 m
1291}));
1292 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" unWatchMarkPrice() is not supported yet".to_string()))));
1293
1294 Value::Null
1295} }
1296
1297 fn un_watch_mark_prices(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1298 let mut symbols = get_arg(optional_args, 0, Value::Null);
1299 let mut params = get_arg(optional_args, 1, Value::Map({
1300 let mut m = indexmap::IndexMap::new();
1301 m
1302}));
1303 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" unWatchMarkPrices() is not supported yet".to_string()))));
1304
1305 Value::Null
1306} }
1307
1308 fn fetch_deposit_addresses(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1309 if let Some(__v) = self.dispatch_to_derived("fetch_deposit_addresses", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
1311 if !matches!(__v, crate::Value::Null) { return __v; }
1312 }
1313
1314 let mut codes = get_arg(optional_args, 0, Value::Null);
1315 let mut params = get_arg(optional_args, 1, Value::Map({
1316 let mut m = indexmap::IndexMap::new();
1317 m
1318}));
1319 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchDepositAddresses() is not supported yet".to_string()))));
1320
1321 Value::Null
1322} }
1323
1324 fn fetch_margin_mode(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1325 if let Some(__v) = self.dispatch_to_derived("fetch_margin_mode", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(symbol.clone()); __args.extend_from_slice(optional_args); __args }).await {
1327 if !matches!(__v, crate::Value::Null) { return __v; }
1328 }
1329
1330 let mut params = get_arg(optional_args, 0, Value::Map({
1331 let mut m = indexmap::IndexMap::new();
1332 m
1333}));
1334 if !is_equal(&get_value(&self.has, &Value::Str("fetchMarginModes".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchMarginModes".to_string())), &Value::Bool(false)) {
1335 let mut marginModes: Value = self.fetch_margin_modes(&[Value::List(vec![symbol.clone()]), params.clone()]).await;
1336 return self.safe_dict(marginModes.clone(), symbol.clone(), &[]);
1337 } else {
1338 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchMarginMode() is not supported yet".to_string()))));
1339 }
1340
1341 Value::Null
1342} }
1343
1344 fn fetch_margin_modes(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1345 if let Some(__v) = self.dispatch_to_derived("fetch_margin_modes", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
1347 if !matches!(__v, crate::Value::Null) { return __v; }
1348 }
1349
1350 let mut symbols = get_arg(optional_args, 0, Value::Null);
1351 let mut params = get_arg(optional_args, 1, Value::Map({
1352 let mut m = indexmap::IndexMap::new();
1353 m
1354}));
1355 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchMarginModes () is not supported yet".to_string()))));
1356
1357 Value::Null
1358} }
1359
1360 fn un_watch_order_book(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1361 let mut params = get_arg(optional_args, 0, Value::Map({
1362 let mut m = indexmap::IndexMap::new();
1363 m
1364}));
1365 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" unWatchOrderBook() is not supported yet".to_string()))));
1366
1367 Value::Null
1368} }
1369
1370 fn fetch_time(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1371 if let Some(__v) = self.dispatch_to_derived("fetch_time", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
1373 if !matches!(__v, crate::Value::Null) { return __v; }
1374 }
1375
1376 let mut params = get_arg(optional_args, 0, Value::Map({
1377 let mut m = indexmap::IndexMap::new();
1378 m
1379}));
1380 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchTime() is not supported yet".to_string()))));
1381
1382 Value::Null
1383} }
1384
1385 fn fetch_trading_limits(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1386 let mut symbols = get_arg(optional_args, 0, Value::Null);
1387 let mut params = get_arg(optional_args, 1, Value::Map({
1388 let mut m = indexmap::IndexMap::new();
1389 m
1390}));
1391 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchTradingLimits() is not supported yet".to_string()))));
1392
1393 Value::Null
1394} }
1395
1396 fn parse_currency(&self, mut rawCurrency: Value) -> Value {
1397 { let __v = crate::exchange::DerivedExchange::parse_currency(self, rawCurrency.clone()); if !matches!(__v, crate::Value::Null) { return __v; } }
1399
1400 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseCurrency() is not supported yet".to_string()))));
1401
1402 Value::Null
1403}
1404
1405 fn parse_currencies(&self, mut rawCurrencies: Value) -> Value {
1406 let mut result: Value = Value::Map({
1407 let mut m = indexmap::IndexMap::new();
1408 m
1409 });
1410 let mut arr: Value = self.to_array(rawCurrencies.clone());
1411 {
1412 let mut i: Value = Value::Int(0);
1413 let mut __for_first_78: bool = true;
1414 while { if !__for_first_78 { i = add(&i, &Value::Int(1)); } __for_first_78 = false; is_less_than(&i, &get_array_length(&arr)) } {
1415 let mut parsed: Value = <Self as crate::exchange_generated::ExchangeBase>::parse_currency(self, get_value(&arr, &i));
1416 if is_equal(&parsed, &Value::Null) {
1417 continue;
1418 }
1419 let mut code: Value = get_value(&parsed, &Value::Str("code".to_string()));
1420 add_element_to_object(&mut result, &code, parsed.clone());
1421 }
1422 }
1423 return result;
1424
1425 Value::Null
1426}
1427
1428 fn parse_market(&self, mut market: Value) -> Value {
1429 { let __v = crate::exchange::DerivedExchange::parse_market(self, market.clone()); if !matches!(__v, crate::Value::Null) { return __v; } }
1431
1432 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseMarket() is not supported yet".to_string()))));
1433
1434 Value::Null
1435}
1436
1437 fn parse_markets(&self, mut markets: Value) -> Value {
1438 let mut result: Value = Value::List(vec![]);
1439 {
1440 let mut i: Value = Value::Int(0);
1441 let mut __for_first_79: bool = true;
1442 while { if !__for_first_79 { i = add(&i, &Value::Int(1)); } __for_first_79 = false; is_less_than(&i, &get_array_length(&markets)) } {
1443 append_to_array(&mut result, <Self as crate::exchange_generated::ExchangeBase>::parse_market(self, get_value(&markets, &i)));
1444 }
1445 }
1446 return result;
1447
1448 Value::Null
1449}
1450
1451 fn parse_ticker(&self, mut ticker: Value, optional_args: &[Value]) -> Value {
1452 { let __v = crate::exchange::DerivedExchange::parse_ticker(self, ticker.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
1454
1455 let mut market = get_arg(optional_args, 0, Value::Null);
1456 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseTicker() is not supported yet".to_string()))));
1457
1458 Value::Null
1459}
1460
1461 fn parse_deposit_address(&self, mut depositAddress: Value, optional_args: &[Value]) -> Value {
1462 { let __v = crate::exchange::DerivedExchange::parse_deposit_address(self, depositAddress.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
1464
1465 let mut currency = get_arg(optional_args, 0, Value::Null);
1466 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseDepositAddress() is not supported yet".to_string()))));
1467
1468 Value::Null
1469}
1470
1471 fn parse_trade(&self, mut trade: Value, optional_args: &[Value]) -> Value {
1472 { let __v = crate::exchange::DerivedExchange::parse_trade(self, trade.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
1474
1475 let mut market = get_arg(optional_args, 0, Value::Null);
1476 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseTrade() is not supported yet".to_string()))));
1477
1478 Value::Null
1479}
1480
1481 fn parse_transaction(&self, mut transaction: Value, optional_args: &[Value]) -> Value {
1482 { let __v = crate::exchange::DerivedExchange::parse_transaction(self, transaction.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
1484
1485 let mut currency = get_arg(optional_args, 0, Value::Null);
1486 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseTransaction() is not supported yet".to_string()))));
1487
1488 Value::Null
1489}
1490
1491 fn parse_transfer(&self, mut transfer: Value, optional_args: &[Value]) -> Value {
1492 { let __v = crate::exchange::DerivedExchange::parse_transfer(self, transfer.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
1494
1495 let mut currency = get_arg(optional_args, 0, Value::Null);
1496 if is_equal(&transfer, &Value::Null) {
1497 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseTransfer() is not supported yet".to_string()))));
1498 }
1499 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseTransfer() is not supported yet".to_string()))));
1500
1501 Value::Null
1502}
1503
1504 fn parse_account(&self, mut account: Value) -> Value {
1505 { let __v = crate::exchange::DerivedExchange::parse_account(self, account.clone()); if !matches!(__v, crate::Value::Null) { return __v; } }
1507
1508 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseAccount() is not supported yet".to_string()))));
1509
1510 Value::Null
1511}
1512
1513 fn parse_ledger_entry(&self, mut item: Value, optional_args: &[Value]) -> Value {
1514 { let __v = crate::exchange::DerivedExchange::parse_ledger_entry(self, item.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
1516
1517 let mut currency = get_arg(optional_args, 0, Value::Null);
1518 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseLedgerEntry() is not supported yet".to_string()))));
1519
1520 Value::Null
1521}
1522
1523 fn parse_order(&self, mut order: Value, optional_args: &[Value]) -> Value {
1524 { let __v = crate::exchange::DerivedExchange::parse_order(self, order.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
1526
1527 let mut market = get_arg(optional_args, 0, Value::Null);
1528 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseOrder() is not supported yet".to_string()))));
1529
1530 Value::Null
1531}
1532
1533 fn fetch_cross_borrow_rates(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1534 let mut params = get_arg(optional_args, 0, Value::Map({
1535 let mut m = indexmap::IndexMap::new();
1536 m
1537}));
1538 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchCrossBorrowRates() is not supported yet".to_string()))));
1539
1540 Value::Null
1541} }
1542
1543 fn fetch_isolated_borrow_rates(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1544 let mut params = get_arg(optional_args, 0, Value::Map({
1545 let mut m = indexmap::IndexMap::new();
1546 m
1547}));
1548 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchIsolatedBorrowRates() is not supported yet".to_string()))));
1549
1550 Value::Null
1551} }
1552
1553 fn parse_market_leverage_tiers(&self, mut info: Value, optional_args: &[Value]) -> Value {
1554 { let __v = crate::exchange::DerivedExchange::parse_market_leverage_tiers(self, info.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
1556
1557 let mut market = get_arg(optional_args, 0, Value::Null);
1558 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseMarketLeverageTiers() is not supported yet".to_string()))));
1559
1560 Value::Null
1561}
1562
1563 fn fetch_leverage_tiers(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1564 if let Some(__v) = self.dispatch_to_derived("fetch_leverage_tiers", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
1566 if !matches!(__v, crate::Value::Null) { return __v; }
1567 }
1568
1569 let mut symbols = get_arg(optional_args, 0, Value::Null);
1570 let mut params = get_arg(optional_args, 1, Value::Map({
1571 let mut m = indexmap::IndexMap::new();
1572 m
1573}));
1574 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchLeverageTiers() is not supported yet".to_string()))));
1575
1576 Value::Null
1577} }
1578
1579 fn parse_position(&self, mut position: Value, optional_args: &[Value]) -> Value {
1580 { let __v = crate::exchange::DerivedExchange::parse_position(self, position.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
1582
1583 let mut market = get_arg(optional_args, 0, Value::Null);
1584 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parsePosition() is not supported yet".to_string()))));
1585
1586 Value::Null
1587}
1588
1589 fn parse_funding_rate_history(&self, mut info: Value, optional_args: &[Value]) -> Value {
1590 { let __v = crate::exchange::DerivedExchange::parse_funding_rate_history(self, info.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
1592
1593 let mut market = get_arg(optional_args, 0, Value::Null);
1594 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseFundingRateHistory() is not supported yet".to_string()))));
1595
1596 Value::Null
1597}
1598
1599 fn parse_borrow_interest(&self, mut info: Value, optional_args: &[Value]) -> Value {
1600 { let __v = crate::exchange::DerivedExchange::parse_borrow_interest(self, info.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
1602
1603 let mut market = get_arg(optional_args, 0, Value::Null);
1604 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseBorrowInterest() is not supported yet".to_string()))));
1605
1606 Value::Null
1607}
1608
1609 fn parse_isolated_borrow_rate(&self, mut info: Value, optional_args: &[Value]) -> Value {
1610 let mut market = get_arg(optional_args, 0, Value::Null);
1611 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseIsolatedBorrowRate() is not supported yet".to_string()))));
1612
1613 Value::Null
1614}
1615
1616 fn parse_ws_trade(&self, mut trade: Value, optional_args: &[Value]) -> Value {
1617 let mut market = get_arg(optional_args, 0, Value::Null);
1618 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseWsTrade() is not supported yet".to_string()))));
1619
1620 Value::Null
1621}
1622
1623 fn parse_ws_order(&self, mut order: Value, optional_args: &[Value]) -> Value {
1624 let mut market = get_arg(optional_args, 0, Value::Null);
1625 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseWsOrder() is not supported yet".to_string()))));
1626
1627 Value::Null
1628}
1629
1630 fn parse_ws_order_trade(&self, mut trade: Value, optional_args: &[Value]) -> Value {
1631 let mut market = get_arg(optional_args, 0, Value::Null);
1632 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseWsOrderTrade() is not supported yet".to_string()))));
1633
1634 Value::Null
1635}
1636
1637 fn parse_ws_ohlcv(&self, mut ohlcv: Value, optional_args: &[Value]) -> Value {
1638 let mut market = get_arg(optional_args, 0, Value::Null);
1639 return <Self as crate::exchange_generated::ExchangeBase>::parse_ohlcv(self, ohlcv.clone(), &[market.clone()]);
1640
1641 Value::Null
1642}
1643
1644 fn fetch_funding_rates(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1645 if let Some(__v) = self.dispatch_to_derived("fetch_funding_rates", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
1647 if !matches!(__v, crate::Value::Null) { return __v; }
1648 }
1649
1650 let mut symbols = get_arg(optional_args, 0, Value::Null);
1651 let mut params = get_arg(optional_args, 1, Value::Map({
1652 let mut m = indexmap::IndexMap::new();
1653 m
1654}));
1655 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchFundingRates() is not supported yet".to_string()))));
1656
1657 Value::Null
1658} }
1659
1660 fn fetch_funding_intervals(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1661 if let Some(__v) = self.dispatch_to_derived("fetch_funding_intervals", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
1663 if !matches!(__v, crate::Value::Null) { return __v; }
1664 }
1665
1666 let mut symbols = get_arg(optional_args, 0, Value::Null);
1667 let mut params = get_arg(optional_args, 1, Value::Map({
1668 let mut m = indexmap::IndexMap::new();
1669 m
1670}));
1671 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchFundingIntervals() is not supported yet".to_string()))));
1672
1673 Value::Null
1674} }
1675
1676 fn watch_funding_rate(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1677 let mut params = get_arg(optional_args, 0, Value::Map({
1678 let mut m = indexmap::IndexMap::new();
1679 m
1680}));
1681 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchFundingRate() is not supported yet".to_string()))));
1682
1683 Value::Null
1684} }
1685
1686 fn watch_funding_rates(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1687 let mut symbols = get_arg(optional_args, 0, Value::Null);
1688 let mut params = get_arg(optional_args, 1, Value::Map({
1689 let mut m = indexmap::IndexMap::new();
1690 m
1691}));
1692 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchFundingRates() is not supported yet".to_string()))));
1693
1694 Value::Null
1695} }
1696
1697 fn un_watch_funding_rates(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1698 let mut symbols = get_arg(optional_args, 0, Value::Null);
1699 let mut params = get_arg(optional_args, 1, Value::Map({
1700 let mut m = indexmap::IndexMap::new();
1701 m
1702}));
1703 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" unWatchFundingRates() is not supported yet".to_string()))));
1704
1705 Value::Null
1706} }
1707
1708 fn watch_funding_rates_for_symbols(&mut self, mut symbols: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1709 let mut params = get_arg(optional_args, 0, Value::Map({
1710 let mut m = indexmap::IndexMap::new();
1711 m
1712}));
1713 return self.watch_funding_rates(&[symbols.clone(), params.clone()]).await;
1714
1715 Value::Null
1716} }
1717
1718 fn transfer(&mut self, mut code: Value, mut amount: Value, mut fromAccount: Value, mut toAccount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1719 if let Some(__v) = self.dispatch_to_derived("transfer", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(code.clone()); __args.push(amount.clone()); __args.push(fromAccount.clone()); __args.push(toAccount.clone()); __args.extend_from_slice(optional_args); __args }).await {
1721 if !matches!(__v, crate::Value::Null) { return __v; }
1722 }
1723
1724 let mut params = get_arg(optional_args, 0, Value::Map({
1725 let mut m = indexmap::IndexMap::new();
1726 m
1727}));
1728 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" transfer() is not supported yet".to_string()))));
1729
1730 Value::Null
1731} }
1732
1733 fn withdraw(&mut self, mut code: Value, mut amount: Value, mut address: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1734 if let Some(__v) = self.dispatch_to_derived("withdraw", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(code.clone()); __args.push(amount.clone()); __args.push(address.clone()); __args.extend_from_slice(optional_args); __args }).await {
1736 if !matches!(__v, crate::Value::Null) { return __v; }
1737 }
1738
1739 let mut tag = get_arg(optional_args, 0, Value::Null);
1740 let mut params = get_arg(optional_args, 1, Value::Map({
1741 let mut m = indexmap::IndexMap::new();
1742 m
1743}));
1744 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" withdraw() is not supported yet".to_string()))));
1745
1746 Value::Null
1747} }
1748
1749 fn create_deposit_address(&mut self, mut code: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1750 let mut params = get_arg(optional_args, 0, Value::Map({
1751 let mut m = indexmap::IndexMap::new();
1752 m
1753}));
1754 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createDepositAddress() is not supported yet".to_string()))));
1755
1756 Value::Null
1757} }
1758
1759 fn set_leverage(&mut self, mut leverage: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1760 if let Some(__v) = self.dispatch_to_derived("set_leverage", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(leverage.clone()); __args.extend_from_slice(optional_args); __args }).await {
1762 if !matches!(__v, crate::Value::Null) { return __v; }
1763 }
1764
1765 let mut symbol = get_arg(optional_args, 0, Value::Null);
1766 let mut params = get_arg(optional_args, 1, Value::Map({
1767 let mut m = indexmap::IndexMap::new();
1768 m
1769}));
1770 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" setLeverage() is not supported yet".to_string()))));
1771
1772 Value::Null
1773} }
1774
1775 fn fetch_leverage(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1776 if let Some(__v) = self.dispatch_to_derived("fetch_leverage", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(symbol.clone()); __args.extend_from_slice(optional_args); __args }).await {
1778 if !matches!(__v, crate::Value::Null) { return __v; }
1779 }
1780
1781 let mut params = get_arg(optional_args, 0, Value::Map({
1782 let mut m = indexmap::IndexMap::new();
1783 m
1784}));
1785 if !is_equal(&get_value(&self.has, &Value::Str("fetchLeverages".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchLeverages".to_string())), &Value::Bool(false)) {
1786 let mut leverages: Value = self.fetch_leverages(&[Value::List(vec![symbol.clone()]), params.clone()]).await;
1787 return self.safe_dict(leverages.clone(), symbol.clone(), &[]);
1788 } else {
1789 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchLeverage() is not supported yet".to_string()))));
1790 }
1791
1792 Value::Null
1793} }
1794
1795 fn fetch_leverages(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1796 if let Some(__v) = self.dispatch_to_derived("fetch_leverages", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
1798 if !matches!(__v, crate::Value::Null) { return __v; }
1799 }
1800
1801 let mut symbols = get_arg(optional_args, 0, Value::Null);
1802 let mut params = get_arg(optional_args, 1, Value::Map({
1803 let mut m = indexmap::IndexMap::new();
1804 m
1805}));
1806 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchLeverages() is not supported yet".to_string()))));
1807
1808 Value::Null
1809} }
1810
1811 fn set_position_mode(&mut self, mut hedged: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1812 if let Some(__v) = self.dispatch_to_derived("set_position_mode", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(hedged.clone()); __args.extend_from_slice(optional_args); __args }).await {
1814 if !matches!(__v, crate::Value::Null) { return __v; }
1815 }
1816
1817 let mut symbol = get_arg(optional_args, 0, Value::Null);
1818 let mut params = get_arg(optional_args, 1, Value::Map({
1819 let mut m = indexmap::IndexMap::new();
1820 m
1821}));
1822 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" setPositionMode() is not supported yet".to_string()))));
1823
1824 Value::Null
1825} }
1826
1827 fn add_margin(&mut self, mut symbol: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1828 if let Some(__v) = self.dispatch_to_derived("add_margin", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(symbol.clone()); __args.push(amount.clone()); __args.extend_from_slice(optional_args); __args }).await {
1830 if !matches!(__v, crate::Value::Null) { return __v; }
1831 }
1832
1833 let mut params = get_arg(optional_args, 0, Value::Map({
1834 let mut m = indexmap::IndexMap::new();
1835 m
1836}));
1837 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" addMargin() is not supported yet".to_string()))));
1838
1839 Value::Null
1840} }
1841
1842 fn reduce_margin(&mut self, mut symbol: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1843 if let Some(__v) = self.dispatch_to_derived("reduce_margin", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(symbol.clone()); __args.push(amount.clone()); __args.extend_from_slice(optional_args); __args }).await {
1845 if !matches!(__v, crate::Value::Null) { return __v; }
1846 }
1847
1848 let mut params = get_arg(optional_args, 0, Value::Map({
1849 let mut m = indexmap::IndexMap::new();
1850 m
1851}));
1852 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" reduceMargin() is not supported yet".to_string()))));
1853
1854 Value::Null
1855} }
1856
1857 fn set_margin(&mut self, mut symbol: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1858 let mut params = get_arg(optional_args, 0, Value::Map({
1859 let mut m = indexmap::IndexMap::new();
1860 m
1861}));
1862 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" setMargin() is not supported yet".to_string()))));
1863
1864 Value::Null
1865} }
1866
1867 fn fetch_long_short_ratio(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1868 let mut timeframe = get_arg(optional_args, 0, Value::Null);
1869 let mut params = get_arg(optional_args, 1, Value::Map({
1870 let mut m = indexmap::IndexMap::new();
1871 m
1872}));
1873 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchLongShortRatio() is not supported yet".to_string()))));
1874
1875 Value::Null
1876} }
1877
1878 fn fetch_long_short_ratio_history(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1879 let mut symbol = get_arg(optional_args, 0, Value::Null);
1880 let mut timeframe = get_arg(optional_args, 1, Value::Null);
1881 let mut since = get_arg(optional_args, 2, Value::Null);
1882 let mut limit = get_arg(optional_args, 3, Value::Null);
1883 let mut params = get_arg(optional_args, 4, Value::Map({
1884 let mut m = indexmap::IndexMap::new();
1885 m
1886}));
1887 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchLongShortRatioHistory() is not supported yet".to_string()))));
1888
1889 Value::Null
1890} }
1891
1892 fn fetch_margin_adjustment_history(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1893 let mut symbol = get_arg(optional_args, 0, Value::Null);
1894 let mut type_var = get_arg(optional_args, 1, Value::Null);
1895 let mut since = get_arg(optional_args, 2, Value::Null);
1896 let mut limit = get_arg(optional_args, 3, Value::Null);
1897 let mut params = get_arg(optional_args, 4, Value::Map({
1898 let mut m = indexmap::IndexMap::new();
1899 m
1900}));
1901 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchMarginAdjustmentHistory() is not supported yet".to_string()))));
1902
1903 Value::Null
1904} }
1905
1906 fn set_margin_mode(&mut self, mut marginMode: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1907 if let Some(__v) = self.dispatch_to_derived("set_margin_mode", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(marginMode.clone()); __args.extend_from_slice(optional_args); __args }).await {
1909 if !matches!(__v, crate::Value::Null) { return __v; }
1910 }
1911
1912 let mut symbol = get_arg(optional_args, 0, Value::Null);
1913 let mut params = get_arg(optional_args, 1, Value::Map({
1914 let mut m = indexmap::IndexMap::new();
1915 m
1916}));
1917 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" setMarginMode() is not supported yet".to_string()))));
1918
1919 Value::Null
1920} }
1921
1922 fn fetch_deposit_addresses_by_network(&mut self, mut code: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1923 if let Some(__v) = self.dispatch_to_derived("fetch_deposit_addresses_by_network", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(code.clone()); __args.extend_from_slice(optional_args); __args }).await {
1925 if !matches!(__v, crate::Value::Null) { return __v; }
1926 }
1927
1928 let mut params = get_arg(optional_args, 0, Value::Map({
1929 let mut m = indexmap::IndexMap::new();
1930 m
1931}));
1932 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchDepositAddressesByNetwork() is not supported yet".to_string()))));
1933
1934 Value::Null
1935} }
1936
1937 fn fetch_open_interest_history(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1938 let mut timeframe = get_arg(optional_args, 0, Value::Str("1h".to_string()));
1939 let mut since = get_arg(optional_args, 1, Value::Null);
1940 let mut limit = get_arg(optional_args, 2, Value::Null);
1941 let mut params = get_arg(optional_args, 3, Value::Map({
1942 let mut m = indexmap::IndexMap::new();
1943 m
1944}));
1945 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOpenInterestHistory() is not supported yet".to_string()))));
1946
1947 Value::Null
1948} }
1949
1950 fn fetch_open_interests(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1951 if let Some(__v) = self.dispatch_to_derived("fetch_open_interests", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
1953 if !matches!(__v, crate::Value::Null) { return __v; }
1954 }
1955
1956 let mut symbols = get_arg(optional_args, 0, Value::Null);
1957 let mut params = get_arg(optional_args, 1, Value::Map({
1958 let mut m = indexmap::IndexMap::new();
1959 m
1960}));
1961 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOpenInterests() is not supported yet".to_string()))));
1962
1963 Value::Null
1964} }
1965
1966 fn sign_in(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1967 if let Some(__v) = self.dispatch_to_derived("sign_in", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
1969 if !matches!(__v, crate::Value::Null) { return __v; }
1970 }
1971
1972 let mut params = get_arg(optional_args, 0, Value::Map({
1973 let mut m = indexmap::IndexMap::new();
1974 m
1975}));
1976 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" signIn() is not supported yet".to_string()))));
1977
1978 Value::Null
1979} }
1980
1981 fn fetch_payment_methods(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
1982 let mut params = get_arg(optional_args, 0, Value::Map({
1983 let mut m = indexmap::IndexMap::new();
1984 m
1985}));
1986 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchPaymentMethods() is not supported yet".to_string()))));
1987
1988 Value::Null
1989} }
1990
1991 fn parse_to_int(&self, mut number: Value) -> Value {
1992 let mut stringifiedNumber: Value = self.number_to_string(number.clone());
1998 let mut convertedNumber: Value = crate::runtime::parse_float(&stringifiedNumber);
1999 return crate::runtime::parse_int(&convertedNumber);
2000
2001 Value::Null
2002}
2003
2004 fn parse_to_numeric(&self, mut number: Value) -> Value {
2005 let mut stringVersion: Value = self.number_to_string(number.clone()); if is_greater_than_or_equal(&get_index_of(&stringVersion, &Value::Str(".".to_string())), &Value::Int(0)) {
2011 return crate::runtime::parse_float(&stringVersion);
2012 }
2013 return crate::runtime::parse_int(&stringVersion);
2014
2015 Value::Null
2016}
2017
2018 fn is_round_number(&self, mut value: Value) -> Value {
2019 let mut res: Value = self.parse_to_numeric((mod_val(&value, &Value::Int(1))));
2022 return Value::Bool(is_equal(&res, &Value::Int(0)));
2023
2024 Value::Null
2025}
2026
2027 fn is_empty_string(&self, mut value: Value) -> Value {
2028 return Value::Bool(!is_true(&self.value_is_defined(value.clone())) || is_equal(&value, &Value::Str("".to_string())));
2029
2030 Value::Null
2031}
2032
2033 fn safe_number_omit_zero(&self, mut obj: Value, mut key: Value, optional_args: &[Value]) -> Value {
2034 let mut defaultValue = get_arg(optional_args, 0, Value::Null);
2035 let mut value: Value = self.safe_string(obj.clone(), key.clone(), &[]);
2036 let mut final_val: Value = self.parse_number(self.omit_zero(value.clone()), &[]);
2037 return ternary(is_true(&(is_equal(&final_val, &Value::Null))), defaultValue.clone(), final_val.clone());
2038
2039 Value::Null
2040}
2041
2042 fn safe_integer_omit_zero(&self, mut obj: Value, mut key: Value, optional_args: &[Value]) -> Value {
2043 let mut defaultValue = get_arg(optional_args, 0, Value::Null);
2044 let mut timestamp: Value = self.safe_integer(obj.clone(), key.clone(), &[defaultValue.clone()]);
2045 if is_equal(×tamp, &Value::Null) || is_equal(×tamp, &Value::Int(0)) {
2046 return Value::Null;
2047 }
2048 return timestamp;
2049
2050 Value::Null
2051}
2052
2053 fn after_construct(&mut self) {
2054 self.create_networks_by_id_object();
2056 self.features_generator();
2057 if !is_equal(&self.markets, &Value::Null) {
2059 self.set_markets(self.markets.clone(), &[]);
2060 }
2061 self.init_rest_rate_limiter();
2063 let mut isSandbox: Value = self.safe_bool2(self.options.clone(), Value::Str("sandbox".to_string()), Value::Str("testnet".to_string()), &[Value::Bool(false)]);
2065 if is_equal(&isSandbox, &Value::Bool(true)) {
2066 self.set_sandbox_mode(isSandbox.clone());
2067 }
2068}
2069
2070 fn init_rest_rate_limiter(&mut self) {
2071 if is_equal(&self.rateLimit, &Value::Null) || is_true(&(!is_equal(&self.id, &Value::Null) && is_equal(&self.rateLimit, &negate(&Value::Int(1))))) {
2072 panic!("{}", crate::exchange_errors::exchange_error(add(&self.id, &Value::Str(".rateLimit property is not configured".to_string()))));
2073 }
2074 let mut refillRate: Value = self.MAX_VALUE.clone();
2075 if is_greater_than(&self.rateLimit, &Value::Int(0)) {
2076 refillRate = divide(&Value::Int(1), &self.rateLimit);
2077 }
2078 let mut useLeaky: bool = is_true(&(is_equal(&self.rollingWindowSize, &Value::Int(0)))) || is_true(&(is_equal(&self.rateLimiterAlgorithm, &Value::Str("leakyBucket".to_string()))));
2079 let mut algorithm: Value = ternary(is_true(&useLeaky), Value::Str("leakyBucket".to_string()), Value::Str("rollingWindow".to_string()));
2080 let mut defaultBucket: Value = Value::Map({
2081 let mut m = indexmap::IndexMap::new();
2082 m.insert("delay".to_string(), Value::Float(0.001));
2083 m.insert("capacity".to_string(), Value::Int(1));
2084 m.insert("cost".to_string(), Value::Int(1));
2085 m.insert("refillRate".to_string(), refillRate.clone());
2086 m.insert("algorithm".to_string(), algorithm.clone());
2087 m.insert("windowSize".to_string(), self.rollingWindowSize.clone());
2088 m.insert("rateLimit".to_string(), self.rateLimit.clone());
2089 m
2090 });
2091 let mut existingBucket: Value = ternary(is_true(&(is_equal(&self.tokenBucket, &Value::Null))), Value::Map({
2092 let mut m = indexmap::IndexMap::new();
2093 m
2094}), self.tokenBucket.clone());
2095 { let __t = self.extend(defaultBucket.clone(), &[existingBucket.clone()]); self.tokenBucket = __t; }
2096 self.init_throttler();
2097}
2098
2099 fn features_generator(&mut self) {
2100 if is_equal(&self.features, &Value::Null) {
2115 return;
2116 }
2117 let mut initialFeatures: Value = self.features.clone();
2119 self.features = Value::Map({
2120 let mut m = indexmap::IndexMap::new();
2121 m
2122 });
2123 let mut unifiedMarketTypes: Value = Value::List(vec![Value::Str("spot".to_string()), Value::Str("swap".to_string()), Value::Str("future".to_string()), Value::Str("option".to_string())]);
2124 let mut subTypes: Value = Value::List(vec![Value::Str("linear".to_string()), Value::Str("inverse".to_string())]);
2125 {
2126 let mut i: Value = Value::Int(0);
2127 let mut __for_first_81: bool = true;
2128 while { if !__for_first_81 { i = add(&i, &Value::Int(1)); } __for_first_81 = false; is_less_than(&i, &get_array_length(&unifiedMarketTypes)) } {
2129 let mut marketType: Value = get_value(&unifiedMarketTypes, &i);
2130 let mut marketType: Value = get_value(&unifiedMarketTypes, &i);
2131 if !is_true(&(Value::Bool(in_op(&initialFeatures, &marketType)))) {
2133 add_element_to_object(&mut self.features, &marketType, Value::Null);
2134 } else {
2135 if is_equal(&marketType, &Value::Str("spot".to_string())) {
2136 { let __be_tmp = self.features_mapper(initialFeatures.clone(), marketType.clone(), &[]); add_element_to_object(&mut self.features, &marketType, __be_tmp); };
2137 } else {
2138 add_element_to_object(&mut self.features, &marketType, Value::Map({
2139 let mut m = indexmap::IndexMap::new();
2140 m
2141}));
2142 {
2143 let mut j: Value = Value::Int(0);
2144 let mut __for_first_80: bool = true;
2145 while { if !__for_first_80 { j = add(&j, &Value::Int(1)); } __for_first_80 = false; is_less_than(&j, &get_array_length(&subTypes)) } {
2146 let mut subType: Value = get_value(&subTypes, &j);
2147 let mut subType: Value = get_value(&subTypes, &j);
2148 { let __be_tmp = self.features_mapper(initialFeatures.clone(), marketType.clone(), &[subType.clone()]); add_element_to_object(get_value_mut(&mut self.features, &marketType), &subType, __be_tmp); };
2149 }
2150 }
2151 }
2152 }
2153 }
2154 }
2155}
2156
2157 fn features_mapper(&mut self, mut initialFeatures: Value, mut marketType: Value, optional_args: &[Value]) -> Value {
2158 let mut subType = get_arg(optional_args, 0, Value::Null);
2159 let mut featuresObj: Value = ternary(is_true(&(!is_equal(&subType, &Value::Null))), get_value(&get_value(&initialFeatures, &marketType), &subType), get_value(&initialFeatures, &marketType));
2160 if is_equal(&featuresObj, &Value::Null) {
2162 return Value::Null;
2163 }
2164 let mut extendsStr: Value = self.safe_string_k(featuresObj.clone(), "extends", &[]);
2165 if !is_equal(&extendsStr, &Value::Null) {
2166 featuresObj = self.omit(featuresObj.clone(), Value::Str("extends".to_string()), &[]);
2167 let mut extendObj: Value = self.features_mapper(initialFeatures.clone(), extendsStr.clone(), &[]);
2168 featuresObj = self.deep_extend(extendObj.clone(), &[featuresObj.clone()]);
2169 }
2170 if is_true(&Value::Bool(in_op(&featuresObj, &Value::Str("createOrder".to_string())))) {
2175 let mut value: Value = self.safe_dict(get_value(&featuresObj, &Value::Str("createOrder".to_string())), Value::Str("attachedStopLossTakeProfit".to_string()), &[]);
2176 add_element_to_object(get_value_mut(&mut featuresObj, &Value::Str("createOrder".to_string())), &Value::Str("stopLoss".to_string()), value.clone());
2177 add_element_to_object(get_value_mut(&mut featuresObj, &Value::Str("createOrder".to_string())), &Value::Str("takeProfit".to_string()), value.clone());
2178 if is_equal(&marketType, &Value::Str("spot".to_string())) {
2179 add_element_to_object(get_value_mut(&mut featuresObj, &Value::Str("createOrder".to_string())), &Value::Str("hedged".to_string()), Value::Bool(false));
2181 if !is_true(&(Value::Bool(in_op(&get_value(&featuresObj, &Value::Str("createOrder".to_string())), &Value::Str("leverage".to_string()))))) {
2183 add_element_to_object(get_value_mut(&mut featuresObj, &Value::Str("createOrder".to_string())), &Value::Str("leverage".to_string()), Value::Bool(false));
2184 }
2185 }
2186 if is_equal(&self.safe_bool(get_value(&get_value(&featuresObj, &Value::Str("createOrder".to_string())), &Value::Str("timeInForce".to_string())), Value::Str("GTC".to_string()), &[]), &Value::Null) {
2188 add_element_to_object(get_value_mut(get_value_mut(&mut featuresObj, &Value::Str("createOrder".to_string())), &Value::Str("timeInForce".to_string())), &Value::Str("GTC".to_string()), Value::Bool(true));
2189 }
2190 }
2191 let mut keys: Value = object_keys(&featuresObj);
2193 {
2194 let mut i: Value = Value::Int(0);
2195 let mut __for_first_82: bool = true;
2196 while { if !__for_first_82 { i = add(&i, &Value::Int(1)); } __for_first_82 = false; is_less_than(&i, &get_array_length(&keys)) } {
2197 let mut key: Value = get_value(&keys, &i);
2198 let mut key: Value = get_value(&keys, &i);
2199 let mut featureBlock: Value = get_value(&featuresObj, &key);
2200 let mut featureBlock: Value = get_value(&featuresObj, &key);
2201 if !is_true(&self.in_array(key.clone(), Value::List(vec![Value::Str("sandbox".to_string())]))) && !is_equal(&featureBlock, &Value::Null) {
2202 if !is_true(&(Value::Bool(in_op(&featureBlock, &Value::Str("symbolRequired".to_string()))))) {
2204 add_element_to_object(&mut featureBlock, &Value::Str("symbolRequired".to_string()), self.in_array(key.clone(), Value::List(vec![Value::Str("createOrder".to_string()), Value::Str("createOrders".to_string()), Value::Str("fetchOHLCV".to_string())])));
2205 }
2206 }
2207 }
2208 }
2209 return featuresObj;
2210
2211 Value::Null
2212}
2213
2214 fn feature_value(&self, mut symbol: Value, optional_args: &[Value]) -> Value {
2215 let mut methodName = get_arg(optional_args, 0, Value::Null);
2216 let mut paramName = get_arg(optional_args, 1, Value::Null);
2217 let mut defaultValue = get_arg(optional_args, 2, Value::Null);
2218 let mut market: Value = self.market(symbol.clone());
2229 return self.feature_value_by_type(get_value(&market, &Value::Str("type".to_string())), get_value(&market, &Value::Str("subType".to_string())), &[methodName.clone(), paramName.clone(), defaultValue.clone()]);
2230
2231 Value::Null
2232}
2233
2234 fn feature_value_by_type(&self, mut marketType: Value, mut subType: Value, optional_args: &[Value]) -> Value {
2235 let mut methodName = get_arg(optional_args, 0, Value::Null);
2236 let mut paramName = get_arg(optional_args, 1, Value::Null);
2237 let mut defaultValue = get_arg(optional_args, 2, Value::Null);
2238 if is_equal(&self.features, &Value::Null) {
2251 return defaultValue;
2252 }
2253 if is_equal(&marketType, &Value::Null) {
2254 return defaultValue;
2255 }
2256 if !is_true(&(Value::Bool(in_op(&self.features, &marketType)))) {
2258 return defaultValue;
2259 }
2260 if is_equal(&get_value(&self.features, &marketType), &Value::Null) {
2262 return defaultValue;
2263 }
2264 let mut methodsContainer: Value = get_value(&self.features, &marketType);
2265 if is_equal(&subType, &Value::Null) {
2266 if !is_equal(&marketType, &Value::Str("spot".to_string())) {
2267 return defaultValue;
2268 }
2269 } else {
2270 if !is_true(&(Value::Bool(in_op(&get_value(&self.features, &marketType), &subType)))) {
2271 return defaultValue;
2272 }
2273 if is_equal(&get_value(&get_value(&self.features, &marketType), &subType), &Value::Null) {
2275 return defaultValue;
2276 }
2277 methodsContainer = get_value(&get_value(&self.features, &marketType), &subType);
2278 }
2279 if is_equal(&methodName, &Value::Null) {
2281 return ternary(is_true(&(!is_equal(&defaultValue, &Value::Null))), defaultValue.clone(), methodsContainer.clone());
2282 }
2283 if !is_true(&(Value::Bool(in_op(&methodsContainer, &methodName)))) {
2284 return defaultValue;
2285 }
2286 let mut methodDict: Value = get_value(&methodsContainer, &methodName);
2287 let mut methodDict: Value = get_value(&methodsContainer, &methodName);
2288 if is_equal(&methodDict, &Value::Null) {
2289 return defaultValue;
2290 }
2291 if is_equal(¶mName, &Value::Null) {
2293 return ternary(is_true(&(!is_equal(&defaultValue, &Value::Null))), defaultValue.clone(), methodDict.clone());
2294 }
2295 let mut splited: Value = split(¶mName, &Value::Str(".".to_string())); let mut parentKey: Value = get_value(&splited, &Value::Int(0));
2297 let mut subKey: Value = self.safe_string(splited.clone(), Value::Int(1), &[]);
2298 if !is_true(&(Value::Bool(in_op(&methodDict, &parentKey)))) {
2299 return defaultValue;
2300 }
2301 let mut dictionary: Value = self.safe_dict(methodDict.clone(), parentKey.clone(), &[]);
2302 if is_equal(&dictionary, &Value::Null) {
2303 return get_value(&methodDict, &parentKey);
2304 } else {
2305 if is_equal(&subKey, &Value::Null) {
2307 return get_value(&methodDict, &parentKey);
2308 }
2309 if !is_true(&(Value::Bool(in_op(&get_value(&methodDict, &parentKey), &subKey)))) {
2311 return defaultValue;
2312 }
2313 return get_value(&get_value(&methodDict, &parentKey), &subKey);
2314 }
2315
2316 Value::Null
2317}
2318
2319 fn orderbook_checksum_message(&self, mut symbol: Value) -> Value {
2320 return add(&add(&symbol, &Value::Str(" : ".to_string())), &Value::Str("orderbook data checksum validation failed. You can reconnect by calling watchOrderBook again or you can mute the error by setting exchange.options[\"watchOrderBook\"][\"checksum\"] = false".to_string()));
2321
2322 Value::Null
2323}
2324
2325 fn create_networks_by_id_object(&mut self) {
2326 let mut networkIdsToCodesGenerated: Value = self.invert_flat_string_dictionary(self.safe_value_k(self.options.clone(), "networks", &[Value::Map({
2328 let mut m = indexmap::IndexMap::new();
2329 m
2330 })])); { let __be_tmp = self.extend(networkIdsToCodesGenerated.clone(), &[self.safe_value_k(self.options.clone(), "networksById", &[Value::Map({
2332 let mut m = indexmap::IndexMap::new();
2333 m
2334})])]); add_element_to_object(&mut self.options, &Value::Str("networksById".to_string()), __be_tmp); }; }
2336
2337 fn get_default_options(&self) -> Value {
2338 return Value::Map({
2339 let mut m = indexmap::IndexMap::new();
2340 m.insert("defaultNetworkCodeReplacements".to_string(), Value::Map({
2341 let mut m = indexmap::IndexMap::new();
2342 m.insert("ETH".to_string(), Value::Map({
2343 let mut m = indexmap::IndexMap::new();
2344 m.insert("primary".to_string(), Value::Str("ETH".to_string()));
2345 m.insert("secondary".to_string(), Value::Str("ERC20".to_string()));
2346 m.insert("default".to_string(), Value::Str("secondary".to_string()));
2347 m
2348}));
2349 m.insert("CRO".to_string(), Value::Map({
2350 let mut m = indexmap::IndexMap::new();
2351 m.insert("primary".to_string(), Value::Str("CRONOS".to_string()));
2352 m.insert("secondary".to_string(), Value::Str("CRC20".to_string()));
2353 m.insert("default".to_string(), Value::Str("secondary".to_string()));
2354 m
2355}));
2356 m.insert("TRX".to_string(), Value::Map({
2357 let mut m = indexmap::IndexMap::new();
2358 m.insert("primary".to_string(), Value::Str("TRX".to_string()));
2359 m.insert("secondary".to_string(), Value::Str("TRC20".to_string()));
2360 m.insert("default".to_string(), Value::Str("secondary".to_string()));
2361 m
2362}));
2363 m.insert("BTC".to_string(), Value::Map({
2364 let mut m = indexmap::IndexMap::new();
2365 m.insert("primary".to_string(), Value::Str("BTC".to_string()));
2366 m.insert("secondary".to_string(), Value::Str("BRC20".to_string()));
2367 m.insert("default".to_string(), Value::Str("primary".to_string()));
2368 m
2369}));
2370 m
2371}));
2372 m.insert("backwardSupportedNetworkCodes".to_string(), Value::Map({
2373 let mut m = indexmap::IndexMap::new();
2374 m.insert("ARB".to_string(), Value::Str("ARBITRUM".to_string()));
2375 m.insert("ARBONE".to_string(), Value::Str("ARBITRUM".to_string()));
2376 m.insert("ARBNOVA".to_string(), Value::Str("ARBITRUM_NOVA".to_string()));
2377 m
2378}));
2379 m
2380});
2381
2382 Value::Null
2383}
2384
2385 fn safe_ledger_entry(&self, mut entry: Value, optional_args: &[Value]) -> Value {
2386 let mut currency = get_arg(optional_args, 0, Value::Null);
2387 currency = self.safe_currency(Value::Null, &[currency.clone()]);
2388 let mut direction: Value = self.safe_string_k(entry.clone(), "direction", &[]);
2389 let mut before: Value = self.safe_string_k(entry.clone(), "before", &[]);
2390 let mut after: Value = self.safe_string_k(entry.clone(), "after", &[]);
2391 let mut amount: Value = self.safe_string_k(entry.clone(), "amount", &[]);
2392 if !is_equal(&amount, &Value::Null) {
2393 if is_equal(&before, &Value::Null) && !is_equal(&after, &Value::Null) {
2394 before = crate::precise::Precise::stringSub(&after, &amount);
2395 } else if !is_equal(&before, &Value::Null) && is_equal(&after, &Value::Null) {
2396 after = crate::precise::Precise::stringAdd(&before, &amount);
2397 }
2398 }
2399 if !is_equal(&before, &Value::Null) && !is_equal(&after, &Value::Null) {
2400 if is_equal(&direction, &Value::Null) {
2401 if is_true(&crate::precise::Precise::stringGt(&before, &after)) {
2402 direction = Value::Str("out".to_string());
2403 }
2404 if is_true(&crate::precise::Precise::stringGt(&after, &before)) {
2405 direction = Value::Str("in".to_string());
2406 }
2407 }
2408 }
2409 let mut fee: Value = self.safe_value_k(entry.clone(), "fee", &[]);
2410 if !is_equal(&fee, &Value::Null) {
2411 { let __be_tmp = self.safe_number_k(fee.clone(), "cost", &[]); add_element_to_object(&mut fee, &Value::Str("cost".to_string()), __be_tmp); };
2412 }
2413 let mut timestamp: Value = self.safe_integer_k(entry.clone(), "timestamp", &[]);
2414 let mut info: Value = self.safe_dict_k(entry.clone(), "info", &[Value::Map({
2415 let mut m = indexmap::IndexMap::new();
2416 m
2417})]);
2418 return Value::Map({
2419 let mut m = indexmap::IndexMap::new();
2420 m.insert("id".to_string(), self.safe_string_k(entry.clone(), "id", &[]));
2421 m.insert("timestamp".to_string(), timestamp.clone());
2422 m.insert("datetime".to_string(), self.iso8601(timestamp.clone()));
2423 m.insert("direction".to_string(), direction.clone());
2424 m.insert("account".to_string(), self.safe_string_k(entry.clone(), "account", &[]));
2425 m.insert("referenceId".to_string(), self.safe_string_k(entry.clone(), "referenceId", &[]));
2426 m.insert("referenceAccount".to_string(), self.safe_string_k(entry.clone(), "referenceAccount", &[]));
2427 m.insert("type".to_string(), self.safe_string_k(entry.clone(), "type", &[]));
2428 m.insert("currency".to_string(), get_value(¤cy, &Value::Str("code".to_string())));
2429 m.insert("amount".to_string(), self.parse_number(amount.clone(), &[]));
2430 m.insert("before".to_string(), self.parse_number(before.clone(), &[]));
2431 m.insert("after".to_string(), self.parse_number(after.clone(), &[]));
2432 m.insert("status".to_string(), self.safe_string_k(entry.clone(), "status", &[]));
2433 m.insert("fee".to_string(), fee.clone());
2434 m.insert("info".to_string(), info.clone());
2435 m
2436});
2437
2438 Value::Null
2439}
2440
2441 fn safe_currency_structure(&self, mut currency: Value) -> Value {
2442 let mut networks: Value = self.safe_dict_k(currency.clone(), "networks", &[Value::Map({
2444 let mut m = indexmap::IndexMap::new();
2445 m
2446})]);
2447 let mut keys: Value = object_keys(&networks);
2448 let mut length: Value = get_array_length(&keys);
2449 if !is_equal(&length, &Value::Int(0)) {
2450 {
2451 let mut i: Value = Value::Int(0);
2452 let mut __for_first_83: bool = true;
2453 while { if !__for_first_83 { i = add(&i, &Value::Int(1)); } __for_first_83 = false; is_less_than(&i, &length) } {
2454 let mut key: Value = get_value(&keys, &i);
2455 let mut key: Value = get_value(&keys, &i);
2456 let mut network: Value = get_value(&networks, &key);
2457 let mut network: Value = get_value(&networks, &key);
2458 let mut deposit: Value = self.safe_bool_k(network.clone(), "deposit", &[]);
2459 let mut currencyDeposit: Value = self.safe_bool_k(currency.clone(), "deposit", &[]);
2460 if is_equal(¤cyDeposit, &Value::Null) || is_true(&(is_equal(&deposit, &Value::Bool(true)))) {
2461 add_element_to_object(&mut currency, &Value::Str("deposit".to_string()), deposit.clone());
2462 }
2463 let mut withdraw: Value = self.safe_bool_k(network.clone(), "withdraw", &[]);
2464 let mut currencyWithdraw: Value = self.safe_bool_k(currency.clone(), "withdraw", &[]);
2465 if is_equal(¤cyWithdraw, &Value::Null) || is_true(&(is_equal(&withdraw, &Value::Bool(true)))) {
2466 add_element_to_object(&mut currency, &Value::Str("withdraw".to_string()), withdraw.clone());
2467 }
2468 let mut fee: Value = self.safe_string_k(network.clone(), "fee", &[]);
2470 let mut feeMain: Value = self.safe_string_k(currency.clone(), "fee", &[]);
2471 if is_equal(&feeMain, &Value::Null) || is_true(&crate::precise::Precise::stringLt(&fee, &feeMain)) {
2472 add_element_to_object(&mut currency, &Value::Str("fee".to_string()), self.parse_number(fee.clone(), &[]));
2473 }
2474 let mut precision: Value = self.safe_string_k(network.clone(), "precision", &[]);
2476 let mut precisionMain: Value = self.safe_string_k(currency.clone(), "precision", &[]);
2477 if is_equal(&precisionMain, &Value::Null) || is_true(&crate::precise::Precise::stringGt(&precision, &precisionMain)) {
2478 add_element_to_object(&mut currency, &Value::Str("precision".to_string()), self.parse_number(precision.clone(), &[]));
2479 }
2480 let mut limits: Value = self.safe_dict_k(network.clone(), "limits", &[]);
2482 let mut limitsMain: Value = self.safe_dict_k(currency.clone(), "limits", &[]);
2483 if is_equal(&limitsMain, &Value::Null) {
2484 add_element_to_object(&mut currency, &Value::Str("limits".to_string()), Value::Map({
2485 let mut m = indexmap::IndexMap::new();
2486 m
2487}));
2488 }
2489 let mut limitsDeposit: Value = self.safe_dict_k(limits.clone(), "deposit", &[]);
2491 let mut limitsDepositMain: Value = self.safe_dict_k(limitsMain.clone(), "deposit", &[]);
2492 if is_equal(&limitsDepositMain, &Value::Null) {
2493 add_element_to_object(get_value_mut(&mut currency, &Value::Str("limits".to_string())), &Value::Str("deposit".to_string()), Value::Map({
2494 let mut m = indexmap::IndexMap::new();
2495 m
2496}));
2497 }
2498 let mut limitsDepositMin: Value = self.safe_string_k(limitsDeposit.clone(), "min", &[]);
2499 let mut limitsDepositMax: Value = self.safe_string_k(limitsDeposit.clone(), "max", &[]);
2500 let mut limitsDepositMinMain: Value = self.safe_string_k(limitsDepositMain.clone(), "min", &[]);
2501 let mut limitsDepositMaxMain: Value = self.safe_string_k(limitsDepositMain.clone(), "max", &[]);
2502 if is_equal(&limitsDepositMinMain, &Value::Null) || is_true(&crate::precise::Precise::stringLt(&limitsDepositMin, &limitsDepositMinMain)) {
2504 add_element_to_object(get_value_mut(get_value_mut(&mut currency, &Value::Str("limits".to_string())), &Value::Str("deposit".to_string())), &Value::Str("min".to_string()), self.parse_number(limitsDepositMin.clone(), &[]));
2505 }
2506 if is_equal(&limitsDepositMaxMain, &Value::Null) || is_true(&crate::precise::Precise::stringGt(&limitsDepositMax, &limitsDepositMaxMain)) {
2508 add_element_to_object(get_value_mut(get_value_mut(&mut currency, &Value::Str("limits".to_string())), &Value::Str("deposit".to_string())), &Value::Str("max".to_string()), self.parse_number(limitsDepositMax.clone(), &[]));
2509 }
2510 let mut limitsWithdraw: Value = self.safe_dict_k(limits.clone(), "withdraw", &[]);
2512 let mut limitsWithdrawMain: Value = self.safe_dict_k(limitsMain.clone(), "withdraw", &[]);
2513 if is_equal(&limitsWithdrawMain, &Value::Null) {
2514 add_element_to_object(get_value_mut(&mut currency, &Value::Str("limits".to_string())), &Value::Str("withdraw".to_string()), Value::Map({
2515 let mut m = indexmap::IndexMap::new();
2516 m
2517}));
2518 }
2519 let mut limitsWithdrawMin: Value = self.safe_string_k(limitsWithdraw.clone(), "min", &[]);
2520 let mut limitsWithdrawMax: Value = self.safe_string_k(limitsWithdraw.clone(), "max", &[]);
2521 let mut limitsWithdrawMinMain: Value = self.safe_string_k(limitsWithdrawMain.clone(), "min", &[]);
2522 let mut limitsWithdrawMaxMain: Value = self.safe_string_k(limitsWithdrawMain.clone(), "max", &[]);
2523 if is_equal(&limitsWithdrawMinMain, &Value::Null) || is_true(&crate::precise::Precise::stringLt(&limitsWithdrawMin, &limitsWithdrawMinMain)) {
2525 add_element_to_object(get_value_mut(get_value_mut(&mut currency, &Value::Str("limits".to_string())), &Value::Str("withdraw".to_string())), &Value::Str("min".to_string()), self.parse_number(limitsWithdrawMin.clone(), &[]));
2526 }
2527 if is_equal(&limitsWithdrawMaxMain, &Value::Null) || is_true(&crate::precise::Precise::stringGt(&limitsWithdrawMax, &limitsWithdrawMaxMain)) {
2529 add_element_to_object(get_value_mut(get_value_mut(&mut currency, &Value::Str("limits".to_string())), &Value::Str("withdraw".to_string())), &Value::Str("max".to_string()), self.parse_number(limitsWithdrawMax.clone(), &[]));
2530 }
2531 }
2532 }
2533 }
2534 return self.extend(Value::Map({
2535 let mut m = indexmap::IndexMap::new();
2536 m.insert("info".to_string(), Value::Null);
2537 m.insert("id".to_string(), Value::Null);
2538 m.insert("numericId".to_string(), Value::Null);
2539 m.insert("code".to_string(), Value::Null);
2540 m.insert("precision".to_string(), Value::Null);
2541 m.insert("type".to_string(), Value::Null);
2542 m.insert("name".to_string(), Value::Null);
2543 m.insert("active".to_string(), Value::Null);
2544 m.insert("deposit".to_string(), Value::Null);
2545 m.insert("withdraw".to_string(), Value::Null);
2546 m.insert("fee".to_string(), Value::Null);
2547 m.insert("fees".to_string(), Value::Map({
2548 let mut m = indexmap::IndexMap::new();
2549 m
2550}));
2551 m.insert("networks".to_string(), Value::Map({
2552 let mut m = indexmap::IndexMap::new();
2553 m
2554}));
2555 m.insert("limits".to_string(), Value::Map({
2556 let mut m = indexmap::IndexMap::new();
2557 m.insert("deposit".to_string(), Value::Map({
2558 let mut m = indexmap::IndexMap::new();
2559 m.insert("min".to_string(), Value::Null);
2560 m.insert("max".to_string(), Value::Null);
2561 m
2562}));
2563 m.insert("withdraw".to_string(), Value::Map({
2564 let mut m = indexmap::IndexMap::new();
2565 m.insert("min".to_string(), Value::Null);
2566 m.insert("max".to_string(), Value::Null);
2567 m
2568}));
2569 m
2570}));
2571 m
2572}), &[currency.clone()]);
2573
2574 Value::Null
2575}
2576
2577 fn safe_market_structure(&self, optional_args: &[Value]) -> Value {
2578 let mut market = get_arg(optional_args, 0, Value::Null);
2579 let mut cleanStructure: Value = Value::Map({
2580 let mut m = indexmap::IndexMap::new();
2581 m.insert("id".to_string(), Value::Null);
2582 m.insert("lowercaseId".to_string(), Value::Null);
2583 m.insert("symbol".to_string(), Value::Null);
2584 m.insert("base".to_string(), Value::Null);
2585 m.insert("quote".to_string(), Value::Null);
2586 m.insert("settle".to_string(), Value::Null);
2587 m.insert("baseId".to_string(), Value::Null);
2588 m.insert("quoteId".to_string(), Value::Null);
2589 m.insert("settleId".to_string(), Value::Null);
2590 m.insert("type".to_string(), Value::Null);
2591 m.insert("spot".to_string(), Value::Null);
2592 m.insert("margin".to_string(), Value::Null);
2593 m.insert("swap".to_string(), Value::Null);
2594 m.insert("future".to_string(), Value::Null);
2595 m.insert("option".to_string(), Value::Null);
2596 m.insert("index".to_string(), Value::Null);
2597 m.insert("active".to_string(), Value::Null);
2598 m.insert("contract".to_string(), Value::Null);
2599 m.insert("linear".to_string(), Value::Null);
2600 m.insert("inverse".to_string(), Value::Null);
2601 m.insert("subType".to_string(), Value::Null);
2602 m.insert("taker".to_string(), Value::Null);
2603 m.insert("maker".to_string(), Value::Null);
2604 m.insert("contractSize".to_string(), Value::Null);
2605 m.insert("expiry".to_string(), Value::Null);
2606 m.insert("expiryDatetime".to_string(), Value::Null);
2607 m.insert("strike".to_string(), Value::Null);
2608 m.insert("optionType".to_string(), Value::Null);
2609 m.insert("precision".to_string(), Value::Map({
2610 let mut m = indexmap::IndexMap::new();
2611 m.insert("amount".to_string(), Value::Null);
2612 m.insert("price".to_string(), Value::Null);
2613 m.insert("cost".to_string(), Value::Null);
2614 m.insert("base".to_string(), Value::Null);
2615 m.insert("quote".to_string(), Value::Null);
2616 m
2617}));
2618 m.insert("limits".to_string(), Value::Map({
2619 let mut m = indexmap::IndexMap::new();
2620 m.insert("leverage".to_string(), Value::Map({
2621 let mut m = indexmap::IndexMap::new();
2622 m.insert("min".to_string(), Value::Null);
2623 m.insert("max".to_string(), Value::Null);
2624 m
2625}));
2626 m.insert("amount".to_string(), Value::Map({
2627 let mut m = indexmap::IndexMap::new();
2628 m.insert("min".to_string(), Value::Null);
2629 m.insert("max".to_string(), Value::Null);
2630 m
2631}));
2632 m.insert("price".to_string(), Value::Map({
2633 let mut m = indexmap::IndexMap::new();
2634 m.insert("min".to_string(), Value::Null);
2635 m.insert("max".to_string(), Value::Null);
2636 m
2637}));
2638 m.insert("cost".to_string(), Value::Map({
2639 let mut m = indexmap::IndexMap::new();
2640 m.insert("min".to_string(), Value::Null);
2641 m.insert("max".to_string(), Value::Null);
2642 m
2643}));
2644 m
2645}));
2646 m.insert("marginModes".to_string(), Value::Map({
2647 let mut m = indexmap::IndexMap::new();
2648 m.insert("cross".to_string(), Value::Null);
2649 m.insert("isolated".to_string(), Value::Null);
2650 m
2651}));
2652 m.insert("created".to_string(), Value::Null);
2653 m.insert("info".to_string(), Value::Null);
2654 m
2655 });
2656 if !is_equal(&market, &Value::Null) {
2657 let mut result: Value = self.extend(cleanStructure.clone(), &[market.clone()]);
2658 if is_equal(&get_value(&result, &Value::Str("spot".to_string())), &Value::Bool(true)) {
2660 if is_equal(&get_value(&result, &Value::Str("contract".to_string())), &Value::Null) {
2661 add_element_to_object(&mut result, &Value::Str("contract".to_string()), Value::Bool(false));
2662 }
2663 if is_equal(&get_value(&result, &Value::Str("swap".to_string())), &Value::Null) {
2664 add_element_to_object(&mut result, &Value::Str("swap".to_string()), Value::Bool(false));
2665 }
2666 if is_equal(&get_value(&result, &Value::Str("future".to_string())), &Value::Null) {
2667 add_element_to_object(&mut result, &Value::Str("future".to_string()), Value::Bool(false));
2668 }
2669 if is_equal(&get_value(&result, &Value::Str("option".to_string())), &Value::Null) {
2670 add_element_to_object(&mut result, &Value::Str("option".to_string()), Value::Bool(false));
2671 }
2672 if is_equal(&get_value(&result, &Value::Str("index".to_string())), &Value::Null) {
2673 add_element_to_object(&mut result, &Value::Str("index".to_string()), Value::Bool(false));
2674 }
2675 }
2676 return result;
2677 }
2678 return self.extend(cleanStructure.clone(), &[]);
2679
2680 Value::Null
2681}
2682
2683 fn set_markets(&mut self, mut markets: Value, optional_args: &[Value]) -> Value {
2684 let mut currencies = get_arg(optional_args, 0, Value::Null);
2685 let mut values: Value = Value::List(vec![]);
2686 { let __t = self.create_safe_dictionary(&[]); self.markets_by_id = __t; }
2687 let mut marketValues: Value = self.sort_by(self.to_array(markets.clone()), Value::Str("spot".to_string()), &[Value::Bool(true), Value::Bool(true)]);
2690 {
2691 let mut i: Value = Value::Int(0);
2692 let mut __for_first_85: bool = true;
2693 while { if !__for_first_85 { i = add(&i, &Value::Int(1)); } __for_first_85 = false; is_less_than(&i, &get_array_length(&marketValues)) } {
2694 let mut value: Value = get_value(&marketValues, &i);
2695 let mut value: Value = get_value(&marketValues, &i);
2696 if is_true(&Value::Bool(in_op(&self.markets_by_id, &get_value(&value, &Value::Str("id".to_string()))))) {
2697 let mut marketsByIdArray: Value = get_value(&self.markets_by_id, &get_value(&value, &Value::Str("id".to_string())));
2698 append_to_array(&mut marketsByIdArray, value.clone());
2699 add_element_to_object(&mut self.markets_by_id, &get_value(&value, &Value::Str("id".to_string())), marketsByIdArray.clone());
2700 } else {
2701 add_element_to_object(&mut self.markets_by_id, &get_value(&value, &Value::Str("id".to_string())), Value::List(vec![value.clone()]));
2702 }
2703 let mut valueDefined: Value = Value::Map({
2707 let mut m = indexmap::IndexMap::new();
2708 m
2709 });
2710 let mut valueKeys: Value = object_keys(&value);
2711 {
2712 let mut j: Value = Value::Int(0);
2713 let mut __for_first_84: bool = true;
2714 while { if !__for_first_84 { j = add(&j, &Value::Int(1)); } __for_first_84 = false; is_less_than(&j, &get_array_length(&valueKeys)) } {
2715 let mut valueKey: Value = get_value(&valueKeys, &j);
2716 let mut valueKey: Value = get_value(&valueKeys, &j);
2717 if !is_equal(&get_value(&value, &valueKey), &Value::Null) {
2718 add_element_to_object(&mut valueDefined, &valueKey, get_value(&value, &valueKey));
2719 }
2720 }
2721 }
2722 let mut market: Value = self.deep_extend(self.safe_market_structure(&[]), &[Value::Map({
2723 let mut m = indexmap::IndexMap::new();
2724 m.insert("precision".to_string(), self.precision.clone());
2725 m.insert("limits".to_string(), self.limits.clone());
2726 m
2727 }), get_value(&self.fees, &Value::Str("trading".to_string())), valueDefined.clone()]);
2728 if is_equal(&get_value(&market, &Value::Str("linear".to_string())), &Value::Bool(true)) {
2729 add_element_to_object(&mut market, &Value::Str("subType".to_string()), Value::Str("linear".to_string()));
2730 } else if is_equal(&get_value(&market, &Value::Str("inverse".to_string())), &Value::Bool(true)) {
2731 add_element_to_object(&mut market, &Value::Str("subType".to_string()), Value::Str("inverse".to_string()));
2732 } else {
2733 add_element_to_object(&mut market, &Value::Str("subType".to_string()), Value::Null);
2734 }
2735 append_to_array(&mut values, market.clone());
2736 }
2737 }
2738 { let __t = self.map_to_safe_map(self.index_by(values.clone(), Value::Str("symbol".to_string()))); self.markets = __t; }
2739 let mut marketsSortedBySymbol: Value = self.keysort(self.markets.clone(), &[]);
2740 let mut marketsSortedById: Value = self.keysort(self.markets_by_id.clone(), &[]);
2741 self.symbols = object_keys(&marketsSortedBySymbol);
2742 self.ids = object_keys(&marketsSortedById);
2743 let mut numCurrencies: Value = Value::Int(0);
2744 if !is_equal(¤cies, &Value::Null) {
2745 let mut keys: Value = object_keys(¤cies);
2746 numCurrencies = get_array_length(&keys);
2747 }
2748 if is_greater_than(&numCurrencies, &Value::Int(0)) {
2749 { let __t = self.map_to_safe_map(self.deep_extend(self.currencies.clone(), &[currencies.clone()])); self.currencies = __t; }
2751 } else {
2752 let mut baseCurrencies: Value = Value::List(vec![]);
2753 let mut quoteCurrencies: Value = Value::List(vec![]);
2754 {
2755 let mut i: Value = Value::Int(0);
2756 let mut __for_first_86: bool = true;
2757 while { if !__for_first_86 { i = add(&i, &Value::Int(1)); } __for_first_86 = false; is_less_than(&i, &get_array_length(&values)) } {
2758 let mut market: Value = get_value(&values, &i);
2759 let mut market: Value = get_value(&values, &i);
2760 let mut defaultCurrencyPrecision: Value = ternary(is_true(&(is_equal(&self.precisionMode, &Value::Int(crate::runtime::DECIMAL_PLACES)))), Value::Int(8), self.parse_number(Value::Str("1e-8".to_string()), &[]));
2761 let mut marketPrecision: Value = self.safe_dict_k(market.clone(), "precision", &[Value::Map({
2762 let mut m = indexmap::IndexMap::new();
2763 m
2764})]);
2765 if is_true(&Value::Bool(in_op(&market, &Value::Str("base".to_string())))) {
2766 let mut currency: Value = self.safe_currency_structure(Value::Map({
2767 let mut m = indexmap::IndexMap::new();
2768 m.insert("id".to_string(), self.safe_string2(market.clone(), Value::Str("baseId".to_string()), Value::Str("base".to_string()), &[]));
2769 m.insert("numericId".to_string(), self.safe_integer_k(market.clone(), "baseNumericId", &[]));
2770 m.insert("code".to_string(), self.safe_string_k(market.clone(), "base", &[]));
2771 m.insert("precision".to_string(), self.safe_value2(marketPrecision.clone(), Value::Str("base".to_string()), Value::Str("amount".to_string()), &[defaultCurrencyPrecision.clone()]));
2772 m
2773 }));
2774 append_to_array(&mut baseCurrencies, currency.clone());
2775 }
2776 if is_true(&Value::Bool(in_op(&market, &Value::Str("quote".to_string())))) {
2777 let mut currency: Value = self.safe_currency_structure(Value::Map({
2778 let mut m = indexmap::IndexMap::new();
2779 m.insert("id".to_string(), self.safe_string2(market.clone(), Value::Str("quoteId".to_string()), Value::Str("quote".to_string()), &[]));
2780 m.insert("numericId".to_string(), self.safe_integer_k(market.clone(), "quoteNumericId", &[]));
2781 m.insert("code".to_string(), self.safe_string_k(market.clone(), "quote", &[]));
2782 m.insert("precision".to_string(), self.safe_value2(marketPrecision.clone(), Value::Str("quote".to_string()), Value::Str("price".to_string()), &[defaultCurrencyPrecision.clone()]));
2783 m
2784 }));
2785 append_to_array(&mut quoteCurrencies, currency.clone());
2786 }
2787 }
2788 }
2789 baseCurrencies = self.sort_by(baseCurrencies.clone(), Value::Str("code".to_string()), &[Value::Bool(false), Value::Str("".to_string())]);
2790 quoteCurrencies = self.sort_by(quoteCurrencies.clone(), Value::Str("code".to_string()), &[Value::Bool(false), Value::Str("".to_string())]);
2791 { let __t = self.map_to_safe_map(self.index_by(baseCurrencies.clone(), Value::Str("code".to_string()))); self.baseCurrencies = __t; }
2792 { let __t = self.map_to_safe_map(self.index_by(quoteCurrencies.clone(), Value::Str("code".to_string()))); self.quoteCurrencies = __t; }
2793 let mut allCurrencies: Value = self.array_concat(baseCurrencies.clone(), quoteCurrencies.clone());
2794 let mut groupedCurrencies: Value = self.group_by(allCurrencies.clone(), Value::Str("code".to_string()), &[]);
2795 let mut codes: Value = object_keys(&groupedCurrencies);
2796 let mut resultingCurrencies: Value = Value::List(vec![]);
2797 {
2798 let mut i: Value = Value::Int(0);
2799 let mut __for_first_88: bool = true;
2800 while { if !__for_first_88 { i = add(&i, &Value::Int(1)); } __for_first_88 = false; is_less_than(&i, &get_array_length(&codes)) } {
2801 let mut code: Value = get_value(&codes, &i);
2802 let mut code: Value = get_value(&codes, &i);
2803 let mut groupedCurrenciesCode: Value = self.safe_list(groupedCurrencies.clone(), code.clone(), &[Value::List(vec![])]);
2804 let mut highestPrecisionCurrency: Value = self.safe_value(groupedCurrenciesCode.clone(), Value::Int(0), &[]);
2805 {
2806 let mut j: Value = Value::Int(1);
2807 let mut __for_first_87: bool = true;
2808 while { if !__for_first_87 { j = add(&j, &Value::Int(1)); } __for_first_87 = false; is_less_than(&j, &get_array_length(&groupedCurrenciesCode)) } {
2809 let mut currentCurrency: Value = get_value(&groupedCurrenciesCode, &j);
2810 let mut currentCurrency: Value = get_value(&groupedCurrenciesCode, &j);
2811 if is_equal(&self.precisionMode, &Value::Int(crate::runtime::TICK_SIZE)) {
2812 highestPrecisionCurrency = ternary(is_true(&(is_less_than(&get_value(¤tCurrency, &Value::Str("precision".to_string())), &get_value(&highestPrecisionCurrency, &Value::Str("precision".to_string()))))), currentCurrency.clone(), highestPrecisionCurrency.clone());
2813 } else {
2814 highestPrecisionCurrency = ternary(is_true(&(is_greater_than(&get_value(¤tCurrency, &Value::Str("precision".to_string())), &get_value(&highestPrecisionCurrency, &Value::Str("precision".to_string()))))), currentCurrency.clone(), highestPrecisionCurrency.clone());
2815 }
2816 }
2817 }
2818 append_to_array(&mut resultingCurrencies, highestPrecisionCurrency.clone());
2819 }
2820 }
2821 let mut sortedCurrencies: Value = self.sort_by(resultingCurrencies.clone(), Value::Str("code".to_string()), &[]);
2822 { let __t = self.map_to_safe_map(self.deep_extend(self.currencies.clone(), &[self.index_by(sortedCurrencies.clone(), Value::Str("code".to_string()))])); self.currencies = __t; }
2823 }
2824 { let __t = self.index_by_safe(self.currencies.clone(), Value::Str("id".to_string())); self.currencies_by_id = __t; }
2825 let mut currenciesSortedByCode: Value = self.keysort(self.currencies.clone(), &[]);
2826 self.codes = object_keys(¤ciesSortedByCode);
2827 if is_equal(&self.markets, &Value::Null) {
2828 panic!("{}", crate::exchange_errors::exchange_error(add(&self.id, &Value::Str(" setMarkets() markets not set".to_string()))));
2829 }
2830 return self.markets.clone();
2831
2832 Value::Null
2833}
2834
2835 fn set_markets_from_exchange(&mut self, mut sourceExchange: Value) -> Value {
2836 if !is_equal(&self.id, &get_value(&sourceExchange, &Value::Str("id".to_string()))) {
2838 panic!("{}", crate::exchange_errors::arguments_required(add(&add(&add(&self.id, &Value::Str(" shareMarkets() can only share markets with exchanges of the same type (got ".to_string())), &get_value(&sourceExchange, &Value::Str("id".to_string()))), &Value::Str(")".to_string()))));
2839 }
2840 if is_true(&(is_equal(&get_value(&sourceExchange, &Value::Str("markets".to_string())), &Value::Null))) || is_true(&(is_equal(&get_value(&sourceExchange, &Value::Str("markets".to_string())), &Value::Null))) {
2842 panic!("{}", crate::exchange_errors::exchange_error(Value::Str("setMarketsFromExchange() source exchange must have loaded markets first. Can call by using loadMarkets function".to_string())));
2843 }
2844 self.markets = get_value(&sourceExchange, &Value::Str("markets".to_string()));
2846 self.markets_by_id = get_value(&sourceExchange, &Value::Str("markets_by_id".to_string()));
2847 self.symbols = get_value(&sourceExchange, &Value::Str("symbols".to_string()));
2848 self.ids = get_value(&sourceExchange, &Value::Str("ids".to_string()));
2849 self.currencies = get_value(&sourceExchange, &Value::Str("currencies".to_string()));
2850 self.currencies_by_id = get_value(&sourceExchange, &Value::Str("currencies_by_id".to_string()));
2851 self.baseCurrencies = get_value(&sourceExchange, &Value::Str("baseCurrencies".to_string()));
2852 self.quoteCurrencies = get_value(&sourceExchange, &Value::Str("quoteCurrencies".to_string()));
2853 self.codes = get_value(&sourceExchange, &Value::Str("codes".to_string()));
2854 let mut sourceExchangeHelpers: Value = self.safe_list(get_value(&sourceExchange, &Value::Str("options".to_string())), Value::Str("marketHelperProps".to_string()), &[Value::List(vec![])]);
2856 {
2857 let mut i: Value = Value::Int(0);
2858 let mut __for_first_89: bool = true;
2859 while { if !__for_first_89 { i = add(&i, &Value::Int(1)); } __for_first_89 = false; is_less_than(&i, &get_array_length(&sourceExchangeHelpers)) } {
2860 let mut helper: Value = get_value(&sourceExchangeHelpers, &i);
2861 let mut helper: Value = get_value(&sourceExchangeHelpers, &i);
2862 if !is_equal(&get_value(&get_value(&sourceExchange, &Value::Str("options".to_string())), &helper), &Value::Null) {
2863 add_element_to_object(&mut self.options, &helper, get_value(&get_value(&sourceExchange, &Value::Str("options".to_string())), &helper));
2864 }
2865 }
2866 }
2867 return Value::Null;
2868
2869 Value::Null
2870}
2871
2872 fn get_describe_for_extended_ws_exchange(&self, mut currentRestInstance: Value, mut parentRestInstance: Value, mut wsBaseDescribe: Value) -> Value {
2873 let mut extendedRestDescribe: Value = self.deep_extend(parentRestInstance.describe(), &[currentRestInstance.describe()]);
2874 let mut superWithRestDescribe: Value = self.deep_extend(extendedRestDescribe.clone(), &[wsBaseDescribe.clone()]);
2875 return superWithRestDescribe;
2876
2877 Value::Null
2878}
2879
2880 fn safe_balance(&self, mut balance: Value) -> Value {
2881 let mut balances: Value = self.omit(balance.clone(), Value::List(vec![Value::Str("info".to_string()), Value::Str("timestamp".to_string()), Value::Str("datetime".to_string()), Value::Str("free".to_string()), Value::Str("used".to_string()), Value::Str("total".to_string())]), &[]);
2882 let mut codes: Value = object_keys(&balances);
2883 add_element_to_object(&mut balance, &Value::Str("free".to_string()), Value::Map({
2884 let mut m = indexmap::IndexMap::new();
2885 m
2886}));
2887 add_element_to_object(&mut balance, &Value::Str("used".to_string()), Value::Map({
2888 let mut m = indexmap::IndexMap::new();
2889 m
2890}));
2891 add_element_to_object(&mut balance, &Value::Str("total".to_string()), Value::Map({
2892 let mut m = indexmap::IndexMap::new();
2893 m
2894}));
2895 let mut debtBalance: Value = Value::Map({
2896 let mut m = indexmap::IndexMap::new();
2897 m
2898 });
2899 {
2900 let mut i: Value = Value::Int(0);
2901 let mut __for_first_90: bool = true;
2902 while { if !__for_first_90 { i = add(&i, &Value::Int(1)); } __for_first_90 = false; is_less_than(&i, &get_array_length(&codes)) } {
2903 let mut code: Value = get_value(&codes, &i);
2904 let mut code: Value = get_value(&codes, &i);
2905 let mut total: Value = self.safe_string_k(get_value(&balance, &code), "total", &[]);
2906 let mut free: Value = self.safe_string_k(get_value(&balance, &code), "free", &[]);
2907 let mut used: Value = self.safe_string_k(get_value(&balance, &code), "used", &[]);
2908 let mut debt: Value = self.safe_string_k(get_value(&balance, &code), "debt", &[]);
2909 if is_true(&(is_equal(&total, &Value::Null))) && is_true(&(!is_equal(&free, &Value::Null))) && is_true(&(!is_equal(&used, &Value::Null))) {
2910 total = crate::precise::Precise::stringAdd(&free, &used);
2911 }
2912 if is_true(&(is_equal(&free, &Value::Null))) && is_true(&(!is_equal(&total, &Value::Null))) && is_true(&(!is_equal(&used, &Value::Null))) {
2913 free = crate::precise::Precise::stringSub(&total, &used);
2914 }
2915 if is_true(&(is_equal(&used, &Value::Null))) && is_true(&(!is_equal(&total, &Value::Null))) && is_true(&(!is_equal(&free, &Value::Null))) {
2916 used = crate::precise::Precise::stringSub(&total, &free);
2917 }
2918 add_element_to_object(get_value_mut(&mut balance, &code), &Value::Str("free".to_string()), self.parse_number(free.clone(), &[]));
2919 add_element_to_object(get_value_mut(&mut balance, &code), &Value::Str("used".to_string()), self.parse_number(used.clone(), &[]));
2920 add_element_to_object(get_value_mut(&mut balance, &code), &Value::Str("total".to_string()), self.parse_number(total.clone(), &[]));
2921 { let __be_tmp = get_value(&get_value(&balance, &code), &Value::Str("free".to_string())); add_element_to_object(get_value_mut(&mut balance, &Value::Str("free".to_string())), &code, __be_tmp); };
2922 { let __be_tmp = get_value(&get_value(&balance, &code), &Value::Str("used".to_string())); add_element_to_object(get_value_mut(&mut balance, &Value::Str("used".to_string())), &code, __be_tmp); };
2923 { let __be_tmp = get_value(&get_value(&balance, &code), &Value::Str("total".to_string())); add_element_to_object(get_value_mut(&mut balance, &Value::Str("total".to_string())), &code, __be_tmp); };
2924 if !is_equal(&debt, &Value::Null) {
2925 add_element_to_object(get_value_mut(&mut balance, &code), &Value::Str("debt".to_string()), self.parse_number(debt.clone(), &[]));
2926 add_element_to_object(&mut debtBalance, &code, get_value(&get_value(&balance, &code), &Value::Str("debt".to_string())));
2927 }
2928 }
2929 }
2930 let mut debtBalanceArray: Value = object_keys(&debtBalance);
2931 let mut length: Value = get_array_length(&debtBalanceArray);
2932 if is_true(&(!is_equal(&length, &Value::Null))) && is_true(&(!is_equal(&length, &Value::Int(0)))) {
2933 add_element_to_object(&mut balance, &Value::Str("debt".to_string()), debtBalance.clone());
2934 }
2935 return balance;
2936
2937 Value::Null
2938}
2939
2940 fn safe_order(&self, mut order: Value, optional_args: &[Value]) -> Value {
2941 let mut market = get_arg(optional_args, 0, Value::Null);
2942 if is_equal(&order, &Value::Null) {
2945 order = Value::Map({
2946 let mut m = indexmap::IndexMap::new();
2947 m
2948 });
2949 }
2950 let mut amount: Value = self.omit_zero(self.safe_string_k(order.clone(), "amount", &[]));
2951 let mut remaining: Value = self.safe_string_k(order.clone(), "remaining", &[]);
2952 let mut filled: Value = self.safe_string_k(order.clone(), "filled", &[]);
2953 let mut cost: Value = self.safe_string_k(order.clone(), "cost", &[]);
2954 let mut average: Value = self.omit_zero(self.safe_string_k(order.clone(), "average", &[]));
2955 let mut price: Value = self.omit_zero(self.safe_string_k(order.clone(), "price", &[]));
2956 let mut lastTradeTimeTimestamp: Value = self.safe_integer_k(order.clone(), "lastTradeTimestamp", &[]);
2957 let mut symbol: Value = self.safe_string_k(order.clone(), "symbol", &[]);
2958 let mut side: Value = self.safe_string_k(order.clone(), "side", &[]);
2959 let mut status: Value = self.safe_string_k(order.clone(), "status", &[]);
2960 let mut parseFilled: bool = is_equal(&filled, &Value::Null);
2961 let mut parseCost: bool = is_equal(&cost, &Value::Null);
2962 let mut parseLastTradeTimeTimestamp: bool = is_equal(&lastTradeTimeTimestamp, &Value::Null);
2963 let mut fee: Value = self.safe_value_k(order.clone(), "fee", &[]);
2964 let mut parseFee: bool = is_equal(&fee, &Value::Null);
2965 let mut parseFees: bool = is_equal(&self.safe_value_k(order.clone(), "fees", &[]), &Value::Null);
2966 let mut parseSymbol: bool = is_equal(&symbol, &Value::Null);
2967 let mut parseSide: bool = is_equal(&side, &Value::Null);
2968 let mut shouldParseFees: bool = is_true(&parseFee) || is_true(&parseFees);
2969 let mut fees: Value = self.safe_list_k(order.clone(), "fees", &[Value::List(vec![])]);
2970 let mut trades: Value = Value::List(vec![]);
2971 let mut isTriggerOrSLTpOrder: bool = is_true(&(!is_equal(&self.safe_string_k(order.clone(), "triggerPrice", &[]), &Value::Null) || is_true(&(!is_equal(&self.safe_string_k(order.clone(), "stopLossPrice", &[]), &Value::Null))))) || is_true(&(!is_equal(&self.safe_string_k(order.clone(), "takeProfitPrice", &[]), &Value::Null)));
2972 if is_true(&parseFilled) || is_true(&parseCost) || is_true(&shouldParseFees) {
2973 let mut rawTrades: Value = self.safe_value_k(order.clone(), "trades", &[trades.clone()]);
2974 let mut firstTrade: Value = self.safe_value(rawTrades.clone(), Value::Int(0), &[]);
2979 let mut tradesAreParsed: bool = is_true(&(!is_equal(&firstTrade, &Value::Null))) && is_true(&(Value::Bool(in_op(&firstTrade, &Value::Str("info".to_string()))))) && is_true(&(Value::Bool(in_op(&firstTrade, &Value::Str("id".to_string())))));
2981 if !is_true(&tradesAreParsed) {
2982 trades = self.parse_trades(rawTrades.clone(), &[market.clone()]);
2983 } else {
2984 trades = rawTrades.clone();
2985 }
2986 let mut tradesLength: Value = Value::Int(0);
2988 let mut isArray: bool = is_array(&trades);
2989 if is_true(&isArray) {
2990 tradesLength = get_array_length(&trades);
2991 }
2992 if is_true(&isArray) && is_true(&(is_greater_than(&tradesLength, &Value::Int(0)))) {
2993 if is_equal(&get_value(&order, &Value::Str("symbol".to_string())), &Value::Null) {
2995 add_element_to_object(&mut order, &Value::Str("symbol".to_string()), get_value(&get_value(&trades, &Value::Int(0)), &Value::Str("symbol".to_string())));
2996 }
2997 if is_equal(&get_value(&order, &Value::Str("side".to_string())), &Value::Null) {
2998 add_element_to_object(&mut order, &Value::Str("side".to_string()), get_value(&get_value(&trades, &Value::Int(0)), &Value::Str("side".to_string())));
2999 }
3000 if is_equal(&get_value(&order, &Value::Str("type".to_string())), &Value::Null) {
3001 add_element_to_object(&mut order, &Value::Str("type".to_string()), get_value(&get_value(&trades, &Value::Int(0)), &Value::Str("type".to_string())));
3002 }
3003 if is_equal(&get_value(&order, &Value::Str("id".to_string())), &Value::Null) {
3004 add_element_to_object(&mut order, &Value::Str("id".to_string()), get_value(&get_value(&trades, &Value::Int(0)), &Value::Str("order".to_string())));
3005 }
3006 if is_true(&parseFilled) {
3007 filled = Value::Str("0".to_string());
3008 }
3009 if is_true(&parseCost) {
3010 cost = Value::Str("0".to_string());
3011 }
3012 {
3013 let mut i: Value = Value::Int(0);
3014 let mut __for_first_92: bool = true;
3015 while { if !__for_first_92 { i = add(&i, &Value::Int(1)); } __for_first_92 = false; is_less_than(&i, &get_array_length(&trades)) } {
3016 let mut trade: Value = get_value(&trades, &i);
3017 let mut trade: Value = get_value(&trades, &i);
3018 let mut tradeAmount: Value = self.safe_string_k(trade.clone(), "amount", &[]);
3019 if is_true(&parseFilled) && is_true(&(!is_equal(&tradeAmount, &Value::Null))) {
3020 filled = crate::precise::Precise::stringAdd(&filled, &tradeAmount);
3021 }
3022 let mut tradeCost: Value = self.safe_string_k(trade.clone(), "cost", &[]);
3023 if is_true(&parseCost) && is_true(&(!is_equal(&tradeCost, &Value::Null))) {
3024 cost = crate::precise::Precise::stringAdd(&cost, &tradeCost);
3025 }
3026 if is_true(&parseSymbol) {
3027 symbol = self.safe_string_k(trade.clone(), "symbol", &[]);
3028 }
3029 if is_true(&parseSide) {
3030 side = self.safe_string_k(trade.clone(), "side", &[]);
3031 }
3032 let mut tradeTimestamp: Value = self.safe_value_k(trade.clone(), "timestamp", &[]);
3033 if is_true(&parseLastTradeTimeTimestamp) && is_true(&(!is_equal(&tradeTimestamp, &Value::Null))) {
3034 if is_equal(&lastTradeTimeTimestamp, &Value::Null) {
3035 lastTradeTimeTimestamp = tradeTimestamp.clone();
3036 } else {
3037 lastTradeTimeTimestamp = crate::runtime::Math::max(&lastTradeTimeTimestamp, &tradeTimestamp);
3038 }
3039 }
3040 if is_true(&shouldParseFees) {
3041 let mut tradeFees: Value = self.safe_value_k(trade.clone(), "fees", &[]);
3042 if !is_equal(&tradeFees, &Value::Null) {
3043 {
3044 let mut j: Value = Value::Int(0);
3045 let mut __for_first_91: bool = true;
3046 while { if !__for_first_91 { j = add(&j, &Value::Int(1)); } __for_first_91 = false; is_less_than(&j, &get_array_length(&tradeFees)) } {
3047 let mut tradeFee: Value = get_value(&tradeFees, &j);
3048 let mut tradeFee: Value = get_value(&tradeFees, &j);
3049 append_to_array(&mut fees, self.extend(Value::Map({
3050 let mut m = indexmap::IndexMap::new();
3051 m
3052 }), &[tradeFee.clone()]));
3053 }
3054 }
3055 } else {
3056 let mut tradeFee: Value = self.safe_value_k(trade.clone(), "fee", &[]);
3057 if !is_equal(&tradeFee, &Value::Null) {
3058 append_to_array(&mut fees, self.extend(Value::Map({
3059 let mut m = indexmap::IndexMap::new();
3060 m
3061 }), &[tradeFee.clone()]));
3062 }
3063 }
3064 }
3065 }
3066 }
3067 }
3068 }
3069 if is_true(&shouldParseFees) {
3070 let mut reducedFees: Value = fees.clone();
3071 if is_true(&self.reduceFees) {
3072 reducedFees = self.reduce_fees_by_currency(fees.clone());
3073 }
3074 if is_equal(&reducedFees, &Value::Null) {
3075 reducedFees = Value::List(vec![]);
3076 }
3077 let mut reducedLength: Value = get_array_length(&reducedFees);
3078 {
3079 let mut i: Value = Value::Int(0);
3080 let mut __for_first_93: bool = true;
3081 while { if !__for_first_93 { i = add(&i, &Value::Int(1)); } __for_first_93 = false; is_less_than(&i, &reducedLength) } {
3082 { let __be_tmp = self.safe_number_k(get_value(&reducedFees, &i), "cost", &[]); add_element_to_object(get_value_mut(&mut reducedFees, &i), &Value::Str("cost".to_string()), __be_tmp); };
3083 if is_true(&Value::Bool(in_op(&get_value(&reducedFees, &i), &Value::Str("rate".to_string())))) {
3084 { let __be_tmp = self.safe_number_k(get_value(&reducedFees, &i), "rate", &[]); add_element_to_object(get_value_mut(&mut reducedFees, &i), &Value::Str("rate".to_string()), __be_tmp); };
3085 }
3086 }
3087 }
3088 if !is_true(&parseFee) && is_true(&(is_equal(&reducedLength, &Value::Int(0)))) {
3089 let mut feeCopy: Value = self.deep_extend(fee.clone(), &[]);
3091 { let __be_tmp = self.safe_number_k(feeCopy.clone(), "cost", &[]); add_element_to_object(&mut feeCopy, &Value::Str("cost".to_string()), __be_tmp); };
3092 if is_true(&Value::Bool(in_op(&feeCopy, &Value::Str("rate".to_string())))) {
3093 { let __be_tmp = self.safe_number_k(feeCopy.clone(), "rate", &[]); add_element_to_object(&mut feeCopy, &Value::Str("rate".to_string()), __be_tmp); };
3094 }
3095 append_to_array(&mut reducedFees, feeCopy.clone());
3096 }
3097 add_element_to_object(&mut order, &Value::Str("fees".to_string()), reducedFees.clone());
3098 if is_true(&parseFee) && is_true(&(is_equal(&reducedLength, &Value::Int(1)))) {
3099 add_element_to_object(&mut order, &Value::Str("fee".to_string()), get_value(&reducedFees, &Value::Int(0)));
3100 }
3101 }
3102 if is_equal(&amount, &Value::Null) {
3103 if !is_equal(&filled, &Value::Null) && !is_equal(&remaining, &Value::Null) {
3105 amount = crate::precise::Precise::stringAdd(&filled, &remaining);
3106 } else if is_equal(&status, &Value::Str("closed".to_string())) {
3107 amount = filled.clone();
3108 }
3109 }
3110 if is_equal(&filled, &Value::Null) {
3111 if !is_equal(&amount, &Value::Null) && !is_equal(&remaining, &Value::Null) {
3112 filled = crate::precise::Precise::stringSub(&amount, &remaining);
3113 } else if is_equal(&status, &Value::Str("closed".to_string())) && !is_equal(&amount, &Value::Null) {
3114 filled = amount.clone();
3115 }
3116 }
3117 if is_equal(&remaining, &Value::Null) {
3118 if !is_equal(&amount, &Value::Null) && !is_equal(&filled, &Value::Null) {
3119 remaining = crate::precise::Precise::stringSub(&amount, &filled);
3120 } else if is_equal(&status, &Value::Str("closed".to_string())) {
3121 remaining = Value::Str("0".to_string());
3122 }
3123 }
3124 let mut inverse: Value = self.safe_bool_k(market.clone(), "inverse", &[Value::Bool(false)]);
3126 let mut contractSize: Value = self.number_to_string(self.safe_value_k(market.clone(), "contractSize", &[Value::Int(1)]));
3127 if is_equal(&average, &Value::Null) {
3133 if is_true(&(!is_equal(&filled, &Value::Null))) && is_true(&(!is_equal(&cost, &Value::Null))) && is_true(&crate::precise::Precise::stringGt(&filled, &Value::Str("0".to_string()))) {
3134 let mut filledTimesContractSize: Value = crate::precise::Precise::stringMul(&filled, &contractSize);
3135 if is_equal(&inverse, &Value::Bool(true)) {
3136 average = crate::precise::Precise::stringDiv(&filledTimesContractSize, &cost);
3137 } else {
3138 average = crate::precise::Precise::stringDiv(&cost, &filledTimesContractSize);
3139 }
3140 }
3141 }
3142 let mut costPriceExists: bool = is_true(&(!is_equal(&average, &Value::Null))) || is_true(&(!is_equal(&price, &Value::Null)));
3149 if is_true(&parseCost) && is_true(&(!is_equal(&filled, &Value::Null))) && is_true(&costPriceExists) {
3150 let mut multiplyPrice: Value = Value::Null;
3151 if is_equal(&average, &Value::Null) {
3152 multiplyPrice = price.clone();
3153 } else {
3154 multiplyPrice = average.clone();
3155 }
3156 let mut filledTimesContractSize: Value = crate::precise::Precise::stringMul(&filled, &contractSize);
3158 if is_equal(&inverse, &Value::Bool(true)) {
3159 cost = crate::precise::Precise::stringDiv(&filledTimesContractSize, &multiplyPrice);
3160 } else {
3161 cost = crate::precise::Precise::stringMul(&filledTimesContractSize, &multiplyPrice);
3162 }
3163 }
3164 let mut orderType: Value = self.safe_value_k(order.clone(), "type", &[]);
3166 let mut emptyPrice: bool = is_true(&(is_equal(&price, &Value::Null))) || is_true(&crate::precise::Precise::stringEquals(&price, &Value::Str("0".to_string())));
3167 if is_true(&emptyPrice) && is_true(&(is_equal(&orderType, &Value::Str("market".to_string())))) {
3168 price = average.clone();
3169 }
3170 {
3171 let mut i: Value = Value::Int(0);
3172 let mut __for_first_95: bool = true;
3173 while { if !__for_first_95 { i = add(&i, &Value::Int(1)); } __for_first_95 = false; is_less_than(&i, &get_array_length(&trades)) } {
3174 let mut entry: Value = get_value(&trades, &i);
3175 let mut entry: Value = get_value(&trades, &i);
3176 { let __be_tmp = self.safe_number_k(entry.clone(), "amount", &[]); add_element_to_object(&mut entry, &Value::Str("amount".to_string()), __be_tmp); };
3177 { let __be_tmp = self.safe_number_k(entry.clone(), "price", &[]); add_element_to_object(&mut entry, &Value::Str("price".to_string()), __be_tmp); };
3178 { let __be_tmp = self.safe_number_k(entry.clone(), "cost", &[]); add_element_to_object(&mut entry, &Value::Str("cost".to_string()), __be_tmp); };
3179 let mut tradeFee: Value = self.safe_dict_k(entry.clone(), "fee", &[Value::Map({
3180 let mut m = indexmap::IndexMap::new();
3181 m
3182})]);
3183 { let __be_tmp = self.safe_number_k(tradeFee.clone(), "cost", &[]); add_element_to_object(&mut tradeFee, &Value::Str("cost".to_string()), __be_tmp); };
3184 if is_true(&Value::Bool(in_op(&tradeFee, &Value::Str("rate".to_string())))) {
3185 { let __be_tmp = self.safe_number_k(tradeFee.clone(), "rate", &[]); add_element_to_object(&mut tradeFee, &Value::Str("rate".to_string()), __be_tmp); };
3186 }
3187 let mut entryFees: Value = self.safe_list_k(entry.clone(), "fees", &[Value::List(vec![])]);
3188 {
3189 let mut j: Value = Value::Int(0);
3190 let mut __for_first_94: bool = true;
3191 while { if !__for_first_94 { j = add(&j, &Value::Int(1)); } __for_first_94 = false; is_less_than(&j, &get_array_length(&entryFees)) } {
3192 { let __be_tmp = self.safe_number_k(get_value(&entryFees, &j), "cost", &[]); add_element_to_object(get_value_mut(&mut entryFees, &j), &Value::Str("cost".to_string()), __be_tmp); };
3193 }
3194 }
3195 add_element_to_object(&mut entry, &Value::Str("fees".to_string()), entryFees.clone());
3196 add_element_to_object(&mut entry, &Value::Str("fee".to_string()), tradeFee.clone());
3197 }
3198 }
3199 let mut timeInForce: Value = self.safe_string_k(order.clone(), "timeInForce", &[]);
3200 let mut postOnly: Value = self.safe_value_k(order.clone(), "postOnly", &[]);
3201 if is_equal(&timeInForce, &Value::Null) {
3203 if !is_true(&isTriggerOrSLTpOrder) && is_true(&(is_equal(&self.safe_string_k(order.clone(), "type", &[]), &Value::Str("market".to_string())))) {
3204 timeInForce = Value::Str("IOC".to_string());
3205 }
3206 if is_equal(&postOnly, &Value::Bool(true)) {
3208 timeInForce = Value::Str("PO".to_string());
3209 }
3210 } else if is_equal(&postOnly, &Value::Null) {
3211 postOnly = Value::Bool(is_equal(&timeInForce, &Value::Str("PO".to_string())));
3213 }
3214 let mut timestamp: Value = self.safe_integer_k(order.clone(), "timestamp", &[]);
3215 let mut lastUpdateTimestamp: Value = self.safe_integer_k(order.clone(), "lastUpdateTimestamp", &[]);
3216 let mut datetime: Value = self.safe_string_k(order.clone(), "datetime", &[]);
3217 if is_equal(&datetime, &Value::Null) {
3218 datetime = self.iso8601(timestamp.clone());
3219 }
3220 let mut triggerPrice: Value = self.parse_number(self.safe_string2(order.clone(), Value::Str("triggerPrice".to_string()), Value::Str("stopPrice".to_string()), &[]), &[]);
3221 let mut takeProfitPrice: Value = self.parse_number(self.safe_string_k(order.clone(), "takeProfitPrice", &[]), &[]);
3222 let mut stopLossPrice: Value = self.parse_number(self.safe_string_k(order.clone(), "stopLossPrice", &[]), &[]);
3223 return self.extend(order.clone(), &[Value::Map({
3224 let mut m = indexmap::IndexMap::new();
3225 m.insert("id".to_string(), self.safe_string_k(order.clone(), "id", &[]));
3226 m.insert("clientOrderId".to_string(), self.safe_string_k(order.clone(), "clientOrderId", &[]));
3227 m.insert("timestamp".to_string(), timestamp.clone());
3228 m.insert("datetime".to_string(), datetime.clone());
3229 m.insert("symbol".to_string(), symbol.clone());
3230 m.insert("type".to_string(), self.safe_string_k(order.clone(), "type", &[]));
3231 m.insert("side".to_string(), side.clone());
3232 m.insert("lastTradeTimestamp".to_string(), lastTradeTimeTimestamp.clone());
3233 m.insert("lastUpdateTimestamp".to_string(), lastUpdateTimestamp.clone());
3234 m.insert("price".to_string(), self.parse_number(price.clone(), &[]));
3235 m.insert("amount".to_string(), self.parse_number(amount.clone(), &[]));
3236 m.insert("cost".to_string(), self.parse_number(cost.clone(), &[]));
3237 m.insert("average".to_string(), self.parse_number(average.clone(), &[]));
3238 m.insert("filled".to_string(), self.parse_number(filled.clone(), &[]));
3239 m.insert("remaining".to_string(), self.parse_number(remaining.clone(), &[]));
3240 m.insert("timeInForce".to_string(), timeInForce.clone());
3241 m.insert("postOnly".to_string(), postOnly.clone());
3242 m.insert("trades".to_string(), trades.clone());
3243 m.insert("reduceOnly".to_string(), self.safe_value_k(order.clone(), "reduceOnly", &[]));
3244 m.insert("stopPrice".to_string(), triggerPrice.clone());
3245 m.insert("triggerPrice".to_string(), triggerPrice.clone());
3246 m.insert("takeProfitPrice".to_string(), takeProfitPrice.clone());
3247 m.insert("stopLossPrice".to_string(), stopLossPrice.clone());
3248 m.insert("status".to_string(), status.clone());
3249 m.insert("fee".to_string(), self.safe_value_k(order.clone(), "fee", &[]));
3250 m
3251})]);
3252
3253 Value::Null
3254}
3255
3256 fn parse_orders(&self, mut orders: Value, optional_args: &[Value]) -> Value {
3257 let mut market = get_arg(optional_args, 0, Value::Null);
3258 let mut since = get_arg(optional_args, 1, Value::Null);
3259 let mut limit = get_arg(optional_args, 2, Value::Null);
3260 let mut params = get_arg(optional_args, 3, Value::Map({
3261 let mut m = indexmap::IndexMap::new();
3262 m
3263}));
3264 if is_equal(&orders, &Value::Null) {
3286 return Value::List(vec![]);
3287 }
3288 let mut results: Value = Value::List(vec![]);
3289 if is_true(&Value::Bool(is_array(&orders))) {
3290 {
3291 let mut i: Value = Value::Int(0);
3292 let mut __for_first_96: bool = true;
3293 while { if !__for_first_96 { i = add(&i, &Value::Int(1)); } __for_first_96 = false; is_less_than(&i, &get_array_length(&orders)) } {
3294 let mut parsed: Value = <Self as crate::exchange_generated::ExchangeBase>::parse_order(self, get_value(&orders, &i), &[market.clone()]); let mut order: Value = self.extend(parsed.clone(), &[params.clone()]);
3296 append_to_array(&mut results, order.clone());
3297 }
3298 }
3299 } else {
3300 let mut ids: Value = object_keys(&orders);
3301 {
3302 let mut i: Value = Value::Int(0);
3303 let mut __for_first_97: bool = true;
3304 while { if !__for_first_97 { i = add(&i, &Value::Int(1)); } __for_first_97 = false; is_less_than(&i, &get_array_length(&ids)) } {
3305 let mut id: Value = get_value(&ids, &i);
3306 let mut id: Value = get_value(&ids, &i);
3307 let mut idExtended: Value = self.extend(Value::Map({
3308 let mut m = indexmap::IndexMap::new();
3309 m.insert("id".to_string(), id.clone());
3310 m
3311 }), &[get_value(&orders, &id)]);
3312 let mut parsedOrder: Value = <Self as crate::exchange_generated::ExchangeBase>::parse_order(self, idExtended.clone(), &[market.clone()]); let mut order: Value = self.extend(parsedOrder.clone(), &[params.clone()]);
3314 append_to_array(&mut results, order.clone());
3315 }
3316 }
3317 }
3318 results = self.sort_by(results.clone(), Value::Str("timestamp".to_string()), &[]);
3319 let mut symbol: Value = self.safe_string_k(market.clone(), "symbol", &[]);
3320 return self.filter_by_symbol_since_limit(results.clone(), &[symbol.clone(), since.clone(), limit.clone()]);
3321
3322 Value::Null
3323}
3324
3325 fn calculate_fee_with_rate(&self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, mut price: Value, optional_args: &[Value]) -> Value {
3326 let mut takerOrMaker = get_arg(optional_args, 0, Value::Str("taker".to_string()));
3327 let mut feeRate = get_arg(optional_args, 1, Value::Null);
3328 let mut params = get_arg(optional_args, 2, Value::Map({
3329 let mut m = indexmap::IndexMap::new();
3330 m
3331}));
3332 if is_equal(&type_var, &Value::Str("market".to_string())) && is_equal(&takerOrMaker, &Value::Str("maker".to_string())) {
3333 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" calculateFee() - you have provided incompatible arguments - \"market\" type order can not be \"maker\". Change either the \"type\" or the \"takerOrMaker\" argument to calculate the fee.".to_string()))));
3334 }
3335 let mut markets: Value = self.markets.clone();
3336 if is_equal(&markets, &Value::Null) {
3337 panic!("{}", crate::exchange_errors::exchange_error(add(&self.id, &Value::Str(" markets not loaded".to_string()))));
3338 }
3339 let mut market: Value = get_value(&markets, &symbol);
3340 let mut market: Value = get_value(&markets, &symbol);
3341 let mut feeSide: Value = self.safe_string_k(market.clone(), "feeSide", &[Value::Str("quote".to_string())]);
3342 let mut useQuote: Value = Value::Null;
3343 if is_equal(&feeSide, &Value::Str("get".to_string())) {
3344 useQuote = Value::Bool(is_equal(&side, &Value::Str("sell".to_string())));
3346 } else if is_equal(&feeSide, &Value::Str("give".to_string())) {
3347 useQuote = Value::Bool(is_equal(&side, &Value::Str("buy".to_string())));
3349 } else {
3350 useQuote = Value::Bool(is_equal(&feeSide, &Value::Str("quote".to_string())));
3352 }
3353 let mut cost: Value = self.number_to_string(amount.clone());
3354 let mut key: Value = Value::Null;
3355 if is_true(&useQuote) {
3356 let mut priceString: Value = self.number_to_string(price.clone());
3357 cost = crate::precise::Precise::stringMul(&cost, &priceString);
3358 key = Value::Str("quote".to_string());
3359 } else {
3360 key = Value::Str("base".to_string());
3361 }
3362 if !is_equal(&get_value(&market, &Value::Str("spot".to_string())), &Value::Bool(true)) {
3364 key = Value::Str("settle".to_string());
3365 }
3366 if is_equal(&type_var, &Value::Str("market".to_string())) {
3368 takerOrMaker = Value::Str("taker".to_string());
3369 }
3370 let mut rate: Value = ternary(is_true(&(!is_equal(&feeRate, &Value::Null))), self.number_to_string(feeRate.clone()), self.safe_string(market.clone(), takerOrMaker.clone(), &[]));
3371 cost = crate::precise::Precise::stringMul(&cost, &rate);
3372 return Value::Map({
3373 let mut m = indexmap::IndexMap::new();
3374 m.insert("type".to_string(), takerOrMaker.clone());
3375 m.insert("currency".to_string(), get_value(&market, &key));
3376 m.insert("rate".to_string(), self.parse_number(rate.clone(), &[]));
3377 m.insert("cost".to_string(), self.parse_number(cost.clone(), &[]));
3378 m
3379});
3380
3381 Value::Null
3382}
3383
3384 fn calculate_fee(&self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, mut price: Value, optional_args: &[Value]) -> Value {
3385 let mut takerOrMaker = get_arg(optional_args, 0, Value::Str("taker".to_string()));
3386 let mut params = get_arg(optional_args, 1, Value::Map({
3387 let mut m = indexmap::IndexMap::new();
3388 m
3389}));
3390 return self.calculate_fee_with_rate(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), price.clone(), &[takerOrMaker.clone(), Value::Null, params.clone()]);
3391
3392 Value::Null
3393}
3394
3395 fn safe_liquidation(&self, mut liquidation: Value, optional_args: &[Value]) -> Value {
3396 let mut market = get_arg(optional_args, 0, Value::Null);
3397 let mut contracts: Value = self.safe_string_k(liquidation.clone(), "contracts", &[]);
3398 let mut contractSize: Value = self.safe_string_k(market.clone(), "contractSize", &[]);
3399 let mut price: Value = self.safe_string_k(liquidation.clone(), "price", &[]);
3400 let mut baseValue: Value = self.safe_string_k(liquidation.clone(), "baseValue", &[]);
3401 let mut quoteValue: Value = self.safe_string_k(liquidation.clone(), "quoteValue", &[]);
3402 if is_true(&(is_equal(&baseValue, &Value::Null))) && is_true(&(!is_equal(&contracts, &Value::Null))) && is_true(&(!is_equal(&contractSize, &Value::Null))) && is_true(&(!is_equal(&price, &Value::Null))) {
3403 baseValue = crate::precise::Precise::stringMul(&contracts, &contractSize);
3404 }
3405 if is_true(&(is_equal("eValue, &Value::Null))) && is_true(&(!is_equal(&baseValue, &Value::Null))) && is_true(&(!is_equal(&price, &Value::Null))) {
3406 quoteValue = crate::precise::Precise::stringMul(&baseValue, &price);
3407 }
3408 add_element_to_object(&mut liquidation, &Value::Str("contracts".to_string()), self.parse_number(contracts.clone(), &[]));
3409 add_element_to_object(&mut liquidation, &Value::Str("contractSize".to_string()), self.parse_number(contractSize.clone(), &[]));
3410 add_element_to_object(&mut liquidation, &Value::Str("price".to_string()), self.parse_number(price.clone(), &[]));
3411 add_element_to_object(&mut liquidation, &Value::Str("baseValue".to_string()), self.parse_number(baseValue.clone(), &[]));
3412 add_element_to_object(&mut liquidation, &Value::Str("quoteValue".to_string()), self.parse_number(quoteValue.clone(), &[]));
3413 return liquidation;
3414
3415 Value::Null
3416}
3417
3418 fn safe_trade(&self, mut trade: Value, optional_args: &[Value]) -> Value {
3419 let mut market = get_arg(optional_args, 0, Value::Null);
3420 let mut amount: Value = self.safe_string_k(trade.clone(), "amount", &[]);
3421 let mut price: Value = self.safe_string_k(trade.clone(), "price", &[]);
3422 let mut cost: Value = self.safe_string_k(trade.clone(), "cost", &[]);
3423 if is_equal(&cost, &Value::Null) {
3424 let mut contractSize: Value = self.safe_string_k(market.clone(), "contractSize", &[]);
3426 let mut multiplyPrice: Value = price.clone();
3427 if !is_equal(&contractSize, &Value::Null) {
3428 let mut inverse: Value = self.safe_bool_k(market.clone(), "inverse", &[Value::Bool(false)]);
3429 if is_equal(&inverse, &Value::Bool(true)) {
3430 multiplyPrice = crate::precise::Precise::stringDiv(&Value::Str("1".to_string()), &price);
3431 }
3432 multiplyPrice = crate::precise::Precise::stringMul(&multiplyPrice, &contractSize);
3433 }
3434 cost = crate::precise::Precise::stringMul(&multiplyPrice, &amount);
3435 }
3436 let mut resultFeeresultFeesVariable = self.parsed_fee_and_fees(trade.clone());
3437 let mut resultFee: Value = get_value(&resultFeeresultFeesVariable, &Value::Int(0));
3438 let mut resultFees: Value = get_value(&resultFeeresultFeesVariable, &Value::Int(1));
3439 add_element_to_object(&mut trade, &Value::Str("fee".to_string()), resultFee.clone());
3440 add_element_to_object(&mut trade, &Value::Str("fees".to_string()), resultFees.clone());
3441 add_element_to_object(&mut trade, &Value::Str("amount".to_string()), self.parse_number(amount.clone(), &[]));
3442 add_element_to_object(&mut trade, &Value::Str("price".to_string()), self.parse_number(price.clone(), &[]));
3443 add_element_to_object(&mut trade, &Value::Str("cost".to_string()), self.parse_number(cost.clone(), &[]));
3444 return trade;
3445
3446 Value::Null
3447}
3448
3449 fn create_ccxt_trade_id(&self, optional_args: &[Value]) -> Value {
3450 let mut timestamp = get_arg(optional_args, 0, Value::Null);
3451 let mut side = get_arg(optional_args, 1, Value::Null);
3452 let mut amount = get_arg(optional_args, 2, Value::Null);
3453 let mut price = get_arg(optional_args, 3, Value::Null);
3454 let mut takerOrMaker = get_arg(optional_args, 4, Value::Null);
3455 let mut id: Value = Value::Null;
3457 if !is_equal(×tamp, &Value::Null) {
3458 id = self.number_to_string(timestamp.clone());
3459 if !is_equal(&side, &Value::Null) {
3460 id = add(&id, &add(&Value::Str("-".to_string()), &side));
3461 }
3462 if !is_equal(&amount, &Value::Null) {
3463 id = add(&id, &add(&Value::Str("-".to_string()), &self.number_to_string(amount.clone())));
3464 }
3465 if !is_equal(&price, &Value::Null) {
3466 id = add(&id, &add(&Value::Str("-".to_string()), &self.number_to_string(price.clone())));
3467 }
3468 if !is_equal(&takerOrMaker, &Value::Null) {
3469 id = add(&id, &add(&Value::Str("-".to_string()), &takerOrMaker));
3470 }
3471 }
3472 return id;
3473
3474 Value::Null
3475}
3476
3477 fn parsed_fee_and_fees(&self, mut container: Value) -> Value {
3478 let mut fee: Value = self.safe_dict_k(container.clone(), "fee", &[]);
3479 let mut fees: Value = self.safe_list_k(container.clone(), "fees", &[]);
3480 let mut feeDefined: bool = !is_equal(&fee, &Value::Null);
3481 let mut feesDefined: bool = !is_equal(&fees, &Value::Null);
3482 let mut shouldParseFees: bool = is_true(&feeDefined) || is_true(&feesDefined);
3484 if is_true(&shouldParseFees) {
3485 if is_true(&feeDefined) {
3486 fee = self.parse_fee_numeric(fee.clone());
3487 }
3488 if !is_true(&feesDefined) {
3489 fees = Value::List(vec![fee.clone()]);
3491 }
3492 let mut reducedFees: Value = fees.clone();
3494 if is_true(&self.reduceFees) {
3495 reducedFees = self.reduce_fees_by_currency(fees.clone());
3496 }
3497 if is_equal(&reducedFees, &Value::Null) {
3498 reducedFees = Value::List(vec![]);
3499 }
3500 let mut reducedLength: Value = get_array_length(&reducedFees);
3501 {
3502 let mut i: Value = Value::Int(0);
3503 let mut __for_first_98: bool = true;
3504 while { if !__for_first_98 { i = add(&i, &Value::Int(1)); } __for_first_98 = false; is_less_than(&i, &reducedLength) } {
3505 { let __be_tmp = self.parse_fee_numeric(get_value(&reducedFees, &i)); add_element_to_object(&mut reducedFees, &i, __be_tmp); };
3506 }
3507 }
3508 fees = reducedFees.clone();
3509 if is_equal(&reducedLength, &Value::Int(1)) {
3510 fee = get_value(&reducedFees, &Value::Int(0));
3511 } else if is_equal(&reducedLength, &Value::Int(0)) {
3512 fee = Value::Null;
3513 }
3514 }
3515 if is_equal(&fee, &Value::Null) {
3517 fee = Value::Map({
3518 let mut m = indexmap::IndexMap::new();
3519 m.insert("cost".to_string(), Value::Null);
3520 m.insert("currency".to_string(), Value::Null);
3521 m
3522 });
3523 }
3524 if is_equal(&fees, &Value::Null) {
3525 fees = Value::List(vec![]);
3526 }
3527 return Value::List(vec![fee.clone(), fees.clone()]);
3528
3529 Value::Null
3530}
3531
3532 fn parse_fee_numeric(&self, mut fee: Value) -> Value {
3533 { let __be_tmp = self.safe_number_k(fee.clone(), "cost", &[]); add_element_to_object(&mut fee, &Value::Str("cost".to_string()), __be_tmp); }; if is_true(&Value::Bool(in_op(&fee, &Value::Str("rate".to_string())))) {
3535 { let __be_tmp = self.safe_number_k(fee.clone(), "rate", &[]); add_element_to_object(&mut fee, &Value::Str("rate".to_string()), __be_tmp); };
3536 }
3537 return fee;
3538
3539 Value::Null
3540}
3541
3542 fn find_nearest_ceiling(&self, mut arr: Value, mut providedValue: Value) -> Value {
3543 let mut length: Value = get_array_length(&arr);
3545 {
3546 let mut i: Value = Value::Int(0);
3547 let mut __for_first_99: bool = true;
3548 while { if !__for_first_99 { i = add(&i, &Value::Int(1)); } __for_first_99 = false; is_less_than(&i, &length) } {
3549 let mut current: Value = get_value(&arr, &i);
3550 let mut current: Value = get_value(&arr, &i);
3551 if is_less_than_or_equal(&providedValue, ¤t) {
3552 return current;
3553 }
3554 }
3555 }
3556 return get_value(&arr, &subtract(&length, &Value::Int(1)));
3557
3558 Value::Null
3559}
3560
3561 fn add_key_in_array_items(&self, mut obj: Value, mut keyName: Value) -> Value {
3562 let mut result: Value = Value::List(vec![]);
3563 let mut keys: Value = object_keys(&obj);
3564 {
3565 let mut i: Value = Value::Int(0);
3566 let mut __for_first_100: bool = true;
3567 while { if !__for_first_100 { i = add(&i, &Value::Int(1)); } __for_first_100 = false; is_less_than(&i, &get_array_length(&keys)) } {
3568 let mut key: Value = get_value(&keys, &i);
3569 let mut key: Value = get_value(&keys, &i);
3570 let mut item: Value = get_value(&obj, &key);
3571 let mut item: Value = get_value(&obj, &key);
3572 if is_equal(&item, &Value::Null) {
3573 continue;
3574 }
3575 let mut itemWithKey: Value = self.extend(Value::Map({
3576 let mut m = indexmap::IndexMap::new();
3577 m
3578 }), &[item.clone()]);
3579 add_element_to_object(&mut itemWithKey, &keyName, key.clone());
3580 append_to_array(&mut result, itemWithKey.clone());
3581 }
3582 }
3583 return result;
3584
3585 Value::Null
3586}
3587
3588 fn invert_flat_string_dictionary(&self, mut dict: Value) -> Value {
3589 let mut reversed: Value = Value::Map({
3590 let mut m = indexmap::IndexMap::new();
3591 m
3592 });
3593 let mut keys: Value = object_keys(&dict);
3594 {
3595 let mut i: Value = Value::Int(0);
3596 let mut __for_first_101: bool = true;
3597 while { if !__for_first_101 { i = add(&i, &Value::Int(1)); } __for_first_101 = false; is_less_than(&i, &get_array_length(&keys)) } {
3598 let mut key: Value = get_value(&keys, &i);
3599 let mut key: Value = get_value(&keys, &i);
3600 let mut value: Value = get_value(&dict, &key);
3601 let mut value: Value = get_value(&dict, &key);
3602 if is_string(&value) {
3603 add_element_to_object(&mut reversed, &value, key.clone());
3604 }
3605 }
3606 }
3607 return reversed;
3608
3609 Value::Null
3610}
3611
3612 fn string_to_base16(&self, mut str_val: Value) -> Value {
3613 return add(&Value::Str("0x".to_string()), &self.binary_to_base16(self.base64_to_binary(self.string_to_base64(str_val.clone(), &[]), &[]), &[]));
3614
3615 Value::Null
3616}
3617
3618 fn reduce_fees_by_currency(&self, mut fees: Value) -> Value {
3619 let mut reduced: Value = Value::Map({
3665 let mut m = indexmap::IndexMap::new();
3666 m
3667 });
3668 {
3669 let mut i: Value = Value::Int(0);
3670 let mut __for_first_102: bool = true;
3671 while { if !__for_first_102 { i = add(&i, &Value::Int(1)); } __for_first_102 = false; is_less_than(&i, &get_array_length(&fees)) } {
3672 let mut fee: Value = get_value(&fees, &i);
3673 let mut fee: Value = get_value(&fees, &i);
3674 let mut code: Value = self.safe_string_k(fee.clone(), "currency", &[]);
3675 let mut feeCurrencyCode: Value = ternary(is_true(&(!is_equal(&code, &Value::Null))), code.clone(), to_string_val(&i));
3676 if !is_equal(&feeCurrencyCode, &Value::Null) {
3677 let mut rate: Value = self.safe_string_k(fee.clone(), "rate", &[]);
3678 let mut cost: Value = self.safe_string_k(fee.clone(), "cost", &[]);
3679 if is_equal(&cost, &Value::Null) {
3680 continue;
3681 }
3682 if !is_true(&(Value::Bool(in_op(&reduced, &feeCurrencyCode)))) {
3683 add_element_to_object(&mut reduced, &feeCurrencyCode, Value::Map({
3684 let mut m = indexmap::IndexMap::new();
3685 m
3686}));
3687 }
3688 let mut rateKey: Value = ternary(is_true(&(is_equal(&rate, &Value::Null))), Value::Str("".to_string()), rate.clone());
3689 if is_true(&Value::Bool(in_op(&get_value(&reduced, &feeCurrencyCode), &rateKey))) {
3690 { let __be_tmp = crate::precise::Precise::stringAdd(&get_value(&get_value(&get_value(&reduced, &feeCurrencyCode), &rateKey), &Value::Str("cost".to_string())), &cost); add_element_to_object(get_value_mut(get_value_mut(&mut reduced, &feeCurrencyCode), &rateKey), &Value::Str("cost".to_string()), __be_tmp); };
3691 } else {
3692 add_element_to_object(get_value_mut(&mut reduced, &feeCurrencyCode), &rateKey, Value::Map({
3693 let mut m = indexmap::IndexMap::new();
3694 m.insert("currency".to_string(), code.clone());
3695 m.insert("cost".to_string(), cost.clone());
3696 m
3697}));
3698 if !is_equal(&rate, &Value::Null) {
3699 add_element_to_object(get_value_mut(get_value_mut(&mut reduced, &feeCurrencyCode), &rateKey), &Value::Str("rate".to_string()), rate.clone());
3700 }
3701 }
3702 }
3703 }
3704 }
3705 let mut result: Value = Value::List(vec![]);
3706 let mut feeValues: Value = object_values(&reduced);
3707 {
3708 let mut i: Value = Value::Int(0);
3709 let mut __for_first_103: bool = true;
3710 while { if !__for_first_103 { i = add(&i, &Value::Int(1)); } __for_first_103 = false; is_less_than(&i, &get_array_length(&feeValues)) } {
3711 let mut reducedFeeValues: Value = object_values(&get_value(&feeValues, &i));
3712 result = self.array_concat(result.clone(), reducedFeeValues.clone());
3713 }
3714 }
3715 return result;
3716
3717 Value::Null
3718}
3719
3720 fn safe_ticker(&self, mut ticker: Value, optional_args: &[Value]) -> Value {
3721 let mut market = get_arg(optional_args, 0, Value::Null);
3722 let mut open: Value = self.omit_zero(self.safe_string_k(ticker.clone(), "open", &[]));
3723 let mut close: Value = self.omit_zero(self.safe_string2(ticker.clone(), Value::Str("close".to_string()), Value::Str("last".to_string()), &[]));
3724 let mut change: Value = self.safe_string_k(ticker.clone(), "change", &[]); let mut percentage: Value = self.omit_zero(self.safe_string_k(ticker.clone(), "percentage", &[]));
3726 let mut average: Value = self.omit_zero(self.safe_string_k(ticker.clone(), "average", &[]));
3727 let mut vwap: Value = self.safe_string_k(ticker.clone(), "vwap", &[]);
3728 let mut baseVolume: Value = self.safe_string_k(ticker.clone(), "baseVolume", &[]);
3729 let mut quoteVolume: Value = self.safe_string_k(ticker.clone(), "quoteVolume", &[]);
3730 if is_equal(&vwap, &Value::Null) {
3731 vwap = crate::precise::Precise::stringDiv(&self.omit_zero(quoteVolume.clone()), &baseVolume);
3732 }
3733 if !is_equal(&change, &Value::Null) {
3735 if is_equal(&close, &Value::Null) && !is_equal(&average, &Value::Null) {
3736 close = crate::precise::Precise::stringAdd(&average, &crate::precise::Precise::stringDiv(&change, &Value::Str("2".to_string())));
3737 }
3738 if is_equal(&open, &Value::Null) && !is_equal(&close, &Value::Null) {
3739 open = crate::precise::Precise::stringSub(&close, &change);
3740 }
3741 } else if !is_equal(&percentage, &Value::Null) {
3742 if is_equal(&close, &Value::Null) && !is_equal(&average, &Value::Null) {
3743 let mut openAddClose: Value = crate::precise::Precise::stringMul(&average, &Value::Str("2".to_string()));
3744 let mut denominator: Value = crate::precise::Precise::stringAdd(&Value::Str("2".to_string()), &crate::precise::Precise::stringDiv(&percentage, &Value::Str("100".to_string())));
3746 let mut calcOpen: Value = ternary(is_true(&(!is_equal(&open, &Value::Null))), open.clone(), crate::precise::Precise::stringDiv(&openAddClose, &denominator));
3747 close = crate::precise::Precise::stringMul(&calcOpen, &crate::precise::Precise::stringAdd(&Value::Str("1".to_string()), &crate::precise::Precise::stringDiv(&percentage, &Value::Str("100".to_string()))));
3748 }
3749 if is_equal(&open, &Value::Null) && !is_equal(&close, &Value::Null) {
3750 open = crate::precise::Precise::stringDiv(&close, &crate::precise::Precise::stringAdd(&Value::Str("1".to_string()), &crate::precise::Precise::stringDiv(&percentage, &Value::Str("100".to_string()))));
3751 }
3752 }
3753 if is_equal(&change, &Value::Null) {
3755 if !is_equal(&close, &Value::Null) && !is_equal(&open, &Value::Null) {
3756 change = crate::precise::Precise::stringSub(&close, &open);
3757 } else if !is_equal(&close, &Value::Null) && !is_equal(&percentage, &Value::Null) {
3758 change = crate::precise::Precise::stringMul(&crate::precise::Precise::stringDiv(&percentage, &Value::Str("100".to_string())), &crate::precise::Precise::stringDiv(&close, &Value::Str("100".to_string())));
3759 } else if !is_equal(&open, &Value::Null) && !is_equal(&percentage, &Value::Null) {
3760 change = crate::precise::Precise::stringMul(&open, &crate::precise::Precise::stringDiv(&percentage, &Value::Str("100".to_string())));
3761 }
3762 }
3763 if !is_equal(&open, &Value::Null) {
3765 if is_equal(&percentage, &Value::Null) && !is_equal(&change, &Value::Null) {
3767 percentage = crate::precise::Precise::stringMul(&crate::precise::Precise::stringDiv(&change, &open), &Value::Str("100".to_string()));
3768 }
3769 if is_equal(&close, &Value::Null) && !is_equal(&change, &Value::Null) {
3771 close = crate::precise::Precise::stringAdd(&open, &change);
3772 }
3773 if is_equal(&close, &Value::Null) && !is_equal(&average, &Value::Null) {
3775 close = crate::precise::Precise::stringSub(&crate::precise::Precise::stringMul(&average, &Value::Str("2".to_string())), &open);
3777 }
3778 if is_equal(&average, &Value::Null) && !is_equal(&close, &Value::Null) {
3780 let mut precision: Value = Value::Int(18);
3781 if !is_equal(&market, &Value::Null) && is_true(&self.is_tick_precision()) {
3782 let mut marketPrecision: Value = self.safe_dict_k(market.clone(), "precision", &[]);
3783 let mut precisionPrice: Value = self.safe_string_k(marketPrecision.clone(), "price", &[]);
3784 if !is_equal(&precisionPrice, &Value::Null) {
3785 precision = self.precision_from_string(precisionPrice.clone());
3786 }
3787 }
3788 average = crate::precise::Precise::stringDivPrec(&crate::precise::Precise::stringAdd(&open, &close), &Value::Str("2".to_string()), &precision);
3789 }
3790 }
3791 let mut closeParsed: Value = self.parse_number(self.omit_zero(close.clone()), &[]);
3794 return self.extend(ticker.clone(), &[Value::Map({
3795 let mut m = indexmap::IndexMap::new();
3796 m.insert("bid".to_string(), self.parse_number(self.omit_zero(self.safe_string_k(ticker.clone(), "bid", &[])), &[]));
3797 m.insert("bidVolume".to_string(), self.safe_number_k(ticker.clone(), "bidVolume", &[]));
3798 m.insert("ask".to_string(), self.parse_number(self.omit_zero(self.safe_string_k(ticker.clone(), "ask", &[])), &[]));
3799 m.insert("askVolume".to_string(), self.safe_number_k(ticker.clone(), "askVolume", &[]));
3800 m.insert("high".to_string(), self.parse_number(self.omit_zero(self.safe_string_k(ticker.clone(), "high", &[])), &[]));
3801 m.insert("low".to_string(), self.parse_number(self.omit_zero(self.safe_string_k(ticker.clone(), "low", &[])), &[]));
3802 m.insert("open".to_string(), self.parse_number(self.omit_zero(open.clone()), &[]));
3803 m.insert("close".to_string(), closeParsed.clone());
3804 m.insert("last".to_string(), closeParsed.clone());
3805 m.insert("change".to_string(), self.parse_number(change.clone(), &[]));
3806 m.insert("percentage".to_string(), self.parse_number(percentage.clone(), &[]));
3807 m.insert("average".to_string(), self.parse_number(average.clone(), &[]));
3808 m.insert("vwap".to_string(), self.parse_number(vwap.clone(), &[]));
3809 m.insert("baseVolume".to_string(), self.parse_number(baseVolume.clone(), &[]));
3810 m.insert("quoteVolume".to_string(), self.parse_number(quoteVolume.clone(), &[]));
3811 m.insert("previousClose".to_string(), self.safe_number_k(ticker.clone(), "previousClose", &[]));
3812 m.insert("indexPrice".to_string(), self.safe_number_k(ticker.clone(), "indexPrice", &[]));
3813 m.insert("markPrice".to_string(), self.safe_number_k(ticker.clone(), "markPrice", &[]));
3814 m
3815})]);
3816
3817 Value::Null
3818}
3819
3820 fn fetch_borrow_rate(&mut self, mut code: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
3821 let mut params = get_arg(optional_args, 0, Value::Map({
3822 let mut m = indexmap::IndexMap::new();
3823 m
3824}));
3825 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchBorrowRate is deprecated, please use fetchCrossBorrowRate or fetchIsolatedBorrowRate instead".to_string()))));
3826
3827 Value::Null
3828} }
3829
3830 fn repay_cross_margin(&mut self, mut code: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
3831 if let Some(__v) = self.dispatch_to_derived("repay_cross_margin", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(code.clone()); __args.push(amount.clone()); __args.extend_from_slice(optional_args); __args }).await {
3833 if !matches!(__v, crate::Value::Null) { return __v; }
3834 }
3835
3836 let mut params = get_arg(optional_args, 0, Value::Map({
3837 let mut m = indexmap::IndexMap::new();
3838 m
3839}));
3840 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" repayCrossMargin is not support yet".to_string()))));
3841
3842 Value::Null
3843} }
3844
3845 fn repay_isolated_margin(&mut self, mut symbol: Value, mut code: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
3846 if let Some(__v) = self.dispatch_to_derived("repay_isolated_margin", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(symbol.clone()); __args.push(code.clone()); __args.push(amount.clone()); __args.extend_from_slice(optional_args); __args }).await {
3848 if !matches!(__v, crate::Value::Null) { return __v; }
3849 }
3850
3851 let mut params = get_arg(optional_args, 0, Value::Map({
3852 let mut m = indexmap::IndexMap::new();
3853 m
3854}));
3855 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" repayIsolatedMargin is not support yet".to_string()))));
3856
3857 Value::Null
3858} }
3859
3860 fn borrow_cross_margin(&mut self, mut code: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
3861 if let Some(__v) = self.dispatch_to_derived("borrow_cross_margin", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(code.clone()); __args.push(amount.clone()); __args.extend_from_slice(optional_args); __args }).await {
3863 if !matches!(__v, crate::Value::Null) { return __v; }
3864 }
3865
3866 let mut params = get_arg(optional_args, 0, Value::Map({
3867 let mut m = indexmap::IndexMap::new();
3868 m
3869}));
3870 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" borrowCrossMargin is not support yet".to_string()))));
3871
3872 Value::Null
3873} }
3874
3875 fn borrow_isolated_margin(&mut self, mut symbol: Value, mut code: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
3876 if let Some(__v) = self.dispatch_to_derived("borrow_isolated_margin", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(symbol.clone()); __args.push(code.clone()); __args.push(amount.clone()); __args.extend_from_slice(optional_args); __args }).await {
3878 if !matches!(__v, crate::Value::Null) { return __v; }
3879 }
3880
3881 let mut params = get_arg(optional_args, 0, Value::Map({
3882 let mut m = indexmap::IndexMap::new();
3883 m
3884}));
3885 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" borrowIsolatedMargin is not support yet".to_string()))));
3886
3887 Value::Null
3888} }
3889
3890 fn borrow_margin(&mut self, mut code: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
3891 let mut symbol = get_arg(optional_args, 0, Value::Null);
3892 let mut params = get_arg(optional_args, 1, Value::Map({
3893 let mut m = indexmap::IndexMap::new();
3894 m
3895}));
3896 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" borrowMargin is deprecated, please use borrowCrossMargin or borrowIsolatedMargin instead".to_string()))));
3897
3898 Value::Null
3899} }
3900
3901 fn repay_margin(&mut self, mut code: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
3902 let mut symbol = get_arg(optional_args, 0, Value::Null);
3903 let mut params = get_arg(optional_args, 1, Value::Map({
3904 let mut m = indexmap::IndexMap::new();
3905 m
3906}));
3907 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" repayMargin is deprecated, please use repayCrossMargin or repayIsolatedMargin instead".to_string()))));
3908
3909 Value::Null
3910} }
3911
3912 fn fetch_ohlcv(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
3913 if let Some(__v) = self.dispatch_to_derived("fetch_ohlcv", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(symbol.clone()); __args.extend_from_slice(optional_args); __args }).await {
3915 if !matches!(__v, crate::Value::Null) { return __v; }
3916 }
3917
3918 let mut timeframe = get_arg(optional_args, 0, Value::Str("1m".to_string()));
3919 let mut since = get_arg(optional_args, 1, Value::Null);
3920 let mut limit = get_arg(optional_args, 2, Value::Null);
3921 let mut params = get_arg(optional_args, 3, Value::Map({
3922 let mut m = indexmap::IndexMap::new();
3923 m
3924}));
3925 let mut message: Value = Value::Str("".to_string());
3926 if !is_equal(&get_value(&self.has, &Value::Str("fetchTrades".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchTrades".to_string())), &Value::Bool(false)) {
3927 message = Value::Str(". If you want to build OHLCV candles from trade executions data, visit https://github.com/ccxt/ccxt/tree/master/examples/ and see \"build-ohlcv-bars\" file".to_string());
3928 }
3929 panic!("{}", crate::exchange_errors::not_supported(add(&add(&self.id, &Value::Str(" fetchOHLCV() is not supported yet".to_string())), &message)));
3930
3931 Value::Null
3932} }
3933
3934 fn fetch_spot_ohlcv(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
3935 let mut timeframe = get_arg(optional_args, 0, Value::Str("1m".to_string()));
3936 let mut since = get_arg(optional_args, 1, Value::Null);
3937 let mut limit = get_arg(optional_args, 2, Value::Null);
3938 let mut params = get_arg(optional_args, 3, Value::Map({
3939 let mut m = indexmap::IndexMap::new();
3940 m
3941}));
3942 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchSpotOHLCV() is not supported yet".to_string()))));
3943
3944 Value::Null
3945} }
3946
3947 fn fetch_contract_ohlcv(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
3948 let mut timeframe = get_arg(optional_args, 0, Value::Str("1m".to_string()));
3949 let mut since = get_arg(optional_args, 1, Value::Null);
3950 let mut limit = get_arg(optional_args, 2, Value::Null);
3951 let mut params = get_arg(optional_args, 3, Value::Map({
3952 let mut m = indexmap::IndexMap::new();
3953 m
3954}));
3955 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchContractOHLCV() is not supported yet".to_string()))));
3956
3957 Value::Null
3958} }
3959
3960 fn fetch_ohlcv_ws(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
3961 let mut timeframe = get_arg(optional_args, 0, Value::Str("1m".to_string()));
3962 let mut since = get_arg(optional_args, 1, Value::Null);
3963 let mut limit = get_arg(optional_args, 2, Value::Null);
3964 let mut params = get_arg(optional_args, 3, Value::Map({
3965 let mut m = indexmap::IndexMap::new();
3966 m
3967}));
3968 let mut message: Value = Value::Str("".to_string());
3969 if !is_equal(&get_value(&self.has, &Value::Str("fetchTradesWs".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchTradesWs".to_string())), &Value::Bool(false)) {
3970 message = Value::Str(". If you want to build OHLCV candles from trade executions data, visit https://github.com/ccxt/ccxt/tree/master/examples/ and see \"build-ohlcv-bars\" file".to_string());
3971 }
3972 panic!("{}", crate::exchange_errors::not_supported(add(&add(&self.id, &Value::Str(" fetchOHLCVWs() is not supported yet. Try using fetchOHLCV instead.".to_string())), &message)));
3973
3974 Value::Null
3975} }
3976
3977 fn watch_ohlcv(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
3978 let mut timeframe = get_arg(optional_args, 0, Value::Str("1m".to_string()));
3979 let mut since = get_arg(optional_args, 1, Value::Null);
3980 let mut limit = get_arg(optional_args, 2, Value::Null);
3981 let mut params = get_arg(optional_args, 3, Value::Map({
3982 let mut m = indexmap::IndexMap::new();
3983 m
3984}));
3985 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchOHLCV() is not supported yet".to_string()))));
3986
3987 Value::Null
3988} }
3989
3990 fn convert_trading_view_to_ohlcv(&self, mut ohlcvs: Value, optional_args: &[Value]) -> Value {
3991 let mut timestamp = get_arg(optional_args, 0, Value::Str("t".to_string()));
3992 let mut open = get_arg(optional_args, 1, Value::Str("o".to_string()));
3993 let mut high = get_arg(optional_args, 2, Value::Str("h".to_string()));
3994 let mut low = get_arg(optional_args, 3, Value::Str("l".to_string()));
3995 let mut close = get_arg(optional_args, 4, Value::Str("c".to_string()));
3996 let mut volume = get_arg(optional_args, 5, Value::Str("v".to_string()));
3997 let mut ms = get_arg(optional_args, 6, Value::Bool(false));
3998 let mut result: Value = Value::List(vec![]);
3999 let mut timestamps: Value = self.safe_list(ohlcvs.clone(), timestamp.clone(), &[Value::List(vec![])]);
4000 let mut opens: Value = self.safe_list(ohlcvs.clone(), open.clone(), &[Value::List(vec![])]);
4001 let mut highs: Value = self.safe_list(ohlcvs.clone(), high.clone(), &[Value::List(vec![])]);
4002 let mut lows: Value = self.safe_list(ohlcvs.clone(), low.clone(), &[Value::List(vec![])]);
4003 let mut closes: Value = self.safe_list(ohlcvs.clone(), close.clone(), &[Value::List(vec![])]);
4004 let mut volumes: Value = self.safe_list(ohlcvs.clone(), volume.clone(), &[Value::List(vec![])]);
4005 {
4006 let mut i: Value = Value::Int(0);
4007 let mut __for_first_104: bool = true;
4008 while { if !__for_first_104 { i = add(&i, &Value::Int(1)); } __for_first_104 = false; is_less_than(&i, &get_array_length(×tamps)) } {
4009 append_to_array(&mut result, Value::List(vec![ternary(is_true(&ms), self.safe_integer(timestamps.clone(), i.clone(), &[]), self.safe_timestamp(timestamps.clone(), i.clone(), &[])), self.safe_value(opens.clone(), i.clone(), &[]), self.safe_value(highs.clone(), i.clone(), &[]), self.safe_value(lows.clone(), i.clone(), &[]), self.safe_value(closes.clone(), i.clone(), &[]), self.safe_value(volumes.clone(), i.clone(), &[])]));
4010 }
4011 }
4012 return result;
4013
4014 Value::Null
4015}
4016
4017 fn convert_ohlcv_to_trading_view(&self, mut ohlcvs: Value, optional_args: &[Value]) -> Value {
4018 let mut timestamp = get_arg(optional_args, 0, Value::Str("t".to_string()));
4019 let mut open = get_arg(optional_args, 1, Value::Str("o".to_string()));
4020 let mut high = get_arg(optional_args, 2, Value::Str("h".to_string()));
4021 let mut low = get_arg(optional_args, 3, Value::Str("l".to_string()));
4022 let mut close = get_arg(optional_args, 4, Value::Str("c".to_string()));
4023 let mut volume = get_arg(optional_args, 5, Value::Str("v".to_string()));
4024 let mut ms = get_arg(optional_args, 6, Value::Bool(false));
4025 let mut result: Value = Value::Map({
4026 let mut m = indexmap::IndexMap::new();
4027 m
4028 });
4029 add_element_to_object(&mut result, ×tamp, Value::List(vec![]));
4030 add_element_to_object(&mut result, &open, Value::List(vec![]));
4031 add_element_to_object(&mut result, &high, Value::List(vec![]));
4032 add_element_to_object(&mut result, &low, Value::List(vec![]));
4033 add_element_to_object(&mut result, &close, Value::List(vec![]));
4034 add_element_to_object(&mut result, &volume, Value::List(vec![]));
4035 {
4036 let mut i: Value = Value::Int(0);
4037 let mut __for_first_105: bool = true;
4038 while { if !__for_first_105 { i = add(&i, &Value::Int(1)); } __for_first_105 = false; is_less_than(&i, &get_array_length(&ohlcvs)) } {
4039 let mut ts: Value = ternary(is_true(&ms), get_value(&get_value(&ohlcvs, &i), &Value::Int(0)), self.parse_to_int(divide(&get_value(&get_value(&ohlcvs, &i), &Value::Int(0)), &Value::Int(1000))));
4040 let mut resultTimestamp: Value = get_value(&result, ×tamp);
4041 append_to_array(&mut resultTimestamp, ts.clone());
4042 crate::set_value(&mut result, ×tamp, resultTimestamp.clone());
4043 let mut resultOpen: Value = get_value(&result, &open);
4044 append_to_array(&mut resultOpen, get_value(&get_value(&ohlcvs, &i), &Value::Int(1)));
4045 crate::set_value(&mut result, &open, resultOpen.clone());
4046 let mut resultHigh: Value = get_value(&result, &high);
4047 append_to_array(&mut resultHigh, get_value(&get_value(&ohlcvs, &i), &Value::Int(2)));
4048 crate::set_value(&mut result, &high, resultHigh.clone());
4049 let mut resultLow: Value = get_value(&result, &low);
4050 append_to_array(&mut resultLow, get_value(&get_value(&ohlcvs, &i), &Value::Int(3)));
4051 crate::set_value(&mut result, &low, resultLow.clone());
4052 let mut resultClose: Value = get_value(&result, &close);
4053 append_to_array(&mut resultClose, get_value(&get_value(&ohlcvs, &i), &Value::Int(4)));
4054 crate::set_value(&mut result, &close, resultClose.clone());
4055 let mut resultVolume: Value = get_value(&result, &volume);
4056 append_to_array(&mut resultVolume, get_value(&get_value(&ohlcvs, &i), &Value::Int(5)));
4057 crate::set_value(&mut result, &volume, resultVolume.clone());
4058 }
4059 }
4060 return result;
4061
4062 Value::Null
4063}
4064
4065 fn fetch_web_endpoint(&mut self, mut method: Value, mut endpointMethod: Value, mut returnAsJson: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
4066 let mut startRegex = get_arg(optional_args, 0, Value::Null);
4067 let mut endRegex = get_arg(optional_args, 1, Value::Null);
4068 let mut errorMessage: Value = Value::Str("".to_string());
4069 let mut options: Value = self.safe_value(self.options.clone(), method.clone(), &[Value::Map({
4070 let mut m = indexmap::IndexMap::new();
4071 m
4072 })]);
4073 let mut muteOnFailure: Value = self.safe_bool_k(options.clone(), "webApiMuteFailure", &[Value::Bool(true)]);
4074 {
4075 if !is_true(&self.safe_bool_k(options.clone(), "webApiEnable", &[Value::Bool(true)])) {
4077 return Value::Null;
4078 }
4079 let mut maxRetries: Value = self.safe_value_k(options.clone(), "webApiRetries", &[Value::Int(10)]);
4080 let mut response: Value = Value::Null;
4081 let mut retry: Value = Value::Int(0);
4082 let mut shouldBreak: bool = false;
4083 while is_less_than(&retry, &maxRetries) {
4084 {
4085 response = self.call_dynamic_checked(endpointMethod.clone(), vec![(Value::Map({
4086 let mut m = indexmap::IndexMap::new();
4087 m
4088 })).clone()]).await;
4089 shouldBreak = true;
4090 break;
4091 }
4092 if is_true(&shouldBreak) {
4093 break;
4094 }
4095 }
4096 let mut content: Value = response.clone();
4097 if is_equal(&content, &Value::Null) {
4098 panic!("{}", crate::exchange_errors::null_response(add(&self.id, &Value::Str(" fetchWebEndpoint() returned empty content".to_string()))));
4099 }
4100 if !is_equal(&startRegex, &Value::Null) {
4101 let mut splitted_by_start: Value = split(&content, &startRegex);
4102 content = get_value(&splitted_by_start, &Value::Int(1)); }
4104 if is_equal(&content, &Value::Null) {
4105 panic!("{}", crate::exchange_errors::null_response(add(&self.id, &Value::Str(" fetchWebEndpoint() returned empty content".to_string()))));
4106 }
4107 if !is_equal(&endRegex, &Value::Null) {
4108 let mut splitted_by_end: Value = split(&content, &endRegex);
4109 content = get_value(&splitted_by_end, &Value::Int(0)); }
4111 if is_true(&(is_equal(&returnAsJson, &Value::Bool(true)))) && is_true(&(is_string(&content))) {
4112 let mut jsoned: Value = self.parse_json_value(trim(&content)); if is_true(&(!is_equal(&jsoned, &Value::Null))) && is_true(&(!is_equal(&jsoned, &Value::Null))) {
4114 return jsoned.clone();
4115 } else {
4116 panic!("{}", crate::exchange_errors::bad_response(Value::Str("could not parse the response into json".to_string())));
4117 }
4118 } else {
4119 return content.clone();
4120 }
4121 }
4122 if is_equal(&muteOnFailure, &Value::Bool(true)) {
4123 return Value::Null;
4124 } else {
4125 panic!("{}", crate::exchange_errors::bad_response(errorMessage));
4126 }
4127} }
4128
4129 fn market_ids(&self, optional_args: &[Value]) -> Value {
4130 let mut symbols = get_arg(optional_args, 0, Value::Null);
4131 if is_equal(&symbols, &Value::Null) {
4137 return symbols;
4138 }
4139 let mut result: Value = Value::List(vec![]);
4140 {
4141 let mut i: Value = Value::Int(0);
4142 let mut __for_first_106: bool = true;
4143 while { if !__for_first_106 { i = add(&i, &Value::Int(1)); } __for_first_106 = false; is_less_than(&i, &get_array_length(&symbols)) } {
4144 let mut id: Value = self.market_id(get_value(&symbols, &i));
4145 if !is_equal(&id, &Value::Null) {
4146 append_to_array(&mut result, id.clone());
4147 }
4148 }
4149 }
4150 return result;
4151
4152 Value::Null
4153}
4154
4155 fn currency_ids(&self, optional_args: &[Value]) -> Value {
4156 let mut codes = get_arg(optional_args, 0, Value::Null);
4157 if is_equal(&codes, &Value::Null) {
4158 return codes;
4159 }
4160 let mut result: Value = Value::List(vec![]);
4161 {
4162 let mut i: Value = Value::Int(0);
4163 let mut __for_first_107: bool = true;
4164 while { if !__for_first_107 { i = add(&i, &Value::Int(1)); } __for_first_107 = false; is_less_than(&i, &get_array_length(&codes)) } {
4165 let mut id: Value = self.currency_id(get_value(&codes, &i));
4166 if !is_equal(&id, &Value::Null) {
4167 append_to_array(&mut result, id.clone());
4168 }
4169 }
4170 }
4171 return result;
4172
4173 Value::Null
4174}
4175
4176 fn markets_for_symbols(&self, optional_args: &[Value]) -> Value {
4177 let mut symbols = get_arg(optional_args, 0, Value::Null);
4178 if is_equal(&symbols, &Value::Null) {
4179 return Value::Null;
4180 }
4181 let mut result: Value = Value::List(vec![]);
4182 {
4183 let mut i: Value = Value::Int(0);
4184 let mut __for_first_108: bool = true;
4185 while { if !__for_first_108 { i = add(&i, &Value::Int(1)); } __for_first_108 = false; is_less_than(&i, &get_array_length(&symbols)) } {
4186 append_to_array(&mut result, self.market(get_value(&symbols, &i)));
4187 }
4188 }
4189 return result;
4190
4191 Value::Null
4192}
4193
4194fn market_symbols(&self, optional_args: &[Value]) -> Value {
4196 let mut symbols = get_arg(optional_args, 0, Value::Null);
4197 let mut type_var = get_arg(optional_args, 1, Value::Null);
4198 let mut allowEmpty = get_arg(optional_args, 2, Value::Bool(true));
4199 let mut sameTypeOnly = get_arg(optional_args, 3, Value::Bool(false));
4200 let mut sameSubTypeOnly = get_arg(optional_args, 4, Value::Bool(false));
4201 if is_equal(&symbols, &Value::Null) {
4211 if !is_true(&allowEmpty) {
4212 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" empty list of symbols is not supported".to_string()))));
4213 }
4214 return symbols;
4215 }
4216 let mut symbolsLength: Value = get_array_length(&symbols);
4217 if is_equal(&symbolsLength, &Value::Int(0)) {
4218 if !is_true(&allowEmpty) {
4219 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" empty list of symbols is not supported".to_string()))));
4220 }
4221 return symbols;
4222 }
4223 let mut result: Value = Value::List(vec![]);
4224 let mut marketType: Value = Value::Null;
4225 let mut isLinearSubType: Value = Value::Null;
4226 {
4227 let mut i: Value = Value::Int(0);
4228 let mut __for_first_109: bool = true;
4229 while { if !__for_first_109 { i = add(&i, &Value::Int(1)); } __for_first_109 = false; is_less_than(&i, &get_array_length(&symbols)) } {
4230 let mut market: Value = self.market(get_value(&symbols, &i));
4231 if is_true(&sameTypeOnly) && is_true(&(!is_equal(&marketType, &Value::Null))) {
4232 if !is_equal(&get_value(&market, &Value::Str("type".to_string())), &marketType) {
4233 panic!("{}", crate::exchange_errors::bad_request(add(&add(&add(&add(&add(&self.id, &Value::Str(" symbols must be of the same type, either ".to_string())), &marketType), &Value::Str(" or ".to_string())), &get_value(&market, &Value::Str("type".to_string()))), &Value::Str(".".to_string()))));
4234 }
4235 }
4236 if is_true(&sameSubTypeOnly) && is_true(&(!is_equal(&isLinearSubType, &Value::Null))) {
4237 if !is_equal(&get_value(&market, &Value::Str("linear".to_string())), &isLinearSubType) {
4238 panic!("{}", crate::exchange_errors::bad_request(add(&self.id, &Value::Str(" symbols must be of the same subType, either linear or inverse.".to_string()))));
4239 }
4240 }
4241 if !is_equal(&type_var, &Value::Null) && !is_equal(&get_value(&market, &Value::Str("type".to_string())), &type_var) {
4242 panic!("{}", crate::exchange_errors::bad_request(add(&add(&add(&self.id, &Value::Str(" symbols must be of the same type ".to_string())), &type_var), &Value::Str(". If the type is incorrect you can change it in options or the params of the request".to_string()))));
4243 }
4244 marketType = get_value(&market, &Value::Str("type".to_string()));
4245 if !is_equal(&get_value(&market, &Value::Str("spot".to_string())), &Value::Bool(true)) {
4246 isLinearSubType = get_value(&market, &Value::Str("linear".to_string()));
4247 }
4248 let mut symbol: Value = self.safe_string_k(market.clone(), "symbol", &[get_value(&symbols, &i)]);
4249 append_to_array(&mut result, symbol.clone());
4250 }
4251 }
4252 return result;
4253
4254 Value::Null
4255}
4256
4257 fn market_codes(&self, optional_args: &[Value]) -> Value {
4258 let mut codes = get_arg(optional_args, 0, Value::Null);
4259 if is_equal(&codes, &Value::Null) {
4260 return codes;
4261 }
4262 let mut result: Value = Value::List(vec![]);
4263 {
4264 let mut i: Value = Value::Int(0);
4265 let mut __for_first_110: bool = true;
4266 while { if !__for_first_110 { i = add(&i, &Value::Int(1)); } __for_first_110 = false; is_less_than(&i, &get_array_length(&codes)) } {
4267 append_to_array(&mut result, self.common_currency_code(get_value(&codes, &i)));
4268 }
4269 }
4270 return result;
4271
4272 Value::Null
4273}
4274
4275 fn parse_order_book_bids_asks(&self, mut bidasks: Value, optional_args: &[Value]) -> Value {
4276 let mut priceKey = get_arg(optional_args, 0, Value::Int(0));
4277 let mut amountKey = get_arg(optional_args, 1, Value::Int(1));
4278 let mut countOrIdKey = get_arg(optional_args, 2, Value::Int(2));
4279 bidasks = self.to_array(bidasks.clone());
4280 let mut result: Value = Value::List(vec![]);
4281 {
4282 let mut i: Value = Value::Int(0);
4283 let mut __for_first_111: bool = true;
4284 while { if !__for_first_111 { i = add(&i, &Value::Int(1)); } __for_first_111 = false; is_less_than(&i, &get_array_length(&bidasks)) } {
4285 append_to_array(&mut result, self.parse_order_book_bid_ask(get_value(&bidasks, &i), &[priceKey.clone(), amountKey.clone(), countOrIdKey.clone()]));
4286 }
4287 }
4288 return result;
4289
4290 Value::Null
4291}
4292
4293 fn filter_by_key(&self, mut objects: Value, mut key: Value, optional_args: &[Value]) -> Value {
4294 let mut value = get_arg(optional_args, 0, Value::Null);
4295 if is_equal(&value, &Value::Null) {
4296 return objects;
4297 }
4298 let mut result: Value = Value::List(vec![]);
4299 {
4300 let mut i: Value = Value::Int(0);
4301 let mut __for_first_112: bool = true;
4302 while { if !__for_first_112 { i = add(&i, &Value::Int(1)); } __for_first_112 = false; is_less_than(&i, &get_array_length(&objects)) } {
4303 let mut objectValue: Value = self.safe_string(get_value(&objects, &i), key.clone(), &[]);
4304 if is_equal(&objectValue, &value) {
4305 append_to_array(&mut result, get_value(&objects, &i));
4306 }
4307 }
4308 }
4309 return result;
4310
4311 Value::Null
4312}
4313
4314 fn filter_by_symbol(&self, mut objects: Value, optional_args: &[Value]) -> Value {
4315 let mut symbol = get_arg(optional_args, 0, Value::Null);
4316 return self.filter_by_key(objects.clone(), Value::Str("symbol".to_string()), &[symbol.clone()]);
4317
4318 Value::Null
4319}
4320
4321 fn parse_ohlcv(&self, mut ohlcv: Value, optional_args: &[Value]) -> Value {
4322 { let __v = crate::exchange::DerivedExchange::parse_ohlcv(self, ohlcv.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
4324
4325 let mut market = get_arg(optional_args, 0, Value::Null);
4326 if is_true(&Value::Bool(is_array(&ohlcv))) {
4327 return Value::List(vec![self.safe_integer(ohlcv.clone(), Value::Int(0), &[]), self.safe_number(ohlcv.clone(), Value::Int(1), &[]), self.safe_number(ohlcv.clone(), Value::Int(2), &[]), self.safe_number(ohlcv.clone(), Value::Int(3), &[]), self.safe_number(ohlcv.clone(), Value::Int(4), &[]), self.safe_number(ohlcv.clone(), Value::Int(5), &[])]);
4328 }
4329 return ohlcv;
4330
4331 Value::Null
4332}
4333
4334 fn safe_network(&self, mut network: Value) -> Value {
4335 let mut withdrawEnabled: Value = self.safe_bool_k(network.clone(), "withdraw", &[]);
4336 let mut depositEnabled: Value = self.safe_bool_k(network.clone(), "deposit", &[]);
4337 let mut limits: Value = self.safe_dict_k(network.clone(), "limits", &[]);
4338 let mut withdraw: Value = self.safe_dict_k(limits.clone(), "withdraw", &[]);
4339 let mut deposit: Value = self.safe_dict_k(limits.clone(), "deposit", &[]);
4340 let mut isEnabled: Value = withdrawEnabled.clone();
4341 if is_equal(&withdrawEnabled, &Value::Bool(true)) {
4342 isEnabled = depositEnabled.clone();
4343 }
4344 return Value::Map({
4345 let mut m = indexmap::IndexMap::new();
4346 m.insert("info".to_string(), get_value(&network, &Value::Str("info".to_string())));
4347 m.insert("id".to_string(), self.safe_string_k(network.clone(), "id", &[]));
4348 m.insert("name".to_string(), self.safe_string_k(network.clone(), "name", &[]));
4349 m.insert("network".to_string(), self.safe_string_k(network.clone(), "network", &[]));
4350 m.insert("active".to_string(), self.safe_bool_k(network.clone(), "active", &[isEnabled.clone()]));
4351 m.insert("deposit".to_string(), depositEnabled.clone());
4352 m.insert("withdraw".to_string(), withdrawEnabled.clone());
4353 m.insert("fee".to_string(), self.safe_number_k(network.clone(), "fee", &[]));
4354 m.insert("precision".to_string(), self.safe_number_k(network.clone(), "precision", &[]));
4355 m.insert("limits".to_string(), Value::Map({
4356 let mut m = indexmap::IndexMap::new();
4357 m.insert("withdraw".to_string(), Value::Map({
4358 let mut m = indexmap::IndexMap::new();
4359 m.insert("min".to_string(), self.safe_number_k(withdraw.clone(), "min", &[]));
4360 m.insert("max".to_string(), self.safe_number_k(withdraw.clone(), "max", &[]));
4361 m
4362}));
4363 m.insert("deposit".to_string(), Value::Map({
4364 let mut m = indexmap::IndexMap::new();
4365 m.insert("min".to_string(), self.safe_number_k(deposit.clone(), "min", &[]));
4366 m.insert("max".to_string(), self.safe_number_k(deposit.clone(), "max", &[]));
4367 m
4368}));
4369 m
4370}));
4371 m
4372});
4373
4374 Value::Null
4375}
4376
4377 fn prioritized_network_aliases(&self, optional_args: &[Value]) -> Value {
4378 let mut networkCode = get_arg(optional_args, 0, Value::Null);
4379 let mut currencyCode = get_arg(optional_args, 1, Value::Null);
4380 let mut allowDefault = get_arg(optional_args, 2, Value::Bool(false));
4381 if is_equal(&networkCode, &Value::Null) {
4401 return Value::Null;
4402 }
4403 let mut replacements: Value = self.safe_dict_k(self.options.clone(), "defaultNetworkCodeReplacements", &[Value::Map({
4404 let mut m = indexmap::IndexMap::new();
4405 m
4406})]);
4407 let mut keys: Value = object_keys(&replacements);
4408 {
4409 let mut i: Value = Value::Int(0);
4410 let mut __for_first_113: bool = true;
4411 while { if !__for_first_113 { i = add(&i, &Value::Int(1)); } __for_first_113 = false; is_less_than(&i, &get_array_length(&keys)) } {
4412 let mut baseCoin: Value = get_value(&keys, &i);
4413 let mut baseCoin: Value = get_value(&keys, &i);
4414 let mut entry: Value = get_value(&replacements, &baseCoin);
4415 let mut entry: Value = get_value(&replacements, &baseCoin);
4416 let mut primary: Value = get_value(&entry, &Value::Str("primary".to_string()));
4417 let mut secondary: Value = get_value(&entry, &Value::Str("secondary".to_string()));
4418 if !is_equal(&networkCode, &primary) && !is_equal(&networkCode, &secondary) {
4419 continue;
4420 }
4421 let mut preferPrimary: Value = Value::Bool(false);
4423 if is_equal(¤cyCode, &baseCoin) {
4424 preferPrimary = Value::Bool(true); } else if !is_equal(¤cyCode, &Value::Null) {
4426 preferPrimary = Value::Bool(false); } else if is_true(&allowDefault) {
4428 preferPrimary = Value::Bool(is_equal(&get_value(&entry, &Value::Str("default".to_string())), &Value::Str("primary".to_string())));
4429 } else {
4430 preferPrimary = Value::Bool(is_equal(&networkCode, &primary)); }
4432 return ternary(is_true(&(preferPrimary)), Value::List(vec![primary.clone(), secondary.clone()]), Value::List(vec![secondary.clone(), primary.clone()]));
4433 }
4434 }
4435 return Value::List(vec![networkCode.clone(), networkCode.clone()]);
4436
4437 Value::Null
4438}
4439
4440 fn network_code_to_id(&self, mut networkCode: Value, optional_args: &[Value]) -> Value {
4441 let mut currencyCode = get_arg(optional_args, 0, Value::Null);
4442 if is_equal(&networkCode, &Value::Null) {
4452 return Value::Null;
4453 }
4454 let mut networkIdsByCodes: Value = self.safe_dict_k(self.options.clone(), "networks", &[Value::Map({
4455 let mut m = indexmap::IndexMap::new();
4456 m
4457})]);
4458 let mut chainPair: Value = self.prioritized_network_aliases(&[networkCode.clone(), currencyCode.clone(), Value::Bool(false)]);
4460 let mut preferredChain: Value = ternary(is_true(&(is_equal(&chainPair, &Value::Null))), networkCode.clone(), get_value(&chainPair, &Value::Int(0)));
4461 let mut alternativeChain: Value = ternary(is_true(&(is_equal(&chainPair, &Value::Null))), networkCode.clone(), get_value(&chainPair, &Value::Int(1)));
4462 let mut networkId: Value = self.safe_string2(networkIdsByCodes.clone(), preferredChain.clone(), alternativeChain.clone(), &[]);
4463 if !is_equal(&networkId, &Value::Null) {
4464 return networkId;
4465 }
4466 let mut currenciesToCheck: Value = Value::List(vec![]);
4468 if is_equal(¤cyCode, &Value::Null) {
4469 currenciesToCheck = object_keys(&self.currencies);
4470 } else {
4471 currenciesToCheck = Value::List(vec![self.safe_dict(self.currencies.clone(), currencyCode.clone(), &[])]);
4472 }
4473 {
4474 let mut i: Value = Value::Int(0);
4475 let mut __for_first_114: bool = true;
4476 while { if !__for_first_114 { i = add(&i, &Value::Int(1)); } __for_first_114 = false; is_less_than(&i, &get_array_length(¤ciesToCheck)) } {
4477 let mut networks: Value = self.safe_dict_k(get_value(¤ciesToCheck, &i), "networks", &[Value::Map({
4478 let mut m = indexmap::IndexMap::new();
4479 m
4480})]);
4481 if is_true(&Value::Bool(in_op(&networks, &networkCode))) {
4482 return self.safe_string_k(get_value(&networks, &networkCode), "id", &[]);
4483 }
4484 }
4485 }
4486 let mut oldCodes: Value = self.safe_dict_k(self.options.clone(), "backwardSupportedNetworkCodes", &[Value::Map({
4488 let mut m = indexmap::IndexMap::new();
4489 m
4490})]);
4491 if is_true(&Value::Bool(in_op(&oldCodes, &networkCode))) {
4492 return self.network_code_to_id(get_value(&oldCodes, &networkCode), &[currencyCode.clone()]);
4493 }
4494 return networkCode;
4495
4496 Value::Null
4497}
4498
4499 fn network_id_to_code(&self, optional_args: &[Value]) -> Value {
4500 let mut networkId = get_arg(optional_args, 0, Value::Null);
4501 let mut currencyCode = get_arg(optional_args, 1, Value::Null);
4502 if is_equal(&networkId, &Value::Null) {
4512 return Value::Null;
4513 }
4514 let mut networkCodesByIds: Value = self.safe_dict_k(self.options.clone(), "networksById", &[Value::Map({
4515 let mut m = indexmap::IndexMap::new();
4516 m
4517})]);
4518 let mut networkCode: Value = self.safe_string(networkCodesByIds.clone(), networkId.clone(), &[networkId.clone()]);
4519 let mut chainPair: Value = self.prioritized_network_aliases(&[networkCode.clone(), currencyCode.clone(), Value::Bool(true)]);
4520 if is_equal(&chainPair, &Value::Null) {
4521 return networkCode;
4522 }
4523 let mut preferredChain: Value = get_value(&chainPair, &Value::Int(0));
4524 let mut alternativeChain: Value = get_value(&chainPair, &Value::Int(1));
4525 if is_equal(¤cyCode, &Value::Null) {
4528 let mut networkIdsByCodes: Value = self.safe_dict_k(self.options.clone(), "networks", &[Value::Map({
4529 let mut m = indexmap::IndexMap::new();
4530 m
4531})]);
4532 if is_true(&(Value::Bool(in_op(&networkIdsByCodes, &preferredChain)))) && is_true(&(Value::Bool(in_op(&networkIdsByCodes, &alternativeChain)))) {
4533 return networkCode;
4534 }
4535 }
4536 return preferredChain;
4537
4538 Value::Null
4539}
4540
4541 fn handle_network_code_and_params(&self, mut params: Value) -> Value {
4542 let mut networkCodeInParams: Value = self.safe_string2(params.clone(), Value::Str("networkCode".to_string()), Value::Str("network".to_string()), &[]);
4543 if !is_equal(&networkCodeInParams, &Value::Null) {
4544 params = self.omit(params.clone(), Value::List(vec![Value::Str("networkCode".to_string()), Value::Str("network".to_string())]), &[]);
4545 }
4546 return Value::List(vec![networkCodeInParams.clone(), params.clone()]);
4547
4548 Value::Null
4549}
4550
4551 fn default_network_code(&self, mut currencyCode: Value) -> Value {
4552 let mut defaultNetworkCode: Value = Value::Null;
4553 let mut defaultNetworks: Value = self.safe_dict_k(self.options.clone(), "defaultNetworks", &[Value::Map({
4554 let mut m = indexmap::IndexMap::new();
4555 m
4556})]);
4557 if is_true(&Value::Bool(in_op(&defaultNetworks, ¤cyCode))) {
4558 defaultNetworkCode = get_value(&defaultNetworks, ¤cyCode);
4560 } else {
4561 let mut defaultNetwork: Value = self.safe_string_k(self.options.clone(), "defaultNetwork", &[]);
4563 if !is_equal(&defaultNetwork, &Value::Null) {
4564 defaultNetworkCode = defaultNetwork.clone();
4565 }
4566 }
4567 return defaultNetworkCode;
4568
4569 Value::Null
4570}
4571
4572 fn select_network_code_from_unified_networks(&self, mut currencyCode: Value, mut networkCode: Value, mut indexedNetworkEntries: Value) -> Value {
4573 return self.select_network_key_from_networks(currencyCode.clone(), networkCode.clone(), indexedNetworkEntries.clone(), &[Value::Bool(true)]);
4574
4575 Value::Null
4576}
4577
4578 fn select_network_id_from_raw_networks(&self, mut currencyCode: Value, mut networkCode: Value, mut indexedNetworkEntries: Value) -> Value {
4579 return self.select_network_key_from_networks(currencyCode.clone(), networkCode.clone(), indexedNetworkEntries.clone(), &[Value::Bool(false)]);
4580
4581 Value::Null
4582}
4583
4584 fn select_network_key_from_networks(&self, mut currencyCode: Value, mut networkCode: Value, mut indexedNetworkEntries: Value, optional_args: &[Value]) -> Value {
4585 let mut isIndexedByUnifiedNetworkCode = get_arg(optional_args, 0, Value::Bool(false));
4586 let mut chosenNetworkId: Value = Value::Null;
4588 let mut availableNetworkIds: Value = object_keys(&indexedNetworkEntries);
4589 let mut responseNetworksLength: Value = get_array_length(&availableNetworkIds);
4590 if !is_equal(&networkCode, &Value::Null) {
4591 if is_equal(&responseNetworksLength, &Value::Int(0)) {
4592 panic!("{}", crate::exchange_errors::not_supported(add(&add(&add(&add(&self.id, &Value::Str(" - ".to_string())), &networkCode), &Value::Str(" network did not return any result for ".to_string())), ¤cyCode)));
4593 } else {
4594 let mut networkIdOrCode: Value = ternary(is_true(&isIndexedByUnifiedNetworkCode), networkCode.clone(), self.network_code_to_id(networkCode.clone(), &[currencyCode.clone()]));
4596 if is_true(&Value::Bool(in_op(&indexedNetworkEntries, &networkIdOrCode))) {
4597 chosenNetworkId = networkIdOrCode.clone();
4598 } else {
4599 panic!("{}", crate::exchange_errors::not_supported(add(&add(&add(&add(&add(&add(&self.id, &Value::Str(" - ".to_string())), &networkIdOrCode), &Value::Str(" network was not found for ".to_string())), ¤cyCode), &Value::Str(", use one of ".to_string())), &join(&availableNetworkIds, &Value::Str(", ".to_string())))));
4600 }
4601 }
4602 } else {
4603 if is_equal(&responseNetworksLength, &Value::Int(0)) {
4604 panic!("{}", crate::exchange_errors::not_supported(add(&add(&self.id, &Value::Str(" - no networks were returned for ".to_string())), ¤cyCode)));
4605 } else {
4606 let mut defaultNetworkCode: Value = self.default_network_code(currencyCode.clone());
4608 let mut defaultNetworkId: Value = ternary(is_true(&isIndexedByUnifiedNetworkCode), defaultNetworkCode.clone(), self.network_code_to_id(defaultNetworkCode.clone(), &[currencyCode.clone()]));
4609 if is_equal(&defaultNetworkId, &Value::Null) {
4610 panic!("{}", crate::exchange_errors::exchange_error(add(&self.id, &Value::Str(" selectNetworkKeyFromNetworks() missing defaultNetworkId".to_string()))));
4611 }
4612 if is_true(&Value::Bool(in_op(&indexedNetworkEntries, &defaultNetworkId))) {
4613 return defaultNetworkId;
4614 }
4615 panic!("{}", crate::exchange_errors::not_supported(add(&add(&self.id, &Value::Str(" - can not determine the default network, please pass param[\"network\"] one from : ".to_string())), &join(&availableNetworkIds, &Value::Str(", ".to_string())))));
4616 }
4617 }
4618 return chosenNetworkId;
4619
4620 Value::Null
4621}
4622
4623 fn safe_number2(&self, mut dictionary: Value, mut key1: Value, mut key2: Value, optional_args: &[Value]) -> Value {
4624 let mut d = get_arg(optional_args, 0, Value::Null);
4625 let mut value: Value = self.safe_string2(dictionary.clone(), key1.clone(), key2.clone(), &[]);
4626 return self.parse_number(value.clone(), &[d.clone()]);
4627
4628 Value::Null
4629}
4630
4631 fn parse_order_book(&self, mut orderbook: Value, mut symbol: Value, optional_args: &[Value]) -> Value {
4632 { let __v = crate::exchange::DerivedExchange::parse_order_book(self, orderbook.clone(), symbol.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null), crate::runtime::get_arg(optional_args, 1, crate::Value::Null), crate::runtime::get_arg(optional_args, 2, crate::Value::Null), crate::runtime::get_arg(optional_args, 3, crate::Value::Null), crate::runtime::get_arg(optional_args, 4, crate::Value::Null), crate::runtime::get_arg(optional_args, 5, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
4634
4635 let mut timestamp = get_arg(optional_args, 0, Value::Null);
4636 let mut bidsKey = get_arg(optional_args, 1, Value::Str("bids".to_string()));
4637 let mut asksKey = get_arg(optional_args, 2, Value::Str("asks".to_string()));
4638 let mut priceKey = get_arg(optional_args, 3, Value::Int(0));
4639 let mut amountKey = get_arg(optional_args, 4, Value::Int(1));
4640 let mut countOrIdKey = get_arg(optional_args, 5, Value::Int(2));
4641 if is_equal(&orderbook, &Value::Null) {
4642 orderbook = Value::Map({
4643 let mut m = indexmap::IndexMap::new();
4644 m
4645 });
4646 }
4647 let mut bids: Value = self.parse_order_book_bids_asks(self.safe_value(orderbook.clone(), bidsKey.clone(), &[Value::List(vec![])]), &[priceKey.clone(), amountKey.clone(), countOrIdKey.clone()]);
4648 let mut asks: Value = self.parse_order_book_bids_asks(self.safe_value(orderbook.clone(), asksKey.clone(), &[Value::List(vec![])]), &[priceKey.clone(), amountKey.clone(), countOrIdKey.clone()]);
4649 return Value::Map({
4650 let mut m = indexmap::IndexMap::new();
4651 m.insert("symbol".to_string(), symbol.clone());
4652 m.insert("bids".to_string(), self.sort_by(bids.clone(), Value::Int(0), &[Value::Bool(true)]));
4653 m.insert("asks".to_string(), self.sort_by(asks.clone(), Value::Int(0), &[]));
4654 m.insert("timestamp".to_string(), timestamp.clone());
4655 m.insert("datetime".to_string(), self.iso8601(timestamp.clone()));
4656 m.insert("nonce".to_string(), Value::Null);
4657 m
4658});
4659
4660 Value::Null
4661}
4662
4663 fn parse_ohlc_vs(&self, mut ohlcvs: Value, optional_args: &[Value]) -> Value {
4664 let mut market = get_arg(optional_args, 0, Value::Null);
4665 let mut timeframe = get_arg(optional_args, 1, Value::Str("1m".to_string()));
4666 let mut since = get_arg(optional_args, 2, Value::Null);
4667 let mut limit = get_arg(optional_args, 3, Value::Null);
4668 let mut tail = get_arg(optional_args, 4, Value::Bool(false));
4669 if is_equal(&ohlcvs, &Value::Null) {
4670 return Value::List(vec![]);
4671 }
4672 let mut results: Value = Value::List(vec![]);
4673 {
4674 let mut i: Value = Value::Int(0);
4675 let mut __for_first_115: bool = true;
4676 while { if !__for_first_115 { i = add(&i, &Value::Int(1)); } __for_first_115 = false; is_less_than(&i, &get_array_length(&ohlcvs)) } {
4677 append_to_array(&mut results, <Self as crate::exchange_generated::ExchangeBase>::parse_ohlcv(self, get_value(&ohlcvs, &i), &[market.clone()]));
4678 }
4679 }
4680 let mut sorted: Value = self.sort_by(results.clone(), Value::Int(0), &[]);
4681 return self.filter_by_since_limit(sorted.clone(), &[since.clone(), limit.clone(), Value::Int(0), tail.clone()]);
4682
4683 Value::Null
4684}
4685
4686 fn parse_leverage_tiers(&self, mut response: Value, optional_args: &[Value]) -> Value {
4687 let mut symbols = get_arg(optional_args, 0, Value::Null);
4688 let mut marketIdKey = get_arg(optional_args, 1, Value::Null);
4689 symbols = self.market_symbols(&[symbols.clone()]);
4691 let mut tiers: Value = Value::Map({
4692 let mut m = indexmap::IndexMap::new();
4693 m
4694 });
4695 let mut symbolsLength: Value = Value::Int(0);
4696 if !is_equal(&symbols, &Value::Null) {
4697 symbolsLength = get_array_length(&symbols);
4698 }
4699 let mut noSymbols: bool = is_true(&(is_equal(&symbols, &Value::Null))) || is_true(&(is_equal(&symbolsLength, &Value::Int(0))));
4700 if is_true(&Value::Bool(is_array(&response))) {
4701 {
4702 let mut i: Value = Value::Int(0);
4703 let mut __for_first_116: bool = true;
4704 while { if !__for_first_116 { i = add(&i, &Value::Int(1)); } __for_first_116 = false; is_less_than(&i, &get_array_length(&response)) } {
4705 let mut item: Value = get_value(&response, &i);
4706 let mut item: Value = get_value(&response, &i);
4707 let mut id: Value = ternary(is_true(&(is_equal(&marketIdKey, &Value::Null))), Value::Null, self.safe_string(item.clone(), marketIdKey.clone(), &[]));
4708 let mut market: Value = self.safe_market(&[id.clone(), Value::Null, Value::Null, Value::Str("swap".to_string())]);
4709 let mut symbol: Value = get_value(&market, &Value::Str("symbol".to_string()));
4710 let mut contract: Value = self.safe_bool_k(market.clone(), "contract", &[Value::Bool(false)]);
4711 if is_true(&(is_equal(&contract, &Value::Bool(true)))) && is_true(&(is_true(&noSymbols) || is_true(&(is_true(&(!is_equal(&symbols, &Value::Null))) && is_true(&self.in_array(symbol.clone(), symbols.clone())))))) {
4712 add_element_to_object(&mut tiers, &symbol, <Self as crate::exchange_generated::ExchangeBase>::parse_market_leverage_tiers(self, item.clone(), &[market.clone()]));
4713 }
4714 }
4715 }
4716 } else {
4717 let mut keys: Value = object_keys(&response);
4718 {
4719 let mut i: Value = Value::Int(0);
4720 let mut __for_first_117: bool = true;
4721 while { if !__for_first_117 { i = add(&i, &Value::Int(1)); } __for_first_117 = false; is_less_than(&i, &get_array_length(&keys)) } {
4722 let mut marketId: Value = get_value(&keys, &i);
4723 let mut marketId: Value = get_value(&keys, &i);
4724 let mut item: Value = get_value(&response, &marketId);
4725 let mut item: Value = get_value(&response, &marketId);
4726 let mut market: Value = self.safe_market(&[marketId.clone(), Value::Null, Value::Null, Value::Str("swap".to_string())]);
4727 let mut symbol: Value = get_value(&market, &Value::Str("symbol".to_string()));
4728 let mut contract: Value = self.safe_bool_k(market.clone(), "contract", &[Value::Bool(false)]);
4729 if is_true(&(is_equal(&contract, &Value::Bool(true)))) && is_true(&(is_true(&noSymbols) || is_true(&(is_true(&(!is_equal(&symbols, &Value::Null))) && is_true(&self.in_array(symbol.clone(), symbols.clone())))))) {
4730 add_element_to_object(&mut tiers, &symbol, <Self as crate::exchange_generated::ExchangeBase>::parse_market_leverage_tiers(self, item.clone(), &[market.clone()]));
4731 }
4732 }
4733 }
4734 }
4735 return tiers;
4736
4737 Value::Null
4738}
4739
4740 fn load_trading_limits(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
4741 let mut symbols = get_arg(optional_args, 0, Value::Null);
4742 let mut reload = get_arg(optional_args, 1, Value::Bool(false));
4743 let mut params = get_arg(optional_args, 2, Value::Map({
4744 let mut m = indexmap::IndexMap::new();
4745 m
4746}));
4747 if !is_equal(&get_value(&self.has, &Value::Str("fetchTradingLimits".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchTradingLimits".to_string())), &Value::Bool(false)) {
4748 if is_true(&reload) || !is_true(&(Value::Bool(in_op(&self.options, &Value::Str("limitsLoaded".to_string()))))) {
4749 let mut response: Value = self.fetch_trading_limits(&[symbols.clone()]).await;
4750 let mut symbolsArray: Value = self.require_value(symbols.clone(), &[Value::Str("loadTradingLimits() requires a symbols argument".to_string())]);
4751 let mut markets: Value = self.markets.clone();
4752 if is_equal(&markets, &Value::Null) {
4753 panic!("{}", crate::exchange_errors::exchange_error(add(&self.id, &Value::Str(" markets not loaded".to_string()))));
4754 }
4755 {
4756 let mut i: Value = Value::Int(0);
4757 let mut __for_first_118: bool = true;
4758 while { if !__for_first_118 { i = add(&i, &Value::Int(1)); } __for_first_118 = false; is_less_than(&i, &get_array_length(&symbolsArray)) } {
4759 let mut symbol: Value = get_value(&symbolsArray, &i);
4760 let mut symbol: Value = get_value(&symbolsArray, &i);
4761 { let __be_tmp = self.deep_extend(get_value(&markets, &symbol), &[get_value(&response, &symbol)]); add_element_to_object(&mut markets, &symbol, __be_tmp); };
4762 }
4763 }
4764 { let __be_tmp = self.milliseconds(); add_element_to_object(&mut self.options, &Value::Str("limitsLoaded".to_string()), __be_tmp); };
4765 }
4766 }
4767 return self.markets.clone();
4768
4769 Value::Null
4770} }
4771
4772 fn safe_position(&self, mut position: Value) -> Value {
4773 let mut unrealizedPnlString: Value = self.safe_string_k(position.clone(), "unrealizedPnl", &[]);
4775 let mut initialMarginString: Value = self.safe_string_k(position.clone(), "initialMargin", &[]);
4776 let mut percentage: Value = self.safe_value_k(position.clone(), "percentage", &[]);
4780 if is_true(&(is_equal(&percentage, &Value::Null))) && is_true(&(!is_equal(&unrealizedPnlString, &Value::Null))) && is_true(&(!is_equal(&initialMarginString, &Value::Null))) {
4781 let mut percentageString: Value = crate::precise::Precise::stringMul(&crate::precise::Precise::stringDivPrec(&unrealizedPnlString, &initialMarginString, &Value::Int(4)), &Value::Str("100".to_string()));
4783 add_element_to_object(&mut position, &Value::Str("percentage".to_string()), self.parse_number(percentageString.clone(), &[]));
4784 }
4785 let mut contractSize: Value = self.safe_number_k(position.clone(), "contractSize", &[]);
4787 let mut symbol: Value = self.safe_string_k(position.clone(), "symbol", &[]);
4788 let mut market: Value = Value::Null;
4789 if !is_equal(&symbol, &Value::Null) {
4790 market = self.safe_value(self.markets.clone(), symbol.clone(), &[]);
4791 }
4792 if is_equal(&contractSize, &Value::Null) && !is_equal(&market, &Value::Null) {
4793 contractSize = self.safe_number_k(market.clone(), "contractSize", &[]);
4794 add_element_to_object(&mut position, &Value::Str("contractSize".to_string()), contractSize.clone());
4795 }
4796 return position;
4797
4798 Value::Null
4799}
4800
4801 fn parse_positions(&self, mut positions: Value, optional_args: &[Value]) -> Value {
4802 let mut symbols = get_arg(optional_args, 0, Value::Null);
4803 let mut params = get_arg(optional_args, 1, Value::Map({
4804 let mut m = indexmap::IndexMap::new();
4805 m
4806}));
4807 symbols = self.market_symbols(&[symbols.clone()]);
4808 let mut positionsArray: Value = self.to_array(positions.clone());
4809 let mut result: Value = Value::List(vec![]);
4810 {
4811 let mut i: Value = Value::Int(0);
4812 let mut __for_first_119: bool = true;
4813 while { if !__for_first_119 { i = add(&i, &Value::Int(1)); } __for_first_119 = false; is_less_than(&i, &get_array_length(&positionsArray)) } {
4814 let mut position: Value = self.extend(<Self as crate::exchange_generated::ExchangeBase>::parse_position(self, get_value(&positionsArray, &i), &[]), &[params.clone()]);
4815 append_to_array(&mut result, position.clone());
4816 }
4817 }
4818 return self.filter_by_array_positions(result.clone(), Value::Str("symbol".to_string()), &[symbols.clone(), Value::Bool(false)]);
4819
4820 Value::Null
4821}
4822
4823 fn parse_adl_rank(&self, mut info: Value, optional_args: &[Value]) -> Value {
4824 { let __v = crate::exchange::DerivedExchange::parse_adl_rank(self, info.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
4826
4827 let mut market = get_arg(optional_args, 0, Value::Null);
4828 if is_equal(&info, &Value::Null) {
4829 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseADLRank() is not supported yet".to_string()))));
4830 }
4831 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseADLRank() is not supported yet".to_string()))));
4832
4833 Value::Null
4834}
4835
4836 fn parse_adl_ranks(&self, mut ranks: Value, optional_args: &[Value]) -> Value {
4837 let mut symbols = get_arg(optional_args, 0, Value::Null);
4838 let mut params = get_arg(optional_args, 1, Value::Map({
4839 let mut m = indexmap::IndexMap::new();
4840 m
4841}));
4842 symbols = self.market_symbols(&[symbols.clone()]);
4843 let mut ranksArray: Value = self.to_array(ranks.clone());
4844 let mut result: Value = Value::List(vec![]);
4845 {
4846 let mut i: Value = Value::Int(0);
4847 let mut __for_first_120: bool = true;
4848 while { if !__for_first_120 { i = add(&i, &Value::Int(1)); } __for_first_120 = false; is_less_than(&i, &get_array_length(&ranksArray)) } {
4849 let mut rank: Value = self.extend(<Self as crate::exchange_generated::ExchangeBase>::parse_adl_rank(self, get_value(&ranksArray, &i), &[]), &[params.clone()]);
4850 append_to_array(&mut result, rank.clone());
4851 }
4852 }
4853 return self.filter_by_array_positions(result.clone(), Value::Str("symbol".to_string()), &[symbols.clone(), Value::Bool(false)]);
4854
4855 Value::Null
4856}
4857
4858 fn parse_accounts(&self, mut accounts: Value, optional_args: &[Value]) -> Value {
4859 let mut params = get_arg(optional_args, 0, Value::Map({
4860 let mut m = indexmap::IndexMap::new();
4861 m
4862}));
4863 let mut accountsArray: Value = self.to_array(accounts.clone());
4864 let mut result: Value = Value::List(vec![]);
4865 {
4866 let mut i: Value = Value::Int(0);
4867 let mut __for_first_121: bool = true;
4868 while { if !__for_first_121 { i = add(&i, &Value::Int(1)); } __for_first_121 = false; is_less_than(&i, &get_array_length(&accountsArray)) } {
4869 let mut account: Value = self.extend(<Self as crate::exchange_generated::ExchangeBase>::parse_account(self, get_value(&accountsArray, &i)), &[params.clone()]);
4870 append_to_array(&mut result, account.clone());
4871 }
4872 }
4873 return result;
4874
4875 Value::Null
4876}
4877
4878 fn parse_trades_helper(&self, mut isWs: Value, mut trades: Value, optional_args: &[Value]) -> Value {
4879 let mut market = get_arg(optional_args, 0, Value::Null);
4880 let mut since = get_arg(optional_args, 1, Value::Null);
4881 let mut limit = get_arg(optional_args, 2, Value::Null);
4882 let mut params = get_arg(optional_args, 3, Value::Map({
4883 let mut m = indexmap::IndexMap::new();
4884 m
4885}));
4886 let mut tradesArray: Value = self.to_array(trades.clone());
4887 let mut result: Value = Value::List(vec![]);
4888 {
4889 let mut i: Value = Value::Int(0);
4890 let mut __for_first_122: bool = true;
4891 while { if !__for_first_122 { i = add(&i, &Value::Int(1)); } __for_first_122 = false; is_less_than(&i, &get_array_length(&tradesArray)) } {
4892 let mut parsed: Value = Value::Null;
4893 if is_true(&isWs) {
4894 parsed = self.parse_ws_trade(get_value(&tradesArray, &i), &[market.clone()]);
4895 } else {
4896 parsed = <Self as crate::exchange_generated::ExchangeBase>::parse_trade(self, get_value(&tradesArray, &i), &[market.clone()]);
4897 }
4898 let mut trade: Value = self.extend(parsed.clone(), &[params.clone()]);
4899 append_to_array(&mut result, trade.clone());
4900 }
4901 }
4902 result = self.sort_by2(result.clone(), Value::Str("timestamp".to_string()), Value::Str("id".to_string()), &[]);
4903 let mut symbol: Value = self.safe_string_k(market.clone(), "symbol", &[]);
4904 return self.filter_by_symbol_since_limit(result.clone(), &[symbol.clone(), since.clone(), limit.clone()]);
4905
4906 Value::Null
4907}
4908
4909 fn parse_trades(&self, mut trades: Value, optional_args: &[Value]) -> Value {
4910 let mut market = get_arg(optional_args, 0, Value::Null);
4911 let mut since = get_arg(optional_args, 1, Value::Null);
4912 let mut limit = get_arg(optional_args, 2, Value::Null);
4913 let mut params = get_arg(optional_args, 3, Value::Map({
4914 let mut m = indexmap::IndexMap::new();
4915 m
4916}));
4917 return self.parse_trades_helper(Value::Bool(false), trades.clone(), &[market.clone(), since.clone(), limit.clone(), params.clone()]);
4918
4919 Value::Null
4920}
4921
4922 fn parse_ws_trades(&self, mut trades: Value, optional_args: &[Value]) -> Value {
4923 let mut market = get_arg(optional_args, 0, Value::Null);
4924 let mut since = get_arg(optional_args, 1, Value::Null);
4925 let mut limit = get_arg(optional_args, 2, Value::Null);
4926 let mut params = get_arg(optional_args, 3, Value::Map({
4927 let mut m = indexmap::IndexMap::new();
4928 m
4929}));
4930 return self.parse_trades_helper(Value::Bool(true), trades.clone(), &[market.clone(), since.clone(), limit.clone(), params.clone()]);
4931
4932 Value::Null
4933}
4934
4935 fn parse_transactions(&self, mut transactions: Value, optional_args: &[Value]) -> Value {
4936 let mut currency = get_arg(optional_args, 0, Value::Null);
4937 let mut since = get_arg(optional_args, 1, Value::Null);
4938 let mut limit = get_arg(optional_args, 2, Value::Null);
4939 let mut params = get_arg(optional_args, 3, Value::Map({
4940 let mut m = indexmap::IndexMap::new();
4941 m
4942}));
4943 let mut transactionsArray: Value = self.to_array(transactions.clone());
4944 let mut result: Value = Value::List(vec![]);
4945 {
4946 let mut i: Value = Value::Int(0);
4947 let mut __for_first_123: bool = true;
4948 while { if !__for_first_123 { i = add(&i, &Value::Int(1)); } __for_first_123 = false; is_less_than(&i, &get_array_length(&transactionsArray)) } {
4949 let mut transaction: Value = self.extend(<Self as crate::exchange_generated::ExchangeBase>::parse_transaction(self, get_value(&transactionsArray, &i), &[currency.clone()]), &[params.clone()]);
4950 append_to_array(&mut result, transaction.clone());
4951 }
4952 }
4953 result = self.sort_by(result.clone(), Value::Str("timestamp".to_string()), &[]);
4954 let mut code: Value = ternary(is_true(&(!is_equal(¤cy, &Value::Null))), get_value(¤cy, &Value::Str("code".to_string())), Value::Null);
4955 return self.filter_by_currency_since_limit(result.clone(), &[code.clone(), since.clone(), limit.clone()]);
4956
4957 Value::Null
4958}
4959
4960 fn parse_transfers(&self, mut transfers: Value, optional_args: &[Value]) -> Value {
4961 let mut currency = get_arg(optional_args, 0, Value::Null);
4962 let mut since = get_arg(optional_args, 1, Value::Null);
4963 let mut limit = get_arg(optional_args, 2, Value::Null);
4964 let mut params = get_arg(optional_args, 3, Value::Map({
4965 let mut m = indexmap::IndexMap::new();
4966 m
4967}));
4968 let mut transfersArray: Value = self.to_array(transfers.clone());
4969 let mut result: Value = Value::List(vec![]);
4970 {
4971 let mut i: Value = Value::Int(0);
4972 let mut __for_first_124: bool = true;
4973 while { if !__for_first_124 { i = add(&i, &Value::Int(1)); } __for_first_124 = false; is_less_than(&i, &get_array_length(&transfersArray)) } {
4974 let mut transfer: Value = self.extend(<Self as crate::exchange_generated::ExchangeBase>::parse_transfer(self, get_value(&transfersArray, &i), &[currency.clone()]), &[params.clone()]);
4975 append_to_array(&mut result, transfer.clone());
4976 }
4977 }
4978 result = self.sort_by(result.clone(), Value::Str("timestamp".to_string()), &[]);
4979 let mut code: Value = ternary(is_true(&(!is_equal(¤cy, &Value::Null))), get_value(¤cy, &Value::Str("code".to_string())), Value::Null);
4980 return self.filter_by_currency_since_limit(result.clone(), &[code.clone(), since.clone(), limit.clone()]);
4981
4982 Value::Null
4983}
4984
4985 fn parse_ledger(&self, mut data: Value, optional_args: &[Value]) -> Value {
4986 let mut currency = get_arg(optional_args, 0, Value::Null);
4987 let mut since = get_arg(optional_args, 1, Value::Null);
4988 let mut limit = get_arg(optional_args, 2, Value::Null);
4989 let mut params = get_arg(optional_args, 3, Value::Map({
4990 let mut m = indexmap::IndexMap::new();
4991 m
4992}));
4993 let mut result: Value = Value::List(vec![]);
4994 let mut arrayData: Value = self.to_array(data.clone());
4995 {
4996 let mut i: Value = Value::Int(0);
4997 let mut __for_first_126: bool = true;
4998 while { if !__for_first_126 { i = add(&i, &Value::Int(1)); } __for_first_126 = false; is_less_than(&i, &get_array_length(&arrayData)) } {
4999 let mut itemOrItems: Value = <Self as crate::exchange_generated::ExchangeBase>::parse_ledger_entry(self, get_value(&arrayData, &i), &[currency.clone()]);
5000 if is_true(&Value::Bool(is_array(&itemOrItems))) {
5001 {
5002 let mut j: Value = Value::Int(0);
5003 let mut __for_first_125: bool = true;
5004 while { if !__for_first_125 { j = add(&j, &Value::Int(1)); } __for_first_125 = false; is_less_than(&j, &get_array_length(&itemOrItems)) } {
5005 append_to_array(&mut result, self.extend(get_value(&itemOrItems, &j), &[params.clone()]));
5006 }
5007 }
5008 } else {
5009 append_to_array(&mut result, self.extend(itemOrItems.clone(), &[params.clone()]));
5010 }
5011 }
5012 }
5013 result = self.sort_by(result.clone(), Value::Str("timestamp".to_string()), &[]);
5014 let mut code: Value = ternary(is_true(&(!is_equal(¤cy, &Value::Null))), get_value(¤cy, &Value::Str("code".to_string())), Value::Null);
5015 return self.filter_by_currency_since_limit(result.clone(), &[code.clone(), since.clone(), limit.clone()]);
5016
5017 Value::Null
5018}
5019
5020 fn nonce(&self) -> Value {
5021 { let __v = crate::exchange::DerivedExchange::nonce(self, ); if !matches!(__v, crate::Value::Null) { return __v; } }
5023
5024 return self.seconds();
5025
5026 Value::Null
5027}
5028
5029 fn set_headers(&self, mut headers: Value) -> Value {
5030 return headers;
5031
5032 Value::Null
5033}
5034
5035 fn currency_id(&self, mut code: Value) -> Value {
5036 if is_equal(&code, &Value::Null) {
5037 return code;
5038 }
5039 let mut currency: Value = self.safe_dict(self.currencies.clone(), code.clone(), &[]);
5040 if is_equal(¤cy, &Value::Null) {
5041 currency = self.safe_currency(code.clone(), &[]);
5042 }
5043 if !is_equal(¤cy, &Value::Null) {
5044 return get_value(¤cy, &Value::Str("id".to_string()));
5045 }
5046 return code;
5047
5048 Value::Null
5049}
5050
5051 fn market_id(&self, mut symbol: Value) -> Value {
5052 let mut market: Value = self.market(symbol.clone());
5053 if !is_equal(&market, &Value::Null) {
5054 return get_value(&market, &Value::Str("id".to_string()));
5055 }
5056 return symbol;
5057
5058 Value::Null
5059}
5060
5061 fn symbol(&self, mut symbol: Value) -> Value {
5062 if is_equal(&symbol, &Value::Null) {
5063 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" symbol() requires a symbol argument".to_string()))));
5064 }
5065 let mut market: Value = self.market(symbol.clone());
5066 return self.safe_string_k(market.clone(), "symbol", &[symbol.clone()]);
5067
5068 Value::Null
5069}
5070
5071fn handle_param_string(&self, mut params: Value, mut paramName: Value, optional_args: &[Value]) -> Value {
5074 let mut defaultValue = get_arg(optional_args, 0, Value::Null);
5075 let mut value: Value = self.safe_string(params.clone(), paramName.clone(), &[defaultValue.clone()]);
5076 if !is_equal(&value, &Value::Null) {
5077 params = self.omit(params.clone(), paramName.clone(), &[]);
5078 }
5079 return Value::List(vec![value.clone(), params.clone()]);
5080
5081 Value::Null
5082}
5083
5084fn handle_param_string2(&self, mut params: Value, mut paramName1: Value, mut paramName2: Value, optional_args: &[Value]) -> Value {
5087 let mut defaultValue = get_arg(optional_args, 0, Value::Null);
5088 let mut value: Value = self.safe_string2(params.clone(), paramName1.clone(), paramName2.clone(), &[defaultValue.clone()]);
5089 if !is_equal(&value, &Value::Null) {
5090 params = self.omit(params.clone(), Value::List(vec![paramName1.clone(), paramName2.clone()]), &[]);
5091 }
5092 return Value::List(vec![value.clone(), params.clone()]);
5093
5094 Value::Null
5095}
5096
5097 fn handle_param_integer(&self, mut params: Value, mut paramName: Value, optional_args: &[Value]) -> Value {
5098 let mut defaultValue = get_arg(optional_args, 0, Value::Null);
5099 let mut value: Value = self.safe_integer(params.clone(), paramName.clone(), &[defaultValue.clone()]);
5100 if !is_equal(&value, &Value::Null) {
5101 params = self.omit(params.clone(), paramName.clone(), &[]);
5102 }
5103 return Value::List(vec![value.clone(), params.clone()]);
5104
5105 Value::Null
5106}
5107
5108 fn handle_param_integer2(&self, mut params: Value, mut paramName1: Value, mut paramName2: Value, optional_args: &[Value]) -> Value {
5109 let mut defaultValue = get_arg(optional_args, 0, Value::Null);
5110 let mut value: Value = self.safe_integer2(params.clone(), paramName1.clone(), paramName2.clone(), &[defaultValue.clone()]);
5111 if !is_equal(&value, &Value::Null) {
5112 params = self.omit(params.clone(), Value::List(vec![paramName1.clone(), paramName2.clone()]), &[]);
5113 }
5114 return Value::List(vec![value.clone(), params.clone()]);
5115
5116 Value::Null
5117}
5118
5119 fn handle_param_bool(&self, mut params: Value, mut paramName: Value, optional_args: &[Value]) -> Value {
5120 let mut defaultValue = get_arg(optional_args, 0, Value::Null);
5121 let mut value: Value = self.safe_bool(params.clone(), paramName.clone(), &[defaultValue.clone()]);
5122 if !is_equal(&value, &Value::Null) {
5123 params = self.omit(params.clone(), paramName.clone(), &[]);
5124 }
5125 return Value::List(vec![value.clone(), params.clone()]);
5126
5127 Value::Null
5128}
5129
5130 fn handle_param_bool2(&self, mut params: Value, mut paramName1: Value, mut paramName2: Value, optional_args: &[Value]) -> Value {
5131 let mut defaultValue = get_arg(optional_args, 0, Value::Null);
5132 let mut value: Value = self.safe_bool2(params.clone(), paramName1.clone(), paramName2.clone(), &[defaultValue.clone()]);
5133 if !is_equal(&value, &Value::Null) {
5134 params = self.omit(params.clone(), Value::List(vec![paramName1.clone(), paramName2.clone()]), &[]);
5135 }
5136 return Value::List(vec![value.clone(), params.clone()]);
5137
5138 Value::Null
5139}
5140
5141fn handle_request_network(&self, mut params: Value, mut request: Value, mut exchangeSpecificKey: Value, optional_args: &[Value]) -> Value {
5150 let mut currencyCode = get_arg(optional_args, 0, Value::Null);
5151 let mut isRequired = get_arg(optional_args, 1, Value::Bool(false));
5152 let mut networkCode: Value = Value::Null;
5153 { let __destr_tmp = self.handle_network_code_and_params(params.clone()); networkCode = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
5154 if !is_equal(&networkCode, &Value::Null) {
5155 add_element_to_object(&mut request, &exchangeSpecificKey, self.network_code_to_id(networkCode.clone(), &[currencyCode.clone()]));
5156 } else if is_true(&isRequired) {
5157 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" - \"network\" param is required for this request".to_string()))));
5158 }
5159 return Value::List(vec![request.clone(), params.clone()]);
5160
5161 Value::Null
5162}
5163
5164 fn resolve_path(&self, mut path: Value, mut params: Value) -> Value {
5165 return Value::List(vec![self.implode_params(path.clone(), params.clone()), self.omit(params.clone(), self.extract_params(path.clone()), &[])]);
5166
5167 Value::Null
5168}
5169
5170 fn get_list_from_object_values(&self, mut objects: Value, mut key: Value) -> Value {
5171 let mut newArray: Value = objects.clone();
5172 if !is_true(&Value::Bool(is_array(&objects))) {
5173 newArray = self.to_array(objects.clone());
5174 }
5175 let mut results: Value = Value::List(vec![]);
5176 {
5177 let mut i: Value = Value::Int(0);
5178 let mut __for_first_127: bool = true;
5179 while { if !__for_first_127 { i = add(&i, &Value::Int(1)); } __for_first_127 = false; is_less_than(&i, &get_array_length(&newArray)) } {
5180 append_to_array(&mut results, get_value(&get_value(&newArray, &i), &key));
5181 }
5182 }
5183 return results;
5184
5185 Value::Null
5186}
5187
5188 fn get_symbols_for_market_type(&self, optional_args: &[Value]) -> Value {
5189 let mut marketType = get_arg(optional_args, 0, Value::Null);
5190 let mut subType = get_arg(optional_args, 1, Value::Null);
5191 let mut symbolWithActiveStatus = get_arg(optional_args, 2, Value::Bool(true));
5192 let mut symbolWithUnknownStatus = get_arg(optional_args, 3, Value::Bool(true));
5193 let mut filteredMarkets: Value = self.markets.clone();
5194 if !is_equal(&marketType, &Value::Null) {
5195 filteredMarkets = self.filter_by(filteredMarkets.clone(), Value::Str("type".to_string()), marketType.clone(), &[]);
5196 }
5197 if !is_equal(&subType, &Value::Null) {
5198 self.check_required_argument(Value::Str("getSymbolsForMarketType".to_string()), subType.clone(), Value::Str("subType".to_string()), &[Value::List(vec![Value::Str("linear".to_string()), Value::Str("inverse".to_string()), Value::Str("quanto".to_string())])]);
5199 filteredMarkets = self.filter_by(filteredMarkets.clone(), Value::Str("subType".to_string()), subType.clone(), &[]);
5200 }
5201 let mut activeStatuses: Value = Value::List(vec![]);
5202 if is_true(&symbolWithActiveStatus) {
5203 append_to_array(&mut activeStatuses, Value::Bool(true));
5204 }
5205 if is_true(&symbolWithUnknownStatus) {
5206 append_to_array(&mut activeStatuses, Value::Null);
5207 }
5208 filteredMarkets = self.filter_by_array(filteredMarkets.clone(), Value::Str("active".to_string()), &[activeStatuses.clone(), Value::Bool(false)]);
5209 return self.get_list_from_object_values(filteredMarkets.clone(), Value::Str("symbol".to_string()));
5210
5211 Value::Null
5212}
5213
5214 fn filter_by_array(&self, mut objects: Value, mut key: Value, optional_args: &[Value]) -> Value {
5215 let mut values = get_arg(optional_args, 0, Value::Null);
5216 let mut indexed = get_arg(optional_args, 1, Value::Bool(true));
5217 objects = self.to_array(objects.clone());
5218 if is_true(&(is_equal(&values, &Value::Null))) || is_true(&(is_equal(&values, &Value::Null))) || is_true(&(is_equal(&values, &Value::Bool(false)))) || is_true(&(is_equal(&values, &Value::Int(0)))) || is_true(&(is_equal(&values, &Value::Str("".to_string())))) {
5220 if is_true(&indexed) {
5222 return self.index_by(objects.clone(), key.clone());
5223 } else {
5224 return objects;
5225 }
5226 }
5227 let mut results: Value = Value::List(vec![]);
5228 {
5229 let mut i: Value = Value::Int(0);
5230 let mut __for_first_128: bool = true;
5231 while { if !__for_first_128 { i = add(&i, &Value::Int(1)); } __for_first_128 = false; is_less_than(&i, &get_array_length(&objects)) } {
5232 if is_true(&self.in_array(get_value(&get_value(&objects, &i), &key), values.clone())) {
5233 append_to_array(&mut results, get_value(&objects, &i));
5234 }
5235 }
5236 }
5237 if is_true(&indexed) {
5239 return self.index_by(results.clone(), key.clone());
5240 }
5241 return results;
5242
5243 Value::Null
5244}
5245
5246 fn filter_out_by_array(&self, mut objects: Value, mut key: Value, optional_args: &[Value]) -> Value {
5247 let mut values = get_arg(optional_args, 0, Value::Null);
5248 let mut indexed = get_arg(optional_args, 1, Value::Bool(true));
5249 objects = self.to_array(objects.clone());
5250 if is_true(&(is_equal(&values, &Value::Null))) || is_true(&(is_equal(&values, &Value::Null))) || is_true(&(is_equal(&values, &Value::Bool(false)))) || is_true(&(is_equal(&values, &Value::Int(0)))) || is_true(&(is_equal(&values, &Value::Str("".to_string())))) {
5252 if is_true(&indexed) {
5254 return self.index_by(objects.clone(), key.clone());
5255 } else {
5256 return objects;
5257 }
5258 }
5259 let mut results: Value = Value::List(vec![]);
5260 {
5261 let mut i: Value = Value::Int(0);
5262 let mut __for_first_129: bool = true;
5263 while { if !__for_first_129 { i = add(&i, &Value::Int(1)); } __for_first_129 = false; is_less_than(&i, &get_array_length(&objects)) } {
5264 if !is_true(&self.in_array(get_value(&get_value(&objects, &i), &key), values.clone())) {
5265 append_to_array(&mut results, get_value(&objects, &i));
5266 }
5267 }
5268 }
5269 if is_true(&indexed) {
5271 return self.index_by(results.clone(), key.clone());
5272 }
5273 return results;
5274
5275 Value::Null
5276}
5277
5278 fn fetch2(&mut self, mut path: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
5279 let mut api = get_arg(optional_args, 0, Value::Str("public".to_string()));
5280 let mut method = get_arg(optional_args, 1, Value::Str("GET".to_string()));
5281 let mut params = get_arg(optional_args, 2, Value::Map({
5282 let mut m = indexmap::IndexMap::new();
5283 m
5284}));
5285 let mut headers = get_arg(optional_args, 3, Value::Null);
5286 let mut body = get_arg(optional_args, 4, Value::Null);
5287 let mut config = get_arg(optional_args, 5, Value::Map({
5288 let mut m = indexmap::IndexMap::new();
5289 m
5290}));
5291 if is_true(&self.enableRateLimit) {
5292 let mut cost: Value = self.calculate_rate_limiter_cost(api.clone(), method.clone(), path.clone(), params.clone(), &[config.clone()]);
5293 self.throttle(&[cost.clone()]).await;
5294 }
5295 let mut retries: Value = Value::Int(0);
5296 { let __destr_tmp = self.handle_option_and_params(params.clone(), path.clone(), Value::Str("maxRetriesOnFailure".to_string()), &[retries.clone()]); retries = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
5297 let mut retryDelay: Value = Value::Int(0);
5298 { let __destr_tmp = self.handle_option_and_params(params.clone(), path.clone(), Value::Str("maxRetriesOnFailureDelay".to_string()), &[retryDelay.clone()]); retryDelay = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
5299 let mut fetchDataCacheEnabled: bool = is_greater_than(&self.fetchHistoryCacheSize, &Value::Int(0));
5300 {
5301 let mut i: Value = Value::Int(0);
5302 let mut __for_first_130: bool = true;
5303 while { if !__for_first_130 { i = add(&i, &Value::Int(1)); } __for_first_130 = false; is_less_than(&i, &add(&retries, &Value::Int(1))) } {
5304 let mut fetchData: Value = Value::Null;
5305 if is_true(&fetchDataCacheEnabled) {
5306 fetchData = Value::Map({
5307 let mut m = indexmap::IndexMap::new();
5308 m.insert("request".to_string(), Value::Null);
5309 m.insert("response".to_string(), Value::Map({
5310 let mut m = indexmap::IndexMap::new();
5311 m.insert("body".to_string(), Value::Null);
5312 m
5313}));
5314 m.insert("error".to_string(), Value::Null);
5315 m
5316 });
5317 }
5318 let _try_result = futures::FutureExt::catch_unwind(std::panic::AssertUnwindSafe(async {
5319 self.set_last_rest_request_timestamp();
5320 let mut request: Value = <Self as crate::exchange_generated::ExchangeBase>::sign(self, path.clone(), &[api.clone(), method.clone(), params.clone(), headers.clone(), body.clone()]);
5321 if !is_equal(&fetchData, &Value::Null) {
5322 add_element_to_object(&mut fetchData, &Value::Str("request".to_string()), request.clone());
5323 }
5324 self.set_last_request(request.clone());
5325 let mut response: Value = self.fetch(get_value(&request, &Value::Str("url".to_string())), &[get_value(&request, &Value::Str("method".to_string())), get_value(&request, &Value::Str("headers".to_string())), get_value(&request, &Value::Str("body".to_string()))]).await;
5326 if !is_equal(&fetchData, &Value::Null) {
5327 add_element_to_object(get_value_mut(&mut fetchData, &Value::Str("response".to_string())), &Value::Str("body".to_string()), response.clone());
5328 self.add_fetch_cache(fetchData.clone());
5329 }
5330 return response.clone();
5331 #[allow(unreachable_code)] { Value::Null }})).await;
5332match _try_result { Ok(__try_ok) => { if !matches!(__try_ok, Value::Null) { return __try_ok; } return Value::Null; } Err(_try_err) => { let e: Value = panic_to_value(_try_err);
5333 if !is_equal(&fetchData, &Value::Null) {
5334 add_element_to_object(&mut fetchData, &Value::Str("error".to_string()), e.clone());
5335 self.add_fetch_cache(fetchData.clone());
5336 }
5337 if is_true(&is_instance(&e, &Value::Str("OperationFailed".to_string()))) {
5338 if is_less_than(&i, &retries) {
5339 if is_true(&self.verbose) {
5340 let mut index: Value = add(&i, &Value::Int(1));
5341 self.log(add(&add(&add(&add(&add(&add(&Value::Str("Request failed with the error: ".to_string()), &to_string_val(&e)), &Value::Str(", retrying ".to_string())), &to_string_val(&index)), &Value::Str(" of ".to_string())), &to_string_val(&retries)), &Value::Str("...".to_string())));
5342 }
5343 if is_true(&(!is_equal(&retryDelay, &Value::Null))) && is_true(&(!is_equal(&retryDelay, &Value::Int(0)))) {
5344 self.sleep(retryDelay.clone()).await;
5345 }
5346 } else {
5347 panic!("{}", e);
5348 }
5349 } else {
5350 panic!("{}", e);
5351 }
5352 } }
5353 }
5354 }
5355 return Value::Null;
5356
5357 Value::Null
5358} }
5359
5360 fn request(&mut self, mut path: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
5361 let mut api = get_arg(optional_args, 0, Value::Str("public".to_string()));
5362 let mut method = get_arg(optional_args, 1, Value::Str("GET".to_string()));
5363 let mut params = get_arg(optional_args, 2, Value::Map({
5364 let mut m = indexmap::IndexMap::new();
5365 m
5366}));
5367 let mut headers = get_arg(optional_args, 3, Value::Null);
5368 let mut body = get_arg(optional_args, 4, Value::Null);
5369 let mut config = get_arg(optional_args, 5, Value::Map({
5370 let mut m = indexmap::IndexMap::new();
5371 m
5372}));
5373 return self.fetch2(path.clone(), &[api.clone(), method.clone(), params.clone(), headers.clone(), body.clone(), config.clone()]).await;
5374
5375 Value::Null
5376} }
5377
5378 fn load_accounts(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
5379 let mut reload = get_arg(optional_args, 0, Value::Bool(false));
5380 let mut params = get_arg(optional_args, 1, Value::Map({
5381 let mut m = indexmap::IndexMap::new();
5382 m
5383}));
5384 if is_true(&reload) {
5385 { let __t = self.fetch_accounts(&[params.clone()]).await; self.accounts = __t; }
5386 } else {
5387 if !is_equal(&self.accounts, &Value::Null) {
5388 return self.accounts.clone();
5389 } else {
5390 { let __t = self.fetch_accounts(&[params.clone()]).await; self.accounts = __t; }
5391 }
5392 }
5393 { let __t = self.index_by(self.accounts.clone(), Value::Str("id".to_string())); self.accountsById = __t; }
5394 return self.accounts.clone();
5395
5396 Value::Null
5397} }
5398
5399 fn build_ohlcvc(&self, mut trades: Value, optional_args: &[Value]) -> Value {
5400 let mut timeframe = get_arg(optional_args, 0, Value::Str("1m".to_string()));
5401 let mut since = get_arg(optional_args, 1, Value::Int(0));
5402 let mut limit = get_arg(optional_args, 2, Value::Int(2147483647));
5403 let mut ms: Value = multiply(&self.parse_timeframe(timeframe.clone()), &Value::Int(1000));
5406 let mut ohlcvs: Value = Value::List(vec![]);
5407 let mut i_timestamp: Value = Value::Int(0);
5408 let mut i_high: Value = Value::Int(2);
5410 let mut i_low: Value = Value::Int(3);
5411 let mut i_close: Value = Value::Int(4);
5412 let mut i_volume: Value = Value::Int(5);
5413 let mut i_count: Value = Value::Int(6);
5414 let mut tradesLength: Value = get_array_length(&trades);
5415 let mut oldest: Value = crate::runtime::Math::min(&tradesLength, &limit);
5416 let mut options: Value = self.safe_dict_k(self.options.clone(), "buildOHLCVC", &[Value::Map({
5417 let mut m = indexmap::IndexMap::new();
5418 m
5419})]);
5420 let mut skipZeroPrices: Value = self.safe_bool_k(options.clone(), "skipZeroPrices", &[Value::Bool(true)]);
5421 {
5422 let mut i: Value = Value::Int(0);
5423 let mut __for_first_131: bool = true;
5424 while { if !__for_first_131 { i = add(&i, &Value::Int(1)); } __for_first_131 = false; is_less_than(&i, &oldest) } {
5425 let mut trade: Value = get_value(&trades, &i);
5426 let mut trade: Value = get_value(&trades, &i);
5427 let mut ts: Value = get_value(&trade, &Value::Str("timestamp".to_string()));
5428 let mut price: Value = get_value(&trade, &Value::Str("price".to_string()));
5429 if is_true(&(is_equal(&ts, &Value::Null))) || is_true(&(is_equal(&price, &Value::Null))) {
5430 continue;
5431 }
5432 if is_less_than(&ts, &since) {
5433 continue;
5434 }
5435 if is_equal(&ts, &Value::Null) {
5436 panic!("{}", crate::exchange_errors::exchange_error(add(&self.id, &Value::Str(" buildOHLCVC() missing ts".to_string()))));
5437 }
5438 let mut openingTime: Value = multiply(&math_floor(÷(&ts, &ms)), &ms); if is_less_than(&openingTime, &since) {
5440 continue;
5441 }
5442 let mut ohlcv_length: Value = get_array_length(&ohlcvs);
5443 let mut candle: Value = subtract(&ohlcv_length, &Value::Int(1));
5444 if is_equal(&price, &Value::Null) {
5445 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" buildOHLCVC() requires a price argument".to_string()))));
5446 }
5447 if is_true(&(is_equal(&skipZeroPrices, &Value::Bool(true)))) && !is_true(&(is_greater_than(&price, &Value::Int(0)))) && !is_true(&(is_less_than(&price, &Value::Int(0)))) {
5448 continue;
5449 }
5450 let mut isFirstCandle: bool = is_equal(&candle, &negate(&Value::Int(1)));
5451 if is_true(&isFirstCandle) || is_greater_than_or_equal(&openingTime, &self.sum(&[get_value(&get_value(&ohlcvs, &candle), &i_timestamp), ms.clone()])) {
5452 append_to_array(&mut ohlcvs, Value::List(vec![openingTime.clone(), price.clone(), price.clone(), price.clone(), price.clone(), get_value(&trade, &Value::Str("amount".to_string())), Value::Int(1)]));
5454 } else {
5455 let mut prevHigh: Value = get_value(&get_value(&ohlcvs, &candle), &i_high);
5457 let mut prevLow: Value = get_value(&get_value(&ohlcvs, &candle), &i_low);
5458 let mut prevHighValue: Value = ternary(is_true(&(is_equal(&prevHigh, &Value::Null))), price.clone(), prevHigh.clone());
5459 let mut prevLowValue: Value = ternary(is_true(&(is_equal(&prevLow, &Value::Null))), price.clone(), prevLow.clone());
5460 add_element_to_object(get_value_mut(&mut ohlcvs, &candle), &i_high, crate::runtime::Math::max(&prevHighValue, &price));
5461 add_element_to_object(get_value_mut(&mut ohlcvs, &candle), &i_low, crate::runtime::Math::min(&prevLowValue, &price));
5462 add_element_to_object(get_value_mut(&mut ohlcvs, &candle), &i_close, price.clone());
5463 { let __be_tmp = self.sum(&[get_value(&get_value(&ohlcvs, &candle), &i_volume), get_value(&trade, &Value::Str("amount".to_string()))]); add_element_to_object(get_value_mut(&mut ohlcvs, &candle), &i_volume, __be_tmp); };
5464 { let __be_tmp = self.sum(&[get_value(&get_value(&ohlcvs, &candle), &i_count), Value::Int(1)]); add_element_to_object(get_value_mut(&mut ohlcvs, &candle), &i_count, __be_tmp); };
5465 }
5466 }
5467 }
5468 return ohlcvs;
5469
5470 Value::Null
5471}
5472
5473 fn parse_trading_view_ohlcv(&self, mut ohlcvs: Value, optional_args: &[Value]) -> Value {
5474 let mut market = get_arg(optional_args, 0, Value::Null);
5475 let mut timeframe = get_arg(optional_args, 1, Value::Str("1m".to_string()));
5476 let mut since = get_arg(optional_args, 2, Value::Null);
5477 let mut limit = get_arg(optional_args, 3, Value::Null);
5478 let mut result: Value = self.convert_trading_view_to_ohlcv(ohlcvs.clone(), &[]);
5479 return self.parse_ohlc_vs(result.clone(), &[market.clone(), timeframe.clone(), since.clone(), limit.clone()]);
5480
5481 Value::Null
5482}
5483
5484 fn fetch_borrow_interest(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
5485 let mut code = get_arg(optional_args, 0, Value::Null);
5486 let mut symbol = get_arg(optional_args, 1, Value::Null);
5487 let mut since = get_arg(optional_args, 2, Value::Null);
5488 let mut limit = get_arg(optional_args, 3, Value::Null);
5489 let mut params = get_arg(optional_args, 4, Value::Map({
5490 let mut m = indexmap::IndexMap::new();
5491 m
5492}));
5493 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchBorrowInterest() is not supported yet".to_string()))));
5494
5495 Value::Null
5496} }
5497
5498 fn fetch_ledger(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
5499 if let Some(__v) = self.dispatch_to_derived("fetch_ledger", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
5501 if !matches!(__v, crate::Value::Null) { return __v; }
5502 }
5503
5504 let mut code = get_arg(optional_args, 0, Value::Null);
5505 let mut since = get_arg(optional_args, 1, Value::Null);
5506 let mut limit = get_arg(optional_args, 2, Value::Null);
5507 let mut params = get_arg(optional_args, 3, Value::Map({
5508 let mut m = indexmap::IndexMap::new();
5509 m
5510}));
5511 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchLedger() is not supported yet".to_string()))));
5512
5513 Value::Null
5514} }
5515
5516 fn fetch_ledger_entry(&mut self, mut id: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
5517 let mut code = get_arg(optional_args, 0, Value::Null);
5518 let mut params = get_arg(optional_args, 1, Value::Map({
5519 let mut m = indexmap::IndexMap::new();
5520 m
5521}));
5522 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchLedgerEntry() is not supported yet".to_string()))));
5523
5524 Value::Null
5525} }
5526
5527 fn parse_order_book_bid_ask(&self, mut bidask: Value, optional_args: &[Value]) -> Value {
5528 let mut priceKey = get_arg(optional_args, 0, Value::Int(0));
5529 let mut amountKey = get_arg(optional_args, 1, Value::Int(1));
5530 let mut countOrIdKey = get_arg(optional_args, 2, Value::Int(2));
5531 let mut price: Value = self.safe_float(bidask.clone(), priceKey.clone(), &[]);
5532 let mut amount: Value = self.safe_float(bidask.clone(), amountKey.clone(), &[]);
5533 let mut countOrId: Value = self.safe_integer(bidask.clone(), countOrIdKey.clone(), &[]);
5534 let mut bidAsk: Value = Value::List(vec![price.clone(), amount.clone()]);
5535 if !is_equal(&countOrId, &Value::Null) {
5536 append_to_array(&mut bidAsk, countOrId.clone());
5537 }
5538 return bidAsk;
5539
5540 Value::Null
5541}
5542
5543 fn safe_currency(&self, mut currencyId: Value, optional_args: &[Value]) -> Value {
5544 let mut currency = get_arg(optional_args, 0, Value::Null);
5545 if is_true(&(is_equal(¤cyId, &Value::Null))) && is_true(&(!is_equal(¤cy, &Value::Null))) {
5546 return currency;
5547 }
5548 if is_true(&(!is_equal(¤cyId, &Value::Null))) && is_true(&(!is_equal(&self.currencies_by_id, &Value::Null))) && is_true(&(Value::Bool(in_op(&self.currencies_by_id, ¤cyId)))) && is_true(&(!is_equal(&get_value(&self.currencies_by_id, ¤cyId), &Value::Null))) {
5549 return get_value(&self.currencies_by_id, ¤cyId);
5550 }
5551 let mut code: Value = currencyId.clone();
5552 if !is_equal(¤cyId, &Value::Null) {
5553 code = self.common_currency_code(to_upper(¤cyId));
5554 }
5555 return self.safe_currency_structure(Value::Map({
5556 let mut m = indexmap::IndexMap::new();
5557 m.insert("id".to_string(), currencyId.clone());
5558 m.insert("code".to_string(), code.clone());
5559 m.insert("precision".to_string(), Value::Null);
5560 m
5561}));
5562
5563 Value::Null
5564}
5565
5566 fn safe_market(&self, optional_args: &[Value]) -> Value {
5567 let mut marketId = get_arg(optional_args, 0, Value::Null);
5568 let mut market = get_arg(optional_args, 1, Value::Null);
5569 let mut delimiter = get_arg(optional_args, 2, Value::Null);
5570 let mut marketType = get_arg(optional_args, 3, Value::Null);
5571 if !is_equal(&marketId, &Value::Null) {
5572 if is_true(&(!is_equal(&self.markets_by_id, &Value::Null))) && is_true(&(Value::Bool(in_op(&self.markets_by_id, &marketId)))) {
5573 let mut markets: Value = get_value(&self.markets_by_id, &marketId);
5574 let mut numMarkets: Value = get_array_length(&markets);
5575 if is_equal(&numMarkets, &Value::Int(1)) {
5576 return get_value(&markets, &Value::Int(0));
5577 } else {
5578 if is_equal(&marketType, &Value::Null) {
5579 if is_equal(&market, &Value::Null) {
5580 panic!("{}", crate::exchange_errors::arguments_required(add(&add(&add(&self.id, &Value::Str(" safeMarket() requires a fourth argument for ".to_string())), &marketId), &Value::Str(" to disambiguate between different markets with the same market id".to_string()))));
5581 } else {
5582 marketType = get_value(&market, &Value::Str("type".to_string()));
5583 }
5584 }
5585 {
5586 let mut i: Value = Value::Int(0);
5587 let mut __for_first_132: bool = true;
5588 while { if !__for_first_132 { i = add(&i, &Value::Int(1)); } __for_first_132 = false; is_less_than(&i, &get_array_length(&markets)) } {
5589 let mut currentMarket: Value = get_value(&markets, &i);
5590 let mut currentMarket: Value = get_value(&markets, &i);
5591 if is_equal(&get_value(¤tMarket, &marketType), &Value::Bool(true)) {
5592 return currentMarket;
5593 }
5594 }
5595 }
5596 }
5597 } else if !is_equal(&delimiter, &Value::Null) && !is_equal(&delimiter, &Value::Str("".to_string())) {
5598 let mut parts: Value = split(&marketId, &delimiter);
5599 let mut partsLength: Value = get_array_length(&parts);
5600 let mut result: Value = self.safe_market_structure(&[Value::Map({
5601 let mut m = indexmap::IndexMap::new();
5602 m.insert("symbol".to_string(), marketId.clone());
5603 m.insert("marketId".to_string(), marketId.clone());
5604 m
5605})]);
5606 if is_equal(&result, &Value::Null) {
5607 panic!("{}", crate::exchange_errors::exchange_error(add(&self.id, &Value::Str(" safeMarket() failed to build market structure".to_string()))));
5608 }
5609 if is_equal(&partsLength, &Value::Int(2)) {
5610 let mut baseId: Value = self.safe_string(parts.clone(), Value::Int(0), &[]);
5611 let mut quoteId: Value = self.safe_string(parts.clone(), Value::Int(1), &[]);
5612 let mut base: Value = self.safe_currency_code(baseId.clone(), &[]);
5613 let mut quote: Value = self.safe_currency_code(quoteId.clone(), &[]);
5614 add_element_to_object(&mut result, &Value::Str("baseId".to_string()), baseId.clone());
5615 add_element_to_object(&mut result, &Value::Str("quoteId".to_string()), quoteId.clone());
5616 if !is_equal(&base, &Value::Null) {
5617 add_element_to_object(&mut result, &Value::Str("base".to_string()), base.clone());
5618 }
5619 if !is_equal("e, &Value::Null) {
5620 add_element_to_object(&mut result, &Value::Str("quote".to_string()), quote.clone());
5621 }
5622 if is_true(&(!is_equal(&base, &Value::Null))) && is_true(&(!is_equal("e, &Value::Null))) {
5623 add_element_to_object(&mut result, &Value::Str("symbol".to_string()), add(&add(&base, &Value::Str("/".to_string())), "e));
5624 }
5625 }
5626 return result;
5627 }
5628 }
5629 if !is_equal(&market, &Value::Null) {
5630 return market;
5631 }
5632 let mut emptyMarket: Value = self.safe_market_structure(&[Value::Map({
5633 let mut m = indexmap::IndexMap::new();
5634 m.insert("symbol".to_string(), marketId.clone());
5635 m.insert("marketId".to_string(), marketId.clone());
5636 m
5637})]);
5638 if is_equal(&emptyMarket, &Value::Null) {
5639 panic!("{}", crate::exchange_errors::exchange_error(add(&self.id, &Value::Str(" safeMarket() failed to build market structure".to_string()))));
5640 }
5641 return emptyMarket;
5642
5643 Value::Null
5644}
5645
5646 fn market_or_null(&self, optional_args: &[Value]) -> Value {
5647 let mut symbol = get_arg(optional_args, 0, Value::Null);
5648 if is_equal(&symbol, &Value::Null) {
5649 return Value::Null;
5650 }
5651 return self.market(symbol.clone());
5652
5653 Value::Null
5654}
5655
5656 fn check_required_credentials(&self, optional_args: &[Value]) -> Value {
5657 let mut error = get_arg(optional_args, 0, Value::Bool(true));
5658 let mut keys: Value = object_keys(&self.requiredCredentials);
5665 {
5666 let mut i: Value = Value::Int(0);
5667 let mut __for_first_133: bool = true;
5668 while { if !__for_first_133 { i = add(&i, &Value::Int(1)); } __for_first_133 = false; is_less_than(&i, &get_array_length(&keys)) } {
5669 let mut key: Value = get_value(&keys, &i);
5670 let mut key: Value = get_value(&keys, &i);
5671 let mut credentialValue: Value = self.prop(&key);
5672 let mut credentialMissing: bool = is_true(&(is_equal(&credentialValue, &Value::Null))) || is_true(&(is_equal(&credentialValue, &Value::Null))) || is_true(&(is_equal(&credentialValue, &Value::Bool(false)))) || is_true(&(is_equal(&credentialValue, &Value::Str("".to_string()))));
5673 if is_true(&(is_equal(&get_value(&self.requiredCredentials, &key), &Value::Bool(true)))) && is_true(&credentialMissing) {
5674 if is_true(&error) {
5675 panic!("{}", crate::exchange_errors::authentication_error(add(&add(&add(&self.id, &Value::Str(" requires \"".to_string())), &key), &Value::Str("\" credential".to_string()))));
5676 } else {
5677 return Value::Bool(false);
5678 }
5679 }
5680 }
5681 }
5682 return Value::Bool(true);
5683
5684 Value::Null
5685}
5686
5687 fn oath(&self) -> Value {
5688 if !is_equal(&self.twofa, &Value::Null) {
5689 return totp(self.twofa.clone());
5690 } else {
5691 panic!("{}", crate::exchange_errors::exchange_error(add(&self.id, &Value::Str(" exchange.twofa has not been set for 2FA Two-Factor Authentication".to_string()))));
5692 }
5693
5694 Value::Null
5695}
5696
5697 fn fetch_balance(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
5698 if let Some(__v) = self.dispatch_to_derived("fetch_balance", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
5700 if !matches!(__v, crate::Value::Null) { return __v; }
5701 }
5702
5703 let mut params = get_arg(optional_args, 0, Value::Map({
5704 let mut m = indexmap::IndexMap::new();
5705 m
5706}));
5707 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchBalance() is not supported yet".to_string()))));
5708
5709 Value::Null
5710} }
5711
5712 fn fetch_balance_ws(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
5713 let mut params = get_arg(optional_args, 0, Value::Map({
5714 let mut m = indexmap::IndexMap::new();
5715 m
5716}));
5717 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchBalanceWs() is not supported yet".to_string()))));
5718
5719 Value::Null
5720} }
5721
5722 fn parse_balance(&self, mut response: Value) -> Value {
5723 { let __v = crate::exchange::DerivedExchange::parse_balance(self, response.clone()); if !matches!(__v, crate::Value::Null) { return __v; } }
5725
5726 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseBalance() is not supported yet".to_string()))));
5727
5728 Value::Null
5729}
5730
5731 fn watch_balance(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
5732 let mut params = get_arg(optional_args, 0, Value::Map({
5733 let mut m = indexmap::IndexMap::new();
5734 m
5735}));
5736 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchBalance() is not supported yet".to_string()))));
5737
5738 Value::Null
5739} }
5740
5741 fn fetch_partial_balance(&mut self, mut part: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
5742 let mut params = get_arg(optional_args, 0, Value::Map({
5743 let mut m = indexmap::IndexMap::new();
5744 m
5745}));
5746 let mut balance: Value = self.fetch_balance(&[params.clone()]).await;
5747 return get_value(&balance, &part);
5748
5749 Value::Null
5750} }
5751
5752 fn fetch_free_balance(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
5753 let mut params = get_arg(optional_args, 0, Value::Map({
5754 let mut m = indexmap::IndexMap::new();
5755 m
5756}));
5757 return self.fetch_partial_balance(Value::Str("free".to_string()), &[params.clone()]).await;
5758
5759 Value::Null
5760} }
5761
5762 fn fetch_used_balance(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
5763 let mut params = get_arg(optional_args, 0, Value::Map({
5764 let mut m = indexmap::IndexMap::new();
5765 m
5766}));
5767 return self.fetch_partial_balance(Value::Str("used".to_string()), &[params.clone()]).await;
5768
5769 Value::Null
5770} }
5771
5772 fn fetch_total_balance(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
5773 let mut params = get_arg(optional_args, 0, Value::Map({
5774 let mut m = indexmap::IndexMap::new();
5775 m
5776}));
5777 return self.fetch_partial_balance(Value::Str("total".to_string()), &[params.clone()]).await;
5778
5779 Value::Null
5780} }
5781
5782 fn fetch_status(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
5783 if let Some(__v) = self.dispatch_to_derived("fetch_status", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
5785 if !matches!(__v, crate::Value::Null) { return __v; }
5786 }
5787
5788 let mut params = get_arg(optional_args, 0, Value::Map({
5789 let mut m = indexmap::IndexMap::new();
5790 m
5791}));
5792 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchStatus() is not supported yet".to_string()))));
5793
5794 Value::Null
5795} }
5796
5797 fn fetch_transaction_fee(&mut self, mut code: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
5798 let mut params = get_arg(optional_args, 0, Value::Map({
5799 let mut m = indexmap::IndexMap::new();
5800 m
5801}));
5802 if is_equal(&get_value(&self.has, &Value::Str("fetchTransactionFees".to_string())), &Value::Null) || is_equal(&get_value(&self.has, &Value::Str("fetchTransactionFees".to_string())), &Value::Bool(false)) {
5803 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchTransactionFee() is not supported yet".to_string()))));
5804 }
5805 return self.fetch_transaction_fees(&[Value::List(vec![code.clone()]), params.clone()]).await;
5806
5807 Value::Null
5808} }
5809
5810 fn fetch_transaction_fees(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
5811 let mut codes = get_arg(optional_args, 0, Value::Null);
5812 let mut params = get_arg(optional_args, 1, Value::Map({
5813 let mut m = indexmap::IndexMap::new();
5814 m
5815}));
5816 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchTransactionFees() is not supported yet".to_string()))));
5817
5818 Value::Null
5819} }
5820
5821 fn fetch_deposit_withdraw_fees(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
5822 if let Some(__v) = self.dispatch_to_derived("fetch_deposit_withdraw_fees", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
5824 if !matches!(__v, crate::Value::Null) { return __v; }
5825 }
5826
5827 let mut codes = get_arg(optional_args, 0, Value::Null);
5828 let mut params = get_arg(optional_args, 1, Value::Map({
5829 let mut m = indexmap::IndexMap::new();
5830 m
5831}));
5832 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchDepositWithdrawFees() is not supported yet".to_string()))));
5833
5834 Value::Null
5835} }
5836
5837 fn fetch_deposit_withdraw_fee(&mut self, mut code: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
5838 if let Some(__v) = self.dispatch_to_derived("fetch_deposit_withdraw_fee", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(code.clone()); __args.extend_from_slice(optional_args); __args }).await {
5840 if !matches!(__v, crate::Value::Null) { return __v; }
5841 }
5842
5843 let mut params = get_arg(optional_args, 0, Value::Map({
5844 let mut m = indexmap::IndexMap::new();
5845 m
5846}));
5847 if is_equal(&get_value(&self.has, &Value::Str("fetchDepositWithdrawFees".to_string())), &Value::Null) || is_equal(&get_value(&self.has, &Value::Str("fetchDepositWithdrawFees".to_string())), &Value::Bool(false)) {
5848 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchDepositWithdrawFee() is not supported yet".to_string()))));
5849 }
5850 let mut fees: Value = self.fetch_deposit_withdraw_fees(&[Value::List(vec![code.clone()]), params.clone()]).await;
5851 return self.safe_value(fees.clone(), code.clone(), &[]);
5852
5853 Value::Null
5854} }
5855
5856 fn get_supported_mapping(&self, mut key: Value, optional_args: &[Value]) -> Value {
5857 let mut mapping = get_arg(optional_args, 0, Value::Map({
5858 let mut m = indexmap::IndexMap::new();
5859 m
5860}));
5861 if is_true(&Value::Bool(in_op(&mapping, &key))) {
5862 return get_value(&mapping, &key);
5863 } else {
5864 panic!("{}", crate::exchange_errors::not_supported(add(&add(&add(&self.id, &Value::Str(" ".to_string())), &key), &Value::Str(" does not have a value in mapping".to_string()))));
5865 }
5866
5867 Value::Null
5868}
5869
5870 fn fetch_cross_borrow_rate(&mut self, mut code: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
5871 let mut params = get_arg(optional_args, 0, Value::Map({
5872 let mut m = indexmap::IndexMap::new();
5873 m
5874}));
5875 self.load_markets(&[]).await;
5876 if is_equal(&get_value(&self.has, &Value::Str("fetchBorrowRates".to_string())), &Value::Null) || is_equal(&get_value(&self.has, &Value::Str("fetchBorrowRates".to_string())), &Value::Bool(false)) {
5877 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchCrossBorrowRate() is not supported yet".to_string()))));
5878 }
5879 let mut borrowRates: Value = self.fetch_cross_borrow_rates(&[params.clone()]).await;
5880 let mut rate: Value = self.safe_value(borrowRates.clone(), code.clone(), &[]);
5881 if is_equal(&rate, &Value::Null) {
5882 panic!("{}", crate::exchange_errors::exchange_error(add(&add(&self.id, &Value::Str(" fetchCrossBorrowRate() could not find the borrow rate for currency code ".to_string())), &code)));
5883 }
5884 return rate;
5885
5886 Value::Null
5887} }
5888
5889 fn fetch_isolated_borrow_rate(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
5890 let mut params = get_arg(optional_args, 0, Value::Map({
5891 let mut m = indexmap::IndexMap::new();
5892 m
5893}));
5894 self.load_markets(&[]).await;
5895 if is_equal(&get_value(&self.has, &Value::Str("fetchBorrowRates".to_string())), &Value::Null) || is_equal(&get_value(&self.has, &Value::Str("fetchBorrowRates".to_string())), &Value::Bool(false)) {
5896 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchIsolatedBorrowRate() is not supported yet".to_string()))));
5897 }
5898 let mut borrowRates: Value = self.fetch_isolated_borrow_rates(&[params.clone()]).await;
5899 let mut rate: Value = self.safe_dict(borrowRates.clone(), symbol.clone(), &[]);
5900 if is_equal(&rate, &Value::Null) {
5901 panic!("{}", crate::exchange_errors::exchange_error(add(&add(&self.id, &Value::Str(" fetchIsolatedBorrowRate() could not find the borrow rate for market symbol ".to_string())), &symbol)));
5902 }
5903 return rate;
5904
5905 Value::Null
5906} }
5907
5908fn require_value(&self, mut value: Value, optional_args: &[Value]) -> Value {
5911 let mut message = get_arg(optional_args, 0, Value::Null);
5912 if is_equal(&value, &Value::Null) {
5913 let mut errorMessage: Value = ternary(is_true(&(!is_equal(&message, &Value::Null))), message.clone(), Value::Str("value is required".to_string()));
5914 panic!("{}", crate::exchange_errors::arguments_required(add(&add(&self.id, &Value::Str(" ".to_string())), &errorMessage)));
5915 }
5916 return value;
5917
5918 Value::Null
5919}
5920
5921fn handle_option_and_params(&self, mut params: Value, mut methodName: Value, mut optionName: Value, optional_args: &[Value]) -> Value {
5924 let mut defaultValue = get_arg(optional_args, 0, Value::Null);
5925 let mut defaultOptionName: Value = add(&Value::Str("default".to_string()), &self.capitalize(optionName.clone())); let mut value: Value = self.safe_value2(params.clone(), optionName.clone(), defaultOptionName.clone(), &[]);
5929 if !is_equal(&value, &Value::Null) {
5930 params = self.omit(params.clone(), Value::List(vec![optionName.clone(), defaultOptionName.clone()]), &[]);
5931 } else {
5932 { let __destr_tmp = self.handle_param_string(params.clone(), Value::Str("callerMethodName".to_string()), &[methodName.clone()]); methodName = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
5934 let mut exchangeWideMethodOptions: Value = self.safe_value(self.options.clone(), methodName.clone(), &[]);
5936 if !is_equal(&exchangeWideMethodOptions, &Value::Null) {
5937 value = self.safe_value2(exchangeWideMethodOptions.clone(), optionName.clone(), defaultOptionName.clone(), &[]);
5939 }
5940 if is_equal(&value, &Value::Null) {
5941 value = self.safe_value2(self.options.clone(), optionName.clone(), defaultOptionName.clone(), &[]);
5943 }
5944 value = ternary(is_true(&(!is_equal(&value, &Value::Null))), value.clone(), defaultValue.clone());
5946 }
5947 return Value::List(vec![value.clone(), params.clone()]);
5948
5949 Value::Null
5950}
5951
5952fn handle_option_and_params2(&self, mut params: Value, mut methodName1: Value, mut optionName1: Value, mut optionName2: Value, optional_args: &[Value]) -> Value {
5955 let mut defaultValue = get_arg(optional_args, 0, Value::Null);
5956 let mut value: Value = Value::Null;
5957 { let __destr_tmp = self.handle_option_and_params(params.clone(), methodName1.clone(), optionName1.clone(), &[]); value = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
5958 if !is_equal(&value, &Value::Null) {
5959 params = self.omit(params.clone(), optionName2.clone(), &[]);
5961 return Value::List(vec![value.clone(), params.clone()]);
5962 }
5963 let mut value2: Value = Value::Null;
5965 { let __destr_tmp = self.handle_option_and_params(params.clone(), methodName1.clone(), optionName2.clone(), &[defaultValue.clone()]); value2 = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
5966 return Value::List(vec![value2.clone(), params.clone()]);
5967
5968 Value::Null
5969}
5970
5971 fn handle_option(&self, mut methodName: Value, mut optionName: Value, optional_args: &[Value]) -> Value {
5972 let mut defaultValue = get_arg(optional_args, 0, Value::Null);
5973 let mut res: Value = self.handle_option_and_params(Value::Map({
5974 let mut m = indexmap::IndexMap::new();
5975 m
5976}), methodName.clone(), optionName.clone(), &[defaultValue.clone()]);
5977 return self.safe_value(res.clone(), Value::Int(0), &[]);
5978
5979 Value::Null
5980}
5981
5982 fn handle_market_type_and_params(&self, mut methodName: Value, optional_args: &[Value]) -> Value {
5983 let mut market = get_arg(optional_args, 0, Value::Null);
5984 let mut params = get_arg(optional_args, 1, Value::Map({
5985 let mut m = indexmap::IndexMap::new();
5986 m
5987}));
5988 let mut defaultValue = get_arg(optional_args, 2, Value::Null);
5989 let mut type_var: Value = self.safe_string2(params.clone(), Value::Str("defaultType".to_string()), Value::Str("type".to_string()), &[]);
6003 if !is_equal(&type_var, &Value::Null) {
6004 params = self.omit(params.clone(), Value::List(vec![Value::Str("defaultType".to_string()), Value::Str("type".to_string())]), &[]);
6005 return Value::List(vec![type_var.clone(), params.clone()]);
6006 }
6007 if !is_equal(&market, &Value::Null) {
6009 return Value::List(vec![get_value(&market, &Value::Str("type".to_string())), params.clone()]);
6010 }
6011 if !is_equal(&defaultValue, &Value::Null) {
6013 return Value::List(vec![defaultValue.clone(), params.clone()]);
6014 }
6015 let mut methodOptions: Value = self.safe_dict(self.options.clone(), methodName.clone(), &[]);
6016 if !is_equal(&methodOptions, &Value::Null) {
6017 if is_string(&methodOptions) {
6018 return Value::List(vec![methodOptions.clone(), params.clone()]);
6019 } else {
6020 let mut typeFromMethod: Value = self.safe_string2(methodOptions.clone(), Value::Str("defaultType".to_string()), Value::Str("type".to_string()), &[]);
6021 if !is_equal(&typeFromMethod, &Value::Null) {
6022 return Value::List(vec![typeFromMethod.clone(), params.clone()]);
6023 }
6024 }
6025 }
6026 let mut defaultType: Value = self.safe_string2(self.options.clone(), Value::Str("defaultType".to_string()), Value::Str("type".to_string()), &[Value::Str("spot".to_string())]);
6027 return Value::List(vec![defaultType.clone(), params.clone()]);
6028
6029 Value::Null
6030}
6031
6032 fn handle_sub_type_and_params(&self, mut methodName: Value, optional_args: &[Value]) -> Value {
6033 let mut market = get_arg(optional_args, 0, Value::Null);
6034 let mut params = get_arg(optional_args, 1, Value::Map({
6035 let mut m = indexmap::IndexMap::new();
6036 m
6037}));
6038 let mut defaultValue = get_arg(optional_args, 2, Value::Null);
6039 let mut subType: Value = Value::Null;
6040 let mut subTypeInParams: Value = self.safe_string2(params.clone(), Value::Str("subType".to_string()), Value::Str("defaultSubType".to_string()), &[]);
6042 if !is_equal(&subTypeInParams, &Value::Null) {
6044 if is_true(&(is_equal(&subTypeInParams, &Value::Str("linear".to_string())))) || is_true(&(is_equal(&subTypeInParams, &Value::Str("inverse".to_string())))) {
6045 subType = subTypeInParams.clone();
6046 }
6047 params = self.omit(params.clone(), Value::List(vec![Value::Str("subType".to_string()), Value::Str("defaultSubType".to_string())]), &[]);
6048 } else {
6049 if !is_equal(&market, &Value::Null) {
6051 if is_equal(&get_value(&market, &Value::Str("linear".to_string())), &Value::Bool(true)) {
6052 subType = Value::Str("linear".to_string());
6053 } else if is_equal(&get_value(&market, &Value::Str("inverse".to_string())), &Value::Bool(true)) {
6054 subType = Value::Str("inverse".to_string());
6055 }
6056 }
6057 if is_equal(&subType, &Value::Null) {
6059 let mut values: Value = self.handle_option_and_params(Value::Map({
6060 let mut m = indexmap::IndexMap::new();
6061 m
6062}), methodName.clone(), Value::Str("subType".to_string()), &[defaultValue.clone()]); subType = get_value(&values, &Value::Int(0));
6064 }
6065 }
6066 return Value::List(vec![subType.clone(), params.clone()]);
6067
6068 Value::Null
6069}
6070
6071 fn handle_margin_mode_and_params(&self, mut methodName: Value, optional_args: &[Value]) -> Value {
6072 let mut params = get_arg(optional_args, 0, Value::Map({
6073 let mut m = indexmap::IndexMap::new();
6074 m
6075}));
6076 let mut defaultValue = get_arg(optional_args, 1, Value::Null);
6077 return self.handle_option_and_params(params.clone(), methodName.clone(), Value::Str("marginMode".to_string()), &[defaultValue.clone()]);
6078
6079 Value::Null
6080}
6081
6082 fn throw_exactly_matched_exception(&self, mut exact: Value, mut string: Value, mut message: Value) {
6083 if is_equal(&string, &Value::Null) {
6084 return;
6085 }
6086 if is_true(&Value::Bool(in_op(&exact, &string))) {
6087 panic!("{}", crate::exchange_errors::create_error(&crate::runtime::stringify_param(&(get_value(&exact, &string))), &crate::runtime::stringify_param(&(message))));
6088 }
6089}
6090
6091 fn throw_broadly_matched_exception(&self, mut broad: Value, mut string: Value, mut message: Value) {
6092 let mut broadKey: Value = self.find_broadly_matched_key(broad.clone(), string.clone());
6093 if !is_equal(&broadKey, &Value::Null) {
6094 panic!("{}", crate::exchange_errors::create_error(&crate::runtime::stringify_param(&(get_value(&broad, &broadKey))), &crate::runtime::stringify_param(&(message))));
6095 }
6096}
6097
6098 fn find_broadly_matched_key(&self, mut broad: Value, mut string: Value) -> Value {
6099 let mut keys: Value = object_keys(&broad);
6101 {
6102 let mut i: Value = Value::Int(0);
6103 let mut __for_first_134: bool = true;
6104 while { if !__for_first_134 { i = add(&i, &Value::Int(1)); } __for_first_134 = false; is_less_than(&i, &get_array_length(&keys)) } {
6105 let mut key: Value = get_value(&keys, &i);
6106 let mut key: Value = get_value(&keys, &i);
6107 if !is_equal(&string, &Value::Null) {
6108 if is_greater_than_or_equal(&get_index_of(&string, &key), &Value::Int(0)) {
6109 return key;
6110 }
6111 }
6112 }
6113 }
6114 return Value::Null;
6115
6116 Value::Null
6117}
6118
6119 fn handle_errors(&self, mut statusCode: Value, mut statusText: Value, mut url: Value, mut method: Value, mut responseHeaders: Value, mut responseBody: Value, mut response: Value, mut requestHeaders: Value, mut requestBody: Value) -> Value {
6120 { let __v = crate::exchange::DerivedExchange::handle_errors(self, statusCode.clone(), statusText.clone(), url.clone(), method.clone(), responseHeaders.clone(), responseBody.clone(), response.clone(), requestHeaders.clone(), requestBody.clone()); if !matches!(__v, crate::Value::Null) { return __v; } }
6122
6123 return Value::Null;
6124
6125 Value::Null
6126}
6127
6128 fn calculate_rate_limiter_cost(&self, mut api: Value, mut method: Value, mut path: Value, mut params: Value, optional_args: &[Value]) -> Value {
6129 let mut config = get_arg(optional_args, 0, Value::Map({
6130 let mut m = indexmap::IndexMap::new();
6131 m
6132}));
6133 return self.safe_value_k(config.clone(), "cost", &[Value::Int(1)]);
6134
6135 Value::Null
6136}
6137
6138 fn fetch_spot_tickers(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6139 let mut symbols = get_arg(optional_args, 0, Value::Null);
6140 let mut params = get_arg(optional_args, 1, Value::Map({
6141 let mut m = indexmap::IndexMap::new();
6142 m
6143}));
6144 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchSpotTickers() is not supported yet".to_string()))));
6145
6146 Value::Null
6147} }
6148
6149 fn fetch_contract_tickers(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6150 let mut symbols = get_arg(optional_args, 0, Value::Null);
6151 let mut params = get_arg(optional_args, 1, Value::Map({
6152 let mut m = indexmap::IndexMap::new();
6153 m
6154}));
6155 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchContractTickers() is not supported yet".to_string()))));
6156
6157 Value::Null
6158} }
6159
6160 fn fetch_order_books(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6161 let mut symbols = get_arg(optional_args, 0, Value::Null);
6162 let mut limit = get_arg(optional_args, 1, Value::Null);
6163 let mut params = get_arg(optional_args, 2, Value::Map({
6164 let mut m = indexmap::IndexMap::new();
6165 m
6166}));
6167 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOrderBooks() is not supported yet".to_string()))));
6168
6169 Value::Null
6170} }
6171
6172 fn un_watch_tickers(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6173 let mut symbols = get_arg(optional_args, 0, Value::Null);
6174 let mut params = get_arg(optional_args, 1, Value::Map({
6175 let mut m = indexmap::IndexMap::new();
6176 m
6177}));
6178 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" unWatchTickers() is not supported yet".to_string()))));
6179
6180 Value::Null
6181} }
6182
6183 fn un_watch_funding_rate(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6184 let mut params = get_arg(optional_args, 0, Value::Map({
6185 let mut m = indexmap::IndexMap::new();
6186 m
6187}));
6188 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" unWatchFundingRate() is not supported yet".to_string()))));
6189
6190 Value::Null
6191} }
6192
6193 fn create_twap_order(&mut self, mut symbol: Value, mut side: Value, mut amount: Value, mut duration: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6194 let mut params = get_arg(optional_args, 0, Value::Map({
6195 let mut m = indexmap::IndexMap::new();
6196 m
6197}));
6198 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createTwapOrder() is not supported yet".to_string()))));
6199
6200 Value::Null
6201} }
6202
6203 fn create_convert_trade(&mut self, mut id: Value, mut fromCode: Value, mut toCode: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6204 let mut amount = get_arg(optional_args, 0, Value::Null);
6205 let mut params = get_arg(optional_args, 1, Value::Map({
6206 let mut m = indexmap::IndexMap::new();
6207 m
6208}));
6209 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createConvertTrade() is not supported yet".to_string()))));
6210
6211 Value::Null
6212} }
6213
6214 fn fetch_convert_trade(&mut self, mut id: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6215 let mut code = get_arg(optional_args, 0, Value::Null);
6216 let mut params = get_arg(optional_args, 1, Value::Map({
6217 let mut m = indexmap::IndexMap::new();
6218 m
6219}));
6220 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchConvertTrade() is not supported yet".to_string()))));
6221
6222 Value::Null
6223} }
6224
6225 fn fetch_convert_trade_history(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6226 let mut code = get_arg(optional_args, 0, Value::Null);
6227 let mut since = get_arg(optional_args, 1, Value::Null);
6228 let mut limit = get_arg(optional_args, 2, Value::Null);
6229 let mut params = get_arg(optional_args, 3, Value::Map({
6230 let mut m = indexmap::IndexMap::new();
6231 m
6232}));
6233 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchConvertTradeHistory() is not supported yet".to_string()))));
6234
6235 Value::Null
6236} }
6237
6238 fn fetch_position_mode(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6239 if let Some(__v) = self.dispatch_to_derived("fetch_position_mode", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
6241 if !matches!(__v, crate::Value::Null) { return __v; }
6242 }
6243
6244 let mut symbol = get_arg(optional_args, 0, Value::Null);
6245 let mut params = get_arg(optional_args, 1, Value::Map({
6246 let mut m = indexmap::IndexMap::new();
6247 m
6248}));
6249 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchPositionMode() is not supported yet".to_string()))));
6250
6251 Value::Null
6252} }
6253
6254 fn fetch_adl_rank(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6255 let mut params = get_arg(optional_args, 0, Value::Map({
6256 let mut m = indexmap::IndexMap::new();
6257 m
6258}));
6259 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchADLRank() is not supported yet".to_string()))));
6260
6261 Value::Null
6262} }
6263
6264 fn fetch_positions_adl_rank(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6265 if let Some(__v) = self.dispatch_to_derived("fetch_positions_adl_rank", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
6267 if !matches!(__v, crate::Value::Null) { return __v; }
6268 }
6269
6270 let mut symbols = get_arg(optional_args, 0, Value::Null);
6271 let mut params = get_arg(optional_args, 1, Value::Map({
6272 let mut m = indexmap::IndexMap::new();
6273 m
6274}));
6275 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchPositionsADLRank() is not supported yet".to_string()))));
6276
6277 Value::Null
6278} }
6279
6280 fn fetch_position_adl_rank(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6281 if let Some(__v) = self.dispatch_to_derived("fetch_position_adl_rank", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(symbol.clone()); __args.extend_from_slice(optional_args); __args }).await {
6283 if !matches!(__v, crate::Value::Null) { return __v; }
6284 }
6285
6286 let mut params = get_arg(optional_args, 0, Value::Map({
6287 let mut m = indexmap::IndexMap::new();
6288 m
6289}));
6290 if !is_equal(&get_value(&self.has, &Value::Str("fetchPositionsADLRank".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchPositionsADLRank".to_string())), &Value::Bool(false)) {
6291 self.load_markets(&[]).await;
6292 let mut market: Value = self.market(symbol.clone());
6293 symbol = get_value(&market, &Value::Str("symbol".to_string()));
6294 let mut ranks: Value = self.fetch_positions_adl_rank(&[Value::List(vec![symbol.clone()]), params.clone()]).await;
6295 let mut rank: Value = self.safe_dict(ranks.clone(), Value::Int(0), &[]);
6296 if is_equal(&rank, &Value::Null) {
6297 panic!("{}", crate::exchange_errors::null_response(add(&add(&self.id, &Value::Str(" fetchPositionsADLRank() could not find a rank for ".to_string())), &symbol)));
6298 } else {
6299 return rank;
6300 }
6301 } else {
6302 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchPositionsADLRank() is not supported yet".to_string()))));
6303 }
6304
6305 Value::Null
6306} }
6307
6308 fn set_take_profit_and_stop_loss_params(&self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> Value {
6309 let mut price = get_arg(optional_args, 0, Value::Null);
6310 let mut takeProfit = get_arg(optional_args, 1, Value::Null);
6311 let mut stopLoss = get_arg(optional_args, 2, Value::Null);
6312 let mut params = get_arg(optional_args, 3, Value::Map({
6313 let mut m = indexmap::IndexMap::new();
6314 m
6315}));
6316 if is_true(&(is_equal(&takeProfit, &Value::Null))) && is_true(&(is_equal(&stopLoss, &Value::Null))) {
6317 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" createOrderWithTakeProfitAndStopLoss() requires either a takeProfit or stopLoss argument".to_string()))));
6318 }
6319 if !is_equal(&takeProfit, &Value::Null) {
6320 add_element_to_object(&mut params, &Value::Str("takeProfit".to_string()), Value::Map({
6321 let mut m = indexmap::IndexMap::new();
6322 m.insert("triggerPrice".to_string(), takeProfit.clone());
6323 m
6324}));
6325 }
6326 if !is_equal(&stopLoss, &Value::Null) {
6327 add_element_to_object(&mut params, &Value::Str("stopLoss".to_string()), Value::Map({
6328 let mut m = indexmap::IndexMap::new();
6329 m.insert("triggerPrice".to_string(), stopLoss.clone());
6330 m
6331}));
6332 }
6333 let mut takeProfitType: Value = self.safe_string_k(params.clone(), "takeProfitType", &[]);
6334 let mut takeProfitPriceType: Value = self.safe_string_k(params.clone(), "takeProfitPriceType", &[]);
6335 let mut takeProfitLimitPrice: Value = self.safe_string_k(params.clone(), "takeProfitLimitPrice", &[]);
6336 let mut takeProfitAmount: Value = self.safe_string_k(params.clone(), "takeProfitAmount", &[]);
6337 let mut stopLossType: Value = self.safe_string_k(params.clone(), "stopLossType", &[]);
6338 let mut stopLossPriceType: Value = self.safe_string_k(params.clone(), "stopLossPriceType", &[]);
6339 let mut stopLossLimitPrice: Value = self.safe_string_k(params.clone(), "stopLossLimitPrice", &[]);
6340 let mut stopLossAmount: Value = self.safe_string_k(params.clone(), "stopLossAmount", &[]);
6341 if !is_equal(&takeProfitType, &Value::Null) {
6342 add_element_to_object(get_value_mut(&mut params, &Value::Str("takeProfit".to_string())), &Value::Str("type".to_string()), takeProfitType.clone());
6343 }
6344 if !is_equal(&takeProfitPriceType, &Value::Null) {
6345 add_element_to_object(get_value_mut(&mut params, &Value::Str("takeProfit".to_string())), &Value::Str("priceType".to_string()), takeProfitPriceType.clone());
6346 }
6347 if !is_equal(&takeProfitLimitPrice, &Value::Null) {
6348 add_element_to_object(get_value_mut(&mut params, &Value::Str("takeProfit".to_string())), &Value::Str("price".to_string()), self.parse_to_numeric(takeProfitLimitPrice.clone()));
6349 }
6350 if !is_equal(&takeProfitAmount, &Value::Null) {
6351 add_element_to_object(get_value_mut(&mut params, &Value::Str("takeProfit".to_string())), &Value::Str("amount".to_string()), self.parse_to_numeric(takeProfitAmount.clone()));
6352 }
6353 if !is_equal(&stopLossType, &Value::Null) {
6354 add_element_to_object(get_value_mut(&mut params, &Value::Str("stopLoss".to_string())), &Value::Str("type".to_string()), stopLossType.clone());
6355 }
6356 if !is_equal(&stopLossPriceType, &Value::Null) {
6357 add_element_to_object(get_value_mut(&mut params, &Value::Str("stopLoss".to_string())), &Value::Str("priceType".to_string()), stopLossPriceType.clone());
6358 }
6359 if !is_equal(&stopLossLimitPrice, &Value::Null) {
6360 add_element_to_object(get_value_mut(&mut params, &Value::Str("stopLoss".to_string())), &Value::Str("price".to_string()), self.parse_to_numeric(stopLossLimitPrice.clone()));
6361 }
6362 if !is_equal(&stopLossAmount, &Value::Null) {
6363 add_element_to_object(get_value_mut(&mut params, &Value::Str("stopLoss".to_string())), &Value::Str("amount".to_string()), self.parse_to_numeric(stopLossAmount.clone()));
6364 }
6365 params = self.omit(params.clone(), Value::List(vec![Value::Str("takeProfitType".to_string()), Value::Str("takeProfitPriceType".to_string()), Value::Str("takeProfitLimitPrice".to_string()), Value::Str("takeProfitAmount".to_string()), Value::Str("stopLossType".to_string()), Value::Str("stopLossPriceType".to_string()), Value::Str("stopLossLimitPrice".to_string()), Value::Str("stopLossAmount".to_string())]), &[]);
6366 return params;
6367
6368 Value::Null
6369}
6370
6371 fn create_spot_orders(&mut self, mut orders: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6372 let mut params = get_arg(optional_args, 0, Value::Map({
6373 let mut m = indexmap::IndexMap::new();
6374 m
6375}));
6376 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createSpotOrders() is not supported yet".to_string()))));
6377
6378 Value::Null
6379} }
6380
6381 fn create_contract_orders(&mut self, mut orders: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6382 let mut params = get_arg(optional_args, 0, Value::Map({
6383 let mut m = indexmap::IndexMap::new();
6384 m
6385}));
6386 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createContractOrders() is not supported yet".to_string()))));
6387
6388 Value::Null
6389} }
6390
6391 fn cancel_spot_order(&mut self, mut id: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6392 let mut symbol = get_arg(optional_args, 0, Value::Null);
6393 let mut params = get_arg(optional_args, 1, Value::Map({
6394 let mut m = indexmap::IndexMap::new();
6395 m
6396}));
6397 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" cancelSpotOrder() is not supported yet".to_string()))));
6398
6399 Value::Null
6400} }
6401
6402 fn cancel_contract_order(&mut self, mut id: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6403 let mut symbol = get_arg(optional_args, 0, Value::Null);
6404 let mut params = get_arg(optional_args, 1, Value::Map({
6405 let mut m = indexmap::IndexMap::new();
6406 m
6407}));
6408 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" cancelContractOrder() is not supported yet".to_string()))));
6409
6410 Value::Null
6411} }
6412
6413 fn cancel_all_spot_orders(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6414 let mut symbol = get_arg(optional_args, 0, Value::Null);
6415 let mut params = get_arg(optional_args, 1, Value::Map({
6416 let mut m = indexmap::IndexMap::new();
6417 m
6418}));
6419 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" cancelAllSpotOrders() is not supported yet".to_string()))));
6420
6421 Value::Null
6422} }
6423
6424 fn cancel_all_contract_orders(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6425 let mut symbol = get_arg(optional_args, 0, Value::Null);
6426 let mut params = get_arg(optional_args, 1, Value::Map({
6427 let mut m = indexmap::IndexMap::new();
6428 m
6429}));
6430 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" cancelAllContractOrders() is not supported yet".to_string()))));
6431
6432 Value::Null
6433} }
6434
6435 fn cancel_all_orders_after(&mut self, mut timeout: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6436 let mut params = get_arg(optional_args, 0, Value::Map({
6437 let mut m = indexmap::IndexMap::new();
6438 m
6439}));
6440 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" cancelAllOrdersAfter() is not supported yet".to_string()))));
6441
6442 Value::Null
6443} }
6444
6445 fn cancel_orders_for_symbols(&mut self, mut orders: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6446 let mut params = get_arg(optional_args, 0, Value::Map({
6447 let mut m = indexmap::IndexMap::new();
6448 m
6449}));
6450 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" cancelOrdersForSymbols() is not supported yet".to_string()))));
6451
6452 Value::Null
6453} }
6454
6455 fn fetch_my_liquidations(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6456 let mut symbol = get_arg(optional_args, 0, Value::Null);
6457 let mut since = get_arg(optional_args, 1, Value::Null);
6458 let mut limit = get_arg(optional_args, 2, Value::Null);
6459 let mut params = get_arg(optional_args, 3, Value::Map({
6460 let mut m = indexmap::IndexMap::new();
6461 m
6462}));
6463 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchMyLiquidations() is not supported yet".to_string()))));
6464
6465 Value::Null
6466} }
6467
6468 fn fetch_liquidations(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6469 let mut since = get_arg(optional_args, 0, Value::Null);
6470 let mut limit = get_arg(optional_args, 1, Value::Null);
6471 let mut params = get_arg(optional_args, 2, Value::Map({
6472 let mut m = indexmap::IndexMap::new();
6473 m
6474}));
6475 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchLiquidations() is not supported yet".to_string()))));
6476
6477 Value::Null
6478} }
6479
6480 fn fetch_greeks(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6481 let mut params = get_arg(optional_args, 0, Value::Map({
6482 let mut m = indexmap::IndexMap::new();
6483 m
6484}));
6485 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchGreeks() is not supported yet".to_string()))));
6486
6487 Value::Null
6488} }
6489
6490 fn fetch_all_greeks(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6491 let mut symbols = get_arg(optional_args, 0, Value::Null);
6492 let mut params = get_arg(optional_args, 1, Value::Map({
6493 let mut m = indexmap::IndexMap::new();
6494 m
6495}));
6496 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchAllGreeks() is not supported yet".to_string()))));
6497
6498 Value::Null
6499} }
6500
6501 fn fetch_option_chain(&mut self, mut code: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6502 let mut params = get_arg(optional_args, 0, Value::Map({
6503 let mut m = indexmap::IndexMap::new();
6504 m
6505}));
6506 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOptionChain() is not supported yet".to_string()))));
6507
6508 Value::Null
6509} }
6510
6511 fn fetch_option(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6512 let mut params = get_arg(optional_args, 0, Value::Map({
6513 let mut m = indexmap::IndexMap::new();
6514 m
6515}));
6516 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOption() is not supported yet".to_string()))));
6517
6518 Value::Null
6519} }
6520
6521 fn fetch_convert_quote(&mut self, mut fromCode: Value, mut toCode: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6522 let mut amount = get_arg(optional_args, 0, Value::Null);
6523 let mut params = get_arg(optional_args, 1, Value::Map({
6524 let mut m = indexmap::IndexMap::new();
6525 m
6526}));
6527 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchConvertQuote() is not supported yet".to_string()))));
6528
6529 Value::Null
6530} }
6531
6532 fn fetch_deposits_withdrawals(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6533 if let Some(__v) = self.dispatch_to_derived("fetch_deposits_withdrawals", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
6535 if !matches!(__v, crate::Value::Null) { return __v; }
6536 }
6537
6538 let mut code = get_arg(optional_args, 0, Value::Null);
6539 let mut since = get_arg(optional_args, 1, Value::Null);
6540 let mut limit = get_arg(optional_args, 2, Value::Null);
6541 let mut params = get_arg(optional_args, 3, Value::Map({
6542 let mut m = indexmap::IndexMap::new();
6543 m
6544}));
6545 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchDepositsWithdrawals() is not supported yet".to_string()))));
6546
6547 Value::Null
6548} }
6549
6550 fn fetch_deposits(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6551 if let Some(__v) = self.dispatch_to_derived("fetch_deposits", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
6553 if !matches!(__v, crate::Value::Null) { return __v; }
6554 }
6555
6556 let mut code = get_arg(optional_args, 0, Value::Null);
6557 let mut since = get_arg(optional_args, 1, Value::Null);
6558 let mut limit = get_arg(optional_args, 2, Value::Null);
6559 let mut params = get_arg(optional_args, 3, Value::Map({
6560 let mut m = indexmap::IndexMap::new();
6561 m
6562}));
6563 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchDeposits() is not supported yet".to_string()))));
6564
6565 Value::Null
6566} }
6567
6568 fn fetch_withdrawals(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6569 if let Some(__v) = self.dispatch_to_derived("fetch_withdrawals", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
6571 if !matches!(__v, crate::Value::Null) { return __v; }
6572 }
6573
6574 let mut code = get_arg(optional_args, 0, Value::Null);
6575 let mut since = get_arg(optional_args, 1, Value::Null);
6576 let mut limit = get_arg(optional_args, 2, Value::Null);
6577 let mut params = get_arg(optional_args, 3, Value::Map({
6578 let mut m = indexmap::IndexMap::new();
6579 m
6580}));
6581 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchWithdrawals() is not supported yet".to_string()))));
6582
6583 Value::Null
6584} }
6585
6586 fn fetch_deposits_ws(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6587 let mut code = get_arg(optional_args, 0, Value::Null);
6588 let mut since = get_arg(optional_args, 1, Value::Null);
6589 let mut limit = get_arg(optional_args, 2, Value::Null);
6590 let mut params = get_arg(optional_args, 3, Value::Map({
6591 let mut m = indexmap::IndexMap::new();
6592 m
6593}));
6594 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchDepositsWs() is not supported yet".to_string()))));
6595
6596 Value::Null
6597} }
6598
6599 fn fetch_withdrawals_ws(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6600 let mut code = get_arg(optional_args, 0, Value::Null);
6601 let mut since = get_arg(optional_args, 1, Value::Null);
6602 let mut limit = get_arg(optional_args, 2, Value::Null);
6603 let mut params = get_arg(optional_args, 3, Value::Map({
6604 let mut m = indexmap::IndexMap::new();
6605 m
6606}));
6607 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchWithdrawalsWs() is not supported yet".to_string()))));
6608
6609 Value::Null
6610} }
6611
6612 fn fetch_funding_rate_history(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6613 if let Some(__v) = self.dispatch_to_derived("fetch_funding_rate_history", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
6615 if !matches!(__v, crate::Value::Null) { return __v; }
6616 }
6617
6618 let mut symbol = get_arg(optional_args, 0, Value::Null);
6619 let mut since = get_arg(optional_args, 1, Value::Null);
6620 let mut limit = get_arg(optional_args, 2, Value::Null);
6621 let mut params = get_arg(optional_args, 3, Value::Map({
6622 let mut m = indexmap::IndexMap::new();
6623 m
6624}));
6625 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchFundingRateHistory() is not supported yet".to_string()))));
6626
6627 Value::Null
6628} }
6629
6630 fn fetch_funding_history(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6631 let mut symbol = get_arg(optional_args, 0, Value::Null);
6632 let mut since = get_arg(optional_args, 1, Value::Null);
6633 let mut limit = get_arg(optional_args, 2, Value::Null);
6634 let mut params = get_arg(optional_args, 3, Value::Map({
6635 let mut m = indexmap::IndexMap::new();
6636 m
6637}));
6638 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchFundingHistory() is not supported yet".to_string()))));
6639
6640 Value::Null
6641} }
6642
6643 fn parse_last_price(&self, mut price: Value, optional_args: &[Value]) -> Value {
6644 { let __v = crate::exchange::DerivedExchange::parse_last_price(self, price.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
6646
6647 let mut market = get_arg(optional_args, 0, Value::Null);
6648 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseLastPrice() is not supported yet".to_string()))));
6649
6650 Value::Null
6651}
6652
6653 fn fetch_deposit_address(&mut self, mut code: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6654 if let Some(__v) = self.dispatch_to_derived("fetch_deposit_address", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(code.clone()); __args.extend_from_slice(optional_args); __args }).await {
6656 if !matches!(__v, crate::Value::Null) { return __v; }
6657 }
6658
6659 let mut params = get_arg(optional_args, 0, Value::Map({
6660 let mut m = indexmap::IndexMap::new();
6661 m
6662}));
6663 if !is_equal(&get_value(&self.has, &Value::Str("fetchDepositAddresses".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchDepositAddresses".to_string())), &Value::Bool(false)) {
6664 let mut depositAddresses: Value = self.fetch_deposit_addresses(&[Value::List(vec![code.clone()]), params.clone()]).await;
6665 let mut depositAddress: Value = self.safe_value(depositAddresses.clone(), code.clone(), &[]);
6666 if is_equal(&depositAddress, &Value::Null) {
6667 panic!("{}", crate::exchange_errors::invalid_address(add(&add(&add(&self.id, &Value::Str(" fetchDepositAddress() could not find a deposit address for ".to_string())), &code), &Value::Str(", make sure you have created a corresponding deposit address in your wallet on the exchange website".to_string()))));
6668 } else {
6669 return depositAddress;
6670 }
6671 } else if !is_equal(&get_value(&self.has, &Value::Str("fetchDepositAddressesByNetwork".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchDepositAddressesByNetwork".to_string())), &Value::Bool(false)) {
6672 let mut network: Value = self.safe_string_k(params.clone(), "network", &[]);
6673 params = self.omit(params.clone(), Value::Str("network".to_string()), &[]);
6674 let mut addressStructures: Value = self.fetch_deposit_addresses_by_network(code.clone(), &[params.clone()]).await;
6675 if !is_equal(&network, &Value::Null) {
6676 return self.safe_dict(addressStructures.clone(), network.clone(), &[]);
6677 } else {
6678 let mut keys: Value = object_keys(&addressStructures);
6679 let mut key: Value = get_value(&keys, &Value::Int(0));
6680 return self.safe_dict(addressStructures.clone(), key.clone(), &[]);
6681 }
6682 } else {
6683 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchDepositAddress() is not supported yet".to_string()))));
6684 }
6685
6686 Value::Null
6687} }
6688
6689 fn fetch_contract_deposit_address(&mut self, mut code: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
6690 let mut params = get_arg(optional_args, 0, Value::Map({
6691 let mut m = indexmap::IndexMap::new();
6692 m
6693}));
6694 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchContractDepositAddress() is not supported yet".to_string()))));
6695
6696 Value::Null
6697} }
6698
6699 fn account(&self) -> Value {
6700 return Value::Map({
6701 let mut m = indexmap::IndexMap::new();
6702 m.insert("free".to_string(), Value::Null);
6703 m.insert("used".to_string(), Value::Null);
6704 m.insert("total".to_string(), Value::Null);
6705 m
6706});
6707
6708 Value::Null
6709}
6710
6711fn merge_balance_account(&self, mut result: Value, mut code: Value, mut account: Value) -> Value {
6721 if !is_true(&(Value::Bool(in_op(&result, &code)))) {
6722 add_element_to_object(&mut result, &code, account.clone());
6723 return result;
6724 }
6725 let mut fields: Value = Value::List(vec![Value::Str("free".to_string()), Value::Str("used".to_string()), Value::Str("total".to_string()), Value::Str("debt".to_string())]);
6726 {
6727 let mut i: Value = Value::Int(0);
6728 let mut __for_first_135: bool = true;
6729 while { if !__for_first_135 { i = add(&i, &Value::Int(1)); } __for_first_135 = false; is_less_than(&i, &get_array_length(&fields)) } {
6730 let mut field: Value = get_value(&fields, &i);
6731 let mut field: Value = get_value(&fields, &i);
6732 let mut current: Value = self.safe_string(get_value(&result, &code), field.clone(), &[]);
6733 let mut incoming: Value = self.safe_string(account.clone(), field.clone(), &[]);
6734 if is_equal(¤t, &Value::Null) {
6735 add_element_to_object(get_value_mut(&mut result, &code), &field, incoming.clone());
6736 } else if !is_equal(&incoming, &Value::Null) {
6737 add_element_to_object(get_value_mut(&mut result, &code), &field, crate::precise::Precise::stringAdd(¤t, &incoming));
6738 }
6739 }
6740 }
6741 return result;
6742
6743 Value::Null
6744}
6745
6746 fn common_currency_code(&self, mut code: Value) -> Value {
6747 if !is_true(&self.substituteCommonCurrencyCodes) {
6748 return code;
6749 }
6750 return self.safe_string(self.commonCurrencies.clone(), code.clone(), &[code.clone()]);
6751
6752 Value::Null
6753}
6754
6755 fn currency(&self, mut code: Value) -> Value {
6756 if is_equal(&code, &Value::Null) {
6757 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" currency() requires a code argument".to_string()))));
6758 }
6759 let mut keys: Value = object_keys(&self.currencies);
6760 let mut numCurrencies: Value = get_array_length(&keys);
6761 if is_equal(&numCurrencies, &Value::Int(0)) {
6762 panic!("{}", crate::exchange_errors::exchange_error(add(&self.id, &Value::Str(" currencies not loaded".to_string()))));
6763 }
6764 if is_string(&code) {
6765 let mut currencies: Value = self.currencies.clone();
6766 let mut currenciesById: Value = self.currencies_by_id.clone();
6767 if is_true(&Value::Bool(in_op(¤cies, &code))) {
6768 return get_value(¤cies, &code);
6769 } else if is_true(&(!is_equal(¤ciesById, &Value::Null))) && is_true(&(Value::Bool(in_op(¤ciesById, &code)))) {
6770 return get_value(¤ciesById, &code);
6771 }
6772 }
6773 panic!("{}", crate::exchange_errors::exchange_error(add(&add(&self.id, &Value::Str(" does not have currency code ".to_string())), &code)));
6774
6775 Value::Null
6776}
6777
6778 fn market(&self, mut symbol: Value) -> Value {
6779 if is_equal(&symbol, &Value::Null) {
6780 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" market() requires a symbol argument".to_string()))));
6781 }
6782 let mut markets: Value = self.markets.clone();
6783 if is_equal(&markets, &Value::Null) {
6784 panic!("{}", crate::exchange_errors::exchange_error(add(&self.id, &Value::Str(" markets not loaded".to_string()))));
6785 }
6786 let mut marketsById: Value = self.markets_by_id.clone();
6787 if is_true(&Value::Bool(in_op(&markets, &symbol))) {
6788 return get_value(&markets, &symbol);
6789 } else if is_true(&(!is_equal(&marketsById, &Value::Null))) && is_true(&(Value::Bool(in_op(&marketsById, &symbol)))) {
6790 let mut marketsList: Value = get_value(&marketsById, &symbol);
6791 let mut marketsList: Value = get_value(&marketsById, &symbol);
6792 let mut defaultType: Value = self.safe_string2(self.options.clone(), Value::Str("defaultType".to_string()), Value::Str("defaultSubType".to_string()), &[Value::Str("spot".to_string())]);
6793 {
6794 let mut i: Value = Value::Int(0);
6795 let mut __for_first_136: bool = true;
6796 while { if !__for_first_136 { i = add(&i, &Value::Int(1)); } __for_first_136 = false; is_less_than(&i, &get_array_length(&marketsList)) } {
6797 let mut market: Value = get_value(&marketsList, &i);
6798 let mut market: Value = get_value(&marketsList, &i);
6799 if is_equal(&get_value(&market, &defaultType), &Value::Bool(true)) {
6800 return market;
6801 }
6802 }
6803 }
6804 return get_value(&marketsList, &Value::Int(0));
6805 } else if is_true(&(Value::Bool(ends_with(&symbol, &Value::Str("-C".to_string()))))) || is_true(&(Value::Bool(ends_with(&symbol, &Value::Str("-P".to_string()))))) || is_true(&(Value::Bool(starts_with(&symbol, &Value::Str("C-".to_string()))))) || is_true(&(Value::Bool(starts_with(&symbol, &Value::Str("P-".to_string()))))) {
6806 return <Self as crate::exchange_generated::ExchangeBase>::create_expired_option_market(self, symbol.clone());
6807 }
6808 panic!("{}", crate::exchange_errors::bad_symbol(add(&add(&self.id, &Value::Str(" does not have market symbol ".to_string())), &symbol)));
6809
6810 Value::Null
6811}
6812
6813 fn create_expired_option_market(&self, mut symbol: Value) -> Value {
6814 { let __v = crate::exchange::DerivedExchange::create_expired_option_market(self, symbol.clone()); if !matches!(__v, crate::Value::Null) { return __v; } }
6816
6817 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createExpiredOptionMarket () is not supported yet".to_string()))));
6818
6819 Value::Null
6820}
6821
6822 fn is_leveraged_currency(&self, mut currencyCode: Value, optional_args: &[Value]) -> Value {
6823 let mut checkBaseCoin = get_arg(optional_args, 0, Value::Bool(false));
6824 let mut existingCurrencies = get_arg(optional_args, 1, Value::Null);
6825 let mut leverageSuffixes: Value = Value::List(vec![Value::Str("2L".to_string()), Value::Str("2S".to_string()), Value::Str("3L".to_string()), Value::Str("3S".to_string()), Value::Str("4L".to_string()), Value::Str("4S".to_string()), Value::Str("5L".to_string()), Value::Str("5S".to_string()), Value::Str("UP".to_string()), Value::Str("DOWN".to_string()), Value::Str("BULL".to_string()), Value::Str("BEAR".to_string())]);
6826 {
6827 let mut i: Value = Value::Int(0);
6828 let mut __for_first_137: bool = true;
6829 while { if !__for_first_137 { i = add(&i, &Value::Int(1)); } __for_first_137 = false; is_less_than(&i, &get_array_length(&leverageSuffixes)) } {
6830 let mut leverageSuffix: Value = get_value(&leverageSuffixes, &i);
6831 let mut leverageSuffix: Value = get_value(&leverageSuffixes, &i);
6832 let mut endsWithSuffix: bool = ends_with(¤cyCode, &leverageSuffix);
6833 if is_true(&endsWithSuffix) {
6834 if !is_true(&checkBaseCoin) {
6835 return Value::Bool(true);
6836 } else {
6837 let mut baseCurrencyCode: Value = replace_str(¤cyCode, &leverageSuffix, &Value::Str("".to_string()));
6839 if is_true(&(!is_equal(&existingCurrencies, &Value::Null))) && is_true(&(Value::Bool(in_op(&existingCurrencies, &baseCurrencyCode)))) {
6840 return Value::Bool(true);
6841 }
6842 }
6843 }
6844 }
6845 }
6846 return Value::Bool(false);
6847
6848 Value::Null
6849}
6850
6851 fn handle_withdraw_tag_and_params(&self, mut tag: Value, mut params: Value) -> Value {
6852 if is_true(&self.is_dictionary(tag.clone())) {
6853 params = self.extend(tag.clone(), &[params.clone()]);
6854 tag = Value::Null;
6855 }
6856 if is_equal(&tag, &Value::Null) {
6857 tag = self.safe_string_k(params.clone(), "tag", &[]);
6858 if !is_equal(&tag, &Value::Null) {
6859 params = self.omit(params.clone(), Value::Str("tag".to_string()), &[]);
6860 }
6861 }
6862 return Value::List(vec![tag.clone(), params.clone()]);
6863
6864 Value::Null
6865}
6866
6867 fn cost_to_precision(&self, mut symbol: Value, mut cost: Value) -> Value {
6868 if is_equal(&cost, &Value::Null) {
6869 return Value::Null;
6870 }
6871 let mut market: Value = self.market(symbol.clone());
6872 return self.decimal_to_precision(cost.clone(), Value::Int(crate::runtime::TRUNCATE), self.safe_string2(get_value(&market, &Value::Str("precision".to_string())), Value::Str("cost".to_string()), Value::Str("price".to_string()), &[]), &[self.precisionMode.clone(), self.paddingMode.clone()]);
6873
6874 Value::Null
6875}
6876
6877 fn price_to_precision(&self, mut symbol: Value, mut price: Value) -> Value {
6878 if is_equal(&price, &Value::Null) {
6879 return Value::Null;
6880 }
6881 let mut market: Value = self.market(symbol.clone());
6882 let mut result: Value = self.decimal_to_precision(price.clone(), Value::Int(crate::runtime::ROUND), get_value(&get_value(&market, &Value::Str("precision".to_string())), &Value::Str("price".to_string())), &[self.precisionMode.clone(), self.paddingMode.clone()]);
6883 if is_equal(&result, &Value::Str("0".to_string())) {
6884 panic!("{}", crate::exchange_errors::invalid_order(add(&add(&add(&add(&self.id, &Value::Str(" price of ".to_string())), &get_value(&market, &Value::Str("symbol".to_string()))), &Value::Str(" must be greater than minimum price precision of ".to_string())), &self.number_to_string(get_value(&get_value(&market, &Value::Str("precision".to_string())), &Value::Str("price".to_string()))))));
6885 }
6886 return result;
6887
6888 Value::Null
6889}
6890
6891 fn amount_to_precision(&self, mut symbol: Value, mut amount: Value) -> Value {
6892 if is_equal(&amount, &Value::Null) {
6893 return Value::Null;
6894 }
6895 let mut market: Value = self.market(symbol.clone());
6896 let mut result: Value = self.decimal_to_precision(amount.clone(), Value::Int(crate::runtime::TRUNCATE), get_value(&get_value(&market, &Value::Str("precision".to_string())), &Value::Str("amount".to_string())), &[self.precisionMode.clone(), self.paddingMode.clone()]);
6897 if is_equal(&result, &Value::Str("0".to_string())) {
6898 panic!("{}", crate::exchange_errors::invalid_order(add(&add(&add(&add(&self.id, &Value::Str(" amount of ".to_string())), &get_value(&market, &Value::Str("symbol".to_string()))), &Value::Str(" must be greater than minimum amount precision of ".to_string())), &self.number_to_string(get_value(&get_value(&market, &Value::Str("precision".to_string())), &Value::Str("amount".to_string()))))));
6899 }
6900 return result;
6901
6902 Value::Null
6903}
6904
6905 fn fee_to_precision(&self, mut symbol: Value, mut fee: Value) -> Value {
6906 if is_equal(&fee, &Value::Null) {
6907 return Value::Null;
6908 }
6909 let mut market: Value = self.market(symbol.clone());
6910 return self.decimal_to_precision(fee.clone(), Value::Int(crate::runtime::ROUND), get_value(&get_value(&market, &Value::Str("precision".to_string())), &Value::Str("price".to_string())), &[self.precisionMode.clone(), self.paddingMode.clone()]);
6911
6912 Value::Null
6913}
6914
6915 fn currency_to_precision(&self, mut code: Value, mut fee: Value, optional_args: &[Value]) -> Value {
6916 let mut networkCode = get_arg(optional_args, 0, Value::Null);
6917 if is_equal(&code, &Value::Null) {
6918 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" currencyToPrecision() requires a code argument".to_string()))));
6919 }
6920 let mut currency: Value = get_value(&self.currencies, &code);
6921 let mut precision: Value = self.safe_value_k(currency.clone(), "precision", &[]);
6922 if !is_equal(&networkCode, &Value::Null) {
6923 let mut networks: Value = self.safe_dict_k(currency.clone(), "networks", &[Value::Map({
6924 let mut m = indexmap::IndexMap::new();
6925 m
6926})]);
6927 let mut networkItem: Value = self.safe_dict(networks.clone(), networkCode.clone(), &[Value::Map({
6928 let mut m = indexmap::IndexMap::new();
6929 m
6930})]);
6931 precision = self.safe_value_k(networkItem.clone(), "precision", &[precision.clone()]);
6932 }
6933 if is_equal(&precision, &Value::Null) {
6934 return self.force_string(fee.clone());
6935 } else {
6936 let mut roundingMode: Value = self.safe_integer_k(self.options.clone(), "currencyToPrecisionRoundingMode", &[Value::Int(crate::runtime::ROUND)]);
6937 return self.decimal_to_precision(fee.clone(), roundingMode.clone(), precision.clone(), &[self.precisionMode.clone(), self.paddingMode.clone()]);
6938 }
6939
6940 Value::Null
6941}
6942
6943 fn force_string(&self, mut value: Value) -> Value {
6944 if !is_string(&value) {
6945 return self.number_to_string(value.clone());
6946 }
6947 return value;
6948
6949 Value::Null
6950}
6951
6952 fn is_tick_precision(&self) -> Value {
6953 return Value::Bool(is_equal(&self.precisionMode, &Value::Int(crate::runtime::TICK_SIZE)));
6954
6955 Value::Null
6956}
6957
6958 fn is_decimal_precision(&self) -> Value {
6959 return Value::Bool(is_equal(&self.precisionMode, &Value::Int(crate::runtime::DECIMAL_PLACES)));
6960
6961 Value::Null
6962}
6963
6964 fn is_significant_precision(&self) -> Value {
6965 return Value::Bool(is_equal(&self.precisionMode, &Value::Int(crate::runtime::SIGNIFICANT_DIGITS)));
6966
6967 Value::Null
6968}
6969
6970 fn safe_number(&self, mut obj: Value, mut key: Value, optional_args: &[Value]) -> Value {
6971 let mut defaultNumber = get_arg(optional_args, 0, Value::Null);
6972 let mut value: Value = self.safe_string(obj.clone(), key.clone(), &[]);
6973 return self.parse_number(value.clone(), &[defaultNumber.clone()]);
6974
6975 Value::Null
6976}
6977
6978 fn safe_number_n(&self, mut obj: Value, mut arr: Value, optional_args: &[Value]) -> Value {
6979 let mut defaultNumber = get_arg(optional_args, 0, Value::Null);
6980 let mut value: Value = self.safe_string_n(obj.clone(), arr.clone(), &[]);
6981 return self.parse_number(value.clone(), &[defaultNumber.clone()]);
6982
6983 Value::Null
6984}
6985
6986 fn parse_precision(&self, optional_args: &[Value]) -> Value {
6987 let mut precision = get_arg(optional_args, 0, Value::Null);
6988 if is_equal(&precision, &Value::Null) {
6995 return Value::Null;
6996 }
6997 let mut precisionNumber: Value = crate::runtime::parse_int(&precision);
6998 if is_equal(&precisionNumber, &Value::Int(0)) {
6999 return Value::Str("1".to_string());
7000 }
7001 if is_greater_than(&precisionNumber, &Value::Int(0)) {
7002 let mut parsedPrecision: Value = Value::Str("0.".to_string());
7003 {
7004 let mut i: Value = Value::Int(0);
7005 let mut __for_first_138: bool = true;
7006 while { if !__for_first_138 { i = add(&i, &Value::Int(1)); } __for_first_138 = false; is_less_than(&i, &subtract(&precisionNumber, &Value::Int(1))) } {
7007 parsedPrecision = add(&parsedPrecision, &Value::Str("0".to_string()));
7008 }
7009 }
7010 return add(&parsedPrecision, &Value::Str("1".to_string()));
7011 } else {
7012 let mut parsedPrecision: Value = Value::Str("1".to_string());
7013 {
7014 let mut i: Value = Value::Int(0);
7015 let mut __for_first_139: bool = true;
7016 while { if !__for_first_139 { i = add(&i, &Value::Int(1)); } __for_first_139 = false; is_less_than(&i, &subtract(&multiply(&precisionNumber, &negate(&Value::Int(1))), &Value::Int(1))) } {
7017 parsedPrecision = add(&parsedPrecision, &Value::Str("0".to_string()));
7018 }
7019 }
7020 return add(&parsedPrecision, &Value::Str("0".to_string()));
7021 }
7022
7023 Value::Null
7024}
7025
7026 fn integer_precision_to_amount(&self, mut precision: Value) -> Value {
7027 if is_equal(&precision, &Value::Null) {
7035 return Value::Null;
7036 }
7037 if is_true(&crate::precise::Precise::stringGe(&precision, &Value::Str("0".to_string()))) {
7038 return self.parse_precision(&[precision.clone()]);
7039 } else {
7040 let mut positivePrecisionString: Value = crate::precise::Precise::stringAbs(&precision);
7041 if is_equal(&positivePrecisionString, &Value::Null) {
7042 return Value::Null;
7043 }
7044 let mut positivePrecision: Value = crate::runtime::parse_int(&positivePrecisionString);
7045 let mut parsedPrecision: Value = Value::Str("1".to_string());
7046 {
7047 let mut i: Value = Value::Int(0);
7048 let mut __for_first_140: bool = true;
7049 while { if !__for_first_140 { i = add(&i, &Value::Int(1)); } __for_first_140 = false; is_less_than(&i, &subtract(&positivePrecision, &Value::Int(1))) } {
7050 parsedPrecision = add(&parsedPrecision, &Value::Str("0".to_string()));
7051 }
7052 }
7053 return add(&parsedPrecision, &Value::Str("0".to_string()));
7054 }
7055}
7056
7057 fn load_time_difference(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
7058 let mut params = get_arg(optional_args, 0, Value::Map({
7059 let mut m = indexmap::IndexMap::new();
7060 m
7061}));
7062 let mut serverTime: Value = self.fetch_time(&[params.clone()]).await;
7063 let mut after: Value = self.milliseconds();
7064 if is_equal(&serverTime, &Value::Null) {
7065 panic!("{}", crate::exchange_errors::exchange_error(add(&self.id, &Value::Str(" loadTimeDifference() missing serverTime".to_string()))));
7066 }
7067 add_element_to_object(&mut self.options, &Value::Str("timeDifference".to_string()), subtract(&after, &serverTime));
7068 return get_value(&self.options, &Value::Str("timeDifference".to_string()));
7069
7070 Value::Null
7071} }
7072
7073 fn implode_hostname(&self, mut url: Value) -> Value {
7074 return self.implode_params(url.clone(), Value::Map({
7075 let mut m = indexmap::IndexMap::new();
7076 m.insert("hostname".to_string(), self.hostname.clone());
7077 m
7078}));
7079
7080 Value::Null
7081}
7082
7083 fn fetch_market_leverage_tiers(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
7084 if let Some(__v) = self.dispatch_to_derived("fetch_market_leverage_tiers", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(symbol.clone()); __args.extend_from_slice(optional_args); __args }).await {
7086 if !matches!(__v, crate::Value::Null) { return __v; }
7087 }
7088
7089 let mut params = get_arg(optional_args, 0, Value::Map({
7090 let mut m = indexmap::IndexMap::new();
7091 m
7092}));
7093 if !is_equal(&get_value(&self.has, &Value::Str("fetchLeverageTiers".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchLeverageTiers".to_string())), &Value::Bool(false)) {
7094 let mut market: Value = self.market(symbol.clone());
7095 if !is_equal(&get_value(&market, &Value::Str("contract".to_string())), &Value::Bool(true)) {
7096 panic!("{}", crate::exchange_errors::bad_symbol(add(&self.id, &Value::Str(" fetchMarketLeverageTiers() supports contract markets only".to_string()))));
7097 }
7098 let mut tiers: Value = self.fetch_leverage_tiers(&[Value::List(vec![symbol.clone()])]).await;
7099 return self.safe_value(tiers.clone(), symbol.clone(), &[]);
7100 } else {
7101 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchMarketLeverageTiers() is not supported yet".to_string()))));
7102 }
7103
7104 Value::Null
7105} }
7106
7107 fn create_sub_account(&mut self, mut name: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
7108 let mut params = get_arg(optional_args, 0, Value::Map({
7109 let mut m = indexmap::IndexMap::new();
7110 m
7111}));
7112 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createSubAccount() is not supported yet".to_string()))));
7113
7114 Value::Null
7115} }
7116
7117 fn safe_currency_code(&self, mut currencyId: Value, optional_args: &[Value]) -> Value {
7118 let mut currency = get_arg(optional_args, 0, Value::Null);
7119 currency = self.safe_currency(currencyId.clone(), &[currency.clone()]);
7120 return get_value(¤cy, &Value::Str("code".to_string()));
7121
7122 Value::Null
7123}
7124
7125 fn filter_by_symbol_since_limit(&self, mut array: Value, optional_args: &[Value]) -> Value {
7126 let mut symbol = get_arg(optional_args, 0, Value::Null);
7127 let mut since = get_arg(optional_args, 1, Value::Null);
7128 let mut limit = get_arg(optional_args, 2, Value::Null);
7129 let mut tail = get_arg(optional_args, 3, Value::Bool(false));
7130 return self.filter_by_value_since_limit(array.clone(), Value::Str("symbol".to_string()), &[symbol.clone(), since.clone(), limit.clone(), Value::Str("timestamp".to_string()), tail.clone()]);
7131
7132 Value::Null
7133}
7134
7135 fn filter_by_currency_since_limit(&self, mut array: Value, optional_args: &[Value]) -> Value {
7136 let mut code = get_arg(optional_args, 0, Value::Null);
7137 let mut since = get_arg(optional_args, 1, Value::Null);
7138 let mut limit = get_arg(optional_args, 2, Value::Null);
7139 let mut tail = get_arg(optional_args, 3, Value::Bool(false));
7140 return self.filter_by_value_since_limit(array.clone(), Value::Str("currency".to_string()), &[code.clone(), since.clone(), limit.clone(), Value::Str("timestamp".to_string()), tail.clone()]);
7141
7142 Value::Null
7143}
7144
7145 fn filter_by_symbols_since_limit(&self, mut array: Value, optional_args: &[Value]) -> Value {
7146 let mut symbols = get_arg(optional_args, 0, Value::Null);
7147 let mut since = get_arg(optional_args, 1, Value::Null);
7148 let mut limit = get_arg(optional_args, 2, Value::Null);
7149 let mut tail = get_arg(optional_args, 3, Value::Bool(false));
7150 let mut result: Value = self.filter_by_array(array.clone(), Value::Str("symbol".to_string()), &[symbols.clone(), Value::Bool(false)]);
7151 return self.filter_by_since_limit(result.clone(), &[since.clone(), limit.clone(), Value::Str("timestamp".to_string()), tail.clone()]);
7152
7153 Value::Null
7154}
7155
7156 fn parse_last_prices(&self, mut pricesData: Value, optional_args: &[Value]) -> Value {
7157 let mut symbols = get_arg(optional_args, 0, Value::Null);
7158 let mut params = get_arg(optional_args, 1, Value::Map({
7159 let mut m = indexmap::IndexMap::new();
7160 m
7161}));
7162 let mut results: Value = Value::List(vec![]);
7182 if is_true(&Value::Bool(is_array(&pricesData))) {
7183 {
7184 let mut i: Value = Value::Int(0);
7185 let mut __for_first_141: bool = true;
7186 while { if !__for_first_141 { i = add(&i, &Value::Int(1)); } __for_first_141 = false; is_less_than(&i, &get_array_length(&pricesData)) } {
7187 let mut priceData: Value = self.extend(<Self as crate::exchange_generated::ExchangeBase>::parse_last_price(self, get_value(&pricesData, &i), &[]), &[params.clone()]);
7188 append_to_array(&mut results, priceData.clone());
7189 }
7190 }
7191 } else {
7192 let mut marketIds: Value = object_keys(&pricesData);
7193 {
7194 let mut i: Value = Value::Int(0);
7195 let mut __for_first_142: bool = true;
7196 while { if !__for_first_142 { i = add(&i, &Value::Int(1)); } __for_first_142 = false; is_less_than(&i, &get_array_length(&marketIds)) } {
7197 let mut marketId: Value = get_value(&marketIds, &i);
7198 let mut marketId: Value = get_value(&marketIds, &i);
7199 let mut market: Value = self.safe_market(&[marketId.clone()]);
7200 let mut priceData: Value = self.extend(<Self as crate::exchange_generated::ExchangeBase>::parse_last_price(self, get_value(&pricesData, &marketId), &[market.clone()]), &[params.clone()]);
7201 append_to_array(&mut results, priceData.clone());
7202 }
7203 }
7204 }
7205 symbols = self.market_symbols(&[symbols.clone()]);
7206 return self.filter_by_array(results.clone(), Value::Str("symbol".to_string()), &[symbols.clone()]);
7207
7208 Value::Null
7209}
7210
7211 fn parse_tickers(&self, mut tickers: Value, optional_args: &[Value]) -> Value {
7212 let mut symbols = get_arg(optional_args, 0, Value::Null);
7213 let mut params = get_arg(optional_args, 1, Value::Map({
7214 let mut m = indexmap::IndexMap::new();
7215 m
7216}));
7217 let mut results: Value = Value::List(vec![]);
7240 if is_true(&Value::Bool(is_array(&tickers))) {
7241 {
7242 let mut i: Value = Value::Int(0);
7243 let mut __for_first_143: bool = true;
7244 while { if !__for_first_143 { i = add(&i, &Value::Int(1)); } __for_first_143 = false; is_less_than(&i, &get_array_length(&tickers)) } {
7245 let mut parsedTicker: Value = <Self as crate::exchange_generated::ExchangeBase>::parse_ticker(self, get_value(&tickers, &i), &[]);
7246 let mut ticker: Value = self.extend(parsedTicker.clone(), &[params.clone()]);
7247 append_to_array(&mut results, ticker.clone());
7248 }
7249 }
7250 } else {
7251 let mut marketIds: Value = object_keys(&tickers);
7252 {
7253 let mut i: Value = Value::Int(0);
7254 let mut __for_first_144: bool = true;
7255 while { if !__for_first_144 { i = add(&i, &Value::Int(1)); } __for_first_144 = false; is_less_than(&i, &get_array_length(&marketIds)) } {
7256 let mut marketId: Value = get_value(&marketIds, &i);
7257 let mut marketId: Value = get_value(&marketIds, &i);
7258 let mut market: Value = self.safe_market(&[marketId.clone()]);
7259 let mut parsed: Value = <Self as crate::exchange_generated::ExchangeBase>::parse_ticker(self, get_value(&tickers, &marketId), &[market.clone()]);
7260 let mut ticker: Value = self.extend(parsed.clone(), &[params.clone()]);
7261 append_to_array(&mut results, ticker.clone());
7262 }
7263 }
7264 }
7265 symbols = self.market_symbols(&[symbols.clone()]);
7266 return self.filter_by_array(results.clone(), Value::Str("symbol".to_string()), &[symbols.clone()]);
7267
7268 Value::Null
7269}
7270
7271 fn parse_deposit_addresses(&self, mut addresses: Value, optional_args: &[Value]) -> Value {
7272 let mut codes = get_arg(optional_args, 0, Value::Null);
7273 let mut indexed = get_arg(optional_args, 1, Value::Bool(true));
7274 let mut params = get_arg(optional_args, 2, Value::Map({
7275 let mut m = indexmap::IndexMap::new();
7276 m
7277}));
7278 let mut result: Value = Value::List(vec![]);
7279 {
7280 let mut i: Value = Value::Int(0);
7281 let mut __for_first_145: bool = true;
7282 while { if !__for_first_145 { i = add(&i, &Value::Int(1)); } __for_first_145 = false; is_less_than(&i, &get_array_length(&addresses)) } {
7283 let mut address: Value = self.extend(<Self as crate::exchange_generated::ExchangeBase>::parse_deposit_address(self, get_value(&addresses, &i), &[]), &[params.clone()]);
7284 append_to_array(&mut result, address.clone());
7285 }
7286 }
7287 if !is_equal(&codes, &Value::Null) {
7288 result = self.filter_by_array(result.clone(), Value::Str("currency".to_string()), &[codes.clone(), Value::Bool(false)]);
7289 }
7290 if is_true(&indexed) {
7291 result = self.filter_by_array(result.clone(), Value::Str("currency".to_string()), &[Value::Null, indexed.clone()]);
7292 }
7293 return result;
7294
7295 Value::Null
7296}
7297
7298 fn parse_borrow_interests(&self, mut response: Value, optional_args: &[Value]) -> Value {
7299 let mut market = get_arg(optional_args, 0, Value::Null);
7300 let mut interests: Value = Value::List(vec![]);
7301 {
7302 let mut i: Value = Value::Int(0);
7303 let mut __for_first_146: bool = true;
7304 while { if !__for_first_146 { i = add(&i, &Value::Int(1)); } __for_first_146 = false; is_less_than(&i, &get_array_length(&response)) } {
7305 let mut row: Value = get_value(&response, &i);
7306 let mut row: Value = get_value(&response, &i);
7307 append_to_array(&mut interests, <Self as crate::exchange_generated::ExchangeBase>::parse_borrow_interest(self, row.clone(), &[market.clone()]));
7308 }
7309 }
7310 return interests;
7311
7312 Value::Null
7313}
7314
7315 fn parse_borrow_rate(&self, mut info: Value, optional_args: &[Value]) -> Value {
7316 { let __v = crate::exchange::DerivedExchange::parse_borrow_rate(self, info.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
7318
7319 let mut currency = get_arg(optional_args, 0, Value::Null);
7320 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseBorrowRate() is not supported yet".to_string()))));
7321
7322 Value::Null
7323}
7324
7325 fn parse_borrow_rate_history(&self, mut response: Value, mut code: Value, mut since: Value, mut limit: Value) -> Value {
7326 let mut result: Value = Value::List(vec![]);
7327 {
7328 let mut i: Value = Value::Int(0);
7329 let mut __for_first_147: bool = true;
7330 while { if !__for_first_147 { i = add(&i, &Value::Int(1)); } __for_first_147 = false; is_less_than(&i, &get_array_length(&response)) } {
7331 let mut item: Value = get_value(&response, &i);
7332 let mut item: Value = get_value(&response, &i);
7333 let mut borrowRate: Value = <Self as crate::exchange_generated::ExchangeBase>::parse_borrow_rate(self, item.clone(), &[]);
7334 append_to_array(&mut result, borrowRate.clone());
7335 }
7336 }
7337 let mut sorted: Value = self.sort_by(result.clone(), Value::Str("timestamp".to_string()), &[]);
7338 return self.filter_by_currency_since_limit(sorted.clone(), &[code.clone(), since.clone(), limit.clone()]);
7339
7340 Value::Null
7341}
7342
7343 fn parse_isolated_borrow_rates(&self, mut info: Value) -> Value {
7344 let mut result: Value = Value::Map({
7345 let mut m = indexmap::IndexMap::new();
7346 m
7347 });
7348 {
7349 let mut i: Value = Value::Int(0);
7350 let mut __for_first_148: bool = true;
7351 while { if !__for_first_148 { i = add(&i, &Value::Int(1)); } __for_first_148 = false; is_less_than(&i, &get_array_length(&info)) } {
7352 let mut item: Value = get_value(&info, &i);
7353 let mut item: Value = get_value(&info, &i);
7354 let mut borrowRate: Value = self.parse_isolated_borrow_rate(item.clone(), &[]);
7355 let mut symbol: Value = self.safe_string_k(borrowRate.clone(), "symbol", &[]);
7356 add_element_to_object(&mut result, &symbol, borrowRate.clone());
7357 }
7358 }
7359 return result;
7360
7361 Value::Null
7362}
7363
7364 fn parse_funding_rate_histories(&self, mut response: Value, optional_args: &[Value]) -> Value {
7365 let mut market = get_arg(optional_args, 0, Value::Null);
7366 let mut since = get_arg(optional_args, 1, Value::Null);
7367 let mut limit = get_arg(optional_args, 2, Value::Null);
7368 let mut rates: Value = Value::List(vec![]);
7369 {
7370 let mut i: Value = Value::Int(0);
7371 let mut __for_first_149: bool = true;
7372 while { if !__for_first_149 { i = add(&i, &Value::Int(1)); } __for_first_149 = false; is_less_than(&i, &get_array_length(&response)) } {
7373 let mut entry: Value = get_value(&response, &i);
7374 let mut entry: Value = get_value(&response, &i);
7375 append_to_array(&mut rates, <Self as crate::exchange_generated::ExchangeBase>::parse_funding_rate_history(self, entry.clone(), &[market.clone()]));
7376 }
7377 }
7378 let mut sorted: Value = self.sort_by(rates.clone(), Value::Str("timestamp".to_string()), &[]);
7379 let mut symbol: Value = ternary(is_true(&(is_equal(&market, &Value::Null))), Value::Null, get_value(&market, &Value::Str("symbol".to_string())));
7380 return self.filter_by_symbol_since_limit(sorted.clone(), &[symbol.clone(), since.clone(), limit.clone()]);
7381
7382 Value::Null
7383}
7384
7385 fn safe_symbol(&self, mut marketId: Value, optional_args: &[Value]) -> Value {
7386 let mut market = get_arg(optional_args, 0, Value::Null);
7387 let mut delimiter = get_arg(optional_args, 1, Value::Null);
7388 let mut marketType = get_arg(optional_args, 2, Value::Null);
7389 market = self.safe_market(&[marketId.clone(), market.clone(), delimiter.clone(), marketType.clone()]);
7390 return get_value(&market, &Value::Str("symbol".to_string()));
7391
7392 Value::Null
7393}
7394
7395 fn parse_funding_rate(&self, mut contract: Value, optional_args: &[Value]) -> Value {
7396 { let __v = crate::exchange::DerivedExchange::parse_funding_rate(self, contract.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
7398
7399 let mut market = get_arg(optional_args, 0, Value::Null);
7400 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseFundingRate() is not supported yet".to_string()))));
7401
7402 Value::Null
7403}
7404
7405 fn parse_funding_rates(&self, mut response: Value, optional_args: &[Value]) -> Value {
7406 let mut symbols = get_arg(optional_args, 0, Value::Null);
7407 let mut fundingRates: Value = Value::Map({
7408 let mut m = indexmap::IndexMap::new();
7409 m
7410 });
7411 {
7412 let mut i: Value = Value::Int(0);
7413 let mut __for_first_150: bool = true;
7414 while { if !__for_first_150 { i = add(&i, &Value::Int(1)); } __for_first_150 = false; is_less_than(&i, &get_array_length(&response)) } {
7415 let mut entry: Value = get_value(&response, &i);
7416 let mut entry: Value = get_value(&response, &i);
7417 let mut parsed: Value = <Self as crate::exchange_generated::ExchangeBase>::parse_funding_rate(self, entry.clone(), &[]);
7418 if !is_equal(&get_value(&parsed, &Value::Str("symbol".to_string())), &Value::Null) {
7419 add_element_to_object(&mut fundingRates, &get_value(&parsed, &Value::Str("symbol".to_string())), parsed.clone());
7420 }
7421 }
7422 }
7423 return self.filter_by_array(fundingRates.clone(), Value::Str("symbol".to_string()), &[symbols.clone()]);
7424
7425 Value::Null
7426}
7427
7428 fn parse_long_short_ratio(&self, mut info: Value, optional_args: &[Value]) -> Value {
7429 let mut market = get_arg(optional_args, 0, Value::Null);
7430 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseLongShortRatio() is not supported yet".to_string()))));
7431
7432 Value::Null
7433}
7434
7435 fn parse_long_short_ratio_history(&self, mut response: Value, optional_args: &[Value]) -> Value {
7436 let mut market = get_arg(optional_args, 0, Value::Null);
7437 let mut since = get_arg(optional_args, 1, Value::Null);
7438 let mut limit = get_arg(optional_args, 2, Value::Null);
7439 let mut rates: Value = Value::List(vec![]);
7440 {
7441 let mut i: Value = Value::Int(0);
7442 let mut __for_first_151: bool = true;
7443 while { if !__for_first_151 { i = add(&i, &Value::Int(1)); } __for_first_151 = false; is_less_than(&i, &get_array_length(&response)) } {
7444 let mut entry: Value = get_value(&response, &i);
7445 let mut entry: Value = get_value(&response, &i);
7446 append_to_array(&mut rates, self.parse_long_short_ratio(entry.clone(), &[market.clone()]));
7447 }
7448 }
7449 let mut sorted: Value = self.sort_by(rates.clone(), Value::Str("timestamp".to_string()), &[]);
7450 let mut symbol: Value = ternary(is_true(&(is_equal(&market, &Value::Null))), Value::Null, get_value(&market, &Value::Str("symbol".to_string())));
7451 return self.filter_by_symbol_since_limit(sorted.clone(), &[symbol.clone(), since.clone(), limit.clone()]);
7452
7453 Value::Null
7454}
7455
7456 fn handle_trigger_prices_and_params(&self, mut symbol: Value, mut params: Value, optional_args: &[Value]) -> Value {
7457 let mut omitParams = get_arg(optional_args, 0, Value::Bool(true));
7458 let mut triggerPrice: Value = self.safe_string2(params.clone(), Value::Str("triggerPrice".to_string()), Value::Str("stopPrice".to_string()), &[]);
7460 let mut triggerPriceStr: Value = Value::Null;
7461 let mut stopLossPrice: Value = self.safe_string_k(params.clone(), "stopLossPrice", &[]);
7462 let mut stopLossPriceStr: Value = Value::Null;
7463 let mut takeProfitPrice: Value = self.safe_string_k(params.clone(), "takeProfitPrice", &[]);
7464 let mut takeProfitPriceStr: Value = Value::Null;
7465 if !is_equal(&triggerPrice, &Value::Null) {
7467 if is_true(&omitParams) {
7468 params = self.omit(params.clone(), Value::List(vec![Value::Str("triggerPrice".to_string()), Value::Str("stopPrice".to_string())]), &[]);
7469 }
7470 triggerPriceStr = self.price_to_precision(symbol.clone(), crate::runtime::parse_float(&triggerPrice));
7471 }
7472 if !is_equal(&stopLossPrice, &Value::Null) {
7473 if is_true(&omitParams) {
7474 params = self.omit(params.clone(), Value::Str("stopLossPrice".to_string()), &[]);
7475 }
7476 stopLossPriceStr = self.price_to_precision(symbol.clone(), crate::runtime::parse_float(&stopLossPrice));
7477 }
7478 if !is_equal(&takeProfitPrice, &Value::Null) {
7479 if is_true(&omitParams) {
7480 params = self.omit(params.clone(), Value::Str("takeProfitPrice".to_string()), &[]);
7481 }
7482 takeProfitPriceStr = self.price_to_precision(symbol.clone(), crate::runtime::parse_float(&takeProfitPrice));
7483 }
7484 return Value::List(vec![triggerPriceStr.clone(), stopLossPriceStr.clone(), takeProfitPriceStr.clone(), params.clone()]);
7485
7486 Value::Null
7487}
7488
7489 fn handle_trigger_direction_and_params(&self, mut params: Value, optional_args: &[Value]) -> Value {
7490 let mut exchangeSpecificKey = get_arg(optional_args, 0, Value::Null);
7491 let mut allowEmpty = get_arg(optional_args, 1, Value::Bool(false));
7492 let mut triggerDirection: Value = self.safe_string_k(params.clone(), "triggerDirection", &[]);
7498 let mut exchangeSpecificDefined: bool = is_true(&(!is_equal(&exchangeSpecificKey, &Value::Null))) && is_true(&(Value::Bool(in_op(¶ms, &exchangeSpecificKey))));
7499 if !is_equal(&triggerDirection, &Value::Null) {
7500 params = self.omit(params.clone(), Value::Str("triggerDirection".to_string()), &[]);
7501 }
7502 if !is_true(&self.in_array(triggerDirection.clone(), Value::List(vec![Value::Str("ascending".to_string()), Value::Str("descending".to_string()), Value::Str("up".to_string()), Value::Str("down".to_string()), Value::Str("above".to_string()), Value::Str("below".to_string())]))) && !is_true(&exchangeSpecificDefined) && !is_true(&allowEmpty) {
7506 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" createOrder() : trigger orders require params[\"triggerDirection\"] to be either \"ascending\" or \"descending\"".to_string()))));
7507 }
7508 if is_equal(&triggerDirection, &Value::Str("up".to_string())) || is_equal(&triggerDirection, &Value::Str("above".to_string())) {
7510 triggerDirection = Value::Str("ascending".to_string());
7511 } else if is_equal(&triggerDirection, &Value::Str("down".to_string())) || is_equal(&triggerDirection, &Value::Str("below".to_string())) {
7512 triggerDirection = Value::Str("descending".to_string());
7513 }
7514 return Value::List(vec![triggerDirection.clone(), params.clone()]);
7515
7516 Value::Null
7517}
7518
7519 fn handle_trigger_and_params(&self, mut params: Value) -> Value {
7520 let mut isTrigger: Value = self.safe_bool2(params.clone(), Value::Str("trigger".to_string()), Value::Str("stop".to_string()), &[]);
7521 if is_equal(&isTrigger, &Value::Bool(true)) {
7522 params = self.omit(params.clone(), Value::List(vec![Value::Str("trigger".to_string()), Value::Str("stop".to_string())]), &[]);
7523 }
7524 return Value::List(vec![isTrigger.clone(), params.clone()]);
7525
7526 Value::Null
7527}
7528
7529 fn is_trigger_order(&self, mut params: Value) -> Value {
7530 return self.handle_trigger_and_params(params.clone());
7531
7532 Value::Null
7533}
7534
7535 fn is_post_only(&self, mut isMarketOrder: Value, mut exchangeSpecificParam: Value, optional_args: &[Value]) -> Value {
7536 let mut params = get_arg(optional_args, 0, Value::Map({
7537 let mut m = indexmap::IndexMap::new();
7538 m
7539}));
7540 let mut timeInForce: Value = self.safe_string_upper(params.clone(), Value::Str("timeInForce".to_string()), &[]);
7549 let mut postOnly: Value = self.safe_bool2(params.clone(), Value::Str("postOnly".to_string()), Value::Str("post_only".to_string()), &[Value::Bool(false)]);
7550 let mut ioc: bool = is_equal(&timeInForce, &Value::Str("IOC".to_string()));
7552 let mut fok: bool = is_equal(&timeInForce, &Value::Str("FOK".to_string()));
7553 let mut timeInForcePostOnly: Value = Value::Bool(is_equal(&timeInForce, &Value::Str("PO".to_string())));
7554 if !is_equal(&postOnly, &Value::Bool(true)) {
7555 postOnly = timeInForcePostOnly.clone();
7556 }
7557 if !is_equal(&postOnly, &Value::Bool(true)) {
7558 postOnly = exchangeSpecificParam.clone();
7559 }
7560 if is_equal(&postOnly, &Value::Bool(true)) {
7561 if is_true(&ioc) || is_true(&fok) {
7562 panic!("{}", crate::exchange_errors::invalid_order(add(&add(&self.id, &Value::Str(" postOnly orders cannot have timeInForce equal to ".to_string())), &timeInForce)));
7563 } else if is_true(&isMarketOrder) {
7564 panic!("{}", crate::exchange_errors::invalid_order(add(&self.id, &Value::Str(" market orders cannot be postOnly".to_string()))));
7565 } else {
7566 return Value::Bool(true);
7567 }
7568 } else {
7569 return Value::Bool(false);
7570 }
7571
7572 Value::Null
7573}
7574
7575 fn handle_post_only(&self, mut isMarketOrder: Value, mut exchangeSpecificPostOnlyOption: Value, optional_args: &[Value]) -> Value {
7576 let mut params = get_arg(optional_args, 0, Value::Map({
7577 let mut m = indexmap::IndexMap::new();
7578 m
7579}));
7580 let mut timeInForce: Value = self.safe_string_upper(params.clone(), Value::Str("timeInForce".to_string()), &[]);
7589 let mut postOnly: Value = self.safe_bool_k(params.clone(), "postOnly", &[Value::Bool(false)]);
7590 let mut ioc: bool = is_equal(&timeInForce, &Value::Str("IOC".to_string()));
7591 let mut fok: bool = is_equal(&timeInForce, &Value::Str("FOK".to_string()));
7592 let mut po: Value = Value::Bool(is_equal(&timeInForce, &Value::Str("PO".to_string())));
7593 if !is_equal(&postOnly, &Value::Bool(true)) {
7594 postOnly = po.clone();
7595 }
7596 if !is_equal(&postOnly, &Value::Bool(true)) {
7597 postOnly = exchangeSpecificPostOnlyOption.clone();
7598 }
7599 if is_equal(&postOnly, &Value::Bool(true)) {
7600 if is_true(&ioc) || is_true(&fok) {
7601 panic!("{}", crate::exchange_errors::invalid_order(add(&add(&self.id, &Value::Str(" postOnly orders cannot have timeInForce equal to ".to_string())), &timeInForce)));
7602 } else if is_true(&isMarketOrder) {
7603 panic!("{}", crate::exchange_errors::invalid_order(add(&self.id, &Value::Str(" market orders cannot be postOnly".to_string()))));
7604 } else {
7605 if is_true(&po) {
7606 params = self.omit(params.clone(), Value::Str("timeInForce".to_string()), &[]);
7607 }
7608 params = self.omit(params.clone(), Value::Str("postOnly".to_string()), &[]);
7609 return Value::List(vec![Value::Bool(true), params.clone()]);
7610 }
7611 }
7612 return Value::List(vec![Value::Bool(false), params.clone()]);
7613
7614 Value::Null
7615}
7616
7617 fn fetch_last_prices(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
7618 let mut symbols = get_arg(optional_args, 0, Value::Null);
7619 let mut params = get_arg(optional_args, 1, Value::Map({
7620 let mut m = indexmap::IndexMap::new();
7621 m
7622}));
7623 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchLastPrices() is not supported yet".to_string()))));
7624
7625 Value::Null
7626} }
7627
7628 fn fetch_trading_fees(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
7629 if let Some(__v) = self.dispatch_to_derived("fetch_trading_fees", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
7631 if !matches!(__v, crate::Value::Null) { return __v; }
7632 }
7633
7634 let mut params = get_arg(optional_args, 0, Value::Map({
7635 let mut m = indexmap::IndexMap::new();
7636 m
7637}));
7638 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchTradingFees() is not supported yet".to_string()))));
7639
7640 Value::Null
7641} }
7642
7643 fn fetch_trading_fees_ws(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
7644 let mut params = get_arg(optional_args, 0, Value::Map({
7645 let mut m = indexmap::IndexMap::new();
7646 m
7647}));
7648 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchTradingFeesWs() is not supported yet".to_string()))));
7649
7650 Value::Null
7651} }
7652
7653 fn fetch_convert_currencies(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
7654 let mut params = get_arg(optional_args, 0, Value::Map({
7655 let mut m = indexmap::IndexMap::new();
7656 m
7657}));
7658 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchConvertCurrencies() is not supported yet".to_string()))));
7659
7660 Value::Null
7661} }
7662
7663 fn parse_open_interest(&self, mut interest: Value, optional_args: &[Value]) -> Value {
7664 { let __v = crate::exchange::DerivedExchange::parse_open_interest(self, interest.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
7666
7667 let mut market = get_arg(optional_args, 0, Value::Null);
7668 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseOpenInterest () is not supported yet".to_string()))));
7669
7670 Value::Null
7671}
7672
7673 fn parse_open_interests(&self, mut response: Value, optional_args: &[Value]) -> Value {
7674 let mut symbols = get_arg(optional_args, 0, Value::Null);
7675 let mut result: Value = Value::Map({
7676 let mut m = indexmap::IndexMap::new();
7677 m
7678 });
7679 {
7680 let mut i: Value = Value::Int(0);
7681 let mut __for_first_152: bool = true;
7682 while { if !__for_first_152 { i = add(&i, &Value::Int(1)); } __for_first_152 = false; is_less_than(&i, &get_array_length(&response)) } {
7683 let mut entry: Value = get_value(&response, &i);
7684 let mut entry: Value = get_value(&response, &i);
7685 let mut parsed: Value = <Self as crate::exchange_generated::ExchangeBase>::parse_open_interest(self, entry.clone(), &[]);
7686 if !is_equal(&get_value(&parsed, &Value::Str("symbol".to_string())), &Value::Null) {
7687 add_element_to_object(&mut result, &get_value(&parsed, &Value::Str("symbol".to_string())), parsed.clone());
7688 }
7689 }
7690 }
7691 return self.filter_by_array(result.clone(), Value::Str("symbol".to_string()), &[symbols.clone()]);
7692
7693 Value::Null
7694}
7695
7696 fn parse_open_interests_history(&self, mut response: Value, optional_args: &[Value]) -> Value {
7697 let mut market = get_arg(optional_args, 0, Value::Null);
7698 let mut since = get_arg(optional_args, 1, Value::Null);
7699 let mut limit = get_arg(optional_args, 2, Value::Null);
7700 let mut interests: Value = Value::List(vec![]);
7701 {
7702 let mut i: Value = Value::Int(0);
7703 let mut __for_first_153: bool = true;
7704 while { if !__for_first_153 { i = add(&i, &Value::Int(1)); } __for_first_153 = false; is_less_than(&i, &get_array_length(&response)) } {
7705 let mut entry: Value = get_value(&response, &i);
7706 let mut entry: Value = get_value(&response, &i);
7707 let mut interest: Value = <Self as crate::exchange_generated::ExchangeBase>::parse_open_interest(self, entry.clone(), &[market.clone()]);
7708 append_to_array(&mut interests, interest.clone());
7709 }
7710 }
7711 let mut sorted: Value = self.sort_by(interests.clone(), Value::Str("timestamp".to_string()), &[]);
7712 let mut symbol: Value = self.safe_string_k(market.clone(), "symbol", &[]);
7713 return self.filter_by_symbol_since_limit(sorted.clone(), &[symbol.clone(), since.clone(), limit.clone()]);
7714
7715 Value::Null
7716}
7717
7718 fn fetch_funding_rate(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
7719 if let Some(__v) = self.dispatch_to_derived("fetch_funding_rate", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(symbol.clone()); __args.extend_from_slice(optional_args); __args }).await {
7721 if !matches!(__v, crate::Value::Null) { return __v; }
7722 }
7723
7724 let mut params = get_arg(optional_args, 0, Value::Map({
7725 let mut m = indexmap::IndexMap::new();
7726 m
7727}));
7728 if !is_equal(&get_value(&self.has, &Value::Str("fetchFundingRates".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchFundingRates".to_string())), &Value::Bool(false)) {
7729 self.load_markets(&[]).await;
7730 let mut market: Value = self.market(symbol.clone());
7731 symbol = get_value(&market, &Value::Str("symbol".to_string()));
7732 if !is_equal(&get_value(&market, &Value::Str("contract".to_string())), &Value::Bool(true)) {
7733 panic!("{}", crate::exchange_errors::bad_symbol(add(&self.id, &Value::Str(" fetchFundingRate() supports contract markets only".to_string()))));
7734 }
7735 let mut rates: Value = self.fetch_funding_rates(&[Value::List(vec![symbol.clone()]), params.clone()]).await;
7736 let mut rate: Value = self.safe_value(rates.clone(), symbol.clone(), &[]);
7737 if is_equal(&rate, &Value::Null) {
7738 panic!("{}", crate::exchange_errors::null_response(add(&add(&self.id, &Value::Str(" fetchFundingRate () returned no data for ".to_string())), &symbol)));
7739 } else {
7740 return rate;
7741 }
7742 } else {
7743 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchFundingRate () is not supported yet".to_string()))));
7744 }
7745
7746 Value::Null
7747} }
7748
7749 fn fetch_funding_interval(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
7750 if let Some(__v) = self.dispatch_to_derived("fetch_funding_interval", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(symbol.clone()); __args.extend_from_slice(optional_args); __args }).await {
7752 if !matches!(__v, crate::Value::Null) { return __v; }
7753 }
7754
7755 let mut params = get_arg(optional_args, 0, Value::Map({
7756 let mut m = indexmap::IndexMap::new();
7757 m
7758}));
7759 if !is_equal(&get_value(&self.has, &Value::Str("fetchFundingIntervals".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchFundingIntervals".to_string())), &Value::Bool(false)) {
7760 self.load_markets(&[]).await;
7761 let mut market: Value = self.market(symbol.clone());
7762 symbol = get_value(&market, &Value::Str("symbol".to_string()));
7763 if !is_equal(&get_value(&market, &Value::Str("contract".to_string())), &Value::Bool(true)) {
7764 panic!("{}", crate::exchange_errors::bad_symbol(add(&self.id, &Value::Str(" fetchFundingInterval() supports contract markets only".to_string()))));
7765 }
7766 let mut rates: Value = self.fetch_funding_intervals(&[Value::List(vec![symbol.clone()]), params.clone()]).await;
7767 let mut rate: Value = self.safe_value(rates.clone(), symbol.clone(), &[]);
7768 if is_equal(&rate, &Value::Null) {
7769 panic!("{}", crate::exchange_errors::null_response(add(&add(&self.id, &Value::Str(" fetchFundingInterval() returned no data for ".to_string())), &symbol)));
7770 } else {
7771 return rate;
7772 }
7773 } else {
7774 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchFundingInterval() is not supported yet".to_string()))));
7775 }
7776
7777 Value::Null
7778} }
7779
7780 fn fetch_mark_ohlcv(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
7781 let mut timeframe = get_arg(optional_args, 0, Value::Str("1m".to_string()));
7782 let mut since = get_arg(optional_args, 1, Value::Null);
7783 let mut limit = get_arg(optional_args, 2, Value::Null);
7784 let mut params = get_arg(optional_args, 3, Value::Map({
7785 let mut m = indexmap::IndexMap::new();
7786 m
7787}));
7788 if !is_equal(&get_value(&self.has, &Value::Str("fetchMarkOHLCV".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchMarkOHLCV".to_string())), &Value::Bool(false)) {
7800 let mut request: Value = Value::Map({
7801 let mut m = indexmap::IndexMap::new();
7802 m.insert("price".to_string(), Value::Str("mark".to_string()));
7803 m
7804 });
7805 return self.fetch_ohlcv(symbol.clone(), &[timeframe.clone(), since.clone(), limit.clone(), self.extend(request.clone(), &[params.clone()])]).await;
7806 } else {
7807 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchMarkOHLCV () is not supported yet".to_string()))));
7808 }
7809} }
7810
7811 fn fetch_index_ohlcv(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
7812 let mut timeframe = get_arg(optional_args, 0, Value::Str("1m".to_string()));
7813 let mut since = get_arg(optional_args, 1, Value::Null);
7814 let mut limit = get_arg(optional_args, 2, Value::Null);
7815 let mut params = get_arg(optional_args, 3, Value::Map({
7816 let mut m = indexmap::IndexMap::new();
7817 m
7818}));
7819 if !is_equal(&get_value(&self.has, &Value::Str("fetchIndexOHLCV".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchIndexOHLCV".to_string())), &Value::Bool(false)) {
7831 let mut request: Value = Value::Map({
7832 let mut m = indexmap::IndexMap::new();
7833 m.insert("price".to_string(), Value::Str("index".to_string()));
7834 m
7835 });
7836 return self.fetch_ohlcv(symbol.clone(), &[timeframe.clone(), since.clone(), limit.clone(), self.extend(request.clone(), &[params.clone()])]).await;
7837 } else {
7838 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchIndexOHLCV () is not supported yet".to_string()))));
7839 }
7840} }
7841
7842 fn fetch_premium_index_ohlcv(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
7843 if let Some(__v) = self.dispatch_to_derived("fetch_premium_index_ohlcv", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(symbol.clone()); __args.extend_from_slice(optional_args); __args }).await {
7845 if !matches!(__v, crate::Value::Null) { return __v; }
7846 }
7847
7848 let mut timeframe = get_arg(optional_args, 0, Value::Str("1m".to_string()));
7849 let mut since = get_arg(optional_args, 1, Value::Null);
7850 let mut limit = get_arg(optional_args, 2, Value::Null);
7851 let mut params = get_arg(optional_args, 3, Value::Map({
7852 let mut m = indexmap::IndexMap::new();
7853 m
7854}));
7855 if !is_equal(&get_value(&self.has, &Value::Str("fetchPremiumIndexOHLCV".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchPremiumIndexOHLCV".to_string())), &Value::Bool(false)) {
7867 let mut request: Value = Value::Map({
7868 let mut m = indexmap::IndexMap::new();
7869 m.insert("price".to_string(), Value::Str("premiumIndex".to_string()));
7870 m
7871 });
7872 return self.fetch_ohlcv(symbol.clone(), &[timeframe.clone(), since.clone(), limit.clone(), self.extend(request.clone(), &[params.clone()])]).await;
7873 } else {
7874 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchPremiumIndexOHLCV () is not supported yet".to_string()))));
7875 }
7876} }
7877
7878 fn handle_time_in_force(&self, optional_args: &[Value]) -> Value {
7879 let mut params = get_arg(optional_args, 0, Value::Map({
7880 let mut m = indexmap::IndexMap::new();
7881 m
7882}));
7883 let mut timeInForce: Value = self.safe_string_upper(params.clone(), Value::Str("timeInForce".to_string()), &[]); if !is_equal(&timeInForce, &Value::Null) {
7891 let mut exchangeValue: Value = self.safe_string(get_value(&self.options, &Value::Str("timeInForce".to_string())), timeInForce.clone(), &[]);
7892 if is_equal(&exchangeValue, &Value::Null) {
7893 panic!("{}", crate::exchange_errors::exchange_error(add(&add(&add(&self.id, &Value::Str(" does not support timeInForce \"".to_string())), &timeInForce), &Value::Str("\"".to_string()))));
7894 }
7895 return exchangeValue;
7896 }
7897 return Value::Null;
7898
7899 Value::Null
7900}
7901
7902 fn convert_type_to_account(&self, mut account: Value) -> Value {
7903 let mut accountsByType: Value = self.safe_dict_k(self.options.clone(), "accountsByType", &[Value::Map({
7911 let mut m = indexmap::IndexMap::new();
7912 m
7913})]);
7914 let mut lowercaseAccount: Value = to_lower(&account);
7915 if is_true(&Value::Bool(in_op(&accountsByType, &lowercaseAccount))) {
7916 return get_value(&accountsByType, &lowercaseAccount);
7917 }
7918 let mut markets: Value = self.markets.clone();
7919 let mut marketsById: Value = self.markets_by_id.clone();
7920 if is_true(&(is_true(&(!is_equal(&markets, &Value::Null))) && is_true(&(Value::Bool(in_op(&markets, &account)))))) || is_true(&(is_true(&(!is_equal(&marketsById, &Value::Null))) && is_true(&(Value::Bool(in_op(&marketsById, &account)))))) {
7921 let mut market: Value = self.market(account.clone());
7922 return get_value(&market, &Value::Str("id".to_string()));
7923 } else {
7924 return account;
7925 }
7926
7927 Value::Null
7928}
7929
7930 fn check_required_argument(&self, mut methodName: Value, mut argument: Value, mut argumentName: Value, optional_args: &[Value]) {
7931 let mut options = get_arg(optional_args, 0, Value::List(vec![]));
7932 let mut optionsLength: Value = get_array_length(&options);
7942 if is_true(&(is_equal(&argument, &Value::Null))) || is_true(&(is_true(&(is_greater_than(&optionsLength, &Value::Int(0)))) && is_true(&(!is_true(&(self.in_array(argument.clone(), options.clone()))))))) {
7943 let mut messageOptions: Value = join(&options, &Value::Str(", ".to_string()));
7944 let mut message: Value = add(&add(&add(&add(&add(&self.id, &Value::Str(" ".to_string())), &methodName), &Value::Str("() requires a ".to_string())), &argumentName), &Value::Str(" argument".to_string()));
7945 if !is_equal(&messageOptions, &Value::Str("".to_string())) {
7946 message = add(&message, &add(&add(&add(&Value::Str(", one of ".to_string()), &Value::Str("(".to_string())), &messageOptions), &Value::Str(")".to_string())));
7947 }
7948 panic!("{}", crate::exchange_errors::arguments_required(message));
7949 }
7950}
7951
7952 fn check_required_margin_argument(&self, mut methodName: Value, mut symbol: Value, mut marginMode: Value) {
7953 if is_true(&(is_equal(&marginMode, &Value::Str("isolated".to_string())))) && is_true(&(is_equal(&symbol, &Value::Null))) {
7961 panic!("{}", crate::exchange_errors::arguments_required(add(&add(&add(&self.id, &Value::Str(" ".to_string())), &methodName), &Value::Str("() requires a symbol argument for isolated margin".to_string()))));
7962 } else if is_true(&(is_equal(&marginMode, &Value::Str("cross".to_string())))) && is_true(&(!is_equal(&symbol, &Value::Null))) {
7963 panic!("{}", crate::exchange_errors::arguments_required(add(&add(&add(&self.id, &Value::Str(" ".to_string())), &methodName), &Value::Str("() cannot have a symbol argument for cross margin".to_string()))));
7964 }
7965}
7966
7967 fn parse_deposit_withdraw_fees(&self, mut response: Value, optional_args: &[Value]) -> Value {
7968 let mut codes = get_arg(optional_args, 0, Value::Null);
7969 let mut currencyIdKey = get_arg(optional_args, 1, Value::Null);
7970 let mut depositWithdrawFees: Value = Value::Map({
7979 let mut m = indexmap::IndexMap::new();
7980 m
7981 });
7982 let mut isArray: bool = is_array(&response);
7983 let mut responseKeys: Value = response.clone();
7984 if !is_true(&isArray) {
7985 responseKeys = object_keys(&response);
7986 }
7987 {
7988 let mut i: Value = Value::Int(0);
7989 let mut __for_first_154: bool = true;
7990 while { if !__for_first_154 { i = add(&i, &Value::Int(1)); } __for_first_154 = false; is_less_than(&i, &get_array_length(&responseKeys)) } {
7991 let mut entry: Value = get_value(&responseKeys, &i);
7992 let mut entry: Value = get_value(&responseKeys, &i);
7993 let mut dictionary: Value = ternary(is_true(&isArray), entry.clone(), get_value(&response, &entry));
7994 let mut currencyId: Value = entry.clone();
7995 if is_true(&isArray) {
7996 currencyId = ternary(is_true(&(is_equal(¤cyIdKey, &Value::Null))), Value::Null, self.safe_string(dictionary.clone(), currencyIdKey.clone(), &[]));
7997 }
7998 let mut currency: Value = self.safe_currency(currencyId.clone(), &[]);
7999 let mut code: Value = self.safe_string_k(currency.clone(), "code", &[]);
8000 if is_true(&(is_equal(&codes, &Value::Null))) || is_true(&(self.in_array(code.clone(), codes.clone()))) {
8001 add_element_to_object(&mut depositWithdrawFees, &code, <Self as crate::exchange_generated::ExchangeBase>::parse_deposit_withdraw_fee(self, dictionary.clone(), &[currency.clone()]));
8002 }
8003 }
8004 }
8005 return depositWithdrawFees;
8006
8007 Value::Null
8008}
8009
8010 fn parse_deposit_withdraw_fee(&self, mut fee: Value, optional_args: &[Value]) -> Value {
8011 { let __v = crate::exchange::DerivedExchange::parse_deposit_withdraw_fee(self, fee.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
8013
8014 let mut currency = get_arg(optional_args, 0, Value::Null);
8015 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseDepositWithdrawFee() is not supported yet".to_string()))));
8016
8017 Value::Null
8018}
8019
8020 fn deposit_withdraw_fee(&self, mut info: Value) -> Value {
8021 return Value::Map({
8022 let mut m = indexmap::IndexMap::new();
8023 m.insert("info".to_string(), info.clone());
8024 m.insert("withdraw".to_string(), Value::Map({
8025 let mut m = indexmap::IndexMap::new();
8026 m.insert("fee".to_string(), Value::Null);
8027 m.insert("percentage".to_string(), Value::Null);
8028 m
8029}));
8030 m.insert("deposit".to_string(), Value::Map({
8031 let mut m = indexmap::IndexMap::new();
8032 m.insert("fee".to_string(), Value::Null);
8033 m.insert("percentage".to_string(), Value::Null);
8034 m
8035}));
8036 m.insert("networks".to_string(), Value::Map({
8037 let mut m = indexmap::IndexMap::new();
8038 m
8039}));
8040 m
8041});
8042
8043 Value::Null
8044}
8045
8046 fn assign_default_deposit_withdraw_fees(&self, mut fee: Value, optional_args: &[Value]) -> Value {
8047 let mut currency = get_arg(optional_args, 0, Value::Null);
8048 let mut networkKeys: Value = object_keys(&get_value(&fee, &Value::Str("networks".to_string())));
8057 let mut numNetworks: Value = get_array_length(&networkKeys);
8058 if is_equal(&numNetworks, &Value::Int(1)) {
8059 { let __be_tmp = get_value(&get_value(&get_value(&fee, &Value::Str("networks".to_string())), &get_value(&networkKeys, &Value::Int(0))), &Value::Str("withdraw".to_string())); add_element_to_object(&mut fee, &Value::Str("withdraw".to_string()), __be_tmp); };
8060 { let __be_tmp = get_value(&get_value(&get_value(&fee, &Value::Str("networks".to_string())), &get_value(&networkKeys, &Value::Int(0))), &Value::Str("deposit".to_string())); add_element_to_object(&mut fee, &Value::Str("deposit".to_string()), __be_tmp); };
8061 return fee;
8062 }
8063 let mut currencyCode: Value = self.safe_string_k(currency.clone(), "code", &[]);
8064 {
8065 let mut i: Value = Value::Int(0);
8066 let mut __for_first_155: bool = true;
8067 while { if !__for_first_155 { i = add(&i, &Value::Int(1)); } __for_first_155 = false; is_less_than(&i, &numNetworks) } {
8068 let mut network: Value = get_value(&networkKeys, &i);
8069 let mut network: Value = get_value(&networkKeys, &i);
8070 if is_equal(&network, ¤cyCode) {
8071 { let __be_tmp = get_value(&get_value(&get_value(&fee, &Value::Str("networks".to_string())), &get_value(&networkKeys, &i)), &Value::Str("withdraw".to_string())); add_element_to_object(&mut fee, &Value::Str("withdraw".to_string()), __be_tmp); };
8072 { let __be_tmp = get_value(&get_value(&get_value(&fee, &Value::Str("networks".to_string())), &get_value(&networkKeys, &i)), &Value::Str("deposit".to_string())); add_element_to_object(&mut fee, &Value::Str("deposit".to_string()), __be_tmp); };
8073 }
8074 }
8075 }
8076 return fee;
8077
8078 Value::Null
8079}
8080
8081 fn parse_income(&self, mut info: Value, optional_args: &[Value]) -> Value {
8082 { let __v = crate::exchange::DerivedExchange::parse_income(self, info.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
8084
8085 let mut market = get_arg(optional_args, 0, Value::Null);
8086 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseIncome () is not supported yet".to_string()))));
8087
8088 Value::Null
8089}
8090
8091 fn parse_incomes(&self, mut incomes: Value, optional_args: &[Value]) -> Value {
8092 let mut market = get_arg(optional_args, 0, Value::Null);
8093 let mut since = get_arg(optional_args, 1, Value::Null);
8094 let mut limit = get_arg(optional_args, 2, Value::Null);
8095 let mut result: Value = Value::List(vec![]);
8106 {
8107 let mut i: Value = Value::Int(0);
8108 let mut __for_first_156: bool = true;
8109 while { if !__for_first_156 { i = add(&i, &Value::Int(1)); } __for_first_156 = false; is_less_than(&i, &get_array_length(&incomes)) } {
8110 let mut entry: Value = get_value(&incomes, &i);
8111 let mut entry: Value = get_value(&incomes, &i);
8112 let mut parsed: Value = <Self as crate::exchange_generated::ExchangeBase>::parse_income(self, entry.clone(), &[market.clone()]);
8113 append_to_array(&mut result, parsed.clone());
8114 }
8115 }
8116 let mut sorted: Value = self.sort_by(result.clone(), Value::Str("timestamp".to_string()), &[]);
8117 let mut symbol: Value = self.safe_string_k(market.clone(), "symbol", &[]);
8118 return self.filter_by_symbol_since_limit(sorted.clone(), &[symbol.clone(), since.clone(), limit.clone()]);
8119
8120 Value::Null
8121}
8122
8123 fn get_market_from_symbols(&self, optional_args: &[Value]) -> Value {
8124 let mut symbols = get_arg(optional_args, 0, Value::Null);
8125 if is_equal(&symbols, &Value::Null) {
8131 return Value::Null;
8132 }
8133 let mut firstMarket: Value = self.safe_string(symbols.clone(), Value::Int(0), &[]);
8134 if is_equal(&firstMarket, &Value::Null) {
8135 return Value::Null;
8136 }
8137 let mut market: Value = self.market(firstMarket.clone());
8138 return market;
8139
8140 Value::Null
8141}
8142
8143 fn parse_ws_ohlc_vs(&self, mut ohlcvs: Value, optional_args: &[Value]) -> Value {
8144 let mut market = get_arg(optional_args, 0, Value::Null);
8145 let mut timeframe = get_arg(optional_args, 1, Value::Str("1m".to_string()));
8146 let mut since = get_arg(optional_args, 2, Value::Null);
8147 let mut limit = get_arg(optional_args, 3, Value::Null);
8148 let mut results: Value = Value::List(vec![]);
8149 {
8150 let mut i: Value = Value::Int(0);
8151 let mut __for_first_157: bool = true;
8152 while { if !__for_first_157 { i = add(&i, &Value::Int(1)); } __for_first_157 = false; is_less_than(&i, &get_array_length(&ohlcvs)) } {
8153 append_to_array(&mut results, self.parse_ws_ohlcv(get_value(&ohlcvs, &i), &[market.clone()]));
8154 }
8155 }
8156 return results;
8157
8158 Value::Null
8159}
8160
8161 fn fetch_transactions(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
8162 let mut code = get_arg(optional_args, 0, Value::Null);
8163 let mut since = get_arg(optional_args, 1, Value::Null);
8164 let mut limit = get_arg(optional_args, 2, Value::Null);
8165 let mut params = get_arg(optional_args, 3, Value::Map({
8166 let mut m = indexmap::IndexMap::new();
8167 m
8168}));
8169 if !is_equal(&get_value(&self.has, &Value::Str("fetchDepositsWithdrawals".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchDepositsWithdrawals".to_string())), &Value::Bool(false)) {
8181 return self.fetch_deposits_withdrawals(&[code.clone(), since.clone(), limit.clone(), params.clone()]).await;
8182 } else {
8183 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchTransactions () is not supported yet".to_string()))));
8184 }
8185} }
8186
8187 fn filter_by_array_positions(&self, mut objects: Value, mut key: Value, optional_args: &[Value]) -> Value {
8188 let mut values = get_arg(optional_args, 0, Value::Null);
8189 let mut indexed = get_arg(optional_args, 1, Value::Bool(true));
8190 return self.filter_by_array(objects.clone(), key.clone(), &[values.clone(), indexed.clone()]);
8191
8192 Value::Null
8193}
8194
8195 fn filter_by_array_tickers(&self, mut objects: Value, mut key: Value, optional_args: &[Value]) -> Value {
8196 let mut values = get_arg(optional_args, 0, Value::Null);
8197 let mut indexed = get_arg(optional_args, 1, Value::Bool(true));
8198 return self.filter_by_array(objects.clone(), key.clone(), &[values.clone(), indexed.clone()]);
8199
8200 Value::Null
8201}
8202
8203 fn filter_by_array_adl_ranks(&self, mut objects: Value, mut key: Value, optional_args: &[Value]) -> Value {
8204 let mut values = get_arg(optional_args, 0, Value::Null);
8205 let mut indexed = get_arg(optional_args, 1, Value::Bool(true));
8206 return self.filter_by_array(objects.clone(), key.clone(), &[values.clone(), indexed.clone()]);
8207
8208 Value::Null
8209}
8210
8211 fn create_ohlcv_object(&self, mut symbol: Value, mut timeframe: Value, mut data: Value) -> Value {
8212 let mut res: Value = Value::Map({
8213 let mut m = indexmap::IndexMap::new();
8214 m
8215 });
8216 add_element_to_object(&mut res, &symbol, Value::Map({
8217 let mut m = indexmap::IndexMap::new();
8218 m
8219}));
8220 add_element_to_object(get_value_mut(&mut res, &symbol), &timeframe, data.clone());
8221 return res;
8222
8223 Value::Null
8224}
8225
8226 fn handle_max_entries_per_request_and_params(&self, mut method: Value, optional_args: &[Value]) -> Value {
8227 let mut maxEntriesPerRequest = get_arg(optional_args, 0, Value::Null);
8228 let mut params = get_arg(optional_args, 1, Value::Map({
8229 let mut m = indexmap::IndexMap::new();
8230 m
8231}));
8232 let mut newMaxEntriesPerRequest: Value = Value::Null;
8233 { let __destr_tmp = self.handle_option_and_params(params.clone(), method.clone(), Value::Str("maxEntriesPerRequest".to_string()), &[]); newMaxEntriesPerRequest = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
8234 if is_true(&(!is_equal(&newMaxEntriesPerRequest, &Value::Null))) && is_true(&(!is_equal(&newMaxEntriesPerRequest, &maxEntriesPerRequest))) {
8235 maxEntriesPerRequest = newMaxEntriesPerRequest.clone();
8236 }
8237 if is_equal(&maxEntriesPerRequest, &Value::Null) {
8238 maxEntriesPerRequest = Value::Int(1000); }
8240 return Value::List(vec![maxEntriesPerRequest.clone(), params.clone()]);
8241
8242 Value::Null
8243}
8244
8245 fn fetch_paginated_call_dynamic(&mut self, mut method: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
8246 let mut symbol = get_arg(optional_args, 0, Value::Null);
8247 let mut since = get_arg(optional_args, 1, Value::Null);
8248 let mut limit = get_arg(optional_args, 2, Value::Null);
8249 let mut params = get_arg(optional_args, 3, Value::Map({
8250 let mut m = indexmap::IndexMap::new();
8251 m
8252}));
8253 let mut maxEntriesPerRequest = get_arg(optional_args, 4, Value::Null);
8254 let mut removeRepeated = get_arg(optional_args, 5, Value::Bool(true));
8255 let mut maxCalls: Value = Value::Int(10);
8256 { let __destr_tmp = self.handle_option_and_params(params.clone(), method.clone(), Value::Str("paginationCalls".to_string()), &[maxCalls.clone()]); maxCalls = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
8257 let mut maxRetries: Value = Value::Int(3);
8258 { let __destr_tmp = self.handle_option_and_params(params.clone(), method.clone(), Value::Str("maxRetries".to_string()), &[maxRetries.clone()]); maxRetries = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
8259 let mut paginationDirection: Value = Value::Null;
8260 { let __destr_tmp = self.handle_option_and_params(params.clone(), method.clone(), Value::Str("paginationDirection".to_string()), &[Value::Str("backward".to_string())]); paginationDirection = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
8261 let mut paginationTimestamp: Value = Value::Null;
8262 let mut removeRepeatedOption: Value = removeRepeated.clone();
8263 { let __destr_tmp = self.handle_option_and_params(params.clone(), method.clone(), Value::Str("removeRepeated".to_string()), &[removeRepeated.clone()]); removeRepeatedOption = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
8264 let mut calls: Value = Value::Int(0);
8265 let mut result: Value = Value::List(vec![]);
8266 let mut errors: Value = Value::Int(0);
8267 let mut until: Value = self.safe_integer_n(params.clone(), Value::List(vec![Value::Str("until".to_string()), Value::Str("untill".to_string()), Value::Str("till".to_string())]), &[]); { let __destr_tmp = self.handle_max_entries_per_request_and_params(method.clone(), &[maxEntriesPerRequest.clone(), params.clone()]); maxEntriesPerRequest = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
8269 if is_true(&(is_equal(&paginationDirection, &Value::Str("forward".to_string())))) {
8270 if is_equal(&since, &Value::Null) {
8271 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" pagination requires a since argument when paginationDirection set to forward".to_string()))));
8272 }
8273 paginationTimestamp = since.clone();
8274 }
8275 while is_true(&(is_less_than(&calls, &maxCalls))) {
8276 calls = add(&calls, &Value::Int(1));
8277 {
8278 if is_equal(&paginationDirection, &Value::Str("backward".to_string())) {
8279 if !is_equal(&paginationTimestamp, &Value::Null) {
8282 add_element_to_object(&mut params, &Value::Str("until".to_string()), subtract(&paginationTimestamp, &Value::Int(1)));
8283 }
8284 let mut response: Value = self.call_dynamic_checked(method.clone(), vec![(symbol).clone(), (Value::Null).clone(), (maxEntriesPerRequest).clone(), (params).clone()]).await;
8285 let mut responseLength: Value = get_array_length(&response);
8286 if is_true(&self.verbose) {
8287 let mut backwardMessage: Value = add(&add(&add(&add(&add(&Value::Str("Dynamic pagination call ".to_string()), &self.number_to_string(calls.clone())), &Value::Str(" method ".to_string())), &method), &Value::Str(" response length ".to_string())), &self.number_to_string(responseLength.clone()));
8288 if !is_equal(&paginationTimestamp, &Value::Null) {
8289 backwardMessage = add(&backwardMessage, &add(&Value::Str(" timestamp ".to_string()), &self.number_to_string(paginationTimestamp.clone())));
8290 }
8291 self.log(backwardMessage.clone());
8292 }
8293 if is_equal(&responseLength, &Value::Int(0)) {
8294 break;
8295 }
8296 errors = Value::Int(0);
8297 result = self.array_concat(result.clone(), response.clone());
8298 let mut firstElement: Value = self.safe_value(response.clone(), Value::Int(0), &[]);
8299 paginationTimestamp = self.safe_integer2(firstElement.clone(), Value::Str("timestamp".to_string()), Value::Int(0), &[]);
8300 if is_equal(&paginationTimestamp, &Value::Null) {
8301 break;
8302 }
8303 if is_true(&(!is_equal(&since, &Value::Null))) && is_true(&(is_less_than_or_equal(&paginationTimestamp, &since))) {
8304 break;
8305 }
8306 } else {
8307 let mut response: Value = self.call_dynamic_checked(method.clone(), vec![(symbol).clone(), (paginationTimestamp).clone(), (maxEntriesPerRequest).clone(), (params).clone()]).await;
8309 let mut responseLength: Value = get_array_length(&response);
8310 if is_true(&self.verbose) {
8311 let mut forwardMessage: Value = add(&add(&add(&add(&add(&Value::Str("Dynamic pagination call ".to_string()), &self.number_to_string(calls.clone())), &Value::Str(" method ".to_string())), &method), &Value::Str(" response length ".to_string())), &self.number_to_string(responseLength.clone()));
8312 if !is_equal(&paginationTimestamp, &Value::Null) {
8313 forwardMessage = add(&forwardMessage, &add(&Value::Str(" timestamp ".to_string()), &self.number_to_string(paginationTimestamp.clone())));
8314 }
8315 self.log(forwardMessage.clone());
8316 }
8317 if is_equal(&responseLength, &Value::Int(0)) {
8318 break;
8319 }
8320 errors = Value::Int(0);
8321 result = self.array_concat(result.clone(), response.clone());
8322 let mut last: Value = self.safe_value(response.clone(), subtract(&responseLength, &Value::Int(1)), &[]);
8323 let mut lastTimestamp: Value = self.safe_integer_k(last.clone(), "timestamp", &[Value::Int(0)]);
8324 if is_equal(&lastTimestamp, &Value::Null) {
8325 break;
8326 }
8327 let mut nextPaginationTimestamp: Value = add(&lastTimestamp, &Value::Int(1));
8328 paginationTimestamp = nextPaginationTimestamp.clone();
8329 if is_true(&(!is_equal(&until, &Value::Null))) && is_true(&(is_greater_than_or_equal(&nextPaginationTimestamp, &until))) {
8330 break;
8331 }
8332 }
8333 }
8334 }
8335 let mut uniqueResults: Value = result.clone();
8336 if is_true(&removeRepeatedOption) {
8337 uniqueResults = self.remove_repeated_elements_from_array(result.clone(), &[]);
8338 }
8339 let mut key: Value = ternary(is_true(&(is_equal(&method, &Value::Str("fetchOHLCV".to_string())))), Value::Int(0), Value::Str("timestamp".to_string()));
8340 let mut sortedRes: Value = self.sort_by(uniqueResults.clone(), key.clone(), &[]);
8341 return self.filter_by_since_limit(sortedRes.clone(), &[since.clone(), limit.clone(), key.clone()]);
8342
8343 Value::Null
8344} }
8345
8346 fn safe_deterministic_call(&mut self, mut method: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
8347 let mut symbol = get_arg(optional_args, 0, Value::Null);
8348 let mut since = get_arg(optional_args, 1, Value::Null);
8349 let mut limit = get_arg(optional_args, 2, Value::Null);
8350 let mut timeframe = get_arg(optional_args, 3, Value::Null);
8351 let mut params = get_arg(optional_args, 4, Value::Map({
8352 let mut m = indexmap::IndexMap::new();
8353 m
8354}));
8355 let mut maxRetries: Value = Value::Int(3);
8356 { let __destr_tmp = self.handle_option_and_params(params.clone(), method.clone(), Value::Str("maxRetries".to_string()), &[maxRetries.clone()]); maxRetries = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
8357 let mut errors: Value = Value::Int(0);
8358 while is_less_than_or_equal(&errors, &maxRetries) {
8359 let _try_result = futures::FutureExt::catch_unwind(std::panic::AssertUnwindSafe(async {
8360 if is_true(&(!is_equal(&timeframe, &Value::Null) && !is_equal(&timeframe, &Value::Str("".to_string())))) && !is_equal(&method, &Value::Str("fetchFundingRateHistory".to_string())) {
8361 return self.call_dynamic_checked(method.clone(), vec![(symbol).clone(), (timeframe).clone(), (since).clone(), (limit).clone(), (params).clone()]).await;
8362 } else {
8363 return self.call_dynamic_checked(method.clone(), vec![(symbol).clone(), (since).clone(), (limit).clone(), (params).clone()]).await;
8364 }
8365 #[allow(unreachable_code)] { Value::Null }})).await;
8366match _try_result { Ok(__try_ok) => { if !matches!(__try_ok, Value::Null) { return __try_ok; } return Value::Null; } Err(_try_err) => { let e: Value = panic_to_value(_try_err);
8367 if is_true(&is_instance(&e, &Value::Str("RateLimitExceeded".to_string()))) {
8368 panic!("{}", e);
8369 }
8370 errors = add(&errors, &Value::Int(1));
8371 if is_greater_than(&errors, &maxRetries) {
8372 panic!("{}", e);
8373 }
8374 } }
8375 }
8376 return Value::List(vec![]);
8377
8378 Value::Null
8379} }
8380
8381 fn fetch_paginated_call_deterministic(&mut self, mut method: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
8382 let mut symbol = get_arg(optional_args, 0, Value::Null);
8383 let mut since = get_arg(optional_args, 1, Value::Null);
8384 let mut limit = get_arg(optional_args, 2, Value::Null);
8385 let mut timeframe = get_arg(optional_args, 3, Value::Null);
8386 let mut params = get_arg(optional_args, 4, Value::Map({
8387 let mut m = indexmap::IndexMap::new();
8388 m
8389}));
8390 let mut maxEntriesPerRequest = get_arg(optional_args, 5, Value::Null);
8391 let mut maxCalls: Value = Value::Int(10);
8392 { let __destr_tmp = self.handle_option_and_params(params.clone(), method.clone(), Value::Str("paginationCalls".to_string()), &[maxCalls.clone()]); maxCalls = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
8393 { let __destr_tmp = self.handle_max_entries_per_request_and_params(method.clone(), &[maxEntriesPerRequest.clone(), params.clone()]); maxEntriesPerRequest = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
8394 params = self.omit(params.clone(), Value::Str("paginationDirection".to_string()), &[]);
8398 let mut current: Value = self.milliseconds();
8399 let mut tasks: Value = Value::List(vec![]);
8400 let mut time: Value = multiply(&self.parse_timeframe(timeframe.clone()), &Value::Int(1000));
8401 maxEntriesPerRequest = self.require_value(maxEntriesPerRequest.clone(), &[Value::Str("fetchPaginatedCallDeterministic() maxEntriesPerRequest is required".to_string())]);
8402 let mut step: Value = multiply(&time, &maxEntriesPerRequest);
8403 let mut until: Value = self.safe_integer2(params.clone(), Value::Str("until".to_string()), Value::Str("till".to_string()), &[]); let mut currentSince: Value = subtract(&subtract(¤t, &(multiply(&maxCalls, &step))), &Value::Int(1));
8405 if !is_equal(&since, &Value::Null) {
8406 if !is_equal(&until, &Value::Null) {
8407 currentSince = since.clone();
8412 } else {
8413 currentSince = crate::runtime::Math::max(¤tSince, &since);
8414 }
8415 } else {
8416 currentSince = crate::runtime::Math::max(¤tSince, &Value::Int(1241440531000)); }
8418 if !is_equal(&until, &Value::Null) {
8419 if is_equal(&since, &Value::Null) {
8420 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" fetchPaginatedCallDeterministic() requires a since argument when until is set".to_string()))));
8421 }
8422 let mut requiredCalls: Value = math_ceil(÷(&(subtract(&until, &since)), &step));
8423 if is_greater_than(&requiredCalls, &maxCalls) {
8424 panic!("{}", crate::exchange_errors::bad_request(add(&add(&add(&add(&self.id, &Value::Str(" the number of required calls is greater than the max number of calls allowed, either increase the paginationCalls or decrease the since-until gap. Current paginationCalls limit is ".to_string())), &to_string_val(&maxCalls)), &Value::Str(" required calls is ".to_string())), &to_string_val(&requiredCalls))));
8425 }
8426 }
8427 {
8428 let mut i: Value = Value::Int(0);
8429 let mut __for_first_158: bool = true;
8430 while { if !__for_first_158 { i = add(&i, &Value::Int(1)); } __for_first_158 = false; is_less_than(&i, &maxCalls) } {
8431 if is_true(&(!is_equal(&until, &Value::Null))) && is_true(&(is_greater_than_or_equal(¤tSince, &until))) {
8432 break;
8433 }
8434 if is_greater_than_or_equal(¤tSince, ¤t) {
8435 break;
8436 }
8437 append_to_array(&mut tasks, self.safe_deterministic_call(method.clone(), &[symbol.clone(), currentSince.clone(), maxEntriesPerRequest.clone(), timeframe.clone(), params.clone()]).await);
8438 currentSince = subtract(&self.sum(&[currentSince.clone(), step.clone()]), &Value::Int(1));
8439 }
8440 }
8441 let mut results: Value = promise_all(&tasks).await;
8442 let mut result: Value = Value::List(vec![]);
8443 {
8444 let mut i: Value = Value::Int(0);
8445 let mut __for_first_159: bool = true;
8446 while { if !__for_first_159 { i = add(&i, &Value::Int(1)); } __for_first_159 = false; is_less_than(&i, &get_array_length(&results)) } {
8447 result = self.array_concat(result.clone(), get_value(&results, &i));
8448 }
8449 }
8450 let mut uniqueResults: Value = self.remove_repeated_elements_from_array(result.clone(), &[]);
8451 let mut key: Value = ternary(is_true(&(is_equal(&method, &Value::Str("fetchOHLCV".to_string())))), Value::Int(0), Value::Str("timestamp".to_string()));
8452 return self.filter_by_since_limit(uniqueResults.clone(), &[since.clone(), limit.clone(), key.clone()]);
8453
8454 Value::Null
8455} }
8456
8457fn fetch_paginated_call_cursor(&mut self, mut method: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
8460 let mut symbol = get_arg(optional_args, 0, Value::Null);
8461 let mut since = get_arg(optional_args, 1, Value::Null);
8462 let mut limit = get_arg(optional_args, 2, Value::Null);
8463 let mut params = get_arg(optional_args, 3, Value::Map({
8464 let mut m = indexmap::IndexMap::new();
8465 m
8466}));
8467 let mut cursorReceived = get_arg(optional_args, 4, Value::Null);
8468 let mut cursorSent = get_arg(optional_args, 5, Value::Null);
8469 let mut cursorIncrement = get_arg(optional_args, 6, Value::Null);
8470 let mut maxEntriesPerRequest = get_arg(optional_args, 7, Value::Null);
8471 let mut maxCalls: Value = Value::Int(10);
8472 { let __destr_tmp = self.handle_option_and_params(params.clone(), method.clone(), Value::Str("paginationCalls".to_string()), &[maxCalls.clone()]); maxCalls = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
8473 let mut maxRetries: Value = Value::Int(3);
8474 { let __destr_tmp = self.handle_option_and_params(params.clone(), method.clone(), Value::Str("maxRetries".to_string()), &[maxRetries.clone()]); maxRetries = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
8475 { let __destr_tmp = self.handle_max_entries_per_request_and_params(method.clone(), &[maxEntriesPerRequest.clone(), params.clone()]); maxEntriesPerRequest = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
8476 let mut cursorValue: Value = Value::Null;
8477 let mut i: Value = Value::Int(0);
8478 let mut errors: Value = Value::Int(0);
8479 let mut result: Value = Value::List(vec![]);
8480 let mut timeframe: Value = self.safe_string_k(params.clone(), "timeframe", &[]);
8481 params = self.omit(params.clone(), Value::Str("timeframe".to_string()), &[]); while is_less_than(&i, &maxCalls) {
8483 {
8484 if !is_equal(&cursorValue, &Value::Null) {
8485 if !is_equal(&cursorIncrement, &Value::Null) {
8486 cursorValue = add(&self.parse_to_int(cursorValue.clone()), &cursorIncrement);
8487 }
8488 add_element_to_object(&mut params, &cursorSent, cursorValue.clone());
8489 }
8490 let mut response: Value = Value::Null;
8491 if is_equal(&method, &Value::Str("fetchAccounts".to_string())) {
8492 response = self.call_dynamic_checked(method.clone(), vec![(params).clone()]).await;
8493 } else if is_equal(&method, &Value::Str("getLeverageTiersPaginated".to_string())) || is_equal(&method, &Value::Str("fetchPositions".to_string())) {
8494 response = self.call_dynamic_checked(method.clone(), vec![(symbol).clone(), (params).clone()]).await;
8495 } else if is_equal(&method, &Value::Str("fetchOpenInterestHistory".to_string())) {
8496 if !is_string(&symbol) {
8497 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" fetchPaginatedCallCursor() requires a symbol argument".to_string()))));
8498 }
8499 if is_equal(&timeframe, &Value::Null) {
8500 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" fetchPaginatedCallCursor() requires a timeframe argument".to_string()))));
8501 }
8502 response = self.call_dynamic_checked(method.clone(), vec![(symbol).clone(), (timeframe).clone(), (since).clone(), (maxEntriesPerRequest).clone(), (params).clone()]).await;
8503 } else {
8504 response = self.call_dynamic_checked(method.clone(), vec![(symbol).clone(), (since).clone(), (maxEntriesPerRequest).clone(), (params).clone()]).await;
8505 }
8506 errors = Value::Int(0);
8507 if is_equal(&response, &Value::Null) {
8508 panic!("{}", crate::exchange_errors::null_response(add(&self.id, &Value::Str(" fetchPaginatedCallCursor() returned empty response".to_string()))));
8509 }
8510 let mut responseLength: Value = get_array_length(&response);
8511 if is_true(&self.verbose) {
8512 let mut cursorString: Value = ternary(is_true(&(is_equal(&cursorValue, &Value::Null))), Value::Str("".to_string()), cursorValue.clone());
8513 let mut iteration: Value = (add(&i, &Value::Int(1)));
8514 let mut cursorMessage: Value = add(&add(&add(&add(&add(&add(&add(&Value::Str("Cursor pagination call ".to_string()), &to_string_val(&iteration)), &Value::Str(" method ".to_string())), &method), &Value::Str(" response length ".to_string())), &to_string_val(&responseLength)), &Value::Str(" cursor ".to_string())), &cursorString);
8515 self.log(cursorMessage.clone());
8516 }
8517 if is_equal(&responseLength, &Value::Int(0)) {
8518 break;
8519 }
8520 if !is_equal(&response, &Value::Null) {
8521 result = self.array_concat(result.clone(), response.clone());
8522 }
8523 let mut last: Value = self.safe_dict(response.clone(), subtract(&responseLength, &Value::Int(1)), &[]);
8524 cursorValue = Value::Null; {
8527 let mut j: Value = Value::Int(0);
8528 let mut __for_first_160: bool = true;
8529 while { if !__for_first_160 { j = add(&j, &Value::Int(1)); } __for_first_160 = false; is_less_than(&j, &responseLength) } {
8530 let mut index: Value = subtract(&subtract(&responseLength, &j), &Value::Int(1));
8531 let mut entry: Value = self.safe_dict(response.clone(), index.clone(), &[]);
8532 let mut info: Value = self.safe_dict_k(entry.clone(), "info", &[]);
8533 let mut cursor: Value = ternary(is_true(&(is_equal(&cursorReceived, &Value::Null))), Value::Null, self.safe_value(info.clone(), cursorReceived.clone(), &[]));
8534 if !is_equal(&cursor, &Value::Null) {
8535 cursorValue = cursor.clone();
8536 break;
8537 }
8538 }
8539 }
8540 if is_equal(&cursorValue, &Value::Null) {
8541 break;
8542 }
8543 let mut lastTimestamp: Value = self.safe_integer_k(last.clone(), "timestamp", &[]);
8544 if is_equal(&since, &Value::Null) {
8545 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" fetchPaginatedCallCursor() requires a since argument".to_string()))));
8546 }
8547 if !is_equal(&lastTimestamp, &Value::Null) && is_less_than(&lastTimestamp, &since) {
8548 break;
8549 }
8550 }
8551 i = add(&i, &Value::Int(1));
8552 }
8553 let mut sorted: Value = self.sort_cursor_paginated_result(result.clone());
8554 let mut key: Value = ternary(is_true(&(is_equal(&method, &Value::Str("fetchOHLCV".to_string())))), Value::Int(0), Value::Str("timestamp".to_string()));
8555 return self.filter_by_since_limit(sorted.clone(), &[since.clone(), limit.clone(), key.clone()]);
8556
8557 Value::Null
8558} }
8559
8560 fn fetch_paginated_call_incremental(&mut self, mut method: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
8561 let mut symbol = get_arg(optional_args, 0, Value::Null);
8562 let mut since = get_arg(optional_args, 1, Value::Null);
8563 let mut limit = get_arg(optional_args, 2, Value::Null);
8564 let mut params = get_arg(optional_args, 3, Value::Map({
8565 let mut m = indexmap::IndexMap::new();
8566 m
8567}));
8568 let mut pageKey = get_arg(optional_args, 4, Value::Null);
8569 let mut maxEntriesPerRequest = get_arg(optional_args, 5, Value::Null);
8570 let mut maxCalls: Value = Value::Int(10);
8571 { let __destr_tmp = self.handle_option_and_params(params.clone(), method.clone(), Value::Str("paginationCalls".to_string()), &[maxCalls.clone()]); maxCalls = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
8572 let mut maxRetries: Value = Value::Int(3);
8573 { let __destr_tmp = self.handle_option_and_params(params.clone(), method.clone(), Value::Str("maxRetries".to_string()), &[maxRetries.clone()]); maxRetries = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
8574 { let __destr_tmp = self.handle_max_entries_per_request_and_params(method.clone(), &[maxEntriesPerRequest.clone(), params.clone()]); maxEntriesPerRequest = get_value(&__destr_tmp, &Value::Int(0)); params = get_value(&__destr_tmp, &Value::Int(1)); }
8575 let mut i: Value = Value::Int(0);
8576 let mut errors: Value = Value::Int(0);
8577 let mut result: Value = Value::List(vec![]);
8578 while is_less_than(&i, &maxCalls) {
8579 {
8580 add_element_to_object(&mut params, &pageKey, add(&i, &Value::Int(1)));
8581 let mut response: Value = self.call_dynamic_checked(method.clone(), vec![(symbol).clone(), (since).clone(), (maxEntriesPerRequest).clone(), (params).clone()]).await;
8582 errors = Value::Int(0);
8583 let mut responseLength: Value = get_array_length(&response);
8584 if is_true(&self.verbose) {
8585 let mut iteration: Value = to_string_val(&(add(&i, &Value::Int(1))));
8586 let mut incrementalMessage: Value = add(&add(&add(&add(&add(&Value::Str("Incremental pagination call ".to_string()), &iteration), &Value::Str(" method ".to_string())), &method), &Value::Str(" response length ".to_string())), &to_string_val(&responseLength));
8587 self.log(incrementalMessage.clone());
8588 }
8589 if is_equal(&responseLength, &Value::Int(0)) {
8590 break;
8591 }
8592 result = self.array_concat(result.clone(), response.clone());
8593 }
8594 i = add(&i, &Value::Int(1));
8595 }
8596 let mut sorted: Value = self.sort_cursor_paginated_result(result.clone());
8597 let mut key: Value = ternary(is_true(&(is_equal(&method, &Value::Str("fetchOHLCV".to_string())))), Value::Int(0), Value::Str("timestamp".to_string()));
8598 return self.filter_by_since_limit(sorted.clone(), &[since.clone(), limit.clone(), key.clone()]);
8599
8600 Value::Null
8601} }
8602
8603 fn sort_cursor_paginated_result(&self, mut result: Value) -> Value {
8604 let mut first: Value = self.safe_value(result.clone(), Value::Int(0), &[]);
8605 if !is_equal(&first, &Value::Null) {
8606 if is_true(&Value::Bool(in_op(&first, &Value::Str("timestamp".to_string())))) {
8607 return self.sort_by(result.clone(), Value::Str("timestamp".to_string()), &[Value::Bool(true)]);
8608 }
8609 if is_true(&Value::Bool(in_op(&first, &Value::Str("id".to_string())))) {
8610 return self.sort_by(result.clone(), Value::Str("id".to_string()), &[Value::Bool(true)]);
8611 }
8612 }
8613 return result;
8614
8615 Value::Null
8616}
8617
8618 fn remove_repeated_elements_from_array(&self, mut input: Value, optional_args: &[Value]) -> Value {
8619 let mut fallbackToTimestamp = get_arg(optional_args, 0, Value::Bool(true));
8620 let mut uniqueDic: Value = Value::Map({
8621 let mut m = indexmap::IndexMap::new();
8622 m
8623 });
8624 let mut uniqueResult: Value = Value::List(vec![]);
8625 {
8626 let mut i: Value = Value::Int(0);
8627 let mut __for_first_161: bool = true;
8628 while { if !__for_first_161 { i = add(&i, &Value::Int(1)); } __for_first_161 = false; is_less_than(&i, &get_array_length(&input)) } {
8629 let mut entry: Value = get_value(&input, &i);
8630 let mut entry: Value = get_value(&input, &i);
8631 let mut uniqValue: Value = ternary(is_true(&fallbackToTimestamp), self.safe_string_n(entry.clone(), Value::List(vec![Value::Str("id".to_string()), Value::Str("timestamp".to_string()), Value::Int(0)]), &[]), self.safe_string_k(entry.clone(), "id", &[]));
8632 if !is_equal(&uniqValue, &Value::Null) && !is_true(&(Value::Bool(in_op(&uniqueDic, &uniqValue)))) {
8633 add_element_to_object(&mut uniqueDic, &uniqValue, Value::Int(1));
8634 append_to_array(&mut uniqueResult, entry.clone());
8635 }
8636 }
8637 }
8638 let mut valuesLength: Value = get_array_length(&uniqueResult);
8639 if is_greater_than(&valuesLength, &Value::Int(0)) {
8640 return uniqueResult;
8641 }
8642 return input;
8643
8644 Value::Null
8645}
8646
8647 fn remove_repeated_trades_from_array(&self, mut input: Value) -> Value {
8648 let mut uniqueResult: Value = Value::Map({
8649 let mut m = indexmap::IndexMap::new();
8650 m
8651 });
8652 {
8653 let mut i: Value = Value::Int(0);
8654 let mut __for_first_162: bool = true;
8655 while { if !__for_first_162 { i = add(&i, &Value::Int(1)); } __for_first_162 = false; is_less_than(&i, &get_array_length(&input)) } {
8656 let mut entry: Value = get_value(&input, &i);
8657 let mut entry: Value = get_value(&input, &i);
8658 let mut id: Value = self.safe_string_k(entry.clone(), "id", &[]);
8659 if is_equal(&id, &Value::Null) {
8660 let mut price: Value = self.safe_string_k(entry.clone(), "price", &[]);
8661 let mut amount: Value = self.safe_string_k(entry.clone(), "amount", &[]);
8662 let mut timestamp: Value = self.safe_string_k(entry.clone(), "timestamp", &[]);
8663 let mut side: Value = self.safe_string_k(entry.clone(), "side", &[]);
8664 if is_equal(×tamp, &Value::Null) {
8666 panic!("{}", crate::exchange_errors::exchange_error(add(&self.id, &Value::Str(" removeRepeatedTradesFromArray() missing timestamp".to_string()))));
8667 }
8668 id = add(&add(&add(&add(&add(&add(&add(&Value::Str("t_".to_string()), &to_string_val(×tamp)), &Value::Str("_".to_string())), &side), &Value::Str("_".to_string())), &price), &Value::Str("_".to_string())), &amount);
8669 }
8670 if !is_equal(&id, &Value::Null) && !is_true(&(Value::Bool(in_op(&uniqueResult, &id)))) {
8671 add_element_to_object(&mut uniqueResult, &id, entry.clone());
8672 }
8673 }
8674 }
8675 let mut values: Value = object_values(&uniqueResult);
8676 return values;
8677
8678 Value::Null
8679}
8680
8681 fn remove_keys_from_dict(&self, mut dict: Value, mut removeKeys: Value) -> Value {
8682 let mut keys: Value = object_keys(&dict);
8683 let mut newDict: Value = Value::Map({
8684 let mut m = indexmap::IndexMap::new();
8685 m
8686 });
8687 {
8688 let mut i: Value = Value::Int(0);
8689 let mut __for_first_163: bool = true;
8690 while { if !__for_first_163 { i = add(&i, &Value::Int(1)); } __for_first_163 = false; is_less_than(&i, &get_array_length(&keys)) } {
8691 let mut key: Value = get_value(&keys, &i);
8692 let mut key: Value = get_value(&keys, &i);
8693 if !is_true(&self.in_array(key.clone(), removeKeys.clone())) {
8694 add_element_to_object(&mut newDict, &key, get_value(&dict, &key));
8695 }
8696 }
8697 }
8698 return newDict;
8699
8700 Value::Null
8701}
8702
8703 fn handle_until_option(&self, mut key: Value, mut request: Value, mut params: Value, optional_args: &[Value]) -> Value {
8704 let mut multiplier = get_arg(optional_args, 0, Value::Int(1));
8705 let mut until: Value = self.safe_integer2(params.clone(), Value::Str("until".to_string()), Value::Str("till".to_string()), &[]);
8706 if !is_equal(&until, &Value::Null) {
8707 add_element_to_object(&mut request, &key, self.parse_to_int(multiply(&until, &multiplier)));
8708 params = self.omit(params.clone(), Value::List(vec![Value::Str("until".to_string()), Value::Str("till".to_string())]), &[]);
8709 }
8710 return Value::List(vec![request.clone(), params.clone()]);
8711
8712 Value::Null
8713}
8714
8715 fn safe_open_interest(&self, mut interest: Value, optional_args: &[Value]) -> Value {
8716 let mut market = get_arg(optional_args, 0, Value::Null);
8717 let mut symbol: Value = self.safe_string_k(interest.clone(), "symbol", &[]);
8718 if is_equal(&symbol, &Value::Null) {
8719 symbol = self.safe_string_k(market.clone(), "symbol", &[]);
8720 }
8721 return self.extend(interest.clone(), &[Value::Map({
8722 let mut m = indexmap::IndexMap::new();
8723 m.insert("symbol".to_string(), symbol.clone());
8724 m.insert("baseVolume".to_string(), self.safe_number_k(interest.clone(), "baseVolume", &[]));
8725 m.insert("quoteVolume".to_string(), self.safe_number_k(interest.clone(), "quoteVolume", &[]));
8726 m.insert("openInterestAmount".to_string(), self.safe_number_k(interest.clone(), "openInterestAmount", &[]));
8727 m.insert("openInterestValue".to_string(), self.safe_number_k(interest.clone(), "openInterestValue", &[]));
8728 m.insert("timestamp".to_string(), self.safe_integer_k(interest.clone(), "timestamp", &[]));
8729 m.insert("datetime".to_string(), self.safe_string_k(interest.clone(), "datetime", &[]));
8730 m.insert("info".to_string(), self.safe_value_k(interest.clone(), "info", &[]));
8731 m
8732})]);
8733
8734 Value::Null
8735}
8736
8737 fn parse_liquidation(&self, mut liquidation: Value, optional_args: &[Value]) -> Value {
8738 { let __v = crate::exchange::DerivedExchange::parse_liquidation(self, liquidation.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
8740
8741 let mut market = get_arg(optional_args, 0, Value::Null);
8742 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseLiquidation () is not supported yet".to_string()))));
8743
8744 Value::Null
8745}
8746
8747 fn parse_liquidations(&self, mut liquidations: Value, optional_args: &[Value]) -> Value {
8748 let mut market = get_arg(optional_args, 0, Value::Null);
8749 let mut since = get_arg(optional_args, 1, Value::Null);
8750 let mut limit = get_arg(optional_args, 2, Value::Null);
8751 let mut result: Value = Value::List(vec![]);
8762 {
8763 let mut i: Value = Value::Int(0);
8764 let mut __for_first_164: bool = true;
8765 while { if !__for_first_164 { i = add(&i, &Value::Int(1)); } __for_first_164 = false; is_less_than(&i, &get_array_length(&liquidations)) } {
8766 let mut entry: Value = get_value(&liquidations, &i);
8767 let mut entry: Value = get_value(&liquidations, &i);
8768 let mut parsed: Value = <Self as crate::exchange_generated::ExchangeBase>::parse_liquidation(self, entry.clone(), &[market.clone()]);
8769 append_to_array(&mut result, parsed.clone());
8770 }
8771 }
8772 let mut sorted: Value = self.sort_by(result.clone(), Value::Str("timestamp".to_string()), &[]);
8773 let mut symbol: Value = self.safe_string_k(market.clone(), "symbol", &[]);
8774 return self.filter_by_symbol_since_limit(sorted.clone(), &[symbol.clone(), since.clone(), limit.clone()]);
8775
8776 Value::Null
8777}
8778
8779 fn parse_greeks(&self, mut greeks: Value, optional_args: &[Value]) -> Value {
8780 { let __v = crate::exchange::DerivedExchange::parse_greeks(self, greeks.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
8782
8783 let mut market = get_arg(optional_args, 0, Value::Null);
8784 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseGreeks () is not supported yet".to_string()))));
8785
8786 Value::Null
8787}
8788
8789 fn parse_all_greeks(&self, mut greeks: Value, optional_args: &[Value]) -> Value {
8790 let mut symbols = get_arg(optional_args, 0, Value::Null);
8791 let mut params = get_arg(optional_args, 1, Value::Map({
8792 let mut m = indexmap::IndexMap::new();
8793 m
8794}));
8795 let mut results: Value = Value::List(vec![]);
8799 if is_true(&Value::Bool(is_array(&greeks))) {
8800 {
8801 let mut i: Value = Value::Int(0);
8802 let mut __for_first_165: bool = true;
8803 while { if !__for_first_165 { i = add(&i, &Value::Int(1)); } __for_first_165 = false; is_less_than(&i, &get_array_length(&greeks)) } {
8804 let mut parsedTicker: Value = <Self as crate::exchange_generated::ExchangeBase>::parse_greeks(self, get_value(&greeks, &i), &[]);
8805 let mut greek: Value = self.extend(parsedTicker.clone(), &[params.clone()]);
8806 append_to_array(&mut results, greek.clone());
8807 }
8808 }
8809 } else {
8810 let mut marketIds: Value = object_keys(&greeks);
8811 {
8812 let mut i: Value = Value::Int(0);
8813 let mut __for_first_166: bool = true;
8814 while { if !__for_first_166 { i = add(&i, &Value::Int(1)); } __for_first_166 = false; is_less_than(&i, &get_array_length(&marketIds)) } {
8815 let mut marketId: Value = get_value(&marketIds, &i);
8816 let mut marketId: Value = get_value(&marketIds, &i);
8817 let mut market: Value = self.safe_market(&[marketId.clone()]);
8818 let mut parsed: Value = <Self as crate::exchange_generated::ExchangeBase>::parse_greeks(self, get_value(&greeks, &marketId), &[market.clone()]);
8819 let mut greek: Value = self.extend(parsed.clone(), &[params.clone()]);
8820 append_to_array(&mut results, greek.clone());
8821 }
8822 }
8823 }
8824 symbols = self.market_symbols(&[symbols.clone()]);
8825 return self.filter_by_array(results.clone(), Value::Str("symbol".to_string()), &[symbols.clone()]);
8826
8827 Value::Null
8828}
8829
8830 fn parse_option(&self, mut chain: Value, optional_args: &[Value]) -> Value {
8831 let mut currency = get_arg(optional_args, 0, Value::Null);
8832 let mut market = get_arg(optional_args, 1, Value::Null);
8833 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseOption () is not supported yet".to_string()))));
8834
8835 Value::Null
8836}
8837
8838 fn parse_option_chain(&self, mut response: Value, optional_args: &[Value]) -> Value {
8839 let mut currencyKey = get_arg(optional_args, 0, Value::Null);
8840 let mut symbolKey = get_arg(optional_args, 1, Value::Null);
8841 let mut optionStructures: Value = Value::Map({
8842 let mut m = indexmap::IndexMap::new();
8843 m
8844 });
8845 {
8846 let mut i: Value = Value::Int(0);
8847 let mut __for_first_167: bool = true;
8848 while { if !__for_first_167 { i = add(&i, &Value::Int(1)); } __for_first_167 = false; is_less_than(&i, &get_array_length(&response)) } {
8849 let mut info: Value = get_value(&response, &i);
8850 let mut info: Value = get_value(&response, &i);
8851 let mut currencyId: Value = ternary(is_true(&(is_equal(¤cyKey, &Value::Null))), Value::Null, self.safe_string(info.clone(), currencyKey.clone(), &[]));
8852 let mut currency: Value = self.safe_currency(currencyId.clone(), &[]);
8853 let mut marketId: Value = ternary(is_true(&(is_equal(&symbolKey, &Value::Null))), Value::Null, self.safe_string(info.clone(), symbolKey.clone(), &[]));
8854 let mut market: Value = self.safe_market(&[marketId.clone(), Value::Null, Value::Null, Value::Str("option".to_string())]);
8855 add_element_to_object(&mut optionStructures, &get_value(&market, &Value::Str("symbol".to_string())), self.parse_option(info.clone(), &[currency.clone(), market.clone()]));
8856 }
8857 }
8858 return optionStructures;
8859
8860 Value::Null
8861}
8862
8863 fn parse_margin_modes(&self, mut response: Value, optional_args: &[Value]) -> Value {
8864 let mut symbols = get_arg(optional_args, 0, Value::Null);
8865 let mut symbolKey = get_arg(optional_args, 1, Value::Null);
8866 let mut marketType = get_arg(optional_args, 2, Value::Null);
8867 let mut marginModeStructures: Value = Value::Map({
8868 let mut m = indexmap::IndexMap::new();
8869 m
8870 });
8871 if is_equal(&marketType, &Value::Null) {
8872 marketType = Value::Str("swap".to_string()); }
8874 {
8875 let mut i: Value = Value::Int(0);
8876 let mut __for_first_168: bool = true;
8877 while { if !__for_first_168 { i = add(&i, &Value::Int(1)); } __for_first_168 = false; is_less_than(&i, &get_array_length(&response)) } {
8878 let mut info: Value = get_value(&response, &i);
8879 let mut info: Value = get_value(&response, &i);
8880 let mut marketId: Value = ternary(is_true(&(is_equal(&symbolKey, &Value::Null))), Value::Null, self.safe_string(info.clone(), symbolKey.clone(), &[]));
8881 let mut market: Value = self.safe_market(&[marketId.clone(), Value::Null, Value::Null, marketType.clone()]);
8882 if is_true(&(is_equal(&symbols, &Value::Null))) || is_true(&self.in_array(get_value(&market, &Value::Str("symbol".to_string())), symbols.clone())) {
8883 add_element_to_object(&mut marginModeStructures, &get_value(&market, &Value::Str("symbol".to_string())), <Self as crate::exchange_generated::ExchangeBase>::parse_margin_mode(self, info.clone(), &[market.clone()]));
8884 }
8885 }
8886 }
8887 return marginModeStructures;
8888
8889 Value::Null
8890}
8891
8892 fn parse_margin_mode(&self, mut marginMode: Value, optional_args: &[Value]) -> Value {
8893 { let __v = crate::exchange::DerivedExchange::parse_margin_mode(self, marginMode.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
8895
8896 let mut market = get_arg(optional_args, 0, Value::Null);
8897 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseMarginMode () is not supported yet".to_string()))));
8898
8899 Value::Null
8900}
8901
8902 fn parse_leverages(&self, mut response: Value, optional_args: &[Value]) -> Value {
8903 let mut symbols = get_arg(optional_args, 0, Value::Null);
8904 let mut symbolKey = get_arg(optional_args, 1, Value::Null);
8905 let mut marketType = get_arg(optional_args, 2, Value::Null);
8906 let mut leverageStructures: Value = Value::Map({
8907 let mut m = indexmap::IndexMap::new();
8908 m
8909 });
8910 if is_equal(&marketType, &Value::Null) {
8911 marketType = Value::Str("swap".to_string()); }
8913 {
8914 let mut i: Value = Value::Int(0);
8915 let mut __for_first_169: bool = true;
8916 while { if !__for_first_169 { i = add(&i, &Value::Int(1)); } __for_first_169 = false; is_less_than(&i, &get_array_length(&response)) } {
8917 let mut info: Value = get_value(&response, &i);
8918 let mut info: Value = get_value(&response, &i);
8919 let mut marketId: Value = ternary(is_true(&(is_equal(&symbolKey, &Value::Null))), Value::Null, self.safe_string(info.clone(), symbolKey.clone(), &[]));
8920 let mut market: Value = self.safe_market(&[marketId.clone(), Value::Null, Value::Null, marketType.clone()]);
8921 if is_true(&(is_equal(&symbols, &Value::Null))) || is_true(&self.in_array(get_value(&market, &Value::Str("symbol".to_string())), symbols.clone())) {
8922 add_element_to_object(&mut leverageStructures, &get_value(&market, &Value::Str("symbol".to_string())), <Self as crate::exchange_generated::ExchangeBase>::parse_leverage(self, info.clone(), &[market.clone()]));
8923 }
8924 }
8925 }
8926 return leverageStructures;
8927
8928 Value::Null
8929}
8930
8931 fn parse_leverage(&self, mut leverage: Value, optional_args: &[Value]) -> Value {
8932 { let __v = crate::exchange::DerivedExchange::parse_leverage(self, leverage.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
8934
8935 let mut market = get_arg(optional_args, 0, Value::Null);
8936 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseLeverage () is not supported yet".to_string()))));
8937
8938 Value::Null
8939}
8940
8941 fn parse_conversions(&self, mut conversions: Value, optional_args: &[Value]) -> Value {
8942 let mut code = get_arg(optional_args, 0, Value::Null);
8943 let mut fromCurrencyKey = get_arg(optional_args, 1, Value::Null);
8944 let mut toCurrencyKey = get_arg(optional_args, 2, Value::Null);
8945 let mut since = get_arg(optional_args, 3, Value::Null);
8946 let mut limit = get_arg(optional_args, 4, Value::Null);
8947 let mut params = get_arg(optional_args, 5, Value::Map({
8948 let mut m = indexmap::IndexMap::new();
8949 m
8950}));
8951 let mut conversionsArray: Value = self.to_array(conversions.clone());
8952 let mut result: Value = Value::List(vec![]);
8953 let mut fromCurrency: Value = Value::Null;
8954 let mut toCurrency: Value = Value::Null;
8955 {
8956 let mut i: Value = Value::Int(0);
8957 let mut __for_first_170: bool = true;
8958 while { if !__for_first_170 { i = add(&i, &Value::Int(1)); } __for_first_170 = false; is_less_than(&i, &get_array_length(&conversionsArray)) } {
8959 let mut entry: Value = get_value(&conversionsArray, &i);
8960 let mut entry: Value = get_value(&conversionsArray, &i);
8961 let mut fromId: Value = ternary(is_true(&(is_equal(&fromCurrencyKey, &Value::Null))), Value::Null, self.safe_string(entry.clone(), fromCurrencyKey.clone(), &[]));
8962 let mut toId: Value = ternary(is_true(&(is_equal(&toCurrencyKey, &Value::Null))), Value::Null, self.safe_string(entry.clone(), toCurrencyKey.clone(), &[]));
8963 if !is_equal(&fromId, &Value::Null) {
8964 fromCurrency = self.safe_currency(fromId.clone(), &[]);
8965 }
8966 if !is_equal(&toId, &Value::Null) {
8967 toCurrency = self.safe_currency(toId.clone(), &[]);
8968 }
8969 let mut conversion: Value = self.extend(<Self as crate::exchange_generated::ExchangeBase>::parse_conversion(self, entry.clone(), &[fromCurrency.clone(), toCurrency.clone()]), &[params.clone()]);
8970 append_to_array(&mut result, conversion.clone());
8971 }
8972 }
8973 let mut sorted: Value = self.sort_by(result.clone(), Value::Str("timestamp".to_string()), &[]);
8974 let mut currency: Value = Value::Null;
8975 if !is_equal(&code, &Value::Null) {
8976 currency = self.safe_currency(code.clone(), &[]);
8977 if is_equal(¤cy, &Value::Null) {
8978 panic!("{}", crate::exchange_errors::exchange_error(add(&self.id, &Value::Str(" parseConversions() could not resolve currency".to_string()))));
8979 }
8980 code = get_value(¤cy, &Value::Str("code".to_string()));
8981 }
8982 if is_equal(&code, &Value::Null) {
8983 return self.filter_by_since_limit(sorted.clone(), &[since.clone(), limit.clone()]);
8984 }
8985 let mut fromConversion: Value = self.filter_by(sorted.clone(), Value::Str("fromCurrency".to_string()), code.clone(), &[]);
8986 let mut toConversion: Value = self.filter_by(sorted.clone(), Value::Str("toCurrency".to_string()), code.clone(), &[]);
8987 let mut both: Value = self.array_concat(fromConversion.clone(), toConversion.clone());
8988 return self.filter_by_since_limit(both.clone(), &[since.clone(), limit.clone()]);
8989
8990 Value::Null
8991}
8992
8993 fn parse_conversion(&self, mut conversion: Value, optional_args: &[Value]) -> Value {
8994 { let __v = crate::exchange::DerivedExchange::parse_conversion(self, conversion.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null), crate::runtime::get_arg(optional_args, 1, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
8996
8997 let mut fromCurrency = get_arg(optional_args, 0, Value::Null);
8998 let mut toCurrency = get_arg(optional_args, 1, Value::Null);
8999 if is_equal(&conversion, &Value::Null) {
9000 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseConversion () is not supported yet".to_string()))));
9001 }
9002 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseConversion () is not supported yet".to_string()))));
9003
9004 Value::Null
9005}
9006
9007 fn convert_expire_date(&self, mut date: Value) -> Value {
9008 if is_equal(&date, &Value::Null) {
9009 return Value::Null;
9010 }
9011 let mut year: Value = slice(&date, &Value::Int(0), &Value::Int(2));
9013 let mut month: Value = slice(&date, &Value::Int(2), &Value::Int(4));
9014 let mut day: Value = slice(&date, &Value::Int(4), &Value::Int(6));
9015 let mut reconstructedDate: Value = add(&add(&add(&add(&add(&add(&Value::Str("20".to_string()), &year), &Value::Str("-".to_string())), &month), &Value::Str("-".to_string())), &day), &Value::Str("T00:00:00.000Z".to_string()));
9018 return reconstructedDate;
9019
9020 Value::Null
9021}
9022
9023 fn convert_expire_date_to_market_id_date(&self, mut date: Value) -> Value {
9024 if is_equal(&date, &Value::Null) {
9025 return Value::Null;
9026 }
9027 let mut year: Value = slice(&date, &Value::Int(0), &Value::Int(2));
9029 let mut monthRaw: Value = slice(&date, &Value::Int(2), &Value::Int(4));
9030 let mut month: Value = Value::Null;
9031 let mut day: Value = slice(&date, &Value::Int(4), &Value::Int(6));
9032 if is_equal(&monthRaw, &Value::Str("01".to_string())) {
9033 month = Value::Str("JAN".to_string());
9034 } else if is_equal(&monthRaw, &Value::Str("02".to_string())) {
9035 month = Value::Str("FEB".to_string());
9036 } else if is_equal(&monthRaw, &Value::Str("03".to_string())) {
9037 month = Value::Str("MAR".to_string());
9038 } else if is_equal(&monthRaw, &Value::Str("04".to_string())) {
9039 month = Value::Str("APR".to_string());
9040 } else if is_equal(&monthRaw, &Value::Str("05".to_string())) {
9041 month = Value::Str("MAY".to_string());
9042 } else if is_equal(&monthRaw, &Value::Str("06".to_string())) {
9043 month = Value::Str("JUN".to_string());
9044 } else if is_equal(&monthRaw, &Value::Str("07".to_string())) {
9045 month = Value::Str("JUL".to_string());
9046 } else if is_equal(&monthRaw, &Value::Str("08".to_string())) {
9047 month = Value::Str("AUG".to_string());
9048 } else if is_equal(&monthRaw, &Value::Str("09".to_string())) {
9049 month = Value::Str("SEP".to_string());
9050 } else if is_equal(&monthRaw, &Value::Str("10".to_string())) {
9051 month = Value::Str("OCT".to_string());
9052 } else if is_equal(&monthRaw, &Value::Str("11".to_string())) {
9053 month = Value::Str("NOV".to_string());
9054 } else if is_equal(&monthRaw, &Value::Str("12".to_string())) {
9055 month = Value::Str("DEC".to_string());
9056 }
9057 let mut reconstructedDate: Value = add(&add(&day, &month), &year);
9058 return reconstructedDate;
9059
9060 Value::Null
9061}
9062
9063 fn convert_market_id_expire_date(&self, mut date: Value) -> Value {
9064 if is_equal(&date, &Value::Null) {
9065 return Value::Null;
9066 }
9067 let mut monthMappping: Value = Value::Map({
9069 let mut m = indexmap::IndexMap::new();
9070 m.insert("JAN".to_string(), Value::Str("01".to_string()));
9071 m.insert("FEB".to_string(), Value::Str("02".to_string()));
9072 m.insert("MAR".to_string(), Value::Str("03".to_string()));
9073 m.insert("APR".to_string(), Value::Str("04".to_string()));
9074 m.insert("MAY".to_string(), Value::Str("05".to_string()));
9075 m.insert("JUN".to_string(), Value::Str("06".to_string()));
9076 m.insert("JUL".to_string(), Value::Str("07".to_string()));
9077 m.insert("AUG".to_string(), Value::Str("08".to_string()));
9078 m.insert("SEP".to_string(), Value::Str("09".to_string()));
9079 m.insert("OCT".to_string(), Value::Str("10".to_string()));
9080 m.insert("NOV".to_string(), Value::Str("11".to_string()));
9081 m.insert("DEC".to_string(), Value::Str("12".to_string()));
9082 m
9083 });
9084 if is_equal(&get_array_length(&date), &Value::Int(6)) {
9086 date = add(&Value::Str("0".to_string()), &date);
9087 }
9088 let mut year: Value = slice(&date, &Value::Int(0), &Value::Int(2));
9089 let mut monthName: Value = slice(&date, &Value::Int(2), &Value::Int(5));
9090 let mut month: Value = self.safe_string(monthMappping.clone(), monthName.clone(), &[]);
9091 let mut day: Value = slice(&date, &Value::Int(5), &Value::Int(7));
9092 let mut reconstructedDate: Value = add(&add(&day, &month), &year);
9093 return reconstructedDate;
9094
9095 Value::Null
9096}
9097
9098 fn load_markets_and_sign_in(&mut self) -> impl ::std::future::Future<Output = Value> + Send { async move {
9099 promise_all(&Value::List(vec![self.load_markets(&[]).await, self.sign_in(&[]).await])).await;
9100
9101 Value::Null
9102} }
9103
9104 fn parse_margin_modification(&self, mut data: Value, optional_args: &[Value]) -> Value {
9105 { let __v = crate::exchange::DerivedExchange::parse_margin_modification(self, data.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }
9107
9108 let mut market = get_arg(optional_args, 0, Value::Null);
9109 if is_equal(&data, &Value::Null) {
9110 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseMarginModification() is not supported yet".to_string()))));
9111 }
9112 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parseMarginModification() is not supported yet".to_string()))));
9113
9114 Value::Null
9115}
9116
9117 fn parse_margin_modifications(&self, mut response: Value, optional_args: &[Value]) -> Value {
9118 let mut symbols = get_arg(optional_args, 0, Value::Null);
9119 let mut symbolKey = get_arg(optional_args, 1, Value::Null);
9120 let mut marketType = get_arg(optional_args, 2, Value::Null);
9121 let mut marginModifications: Value = Value::List(vec![]);
9122 if is_equal(&response, &Value::Null) {
9123 return marginModifications;
9124 }
9125 {
9126 let mut i: Value = Value::Int(0);
9127 let mut __for_first_171: bool = true;
9128 while { if !__for_first_171 { i = add(&i, &Value::Int(1)); } __for_first_171 = false; is_less_than(&i, &get_array_length(&response)) } {
9129 let mut info: Value = get_value(&response, &i);
9130 let mut info: Value = get_value(&response, &i);
9131 let mut marketId: Value = ternary(is_true(&(is_equal(&symbolKey, &Value::Null))), Value::Null, self.safe_string(info.clone(), symbolKey.clone(), &[]));
9132 let mut market: Value = self.safe_market(&[marketId.clone(), Value::Null, Value::Null, marketType.clone()]);
9133 if is_true(&(is_equal(&symbols, &Value::Null))) || is_true(&self.in_array(get_value(&market, &Value::Str("symbol".to_string())), symbols.clone())) {
9134 append_to_array(&mut marginModifications, <Self as crate::exchange_generated::ExchangeBase>::parse_margin_modification(self, info.clone(), &[market.clone()]));
9135 }
9136 }
9137 }
9138 return marginModifications;
9139
9140 Value::Null
9141}
9142
9143 fn fetch_transfer(&mut self, mut id: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9144 let mut code = get_arg(optional_args, 0, Value::Null);
9145 let mut params = get_arg(optional_args, 1, Value::Map({
9146 let mut m = indexmap::IndexMap::new();
9147 m
9148}));
9149 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchTransfer () is not supported yet".to_string()))));
9150
9151 Value::Null
9152} }
9153
9154 fn fetch_transfers(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9155 let mut code = get_arg(optional_args, 0, Value::Null);
9156 let mut since = get_arg(optional_args, 1, Value::Null);
9157 let mut limit = get_arg(optional_args, 2, Value::Null);
9158 let mut params = get_arg(optional_args, 3, Value::Map({
9159 let mut m = indexmap::IndexMap::new();
9160 m
9161}));
9162 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchTransfers () is not supported yet".to_string()))));
9163
9164 Value::Null
9165} }
9166
9167 fn un_watch_ohlcv(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9168 let mut timeframe = get_arg(optional_args, 0, Value::Str("1m".to_string()));
9169 let mut params = get_arg(optional_args, 1, Value::Map({
9170 let mut m = indexmap::IndexMap::new();
9171 m
9172}));
9173 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" unWatchOHLCV () is not supported yet".to_string()))));
9174
9175 Value::Null
9176} }
9177
9178 fn withdraw_ws(&mut self, mut code: Value, mut amount: Value, mut address: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9179 let mut tag = get_arg(optional_args, 0, Value::Null);
9180 let mut params = get_arg(optional_args, 1, Value::Map({
9181 let mut m = indexmap::IndexMap::new();
9182 m
9183}));
9184 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" withdrawWs () is not supported yet".to_string()))));
9185
9186 Value::Null
9187} }
9188
9189 fn un_watch_my_trades(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9190 let mut symbol = get_arg(optional_args, 0, Value::Null);
9191 let mut params = get_arg(optional_args, 1, Value::Map({
9192 let mut m = indexmap::IndexMap::new();
9193 m
9194}));
9195 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" unWatchMyTrades () is not supported yet".to_string()))));
9196
9197 Value::Null
9198} }
9199
9200 fn fetch_orders_by_status_ws(&mut self, mut status: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9201 let mut symbol = get_arg(optional_args, 0, Value::Null);
9202 let mut since = get_arg(optional_args, 1, Value::Null);
9203 let mut limit = get_arg(optional_args, 2, Value::Null);
9204 let mut params = get_arg(optional_args, 3, Value::Map({
9205 let mut m = indexmap::IndexMap::new();
9206 m
9207}));
9208 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOrdersByStatusWs () is not supported yet".to_string()))));
9209
9210 Value::Null
9211} }
9212
9213 fn un_watch_bids_asks(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9214 let mut symbols = get_arg(optional_args, 0, Value::Null);
9215 let mut params = get_arg(optional_args, 1, Value::Map({
9216 let mut m = indexmap::IndexMap::new();
9217 m
9218}));
9219 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" unWatchBidsAsks () is not supported yet".to_string()))));
9220
9221 Value::Null
9222} }
9223
9224 fn clean_unsubscription(&self, mut client: Value, mut subHash: Value, mut unsubHash: Value, optional_args: &[Value]) {
9225 let mut subHashIsPrefix = get_arg(optional_args, 0, Value::Bool(false));
9226 if is_true(&(!is_equal(&unsubHash, &Value::Null))) && is_true(&(Value::Bool(in_op(&get_value(&client, &Value::Str("subscriptions".to_string())), &unsubHash)))) {
9227 remove(&mut get_value(&client, &Value::Str("subscriptions".to_string())), &unsubHash);
9228 }
9229 if !is_true(&subHashIsPrefix) {
9230 if is_true(&(!is_equal(&subHash, &Value::Null))) && is_true(&(Value::Bool(in_op(&get_value(&client, &Value::Str("subscriptions".to_string())), &subHash)))) {
9231 remove(&mut get_value(&client, &Value::Str("subscriptions".to_string())), &subHash);
9232 }
9233 if is_true(&(!is_equal(&subHash, &Value::Null))) && is_true(&(Value::Bool(in_op(&get_value(&client, &Value::Str("futures".to_string())), &subHash)))) {
9234 let mut error = crate::exchange_errors::unsubscribe_error(add(&add(&self.id, &Value::Str(" ".to_string())), &subHash));
9235 client.reject(&[Value::from(error.clone()), subHash.clone()]);
9236 }
9237 } else {
9238 let mut clientSubscriptions: Value = object_keys(&get_value(&client, &Value::Str("subscriptions".to_string())));
9239 {
9240 let mut i: Value = Value::Int(0);
9241 let mut __for_first_172: bool = true;
9242 while { if !__for_first_172 { i = add(&i, &Value::Int(1)); } __for_first_172 = false; is_less_than(&i, &get_array_length(&clientSubscriptions)) } {
9243 let mut sub: Value = get_value(&clientSubscriptions, &i);
9244 let mut sub: Value = get_value(&clientSubscriptions, &i);
9245 if is_true(&(!is_equal(&sub, &Value::Null))) && is_true(&(!is_equal(&subHash, &Value::Null))) && is_true(&Value::Bool(starts_with(&sub, &subHash))) {
9246 remove(&mut get_value(&client, &Value::Str("subscriptions".to_string())), &sub);
9247 }
9248 }
9249 }
9250 let mut clientFutures: Value = object_keys(&get_value(&client, &Value::Str("futures".to_string())));
9251 {
9252 let mut i: Value = Value::Int(0);
9253 let mut __for_first_173: bool = true;
9254 while { if !__for_first_173 { i = add(&i, &Value::Int(1)); } __for_first_173 = false; is_less_than(&i, &get_array_length(&clientFutures)) } {
9255 let mut future: Value = get_value(&clientFutures, &i);
9256 let mut future: Value = get_value(&clientFutures, &i);
9257 if is_true(&(!is_equal(&future, &Value::Null))) && is_true(&(!is_equal(&subHash, &Value::Null))) && is_true(&Value::Bool(starts_with(&future, &subHash))) {
9258 let mut error = crate::exchange_errors::unsubscribe_error(add(&add(&self.id, &Value::Str(" ".to_string())), &future));
9259 client.reject(&[Value::from(error.clone()), future.clone()]);
9260 }
9261 }
9262 }
9263 }
9264 client.resolve(&[Value::Bool(true), unsubHash.clone()]);
9265}
9266
9267 fn clean_cache(&mut self, mut subscription: Value) {
9268 let mut topic: Value = self.safe_string_k(subscription.clone(), "topic", &[]);
9269 let mut symbols: Value = self.safe_list_k(subscription.clone(), "symbols", &[Value::List(vec![])]);
9270 let mut symbolsLength: Value = get_array_length(&symbols);
9271 if is_equal(&topic, &Value::Str("ohlcv".to_string())) {
9272 let mut symbolsAndTimeframes: Value = self.safe_list_k(subscription.clone(), "symbolsAndTimeframes", &[Value::List(vec![])]);
9273 {
9274 let mut i: Value = Value::Int(0);
9275 let mut __for_first_174: bool = true;
9276 while { if !__for_first_174 { i = add(&i, &Value::Int(1)); } __for_first_174 = false; is_less_than(&i, &get_array_length(&symbolsAndTimeframes)) } {
9277 let mut symbolAndTimeFrame: Value = get_value(&symbolsAndTimeframes, &i);
9278 let mut symbolAndTimeFrame: Value = get_value(&symbolsAndTimeframes, &i);
9279 let mut symbol: Value = self.safe_string(symbolAndTimeFrame.clone(), Value::Int(0), &[]);
9280 let mut timeframe: Value = self.safe_string(symbolAndTimeFrame.clone(), Value::Int(1), &[]);
9281 if is_equal(&symbol, &Value::Null) {
9282 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" cleanCache() requires a symbol argument".to_string()))));
9283 }
9284 if is_equal(&timeframe, &Value::Null) {
9285 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" cleanCache() requires a timeframe argument".to_string()))));
9286 }
9287 if is_true(&(!is_equal(&self.ohlcvs, &Value::Null))) && is_true(&(Value::Bool(in_op(&self.ohlcvs, &symbol)))) {
9288 if is_true(&Value::Bool(in_op(&get_value(&self.ohlcvs, &symbol), &timeframe))) {
9289 remove(&mut get_value(&self.ohlcvs, &symbol), &timeframe);
9290 }
9291 }
9292 }
9293 }
9294 } else if is_greater_than(&symbolsLength, &Value::Int(0)) {
9295 {
9296 let mut i: Value = Value::Int(0);
9297 let mut __for_first_175: bool = true;
9298 while { if !__for_first_175 { i = add(&i, &Value::Int(1)); } __for_first_175 = false; is_less_than(&i, &get_array_length(&symbols)) } {
9299 let mut symbol: Value = get_value(&symbols, &i);
9300 let mut symbol: Value = get_value(&symbols, &i);
9301 if is_equal(&topic, &Value::Str("trades".to_string())) {
9302 if is_true(&Value::Bool(in_op(&self.trades, &symbol))) {
9303 remove(&mut self.trades.clone(), &symbol);
9304 }
9305 } else if is_equal(&topic, &Value::Str("orderbook".to_string())) {
9306 if is_true(&Value::Bool(in_op(&self.orderbooks, &symbol))) {
9307 remove(&mut self.orderbooks.clone(), &symbol);
9308 }
9309 } else if is_equal(&topic, &Value::Str("ticker".to_string())) {
9310 if is_true(&Value::Bool(in_op(&self.tickers, &symbol))) {
9311 remove(&mut self.tickers.clone(), &symbol);
9312 }
9313 } else if is_equal(&topic, &Value::Str("bidsasks".to_string())) {
9314 if is_true(&Value::Bool(in_op(&self.bidsasks, &symbol))) {
9315 remove(&mut self.bidsasks.clone(), &symbol);
9316 }
9317 }
9318 }
9319 }
9320 } else {
9321 if is_equal(&topic, &Value::Str("myTrades".to_string())) && is_true(&(!is_equal(&self.myTrades, &Value::Null))) {
9322 self.myTrades = Value::Null;
9323 } else if is_equal(&topic, &Value::Str("orders".to_string())) && is_true(&(!is_equal(&self.orders, &Value::Null))) {
9324 self.orders = Value::Null;
9325 } else if is_equal(&topic, &Value::Str("positions".to_string())) && is_true(&(!is_equal(&self.positions, &Value::Null))) {
9326 self.positions = Value::Null;
9327 let mut clients: Value = object_values(&self.clients);
9328 {
9329 let mut i: Value = Value::Int(0);
9330 let mut __for_first_176: bool = true;
9331 while { if !__for_first_176 { i = add(&i, &Value::Int(1)); } __for_first_176 = false; is_less_than(&i, &get_array_length(&clients)) } {
9332 let mut client: Value = get_value(&clients, &i);
9333 let mut client: Value = get_value(&clients, &i);
9334 let mut futures: Value = get_value(&client, &Value::Str("futures".to_string()));
9335 if is_true(&(!is_equal(&futures, &Value::Null))) && is_true(&(Value::Bool(in_op(&futures, &Value::Str("fetchPositionsSnapshot".to_string()))))) {
9336 remove(&mut futures, &Value::Str("fetchPositionsSnapshot".to_string()));
9337 }
9338 }
9339 }
9340 } else if is_true(&(is_equal(&topic, &Value::Str("ticker".to_string())) || is_equal(&topic, &Value::Str("markPrice".to_string())))) && is_true(&(!is_equal(&self.tickers, &Value::Null))) {
9341 let mut tickerSymbols: Value = object_keys(&self.tickers);
9342 {
9343 let mut i: Value = Value::Int(0);
9344 let mut __for_first_177: bool = true;
9345 while { if !__for_first_177 { i = add(&i, &Value::Int(1)); } __for_first_177 = false; is_less_than(&i, &get_array_length(&tickerSymbols)) } {
9346 let mut tickerSymbol: Value = get_value(&tickerSymbols, &i);
9347 let mut tickerSymbol: Value = get_value(&tickerSymbols, &i);
9348 if is_true(&Value::Bool(in_op(&self.tickers, &tickerSymbol))) {
9349 remove(&mut self.tickers.clone(), &tickerSymbol);
9350 }
9351 }
9352 }
9353 } else if is_equal(&topic, &Value::Str("bidsasks".to_string())) && is_true(&(!is_equal(&self.bidsasks, &Value::Null))) {
9354 let mut bidsaskSymbols: Value = object_keys(&self.bidsasks);
9355 {
9356 let mut i: Value = Value::Int(0);
9357 let mut __for_first_178: bool = true;
9358 while { if !__for_first_178 { i = add(&i, &Value::Int(1)); } __for_first_178 = false; is_less_than(&i, &get_array_length(&bidsaskSymbols)) } {
9359 let mut bidsaskSymbol: Value = get_value(&bidsaskSymbols, &i);
9360 let mut bidsaskSymbol: Value = get_value(&bidsaskSymbols, &i);
9361 if is_true(&Value::Bool(in_op(&self.bidsasks, &bidsaskSymbol))) {
9362 remove(&mut self.bidsasks.clone(), &bidsaskSymbol);
9363 }
9364 }
9365 }
9366 }
9367 }
9368}
9369
9370 fn timeframe_from_milliseconds(&self, mut ms: Value) -> Value {
9371 if is_less_than_or_equal(&ms, &Value::Int(0)) {
9372 return Value::Str("".to_string());
9373 }
9374 let mut second: Value = Value::Int(1000);
9375 let mut minute: Value = multiply(&Value::Int(60), &second);
9376 let mut hour: Value = multiply(&Value::Int(60), &minute);
9377 let mut day: Value = multiply(&Value::Int(24), &hour);
9378 let mut week: Value = multiply(&Value::Int(7), &day);
9379 if is_equal(&mod_val(&ms, &week), &Value::Int(0)) {
9380 return add(&(divide(&ms, &week)), &Value::Str("w".to_string()));
9381 }
9382 if is_equal(&mod_val(&ms, &day), &Value::Int(0)) {
9383 return add(&(divide(&ms, &day)), &Value::Str("d".to_string()));
9384 }
9385 if is_equal(&mod_val(&ms, &hour), &Value::Int(0)) {
9386 return add(&(divide(&ms, &hour)), &Value::Str("h".to_string()));
9387 }
9388 if is_equal(&mod_val(&ms, &minute), &Value::Int(0)) {
9389 return add(&(divide(&ms, &minute)), &Value::Str("m".to_string()));
9390 }
9391 if is_equal(&mod_val(&ms, &second), &Value::Int(0)) {
9392 return add(&(divide(&ms, &second)), &Value::Str("s".to_string()));
9393 }
9394 return Value::Str("".to_string());
9395
9396 Value::Null
9397}
9398
9399 fn is_uta_enabled(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9400 let mut params = get_arg(optional_args, 0, Value::Map({
9401 let mut m = indexmap::IndexMap::new();
9402 m
9403}));
9404 return Value::Bool(false);
9405
9406 Value::Null
9407} }
9408 fn close_position(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9409 let mut side = get_arg(optional_args, 0, Value::Null);
9410 let mut params = get_arg(optional_args, 1, Value::Map({
9411 let mut m = indexmap::IndexMap::new();
9412 m
9413}));
9414 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" closePosition() is not supported yet".to_string()))));
9415
9416 Value::Null
9417} }
9418
9419 fn close_all_positions(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9420 let mut params = get_arg(optional_args, 0, Value::Map({
9421 let mut m = indexmap::IndexMap::new();
9422 m
9423}));
9424 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" closeAllPositions() is not supported yet".to_string()))));
9425
9426 Value::Null
9427} }
9428
9429 fn edit_orders(&mut self, mut orders: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9430 let mut params = get_arg(optional_args, 0, Value::Map({
9431 let mut m = indexmap::IndexMap::new();
9432 m
9433}));
9434 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" editOrders() is not supported yet".to_string()))));
9435
9436 Value::Null
9437} }
9438
9439 fn fetch_canceled_and_closed_orders(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9440 let mut symbol = get_arg(optional_args, 0, Value::Null);
9441 let mut since = get_arg(optional_args, 1, Value::Null);
9442 let mut limit = get_arg(optional_args, 2, Value::Null);
9443 let mut params = get_arg(optional_args, 3, Value::Map({
9444 let mut m = indexmap::IndexMap::new();
9445 m
9446}));
9447 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchCanceledAndClosedOrders() is not supported yet".to_string()))));
9448
9449 Value::Null
9450} }
9451
9452 fn fetch_position_history(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9453 if let Some(__v) = self.dispatch_to_derived("fetch_position_history", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(symbol.clone()); __args.extend_from_slice(optional_args); __args }).await {
9455 if !matches!(__v, crate::Value::Null) { return __v; }
9456 }
9457
9458 let mut since = get_arg(optional_args, 0, Value::Null);
9459 let mut limit = get_arg(optional_args, 1, Value::Null);
9460 let mut params = get_arg(optional_args, 2, Value::Map({
9461 let mut m = indexmap::IndexMap::new();
9462 m
9463}));
9464 if !is_equal(&get_value(&self.has, &Value::Str("fetchPositionsHistory".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchPositionsHistory".to_string())), &Value::Bool(false)) {
9475 let mut positions: Value = self.fetch_positions_history(&[Value::List(vec![symbol.clone()]), since.clone(), limit.clone(), params.clone()]).await;
9476 return positions;
9477 } else {
9478 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchPositionHistory () is not supported yet".to_string()))));
9479 }
9480} }
9481
9482 fn fetch_positions_history(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9483 if let Some(__v) = self.dispatch_to_derived("fetch_positions_history", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
9485 if !matches!(__v, crate::Value::Null) { return __v; }
9486 }
9487
9488 let mut symbols = get_arg(optional_args, 0, Value::Null);
9489 let mut since = get_arg(optional_args, 1, Value::Null);
9490 let mut limit = get_arg(optional_args, 2, Value::Null);
9491 let mut params = get_arg(optional_args, 3, Value::Map({
9492 let mut m = indexmap::IndexMap::new();
9493 m
9494}));
9495 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchPositionsHistory () is not supported yet".to_string()))));
9496
9497 Value::Null
9498} }
9499
9500 fn fetch_positions_risk(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9501 let mut symbols = get_arg(optional_args, 0, Value::Null);
9502 let mut params = get_arg(optional_args, 1, Value::Map({
9503 let mut m = indexmap::IndexMap::new();
9504 m
9505}));
9506 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchPositionsRisk() is not supported yet".to_string()))));
9507
9508 Value::Null
9509} }
9510
9511 fn fetch_positions_for_symbol(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9512 let mut params = get_arg(optional_args, 0, Value::Map({
9513 let mut m = indexmap::IndexMap::new();
9514 m
9515}));
9516 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchPositionsForSymbol() is not supported yet".to_string()))));
9517
9518 Value::Null
9519} }
9520
9521 fn fetch_positions_for_symbol_ws(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9522 let mut params = get_arg(optional_args, 0, Value::Map({
9523 let mut m = indexmap::IndexMap::new();
9524 m
9525}));
9526 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchPositionsForSymbol() is not supported yet".to_string()))));
9527
9528 Value::Null
9529} }
9530
9531 fn watch_position(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9532 let mut symbol = get_arg(optional_args, 0, Value::Null);
9533 let mut params = get_arg(optional_args, 1, Value::Map({
9534 let mut m = indexmap::IndexMap::new();
9535 m
9536}));
9537 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchPosition() is not supported yet".to_string()))));
9538
9539 Value::Null
9540} }
9541
9542 fn watch_my_trades_for_symbols(&mut self, mut symbols: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9543 let mut since = get_arg(optional_args, 0, Value::Null);
9544 let mut limit = get_arg(optional_args, 1, Value::Null);
9545 let mut params = get_arg(optional_args, 2, Value::Map({
9546 let mut m = indexmap::IndexMap::new();
9547 m
9548}));
9549 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchMyTradesForSymbols() is not supported yet".to_string()))));
9550
9551 Value::Null
9552} }
9553
9554 fn watch_trades_for_symbols(&mut self, mut symbols: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9555 let mut since = get_arg(optional_args, 0, Value::Null);
9556 let mut limit = get_arg(optional_args, 1, Value::Null);
9557 let mut params = get_arg(optional_args, 2, Value::Map({
9558 let mut m = indexmap::IndexMap::new();
9559 m
9560}));
9561 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchTradesForSymbols() is not supported yet".to_string()))));
9562
9563 Value::Null
9564} }
9565
9566 fn fetch_bids_asks(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9567 let mut symbols = get_arg(optional_args, 0, Value::Null);
9568 let mut params = get_arg(optional_args, 1, Value::Map({
9569 let mut m = indexmap::IndexMap::new();
9570 m
9571}));
9572 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchBidsAsks() is not supported yet".to_string()))));
9573
9574 Value::Null
9575} }
9576
9577 fn fetch_mark_price(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9578 let mut params = get_arg(optional_args, 0, Value::Map({
9579 let mut m = indexmap::IndexMap::new();
9580 m
9581}));
9582 if !is_equal(&get_value(&self.has, &Value::Str("fetchMarkPrices".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchMarkPrices".to_string())), &Value::Bool(false)) {
9583 self.load_markets(&[]).await;
9584 let mut market: Value = self.market(symbol.clone());
9585 symbol = get_value(&market, &Value::Str("symbol".to_string()));
9586 let mut tickers: Value = self.fetch_mark_prices(&[Value::List(vec![symbol.clone()]), params.clone()]).await;
9587 let mut ticker: Value = self.safe_dict(tickers.clone(), symbol.clone(), &[]);
9588 if is_equal(&ticker, &Value::Null) {
9589 panic!("{}", crate::exchange_errors::null_response(add(&add(&self.id, &Value::Str(" fetchMarkPrices() could not find a ticker for ".to_string())), &symbol)));
9590 } else {
9591 return ticker;
9592 }
9593 } else {
9594 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchMarkPrices() is not supported yet".to_string()))));
9595 }
9596
9597 Value::Null
9598} }
9599
9600 fn fetch_mark_prices(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9601 let mut symbols = get_arg(optional_args, 0, Value::Null);
9602 let mut params = get_arg(optional_args, 1, Value::Map({
9603 let mut m = indexmap::IndexMap::new();
9604 m
9605}));
9606 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchMarkPrices() is not supported yet".to_string()))));
9607
9608 Value::Null
9609} }
9610
9611 fn watch_bids_asks(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9612 let mut symbols = get_arg(optional_args, 0, Value::Null);
9613 let mut params = get_arg(optional_args, 1, Value::Map({
9614 let mut m = indexmap::IndexMap::new();
9615 m
9616}));
9617 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchBidsAsks() is not supported yet".to_string()))));
9618
9619 Value::Null
9620} }
9621
9622 fn watch_mark_price(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9623 let mut params = get_arg(optional_args, 0, Value::Map({
9624 let mut m = indexmap::IndexMap::new();
9625 m
9626}));
9627 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchMarkPrice () is not supported yet".to_string()))));
9628
9629 Value::Null
9630} }
9631
9632 fn watch_mark_prices(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9633 let mut symbols = get_arg(optional_args, 0, Value::Null);
9634 let mut params = get_arg(optional_args, 1, Value::Map({
9635 let mut m = indexmap::IndexMap::new();
9636 m
9637}));
9638 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchMarkPrices () is not supported yet".to_string()))));
9639
9640 Value::Null
9641} }
9642
9643 fn fetch_l3_order_book(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9644 let mut limit = get_arg(optional_args, 0, Value::Null);
9645 let mut params = get_arg(optional_args, 1, Value::Map({
9646 let mut m = indexmap::IndexMap::new();
9647 m
9648}));
9649 panic!("{}", crate::exchange_errors::bad_request(add(&self.id, &Value::Str(" fetchL3OrderBook() is not supported yet".to_string()))));
9650
9651 Value::Null
9652} }
9653
9654 fn watch_order_book_for_symbols(&mut self, mut symbols: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9655 let mut limit = get_arg(optional_args, 0, Value::Null);
9656 let mut params = get_arg(optional_args, 1, Value::Map({
9657 let mut m = indexmap::IndexMap::new();
9658 m
9659}));
9660 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchOrderBookForSymbols() is not supported yet".to_string()))));
9661
9662 Value::Null
9663} }
9664
9665 fn watch_orders_for_symbols(&mut self, mut symbols: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9666 let mut since = get_arg(optional_args, 0, Value::Null);
9667 let mut limit = get_arg(optional_args, 1, Value::Null);
9668 let mut params = get_arg(optional_args, 2, Value::Map({
9669 let mut m = indexmap::IndexMap::new();
9670 m
9671}));
9672 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchOrdersForSymbols() is not supported yet".to_string()))));
9673
9674 Value::Null
9675} }
9676
9677 fn cancel_all_orders_ws(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9678 let mut symbol = get_arg(optional_args, 0, Value::Null);
9679 let mut params = get_arg(optional_args, 1, Value::Map({
9680 let mut m = indexmap::IndexMap::new();
9681 m
9682}));
9683 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" cancelAllOrdersWs() is not supported yet".to_string()))));
9684
9685 Value::Null
9686} }
9687
9688 fn cancel_order_ws(&mut self, mut id: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9689 let mut symbol = get_arg(optional_args, 0, Value::Null);
9690 let mut params = get_arg(optional_args, 1, Value::Map({
9691 let mut m = indexmap::IndexMap::new();
9692 m
9693}));
9694 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" cancelOrderWs() is not supported yet".to_string()))));
9695
9696 Value::Null
9697} }
9698
9699 fn cancel_orders_ws(&mut self, mut ids: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9700 let mut symbol = get_arg(optional_args, 0, Value::Null);
9701 let mut params = get_arg(optional_args, 1, Value::Map({
9702 let mut m = indexmap::IndexMap::new();
9703 m
9704}));
9705 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" cancelOrdersWs() is not supported yet".to_string()))));
9706
9707 Value::Null
9708} }
9709
9710 fn create_limit_buy_order_ws(&mut self, mut symbol: Value, mut amount: Value, mut price: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9711 let mut params = get_arg(optional_args, 0, Value::Map({
9712 let mut m = indexmap::IndexMap::new();
9713 m
9714}));
9715 return self.create_order_ws(symbol.clone(), Value::Str("limit".to_string()), Value::Str("buy".to_string()), amount.clone(), &[price.clone(), params.clone()]).await;
9716
9717 Value::Null
9718} }
9719
9720 fn create_limit_order_ws(&mut self, mut symbol: Value, mut side: Value, mut amount: Value, mut price: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9721 let mut params = get_arg(optional_args, 0, Value::Map({
9722 let mut m = indexmap::IndexMap::new();
9723 m
9724}));
9725 return self.create_order_ws(symbol.clone(), Value::Str("limit".to_string()), side.clone(), amount.clone(), &[price.clone(), params.clone()]).await;
9726
9727 Value::Null
9728} }
9729
9730 fn create_limit_sell_order_ws(&mut self, mut symbol: Value, mut amount: Value, mut price: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9731 let mut params = get_arg(optional_args, 0, Value::Map({
9732 let mut m = indexmap::IndexMap::new();
9733 m
9734}));
9735 return self.create_order_ws(symbol.clone(), Value::Str("limit".to_string()), Value::Str("sell".to_string()), amount.clone(), &[price.clone(), params.clone()]).await;
9736
9737 Value::Null
9738} }
9739
9740 fn create_market_buy_order_ws(&mut self, mut symbol: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9741 let mut params = get_arg(optional_args, 0, Value::Map({
9742 let mut m = indexmap::IndexMap::new();
9743 m
9744}));
9745 return self.create_order_ws(symbol.clone(), Value::Str("market".to_string()), Value::Str("buy".to_string()), amount.clone(), &[Value::Null, params.clone()]).await;
9746
9747 Value::Null
9748} }
9749
9750 fn create_market_order_with_cost_ws(&mut self, mut symbol: Value, mut side: Value, mut cost: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9751 let mut params = get_arg(optional_args, 0, Value::Map({
9752 let mut m = indexmap::IndexMap::new();
9753 m
9754}));
9755 if is_true(&(!is_equal(&get_value(&self.has, &Value::Str("createMarketOrderWithCostWs".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("createMarketOrderWithCostWs".to_string())), &Value::Bool(false)))) || is_true(&(is_true(&(!is_equal(&get_value(&self.has, &Value::Str("createMarketBuyOrderWithCostWs".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("createMarketBuyOrderWithCostWs".to_string())), &Value::Bool(false)))) && is_true(&(!is_equal(&get_value(&self.has, &Value::Str("createMarketSellOrderWithCostWs".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("createMarketSellOrderWithCostWs".to_string())), &Value::Bool(false)))))) {
9766 return self.create_order_ws(symbol.clone(), Value::Str("market".to_string()), side.clone(), cost.clone(), &[Value::Int(1), params.clone()]).await;
9767 }
9768 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createMarketOrderWithCostWs() is not supported yet".to_string()))));
9769
9770 Value::Null
9771} }
9772
9773 fn create_market_order_ws(&mut self, mut symbol: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9774 let mut price = get_arg(optional_args, 0, Value::Null);
9775 let mut params = get_arg(optional_args, 1, Value::Map({
9776 let mut m = indexmap::IndexMap::new();
9777 m
9778}));
9779 return self.create_order_ws(symbol.clone(), Value::Str("market".to_string()), side.clone(), amount.clone(), &[price.clone(), params.clone()]).await;
9780
9781 Value::Null
9782} }
9783
9784 fn create_market_sell_order_ws(&mut self, mut symbol: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9785 let mut params = get_arg(optional_args, 0, Value::Map({
9786 let mut m = indexmap::IndexMap::new();
9787 m
9788}));
9789 return self.create_order_ws(symbol.clone(), Value::Str("market".to_string()), Value::Str("sell".to_string()), amount.clone(), &[Value::Null, params.clone()]).await;
9790
9791 Value::Null
9792} }
9793
9794 fn create_order_with_take_profit_and_stop_loss_ws(&mut self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9795 let mut price = get_arg(optional_args, 0, Value::Null);
9796 let mut takeProfit = get_arg(optional_args, 1, Value::Null);
9797 let mut stopLoss = get_arg(optional_args, 2, Value::Null);
9798 let mut params = get_arg(optional_args, 3, Value::Map({
9799 let mut m = indexmap::IndexMap::new();
9800 m
9801}));
9802 params = self.set_take_profit_and_stop_loss_params(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), takeProfit.clone(), stopLoss.clone(), params.clone()]);
9825 if !is_equal(&get_value(&self.has, &Value::Str("createOrderWithTakeProfitAndStopLossWs".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("createOrderWithTakeProfitAndStopLossWs".to_string())), &Value::Bool(false)) {
9826 return self.create_order_ws(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), params.clone()]).await;
9827 }
9828 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createOrderWithTakeProfitAndStopLossWs() is not supported yet".to_string()))));
9829
9830 Value::Null
9831} }
9832
9833 fn create_order_ws(&mut self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9834 let mut price = get_arg(optional_args, 0, Value::Null);
9835 let mut params = get_arg(optional_args, 1, Value::Map({
9836 let mut m = indexmap::IndexMap::new();
9837 m
9838}));
9839 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createOrderWs() is not supported yet".to_string()))));
9840
9841 Value::Null
9842} }
9843
9844 fn create_orders_ws(&mut self, mut orders: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9845 let mut params = get_arg(optional_args, 0, Value::Map({
9846 let mut m = indexmap::IndexMap::new();
9847 m
9848}));
9849 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createOrdersWs () is not supported yet".to_string()))));
9850
9851 Value::Null
9852} }
9853
9854 fn create_post_only_order_ws(&mut self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9855 let mut price = get_arg(optional_args, 0, Value::Null);
9856 let mut params = get_arg(optional_args, 1, Value::Map({
9857 let mut m = indexmap::IndexMap::new();
9858 m
9859}));
9860 if is_equal(&get_value(&self.has, &Value::Str("createPostOnlyOrderWs".to_string())), &Value::Null) || is_equal(&get_value(&self.has, &Value::Str("createPostOnlyOrderWs".to_string())), &Value::Bool(false)) {
9861 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createPostOnlyOrderWs() is not supported yet".to_string()))));
9862 }
9863 let mut query: Value = self.extend(params.clone(), &[Value::Map({
9864 let mut m = indexmap::IndexMap::new();
9865 m.insert("postOnly".to_string(), Value::Bool(true));
9866 m
9867 })]);
9868 return self.create_order_ws(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), query.clone()]).await;
9869
9870 Value::Null
9871} }
9872
9873 fn create_reduce_only_order_ws(&mut self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9874 let mut price = get_arg(optional_args, 0, Value::Null);
9875 let mut params = get_arg(optional_args, 1, Value::Map({
9876 let mut m = indexmap::IndexMap::new();
9877 m
9878}));
9879 if is_equal(&get_value(&self.has, &Value::Str("createReduceOnlyOrderWs".to_string())), &Value::Null) || is_equal(&get_value(&self.has, &Value::Str("createReduceOnlyOrderWs".to_string())), &Value::Bool(false)) {
9880 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createReduceOnlyOrderWs() is not supported yet".to_string()))));
9881 }
9882 let mut query: Value = self.extend(params.clone(), &[Value::Map({
9883 let mut m = indexmap::IndexMap::new();
9884 m.insert("reduceOnly".to_string(), Value::Bool(true));
9885 m
9886 })]);
9887 return self.create_order_ws(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), query.clone()]).await;
9888
9889 Value::Null
9890} }
9891
9892 fn create_stop_limit_order_ws(&mut self, mut symbol: Value, mut side: Value, mut amount: Value, mut price: Value, mut triggerPrice: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9893 let mut params = get_arg(optional_args, 0, Value::Map({
9894 let mut m = indexmap::IndexMap::new();
9895 m
9896}));
9897 if is_equal(&get_value(&self.has, &Value::Str("createStopLimitOrderWs".to_string())), &Value::Null) || is_equal(&get_value(&self.has, &Value::Str("createStopLimitOrderWs".to_string())), &Value::Bool(false)) {
9898 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createStopLimitOrderWs() is not supported yet".to_string()))));
9899 }
9900 let mut query: Value = self.extend(params.clone(), &[Value::Map({
9901 let mut m = indexmap::IndexMap::new();
9902 m.insert("stopPrice".to_string(), triggerPrice.clone());
9903 m
9904 })]);
9905 return self.create_order_ws(symbol.clone(), Value::Str("limit".to_string()), side.clone(), amount.clone(), &[price.clone(), query.clone()]).await;
9906
9907 Value::Null
9908} }
9909
9910 fn create_stop_loss_order_ws(&mut self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9911 let mut price = get_arg(optional_args, 0, Value::Null);
9912 let mut stopLossPrice = get_arg(optional_args, 1, Value::Null);
9913 let mut params = get_arg(optional_args, 2, Value::Map({
9914 let mut m = indexmap::IndexMap::new();
9915 m
9916}));
9917 if is_equal(&stopLossPrice, &Value::Null) {
9931 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" createStopLossOrderWs() requires a stopLossPrice argument".to_string()))));
9932 }
9933 params = self.extend(params.clone(), &[Value::Map({
9934 let mut m = indexmap::IndexMap::new();
9935 m.insert("stopLossPrice".to_string(), stopLossPrice.clone());
9936 m
9937 })]);
9938 if !is_equal(&get_value(&self.has, &Value::Str("createStopLossOrderWs".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("createStopLossOrderWs".to_string())), &Value::Bool(false)) {
9939 return self.create_order_ws(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), params.clone()]).await;
9940 }
9941 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createStopLossOrderWs() is not supported yet".to_string()))));
9942
9943 Value::Null
9944} }
9945
9946 fn create_stop_market_order_ws(&mut self, mut symbol: Value, mut side: Value, mut amount: Value, mut triggerPrice: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9947 let mut params = get_arg(optional_args, 0, Value::Map({
9948 let mut m = indexmap::IndexMap::new();
9949 m
9950}));
9951 if is_equal(&get_value(&self.has, &Value::Str("createStopMarketOrderWs".to_string())), &Value::Null) || is_equal(&get_value(&self.has, &Value::Str("createStopMarketOrderWs".to_string())), &Value::Bool(false)) {
9952 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createStopMarketOrderWs() is not supported yet".to_string()))));
9953 }
9954 let mut query: Value = self.extend(params.clone(), &[Value::Map({
9955 let mut m = indexmap::IndexMap::new();
9956 m.insert("stopPrice".to_string(), triggerPrice.clone());
9957 m
9958 })]);
9959 return self.create_order_ws(symbol.clone(), Value::Str("market".to_string()), side.clone(), amount.clone(), &[Value::Null, query.clone()]).await;
9960
9961 Value::Null
9962} }
9963
9964 fn create_stop_order_ws(&mut self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9965 let mut price = get_arg(optional_args, 0, Value::Null);
9966 let mut triggerPrice = get_arg(optional_args, 1, Value::Null);
9967 let mut params = get_arg(optional_args, 2, Value::Map({
9968 let mut m = indexmap::IndexMap::new();
9969 m
9970}));
9971 if is_equal(&get_value(&self.has, &Value::Str("createStopOrderWs".to_string())), &Value::Null) || is_equal(&get_value(&self.has, &Value::Str("createStopOrderWs".to_string())), &Value::Bool(false)) {
9972 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createStopOrderWs() is not supported yet".to_string()))));
9973 }
9974 if is_equal(&triggerPrice, &Value::Null) {
9975 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" createStopOrderWs() requires a stopPrice argument".to_string()))));
9976 }
9977 let mut query: Value = self.extend(params.clone(), &[Value::Map({
9978 let mut m = indexmap::IndexMap::new();
9979 m.insert("stopPrice".to_string(), triggerPrice.clone());
9980 m
9981 })]);
9982 return self.create_order_ws(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), query.clone()]).await;
9983
9984 Value::Null
9985} }
9986
9987 fn create_take_profit_order_ws(&mut self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
9988 let mut price = get_arg(optional_args, 0, Value::Null);
9989 let mut takeProfitPrice = get_arg(optional_args, 1, Value::Null);
9990 let mut params = get_arg(optional_args, 2, Value::Map({
9991 let mut m = indexmap::IndexMap::new();
9992 m
9993}));
9994 if is_equal(&takeProfitPrice, &Value::Null) {
10008 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" createTakeProfitOrderWs() requires a takeProfitPrice argument".to_string()))));
10009 }
10010 params = self.extend(params.clone(), &[Value::Map({
10011 let mut m = indexmap::IndexMap::new();
10012 m.insert("takeProfitPrice".to_string(), takeProfitPrice.clone());
10013 m
10014 })]);
10015 if !is_equal(&get_value(&self.has, &Value::Str("createTakeProfitOrderWs".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("createTakeProfitOrderWs".to_string())), &Value::Bool(false)) {
10016 return self.create_order_ws(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), params.clone()]).await;
10017 }
10018 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createTakeProfitOrderWs() is not supported yet".to_string()))));
10019
10020 Value::Null
10021} }
10022
10023 fn create_trailing_amount_order_ws(&mut self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10024 let mut price = get_arg(optional_args, 0, Value::Null);
10025 let mut trailingAmount = get_arg(optional_args, 1, Value::Null);
10026 let mut trailingTriggerPrice = get_arg(optional_args, 2, Value::Null);
10027 let mut params = get_arg(optional_args, 3, Value::Map({
10028 let mut m = indexmap::IndexMap::new();
10029 m
10030}));
10031 if is_equal(&trailingAmount, &Value::Null) {
10046 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" createTrailingAmountOrderWs() requires a trailingAmount argument".to_string()))));
10047 }
10048 add_element_to_object(&mut params, &Value::Str("trailingAmount".to_string()), trailingAmount.clone());
10049 if !is_equal(&trailingTriggerPrice, &Value::Null) {
10050 add_element_to_object(&mut params, &Value::Str("trailingTriggerPrice".to_string()), trailingTriggerPrice.clone());
10051 }
10052 if !is_equal(&get_value(&self.has, &Value::Str("createTrailingAmountOrderWs".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("createTrailingAmountOrderWs".to_string())), &Value::Bool(false)) {
10053 return self.create_order_ws(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), params.clone()]).await;
10054 }
10055 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createTrailingAmountOrderWs() is not supported yet".to_string()))));
10056
10057 Value::Null
10058} }
10059
10060 fn create_trailing_percent_order_ws(&mut self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10061 let mut price = get_arg(optional_args, 0, Value::Null);
10062 let mut trailingPercent = get_arg(optional_args, 1, Value::Null);
10063 let mut trailingTriggerPrice = get_arg(optional_args, 2, Value::Null);
10064 let mut params = get_arg(optional_args, 3, Value::Map({
10065 let mut m = indexmap::IndexMap::new();
10066 m
10067}));
10068 if is_equal(&trailingPercent, &Value::Null) {
10083 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" createTrailingPercentOrderWs() requires a trailingPercent argument".to_string()))));
10084 }
10085 add_element_to_object(&mut params, &Value::Str("trailingPercent".to_string()), trailingPercent.clone());
10086 if !is_equal(&trailingTriggerPrice, &Value::Null) {
10087 add_element_to_object(&mut params, &Value::Str("trailingTriggerPrice".to_string()), trailingTriggerPrice.clone());
10088 }
10089 if !is_equal(&get_value(&self.has, &Value::Str("createTrailingPercentOrderWs".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("createTrailingPercentOrderWs".to_string())), &Value::Bool(false)) {
10090 return self.create_order_ws(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), params.clone()]).await;
10091 }
10092 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createTrailingPercentOrderWs() is not supported yet".to_string()))));
10093
10094 Value::Null
10095} }
10096
10097 fn create_trigger_order_ws(&mut self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10098 let mut price = get_arg(optional_args, 0, Value::Null);
10099 let mut triggerPrice = get_arg(optional_args, 1, Value::Null);
10100 let mut params = get_arg(optional_args, 2, Value::Map({
10101 let mut m = indexmap::IndexMap::new();
10102 m
10103}));
10104 if is_equal(&triggerPrice, &Value::Null) {
10118 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" createTriggerOrderWs() requires a triggerPrice argument".to_string()))));
10119 }
10120 params = self.extend(params.clone(), &[Value::Map({
10121 let mut m = indexmap::IndexMap::new();
10122 m.insert("triggerPrice".to_string(), triggerPrice.clone());
10123 m
10124 })]);
10125 if !is_equal(&get_value(&self.has, &Value::Str("createTriggerOrderWs".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("createTriggerOrderWs".to_string())), &Value::Bool(false)) {
10126 return self.create_order_ws(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), params.clone()]).await;
10127 }
10128 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createTriggerOrderWs() is not supported yet".to_string()))));
10129
10130 Value::Null
10131} }
10132
10133 fn edit_order_ws(&mut self, mut id: Value, mut symbol: Value, mut type_var: Value, mut side: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10134 let mut amount = get_arg(optional_args, 0, Value::Null);
10135 let mut price = get_arg(optional_args, 1, Value::Null);
10136 let mut params = get_arg(optional_args, 2, Value::Map({
10137 let mut m = indexmap::IndexMap::new();
10138 m
10139}));
10140 self.cancel_order_ws(id.clone(), &[symbol.clone()]).await;
10141 return self.create_order_ws(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), params.clone()]).await;
10142
10143 Value::Null
10144} }
10145
10146 fn fetch_closed_orders_ws(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10147 let mut symbol = get_arg(optional_args, 0, Value::Null);
10148 let mut since = get_arg(optional_args, 1, Value::Null);
10149 let mut limit = get_arg(optional_args, 2, Value::Null);
10150 let mut params = get_arg(optional_args, 3, Value::Map({
10151 let mut m = indexmap::IndexMap::new();
10152 m
10153}));
10154 if !is_equal(&get_value(&self.has, &Value::Str("fetchOrdersWs".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchOrdersWs".to_string())), &Value::Bool(false)) {
10155 let mut orders: Value = self.fetch_orders_ws(&[symbol.clone(), since.clone(), limit.clone(), params.clone()]).await;
10156 return self.filter_by(orders.clone(), Value::Str("status".to_string()), Value::Str("closed".to_string()), &[]);
10157 }
10158 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchClosedOrdersWs() is not supported yet".to_string()))));
10159
10160 Value::Null
10161} }
10162
10163 fn fetch_my_trades_ws(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10164 let mut symbol = get_arg(optional_args, 0, Value::Null);
10165 let mut since = get_arg(optional_args, 1, Value::Null);
10166 let mut limit = get_arg(optional_args, 2, Value::Null);
10167 let mut params = get_arg(optional_args, 3, Value::Map({
10168 let mut m = indexmap::IndexMap::new();
10169 m
10170}));
10171 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchMyTradesWs() is not supported yet".to_string()))));
10172
10173 Value::Null
10174} }
10175
10176 fn fetch_open_orders_ws(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10177 let mut symbol = get_arg(optional_args, 0, Value::Null);
10178 let mut since = get_arg(optional_args, 1, Value::Null);
10179 let mut limit = get_arg(optional_args, 2, Value::Null);
10180 let mut params = get_arg(optional_args, 3, Value::Map({
10181 let mut m = indexmap::IndexMap::new();
10182 m
10183}));
10184 if !is_equal(&get_value(&self.has, &Value::Str("fetchOrdersWs".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchOrdersWs".to_string())), &Value::Bool(false)) {
10185 let mut orders: Value = self.fetch_orders_ws(&[symbol.clone(), since.clone(), limit.clone(), params.clone()]).await;
10186 return self.filter_by(orders.clone(), Value::Str("status".to_string()), Value::Str("open".to_string()), &[]);
10187 }
10188 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOpenOrdersWs() is not supported yet".to_string()))));
10189
10190 Value::Null
10191} }
10192
10193 fn fetch_order_book_ws(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10194 let mut limit = get_arg(optional_args, 0, Value::Null);
10195 let mut params = get_arg(optional_args, 1, Value::Map({
10196 let mut m = indexmap::IndexMap::new();
10197 m
10198}));
10199 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOrderBookWs() is not supported yet".to_string()))));
10200
10201 Value::Null
10202} }
10203
10204 fn fetch_order_ws(&mut self, mut id: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10205 let mut symbol = get_arg(optional_args, 0, Value::Null);
10206 let mut params = get_arg(optional_args, 1, Value::Map({
10207 let mut m = indexmap::IndexMap::new();
10208 m
10209}));
10210 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOrderWs() is not supported yet".to_string()))));
10211
10212 Value::Null
10213} }
10214
10215 fn fetch_orders_ws(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10216 let mut symbol = get_arg(optional_args, 0, Value::Null);
10217 let mut since = get_arg(optional_args, 1, Value::Null);
10218 let mut limit = get_arg(optional_args, 2, Value::Null);
10219 let mut params = get_arg(optional_args, 3, Value::Map({
10220 let mut m = indexmap::IndexMap::new();
10221 m
10222}));
10223 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOrdersWs() is not supported yet".to_string()))));
10224
10225 Value::Null
10226} }
10227
10228 fn fetch_position_ws(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10229 let mut params = get_arg(optional_args, 0, Value::Map({
10230 let mut m = indexmap::IndexMap::new();
10231 m
10232}));
10233 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchPositionWs() is not supported yet".to_string()))));
10234
10235 Value::Null
10236} }
10237
10238 fn fetch_positions_ws(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10239 let mut symbols = get_arg(optional_args, 0, Value::Null);
10240 let mut params = get_arg(optional_args, 1, Value::Map({
10241 let mut m = indexmap::IndexMap::new();
10242 m
10243}));
10244 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchPositions() is not supported yet".to_string()))));
10245
10246 Value::Null
10247} }
10248
10249 fn fetch_ticker_ws(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10250 let mut params = get_arg(optional_args, 0, Value::Map({
10251 let mut m = indexmap::IndexMap::new();
10252 m
10253}));
10254 if !is_equal(&get_value(&self.has, &Value::Str("fetchTickersWs".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchTickersWs".to_string())), &Value::Bool(false)) {
10255 self.load_markets(&[]).await;
10256 let mut market: Value = self.market(symbol.clone());
10257 symbol = get_value(&market, &Value::Str("symbol".to_string()));
10258 let mut tickers: Value = self.fetch_tickers_ws(&[Value::List(vec![symbol.clone()]), params.clone()]).await;
10259 let mut ticker: Value = self.safe_dict(tickers.clone(), symbol.clone(), &[]);
10260 if is_equal(&ticker, &Value::Null) {
10261 panic!("{}", crate::exchange_errors::null_response(add(&add(&self.id, &Value::Str(" fetchTickerWs() could not find a ticker for ".to_string())), &symbol)));
10262 } else {
10263 return ticker;
10264 }
10265 } else {
10266 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchTickerWs() is not supported yet".to_string()))));
10267 }
10268
10269 Value::Null
10270} }
10271
10272 fn fetch_tickers_ws(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10273 let mut symbols = get_arg(optional_args, 0, Value::Null);
10274 let mut params = get_arg(optional_args, 1, Value::Map({
10275 let mut m = indexmap::IndexMap::new();
10276 m
10277}));
10278 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchTickersWs() is not supported yet".to_string()))));
10279
10280 Value::Null
10281} }
10282
10283 fn fetch_trades_ws(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10284 let mut since = get_arg(optional_args, 0, Value::Null);
10285 let mut limit = get_arg(optional_args, 1, Value::Null);
10286 let mut params = get_arg(optional_args, 2, Value::Map({
10287 let mut m = indexmap::IndexMap::new();
10288 m
10289}));
10290 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchTradesWs() is not supported yet".to_string()))));
10291
10292 Value::Null
10293} }
10294
10295
10296 fn fetch_trades(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10297 if let Some(__v) = self.dispatch_to_derived("fetch_trades", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(symbol.clone()); __args.extend_from_slice(optional_args); __args }).await {
10299 if !matches!(__v, crate::Value::Null) { return __v; }
10300 }
10301
10302 let mut since = get_arg(optional_args, 0, Value::Null);
10303 let mut limit = get_arg(optional_args, 1, Value::Null);
10304 let mut params = get_arg(optional_args, 2, Value::Map({
10305 let mut m = indexmap::IndexMap::new();
10306 m
10307}));
10308 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchTrades() is not supported yet".to_string()))));
10309
10310 Value::Null
10311} }
10312
10313 fn watch_trades(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10314 let mut since = get_arg(optional_args, 0, Value::Null);
10315 let mut limit = get_arg(optional_args, 1, Value::Null);
10316 let mut params = get_arg(optional_args, 2, Value::Map({
10317 let mut m = indexmap::IndexMap::new();
10318 m
10319}));
10320 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchTrades() is not supported yet".to_string()))));
10321
10322 Value::Null
10323} }
10324
10325 fn fetch_order_book(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10326 if let Some(__v) = self.dispatch_to_derived("fetch_order_book", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(symbol.clone()); __args.extend_from_slice(optional_args); __args }).await {
10328 if !matches!(__v, crate::Value::Null) { return __v; }
10329 }
10330
10331 let mut limit = get_arg(optional_args, 0, Value::Null);
10332 let mut params = get_arg(optional_args, 1, Value::Map({
10333 let mut m = indexmap::IndexMap::new();
10334 m
10335}));
10336 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOrderBook() is not supported yet".to_string()))));
10337
10338 Value::Null
10339} }
10340
10341 fn fetch_rest_order_book_safe(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10342 let mut limit = get_arg(optional_args, 0, Value::Null);
10343 let mut params = get_arg(optional_args, 1, Value::Map({
10344 let mut m = indexmap::IndexMap::new();
10345 m
10346}));
10347 let mut fetchSnapshotMaxRetries: Value = self.handle_option(Value::Str("watchOrderBook".to_string()), Value::Str("maxRetries".to_string()), &[Value::Int(3)]);
10348 {
10349 let mut i: Value = Value::Int(0);
10350 let mut __for_first_179: bool = true;
10351 while { if !__for_first_179 { i = add(&i, &Value::Int(1)); } __for_first_179 = false; is_less_than(&i, &fetchSnapshotMaxRetries) } {
10352 let _try_result = futures::FutureExt::catch_unwind(std::panic::AssertUnwindSafe(async {
10353 let mut orderBook: Value = self.fetch_order_book(symbol.clone(), &[limit.clone(), params.clone()]).await;
10354 return orderBook.clone();
10355 #[allow(unreachable_code)] { Value::Null }})).await;
10356match _try_result { Ok(__try_ok) => { if !matches!(__try_ok, Value::Null) { return __try_ok; } return Value::Null; } Err(_try_err) => { let e: Value = panic_to_value(_try_err);
10357 if is_equal(&(add(&i, &Value::Int(1))), &fetchSnapshotMaxRetries) {
10358 panic!("{}", e);
10359 }
10360 } }
10361 }
10362 }
10363 return Value::Null;
10364
10365 Value::Null
10366} }
10367
10368 fn watch_order_book(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10369 let mut limit = get_arg(optional_args, 0, Value::Null);
10370 let mut params = get_arg(optional_args, 1, Value::Map({
10371 let mut m = indexmap::IndexMap::new();
10372 m
10373}));
10374 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchOrderBook() is not supported yet".to_string()))));
10375
10376 Value::Null
10377} }
10378
10379 fn fetch_open_interest(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10380 if let Some(__v) = self.dispatch_to_derived("fetch_open_interest", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(symbol.clone()); __args.extend_from_slice(optional_args); __args }).await {
10382 if !matches!(__v, crate::Value::Null) { return __v; }
10383 }
10384
10385 let mut params = get_arg(optional_args, 0, Value::Map({
10386 let mut m = indexmap::IndexMap::new();
10387 m
10388}));
10389 if !is_equal(&get_value(&self.has, &Value::Str("fetchOpenInterests".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchOpenInterests".to_string())), &Value::Bool(false)) {
10390 let mut openInterests: Value = self.fetch_open_interests(&[Value::List(vec![symbol.clone()]), params.clone()]).await;
10391 return self.safe_dict(openInterests.clone(), symbol.clone(), &[]);
10392 } else {
10393 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOpenInterest() is not supported yet".to_string()))));
10394 }
10395
10396 Value::Null
10397} }
10398
10399 fn fetch_l2_order_book(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10400 let mut limit = get_arg(optional_args, 0, Value::Null);
10401 let mut params = get_arg(optional_args, 1, Value::Map({
10402 let mut m = indexmap::IndexMap::new();
10403 m
10404}));
10405 let mut orderbook: Value = self.fetch_order_book(symbol.clone(), &[limit.clone(), params.clone()]).await;
10406 return self.extend(orderbook.clone(), &[Value::Map({
10407 let mut m = indexmap::IndexMap::new();
10408 m.insert("asks".to_string(), self.sort_by(self.aggregate(get_value(&orderbook, &Value::Str("asks".to_string()))), Value::Int(0), &[]));
10409 m.insert("bids".to_string(), self.sort_by(self.aggregate(get_value(&orderbook, &Value::Str("bids".to_string()))), Value::Int(0), &[Value::Bool(true)]));
10410 m
10411})]);
10412
10413 Value::Null
10414} }
10415
10416 fn edit_limit_buy_order(&mut self, mut id: Value, mut symbol: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10417 let mut price = get_arg(optional_args, 0, Value::Null);
10418 let mut params = get_arg(optional_args, 1, Value::Map({
10419 let mut m = indexmap::IndexMap::new();
10420 m
10421}));
10422 return self.edit_limit_order(id.clone(), symbol.clone(), Value::Str("buy".to_string()), amount.clone(), &[price.clone(), params.clone()]).await;
10423
10424 Value::Null
10425} }
10426
10427 fn edit_limit_sell_order(&mut self, mut id: Value, mut symbol: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10428 let mut price = get_arg(optional_args, 0, Value::Null);
10429 let mut params = get_arg(optional_args, 1, Value::Map({
10430 let mut m = indexmap::IndexMap::new();
10431 m
10432}));
10433 return self.edit_limit_order(id.clone(), symbol.clone(), Value::Str("sell".to_string()), amount.clone(), &[price.clone(), params.clone()]).await;
10434
10435 Value::Null
10436} }
10437
10438 fn edit_limit_order(&mut self, mut id: Value, mut symbol: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10439 let mut price = get_arg(optional_args, 0, Value::Null);
10440 let mut params = get_arg(optional_args, 1, Value::Map({
10441 let mut m = indexmap::IndexMap::new();
10442 m
10443}));
10444 return self.edit_order(id.clone(), symbol.clone(), Value::Str("limit".to_string()), side.clone(), &[amount.clone(), price.clone(), params.clone()]).await;
10445
10446 Value::Null
10447} }
10448
10449 fn edit_order(&mut self, mut id: Value, mut symbol: Value, mut type_var: Value, mut side: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10450 if let Some(__v) = self.dispatch_to_derived("edit_order", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(id.clone()); __args.push(symbol.clone()); __args.push(type_var.clone()); __args.push(side.clone()); __args.extend_from_slice(optional_args); __args }).await {
10452 if !matches!(__v, crate::Value::Null) { return __v; }
10453 }
10454
10455 let mut amount = get_arg(optional_args, 0, Value::Null);
10456 let mut price = get_arg(optional_args, 1, Value::Null);
10457 let mut params = get_arg(optional_args, 2, Value::Map({
10458 let mut m = indexmap::IndexMap::new();
10459 m
10460}));
10461 self.cancel_order(id.clone(), &[symbol.clone()]).await;
10462 return self.create_order(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), params.clone()]).await;
10463
10464 Value::Null
10465} }
10466
10467 fn edit_order_with_client_order_id(&mut self, mut clientOrderId: Value, mut symbol: Value, mut type_var: Value, mut side: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10468 let mut amount = get_arg(optional_args, 0, Value::Null);
10469 let mut price = get_arg(optional_args, 1, Value::Null);
10470 let mut params = get_arg(optional_args, 2, Value::Map({
10471 let mut m = indexmap::IndexMap::new();
10472 m
10473}));
10474 let mut extendedParams: Value = self.extend(params.clone(), &[Value::Map({
10475 let mut m = indexmap::IndexMap::new();
10476 m.insert("clientOrderId".to_string(), clientOrderId.clone());
10477 m
10478 })]);
10479 return self.edit_order(Value::Str("".to_string()), symbol.clone(), type_var.clone(), side.clone(), &[amount.clone(), price.clone(), extendedParams.clone()]).await;
10480
10481 Value::Null
10482} }
10483
10484 fn fetch_position(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10485 if let Some(__v) = self.dispatch_to_derived("fetch_position", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(symbol.clone()); __args.extend_from_slice(optional_args); __args }).await {
10487 if !matches!(__v, crate::Value::Null) { return __v; }
10488 }
10489
10490 let mut params = get_arg(optional_args, 0, Value::Map({
10491 let mut m = indexmap::IndexMap::new();
10492 m
10493}));
10494 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchPosition() is not supported yet".to_string()))));
10495
10496 Value::Null
10497} }
10498
10499 fn watch_positions(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10500 let mut symbols = get_arg(optional_args, 0, Value::Null);
10501 let mut since = get_arg(optional_args, 1, Value::Null);
10502 let mut limit = get_arg(optional_args, 2, Value::Null);
10503 let mut params = get_arg(optional_args, 3, Value::Map({
10504 let mut m = indexmap::IndexMap::new();
10505 m
10506}));
10507 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchPositions() is not supported yet".to_string()))));
10508
10509 Value::Null
10510} }
10511
10512 fn watch_position_for_symbols(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10513 let mut symbols = get_arg(optional_args, 0, Value::Null);
10514 let mut since = get_arg(optional_args, 1, Value::Null);
10515 let mut limit = get_arg(optional_args, 2, Value::Null);
10516 let mut params = get_arg(optional_args, 3, Value::Map({
10517 let mut m = indexmap::IndexMap::new();
10518 m
10519}));
10520 return self.watch_positions(&[symbols.clone(), since.clone(), limit.clone(), params.clone()]).await;
10521
10522 Value::Null
10523} }
10524
10525 fn fetch_positions(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10526 if let Some(__v) = self.dispatch_to_derived("fetch_positions", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
10528 if !matches!(__v, crate::Value::Null) { return __v; }
10529 }
10530
10531 let mut symbols = get_arg(optional_args, 0, Value::Null);
10532 let mut params = get_arg(optional_args, 1, Value::Map({
10533 let mut m = indexmap::IndexMap::new();
10534 m
10535}));
10536 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchPositions() is not supported yet".to_string()))));
10537
10538 Value::Null
10539} }
10540
10541 fn fetch_ticker(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10542 if let Some(__v) = self.dispatch_to_derived("fetch_ticker", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(symbol.clone()); __args.extend_from_slice(optional_args); __args }).await {
10544 if !matches!(__v, crate::Value::Null) { return __v; }
10545 }
10546
10547 let mut params = get_arg(optional_args, 0, Value::Map({
10548 let mut m = indexmap::IndexMap::new();
10549 m
10550}));
10551 if !is_equal(&get_value(&self.has, &Value::Str("fetchTickers".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchTickers".to_string())), &Value::Bool(false)) {
10552 self.load_markets(&[]).await;
10553 let mut market: Value = self.market(symbol.clone());
10554 symbol = get_value(&market, &Value::Str("symbol".to_string()));
10555 let mut tickers: Value = self.fetch_tickers(&[Value::List(vec![symbol.clone()]), params.clone()]).await;
10556 let mut ticker: Value = self.safe_dict(tickers.clone(), symbol.clone(), &[]);
10557 if is_equal(&ticker, &Value::Null) {
10558 panic!("{}", crate::exchange_errors::null_response(add(&add(&self.id, &Value::Str(" fetchTickers() could not find a ticker for ".to_string())), &symbol)));
10559 } else {
10560 return ticker;
10561 }
10562 } else {
10563 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchTicker() is not supported yet".to_string()))));
10564 }
10565
10566 Value::Null
10567} }
10568
10569 fn watch_ticker(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10570 let mut params = get_arg(optional_args, 0, Value::Map({
10571 let mut m = indexmap::IndexMap::new();
10572 m
10573}));
10574 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchTicker() is not supported yet".to_string()))));
10575
10576 Value::Null
10577} }
10578
10579 fn fetch_tickers(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10580 if let Some(__v) = self.dispatch_to_derived("fetch_tickers", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
10582 if !matches!(__v, crate::Value::Null) { return __v; }
10583 }
10584
10585 let mut symbols = get_arg(optional_args, 0, Value::Null);
10586 let mut params = get_arg(optional_args, 1, Value::Map({
10587 let mut m = indexmap::IndexMap::new();
10588 m
10589}));
10590 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchTickers() is not supported yet".to_string()))));
10591
10592 Value::Null
10593} }
10594
10595 fn watch_tickers(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10596 let mut symbols = get_arg(optional_args, 0, Value::Null);
10597 let mut params = get_arg(optional_args, 1, Value::Map({
10598 let mut m = indexmap::IndexMap::new();
10599 m
10600}));
10601 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchTickers() is not supported yet".to_string()))));
10602
10603 Value::Null
10604} }
10605
10606 fn fetch_order(&mut self, mut id: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10607 if let Some(__v) = self.dispatch_to_derived("fetch_order", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(id.clone()); __args.extend_from_slice(optional_args); __args }).await {
10609 if !matches!(__v, crate::Value::Null) { return __v; }
10610 }
10611
10612 let mut symbol = get_arg(optional_args, 0, Value::Null);
10613 let mut params = get_arg(optional_args, 1, Value::Map({
10614 let mut m = indexmap::IndexMap::new();
10615 m
10616}));
10617 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOrder() is not supported yet".to_string()))));
10618
10619 Value::Null
10620} }
10621
10622fn fetch_order_with_client_order_id(&mut self, mut clientOrderId: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10632 let mut symbol = get_arg(optional_args, 0, Value::Null);
10633 let mut params = get_arg(optional_args, 1, Value::Map({
10634 let mut m = indexmap::IndexMap::new();
10635 m
10636}));
10637 let mut extendedParams: Value = self.extend(params.clone(), &[Value::Map({
10638 let mut m = indexmap::IndexMap::new();
10639 m.insert("clientOrderId".to_string(), clientOrderId.clone());
10640 m
10641 })]);
10642 return self.fetch_order(Value::Str("".to_string()), &[symbol.clone(), extendedParams.clone()]).await;
10643
10644 Value::Null
10645} }
10646
10647 fn fetch_order_status(&mut self, mut id: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10648 let mut symbol = get_arg(optional_args, 0, Value::Null);
10649 let mut params = get_arg(optional_args, 1, Value::Map({
10650 let mut m = indexmap::IndexMap::new();
10651 m
10652}));
10653 let mut order: Value = self.fetch_order(id.clone(), &[symbol.clone(), params.clone()]).await;
10656 return get_value(&order, &Value::Str("status".to_string()));
10657
10658 Value::Null
10659} }
10660
10661 fn fetch_unified_order(&mut self, mut order: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10662 let mut params = get_arg(optional_args, 0, Value::Map({
10663 let mut m = indexmap::IndexMap::new();
10664 m
10665}));
10666 return self.fetch_order(self.safe_string_k(order.clone(), "id", &[]), &[self.safe_string_k(order.clone(), "symbol", &[]), params.clone()]).await;
10667
10668 Value::Null
10669} }
10670
10671 fn create_order(&mut self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10672 if let Some(__v) = self.dispatch_to_derived("create_order", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(symbol.clone()); __args.push(type_var.clone()); __args.push(side.clone()); __args.push(amount.clone()); __args.extend_from_slice(optional_args); __args }).await {
10674 if !matches!(__v, crate::Value::Null) { return __v; }
10675 }
10676
10677 let mut price = get_arg(optional_args, 0, Value::Null);
10678 let mut params = get_arg(optional_args, 1, Value::Map({
10679 let mut m = indexmap::IndexMap::new();
10680 m
10681}));
10682 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createOrder() is not supported yet".to_string()))));
10683
10684 Value::Null
10685} }
10686
10687 fn create_trailing_amount_order(&mut self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10688 let mut price = get_arg(optional_args, 0, Value::Null);
10689 let mut trailingAmount = get_arg(optional_args, 1, Value::Null);
10690 let mut trailingTriggerPrice = get_arg(optional_args, 2, Value::Null);
10691 let mut params = get_arg(optional_args, 3, Value::Map({
10692 let mut m = indexmap::IndexMap::new();
10693 m
10694}));
10695 if is_equal(&trailingAmount, &Value::Null) {
10710 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" createTrailingAmountOrder() requires a trailingAmount argument".to_string()))));
10711 }
10712 add_element_to_object(&mut params, &Value::Str("trailingAmount".to_string()), trailingAmount.clone());
10713 if !is_equal(&trailingTriggerPrice, &Value::Null) {
10714 add_element_to_object(&mut params, &Value::Str("trailingTriggerPrice".to_string()), trailingTriggerPrice.clone());
10715 }
10716 if !is_equal(&get_value(&self.has, &Value::Str("createTrailingAmountOrder".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("createTrailingAmountOrder".to_string())), &Value::Bool(false)) {
10717 return self.create_order(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), params.clone()]).await;
10718 }
10719 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createTrailingAmountOrder() is not supported yet".to_string()))));
10720
10721 Value::Null
10722} }
10723
10724 fn create_trailing_percent_order(&mut self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10725 let mut price = get_arg(optional_args, 0, Value::Null);
10726 let mut trailingPercent = get_arg(optional_args, 1, Value::Null);
10727 let mut trailingTriggerPrice = get_arg(optional_args, 2, Value::Null);
10728 let mut params = get_arg(optional_args, 3, Value::Map({
10729 let mut m = indexmap::IndexMap::new();
10730 m
10731}));
10732 if is_equal(&trailingPercent, &Value::Null) {
10747 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" createTrailingPercentOrder() requires a trailingPercent argument".to_string()))));
10748 }
10749 add_element_to_object(&mut params, &Value::Str("trailingPercent".to_string()), trailingPercent.clone());
10750 if !is_equal(&trailingTriggerPrice, &Value::Null) {
10751 add_element_to_object(&mut params, &Value::Str("trailingTriggerPrice".to_string()), trailingTriggerPrice.clone());
10752 }
10753 if !is_equal(&get_value(&self.has, &Value::Str("createTrailingPercentOrder".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("createTrailingPercentOrder".to_string())), &Value::Bool(false)) {
10754 return self.create_order(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), params.clone()]).await;
10755 }
10756 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createTrailingPercentOrder() is not supported yet".to_string()))));
10757
10758 Value::Null
10759} }
10760
10761 fn create_market_order_with_cost(&mut self, mut symbol: Value, mut side: Value, mut cost: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10762 let mut params = get_arg(optional_args, 0, Value::Map({
10763 let mut m = indexmap::IndexMap::new();
10764 m
10765}));
10766 if is_true(&(!is_equal(&get_value(&self.has, &Value::Str("createMarketOrderWithCost".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("createMarketOrderWithCost".to_string())), &Value::Bool(false)))) || is_true(&(is_true(&(!is_equal(&get_value(&self.has, &Value::Str("createMarketBuyOrderWithCost".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("createMarketBuyOrderWithCost".to_string())), &Value::Bool(false)))) && is_true(&(!is_equal(&get_value(&self.has, &Value::Str("createMarketSellOrderWithCost".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("createMarketSellOrderWithCost".to_string())), &Value::Bool(false)))))) {
10777 return self.create_order(symbol.clone(), Value::Str("market".to_string()), side.clone(), cost.clone(), &[Value::Int(1), params.clone()]).await;
10778 }
10779 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createMarketOrderWithCost() is not supported yet".to_string()))));
10780
10781 Value::Null
10782} }
10783
10784 fn create_market_buy_order_with_cost(&mut self, mut symbol: Value, mut cost: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10785 let mut params = get_arg(optional_args, 0, Value::Map({
10786 let mut m = indexmap::IndexMap::new();
10787 m
10788}));
10789 if is_true(&(is_equal(&get_value(&self.options, &Value::Str("createMarketBuyOrderRequiresPrice".to_string())), &Value::Bool(true)))) || is_true(&(!is_equal(&get_value(&self.has, &Value::Str("createMarketBuyOrderWithCost".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("createMarketBuyOrderWithCost".to_string())), &Value::Bool(false)))) {
10799 return self.create_order(symbol.clone(), Value::Str("market".to_string()), Value::Str("buy".to_string()), cost.clone(), &[Value::Int(1), params.clone()]).await;
10800 }
10801 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createMarketBuyOrderWithCost() is not supported yet".to_string()))));
10802
10803 Value::Null
10804} }
10805
10806 fn create_market_sell_order_with_cost(&mut self, mut symbol: Value, mut cost: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10807 let mut params = get_arg(optional_args, 0, Value::Map({
10808 let mut m = indexmap::IndexMap::new();
10809 m
10810}));
10811 if is_true(&(is_equal(&get_value(&self.options, &Value::Str("createMarketSellOrderRequiresPrice".to_string())), &Value::Bool(true)))) || is_true(&(!is_equal(&get_value(&self.has, &Value::Str("createMarketSellOrderWithCost".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("createMarketSellOrderWithCost".to_string())), &Value::Bool(false)))) {
10821 return self.create_order(symbol.clone(), Value::Str("market".to_string()), Value::Str("sell".to_string()), cost.clone(), &[Value::Int(1), params.clone()]).await;
10822 }
10823 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createMarketSellOrderWithCost() is not supported yet".to_string()))));
10824
10825 Value::Null
10826} }
10827
10828 fn create_trigger_order(&mut self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10829 let mut price = get_arg(optional_args, 0, Value::Null);
10830 let mut triggerPrice = get_arg(optional_args, 1, Value::Null);
10831 let mut params = get_arg(optional_args, 2, Value::Map({
10832 let mut m = indexmap::IndexMap::new();
10833 m
10834}));
10835 if is_equal(&triggerPrice, &Value::Null) {
10849 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" createTriggerOrder() requires a triggerPrice argument".to_string()))));
10850 }
10851 params = self.extend(params.clone(), &[Value::Map({
10852 let mut m = indexmap::IndexMap::new();
10853 m.insert("triggerPrice".to_string(), triggerPrice.clone());
10854 m
10855 })]);
10856 if !is_equal(&get_value(&self.has, &Value::Str("createTriggerOrder".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("createTriggerOrder".to_string())), &Value::Bool(false)) {
10857 return self.create_order(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), params.clone()]).await;
10858 }
10859 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createTriggerOrder() is not supported yet".to_string()))));
10860
10861 Value::Null
10862} }
10863
10864 fn create_stop_loss_order(&mut self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10865 let mut price = get_arg(optional_args, 0, Value::Null);
10866 let mut stopLossPrice = get_arg(optional_args, 1, Value::Null);
10867 let mut params = get_arg(optional_args, 2, Value::Map({
10868 let mut m = indexmap::IndexMap::new();
10869 m
10870}));
10871 if is_equal(&stopLossPrice, &Value::Null) {
10885 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" createStopLossOrder() requires a stopLossPrice argument".to_string()))));
10886 }
10887 params = self.extend(params.clone(), &[Value::Map({
10888 let mut m = indexmap::IndexMap::new();
10889 m.insert("stopLossPrice".to_string(), stopLossPrice.clone());
10890 m
10891 })]);
10892 if !is_equal(&get_value(&self.has, &Value::Str("createStopLossOrder".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("createStopLossOrder".to_string())), &Value::Bool(false)) {
10893 return self.create_order(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), params.clone()]).await;
10894 }
10895 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createStopLossOrder() is not supported yet".to_string()))));
10896
10897 Value::Null
10898} }
10899
10900 fn create_take_profit_order(&mut self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10901 let mut price = get_arg(optional_args, 0, Value::Null);
10902 let mut takeProfitPrice = get_arg(optional_args, 1, Value::Null);
10903 let mut params = get_arg(optional_args, 2, Value::Map({
10904 let mut m = indexmap::IndexMap::new();
10905 m
10906}));
10907 if is_equal(&takeProfitPrice, &Value::Null) {
10921 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" createTakeProfitOrder() requires a takeProfitPrice argument".to_string()))));
10922 }
10923 params = self.extend(params.clone(), &[Value::Map({
10924 let mut m = indexmap::IndexMap::new();
10925 m.insert("takeProfitPrice".to_string(), takeProfitPrice.clone());
10926 m
10927 })]);
10928 if !is_equal(&get_value(&self.has, &Value::Str("createTakeProfitOrder".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("createTakeProfitOrder".to_string())), &Value::Bool(false)) {
10929 return self.create_order(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), params.clone()]).await;
10930 }
10931 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createTakeProfitOrder() is not supported yet".to_string()))));
10932
10933 Value::Null
10934} }
10935
10936 fn create_order_with_take_profit_and_stop_loss(&mut self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10937 let mut price = get_arg(optional_args, 0, Value::Null);
10938 let mut takeProfit = get_arg(optional_args, 1, Value::Null);
10939 let mut stopLoss = get_arg(optional_args, 2, Value::Null);
10940 let mut params = get_arg(optional_args, 3, Value::Map({
10941 let mut m = indexmap::IndexMap::new();
10942 m
10943}));
10944 params = self.set_take_profit_and_stop_loss_params(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), takeProfit.clone(), stopLoss.clone(), params.clone()]);
10967 if !is_equal(&get_value(&self.has, &Value::Str("createOrderWithTakeProfitAndStopLoss".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("createOrderWithTakeProfitAndStopLoss".to_string())), &Value::Bool(false)) {
10968 return self.create_order(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), params.clone()]).await;
10969 }
10970 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createOrderWithTakeProfitAndStopLoss() is not supported yet".to_string()))));
10971
10972 Value::Null
10973} }
10974
10975 fn create_orders(&mut self, mut orders: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10976 if let Some(__v) = self.dispatch_to_derived("create_orders", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(orders.clone()); __args.extend_from_slice(optional_args); __args }).await {
10978 if !matches!(__v, crate::Value::Null) { return __v; }
10979 }
10980
10981 let mut params = get_arg(optional_args, 0, Value::Map({
10982 let mut m = indexmap::IndexMap::new();
10983 m
10984}));
10985 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createOrders() is not supported yet".to_string()))));
10986
10987 Value::Null
10988} }
10989
10990 fn cancel_order(&mut self, mut id: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
10991 if let Some(__v) = self.dispatch_to_derived("cancel_order", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(id.clone()); __args.extend_from_slice(optional_args); __args }).await {
10993 if !matches!(__v, crate::Value::Null) { return __v; }
10994 }
10995
10996 let mut symbol = get_arg(optional_args, 0, Value::Null);
10997 let mut params = get_arg(optional_args, 1, Value::Map({
10998 let mut m = indexmap::IndexMap::new();
10999 m
11000}));
11001 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" cancelOrder() is not supported yet".to_string()))));
11002
11003 Value::Null
11004} }
11005
11006fn cancel_order_with_client_order_id(&mut self, mut clientOrderId: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11016 let mut symbol = get_arg(optional_args, 0, Value::Null);
11017 let mut params = get_arg(optional_args, 1, Value::Map({
11018 let mut m = indexmap::IndexMap::new();
11019 m
11020}));
11021 let mut extendedParams: Value = self.extend(params.clone(), &[Value::Map({
11022 let mut m = indexmap::IndexMap::new();
11023 m.insert("clientOrderId".to_string(), clientOrderId.clone());
11024 m
11025 })]);
11026 return self.cancel_order(Value::Str("".to_string()), &[symbol.clone(), extendedParams.clone()]).await;
11027
11028 Value::Null
11029} }
11030
11031 fn cancel_orders(&mut self, mut ids: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11032 if let Some(__v) = self.dispatch_to_derived("cancel_orders", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(ids.clone()); __args.extend_from_slice(optional_args); __args }).await {
11034 if !matches!(__v, crate::Value::Null) { return __v; }
11035 }
11036
11037 let mut symbol = get_arg(optional_args, 0, Value::Null);
11038 let mut params = get_arg(optional_args, 1, Value::Map({
11039 let mut m = indexmap::IndexMap::new();
11040 m
11041}));
11042 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" cancelOrders() is not supported yet".to_string()))));
11043
11044 Value::Null
11045} }
11046
11047fn cancel_orders_with_client_order_ids(&mut self, mut clientOrderIds: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11057 let mut symbol = get_arg(optional_args, 0, Value::Null);
11058 let mut params = get_arg(optional_args, 1, Value::Map({
11059 let mut m = indexmap::IndexMap::new();
11060 m
11061}));
11062 let mut extendedParams: Value = self.extend(params.clone(), &[Value::Map({
11063 let mut m = indexmap::IndexMap::new();
11064 m.insert("clientOrderIds".to_string(), clientOrderIds.clone());
11065 m
11066 })]);
11067 return self.cancel_orders(Value::List(vec![]), &[symbol.clone(), extendedParams.clone()]).await;
11068
11069 Value::Null
11070} }
11071
11072 fn cancel_all_orders(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11073 if let Some(__v) = self.dispatch_to_derived("cancel_all_orders", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
11075 if !matches!(__v, crate::Value::Null) { return __v; }
11076 }
11077
11078 let mut symbol = get_arg(optional_args, 0, Value::Null);
11079 let mut params = get_arg(optional_args, 1, Value::Map({
11080 let mut m = indexmap::IndexMap::new();
11081 m
11082}));
11083 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" cancelAllOrders() is not supported yet".to_string()))));
11084
11085 Value::Null
11086} }
11087
11088 fn cancel_unified_order(&mut self, mut order: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11089 let mut params = get_arg(optional_args, 0, Value::Map({
11090 let mut m = indexmap::IndexMap::new();
11091 m
11092}));
11093 return self.cancel_order(self.safe_string_k(order.clone(), "id", &[]), &[self.safe_string_k(order.clone(), "symbol", &[]), params.clone()]).await;
11094
11095 Value::Null
11096} }
11097
11098 fn fetch_orders(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11099 if let Some(__v) = self.dispatch_to_derived("fetch_orders", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
11101 if !matches!(__v, crate::Value::Null) { return __v; }
11102 }
11103
11104 let mut symbol = get_arg(optional_args, 0, Value::Null);
11105 let mut since = get_arg(optional_args, 1, Value::Null);
11106 let mut limit = get_arg(optional_args, 2, Value::Null);
11107 let mut params = get_arg(optional_args, 3, Value::Map({
11108 let mut m = indexmap::IndexMap::new();
11109 m
11110}));
11111 if is_true(&(!is_equal(&get_value(&self.has, &Value::Str("fetchOpenOrders".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchOpenOrders".to_string())), &Value::Bool(false)))) && is_true(&(!is_equal(&get_value(&self.has, &Value::Str("fetchClosedOrders".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchClosedOrders".to_string())), &Value::Bool(false)))) {
11112 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOrders() is not supported yet, consider using fetchOpenOrders() and fetchClosedOrders() instead".to_string()))));
11113 }
11114 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOrders() is not supported yet".to_string()))));
11115
11116 Value::Null
11117} }
11118
11119 fn fetch_order_trades(&mut self, mut id: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11120 let mut symbol = get_arg(optional_args, 0, Value::Null);
11121 let mut since = get_arg(optional_args, 1, Value::Null);
11122 let mut limit = get_arg(optional_args, 2, Value::Null);
11123 let mut params = get_arg(optional_args, 3, Value::Map({
11124 let mut m = indexmap::IndexMap::new();
11125 m
11126}));
11127 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOrderTrades() is not supported yet".to_string()))));
11128
11129 Value::Null
11130} }
11131
11132 fn watch_orders(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11133 let mut symbol = get_arg(optional_args, 0, Value::Null);
11134 let mut since = get_arg(optional_args, 1, Value::Null);
11135 let mut limit = get_arg(optional_args, 2, Value::Null);
11136 let mut params = get_arg(optional_args, 3, Value::Map({
11137 let mut m = indexmap::IndexMap::new();
11138 m
11139}));
11140 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchOrders() is not supported yet".to_string()))));
11141
11142 Value::Null
11143} }
11144
11145 fn fetch_open_orders(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11146 if let Some(__v) = self.dispatch_to_derived("fetch_open_orders", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
11148 if !matches!(__v, crate::Value::Null) { return __v; }
11149 }
11150
11151 let mut symbol = get_arg(optional_args, 0, Value::Null);
11152 let mut since = get_arg(optional_args, 1, Value::Null);
11153 let mut limit = get_arg(optional_args, 2, Value::Null);
11154 let mut params = get_arg(optional_args, 3, Value::Map({
11155 let mut m = indexmap::IndexMap::new();
11156 m
11157}));
11158 if !is_equal(&get_value(&self.has, &Value::Str("fetchOrders".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchOrders".to_string())), &Value::Bool(false)) {
11159 let mut orders: Value = self.fetch_orders(&[symbol.clone(), since.clone(), limit.clone(), params.clone()]).await;
11160 return self.filter_by(orders.clone(), Value::Str("status".to_string()), Value::Str("open".to_string()), &[]);
11161 }
11162 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOpenOrders() is not supported yet".to_string()))));
11163
11164 Value::Null
11165} }
11166
11167 fn fetch_closed_orders(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11168 if let Some(__v) = self.dispatch_to_derived("fetch_closed_orders", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
11170 if !matches!(__v, crate::Value::Null) { return __v; }
11171 }
11172
11173 let mut symbol = get_arg(optional_args, 0, Value::Null);
11174 let mut since = get_arg(optional_args, 1, Value::Null);
11175 let mut limit = get_arg(optional_args, 2, Value::Null);
11176 let mut params = get_arg(optional_args, 3, Value::Map({
11177 let mut m = indexmap::IndexMap::new();
11178 m
11179}));
11180 if !is_equal(&get_value(&self.has, &Value::Str("fetchOrders".to_string())), &Value::Null) && !is_equal(&get_value(&self.has, &Value::Str("fetchOrders".to_string())), &Value::Bool(false)) {
11181 let mut orders: Value = self.fetch_orders(&[symbol.clone(), since.clone(), limit.clone(), params.clone()]).await;
11182 return self.filter_by(orders.clone(), Value::Str("status".to_string()), Value::Str("closed".to_string()), &[]);
11183 }
11184 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchClosedOrders() is not supported yet".to_string()))));
11185
11186 Value::Null
11187} }
11188
11189 fn fetch_canceled_orders(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11190 let mut symbol = get_arg(optional_args, 0, Value::Null);
11191 let mut since = get_arg(optional_args, 1, Value::Null);
11192 let mut limit = get_arg(optional_args, 2, Value::Null);
11193 let mut params = get_arg(optional_args, 3, Value::Map({
11194 let mut m = indexmap::IndexMap::new();
11195 m
11196}));
11197 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchCanceledOrders() is not supported yet".to_string()))));
11198
11199 Value::Null
11200} }
11201
11202 fn fetch_my_trades(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11203 if let Some(__v) = self.dispatch_to_derived("fetch_my_trades", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
11205 if !matches!(__v, crate::Value::Null) { return __v; }
11206 }
11207
11208 let mut symbol = get_arg(optional_args, 0, Value::Null);
11209 let mut since = get_arg(optional_args, 1, Value::Null);
11210 let mut limit = get_arg(optional_args, 2, Value::Null);
11211 let mut params = get_arg(optional_args, 3, Value::Map({
11212 let mut m = indexmap::IndexMap::new();
11213 m
11214}));
11215 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchMyTrades() is not supported yet".to_string()))));
11216
11217 Value::Null
11218} }
11219
11220 fn watch_my_trades(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11221 let mut symbol = get_arg(optional_args, 0, Value::Null);
11222 let mut since = get_arg(optional_args, 1, Value::Null);
11223 let mut limit = get_arg(optional_args, 2, Value::Null);
11224 let mut params = get_arg(optional_args, 3, Value::Map({
11225 let mut m = indexmap::IndexMap::new();
11226 m
11227}));
11228 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchMyTrades() is not supported yet".to_string()))));
11229
11230 Value::Null
11231} }
11232
11233 fn create_limit_order(&mut self, mut symbol: Value, mut side: Value, mut amount: Value, mut price: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11234 let mut params = get_arg(optional_args, 0, Value::Map({
11235 let mut m = indexmap::IndexMap::new();
11236 m
11237}));
11238 return self.create_order(symbol.clone(), Value::Str("limit".to_string()), side.clone(), amount.clone(), &[price.clone(), params.clone()]).await;
11239
11240 Value::Null
11241} }
11242
11243 fn create_market_order(&mut self, mut symbol: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11244 let mut price = get_arg(optional_args, 0, Value::Null);
11245 let mut params = get_arg(optional_args, 1, Value::Map({
11246 let mut m = indexmap::IndexMap::new();
11247 m
11248}));
11249 return self.create_order(symbol.clone(), Value::Str("market".to_string()), side.clone(), amount.clone(), &[price.clone(), params.clone()]).await;
11250
11251 Value::Null
11252} }
11253
11254 fn create_limit_buy_order(&mut self, mut symbol: Value, mut amount: Value, mut price: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11255 let mut params = get_arg(optional_args, 0, Value::Map({
11256 let mut m = indexmap::IndexMap::new();
11257 m
11258}));
11259 return self.create_order(symbol.clone(), Value::Str("limit".to_string()), Value::Str("buy".to_string()), amount.clone(), &[price.clone(), params.clone()]).await;
11260
11261 Value::Null
11262} }
11263
11264 fn create_limit_sell_order(&mut self, mut symbol: Value, mut amount: Value, mut price: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11265 let mut params = get_arg(optional_args, 0, Value::Map({
11266 let mut m = indexmap::IndexMap::new();
11267 m
11268}));
11269 return self.create_order(symbol.clone(), Value::Str("limit".to_string()), Value::Str("sell".to_string()), amount.clone(), &[price.clone(), params.clone()]).await;
11270
11271 Value::Null
11272} }
11273
11274 fn create_market_buy_order(&mut self, mut symbol: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11275 let mut params = get_arg(optional_args, 0, Value::Map({
11276 let mut m = indexmap::IndexMap::new();
11277 m
11278}));
11279 return self.create_order(symbol.clone(), Value::Str("market".to_string()), Value::Str("buy".to_string()), amount.clone(), &[Value::Null, params.clone()]).await;
11280
11281 Value::Null
11282} }
11283
11284 fn create_market_sell_order(&mut self, mut symbol: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11285 let mut params = get_arg(optional_args, 0, Value::Map({
11286 let mut m = indexmap::IndexMap::new();
11287 m
11288}));
11289 return self.create_order(symbol.clone(), Value::Str("market".to_string()), Value::Str("sell".to_string()), amount.clone(), &[Value::Null, params.clone()]).await;
11290
11291 Value::Null
11292} }
11293
11294 fn create_post_only_order(&mut self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11295 let mut price = get_arg(optional_args, 0, Value::Null);
11296 let mut params = get_arg(optional_args, 1, Value::Map({
11297 let mut m = indexmap::IndexMap::new();
11298 m
11299}));
11300 if is_equal(&get_value(&self.has, &Value::Str("createPostOnlyOrder".to_string())), &Value::Null) || is_equal(&get_value(&self.has, &Value::Str("createPostOnlyOrder".to_string())), &Value::Bool(false)) {
11301 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createPostOnlyOrder() is not supported yet".to_string()))));
11302 }
11303 let mut query: Value = self.extend(params.clone(), &[Value::Map({
11304 let mut m = indexmap::IndexMap::new();
11305 m.insert("postOnly".to_string(), Value::Bool(true));
11306 m
11307 })]);
11308 return self.create_order(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), query.clone()]).await;
11309
11310 Value::Null
11311} }
11312
11313 fn create_reduce_only_order(&mut self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11314 let mut price = get_arg(optional_args, 0, Value::Null);
11315 let mut params = get_arg(optional_args, 1, Value::Map({
11316 let mut m = indexmap::IndexMap::new();
11317 m
11318}));
11319 if is_equal(&get_value(&self.has, &Value::Str("createReduceOnlyOrder".to_string())), &Value::Null) || is_equal(&get_value(&self.has, &Value::Str("createReduceOnlyOrder".to_string())), &Value::Bool(false)) {
11320 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createReduceOnlyOrder() is not supported yet".to_string()))));
11321 }
11322 let mut query: Value = self.extend(params.clone(), &[Value::Map({
11323 let mut m = indexmap::IndexMap::new();
11324 m.insert("reduceOnly".to_string(), Value::Bool(true));
11325 m
11326 })]);
11327 return self.create_order(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), query.clone()]).await;
11328
11329 Value::Null
11330} }
11331
11332 fn create_stop_order(&mut self, mut symbol: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11333 let mut price = get_arg(optional_args, 0, Value::Null);
11334 let mut triggerPrice = get_arg(optional_args, 1, Value::Null);
11335 let mut params = get_arg(optional_args, 2, Value::Map({
11336 let mut m = indexmap::IndexMap::new();
11337 m
11338}));
11339 if is_equal(&get_value(&self.has, &Value::Str("createStopOrder".to_string())), &Value::Null) || is_equal(&get_value(&self.has, &Value::Str("createStopOrder".to_string())), &Value::Bool(false)) {
11340 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createStopOrder() is not supported yet".to_string()))));
11341 }
11342 if is_equal(&triggerPrice, &Value::Null) {
11343 panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" create_stop_order() requires a stopPrice argument".to_string()))));
11344 }
11345 let mut query: Value = self.extend(params.clone(), &[Value::Map({
11346 let mut m = indexmap::IndexMap::new();
11347 m.insert("stopPrice".to_string(), triggerPrice.clone());
11348 m
11349 })]);
11350 return self.create_order(symbol.clone(), type_var.clone(), side.clone(), amount.clone(), &[price.clone(), query.clone()]).await;
11351
11352 Value::Null
11353} }
11354
11355 fn create_stop_limit_order(&mut self, mut symbol: Value, mut side: Value, mut amount: Value, mut price: Value, mut triggerPrice: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11356 let mut params = get_arg(optional_args, 0, Value::Map({
11357 let mut m = indexmap::IndexMap::new();
11358 m
11359}));
11360 if is_equal(&get_value(&self.has, &Value::Str("createStopLimitOrder".to_string())), &Value::Null) || is_equal(&get_value(&self.has, &Value::Str("createStopLimitOrder".to_string())), &Value::Bool(false)) {
11361 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createStopLimitOrder() is not supported yet".to_string()))));
11362 }
11363 let mut query: Value = self.extend(params.clone(), &[Value::Map({
11364 let mut m = indexmap::IndexMap::new();
11365 m.insert("stopPrice".to_string(), triggerPrice.clone());
11366 m
11367 })]);
11368 return self.create_order(symbol.clone(), Value::Str("limit".to_string()), side.clone(), amount.clone(), &[price.clone(), query.clone()]).await;
11369
11370 Value::Null
11371} }
11372
11373 fn create_stop_market_order(&mut self, mut symbol: Value, mut side: Value, mut amount: Value, mut triggerPrice: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11374 let mut params = get_arg(optional_args, 0, Value::Map({
11375 let mut m = indexmap::IndexMap::new();
11376 m
11377}));
11378 if is_equal(&get_value(&self.has, &Value::Str("createStopMarketOrder".to_string())), &Value::Null) || is_equal(&get_value(&self.has, &Value::Str("createStopMarketOrder".to_string())), &Value::Bool(false)) {
11379 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createStopMarketOrder() is not supported yet".to_string()))));
11380 }
11381 let mut query: Value = self.extend(params.clone(), &[Value::Map({
11382 let mut m = indexmap::IndexMap::new();
11383 m.insert("stopPrice".to_string(), triggerPrice.clone());
11384 m
11385 })]);
11386 return self.create_order(symbol.clone(), Value::Str("market".to_string()), side.clone(), amount.clone(), &[Value::Null, query.clone()]).await;
11387
11388 Value::Null
11389} }
11390
11391 fn fetch_trading_fee(&mut self, mut symbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
11392 if let Some(__v) = self.dispatch_to_derived("fetch_trading_fee", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(symbol.clone()); __args.extend_from_slice(optional_args); __args }).await {
11394 if !matches!(__v, crate::Value::Null) { return __v; }
11395 }
11396
11397 let mut params = get_arg(optional_args, 0, Value::Map({
11398 let mut m = indexmap::IndexMap::new();
11399 m
11400}));
11401 if is_equal(&get_value(&self.has, &Value::Str("fetchTradingFees".to_string())), &Value::Null) || is_equal(&get_value(&self.has, &Value::Str("fetchTradingFees".to_string())), &Value::Bool(false)) {
11402 panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchTradingFee() is not supported yet".to_string()))));
11403 }
11404 let mut fees: Value = self.fetch_trading_fees(&[params.clone()]).await;
11405 return self.safe_dict(fees.clone(), symbol.clone(), &[]);
11406
11407 Value::Null
11408} }
11409 fn call_dynamic_base<'a>(&'a mut self, method: &'a str, args: Vec<crate::Value>)
11411 -> std::pin::Pin<Box<dyn std::future::Future<Output = crate::Value> + Send + 'a>>
11412 {
11413 Box::pin(async move {
11414 match method {
11415 "account" => self.account(),
11416 "add_key_in_array_items" => self.add_key_in_array_items(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null)),
11417 "add_margin" => self.add_margin(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]).await,
11418 "amount_to_precision" => self.amount_to_precision(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null)),
11419 "arrays_concat" => self.arrays_concat(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11420 "assign_default_deposit_withdraw_fees" => self.assign_default_deposit_withdraw_fees(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11421 "borrow_cross_margin" => self.borrow_cross_margin(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]).await,
11422 "borrow_isolated_margin" => self.borrow_isolated_margin(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]).await,
11423 "borrow_margin" => self.borrow_margin(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]).await,
11424 "build_ohlcvc" => self.build_ohlcvc(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11425 "calculate_fee" => self.calculate_fee(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), args.get(4).cloned().unwrap_or(crate::Value::Null), &args.get(5..).unwrap_or(&[]).to_vec()[..]),
11426 "calculate_fee_with_rate" => self.calculate_fee_with_rate(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), args.get(4).cloned().unwrap_or(crate::Value::Null), &args.get(5..).unwrap_or(&[]).to_vec()[..]),
11427 "calculate_rate_limiter_cost" => self.calculate_rate_limiter_cost(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]),
11428 "call_method" => self.call_method(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11429 "cancel_all_contract_orders" => self.cancel_all_contract_orders(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11430 "cancel_all_orders" => self.cancel_all_orders(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11431 "cancel_all_orders_after" => self.cancel_all_orders_after(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11432 "cancel_all_orders_ws" => self.cancel_all_orders_ws(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11433 "cancel_all_spot_orders" => self.cancel_all_spot_orders(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11434 "cancel_contract_order" => self.cancel_contract_order(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11435 "cancel_order" => self.cancel_order(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11436 "cancel_order_with_client_order_id" => self.cancel_order_with_client_order_id(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11437 "cancel_order_ws" => self.cancel_order_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11438 "cancel_orders" => self.cancel_orders(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11439 "cancel_orders_for_symbols" => self.cancel_orders_for_symbols(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11440 "cancel_orders_with_client_order_ids" => self.cancel_orders_with_client_order_ids(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11441 "cancel_orders_ws" => self.cancel_orders_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11442 "cancel_spot_order" => self.cancel_spot_order(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11443 "cancel_unified_order" => self.cancel_unified_order(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11444 "check_address" => self.check_address(&args.get(0..).unwrap_or(&[]).to_vec()[..]),
11445 "check_proxy_settings" => self.check_proxy_settings(&args.get(0..).unwrap_or(&[]).to_vec()[..]),
11446 "check_proxy_url_settings" => self.check_proxy_url_settings(&args.get(0..).unwrap_or(&[]).to_vec()[..]),
11447 "check_required_credentials" => self.check_required_credentials(&args.get(0..).unwrap_or(&[]).to_vec()[..]),
11448 "check_ws_proxy_settings" => self.check_ws_proxy_settings(),
11449 "close_all_positions" => self.close_all_positions(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11450 "close_position" => self.close_position(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11451 "common_currency_code" => self.common_currency_code(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11452 "convert_expire_date" => self.convert_expire_date(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11453 "convert_expire_date_to_market_id_date" => self.convert_expire_date_to_market_id_date(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11454 "convert_market_id_expire_date" => self.convert_market_id_expire_date(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11455 "convert_ohlcv_to_trading_view" => self.convert_ohlcv_to_trading_view(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11456 "convert_trading_view_to_ohlcv" => self.convert_trading_view_to_ohlcv(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11457 "convert_type_to_account" => self.convert_type_to_account(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11458 "cost_to_precision" => self.cost_to_precision(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null)),
11459 "create_ccxt_trade_id" => self.create_ccxt_trade_id(&args.get(0..).unwrap_or(&[]).to_vec()[..]),
11460 "create_contract_orders" => self.create_contract_orders(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11461 "create_convert_trade" => self.create_convert_trade(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]).await,
11462 "create_deposit_address" => self.create_deposit_address(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11463 "create_expired_option_market" => <Self as crate::exchange_generated::ExchangeBase>::create_expired_option_market(self, args.get(0).cloned().unwrap_or(crate::Value::Null)),
11464 "create_limit_buy_order" => self.create_limit_buy_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]).await,
11465 "create_limit_buy_order_ws" => self.create_limit_buy_order_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]).await,
11466 "create_limit_order" => self.create_limit_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11467 "create_limit_order_ws" => self.create_limit_order_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11468 "create_limit_sell_order" => self.create_limit_sell_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]).await,
11469 "create_limit_sell_order_ws" => self.create_limit_sell_order_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]).await,
11470 "create_market_buy_order" => self.create_market_buy_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]).await,
11471 "create_market_buy_order_with_cost" => self.create_market_buy_order_with_cost(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]).await,
11472 "create_market_buy_order_ws" => self.create_market_buy_order_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]).await,
11473 "create_market_order" => self.create_market_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]).await,
11474 "create_market_order_with_cost" => self.create_market_order_with_cost(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]).await,
11475 "create_market_order_with_cost_ws" => self.create_market_order_with_cost_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]).await,
11476 "create_market_order_ws" => self.create_market_order_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]).await,
11477 "create_market_sell_order" => self.create_market_sell_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]).await,
11478 "create_market_sell_order_with_cost" => self.create_market_sell_order_with_cost(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]).await,
11479 "create_market_sell_order_ws" => self.create_market_sell_order_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]).await,
11480 "create_ohlcv_object" => self.create_ohlcv_object(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null)),
11481 "create_order" => self.create_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11482 "create_order_with_take_profit_and_stop_loss" => self.create_order_with_take_profit_and_stop_loss(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11483 "create_order_with_take_profit_and_stop_loss_ws" => self.create_order_with_take_profit_and_stop_loss_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11484 "create_order_ws" => self.create_order_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11485 "create_orders" => self.create_orders(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11486 "create_orders_ws" => self.create_orders_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11487 "create_post_only_order" => self.create_post_only_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11488 "create_post_only_order_ws" => self.create_post_only_order_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11489 "create_reduce_only_order" => self.create_reduce_only_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11490 "create_reduce_only_order_ws" => self.create_reduce_only_order_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11491 "create_spot_orders" => self.create_spot_orders(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11492 "create_stop_limit_order" => self.create_stop_limit_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), args.get(4).cloned().unwrap_or(crate::Value::Null), &args.get(5..).unwrap_or(&[]).to_vec()[..]).await,
11493 "create_stop_limit_order_ws" => self.create_stop_limit_order_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), args.get(4).cloned().unwrap_or(crate::Value::Null), &args.get(5..).unwrap_or(&[]).to_vec()[..]).await,
11494 "create_stop_loss_order" => self.create_stop_loss_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11495 "create_stop_loss_order_ws" => self.create_stop_loss_order_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11496 "create_stop_market_order" => self.create_stop_market_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11497 "create_stop_market_order_ws" => self.create_stop_market_order_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11498 "create_stop_order" => self.create_stop_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11499 "create_stop_order_ws" => self.create_stop_order_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11500 "create_sub_account" => self.create_sub_account(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11501 "create_take_profit_order" => self.create_take_profit_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11502 "create_take_profit_order_ws" => self.create_take_profit_order_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11503 "create_trailing_amount_order" => self.create_trailing_amount_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11504 "create_trailing_amount_order_ws" => self.create_trailing_amount_order_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11505 "create_trailing_percent_order" => self.create_trailing_percent_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11506 "create_trailing_percent_order_ws" => self.create_trailing_percent_order_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11507 "create_trigger_order" => self.create_trigger_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11508 "create_trigger_order_ws" => self.create_trigger_order_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11509 "create_twap_order" => self.create_twap_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11510 "currency" => self.currency(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11511 "currency_id" => self.currency_id(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11512 "currency_ids" => self.currency_ids(&args.get(0..).unwrap_or(&[]).to_vec()[..]),
11513 "currency_to_precision" => self.currency_to_precision(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11514 "default_network_code" => self.default_network_code(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11515 "deposit_withdraw_fee" => self.deposit_withdraw_fee(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11516 "edit_limit_buy_order" => self.edit_limit_buy_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]).await,
11517 "edit_limit_order" => self.edit_limit_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11518 "edit_limit_sell_order" => self.edit_limit_sell_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]).await,
11519 "edit_order" => self.edit_order(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11520 "edit_order_with_client_order_id" => self.edit_order_with_client_order_id(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11521 "edit_order_ws" => self.edit_order_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11522 "edit_orders" => self.edit_orders(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11523 "feature_value" => self.feature_value(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11524 "feature_value_by_type" => self.feature_value_by_type(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11525 "features_mapper" => self.features_mapper(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11526 "fee_to_precision" => self.fee_to_precision(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null)),
11527 "fetch" => self.fetch(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11528 "fetch2" => self.fetch2(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11529 "fetch_accounts" => self.fetch_accounts(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11530 "fetch_adl_rank" => self.fetch_adl_rank(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11531 "fetch_all_greeks" => self.fetch_all_greeks(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11532 "fetch_balance" => self.fetch_balance(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11533 "fetch_balance_ws" => self.fetch_balance_ws(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11534 "fetch_bids_asks" => self.fetch_bids_asks(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11535 "fetch_borrow_interest" => self.fetch_borrow_interest(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11536 "fetch_borrow_rate" => self.fetch_borrow_rate(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]).await,
11537 "fetch_canceled_and_closed_orders" => self.fetch_canceled_and_closed_orders(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11538 "fetch_canceled_orders" => self.fetch_canceled_orders(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11539 "fetch_closed_orders" => self.fetch_closed_orders(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11540 "fetch_closed_orders_ws" => self.fetch_closed_orders_ws(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11541 "fetch_contract_deposit_address" => self.fetch_contract_deposit_address(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11542 "fetch_contract_ohlcv" => self.fetch_contract_ohlcv(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11543 "fetch_contract_tickers" => self.fetch_contract_tickers(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11544 "fetch_convert_currencies" => self.fetch_convert_currencies(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11545 "fetch_convert_quote" => self.fetch_convert_quote(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]).await,
11546 "fetch_convert_trade" => self.fetch_convert_trade(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11547 "fetch_convert_trade_history" => self.fetch_convert_trade_history(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11548 "fetch_cross_borrow_rate" => self.fetch_cross_borrow_rate(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11549 "fetch_cross_borrow_rates" => self.fetch_cross_borrow_rates(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11550 "fetch_deposit_address" => self.fetch_deposit_address(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11551 "fetch_deposit_addresses" => self.fetch_deposit_addresses(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11552 "fetch_deposit_addresses_by_network" => self.fetch_deposit_addresses_by_network(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11553 "fetch_deposit_withdraw_fee" => self.fetch_deposit_withdraw_fee(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11554 "fetch_deposit_withdraw_fees" => self.fetch_deposit_withdraw_fees(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11555 "fetch_deposits" => self.fetch_deposits(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11556 "fetch_deposits_withdrawals" => self.fetch_deposits_withdrawals(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11557 "fetch_deposits_ws" => self.fetch_deposits_ws(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11558 "fetch_free_balance" => self.fetch_free_balance(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11559 "fetch_funding_history" => self.fetch_funding_history(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11560 "fetch_funding_interval" => self.fetch_funding_interval(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11561 "fetch_funding_intervals" => self.fetch_funding_intervals(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11562 "fetch_funding_rate" => self.fetch_funding_rate(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11563 "fetch_funding_rate_history" => self.fetch_funding_rate_history(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11564 "fetch_funding_rates" => self.fetch_funding_rates(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11565 "fetch_greeks" => self.fetch_greeks(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11566 "fetch_index_ohlcv" => self.fetch_index_ohlcv(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11567 "fetch_isolated_borrow_rate" => self.fetch_isolated_borrow_rate(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11568 "fetch_isolated_borrow_rates" => self.fetch_isolated_borrow_rates(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11569 "fetch_l2_order_book" => self.fetch_l2_order_book(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11570 "fetch_l3_order_book" => self.fetch_l3_order_book(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11571 "fetch_last_prices" => self.fetch_last_prices(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11572 "fetch_ledger" => self.fetch_ledger(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11573 "fetch_ledger_entry" => self.fetch_ledger_entry(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11574 "fetch_leverage" => self.fetch_leverage(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11575 "fetch_leverage_tiers" => self.fetch_leverage_tiers(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11576 "fetch_leverages" => self.fetch_leverages(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11577 "fetch_liquidations" => self.fetch_liquidations(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11578 "fetch_long_short_ratio" => self.fetch_long_short_ratio(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11579 "fetch_long_short_ratio_history" => self.fetch_long_short_ratio_history(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11580 "fetch_margin_adjustment_history" => self.fetch_margin_adjustment_history(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11581 "fetch_margin_mode" => self.fetch_margin_mode(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11582 "fetch_margin_modes" => self.fetch_margin_modes(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11583 "fetch_mark_ohlcv" => self.fetch_mark_ohlcv(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11584 "fetch_mark_price" => self.fetch_mark_price(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11585 "fetch_mark_prices" => self.fetch_mark_prices(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11586 "fetch_market_leverage_tiers" => self.fetch_market_leverage_tiers(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11587 "fetch_my_liquidations" => self.fetch_my_liquidations(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11588 "fetch_my_trades" => self.fetch_my_trades(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11589 "fetch_my_trades_ws" => self.fetch_my_trades_ws(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11590 "fetch_ohlcv" => self.fetch_ohlcv(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11591 "fetch_ohlcv_ws" => self.fetch_ohlcv_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11592 "fetch_open_interest" => self.fetch_open_interest(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11593 "fetch_open_interest_history" => self.fetch_open_interest_history(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11594 "fetch_open_interests" => self.fetch_open_interests(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11595 "fetch_open_orders" => self.fetch_open_orders(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11596 "fetch_open_orders_ws" => self.fetch_open_orders_ws(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11597 "fetch_option" => self.fetch_option(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11598 "fetch_option_chain" => self.fetch_option_chain(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11599 "fetch_order" => self.fetch_order(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11600 "fetch_order_book" => self.fetch_order_book(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11601 "fetch_order_book_ws" => self.fetch_order_book_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11602 "fetch_order_books" => self.fetch_order_books(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11603 "fetch_order_status" => self.fetch_order_status(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11604 "fetch_order_trades" => self.fetch_order_trades(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11605 "fetch_order_with_client_order_id" => self.fetch_order_with_client_order_id(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11606 "fetch_order_ws" => self.fetch_order_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11607 "fetch_orders" => self.fetch_orders(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11608 "fetch_orders_by_status_ws" => self.fetch_orders_by_status_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11609 "fetch_orders_ws" => self.fetch_orders_ws(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11610 "fetch_paginated_call_cursor" => self.fetch_paginated_call_cursor(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11611 "fetch_paginated_call_deterministic" => self.fetch_paginated_call_deterministic(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11612 "fetch_paginated_call_dynamic" => self.fetch_paginated_call_dynamic(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11613 "fetch_paginated_call_incremental" => self.fetch_paginated_call_incremental(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11614 "fetch_partial_balance" => self.fetch_partial_balance(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11615 "fetch_payment_methods" => self.fetch_payment_methods(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11616 "fetch_position" => self.fetch_position(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11617 "fetch_position_adl_rank" => self.fetch_position_adl_rank(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11618 "fetch_position_history" => self.fetch_position_history(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11619 "fetch_position_mode" => self.fetch_position_mode(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11620 "fetch_position_ws" => self.fetch_position_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11621 "fetch_positions" => self.fetch_positions(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11622 "fetch_positions_adl_rank" => self.fetch_positions_adl_rank(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11623 "fetch_positions_for_symbol" => self.fetch_positions_for_symbol(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11624 "fetch_positions_for_symbol_ws" => self.fetch_positions_for_symbol_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11625 "fetch_positions_history" => self.fetch_positions_history(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11626 "fetch_positions_risk" => self.fetch_positions_risk(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11627 "fetch_positions_ws" => self.fetch_positions_ws(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11628 "fetch_premium_index_ohlcv" => self.fetch_premium_index_ohlcv(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11629 "fetch_rest_order_book_safe" => self.fetch_rest_order_book_safe(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11630 "fetch_spot_ohlcv" => self.fetch_spot_ohlcv(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11631 "fetch_spot_tickers" => self.fetch_spot_tickers(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11632 "fetch_status" => self.fetch_status(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11633 "fetch_ticker" => self.fetch_ticker(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11634 "fetch_ticker_ws" => self.fetch_ticker_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11635 "fetch_tickers" => self.fetch_tickers(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11636 "fetch_tickers_ws" => self.fetch_tickers_ws(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11637 "fetch_time" => self.fetch_time(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11638 "fetch_total_balance" => self.fetch_total_balance(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11639 "fetch_trades" => self.fetch_trades(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11640 "fetch_trades_ws" => self.fetch_trades_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11641 "fetch_trading_fee" => self.fetch_trading_fee(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11642 "fetch_trading_fees" => self.fetch_trading_fees(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11643 "fetch_trading_fees_ws" => self.fetch_trading_fees_ws(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11644 "fetch_trading_limits" => self.fetch_trading_limits(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11645 "fetch_transaction_fee" => self.fetch_transaction_fee(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11646 "fetch_transaction_fees" => self.fetch_transaction_fees(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11647 "fetch_transactions" => self.fetch_transactions(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11648 "fetch_transfer" => self.fetch_transfer(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11649 "fetch_transfers" => self.fetch_transfers(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11650 "fetch_unified_order" => self.fetch_unified_order(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11651 "fetch_used_balance" => self.fetch_used_balance(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11652 "fetch_web_endpoint" => self.fetch_web_endpoint(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]).await,
11653 "fetch_withdrawals" => self.fetch_withdrawals(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11654 "fetch_withdrawals_ws" => self.fetch_withdrawals_ws(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11655 "filter_by_array" => self.filter_by_array(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11656 "filter_by_array_adl_ranks" => self.filter_by_array_adl_ranks(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11657 "filter_by_array_positions" => self.filter_by_array_positions(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11658 "filter_by_array_tickers" => self.filter_by_array_tickers(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11659 "filter_by_currency_since_limit" => self.filter_by_currency_since_limit(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11660 "filter_by_key" => self.filter_by_key(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11661 "filter_by_limit" => self.filter_by_limit(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11662 "filter_by_since_limit" => self.filter_by_since_limit(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11663 "filter_by_symbol" => self.filter_by_symbol(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11664 "filter_by_symbol_since_limit" => self.filter_by_symbol_since_limit(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11665 "filter_by_symbols_since_limit" => self.filter_by_symbols_since_limit(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11666 "filter_by_value_since_limit" => self.filter_by_value_since_limit(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11667 "filter_out_by_array" => self.filter_out_by_array(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11668 "find_broadly_matched_key" => self.find_broadly_matched_key(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null)),
11669 "find_message_hashes" => self.find_message_hashes(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null)),
11670 "find_nearest_ceiling" => self.find_nearest_ceiling(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null)),
11671 "find_timeframe" => self.find_timeframe(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11672 "force_string" => self.force_string(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11673 "get_cache_index" => self.get_cache_index(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null)),
11674 "get_default_options" => self.get_default_options(),
11675 "get_describe_for_extended_ws_exchange" => self.get_describe_for_extended_ws_exchange(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null)),
11676 "get_list_from_object_values" => self.get_list_from_object_values(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null)),
11677 "get_market_from_symbols" => self.get_market_from_symbols(&args.get(0..).unwrap_or(&[]).to_vec()[..]),
11678 "get_supported_mapping" => self.get_supported_mapping(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11679 "get_symbols_for_market_type" => self.get_symbols_for_market_type(&args.get(0..).unwrap_or(&[]).to_vec()[..]),
11680 "handle_errors" => <Self as crate::exchange_generated::ExchangeBase>::handle_errors(self, args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), args.get(4).cloned().unwrap_or(crate::Value::Null), args.get(5).cloned().unwrap_or(crate::Value::Null), args.get(6).cloned().unwrap_or(crate::Value::Null), args.get(7).cloned().unwrap_or(crate::Value::Null), args.get(8).cloned().unwrap_or(crate::Value::Null)),
11681 "handle_margin_mode_and_params" => self.handle_margin_mode_and_params(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11682 "handle_market_type_and_params" => self.handle_market_type_and_params(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11683 "handle_max_entries_per_request_and_params" => self.handle_max_entries_per_request_and_params(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11684 "handle_network_code_and_params" => self.handle_network_code_and_params(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11685 "handle_option" => self.handle_option(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11686 "handle_option_and_params" => self.handle_option_and_params(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]),
11687 "handle_option_and_params2" => self.handle_option_and_params2(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]),
11688 "handle_param_bool" => self.handle_param_bool(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11689 "handle_param_bool2" => self.handle_param_bool2(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]),
11690 "handle_param_integer" => self.handle_param_integer(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11691 "handle_param_integer2" => self.handle_param_integer2(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]),
11692 "handle_param_string" => self.handle_param_string(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11693 "handle_param_string2" => self.handle_param_string2(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]),
11694 "handle_post_only" => self.handle_post_only(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11695 "handle_request_network" => self.handle_request_network(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]),
11696 "handle_sub_type_and_params" => self.handle_sub_type_and_params(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11697 "handle_time_in_force" => self.handle_time_in_force(&args.get(0..).unwrap_or(&[]).to_vec()[..]),
11698 "handle_trigger_and_params" => self.handle_trigger_and_params(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11699 "handle_trigger_direction_and_params" => self.handle_trigger_direction_and_params(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11700 "handle_trigger_prices_and_params" => self.handle_trigger_prices_and_params(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11701 "handle_until_option" => self.handle_until_option(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]),
11702 "handle_withdraw_tag_and_params" => self.handle_withdraw_tag_and_params(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null)),
11703 "implode_hostname" => self.implode_hostname(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11704 "integer_precision_to_amount" => self.integer_precision_to_amount(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11705 "invert_flat_string_dictionary" => self.invert_flat_string_dictionary(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11706 "is_decimal_precision" => self.is_decimal_precision(),
11707 "is_empty_string" => self.is_empty_string(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11708 "is_leveraged_currency" => self.is_leveraged_currency(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11709 "is_post_only" => self.is_post_only(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11710 "is_round_number" => self.is_round_number(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11711 "is_significant_precision" => self.is_significant_precision(),
11712 "is_tick_precision" => self.is_tick_precision(),
11713 "is_trigger_order" => self.is_trigger_order(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11714 "is_uta_enabled" => self.is_uta_enabled(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11715 "load_accounts" => self.load_accounts(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11716 "load_markets" => self.load_markets(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11717 "load_markets_and_sign_in" => self.load_markets_and_sign_in().await,
11718 "load_time_difference" => self.load_time_difference(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11719 "load_trading_limits" => self.load_trading_limits(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11720 "market" => self.market(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11721 "market_codes" => self.market_codes(&args.get(0..).unwrap_or(&[]).to_vec()[..]),
11722 "market_id" => self.market_id(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11723 "market_ids" => self.market_ids(&args.get(0..).unwrap_or(&[]).to_vec()[..]),
11724 "market_or_null" => self.market_or_null(&args.get(0..).unwrap_or(&[]).to_vec()[..]),
11725 "market_symbols" => self.market_symbols(&args.get(0..).unwrap_or(&[]).to_vec()[..]),
11726 "markets_for_symbols" => self.markets_for_symbols(&args.get(0..).unwrap_or(&[]).to_vec()[..]),
11727 "merge_balance_account" => self.merge_balance_account(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null)),
11728 "network_code_to_id" => self.network_code_to_id(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11729 "network_id_to_code" => self.network_id_to_code(&args.get(0..).unwrap_or(&[]).to_vec()[..]),
11730 "nonce" => <Self as crate::exchange_generated::ExchangeBase>::nonce(self),
11731 "oath" => self.oath(),
11732 "orderbook_checksum_message" => self.orderbook_checksum_message(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11733 "parse_account" => <Self as crate::exchange_generated::ExchangeBase>::parse_account(self, args.get(0).cloned().unwrap_or(crate::Value::Null)),
11734 "parse_accounts" => self.parse_accounts(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11735 "parse_adl_rank" => <Self as crate::exchange_generated::ExchangeBase>::parse_adl_rank(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11736 "parse_adl_ranks" => self.parse_adl_ranks(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11737 "parse_all_greeks" => self.parse_all_greeks(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11738 "parse_balance" => <Self as crate::exchange_generated::ExchangeBase>::parse_balance(self, args.get(0).cloned().unwrap_or(crate::Value::Null)),
11739 "parse_borrow_interest" => <Self as crate::exchange_generated::ExchangeBase>::parse_borrow_interest(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11740 "parse_borrow_interests" => self.parse_borrow_interests(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11741 "parse_borrow_rate" => <Self as crate::exchange_generated::ExchangeBase>::parse_borrow_rate(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11742 "parse_borrow_rate_history" => self.parse_borrow_rate_history(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null)),
11743 "parse_conversion" => <Self as crate::exchange_generated::ExchangeBase>::parse_conversion(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11744 "parse_conversions" => self.parse_conversions(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11745 "parse_currencies" => self.parse_currencies(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11746 "parse_currency" => <Self as crate::exchange_generated::ExchangeBase>::parse_currency(self, args.get(0).cloned().unwrap_or(crate::Value::Null)),
11747 "parse_deposit_address" => <Self as crate::exchange_generated::ExchangeBase>::parse_deposit_address(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11748 "parse_deposit_addresses" => self.parse_deposit_addresses(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11749 "parse_deposit_withdraw_fee" => <Self as crate::exchange_generated::ExchangeBase>::parse_deposit_withdraw_fee(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11750 "parse_deposit_withdraw_fees" => self.parse_deposit_withdraw_fees(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11751 "parse_fee_numeric" => self.parse_fee_numeric(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11752 "parse_funding_rate" => <Self as crate::exchange_generated::ExchangeBase>::parse_funding_rate(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11753 "parse_funding_rate_histories" => self.parse_funding_rate_histories(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11754 "parse_funding_rate_history" => <Self as crate::exchange_generated::ExchangeBase>::parse_funding_rate_history(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11755 "parse_funding_rates" => self.parse_funding_rates(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11756 "parse_greeks" => <Self as crate::exchange_generated::ExchangeBase>::parse_greeks(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11757 "parse_income" => <Self as crate::exchange_generated::ExchangeBase>::parse_income(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11758 "parse_incomes" => self.parse_incomes(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11759 "parse_isolated_borrow_rate" => self.parse_isolated_borrow_rate(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11760 "parse_isolated_borrow_rates" => self.parse_isolated_borrow_rates(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11761 "parse_last_price" => <Self as crate::exchange_generated::ExchangeBase>::parse_last_price(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11762 "parse_last_prices" => self.parse_last_prices(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11763 "parse_ledger" => self.parse_ledger(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11764 "parse_ledger_entry" => <Self as crate::exchange_generated::ExchangeBase>::parse_ledger_entry(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11765 "parse_leverage" => <Self as crate::exchange_generated::ExchangeBase>::parse_leverage(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11766 "parse_leverage_tiers" => self.parse_leverage_tiers(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11767 "parse_leverages" => self.parse_leverages(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11768 "parse_liquidation" => <Self as crate::exchange_generated::ExchangeBase>::parse_liquidation(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11769 "parse_liquidations" => self.parse_liquidations(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11770 "parse_long_short_ratio" => self.parse_long_short_ratio(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11771 "parse_long_short_ratio_history" => self.parse_long_short_ratio_history(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11772 "parse_margin_mode" => <Self as crate::exchange_generated::ExchangeBase>::parse_margin_mode(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11773 "parse_margin_modes" => self.parse_margin_modes(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11774 "parse_margin_modification" => <Self as crate::exchange_generated::ExchangeBase>::parse_margin_modification(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11775 "parse_margin_modifications" => self.parse_margin_modifications(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11776 "parse_market" => <Self as crate::exchange_generated::ExchangeBase>::parse_market(self, args.get(0).cloned().unwrap_or(crate::Value::Null)),
11777 "parse_market_leverage_tiers" => <Self as crate::exchange_generated::ExchangeBase>::parse_market_leverage_tiers(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11778 "parse_markets" => self.parse_markets(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11779 "parse_ohlc_vs" => self.parse_ohlc_vs(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11780 "parse_ohlcv" => <Self as crate::exchange_generated::ExchangeBase>::parse_ohlcv(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11781 "parse_open_interest" => <Self as crate::exchange_generated::ExchangeBase>::parse_open_interest(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11782 "parse_open_interests" => self.parse_open_interests(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11783 "parse_open_interests_history" => self.parse_open_interests_history(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11784 "parse_option" => self.parse_option(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11785 "parse_option_chain" => self.parse_option_chain(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11786 "parse_order" => <Self as crate::exchange_generated::ExchangeBase>::parse_order(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11787 "parse_order_book" => <Self as crate::exchange_generated::ExchangeBase>::parse_order_book(self, args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11788 "parse_order_book_bid_ask" => self.parse_order_book_bid_ask(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11789 "parse_order_book_bids_asks" => self.parse_order_book_bids_asks(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11790 "parse_orders" => self.parse_orders(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11791 "parse_position" => <Self as crate::exchange_generated::ExchangeBase>::parse_position(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11792 "parse_positions" => self.parse_positions(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11793 "parse_precision" => self.parse_precision(&args.get(0..).unwrap_or(&[]).to_vec()[..]),
11794 "parse_ticker" => <Self as crate::exchange_generated::ExchangeBase>::parse_ticker(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11795 "parse_tickers" => self.parse_tickers(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11796 "parse_to_int" => self.parse_to_int(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11797 "parse_to_numeric" => self.parse_to_numeric(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11798 "parse_trade" => <Self as crate::exchange_generated::ExchangeBase>::parse_trade(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11799 "parse_trades" => self.parse_trades(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11800 "parse_trades_helper" => self.parse_trades_helper(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11801 "parse_trading_view_ohlcv" => self.parse_trading_view_ohlcv(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11802 "parse_transaction" => <Self as crate::exchange_generated::ExchangeBase>::parse_transaction(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11803 "parse_transactions" => self.parse_transactions(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11804 "parse_transfer" => <Self as crate::exchange_generated::ExchangeBase>::parse_transfer(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11805 "parse_transfers" => self.parse_transfers(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11806 "parse_ws_ohlc_vs" => self.parse_ws_ohlc_vs(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11807 "parse_ws_ohlcv" => self.parse_ws_ohlcv(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11808 "parse_ws_order" => self.parse_ws_order(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11809 "parse_ws_order_trade" => self.parse_ws_order_trade(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11810 "parse_ws_trade" => self.parse_ws_trade(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11811 "parse_ws_trades" => self.parse_ws_trades(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11812 "parsed_fee_and_fees" => self.parsed_fee_and_fees(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11813 "price_to_precision" => self.price_to_precision(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null)),
11814 "prioritized_network_aliases" => self.prioritized_network_aliases(&args.get(0..).unwrap_or(&[]).to_vec()[..]),
11815 "reduce_fees_by_currency" => self.reduce_fees_by_currency(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11816 "reduce_margin" => self.reduce_margin(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]).await,
11817 "remove_keys_from_dict" => self.remove_keys_from_dict(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null)),
11818 "remove_repeated_elements_from_array" => self.remove_repeated_elements_from_array(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11819 "remove_repeated_trades_from_array" => self.remove_repeated_trades_from_array(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11820 "repay_cross_margin" => self.repay_cross_margin(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]).await,
11821 "repay_isolated_margin" => self.repay_isolated_margin(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]).await,
11822 "repay_margin" => self.repay_margin(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]).await,
11823 "request" => self.request(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11824 "require_value" => self.require_value(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11825 "resolve_path" => self.resolve_path(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null)),
11826 "safe_balance" => self.safe_balance(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11827 "safe_bool" => self.safe_bool(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11828 "safe_bool2" => self.safe_bool2(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]),
11829 "safe_bool_n" => self.safe_bool_n(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11830 "safe_currency" => self.safe_currency(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11831 "safe_currency_code" => self.safe_currency_code(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11832 "safe_currency_structure" => self.safe_currency_structure(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11833 "safe_deterministic_call" => self.safe_deterministic_call(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11834 "safe_dict" => self.safe_dict(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11835 "safe_dict2" => self.safe_dict2(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]),
11836 "safe_dict_n" => self.safe_dict_n(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11837 "safe_integer_omit_zero" => self.safe_integer_omit_zero(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11838 "safe_ledger_entry" => self.safe_ledger_entry(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11839 "safe_liquidation" => self.safe_liquidation(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11840 "safe_list" => self.safe_list(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11841 "safe_list2" => self.safe_list2(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]),
11842 "safe_list_n" => self.safe_list_n(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11843 "safe_market" => self.safe_market(&args.get(0..).unwrap_or(&[]).to_vec()[..]),
11844 "safe_market_structure" => self.safe_market_structure(&args.get(0..).unwrap_or(&[]).to_vec()[..]),
11845 "safe_network" => self.safe_network(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11846 "safe_number" => self.safe_number(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11847 "safe_number2" => self.safe_number2(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]),
11848 "safe_number_n" => self.safe_number_n(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11849 "safe_number_omit_zero" => self.safe_number_omit_zero(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
11850 "safe_open_interest" => self.safe_open_interest(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11851 "safe_order" => self.safe_order(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11852 "safe_position" => self.safe_position(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11853 "safe_symbol" => self.safe_symbol(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11854 "safe_ticker" => self.safe_ticker(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11855 "safe_trade" => self.safe_trade(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11856 "select_network_code_from_unified_networks" => self.select_network_code_from_unified_networks(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null)),
11857 "select_network_id_from_raw_networks" => self.select_network_id_from_raw_networks(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null)),
11858 "select_network_key_from_networks" => self.select_network_key_from_networks(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]),
11859 "set_headers" => self.set_headers(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11860 "set_leverage" => self.set_leverage(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11861 "set_margin" => self.set_margin(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]).await,
11862 "set_margin_mode" => self.set_margin_mode(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11863 "set_markets" => self.set_markets(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11864 "set_markets_from_exchange" => self.set_markets_from_exchange(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11865 "set_position_mode" => self.set_position_mode(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11866 "set_take_profit_and_stop_loss_params" => self.set_take_profit_and_stop_loss_params(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]),
11867 "sign" => <Self as crate::exchange_generated::ExchangeBase>::sign(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
11868 "sign_in" => self.sign_in(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11869 "sort_cursor_paginated_result" => self.sort_cursor_paginated_result(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11870 "string_to_base16" => self.string_to_base16(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11871 "symbol" => self.symbol(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11872 "timeframe_from_milliseconds" => self.timeframe_from_milliseconds(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11873 "transfer" => self.transfer(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
11874 "un_watch_bids_asks" => self.un_watch_bids_asks(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11875 "un_watch_funding_rate" => self.un_watch_funding_rate(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11876 "un_watch_funding_rates" => self.un_watch_funding_rates(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11877 "un_watch_mark_price" => self.un_watch_mark_price(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11878 "un_watch_mark_prices" => self.un_watch_mark_prices(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11879 "un_watch_my_trades" => self.un_watch_my_trades(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11880 "un_watch_ohlcv" => self.un_watch_ohlcv(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11881 "un_watch_ohlcv_for_symbols" => self.un_watch_ohlcv_for_symbols(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11882 "un_watch_order_book" => self.un_watch_order_book(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11883 "un_watch_order_book_for_symbols" => self.un_watch_order_book_for_symbols(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11884 "un_watch_orders" => self.un_watch_orders(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11885 "un_watch_positions" => self.un_watch_positions(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11886 "un_watch_ticker" => self.un_watch_ticker(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11887 "un_watch_tickers" => self.un_watch_tickers(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11888 "un_watch_trades" => self.un_watch_trades(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11889 "un_watch_trades_for_symbols" => self.un_watch_trades_for_symbols(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11890 "url_encoder_for_proxy_url" => self.url_encoder_for_proxy_url(args.get(0).cloned().unwrap_or(crate::Value::Null)),
11891 "watch_balance" => self.watch_balance(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11892 "watch_bids_asks" => self.watch_bids_asks(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11893 "watch_funding_rate" => self.watch_funding_rate(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11894 "watch_funding_rates" => self.watch_funding_rates(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11895 "watch_funding_rates_for_symbols" => self.watch_funding_rates_for_symbols(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11896 "watch_liquidations" => self.watch_liquidations(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11897 "watch_liquidations_for_symbols" => self.watch_liquidations_for_symbols(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11898 "watch_mark_price" => self.watch_mark_price(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11899 "watch_mark_prices" => self.watch_mark_prices(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11900 "watch_my_liquidations" => self.watch_my_liquidations(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11901 "watch_my_liquidations_for_symbols" => self.watch_my_liquidations_for_symbols(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11902 "watch_my_trades" => self.watch_my_trades(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11903 "watch_my_trades_for_symbols" => self.watch_my_trades_for_symbols(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11904 "watch_ohlcv" => self.watch_ohlcv(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11905 "watch_ohlcv_for_symbols" => self.watch_ohlcv_for_symbols(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11906 "watch_order_book" => self.watch_order_book(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11907 "watch_order_book_for_symbols" => self.watch_order_book_for_symbols(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11908 "watch_orders" => self.watch_orders(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11909 "watch_orders_for_symbols" => self.watch_orders_for_symbols(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11910 "watch_position" => self.watch_position(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11911 "watch_position_for_symbols" => self.watch_position_for_symbols(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11912 "watch_positions" => self.watch_positions(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11913 "watch_ticker" => self.watch_ticker(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11914 "watch_tickers" => self.watch_tickers(&args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
11915 "watch_trades" => self.watch_trades(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11916 "watch_trades_for_symbols" => self.watch_trades_for_symbols(args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
11917 "withdraw" => self.withdraw(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]).await,
11918 "withdraw_ws" => self.withdraw_ws(args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), &args.get(3..).unwrap_or(&[]).to_vec()[..]).await,
11919 _ => {
11933 if self.internals.implicit_api.is_empty() {
11934 self.build_implicit_api();
11935 }
11936 if self.internals.implicit_api.contains_key(method) {
11937 self.call_method(crate::Value::Str(method.to_string()), &args[..]).await
11938 } else {
11939 self.internals.dynamic_dispatch_miss = Some(method.to_string());
11940 crate::Value::Null
11941 }
11942 }
11943 }
11944 })
11945 }
11946}