ccxt 4.2.37 → 4.2.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,6 +37,7 @@ class kucoin extends kucoin$1 {
37
37
  'watchOrderBook': {
38
38
  'snapshotDelay': 5,
39
39
  'snapshotMaxRetries': 3,
40
+ 'method': '/market/level2', // '/spotMarket/level2Depth5' or '/spotMarket/level2Depth50'
40
41
  },
41
42
  },
42
43
  'streaming': {
@@ -438,10 +439,15 @@ class kucoin extends kucoin$1 {
438
439
  /**
439
440
  * @method
440
441
  * @name kucoin#watchOrderBook
442
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level1-bbo-market-data
443
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-market-data
444
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-5-best-ask-bid-orders
445
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-50-best-ask-bid-orders
441
446
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
442
447
  * @param {string} symbol unified symbol of the market to fetch the order book for
443
448
  * @param {int} [limit] the maximum amount of order book entries to return
444
449
  * @param {object} [params] extra parameters specific to the exchange API endpoint
450
+ * @param {string} [params.method] either '/market/level2' or '/spotMarket/level2Depth5' or '/spotMarket/level2Depth50' default is '/market/level2'
445
451
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
446
452
  */
447
453
  //
@@ -465,10 +471,15 @@ class kucoin extends kucoin$1 {
465
471
  /**
466
472
  * @method
467
473
  * @name kucoin#watchOrderBookForSymbols
474
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level1-bbo-market-data
475
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-market-data
476
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-5-best-ask-bid-orders
477
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/level2-50-best-ask-bid-orders
468
478
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
469
479
  * @param {string[]} symbols unified array of symbols
470
480
  * @param {int} [limit] the maximum amount of order book entries to return
471
481
  * @param {object} [params] extra parameters specific to the exchange API endpoint
482
+ * @param {string} [params.method] either '/market/level2' or '/spotMarket/level2Depth5' or '/spotMarket/level2Depth50' default is '/market/level2'
472
483
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
473
484
  */
474
485
  const symbolsLength = symbols.length;
@@ -476,28 +487,36 @@ class kucoin extends kucoin$1 {
476
487
  throw new errors.ArgumentsRequired(this.id + ' watchOrderBookForSymbols() requires a non-empty array of symbols');
477
488
  }
478
489
  if (limit !== undefined) {
479
- if ((limit !== 20) && (limit !== 100)) {
480
- throw new errors.ExchangeError(this.id + " watchOrderBook 'limit' argument must be undefined, 20 or 100");
490
+ if ((limit !== 20) && (limit !== 100) && (limit !== 50) && (limit !== 5)) {
491
+ throw new errors.ExchangeError(this.id + " watchOrderBook 'limit' argument must be undefined, 5, 20, 50 or 100");
481
492
  }
482
493
  }
483
494
  await this.loadMarkets();
484
495
  symbols = this.marketSymbols(symbols);
485
496
  const marketIds = this.marketIds(symbols);
486
497
  const url = await this.negotiate(false);
487
- const topic = '/market/level2:' + marketIds.join(',');
498
+ let method = undefined;
499
+ [method, params] = this.handleOptionAndParams(params, 'watchOrderBook', 'method', '/market/level2');
500
+ if ((limit === 5) || (limit === 50)) {
501
+ method = '/spotMarket/level2Depth' + limit.toString();
502
+ }
503
+ const topic = method + ':' + marketIds.join(',');
488
504
  const messageHashes = [];
489
505
  const subscriptionHashes = [];
490
506
  for (let i = 0; i < symbols.length; i++) {
491
507
  const symbol = symbols[i];
492
508
  messageHashes.push('orderbook:' + symbol);
493
509
  const marketId = marketIds[i];
494
- subscriptionHashes.push('/market/level2:' + marketId);
510
+ subscriptionHashes.push(method + ':' + marketId);
511
+ }
512
+ let subscription = {};
513
+ if (method === '/market/level2') { // other streams return the entire orderbook, so we don't need to fetch the snapshot through REST
514
+ subscription = {
515
+ 'method': this.handleOrderBookSubscription,
516
+ 'symbols': symbols,
517
+ 'limit': limit,
518
+ };
495
519
  }
496
- const subscription = {
497
- 'method': this.handleOrderBookSubscription,
498
- 'symbols': symbols,
499
- 'limit': limit,
500
- };
501
520
  const orderbook = await this.subscribeMultiple(url, messageHashes, topic, subscriptionHashes, params, subscription);
502
521
  return orderbook.limit();
503
522
  }
@@ -521,41 +540,74 @@ class kucoin extends kucoin$1 {
521
540
  // }
522
541
  // }
523
542
  //
543
+ // {
544
+ // "topic": "/spotMarket/level2Depth5:BTC-USDT",
545
+ // "type": "message",
546
+ // "data": {
547
+ // "asks": [
548
+ // [
549
+ // "42815.6",
550
+ // "1.24016245"
551
+ // ]
552
+ // ],
553
+ // "bids": [
554
+ // [
555
+ // "42815.5",
556
+ // "0.08652716"
557
+ // ]
558
+ // ],
559
+ // "timestamp": 1707204474018
560
+ // },
561
+ // "subject": "level2"
562
+ // }
563
+ //
524
564
  const data = this.safeValue(message, 'data');
525
- const marketId = this.safeString(data, 'symbol');
565
+ const subject = this.safeString(message, 'subject');
566
+ const topic = this.safeString(message, 'topic');
567
+ const topicParts = topic.split(':');
568
+ const topicSymbol = this.safeString(topicParts, 1);
569
+ const topicChannel = this.safeString(topicParts, 0);
570
+ const marketId = this.safeString(data, 'symbol', topicSymbol);
526
571
  const symbol = this.safeSymbol(marketId, undefined, '-');
527
572
  const messageHash = 'orderbook:' + symbol;
528
- const storedOrderBook = this.orderbooks[symbol];
529
- const nonce = this.safeInteger(storedOrderBook, 'nonce');
530
- const deltaEnd = this.safeInteger(data, 'sequenceEnd');
531
- if (nonce === undefined) {
532
- const cacheLength = storedOrderBook.cache.length;
533
- const topic = this.safeString(message, 'topic');
534
- const topicParts = topic.split(':');
535
- const topicSymbol = this.safeString(topicParts, 1);
536
- const topicChannel = this.safeString(topicParts, 0);
537
- const subscriptions = Object.keys(client.subscriptions);
538
- let subscription = undefined;
539
- for (let i = 0; i < subscriptions.length; i++) {
540
- const key = subscriptions[i];
541
- if ((key.indexOf(topicSymbol) >= 0) && (key.indexOf(topicChannel) >= 0)) {
542
- subscription = client.subscriptions[key];
543
- break;
544
- }
573
+ let orderbook = this.safeDict(this.orderbooks, symbol);
574
+ if (subject === 'level2') {
575
+ if (orderbook === undefined) {
576
+ orderbook = this.orderBook();
545
577
  }
546
- const limit = this.safeInteger(subscription, 'limit');
547
- const snapshotDelay = this.handleOption('watchOrderBook', 'snapshotDelay', 5);
548
- if (cacheLength === snapshotDelay) {
549
- this.spawn(this.loadOrderBook, client, messageHash, symbol, limit, {});
578
+ else {
579
+ orderbook.reset();
550
580
  }
551
- storedOrderBook.cache.push(data);
552
- return;
581
+ orderbook['symbol'] = symbol;
553
582
  }
554
- else if (nonce >= deltaEnd) {
555
- return;
583
+ else {
584
+ const nonce = this.safeInteger(orderbook, 'nonce');
585
+ const deltaEnd = this.safeInteger2(data, 'sequenceEnd', 'timestamp');
586
+ if (nonce === undefined) {
587
+ const cacheLength = orderbook.cache.length;
588
+ const subscriptions = Object.keys(client.subscriptions);
589
+ let subscription = undefined;
590
+ for (let i = 0; i < subscriptions.length; i++) {
591
+ const key = subscriptions[i];
592
+ if ((key.indexOf(topicSymbol) >= 0) && (key.indexOf(topicChannel) >= 0)) {
593
+ subscription = client.subscriptions[key];
594
+ break;
595
+ }
596
+ }
597
+ const limit = this.safeInteger(subscription, 'limit');
598
+ const snapshotDelay = this.handleOption('watchOrderBook', 'snapshotDelay', 5);
599
+ if (cacheLength === snapshotDelay) {
600
+ this.spawn(this.loadOrderBook, client, messageHash, symbol, limit, {});
601
+ }
602
+ orderbook.cache.push(data);
603
+ return;
604
+ }
605
+ else if (nonce >= deltaEnd) {
606
+ return;
607
+ }
556
608
  }
557
- this.handleDelta(storedOrderBook, data);
558
- client.resolve(storedOrderBook, messageHash);
609
+ this.handleDelta(orderbook, data);
610
+ client.resolve(orderbook, messageHash);
559
611
  }
560
612
  getCacheIndex(orderbook, cache) {
561
613
  const firstDelta = this.safeValue(cache, 0);
@@ -575,11 +627,11 @@ class kucoin extends kucoin$1 {
575
627
  return cache.length;
576
628
  }
577
629
  handleDelta(orderbook, delta) {
578
- orderbook['nonce'] = this.safeInteger(delta, 'sequenceEnd');
579
- const timestamp = this.safeInteger(delta, 'time');
630
+ const timestamp = this.safeInteger2(delta, 'time', 'timestamp');
631
+ orderbook['nonce'] = this.safeInteger(delta, 'sequenceEnd', timestamp);
580
632
  orderbook['timestamp'] = timestamp;
581
633
  orderbook['datetime'] = this.iso8601(timestamp);
582
- const changes = this.safeValue(delta, 'changes');
634
+ const changes = this.safeValue(delta, 'changes', delta);
583
635
  const bids = this.safeValue(changes, 'bids', []);
584
636
  const asks = this.safeValue(changes, 'asks', []);
585
637
  const storedBids = orderbook['bids'];
@@ -993,6 +1045,7 @@ class kucoin extends kucoin$1 {
993
1045
  }
994
1046
  const subject = this.safeString(message, 'subject');
995
1047
  const methods = {
1048
+ 'level2': this.handleOrderBook,
996
1049
  'trade.l2update': this.handleOrderBook,
997
1050
  'trade.ticker': this.handleTicker,
998
1051
  'trade.snapshot': this.handleTicker,
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
7
- declare const version = "4.2.36";
7
+ declare const version = "4.2.37";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
@@ -37,6 +37,7 @@ import bitteam from './src/bitteam.js';
37
37
  import bitvavo from './src/bitvavo.js';
38
38
  import bl3p from './src/bl3p.js';
39
39
  import blockchaincom from './src/blockchaincom.js';
40
+ import blofin from './src/blofin.js';
40
41
  import btcalpha from './src/btcalpha.js';
41
42
  import btcbox from './src/btcbox.js';
42
43
  import btcmarkets from './src/btcmarkets.js';
@@ -199,6 +200,7 @@ declare const exchanges: {
199
200
  bitvavo: typeof bitvavo;
200
201
  bl3p: typeof bl3p;
201
202
  blockchaincom: typeof blockchaincom;
203
+ blofin: typeof blofin;
202
204
  btcalpha: typeof btcalpha;
203
205
  btcbox: typeof btcbox;
204
206
  btcmarkets: typeof btcmarkets;
@@ -432,6 +434,7 @@ declare const ccxt: {
432
434
  bitvavo: typeof bitvavo;
433
435
  bl3p: typeof bl3p;
434
436
  blockchaincom: typeof blockchaincom;
437
+ blofin: typeof blofin;
435
438
  btcalpha: typeof btcalpha;
436
439
  btcbox: typeof btcbox;
437
440
  btcmarkets: typeof btcmarkets;
@@ -501,5 +504,5 @@ declare const ccxt: {
501
504
  zaif: typeof zaif;
502
505
  zonda: typeof zonda;
503
506
  } & typeof functions & typeof errors;
504
- export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange, Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitforex, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
507
+ export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange, Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitforex, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
505
508
  export default ccxt;
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.2.37';
41
+ const version = '4.2.38';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -73,6 +73,7 @@ import bitteam from './src/bitteam.js';
73
73
  import bitvavo from './src/bitvavo.js';
74
74
  import bl3p from './src/bl3p.js';
75
75
  import blockchaincom from './src/blockchaincom.js';
76
+ import blofin from './src/blofin.js';
76
77
  import btcalpha from './src/btcalpha.js';
77
78
  import btcbox from './src/btcbox.js';
78
79
  import btcmarkets from './src/btcmarkets.js';
@@ -236,6 +237,7 @@ const exchanges = {
236
237
  'bitvavo': bitvavo,
237
238
  'bl3p': bl3p,
238
239
  'blockchaincom': blockchaincom,
240
+ 'blofin': blofin,
239
241
  'btcalpha': btcalpha,
240
242
  'btcbox': btcbox,
241
243
  'btcmarkets': btcmarkets,
@@ -380,6 +382,6 @@ pro.exchanges = Object.keys(pro);
380
382
  pro['Exchange'] = Exchange; // now the same for rest and ts
381
383
  //-----------------------------------------------------------------------------
382
384
  const ccxt = Object.assign({ version, Exchange, Precise, 'exchanges': Object.keys(exchanges), 'pro': pro }, exchanges, functions, errors);
383
- export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitforex, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
385
+ export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitforex, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
384
386
  export default ccxt;
385
387
  //-----------------------------------------------------------------------------
@@ -0,0 +1,36 @@
1
+ import { implicitReturnType } from '../base/types.js';
2
+ import { Exchange as _Exchange } from '../base/Exchange.js';
3
+ interface Exchange {
4
+ publicGetMarketInstruments(params?: {}): Promise<implicitReturnType>;
5
+ publicGetMarketTickers(params?: {}): Promise<implicitReturnType>;
6
+ publicGetMarketBooks(params?: {}): Promise<implicitReturnType>;
7
+ publicGetMarketTrades(params?: {}): Promise<implicitReturnType>;
8
+ publicGetMarketCandles(params?: {}): Promise<implicitReturnType>;
9
+ publicGetMarketMarkPrice(params?: {}): Promise<implicitReturnType>;
10
+ publicGetMarketFundingRate(params?: {}): Promise<implicitReturnType>;
11
+ publicGetMarketFundingRateHistory(params?: {}): Promise<implicitReturnType>;
12
+ privateGetAssetBalances(params?: {}): Promise<implicitReturnType>;
13
+ privateGetTradeOrdersPending(params?: {}): Promise<implicitReturnType>;
14
+ privateGetTradeFillsHistory(params?: {}): Promise<implicitReturnType>;
15
+ privateGetAssetDepositHistory(params?: {}): Promise<implicitReturnType>;
16
+ privateGetAssetWithdrawalHistory(params?: {}): Promise<implicitReturnType>;
17
+ privateGetAssetBills(params?: {}): Promise<implicitReturnType>;
18
+ privateGetAccountBalance(params?: {}): Promise<implicitReturnType>;
19
+ privateGetAccountPositions(params?: {}): Promise<implicitReturnType>;
20
+ privateGetAccountLeverageInfo(params?: {}): Promise<implicitReturnType>;
21
+ privateGetTradeOrdersTpslPending(params?: {}): Promise<implicitReturnType>;
22
+ privateGetTradeOrdersHistory(params?: {}): Promise<implicitReturnType>;
23
+ privateGetTradeOrdersTpslHistory(params?: {}): Promise<implicitReturnType>;
24
+ privatePostTradeOrder(params?: {}): Promise<implicitReturnType>;
25
+ privatePostTradeCancelOrder(params?: {}): Promise<implicitReturnType>;
26
+ privatePostAccountSetLeverage(params?: {}): Promise<implicitReturnType>;
27
+ privatePostTradeBatchOrders(params?: {}): Promise<implicitReturnType>;
28
+ privatePostTradeOrderTpsl(params?: {}): Promise<implicitReturnType>;
29
+ privatePostTradeCancelBatchOrders(params?: {}): Promise<implicitReturnType>;
30
+ privatePostTradeCancelTpsl(params?: {}): Promise<implicitReturnType>;
31
+ privatePostTradeClosePosition(params?: {}): Promise<implicitReturnType>;
32
+ privatePostAssetTransfer(params?: {}): Promise<implicitReturnType>;
33
+ }
34
+ declare abstract class Exchange extends _Exchange {
35
+ }
36
+ export default Exchange;
@@ -0,0 +1,11 @@
1
+ // ----------------------------------------------------------------------------
2
+
3
+ // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+ // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
+
7
+ // -------------------------------------------------------------------------------
8
+ import { Exchange as _Exchange } from '../base/Exchange.js';
9
+ class Exchange extends _Exchange {
10
+ }
11
+ export default Exchange;
@@ -0,0 +1,124 @@
1
+ import Exchange from './abstract/blofin.js';
2
+ import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, Str, Transaction, Ticker, OrderBook, Balances, Tickers, Market, Strings, Currency, Position, TransferEntry } from './base/types.js';
3
+ /**
4
+ * @class blofin
5
+ * @augments Exchange
6
+ */
7
+ export default class blofin extends Exchange {
8
+ describe(): any;
9
+ fetchMarkets(params?: {}): Promise<import("./base/types.js").MarketInterface[]>;
10
+ parseMarket(market: any): Market;
11
+ fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
12
+ parseTicker(ticker: any, market?: Market): Ticker;
13
+ fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
14
+ fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
15
+ parseTrade(trade: any, market?: Market): Trade;
16
+ fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
17
+ parseOHLCV(ohlcv: any, market?: Market): OHLCV;
18
+ fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
19
+ fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
20
+ parseFundingRate(contract: any, market?: Market): {
21
+ info: any;
22
+ symbol: string;
23
+ markPrice: any;
24
+ indexPrice: any;
25
+ interestRate: number;
26
+ estimatedSettlePrice: any;
27
+ timestamp: any;
28
+ datetime: any;
29
+ fundingRate: number;
30
+ fundingTimestamp: number;
31
+ fundingDatetime: string;
32
+ nextFundingRate: number;
33
+ nextFundingTimestamp: number;
34
+ nextFundingDatetime: string;
35
+ previousFundingRate: any;
36
+ previousFundingTimestamp: any;
37
+ previousFundingDatetime: any;
38
+ };
39
+ fetchFundingRate(symbol: string, params?: {}): Promise<{
40
+ info: any;
41
+ symbol: string;
42
+ markPrice: any;
43
+ indexPrice: any;
44
+ interestRate: number;
45
+ estimatedSettlePrice: any;
46
+ timestamp: any;
47
+ datetime: any;
48
+ fundingRate: number;
49
+ fundingTimestamp: number;
50
+ fundingDatetime: string;
51
+ nextFundingRate: number;
52
+ nextFundingTimestamp: number;
53
+ nextFundingDatetime: string;
54
+ previousFundingRate: any;
55
+ previousFundingTimestamp: any;
56
+ previousFundingDatetime: any;
57
+ }>;
58
+ parseBalanceByType(type: any, response: any): Balances;
59
+ parseTradingBalance(response: any): Balances;
60
+ parseFundingBalance(response: any): Balances;
61
+ parseTradingFee(fee: any, market?: Market): {
62
+ info: any;
63
+ symbol: string;
64
+ maker: number;
65
+ taker: number;
66
+ };
67
+ fetchBalance(params?: {}): Promise<Balances>;
68
+ createOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): any;
69
+ parseOrderStatus(status: any): string;
70
+ parseOrder(order: any, market?: Market): Order;
71
+ createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
72
+ createTpslOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount?: number, price?: number, params?: {}): any;
73
+ cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
74
+ createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
75
+ fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
76
+ fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
77
+ fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
78
+ fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
79
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
80
+ parseTransaction(transaction: any, currency?: Currency): Transaction;
81
+ parseTransactionStatus(status: any): string;
82
+ parseLedgerEntryType(type: any): string;
83
+ parseLedgerEntry(item: any, currency?: Currency): {
84
+ id: string;
85
+ info: any;
86
+ timestamp: number;
87
+ datetime: string;
88
+ fromAccount: string;
89
+ toAccount: string;
90
+ type: string;
91
+ currency: string;
92
+ amount: number;
93
+ clientId: string;
94
+ status: string;
95
+ };
96
+ parseIds(ids: any): any;
97
+ cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<Order[]>;
98
+ transfer(code: string, amount: number, fromAccount: any, toAccount: any, params?: {}): Promise<TransferEntry>;
99
+ parseTransfer(transfer: any, currency?: Currency): {
100
+ info: any;
101
+ id: string;
102
+ timestamp: any;
103
+ datetime: any;
104
+ currency: any;
105
+ amount: any;
106
+ fromAccount: any;
107
+ toAccount: any;
108
+ status: any;
109
+ };
110
+ fetchPosition(symbol: string, params?: {}): Promise<Position>;
111
+ fetchPositions(symbols?: string[], params?: {}): Promise<Position[]>;
112
+ parsePosition(position: any, market?: Market): Position;
113
+ fetchLeverage(symbol: string, params?: {}): Promise<any>;
114
+ setLeverage(leverage: any, symbol?: Str, params?: {}): Promise<any>;
115
+ closePosition(symbol: string, side?: OrderSide, params?: {}): Promise<Order>;
116
+ fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
117
+ handleErrors(httpCode: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
118
+ sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
119
+ url: string;
120
+ method: string;
121
+ body: any;
122
+ headers: any;
123
+ };
124
+ }