ccxt 4.2.45 → 4.2.46
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.
- package/CHANGELOG.md +3099 -8415
- package/README.md +4 -4
- package/change.sh +4 -2
- package/dist/ccxt.browser.js +381 -58
- package/dist/ccxt.browser.min.js +7 -7
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/ws/Cache.js +13 -5
- package/dist/cjs/src/base/ws/OrderBook.js +2 -2
- package/dist/cjs/src/binance.js +34 -12
- package/dist/cjs/src/bitfinex2.js +1 -0
- package/dist/cjs/src/bithumb.js +5 -0
- package/dist/cjs/src/btcturk.js +11 -0
- package/dist/cjs/src/coinbase.js +9 -5
- package/dist/cjs/src/coincheck.js +11 -0
- package/dist/cjs/src/coinmate.js +114 -1
- package/dist/cjs/src/coinspot.js +7 -0
- package/dist/cjs/src/cryptocom.js +2 -2
- package/dist/cjs/src/hitbtc.js +2 -0
- package/dist/cjs/src/idex.js +60 -1
- package/dist/cjs/src/latoken.js +3 -0
- package/dist/cjs/src/mercado.js +3 -0
- package/dist/cjs/src/oceanex.js +3 -0
- package/dist/cjs/src/okx.js +1 -0
- package/dist/cjs/src/pro/bitget.js +12 -8
- package/dist/cjs/src/pro/bitmart.js +11 -11
- package/dist/cjs/src/pro/bitmex.js +4 -4
- package/dist/cjs/src/pro/cex.js +2 -2
- package/dist/cjs/src/pro/gemini.js +4 -3
- package/dist/cjs/src/timex.js +65 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bequant.d.ts +2 -0
- package/js/src/abstract/bitcoincom.d.ts +2 -0
- package/js/src/abstract/bithumb.d.ts +5 -0
- package/js/src/abstract/coinmate.d.ts +12 -0
- package/js/src/abstract/fmfwio.d.ts +2 -0
- package/js/src/abstract/hitbtc.d.ts +2 -0
- package/js/src/abstract/hitbtc3.d.ts +2 -0
- package/js/src/abstract/okx.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +9 -7
- package/js/src/base/ws/Cache.d.ts +5 -1
- package/js/src/base/ws/Cache.js +13 -5
- package/js/src/base/ws/OrderBook.d.ts +5 -1
- package/js/src/base/ws/OrderBook.js +3 -3
- package/js/src/binance.d.ts +1 -1
- package/js/src/binance.js +34 -12
- package/js/src/bitfinex2.js +1 -0
- package/js/src/bithumb.js +5 -0
- package/js/src/btcturk.js +11 -0
- package/js/src/coinbase.js +9 -5
- package/js/src/coincheck.js +11 -0
- package/js/src/coinmate.d.ts +3 -1
- package/js/src/coinmate.js +114 -1
- package/js/src/coinspot.js +7 -0
- package/js/src/cryptocom.js +2 -2
- package/js/src/hitbtc.js +2 -0
- package/js/src/idex.d.ts +14 -0
- package/js/src/idex.js +60 -1
- package/js/src/latoken.js +3 -0
- package/js/src/mercado.js +3 -0
- package/js/src/oceanex.js +3 -0
- package/js/src/okx.js +1 -0
- package/js/src/pro/bitget.js +12 -8
- package/js/src/pro/bitmart.js +11 -11
- package/js/src/pro/bitmex.js +4 -4
- package/js/src/pro/cex.js +2 -2
- package/js/src/pro/gemini.js +4 -3
- package/js/src/timex.d.ts +14 -0
- package/js/src/timex.js +65 -0
- package/package.json +1 -1
- package/skip-tests.json +4 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// EDIT THE CORRESPONDENT .ts FILE INSTEAD
|
|
6
6
|
|
|
7
7
|
/* eslint-disable max-classes-per-file */
|
|
8
|
-
// @ts-nocheck
|
|
8
|
+
// @ts-nocheck
|
|
9
9
|
import { iso8601 } from '../../base/functions/time.js';
|
|
10
10
|
import { extend } from '../../base/functions/generic.js';
|
|
11
11
|
import { Asks, Bids, CountedAsks, CountedBids, IndexedAsks, IndexedBids,
|
|
@@ -14,14 +14,14 @@ import { Asks, Bids, CountedAsks, CountedBids, IndexedAsks, IndexedBids,
|
|
|
14
14
|
// IncrementalIndexedAsks,
|
|
15
15
|
// IncrementalIndexedBids, // check this
|
|
16
16
|
} from './OrderBookSide.js';
|
|
17
|
-
// ----------------------------------------------------------------------------
|
|
18
|
-
// overwrites absolute volumes at price levels
|
|
19
17
|
class OrderBook {
|
|
20
18
|
constructor(snapshot = {}, depth = undefined) {
|
|
19
|
+
this.cache = []; // make prop visible so we use typed OrderBooks
|
|
21
20
|
Object.defineProperty(this, 'cache', {
|
|
22
21
|
__proto__: null,
|
|
23
22
|
value: [],
|
|
24
23
|
writable: true,
|
|
24
|
+
enumerable: false,
|
|
25
25
|
});
|
|
26
26
|
depth = depth || Number.MAX_SAFE_INTEGER;
|
|
27
27
|
const defaults = {
|
package/js/src/binance.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export default class binance extends Exchange {
|
|
|
21
21
|
fetchMarkets(params?: {}): Promise<any[]>;
|
|
22
22
|
parseMarket(market: any): Market;
|
|
23
23
|
parseBalanceHelper(entry: any): import("./base/types.js").Account;
|
|
24
|
-
parseBalanceCustom(response: any, type?: any, marginMode?: any): Balances;
|
|
24
|
+
parseBalanceCustom(response: any, type?: any, marginMode?: any, isPortfolioMargin?: boolean): Balances;
|
|
25
25
|
fetchBalance(params?: {}): Promise<Balances>;
|
|
26
26
|
fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
27
27
|
parseTicker(ticker: any, market?: Market): Ticker;
|
package/js/src/binance.js
CHANGED
|
@@ -3161,25 +3161,38 @@ export default class binance extends Exchange {
|
|
|
3161
3161
|
account['debt'] = Precise.stringAdd(debt, interest);
|
|
3162
3162
|
return account;
|
|
3163
3163
|
}
|
|
3164
|
-
parseBalanceCustom(response, type = undefined, marginMode = undefined) {
|
|
3164
|
+
parseBalanceCustom(response, type = undefined, marginMode = undefined, isPortfolioMargin = false) {
|
|
3165
3165
|
const result = {
|
|
3166
3166
|
'info': response,
|
|
3167
3167
|
};
|
|
3168
3168
|
let timestamp = undefined;
|
|
3169
3169
|
const isolated = marginMode === 'isolated';
|
|
3170
3170
|
const cross = (type === 'margin') || (marginMode === 'cross');
|
|
3171
|
-
if (
|
|
3171
|
+
if (isPortfolioMargin) {
|
|
3172
3172
|
for (let i = 0; i < response.length; i++) {
|
|
3173
3173
|
const entry = response[i];
|
|
3174
3174
|
const account = this.account();
|
|
3175
3175
|
const currencyId = this.safeString(entry, 'asset');
|
|
3176
3176
|
const code = this.safeCurrencyCode(currencyId);
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3177
|
+
if (type === 'linear') {
|
|
3178
|
+
account['free'] = this.safeString(entry, 'umWalletBalance');
|
|
3179
|
+
account['used'] = this.safeString(entry, 'umUnrealizedPNL');
|
|
3180
|
+
}
|
|
3181
|
+
else if (type === 'inverse') {
|
|
3182
|
+
account['free'] = this.safeString(entry, 'cmWalletBalance');
|
|
3183
|
+
account['used'] = this.safeString(entry, 'cmUnrealizedPNL');
|
|
3184
|
+
}
|
|
3185
|
+
else if (cross) {
|
|
3186
|
+
const borrowed = this.safeString(entry, 'crossMarginBorrowed');
|
|
3187
|
+
const interest = this.safeString(entry, 'crossMarginInterest');
|
|
3188
|
+
account['debt'] = Precise.stringAdd(borrowed, interest);
|
|
3189
|
+
account['free'] = this.safeString(entry, 'crossMarginFree');
|
|
3190
|
+
account['used'] = this.safeString(entry, 'crossMarginLocked');
|
|
3191
|
+
account['total'] = this.safeString(entry, 'crossMarginAsset');
|
|
3192
|
+
}
|
|
3193
|
+
else {
|
|
3194
|
+
account['total'] = this.safeString(entry, 'totalWalletBalance');
|
|
3195
|
+
}
|
|
3183
3196
|
result[code] = account;
|
|
3184
3197
|
}
|
|
3185
3198
|
}
|
|
@@ -3299,7 +3312,13 @@ export default class binance extends Exchange {
|
|
|
3299
3312
|
let response = undefined;
|
|
3300
3313
|
const request = {};
|
|
3301
3314
|
if (isPortfolioMargin || (type === 'papi')) {
|
|
3302
|
-
type
|
|
3315
|
+
if (this.isLinear(type, subType)) {
|
|
3316
|
+
type = 'linear';
|
|
3317
|
+
}
|
|
3318
|
+
else if (this.isInverse(type, subType)) {
|
|
3319
|
+
type = 'inverse';
|
|
3320
|
+
}
|
|
3321
|
+
isPortfolioMargin = true;
|
|
3303
3322
|
response = await this.papiGetBalance(this.extend(request, query));
|
|
3304
3323
|
}
|
|
3305
3324
|
else if (this.isLinear(type, subType)) {
|
|
@@ -3547,7 +3566,7 @@ export default class binance extends Exchange {
|
|
|
3547
3566
|
// },
|
|
3548
3567
|
// ]
|
|
3549
3568
|
//
|
|
3550
|
-
return this.parseBalanceCustom(response, type, marginMode);
|
|
3569
|
+
return this.parseBalanceCustom(response, type, marginMode, isPortfolioMargin);
|
|
3551
3570
|
}
|
|
3552
3571
|
async fetchOrderBook(symbol, limit = undefined, params = {}) {
|
|
3553
3572
|
/**
|
|
@@ -9830,12 +9849,12 @@ export default class binance extends Exchange {
|
|
|
9830
9849
|
/**
|
|
9831
9850
|
* @method
|
|
9832
9851
|
* @name binance#fetchPositions
|
|
9852
|
+
* @description fetch all open positions
|
|
9833
9853
|
* @see https://binance-docs.github.io/apidocs/futures/en/#position-information-v2-user_data
|
|
9834
9854
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#position-information-user_data
|
|
9835
9855
|
* @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
|
|
9836
9856
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
|
|
9837
9857
|
* @see https://binance-docs.github.io/apidocs/voptions/en/#option-position-information-user_data
|
|
9838
|
-
* @description fetch all open positions
|
|
9839
9858
|
* @param {string[]} [symbols] list of unified market symbols
|
|
9840
9859
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
9841
9860
|
* @param {string} [method] method name to call, "positionRisk", "account" or "option", default is "positionRisk"
|
|
@@ -10059,7 +10078,10 @@ export default class binance extends Exchange {
|
|
|
10059
10078
|
const result = [];
|
|
10060
10079
|
for (let i = 0; i < response.length; i++) {
|
|
10061
10080
|
const parsed = this.parsePositionRisk(response[i]);
|
|
10062
|
-
|
|
10081
|
+
const entryPrice = this.safeString(parsed, 'entryPrice');
|
|
10082
|
+
if ((entryPrice !== '0') && (entryPrice !== '0.0') && (entryPrice !== '0.00000000')) {
|
|
10083
|
+
result.push(parsed);
|
|
10084
|
+
}
|
|
10063
10085
|
}
|
|
10064
10086
|
symbols = this.marketSymbols(symbols);
|
|
10065
10087
|
return this.filterByArrayPositions(result, 'symbol', symbols, false);
|
package/js/src/bitfinex2.js
CHANGED
package/js/src/bithumb.js
CHANGED
|
@@ -91,6 +91,11 @@ export default class bithumb extends Exchange {
|
|
|
91
91
|
'orderbook/ALL_{quoteId}',
|
|
92
92
|
'orderbook/{baseId}_{quoteId}',
|
|
93
93
|
'transaction_history/{baseId}_{quoteId}',
|
|
94
|
+
'network-info',
|
|
95
|
+
'assetsstatus/multichain/ALL',
|
|
96
|
+
'assetsstatus/multichain/{currency}',
|
|
97
|
+
'withdraw/minimum/ALL',
|
|
98
|
+
'withdraw/minimum/{currency}',
|
|
94
99
|
'assetsstatus/ALL',
|
|
95
100
|
'assetsstatus/{baseId}',
|
|
96
101
|
'candlestick/{baseId}_{quoteId}/{interval}',
|
package/js/src/btcturk.js
CHANGED
|
@@ -147,6 +147,7 @@ export default class btcturk extends Exchange {
|
|
|
147
147
|
* @method
|
|
148
148
|
* @name btcturk#fetchMarkets
|
|
149
149
|
* @description retrieves data on all markets for btcturk
|
|
150
|
+
* @see https://docs.btcturk.com/public-endpoints/exchange-info
|
|
150
151
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
151
152
|
* @returns {object[]} an array of objects representing market data
|
|
152
153
|
*/
|
|
@@ -296,6 +297,7 @@ export default class btcturk extends Exchange {
|
|
|
296
297
|
* @method
|
|
297
298
|
* @name btcturk#fetchBalance
|
|
298
299
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
300
|
+
* @see https://docs.btcturk.com/private-endpoints/account-balance
|
|
299
301
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
300
302
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
301
303
|
*/
|
|
@@ -324,6 +326,7 @@ export default class btcturk extends Exchange {
|
|
|
324
326
|
* @method
|
|
325
327
|
* @name btcturk#fetchOrderBook
|
|
326
328
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
329
|
+
* @see https://docs.btcturk.com/public-endpoints/orderbook
|
|
327
330
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
328
331
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
329
332
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -404,6 +407,7 @@ export default class btcturk extends Exchange {
|
|
|
404
407
|
* @method
|
|
405
408
|
* @name btcturk#fetchTickers
|
|
406
409
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
410
|
+
* @see https://docs.btcturk.com/public-endpoints/ticker
|
|
407
411
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
408
412
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
409
413
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -418,6 +422,7 @@ export default class btcturk extends Exchange {
|
|
|
418
422
|
* @method
|
|
419
423
|
* @name btcturk#fetchTicker
|
|
420
424
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
425
|
+
* @see https://docs.btcturk.com/public-endpoints/ticker
|
|
421
426
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
422
427
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
423
428
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -493,6 +498,7 @@ export default class btcturk extends Exchange {
|
|
|
493
498
|
* @method
|
|
494
499
|
* @name btcturk#fetchTrades
|
|
495
500
|
* @description get the list of most recent trades for a particular symbol
|
|
501
|
+
* @see https://docs.btcturk.com/public-endpoints/trades
|
|
496
502
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
497
503
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
498
504
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -656,6 +662,7 @@ export default class btcturk extends Exchange {
|
|
|
656
662
|
* @method
|
|
657
663
|
* @name btcturk#createOrder
|
|
658
664
|
* @description create a trade order
|
|
665
|
+
* @see https://docs.btcturk.com/private-endpoints/submit-order
|
|
659
666
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
660
667
|
* @param {string} type 'market' or 'limit'
|
|
661
668
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -690,6 +697,7 @@ export default class btcturk extends Exchange {
|
|
|
690
697
|
* @method
|
|
691
698
|
* @name btcturk#cancelOrder
|
|
692
699
|
* @description cancels an open order
|
|
700
|
+
* @see https://docs.btcturk.com/private-endpoints/cancel-order
|
|
693
701
|
* @param {string} id order id
|
|
694
702
|
* @param {string} symbol not used by btcturk cancelOrder ()
|
|
695
703
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -705,6 +713,7 @@ export default class btcturk extends Exchange {
|
|
|
705
713
|
* @method
|
|
706
714
|
* @name btcturk#fetchOpenOrders
|
|
707
715
|
* @description fetch all unfilled currently open orders
|
|
716
|
+
* @see https://docs.btcturk.com/private-endpoints/open-orders
|
|
708
717
|
* @param {string} symbol unified market symbol
|
|
709
718
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
710
719
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -729,6 +738,7 @@ export default class btcturk extends Exchange {
|
|
|
729
738
|
* @method
|
|
730
739
|
* @name btcturk#fetchOrders
|
|
731
740
|
* @description fetches information on multiple orders made by the user
|
|
741
|
+
* @see https://docs.btcturk.com/private-endpoints/all-orders
|
|
732
742
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
733
743
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
734
744
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -851,6 +861,7 @@ export default class btcturk extends Exchange {
|
|
|
851
861
|
* @method
|
|
852
862
|
* @name btcturk#fetchMyTrades
|
|
853
863
|
* @description fetch all trades made by the user
|
|
864
|
+
* @see https://docs.btcturk.com/private-endpoints/user-transactions
|
|
854
865
|
* @param {string} symbol unified market symbol
|
|
855
866
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
856
867
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
package/js/src/coinbase.js
CHANGED
|
@@ -65,6 +65,8 @@ export default class coinbase extends Exchange {
|
|
|
65
65
|
'fetchCrossBorrowRate': false,
|
|
66
66
|
'fetchCrossBorrowRates': false,
|
|
67
67
|
'fetchCurrencies': true,
|
|
68
|
+
'fetchDepositAddress': 'emulated',
|
|
69
|
+
'fetchDepositAddresses': false,
|
|
68
70
|
'fetchDepositAddressesByNetwork': true,
|
|
69
71
|
'fetchDeposits': true,
|
|
70
72
|
'fetchFundingHistory': false,
|
|
@@ -1743,17 +1745,18 @@ export default class coinbase extends Exchange {
|
|
|
1743
1745
|
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-accounts#list-accounts
|
|
1744
1746
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1745
1747
|
* @param {boolean} [params.v3] default false, set true to use v3 api endpoint
|
|
1748
|
+
* @param {object} [params.type] "spot" (default) or "swap"
|
|
1746
1749
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
1747
1750
|
*/
|
|
1748
1751
|
await this.loadMarkets();
|
|
1749
|
-
const request = {
|
|
1750
|
-
'limit': 250,
|
|
1751
|
-
};
|
|
1752
|
+
const request = {};
|
|
1752
1753
|
let response = undefined;
|
|
1753
1754
|
const isV3 = this.safeBool(params, 'v3', false);
|
|
1754
|
-
|
|
1755
|
+
const type = this.safeString(params, 'type');
|
|
1756
|
+
params = this.omit(params, ['v3', 'type']);
|
|
1755
1757
|
const method = this.safeString(this.options, 'fetchBalance', 'v3PrivateGetBrokerageAccounts');
|
|
1756
1758
|
if ((isV3) || (method === 'v3PrivateGetBrokerageAccounts')) {
|
|
1759
|
+
request['limit'] = 250;
|
|
1757
1760
|
response = await this.v3PrivateGetBrokerageAccounts(this.extend(request, params));
|
|
1758
1761
|
}
|
|
1759
1762
|
else {
|
|
@@ -1830,6 +1833,7 @@ export default class coinbase extends Exchange {
|
|
|
1830
1833
|
// "size": 9
|
|
1831
1834
|
// }
|
|
1832
1835
|
//
|
|
1836
|
+
params['type'] = type;
|
|
1833
1837
|
return this.parseCustomBalance(response, params);
|
|
1834
1838
|
}
|
|
1835
1839
|
async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -3404,7 +3408,7 @@ export default class coinbase extends Exchange {
|
|
|
3404
3408
|
async fetchDepositAddressesByNetwork(code, params = {}) {
|
|
3405
3409
|
/**
|
|
3406
3410
|
* @method
|
|
3407
|
-
* @name
|
|
3411
|
+
* @name coinbase#fetchDepositAddress
|
|
3408
3412
|
* @description fetch the deposit address for a currency associated with this account
|
|
3409
3413
|
* @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postcoinbaseaccountaddresses
|
|
3410
3414
|
* @param {string} code unified currency code
|
package/js/src/coincheck.js
CHANGED
|
@@ -192,6 +192,7 @@ export default class coincheck extends Exchange {
|
|
|
192
192
|
* @method
|
|
193
193
|
* @name coincheck#fetchBalance
|
|
194
194
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
195
|
+
* @see https://coincheck.com/documents/exchange/api#order-transactions-pagination
|
|
195
196
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
196
197
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
197
198
|
*/
|
|
@@ -204,6 +205,7 @@ export default class coincheck extends Exchange {
|
|
|
204
205
|
* @method
|
|
205
206
|
* @name coincheck#fetchOpenOrders
|
|
206
207
|
* @description fetch all unfilled currently open orders
|
|
208
|
+
* @see https://coincheck.com/documents/exchange/api#order-opens
|
|
207
209
|
* @param {string} symbol unified market symbol
|
|
208
210
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
209
211
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -279,6 +281,7 @@ export default class coincheck extends Exchange {
|
|
|
279
281
|
* @method
|
|
280
282
|
* @name coincheck#fetchOrderBook
|
|
281
283
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
284
|
+
* @see https://coincheck.com/documents/exchange/api#order-book
|
|
282
285
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
283
286
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
284
287
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -335,6 +338,7 @@ export default class coincheck extends Exchange {
|
|
|
335
338
|
* @method
|
|
336
339
|
* @name coincheck#fetchTicker
|
|
337
340
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
341
|
+
* @see https://coincheck.com/documents/exchange/api#ticker
|
|
338
342
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
339
343
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
340
344
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -448,6 +452,7 @@ export default class coincheck extends Exchange {
|
|
|
448
452
|
* @method
|
|
449
453
|
* @name coincheck#fetchMyTrades
|
|
450
454
|
* @description fetch all trades made by the user
|
|
455
|
+
* @see https://coincheck.com/documents/exchange/api#order-transactions-pagination
|
|
451
456
|
* @param {string} symbol unified market symbol
|
|
452
457
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
453
458
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
@@ -491,6 +496,7 @@ export default class coincheck extends Exchange {
|
|
|
491
496
|
* @method
|
|
492
497
|
* @name coincheck#fetchTrades
|
|
493
498
|
* @description get the list of most recent trades for a particular symbol
|
|
499
|
+
* @see https://coincheck.com/documents/exchange/api#public-trades
|
|
494
500
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
495
501
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
496
502
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -524,6 +530,7 @@ export default class coincheck extends Exchange {
|
|
|
524
530
|
* @method
|
|
525
531
|
* @name coincheck#fetchTradingFees
|
|
526
532
|
* @description fetch the trading fees for multiple markets
|
|
533
|
+
* @see https://coincheck.com/documents/exchange/api#account-info
|
|
527
534
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
528
535
|
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
|
|
529
536
|
*/
|
|
@@ -570,6 +577,7 @@ export default class coincheck extends Exchange {
|
|
|
570
577
|
* @method
|
|
571
578
|
* @name coincheck#createOrder
|
|
572
579
|
* @description create a trade order
|
|
580
|
+
* @see https://coincheck.com/documents/exchange/api#order-new
|
|
573
581
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
574
582
|
* @param {string} type 'market' or 'limit'
|
|
575
583
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -606,6 +614,7 @@ export default class coincheck extends Exchange {
|
|
|
606
614
|
* @method
|
|
607
615
|
* @name coincheck#cancelOrder
|
|
608
616
|
* @description cancels an open order
|
|
617
|
+
* @see https://coincheck.com/documents/exchange/api#order-cancel
|
|
609
618
|
* @param {string} id order id
|
|
610
619
|
* @param {string} symbol not used by coincheck cancelOrder ()
|
|
611
620
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -621,6 +630,7 @@ export default class coincheck extends Exchange {
|
|
|
621
630
|
* @method
|
|
622
631
|
* @name coincheck#fetchDeposits
|
|
623
632
|
* @description fetch all deposits made to an account
|
|
633
|
+
* @see https://coincheck.com/documents/exchange/api#account-deposits
|
|
624
634
|
* @param {string} code unified currency code
|
|
625
635
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
626
636
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
@@ -669,6 +679,7 @@ export default class coincheck extends Exchange {
|
|
|
669
679
|
* @method
|
|
670
680
|
* @name coincheck#fetchWithdrawals
|
|
671
681
|
* @description fetch all withdrawals made from an account
|
|
682
|
+
* @see https://coincheck.com/documents/exchange/api#withdraws
|
|
672
683
|
* @param {string} code unified currency code
|
|
673
684
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
674
685
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
package/js/src/coinmate.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/coinmate.js';
|
|
2
|
-
import type { Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, Transaction } from './base/types.js';
|
|
2
|
+
import type { Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class coinmate
|
|
5
5
|
* @augments Exchange
|
|
@@ -11,6 +11,8 @@ export default class coinmate extends Exchange {
|
|
|
11
11
|
fetchBalance(params?: {}): Promise<Balances>;
|
|
12
12
|
fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
13
13
|
fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
14
|
+
fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
15
|
+
parseTicker(ticker: any, market?: Market): Ticker;
|
|
14
16
|
fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
15
17
|
parseTransactionStatus(status: any): string;
|
|
16
18
|
parseTransaction(transaction: any, currency?: Currency): Transaction;
|
package/js/src/coinmate.js
CHANGED
|
@@ -65,6 +65,7 @@ export default class coinmate extends Exchange {
|
|
|
65
65
|
'fetchPositionsRisk': false,
|
|
66
66
|
'fetchPremiumIndexOHLCV': false,
|
|
67
67
|
'fetchTicker': true,
|
|
68
|
+
'fetchTickers': true,
|
|
68
69
|
'fetchTrades': true,
|
|
69
70
|
'fetchTradingFee': true,
|
|
70
71
|
'fetchTradingFees': false,
|
|
@@ -99,6 +100,8 @@ export default class coinmate extends Exchange {
|
|
|
99
100
|
'get': [
|
|
100
101
|
'orderBook',
|
|
101
102
|
'ticker',
|
|
103
|
+
'tickerAll',
|
|
104
|
+
'products',
|
|
102
105
|
'transactions',
|
|
103
106
|
'tradingPairs',
|
|
104
107
|
],
|
|
@@ -147,6 +150,16 @@ export default class coinmate extends Exchange {
|
|
|
147
150
|
'unconfirmedEthereumDeposits',
|
|
148
151
|
'unconfirmedLitecoinDeposits',
|
|
149
152
|
'unconfirmedRippleDeposits',
|
|
153
|
+
'cancelAllOpenOrders',
|
|
154
|
+
'withdrawVirtualCurrency',
|
|
155
|
+
'virtualCurrencyDepositAddresses',
|
|
156
|
+
'unconfirmedVirtualCurrencyDeposits',
|
|
157
|
+
'adaWithdrawal',
|
|
158
|
+
'adaDepositAddresses',
|
|
159
|
+
'unconfirmedAdaDeposits',
|
|
160
|
+
'solWithdrawal',
|
|
161
|
+
'solDepositAddresses',
|
|
162
|
+
'unconfirmedSolDeposits',
|
|
150
163
|
],
|
|
151
164
|
},
|
|
152
165
|
},
|
|
@@ -191,6 +204,8 @@ export default class coinmate extends Exchange {
|
|
|
191
204
|
'XRP': 'privatePostRippleWithdrawal',
|
|
192
205
|
'DASH': 'privatePostDashWithdrawal',
|
|
193
206
|
'DAI': 'privatePostDaiWithdrawal',
|
|
207
|
+
'ADA': 'privatePostAdaWithdrawal',
|
|
208
|
+
'SOL': 'privatePostSolWithdrawal',
|
|
194
209
|
},
|
|
195
210
|
},
|
|
196
211
|
},
|
|
@@ -215,6 +230,7 @@ export default class coinmate extends Exchange {
|
|
|
215
230
|
* @method
|
|
216
231
|
* @name coinmate#fetchMarkets
|
|
217
232
|
* @description retrieves data on all markets for coinmate
|
|
233
|
+
* @see https://coinmate.docs.apiary.io/#reference/trading-pairs/get-trading-pairs/get
|
|
218
234
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
219
235
|
* @returns {object[]} an array of objects representing market data
|
|
220
236
|
*/
|
|
@@ -321,6 +337,7 @@ export default class coinmate extends Exchange {
|
|
|
321
337
|
* @method
|
|
322
338
|
* @name coinmate#fetchBalance
|
|
323
339
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
340
|
+
* @see https://coinmate.docs.apiary.io/#reference/balance/get-balances/post
|
|
324
341
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
325
342
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
326
343
|
*/
|
|
@@ -333,6 +350,7 @@ export default class coinmate extends Exchange {
|
|
|
333
350
|
* @method
|
|
334
351
|
* @name coinmate#fetchOrderBook
|
|
335
352
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
353
|
+
* @see https://coinmate.docs.apiary.io/#reference/order-book/get-order-book/get
|
|
336
354
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
337
355
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
338
356
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -354,6 +372,7 @@ export default class coinmate extends Exchange {
|
|
|
354
372
|
* @method
|
|
355
373
|
* @name coinmate#fetchTicker
|
|
356
374
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
375
|
+
* @see https://coinmate.docs.apiary.io/#reference/ticker/get-ticker/get
|
|
357
376
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
358
377
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
359
378
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -364,7 +383,82 @@ export default class coinmate extends Exchange {
|
|
|
364
383
|
'currencyPair': market['id'],
|
|
365
384
|
};
|
|
366
385
|
const response = await this.publicGetTicker(this.extend(request, params));
|
|
367
|
-
|
|
386
|
+
//
|
|
387
|
+
// {
|
|
388
|
+
// "error": false,
|
|
389
|
+
// "errorMessage": null,
|
|
390
|
+
// "data": {
|
|
391
|
+
// "last": 0.55105,
|
|
392
|
+
// "high": 0.56439,
|
|
393
|
+
// "low": 0.54358,
|
|
394
|
+
// "amount": 37038.993381,
|
|
395
|
+
// "bid": 0.54595,
|
|
396
|
+
// "ask": 0.55324,
|
|
397
|
+
// "change": 3.03659243,
|
|
398
|
+
// "open": 0.53481,
|
|
399
|
+
// "timestamp": 1708074779
|
|
400
|
+
// }
|
|
401
|
+
// }
|
|
402
|
+
//
|
|
403
|
+
const data = this.safeValue(response, 'data');
|
|
404
|
+
return this.parseTicker(data, market);
|
|
405
|
+
}
|
|
406
|
+
async fetchTickers(symbols = undefined, params = {}) {
|
|
407
|
+
/**
|
|
408
|
+
* @method
|
|
409
|
+
* @name coinmate#fetchTickers
|
|
410
|
+
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
411
|
+
* @see https://coinmate.docs.apiary.io/#reference/ticker/get-ticker-all/get
|
|
412
|
+
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
413
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
414
|
+
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
415
|
+
*/
|
|
416
|
+
await this.loadMarkets();
|
|
417
|
+
symbols = this.marketSymbols(symbols);
|
|
418
|
+
const response = await this.publicGetTickerAll(params);
|
|
419
|
+
//
|
|
420
|
+
// {
|
|
421
|
+
// "error": false,
|
|
422
|
+
// "errorMessage": null,
|
|
423
|
+
// "data": {
|
|
424
|
+
// "LTC_BTC": {
|
|
425
|
+
// "last": "0.001337",
|
|
426
|
+
// "high": "0.001348",
|
|
427
|
+
// "low": "0.001332",
|
|
428
|
+
// "amount": "34.75472959",
|
|
429
|
+
// "bid": "0.001348",
|
|
430
|
+
// "ask": "0.001356",
|
|
431
|
+
// "change": "-0.74239050",
|
|
432
|
+
// "open": "0.001347",
|
|
433
|
+
// "timestamp": "1708074485"
|
|
434
|
+
// }
|
|
435
|
+
// }
|
|
436
|
+
// }
|
|
437
|
+
//
|
|
438
|
+
const data = this.safeValue(response, 'data', {});
|
|
439
|
+
const keys = Object.keys(data);
|
|
440
|
+
const result = {};
|
|
441
|
+
for (let i = 0; i < keys.length; i++) {
|
|
442
|
+
const market = this.market(keys[i]);
|
|
443
|
+
const ticker = this.parseTicker(this.safeValue(data, keys[i]), market);
|
|
444
|
+
result[market['symbol']] = ticker;
|
|
445
|
+
}
|
|
446
|
+
return this.filterByArrayTickers(result, 'symbol', symbols);
|
|
447
|
+
}
|
|
448
|
+
parseTicker(ticker, market = undefined) {
|
|
449
|
+
//
|
|
450
|
+
// {
|
|
451
|
+
// "last": "0.001337",
|
|
452
|
+
// "high": "0.001348",
|
|
453
|
+
// "low": "0.001332",
|
|
454
|
+
// "amount": "34.75472959",
|
|
455
|
+
// "bid": "0.001348",
|
|
456
|
+
// "ask": "0.001356",
|
|
457
|
+
// "change": "-0.74239050",
|
|
458
|
+
// "open": "0.001347",
|
|
459
|
+
// "timestamp": "1708074485"
|
|
460
|
+
// }
|
|
461
|
+
//
|
|
368
462
|
const timestamp = this.safeTimestamp(ticker, 'timestamp');
|
|
369
463
|
const last = this.safeNumber(ticker, 'last');
|
|
370
464
|
return this.safeTicker({
|
|
@@ -395,6 +489,7 @@ export default class coinmate extends Exchange {
|
|
|
395
489
|
* @method
|
|
396
490
|
* @name coinmate#fetchDepositsWithdrawals
|
|
397
491
|
* @description fetch history of deposits and withdrawals
|
|
492
|
+
* @see https://coinmate.docs.apiary.io/#reference/transfers/get-transfer-history/post
|
|
398
493
|
* @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
|
|
399
494
|
* @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
|
|
400
495
|
* @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
|
|
@@ -507,6 +602,12 @@ export default class coinmate extends Exchange {
|
|
|
507
602
|
* @method
|
|
508
603
|
* @name coinmate#withdraw
|
|
509
604
|
* @description make a withdrawal
|
|
605
|
+
* @see https://coinmate.docs.apiary.io/#reference/bitcoin-withdrawal-and-deposit/withdraw-bitcoins/post
|
|
606
|
+
* @see https://coinmate.docs.apiary.io/#reference/litecoin-withdrawal-and-deposit/withdraw-litecoins/post
|
|
607
|
+
* @see https://coinmate.docs.apiary.io/#reference/ethereum-withdrawal-and-deposit/withdraw-ethereum/post
|
|
608
|
+
* @see https://coinmate.docs.apiary.io/#reference/ripple-withdrawal-and-deposit/withdraw-ripple/post
|
|
609
|
+
* @see https://coinmate.docs.apiary.io/#reference/cardano-withdrawal-and-deposit/withdraw-cardano/post
|
|
610
|
+
* @see https://coinmate.docs.apiary.io/#reference/solana-withdrawal-and-deposit/withdraw-solana/post
|
|
510
611
|
* @param {string} code unified currency code
|
|
511
612
|
* @param {float} amount the amount to withdraw
|
|
512
613
|
* @param {string} address the address to withdraw to
|
|
@@ -560,6 +661,7 @@ export default class coinmate extends Exchange {
|
|
|
560
661
|
* @method
|
|
561
662
|
* @name coinmate#fetchMyTrades
|
|
562
663
|
* @description fetch all trades made by the user
|
|
664
|
+
* @see https://coinmate.docs.apiary.io/#reference/trade-history/get-trade-history/post
|
|
563
665
|
* @param {string} symbol unified market symbol
|
|
564
666
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
565
667
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
@@ -652,6 +754,7 @@ export default class coinmate extends Exchange {
|
|
|
652
754
|
* @method
|
|
653
755
|
* @name coinmate#fetchTrades
|
|
654
756
|
* @description get the list of most recent trades for a particular symbol
|
|
757
|
+
* @see https://coinmate.docs.apiary.io/#reference/transactions/transactions/get
|
|
655
758
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
656
759
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
657
760
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -689,6 +792,7 @@ export default class coinmate extends Exchange {
|
|
|
689
792
|
* @method
|
|
690
793
|
* @name coinmate#fetchTradingFee
|
|
691
794
|
* @description fetch the trading fees for a market
|
|
795
|
+
* @see https://coinmate.docs.apiary.io/#reference/trader-fees/get-trading-fees/post
|
|
692
796
|
* @param {string} symbol unified market symbol
|
|
693
797
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
694
798
|
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
@@ -725,6 +829,7 @@ export default class coinmate extends Exchange {
|
|
|
725
829
|
* @method
|
|
726
830
|
* @name coinmate#fetchOpenOrders
|
|
727
831
|
* @description fetch all unfilled currently open orders
|
|
832
|
+
* @see https://coinmate.docs.apiary.io/#reference/order/get-open-orders/post
|
|
728
833
|
* @param {string} symbol unified market symbol
|
|
729
834
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
730
835
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -740,6 +845,7 @@ export default class coinmate extends Exchange {
|
|
|
740
845
|
* @method
|
|
741
846
|
* @name coinmate#fetchOrders
|
|
742
847
|
* @description fetches information on multiple orders made by the user
|
|
848
|
+
* @see https://coinmate.docs.apiary.io/#reference/order/order-history/post
|
|
743
849
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
744
850
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
745
851
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -863,6 +969,10 @@ export default class coinmate extends Exchange {
|
|
|
863
969
|
* @method
|
|
864
970
|
* @name coinmate#createOrder
|
|
865
971
|
* @description create a trade order
|
|
972
|
+
* @see https://coinmate.docs.apiary.io/#reference/order/buy-limit-order/post
|
|
973
|
+
* @see https://coinmate.docs.apiary.io/#reference/order/sell-limit-order/post
|
|
974
|
+
* @see https://coinmate.docs.apiary.io/#reference/order/buy-instant-order/post
|
|
975
|
+
* @see https://coinmate.docs.apiary.io/#reference/order/sell-instant-order/post
|
|
866
976
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
867
977
|
* @param {string} type 'market' or 'limit'
|
|
868
978
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -903,6 +1013,8 @@ export default class coinmate extends Exchange {
|
|
|
903
1013
|
* @method
|
|
904
1014
|
* @name coinmate#fetchOrder
|
|
905
1015
|
* @description fetches information on an order made by the user
|
|
1016
|
+
* @see https://coinmate.docs.apiary.io/#reference/order/get-order-by-orderid/post
|
|
1017
|
+
* @see https://coinmate.docs.apiary.io/#reference/order/get-order-by-clientorderid/post
|
|
906
1018
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
907
1019
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
908
1020
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
@@ -924,6 +1036,7 @@ export default class coinmate extends Exchange {
|
|
|
924
1036
|
* @method
|
|
925
1037
|
* @name coinmate#cancelOrder
|
|
926
1038
|
* @description cancels an open order
|
|
1039
|
+
* @see https://coinmate.docs.apiary.io/#reference/order/cancel-order/post
|
|
927
1040
|
* @param {string} id order id
|
|
928
1041
|
* @param {string} symbol not used by coinmate cancelOrder ()
|
|
929
1042
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|