ccxt 4.1.4 → 4.1.5
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/README.md +3 -3
- package/dist/ccxt.browser.js +126 -27
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/coinex.js +1 -1
- package/dist/cjs/src/coinsph.js +1 -2
- package/dist/cjs/src/kraken.js +1 -5
- package/dist/cjs/src/kuna.js +97 -10
- package/dist/cjs/src/pro/bitget.js +22 -6
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/kuna.d.ts +34 -0
- package/js/src/coinex.js +1 -1
- package/js/src/coinsph.js +1 -2
- package/js/src/kraken.d.ts +1 -1
- package/js/src/kraken.js +1 -5
- package/js/src/kuna.d.ts +1 -0
- package/js/src/kuna.js +97 -10
- package/js/src/pro/bitget.d.ts +5 -0
- package/js/src/pro/bitget.js +22 -6
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -179,7 +179,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
179
179
|
|
|
180
180
|
//-----------------------------------------------------------------------------
|
|
181
181
|
// this is updated by vss.js when building
|
|
182
|
-
const version = '4.1.
|
|
182
|
+
const version = '4.1.5';
|
|
183
183
|
Exchange["default"].ccxtVersion = version;
|
|
184
184
|
const exchanges = {
|
|
185
185
|
'ace': ace,
|
package/dist/cjs/src/coinex.js
CHANGED
package/dist/cjs/src/coinsph.js
CHANGED
|
@@ -540,7 +540,6 @@ class coinsph extends coinsph$1 {
|
|
|
540
540
|
const quoteId = this.safeString(market, 'quoteAsset');
|
|
541
541
|
const base = this.safeCurrencyCode(baseId);
|
|
542
542
|
const quote = this.safeCurrencyCode(quoteId);
|
|
543
|
-
const isActive = this.safeString(market, 'status') === 'TRADING';
|
|
544
543
|
const limits = this.indexBy(this.safeValue(market, 'filters'), 'filterType');
|
|
545
544
|
const amountLimits = this.safeValue(limits, 'LOT_SIZE', {});
|
|
546
545
|
const priceLimits = this.safeValue(limits, 'PRICE_FILTER', {});
|
|
@@ -560,7 +559,7 @@ class coinsph extends coinsph$1 {
|
|
|
560
559
|
'swap': false,
|
|
561
560
|
'future': false,
|
|
562
561
|
'option': false,
|
|
563
|
-
'active':
|
|
562
|
+
'active': this.safeStringLower(market, 'status') === 'trading',
|
|
564
563
|
'contract': false,
|
|
565
564
|
'linear': undefined,
|
|
566
565
|
'inverse': undefined,
|
package/dist/cjs/src/kraken.js
CHANGED
|
@@ -936,11 +936,7 @@ class kraken extends kraken$1 {
|
|
|
936
936
|
else {
|
|
937
937
|
direction = 'in';
|
|
938
938
|
}
|
|
939
|
-
const
|
|
940
|
-
let timestamp = undefined;
|
|
941
|
-
if (time !== undefined) {
|
|
942
|
-
timestamp = this.parseToInt(time * 1000);
|
|
943
|
-
}
|
|
939
|
+
const timestamp = this.safeIntegerProduct(item, 'time', 1000);
|
|
944
940
|
return {
|
|
945
941
|
'info': item,
|
|
946
942
|
'id': id,
|
package/dist/cjs/src/kuna.js
CHANGED
|
@@ -4,12 +4,14 @@ var kuna$1 = require('./abstract/kuna.js');
|
|
|
4
4
|
var errors = require('./base/errors.js');
|
|
5
5
|
var number = require('./base/functions/number.js');
|
|
6
6
|
var sha256 = require('./static_dependencies/noble-hashes/sha256.js');
|
|
7
|
+
var sha512 = require('./static_dependencies/noble-hashes/sha512.js');
|
|
7
8
|
|
|
8
9
|
// ---------------------------------------------------------------------------
|
|
9
10
|
// ---------------------------------------------------------------------------
|
|
10
11
|
/**
|
|
11
12
|
* @class kuna
|
|
12
13
|
* @extends Exchange
|
|
14
|
+
* @description Use the public-key as your apiKey
|
|
13
15
|
*/
|
|
14
16
|
class kuna extends kuna$1 {
|
|
15
17
|
describe() {
|
|
@@ -67,6 +69,7 @@ class kuna extends kuna$1 {
|
|
|
67
69
|
'api': {
|
|
68
70
|
'xreserve': 'https://api.xreserve.fund',
|
|
69
71
|
'v3': 'https://api.kuna.io',
|
|
72
|
+
'v4': 'https://api.kuna.io',
|
|
70
73
|
'public': 'https://kuna.io',
|
|
71
74
|
'private': 'https://kuna.io', // v2
|
|
72
75
|
},
|
|
@@ -85,6 +88,54 @@ class kuna extends kuna$1 {
|
|
|
85
88
|
'delegate-transfer': 1,
|
|
86
89
|
},
|
|
87
90
|
},
|
|
91
|
+
'v4': {
|
|
92
|
+
'private': {
|
|
93
|
+
'get': {
|
|
94
|
+
'me': 1,
|
|
95
|
+
'getBalance': 1,
|
|
96
|
+
'active': 1,
|
|
97
|
+
'order/history': 1,
|
|
98
|
+
'order/private/{id}/trades': 1,
|
|
99
|
+
'order/details/{id}?withTrades={withTrades}': 1,
|
|
100
|
+
'trade/history': 1,
|
|
101
|
+
'transaction/{hash}': 1,
|
|
102
|
+
'deposit/preRequest': 1,
|
|
103
|
+
'deposit/crypto/address': 1,
|
|
104
|
+
'deposit/crypto/getMerchantAddress': 1,
|
|
105
|
+
'deposit/history': 1,
|
|
106
|
+
'deposit/details/{depositId}': 1,
|
|
107
|
+
'withdraw/preRequest': 1,
|
|
108
|
+
'withdraw/history': 1,
|
|
109
|
+
'withdraw/details/{withdrawId}': 1,
|
|
110
|
+
'kuna-code/{id}': 1,
|
|
111
|
+
'kuna-code/{code}/check': 1,
|
|
112
|
+
'kuna-code/issued-by-me': 1,
|
|
113
|
+
'kuna-code/redeemed-by-me': 1,
|
|
114
|
+
},
|
|
115
|
+
'post': {
|
|
116
|
+
'order/create': 1,
|
|
117
|
+
'order/cancel': 1,
|
|
118
|
+
'order/cancel/multi': 1,
|
|
119
|
+
'deposit/crypto/generateAddress': 1,
|
|
120
|
+
'deposit/crypto/generateMerchantAddress': 1,
|
|
121
|
+
'withdraw/create': 1,
|
|
122
|
+
'kuna-code': 1,
|
|
123
|
+
},
|
|
124
|
+
'put': {
|
|
125
|
+
'kuna-code/redeem': 1,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
'public': {
|
|
129
|
+
'get': {
|
|
130
|
+
'timestamp': 1,
|
|
131
|
+
'fees': 1,
|
|
132
|
+
'currencies?type={type}': 1,
|
|
133
|
+
'markets/getAll': 1,
|
|
134
|
+
'markets/tickers?pairs={pairs}': 1,
|
|
135
|
+
'order/book/{pairs}': 1,
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
},
|
|
88
139
|
'v3': {
|
|
89
140
|
'public': {
|
|
90
141
|
'get': {
|
|
@@ -292,6 +343,9 @@ class kuna extends kuna$1 {
|
|
|
292
343
|
'2002': errors.InsufficientFunds,
|
|
293
344
|
'2003': errors.OrderNotFound,
|
|
294
345
|
},
|
|
346
|
+
'options': {
|
|
347
|
+
// 'account': 'pro' // Only for pro accounts
|
|
348
|
+
},
|
|
295
349
|
});
|
|
296
350
|
}
|
|
297
351
|
async fetchTime(params = {}) {
|
|
@@ -848,20 +902,53 @@ class kuna extends kuna$1 {
|
|
|
848
902
|
let url = undefined;
|
|
849
903
|
if (Array.isArray(api)) {
|
|
850
904
|
const [version, access] = api;
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
if (
|
|
854
|
-
if (
|
|
855
|
-
|
|
905
|
+
if (version === 'v3') {
|
|
906
|
+
url = this.urls['api'][version] + '/' + version + '/' + this.implodeParams(path, params);
|
|
907
|
+
if (access === 'public') {
|
|
908
|
+
if (method === 'GET') {
|
|
909
|
+
if (Object.keys(params).length) {
|
|
910
|
+
url += '?' + this.urlencode(params);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
else if ((method === 'POST') || (method === 'PUT')) {
|
|
914
|
+
headers = { 'Content-Type': 'application/json' };
|
|
915
|
+
body = this.json(params);
|
|
856
916
|
}
|
|
857
917
|
}
|
|
858
|
-
else if (
|
|
859
|
-
|
|
860
|
-
body = this.json(params);
|
|
918
|
+
else if (access === 'private') {
|
|
919
|
+
throw new errors.NotSupported(this.id + ' private v3 API is not supported yet');
|
|
861
920
|
}
|
|
862
921
|
}
|
|
863
|
-
else if (
|
|
864
|
-
|
|
922
|
+
else if (version === 'v4') {
|
|
923
|
+
const splitPath = path.split('/');
|
|
924
|
+
const splitPathLength = splitPath.length;
|
|
925
|
+
let urlPath = '';
|
|
926
|
+
if ((splitPathLength > 1) && (splitPath[0] !== 'kuna-code')) {
|
|
927
|
+
let pathTail = '';
|
|
928
|
+
for (let i = 1; i < splitPathLength; i++) {
|
|
929
|
+
pathTail += splitPath[i];
|
|
930
|
+
}
|
|
931
|
+
urlPath = '/' + version + '/' + splitPath[0] + '/' + access + '/' + this.implodeParams(pathTail, params);
|
|
932
|
+
}
|
|
933
|
+
else {
|
|
934
|
+
urlPath = '/' + version + '/' + access + '/' + this.implodeParams(path, params);
|
|
935
|
+
}
|
|
936
|
+
url = this.urls['api'][version] + urlPath;
|
|
937
|
+
if (access === 'private') {
|
|
938
|
+
const nonce = this.nonce();
|
|
939
|
+
const auth = urlPath + nonce + this.json(params);
|
|
940
|
+
headers = {
|
|
941
|
+
'content-type': 'application/json',
|
|
942
|
+
'accept': 'application/json',
|
|
943
|
+
'nonce': nonce,
|
|
944
|
+
'public-key': this.apiKey,
|
|
945
|
+
'signature': this.hmac(this.encode(auth), this.encode(this.secret), sha512.sha384, 'hex'),
|
|
946
|
+
};
|
|
947
|
+
const account = this.safeString(this.options, 'account');
|
|
948
|
+
if (account === 'pro') {
|
|
949
|
+
headers['account'] = 'pro';
|
|
950
|
+
}
|
|
951
|
+
}
|
|
865
952
|
}
|
|
866
953
|
}
|
|
867
954
|
else {
|
|
@@ -8,6 +8,11 @@ var sha256 = require('../static_dependencies/noble-hashes/sha256.js');
|
|
|
8
8
|
|
|
9
9
|
// ---------------------------------------------------------------------------
|
|
10
10
|
// ---------------------------------------------------------------------------
|
|
11
|
+
/**
|
|
12
|
+
* @class bitget
|
|
13
|
+
* @extends Exchange
|
|
14
|
+
* @description watching delivery future markets is not yet implemented (perpertual future / swap is implemented)
|
|
15
|
+
*/
|
|
11
16
|
class bitget extends bitget$1 {
|
|
12
17
|
describe() {
|
|
13
18
|
return this.deepExtend(super.describe(), {
|
|
@@ -80,10 +85,10 @@ class bitget extends bitget$1 {
|
|
|
80
85
|
}
|
|
81
86
|
else {
|
|
82
87
|
if (!sandboxMode) {
|
|
83
|
-
return market['id'].replace('_UMCBL', '');
|
|
88
|
+
return market['id'].replace('_UMCBL', '').replace('_DMCBL', '').replace('_CMCBL', '');
|
|
84
89
|
}
|
|
85
90
|
else {
|
|
86
|
-
return market['id'].replace('_SUMCBL', '');
|
|
91
|
+
return market['id'].replace('_SUMCBL', '').replace('_SDMCBL', '').replace('_SCMCBL', '');
|
|
87
92
|
}
|
|
88
93
|
}
|
|
89
94
|
}
|
|
@@ -95,15 +100,24 @@ class bitget extends bitget$1 {
|
|
|
95
100
|
const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
|
|
96
101
|
let marketId = this.safeString(arg, 'instId');
|
|
97
102
|
if (instType === 'sp') {
|
|
98
|
-
marketId
|
|
103
|
+
marketId = marketId + '_SPBL';
|
|
99
104
|
}
|
|
100
105
|
else {
|
|
101
|
-
|
|
102
|
-
|
|
106
|
+
let extension = sandboxMode ? '_S' : '_';
|
|
107
|
+
const splitByUSDT = marketId.split('USDT');
|
|
108
|
+
const splitByPERP = marketId.split('PERP');
|
|
109
|
+
const splitByUSDTLength = splitByUSDT.length;
|
|
110
|
+
const splitByPERPLength = splitByPERP.length;
|
|
111
|
+
if (splitByUSDTLength > 1) {
|
|
112
|
+
extension += 'UMCBL';
|
|
113
|
+
}
|
|
114
|
+
else if (splitByPERPLength > 1) {
|
|
115
|
+
extension += 'CMCBL';
|
|
103
116
|
}
|
|
104
117
|
else {
|
|
105
|
-
|
|
118
|
+
extension += 'DMCBL';
|
|
106
119
|
}
|
|
120
|
+
marketId = marketId + extension;
|
|
107
121
|
}
|
|
108
122
|
return marketId;
|
|
109
123
|
}
|
|
@@ -606,6 +620,8 @@ class bitget extends bitget$1 {
|
|
|
606
620
|
* @method
|
|
607
621
|
* @name bitget#watchTrades
|
|
608
622
|
* @description get the list of most recent trades for a particular symbol
|
|
623
|
+
* @see https://bitgetlimited.github.io/apidoc/en/spot/#trades-channel
|
|
624
|
+
* @see https://bitgetlimited.github.io/apidoc/en/mix/#trades-channel
|
|
609
625
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
610
626
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
611
627
|
* @param {int} [limit] the maximum amount of trades to fetch
|
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 { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position } 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.1.
|
|
7
|
+
declare const version = "4.1.4";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
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.1.
|
|
41
|
+
const version = '4.1.5';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -5,6 +5,40 @@ interface Exchange {
|
|
|
5
5
|
xreserveGetFee(params?: {}): Promise<implicitReturnType>;
|
|
6
6
|
xreserveGetDelegatedTransactions(params?: {}): Promise<implicitReturnType>;
|
|
7
7
|
xreservePostDelegateTransfer(params?: {}): Promise<implicitReturnType>;
|
|
8
|
+
v4PrivateGetMe(params?: {}): Promise<implicitReturnType>;
|
|
9
|
+
v4PrivateGetGetBalance(params?: {}): Promise<implicitReturnType>;
|
|
10
|
+
v4PrivateGetActive(params?: {}): Promise<implicitReturnType>;
|
|
11
|
+
v4PrivateGetOrderHistory(params?: {}): Promise<implicitReturnType>;
|
|
12
|
+
v4PrivateGetOrderPrivateIdTrades(params?: {}): Promise<implicitReturnType>;
|
|
13
|
+
v4PrivateGetOrderDetailsIdWithTradesWithTrades(params?: {}): Promise<implicitReturnType>;
|
|
14
|
+
v4PrivateGetTradeHistory(params?: {}): Promise<implicitReturnType>;
|
|
15
|
+
v4PrivateGetTransactionHash(params?: {}): Promise<implicitReturnType>;
|
|
16
|
+
v4PrivateGetDepositPreRequest(params?: {}): Promise<implicitReturnType>;
|
|
17
|
+
v4PrivateGetDepositCryptoAddress(params?: {}): Promise<implicitReturnType>;
|
|
18
|
+
v4PrivateGetDepositCryptoGetMerchantAddress(params?: {}): Promise<implicitReturnType>;
|
|
19
|
+
v4PrivateGetDepositHistory(params?: {}): Promise<implicitReturnType>;
|
|
20
|
+
v4PrivateGetDepositDetailsDepositId(params?: {}): Promise<implicitReturnType>;
|
|
21
|
+
v4PrivateGetWithdrawPreRequest(params?: {}): Promise<implicitReturnType>;
|
|
22
|
+
v4PrivateGetWithdrawHistory(params?: {}): Promise<implicitReturnType>;
|
|
23
|
+
v4PrivateGetWithdrawDetailsWithdrawId(params?: {}): Promise<implicitReturnType>;
|
|
24
|
+
v4PrivateGetKunaCodeId(params?: {}): Promise<implicitReturnType>;
|
|
25
|
+
v4PrivateGetKunaCodeCodeCheck(params?: {}): Promise<implicitReturnType>;
|
|
26
|
+
v4PrivateGetKunaCodeIssuedByMe(params?: {}): Promise<implicitReturnType>;
|
|
27
|
+
v4PrivateGetKunaCodeRedeemedByMe(params?: {}): Promise<implicitReturnType>;
|
|
28
|
+
v4PrivatePostOrderCreate(params?: {}): Promise<implicitReturnType>;
|
|
29
|
+
v4PrivatePostOrderCancel(params?: {}): Promise<implicitReturnType>;
|
|
30
|
+
v4PrivatePostOrderCancelMulti(params?: {}): Promise<implicitReturnType>;
|
|
31
|
+
v4PrivatePostDepositCryptoGenerateAddress(params?: {}): Promise<implicitReturnType>;
|
|
32
|
+
v4PrivatePostDepositCryptoGenerateMerchantAddress(params?: {}): Promise<implicitReturnType>;
|
|
33
|
+
v4PrivatePostWithdrawCreate(params?: {}): Promise<implicitReturnType>;
|
|
34
|
+
v4PrivatePostKunaCode(params?: {}): Promise<implicitReturnType>;
|
|
35
|
+
v4PrivatePutKunaCodeRedeem(params?: {}): Promise<implicitReturnType>;
|
|
36
|
+
v4PublicGetTimestamp(params?: {}): Promise<implicitReturnType>;
|
|
37
|
+
v4PublicGetFees(params?: {}): Promise<implicitReturnType>;
|
|
38
|
+
v4PublicGetCurrenciesTypeType(params?: {}): Promise<implicitReturnType>;
|
|
39
|
+
v4PublicGetMarketsGetAll(params?: {}): Promise<implicitReturnType>;
|
|
40
|
+
v4PublicGetMarketsTickersPairsPairs(params?: {}): Promise<implicitReturnType>;
|
|
41
|
+
v4PublicGetOrderBookPairs(params?: {}): Promise<implicitReturnType>;
|
|
8
42
|
v3PublicGetTimestamp(params?: {}): Promise<implicitReturnType>;
|
|
9
43
|
v3PublicGetCurrencies(params?: {}): Promise<implicitReturnType>;
|
|
10
44
|
v3PublicGetMarkets(params?: {}): Promise<implicitReturnType>;
|
package/js/src/coinex.js
CHANGED
package/js/src/coinsph.js
CHANGED
|
@@ -543,7 +543,6 @@ export default class coinsph extends Exchange {
|
|
|
543
543
|
const quoteId = this.safeString(market, 'quoteAsset');
|
|
544
544
|
const base = this.safeCurrencyCode(baseId);
|
|
545
545
|
const quote = this.safeCurrencyCode(quoteId);
|
|
546
|
-
const isActive = this.safeString(market, 'status') === 'TRADING';
|
|
547
546
|
const limits = this.indexBy(this.safeValue(market, 'filters'), 'filterType');
|
|
548
547
|
const amountLimits = this.safeValue(limits, 'LOT_SIZE', {});
|
|
549
548
|
const priceLimits = this.safeValue(limits, 'PRICE_FILTER', {});
|
|
@@ -563,7 +562,7 @@ export default class coinsph extends Exchange {
|
|
|
563
562
|
'swap': false,
|
|
564
563
|
'future': false,
|
|
565
564
|
'option': false,
|
|
566
|
-
'active':
|
|
565
|
+
'active': this.safeStringLower(market, 'status') === 'trading',
|
|
567
566
|
'contract': false,
|
|
568
567
|
'linear': undefined,
|
|
569
568
|
'inverse': undefined,
|
package/js/src/kraken.d.ts
CHANGED
package/js/src/kraken.js
CHANGED
|
@@ -939,11 +939,7 @@ export default class kraken extends Exchange {
|
|
|
939
939
|
else {
|
|
940
940
|
direction = 'in';
|
|
941
941
|
}
|
|
942
|
-
const
|
|
943
|
-
let timestamp = undefined;
|
|
944
|
-
if (time !== undefined) {
|
|
945
|
-
timestamp = this.parseToInt(time * 1000);
|
|
946
|
-
}
|
|
942
|
+
const timestamp = this.safeIntegerProduct(item, 'time', 1000);
|
|
947
943
|
return {
|
|
948
944
|
'info': item,
|
|
949
945
|
'id': id,
|
package/js/src/kuna.d.ts
CHANGED
package/js/src/kuna.js
CHANGED
|
@@ -9,10 +9,12 @@ import Exchange from './abstract/kuna.js';
|
|
|
9
9
|
import { ArgumentsRequired, InsufficientFunds, OrderNotFound, NotSupported } from './base/errors.js';
|
|
10
10
|
import { TICK_SIZE } from './base/functions/number.js';
|
|
11
11
|
import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
|
|
12
|
+
import { sha384 } from './static_dependencies/noble-hashes/sha512.js';
|
|
12
13
|
// ---------------------------------------------------------------------------
|
|
13
14
|
/**
|
|
14
15
|
* @class kuna
|
|
15
16
|
* @extends Exchange
|
|
17
|
+
* @description Use the public-key as your apiKey
|
|
16
18
|
*/
|
|
17
19
|
export default class kuna extends Exchange {
|
|
18
20
|
describe() {
|
|
@@ -70,6 +72,7 @@ export default class kuna extends Exchange {
|
|
|
70
72
|
'api': {
|
|
71
73
|
'xreserve': 'https://api.xreserve.fund',
|
|
72
74
|
'v3': 'https://api.kuna.io',
|
|
75
|
+
'v4': 'https://api.kuna.io',
|
|
73
76
|
'public': 'https://kuna.io',
|
|
74
77
|
'private': 'https://kuna.io', // v2
|
|
75
78
|
},
|
|
@@ -88,6 +91,54 @@ export default class kuna extends Exchange {
|
|
|
88
91
|
'delegate-transfer': 1,
|
|
89
92
|
},
|
|
90
93
|
},
|
|
94
|
+
'v4': {
|
|
95
|
+
'private': {
|
|
96
|
+
'get': {
|
|
97
|
+
'me': 1,
|
|
98
|
+
'getBalance': 1,
|
|
99
|
+
'active': 1,
|
|
100
|
+
'order/history': 1,
|
|
101
|
+
'order/private/{id}/trades': 1,
|
|
102
|
+
'order/details/{id}?withTrades={withTrades}': 1,
|
|
103
|
+
'trade/history': 1,
|
|
104
|
+
'transaction/{hash}': 1,
|
|
105
|
+
'deposit/preRequest': 1,
|
|
106
|
+
'deposit/crypto/address': 1,
|
|
107
|
+
'deposit/crypto/getMerchantAddress': 1,
|
|
108
|
+
'deposit/history': 1,
|
|
109
|
+
'deposit/details/{depositId}': 1,
|
|
110
|
+
'withdraw/preRequest': 1,
|
|
111
|
+
'withdraw/history': 1,
|
|
112
|
+
'withdraw/details/{withdrawId}': 1,
|
|
113
|
+
'kuna-code/{id}': 1,
|
|
114
|
+
'kuna-code/{code}/check': 1,
|
|
115
|
+
'kuna-code/issued-by-me': 1,
|
|
116
|
+
'kuna-code/redeemed-by-me': 1,
|
|
117
|
+
},
|
|
118
|
+
'post': {
|
|
119
|
+
'order/create': 1,
|
|
120
|
+
'order/cancel': 1,
|
|
121
|
+
'order/cancel/multi': 1,
|
|
122
|
+
'deposit/crypto/generateAddress': 1,
|
|
123
|
+
'deposit/crypto/generateMerchantAddress': 1,
|
|
124
|
+
'withdraw/create': 1,
|
|
125
|
+
'kuna-code': 1,
|
|
126
|
+
},
|
|
127
|
+
'put': {
|
|
128
|
+
'kuna-code/redeem': 1,
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
'public': {
|
|
132
|
+
'get': {
|
|
133
|
+
'timestamp': 1,
|
|
134
|
+
'fees': 1,
|
|
135
|
+
'currencies?type={type}': 1,
|
|
136
|
+
'markets/getAll': 1,
|
|
137
|
+
'markets/tickers?pairs={pairs}': 1,
|
|
138
|
+
'order/book/{pairs}': 1,
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
91
142
|
'v3': {
|
|
92
143
|
'public': {
|
|
93
144
|
'get': {
|
|
@@ -295,6 +346,9 @@ export default class kuna extends Exchange {
|
|
|
295
346
|
'2002': InsufficientFunds,
|
|
296
347
|
'2003': OrderNotFound,
|
|
297
348
|
},
|
|
349
|
+
'options': {
|
|
350
|
+
// 'account': 'pro' // Only for pro accounts
|
|
351
|
+
},
|
|
298
352
|
});
|
|
299
353
|
}
|
|
300
354
|
async fetchTime(params = {}) {
|
|
@@ -851,20 +905,53 @@ export default class kuna extends Exchange {
|
|
|
851
905
|
let url = undefined;
|
|
852
906
|
if (Array.isArray(api)) {
|
|
853
907
|
const [version, access] = api;
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
if (
|
|
857
|
-
if (
|
|
858
|
-
|
|
908
|
+
if (version === 'v3') {
|
|
909
|
+
url = this.urls['api'][version] + '/' + version + '/' + this.implodeParams(path, params);
|
|
910
|
+
if (access === 'public') {
|
|
911
|
+
if (method === 'GET') {
|
|
912
|
+
if (Object.keys(params).length) {
|
|
913
|
+
url += '?' + this.urlencode(params);
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
else if ((method === 'POST') || (method === 'PUT')) {
|
|
917
|
+
headers = { 'Content-Type': 'application/json' };
|
|
918
|
+
body = this.json(params);
|
|
859
919
|
}
|
|
860
920
|
}
|
|
861
|
-
else if (
|
|
862
|
-
|
|
863
|
-
body = this.json(params);
|
|
921
|
+
else if (access === 'private') {
|
|
922
|
+
throw new NotSupported(this.id + ' private v3 API is not supported yet');
|
|
864
923
|
}
|
|
865
924
|
}
|
|
866
|
-
else if (
|
|
867
|
-
|
|
925
|
+
else if (version === 'v4') {
|
|
926
|
+
const splitPath = path.split('/');
|
|
927
|
+
const splitPathLength = splitPath.length;
|
|
928
|
+
let urlPath = '';
|
|
929
|
+
if ((splitPathLength > 1) && (splitPath[0] !== 'kuna-code')) {
|
|
930
|
+
let pathTail = '';
|
|
931
|
+
for (let i = 1; i < splitPathLength; i++) {
|
|
932
|
+
pathTail += splitPath[i];
|
|
933
|
+
}
|
|
934
|
+
urlPath = '/' + version + '/' + splitPath[0] + '/' + access + '/' + this.implodeParams(pathTail, params);
|
|
935
|
+
}
|
|
936
|
+
else {
|
|
937
|
+
urlPath = '/' + version + '/' + access + '/' + this.implodeParams(path, params);
|
|
938
|
+
}
|
|
939
|
+
url = this.urls['api'][version] + urlPath;
|
|
940
|
+
if (access === 'private') {
|
|
941
|
+
const nonce = this.nonce();
|
|
942
|
+
const auth = urlPath + nonce + this.json(params);
|
|
943
|
+
headers = {
|
|
944
|
+
'content-type': 'application/json',
|
|
945
|
+
'accept': 'application/json',
|
|
946
|
+
'nonce': nonce,
|
|
947
|
+
'public-key': this.apiKey,
|
|
948
|
+
'signature': this.hmac(this.encode(auth), this.encode(this.secret), sha384, 'hex'),
|
|
949
|
+
};
|
|
950
|
+
const account = this.safeString(this.options, 'account');
|
|
951
|
+
if (account === 'pro') {
|
|
952
|
+
headers['account'] = 'pro';
|
|
953
|
+
}
|
|
954
|
+
}
|
|
868
955
|
}
|
|
869
956
|
}
|
|
870
957
|
else {
|
package/js/src/pro/bitget.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import bitgetRest from '../bitget.js';
|
|
2
2
|
import { Int } from '../base/types.js';
|
|
3
3
|
import Client from '../base/ws/Client.js';
|
|
4
|
+
/**
|
|
5
|
+
* @class bitget
|
|
6
|
+
* @extends Exchange
|
|
7
|
+
* @description watching delivery future markets is not yet implemented (perpertual future / swap is implemented)
|
|
8
|
+
*/
|
|
4
9
|
export default class bitget extends bitgetRest {
|
|
5
10
|
describe(): any;
|
|
6
11
|
getWsMarketId(market: any): any;
|
package/js/src/pro/bitget.js
CHANGED
|
@@ -11,6 +11,11 @@ import { Precise } from '../base/Precise.js';
|
|
|
11
11
|
import { ArrayCache, ArrayCacheBySymbolById, ArrayCacheByTimestamp } from '../base/ws/Cache.js';
|
|
12
12
|
import { sha256 } from '../static_dependencies/noble-hashes/sha256.js';
|
|
13
13
|
// ---------------------------------------------------------------------------
|
|
14
|
+
/**
|
|
15
|
+
* @class bitget
|
|
16
|
+
* @extends Exchange
|
|
17
|
+
* @description watching delivery future markets is not yet implemented (perpertual future / swap is implemented)
|
|
18
|
+
*/
|
|
14
19
|
export default class bitget extends bitgetRest {
|
|
15
20
|
describe() {
|
|
16
21
|
return this.deepExtend(super.describe(), {
|
|
@@ -83,10 +88,10 @@ export default class bitget extends bitgetRest {
|
|
|
83
88
|
}
|
|
84
89
|
else {
|
|
85
90
|
if (!sandboxMode) {
|
|
86
|
-
return market['id'].replace('_UMCBL', '');
|
|
91
|
+
return market['id'].replace('_UMCBL', '').replace('_DMCBL', '').replace('_CMCBL', '');
|
|
87
92
|
}
|
|
88
93
|
else {
|
|
89
|
-
return market['id'].replace('_SUMCBL', '');
|
|
94
|
+
return market['id'].replace('_SUMCBL', '').replace('_SDMCBL', '').replace('_SCMCBL', '');
|
|
90
95
|
}
|
|
91
96
|
}
|
|
92
97
|
}
|
|
@@ -98,15 +103,24 @@ export default class bitget extends bitgetRest {
|
|
|
98
103
|
const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
|
|
99
104
|
let marketId = this.safeString(arg, 'instId');
|
|
100
105
|
if (instType === 'sp') {
|
|
101
|
-
marketId
|
|
106
|
+
marketId = marketId + '_SPBL';
|
|
102
107
|
}
|
|
103
108
|
else {
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
let extension = sandboxMode ? '_S' : '_';
|
|
110
|
+
const splitByUSDT = marketId.split('USDT');
|
|
111
|
+
const splitByPERP = marketId.split('PERP');
|
|
112
|
+
const splitByUSDTLength = splitByUSDT.length;
|
|
113
|
+
const splitByPERPLength = splitByPERP.length;
|
|
114
|
+
if (splitByUSDTLength > 1) {
|
|
115
|
+
extension += 'UMCBL';
|
|
116
|
+
}
|
|
117
|
+
else if (splitByPERPLength > 1) {
|
|
118
|
+
extension += 'CMCBL';
|
|
106
119
|
}
|
|
107
120
|
else {
|
|
108
|
-
|
|
121
|
+
extension += 'DMCBL';
|
|
109
122
|
}
|
|
123
|
+
marketId = marketId + extension;
|
|
110
124
|
}
|
|
111
125
|
return marketId;
|
|
112
126
|
}
|
|
@@ -609,6 +623,8 @@ export default class bitget extends bitgetRest {
|
|
|
609
623
|
* @method
|
|
610
624
|
* @name bitget#watchTrades
|
|
611
625
|
* @description get the list of most recent trades for a particular symbol
|
|
626
|
+
* @see https://bitgetlimited.github.io/apidoc/en/spot/#trades-channel
|
|
627
|
+
* @see https://bitgetlimited.github.io/apidoc/en/mix/#trades-channel
|
|
612
628
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
613
629
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
614
630
|
* @param {int} [limit] the maximum amount of trades to fetch
|
package/package.json
CHANGED