ccxt 4.4.26 → 4.4.28
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 +133 -132
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ace.js +1 -1
- package/dist/cjs/src/alpaca.js +198 -5
- package/dist/cjs/src/ascendex.js +1 -1
- package/dist/cjs/src/base/Exchange.js +18 -0
- package/dist/cjs/src/bequant.js +1 -1
- package/dist/cjs/src/bigone.js +1 -1
- package/dist/cjs/src/binance.js +8 -1
- package/dist/cjs/src/binancecoinm.js +1 -1
- package/dist/cjs/src/binanceus.js +1 -1
- package/dist/cjs/src/binanceusdm.js +1 -1
- package/dist/cjs/src/bingx.js +25 -36
- package/dist/cjs/src/bit2c.js +1 -1
- package/dist/cjs/src/bitbank.js +1 -1
- package/dist/cjs/src/bitbns.js +1 -1
- package/dist/cjs/src/bitfinex.js +1 -1
- package/dist/cjs/src/bitfinex2.js +1 -1
- package/dist/cjs/src/bitflyer.js +1 -1
- package/dist/cjs/src/bitget.js +1 -1
- package/dist/cjs/src/bithumb.js +1 -1
- package/dist/cjs/src/bitmart.js +1 -1
- package/dist/cjs/src/bitmex.js +1 -1
- package/dist/cjs/src/bitopro.js +1 -1
- package/dist/cjs/src/bitrue.js +1 -1
- package/dist/cjs/src/bitso.js +1 -1
- package/dist/cjs/src/bitstamp.js +1 -1
- package/dist/cjs/src/bitteam.js +1 -1
- package/dist/cjs/src/bitvavo.js +1 -1
- package/dist/cjs/src/bl3p.js +1 -1
- package/dist/cjs/src/blockchaincom.js +1 -1
- package/dist/cjs/src/blofin.js +1 -1
- package/dist/cjs/src/btcalpha.js +1 -1
- package/dist/cjs/src/btcbox.js +1 -1
- package/dist/cjs/src/btcmarkets.js +1 -1
- package/dist/cjs/src/btcturk.js +1 -1
- package/dist/cjs/src/bybit.js +5 -1
- package/dist/cjs/src/coinbase.js +97 -11
- package/dist/cjs/src/coinex.js +1 -1
- package/dist/cjs/src/gate.js +22 -16
- package/dist/cjs/src/hyperliquid.js +21 -1
- package/dist/cjs/src/kraken.js +48 -35
- package/dist/cjs/src/lbank.js +100 -1
- package/dist/cjs/src/pro/binance.js +5 -7
- package/dist/cjs/src/pro/lbank.js +9 -4
- package/dist/cjs/src/wavesexchange.js +14 -2
- package/examples/js/cli.js +23 -3
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/alpaca.d.ts +2 -0
- package/js/src/abstract/binance.d.ts +7 -0
- package/js/src/abstract/binancecoinm.d.ts +7 -0
- package/js/src/abstract/binanceus.d.ts +7 -0
- package/js/src/abstract/binanceusdm.d.ts +7 -0
- package/js/src/ace.js +1 -1
- package/js/src/alpaca.d.ts +9 -1
- package/js/src/alpaca.js +198 -5
- package/js/src/ascendex.js +1 -1
- package/js/src/base/Exchange.d.ts +6 -0
- package/js/src/base/Exchange.js +18 -0
- package/js/src/bequant.js +1 -1
- package/js/src/bigone.js +1 -1
- package/js/src/binance.js +8 -1
- package/js/src/binancecoinm.js +1 -1
- package/js/src/binanceus.js +1 -1
- package/js/src/binanceusdm.js +1 -1
- package/js/src/bingx.js +25 -36
- package/js/src/bit2c.js +1 -1
- package/js/src/bitbank.js +1 -1
- package/js/src/bitbns.js +1 -1
- package/js/src/bitfinex.js +1 -1
- package/js/src/bitfinex2.js +1 -1
- package/js/src/bitflyer.js +1 -1
- package/js/src/bitget.js +1 -1
- package/js/src/bithumb.js +1 -1
- package/js/src/bitmart.js +1 -1
- package/js/src/bitmex.js +1 -1
- package/js/src/bitopro.js +1 -1
- package/js/src/bitrue.js +1 -1
- package/js/src/bitso.js +1 -1
- package/js/src/bitstamp.js +1 -1
- package/js/src/bitteam.js +1 -1
- package/js/src/bitvavo.js +1 -1
- package/js/src/bl3p.js +1 -1
- package/js/src/blockchaincom.js +1 -1
- package/js/src/blofin.js +1 -1
- package/js/src/btcalpha.js +1 -1
- package/js/src/btcbox.js +1 -1
- package/js/src/btcmarkets.js +1 -1
- package/js/src/btcturk.js +1 -1
- package/js/src/bybit.js +5 -1
- package/js/src/coinbase.d.ts +1 -0
- package/js/src/coinbase.js +97 -11
- package/js/src/coinex.js +1 -1
- package/js/src/gate.js +22 -16
- package/js/src/hyperliquid.d.ts +1 -0
- package/js/src/hyperliquid.js +21 -1
- package/js/src/kraken.js +48 -35
- package/js/src/lbank.d.ts +4 -1
- package/js/src/lbank.js +100 -1
- package/js/src/pro/binance.js +5 -7
- package/js/src/pro/lbank.js +9 -4
- package/js/src/wavesexchange.js +14 -2
- package/package.json +1 -1
package/js/src/bitmex.js
CHANGED
|
@@ -111,7 +111,7 @@ export default class bitmex extends Exchange {
|
|
|
111
111
|
'public': 'https://testnet.bitmex.com',
|
|
112
112
|
'private': 'https://testnet.bitmex.com',
|
|
113
113
|
},
|
|
114
|
-
'logo': 'https://github.com/
|
|
114
|
+
'logo': 'https://github.com/user-attachments/assets/c78425ab-78d5-49d6-bd14-db7734798f04',
|
|
115
115
|
'api': {
|
|
116
116
|
'public': 'https://www.bitmex.com',
|
|
117
117
|
'private': 'https://www.bitmex.com',
|
package/js/src/bitopro.js
CHANGED
|
@@ -107,7 +107,7 @@ export default class bitopro extends Exchange {
|
|
|
107
107
|
'1M': '1M',
|
|
108
108
|
},
|
|
109
109
|
'urls': {
|
|
110
|
-
'logo': 'https://
|
|
110
|
+
'logo': 'https://github.com/user-attachments/assets/affc6337-b95a-44bf-aacd-04f9722364f6',
|
|
111
111
|
'api': {
|
|
112
112
|
'rest': 'https://api.bitopro.com/v3',
|
|
113
113
|
},
|
package/js/src/bitrue.js
CHANGED
|
@@ -98,7 +98,7 @@ export default class bitrue extends Exchange {
|
|
|
98
98
|
'1w': '1W',
|
|
99
99
|
},
|
|
100
100
|
'urls': {
|
|
101
|
-
'logo': 'https://
|
|
101
|
+
'logo': 'https://github.com/user-attachments/assets/67abe346-1273-461a-bd7c-42fa32907c8e',
|
|
102
102
|
'api': {
|
|
103
103
|
'spot': 'https://www.bitrue.com/api',
|
|
104
104
|
'fapi': 'https://fapi.bitrue.com/fapi',
|
package/js/src/bitso.js
CHANGED
|
@@ -99,7 +99,7 @@ export default class bitso extends Exchange {
|
|
|
99
99
|
'withdraw': true,
|
|
100
100
|
},
|
|
101
101
|
'urls': {
|
|
102
|
-
'logo': 'https://
|
|
102
|
+
'logo': 'https://github.com/user-attachments/assets/178c8e56-9054-4107-b192-5e5053d4f975',
|
|
103
103
|
'api': {
|
|
104
104
|
'rest': 'https://bitso.com/api',
|
|
105
105
|
},
|
package/js/src/bitstamp.js
CHANGED
|
@@ -97,7 +97,7 @@ export default class bitstamp extends Exchange {
|
|
|
97
97
|
'withdraw': true,
|
|
98
98
|
},
|
|
99
99
|
'urls': {
|
|
100
|
-
'logo': 'https://
|
|
100
|
+
'logo': 'https://github.com/user-attachments/assets/d5480572-1fee-43cb-b900-d38c522d0024',
|
|
101
101
|
'api': {
|
|
102
102
|
'public': 'https://www.bitstamp.net/api',
|
|
103
103
|
'private': 'https://www.bitstamp.net/api',
|
package/js/src/bitteam.js
CHANGED
|
@@ -131,7 +131,7 @@ export default class bitteam extends Exchange {
|
|
|
131
131
|
'1d': '1D',
|
|
132
132
|
},
|
|
133
133
|
'urls': {
|
|
134
|
-
'logo': 'https://github.com/
|
|
134
|
+
'logo': 'https://github.com/user-attachments/assets/b41b5e0d-98e5-4bd3-8a6e-aeb230a4a135',
|
|
135
135
|
'api': {
|
|
136
136
|
'history': 'https://history.bit.team',
|
|
137
137
|
'public': 'https://bit.team',
|
package/js/src/bitvavo.js
CHANGED
|
@@ -112,7 +112,7 @@ export default class bitvavo extends Exchange {
|
|
|
112
112
|
'1d': '1d',
|
|
113
113
|
},
|
|
114
114
|
'urls': {
|
|
115
|
-
'logo': 'https://
|
|
115
|
+
'logo': 'https://github.com/user-attachments/assets/d213155c-8c71-4701-9bd5-45351febc2a8',
|
|
116
116
|
'api': {
|
|
117
117
|
'public': 'https://api.bitvavo.com',
|
|
118
118
|
'private': 'https://api.bitvavo.com',
|
package/js/src/bl3p.js
CHANGED
|
@@ -83,7 +83,7 @@ export default class bl3p extends Exchange {
|
|
|
83
83
|
'ws': false,
|
|
84
84
|
},
|
|
85
85
|
'urls': {
|
|
86
|
-
'logo': 'https://
|
|
86
|
+
'logo': 'https://github.com/user-attachments/assets/75aeb14e-cd48-43c8-8492-dff002dea0be',
|
|
87
87
|
'api': {
|
|
88
88
|
'rest': 'https://api.bl3p.eu',
|
|
89
89
|
},
|
package/js/src/blockchaincom.js
CHANGED
|
@@ -79,7 +79,7 @@ export default class blockchaincom extends Exchange {
|
|
|
79
79
|
},
|
|
80
80
|
'timeframes': undefined,
|
|
81
81
|
'urls': {
|
|
82
|
-
'logo': 'https://
|
|
82
|
+
'logo': 'https://github.com/user-attachments/assets/975e3054-3399-4363-bcee-ec3c6d63d4e8',
|
|
83
83
|
'test': {
|
|
84
84
|
'public': 'https://testnet-api.delta.exchange',
|
|
85
85
|
'private': 'https://testnet-api.delta.exchange',
|
package/js/src/blofin.js
CHANGED
|
@@ -156,7 +156,7 @@ export default class blofin extends Exchange {
|
|
|
156
156
|
},
|
|
157
157
|
'hostname': 'www.blofin.com',
|
|
158
158
|
'urls': {
|
|
159
|
-
'logo': 'https://github.com/
|
|
159
|
+
'logo': 'https://github.com/user-attachments/assets/518cdf80-f05d-4821-a3e3-d48ceb41d73b',
|
|
160
160
|
'api': {
|
|
161
161
|
'rest': 'https://openapi.blofin.com',
|
|
162
162
|
},
|
package/js/src/btcalpha.js
CHANGED
|
@@ -102,7 +102,7 @@ export default class btcalpha extends Exchange {
|
|
|
102
102
|
'1d': 'D',
|
|
103
103
|
},
|
|
104
104
|
'urls': {
|
|
105
|
-
'logo': 'https://
|
|
105
|
+
'logo': 'https://github.com/user-attachments/assets/dce49f3a-61e5-4ba0-a2fe-41d192fd0e5d',
|
|
106
106
|
'api': {
|
|
107
107
|
'rest': 'https://btc-alpha.com/api',
|
|
108
108
|
},
|
package/js/src/btcbox.js
CHANGED
|
@@ -82,7 +82,7 @@ export default class btcbox extends Exchange {
|
|
|
82
82
|
'ws': false,
|
|
83
83
|
},
|
|
84
84
|
'urls': {
|
|
85
|
-
'logo': 'https://
|
|
85
|
+
'logo': 'https://github.com/user-attachments/assets/1e2cb499-8d0f-4f8f-9464-3c015cfbc76b',
|
|
86
86
|
'api': {
|
|
87
87
|
'rest': 'https://www.btcbox.co.jp/api',
|
|
88
88
|
},
|
package/js/src/btcmarkets.js
CHANGED
|
@@ -87,7 +87,7 @@ export default class btcmarkets extends Exchange {
|
|
|
87
87
|
'withdraw': true,
|
|
88
88
|
},
|
|
89
89
|
'urls': {
|
|
90
|
-
'logo': 'https://
|
|
90
|
+
'logo': 'https://github.com/user-attachments/assets/8c8d6907-3873-4cc4-ad20-e22fba28247e',
|
|
91
91
|
'api': {
|
|
92
92
|
'public': 'https://api.btcmarkets.net',
|
|
93
93
|
'private': 'https://api.btcmarkets.net',
|
package/js/src/btcturk.js
CHANGED
|
@@ -90,7 +90,7 @@ export default class btcturk extends Exchange {
|
|
|
90
90
|
'1y': '1 y',
|
|
91
91
|
},
|
|
92
92
|
'urls': {
|
|
93
|
-
'logo': 'https://
|
|
93
|
+
'logo': 'https://github.com/user-attachments/assets/10e0a238-9f60-4b06-9dda-edfc7602f1d6',
|
|
94
94
|
'api': {
|
|
95
95
|
'public': 'https://api.btcturk.com/api/v2',
|
|
96
96
|
'private': 'https://api.btcturk.com/api/v1',
|
package/js/src/bybit.js
CHANGED
|
@@ -160,7 +160,7 @@ export default class bybit extends Exchange {
|
|
|
160
160
|
'public': 'https://api-testnet.{hostname}',
|
|
161
161
|
'private': 'https://api-testnet.{hostname}',
|
|
162
162
|
},
|
|
163
|
-
'logo': 'https://
|
|
163
|
+
'logo': 'https://github.com/user-attachments/assets/97a5d0b3-de10-423d-90e1-6620960025ed',
|
|
164
164
|
'api': {
|
|
165
165
|
'spot': 'https://api.{hostname}',
|
|
166
166
|
'futures': 'https://api.{hostname}',
|
|
@@ -2586,6 +2586,10 @@ export default class bybit extends Exchange {
|
|
|
2586
2586
|
//
|
|
2587
2587
|
const data = this.safeDict(response, 'result', {});
|
|
2588
2588
|
const tickerList = this.safeList(data, 'list', []);
|
|
2589
|
+
const timestamp = this.safeInteger(response, 'time');
|
|
2590
|
+
for (let i = 0; i < tickerList.length; i++) {
|
|
2591
|
+
tickerList[i]['timestamp'] = timestamp; // will be removed inside the parser
|
|
2592
|
+
}
|
|
2589
2593
|
const result = this.parseFundingRates(tickerList);
|
|
2590
2594
|
return this.filterByArray(result, 'symbol', symbols);
|
|
2591
2595
|
}
|
package/js/src/coinbase.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export default class coinbase extends Exchange {
|
|
|
28
28
|
fetchTransactionsWithMethod(method: any, code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
29
29
|
fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
30
30
|
fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
31
|
+
fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
31
32
|
parseTransactionStatus(status: Str): string;
|
|
32
33
|
parseTransaction(transaction: Dict, currency?: Currency): Transaction;
|
|
33
34
|
parseTrade(trade: Dict, market?: Market): Trade;
|
package/js/src/coinbase.js
CHANGED
|
@@ -82,6 +82,7 @@ export default class coinbase extends Exchange {
|
|
|
82
82
|
'fetchDepositAddresses': false,
|
|
83
83
|
'fetchDepositAddressesByNetwork': true,
|
|
84
84
|
'fetchDeposits': true,
|
|
85
|
+
'fetchDepositsWithdrawals': true,
|
|
85
86
|
'fetchFundingHistory': false,
|
|
86
87
|
'fetchFundingRate': false,
|
|
87
88
|
'fetchFundingRateHistory': false,
|
|
@@ -776,8 +777,15 @@ export default class coinbase extends Exchange {
|
|
|
776
777
|
* @param {int} [since] the earliest time in ms to fetch withdrawals for
|
|
777
778
|
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
|
|
778
779
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
780
|
+
* @param {string} [params.currencyType] "fiat" or "crypto"
|
|
779
781
|
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
780
782
|
*/
|
|
783
|
+
let currencyType = undefined;
|
|
784
|
+
[currencyType, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'currencyType');
|
|
785
|
+
if (currencyType === 'crypto') {
|
|
786
|
+
const results = await this.fetchTransactionsWithMethod('v2PrivateGetAccountsAccountIdTransactions', code, since, limit, params);
|
|
787
|
+
return this.filterByArray(results, 'type', 'withdrawal', false);
|
|
788
|
+
}
|
|
781
789
|
return await this.fetchTransactionsWithMethod('v2PrivateGetAccountsAccountIdWithdrawals', code, since, limit, params);
|
|
782
790
|
}
|
|
783
791
|
async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -790,10 +798,33 @@ export default class coinbase extends Exchange {
|
|
|
790
798
|
* @param {int} [since] the earliest time in ms to fetch deposits for
|
|
791
799
|
* @param {int} [limit] the maximum number of deposits structures to retrieve
|
|
792
800
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
801
|
+
* @param {string} [params.currencyType] "fiat" or "crypto"
|
|
793
802
|
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
794
803
|
*/
|
|
804
|
+
let currencyType = undefined;
|
|
805
|
+
[currencyType, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'currencyType');
|
|
806
|
+
if (currencyType === 'crypto') {
|
|
807
|
+
const results = await this.fetchTransactionsWithMethod('v2PrivateGetAccountsAccountIdTransactions', code, since, limit, params);
|
|
808
|
+
return this.filterByArray(results, 'type', 'deposit', false);
|
|
809
|
+
}
|
|
795
810
|
return await this.fetchTransactionsWithMethod('v2PrivateGetAccountsAccountIdDeposits', code, since, limit, params);
|
|
796
811
|
}
|
|
812
|
+
async fetchDepositsWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
813
|
+
/**
|
|
814
|
+
* @method
|
|
815
|
+
* @name coinbase#fetchDepositsWithdrawals
|
|
816
|
+
* @description fetch history of deposits and withdrawals
|
|
817
|
+
* @see https://docs.cdp.coinbase.com/coinbase-app/docs/api-transactions
|
|
818
|
+
* @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
|
|
819
|
+
* @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
|
|
820
|
+
* @param {int} [limit] max number of deposit/withdrawals to return, default = 50, Min: 1, Max: 100
|
|
821
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
822
|
+
* @returns {object} a list of [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
823
|
+
*/
|
|
824
|
+
await this.loadMarkets();
|
|
825
|
+
const results = await this.fetchTransactionsWithMethod('v2PrivateGetAccountsAccountIdTransactions', code, since, limit, params);
|
|
826
|
+
return this.filterByArray(results, 'type', ['deposit', 'withdrawal'], false);
|
|
827
|
+
}
|
|
797
828
|
parseTransactionStatus(status) {
|
|
798
829
|
const statuses = {
|
|
799
830
|
'created': 'pending',
|
|
@@ -917,18 +948,62 @@ export default class coinbase extends Exchange {
|
|
|
917
948
|
// "hide_native_amount": false
|
|
918
949
|
// }
|
|
919
950
|
//
|
|
951
|
+
//
|
|
952
|
+
// crypto deposit & withdrawal (using `/transactions` endpoint)
|
|
953
|
+
// {
|
|
954
|
+
// "amount": {
|
|
955
|
+
// "amount": "0.00014200", (negative for withdrawal)
|
|
956
|
+
// "currency": "BTC"
|
|
957
|
+
// },
|
|
958
|
+
// "created_at": "2024-03-29T15:48:30Z",
|
|
959
|
+
// "id": "0031a605-241d-514d-a97b-d4b99f3225d3",
|
|
960
|
+
// "idem": "092a979b-017e-4403-940a-2ca57811f442", // field present only in case of withdrawal
|
|
961
|
+
// "native_amount": {
|
|
962
|
+
// "amount": "9.85", (negative for withdrawal)
|
|
963
|
+
// "currency": "USD"
|
|
964
|
+
// },
|
|
965
|
+
// "network": {
|
|
966
|
+
// "status": "pending", // if status is `off_blockchain` then no more other fields are present in this object
|
|
967
|
+
// "hash": "5jYuvrNsvX2DZoMnzGYzVpYxJLfYu4GSK3xetG1H5LHrSovsuFCFYdFMwNRoiht3s6fBk92MM8QLLnz65xuEFTrE",
|
|
968
|
+
// "network_name": "solana",
|
|
969
|
+
// "transaction_fee": {
|
|
970
|
+
// "amount": "0.000100000",
|
|
971
|
+
// "currency": "SOL"
|
|
972
|
+
// }
|
|
973
|
+
// },
|
|
974
|
+
// "resource": "transaction",
|
|
975
|
+
// "resource_path": "/v2/accounts/dc504b1c-248e-5b68-a3b0-b991f7fa84e6/transactions/0031a605-241d-514d-a97b-d4b99f3225d3",
|
|
976
|
+
// "status": "completed",
|
|
977
|
+
// "type": "send",
|
|
978
|
+
// "from": { // in some cases, field might be present for deposit
|
|
979
|
+
// "id": "7fd10cd7-b091-5cee-ba41-c29e49a7cccf",
|
|
980
|
+
// "name": "Coinbase",
|
|
981
|
+
// "resource": "user"
|
|
982
|
+
// },
|
|
983
|
+
// "to": { // field only present for withdrawal
|
|
984
|
+
// "address": "5HA12BNthAvBwNYARYf9y5MqqCpB4qhCNFCs1Qw48ACE",
|
|
985
|
+
// "resource": "address"
|
|
986
|
+
// },
|
|
987
|
+
// "description": "C3 - One Time BTC Credit . Reference Case # 123.", // in some cases, field might be present for deposit
|
|
988
|
+
// }
|
|
989
|
+
//
|
|
920
990
|
const transactionType = this.safeString(transaction, 'type');
|
|
921
991
|
let amountAndCurrencyObject = undefined;
|
|
922
992
|
let feeObject = undefined;
|
|
993
|
+
const network = this.safeDict(transaction, 'network', {});
|
|
923
994
|
if (transactionType === 'send') {
|
|
924
|
-
|
|
925
|
-
amountAndCurrencyObject = this.safeDict(network, 'transaction_amount', {});
|
|
995
|
+
amountAndCurrencyObject = this.safeDict(network, 'transaction_amount');
|
|
926
996
|
feeObject = this.safeDict(network, 'transaction_fee', {});
|
|
927
997
|
}
|
|
928
998
|
else {
|
|
929
|
-
amountAndCurrencyObject = this.safeDict(transaction, 'subtotal'
|
|
999
|
+
amountAndCurrencyObject = this.safeDict(transaction, 'subtotal');
|
|
930
1000
|
feeObject = this.safeDict(transaction, 'fee', {});
|
|
931
1001
|
}
|
|
1002
|
+
if (amountAndCurrencyObject === undefined) {
|
|
1003
|
+
amountAndCurrencyObject = this.safeDict(transaction, 'amount');
|
|
1004
|
+
}
|
|
1005
|
+
const amountString = this.safeString(amountAndCurrencyObject, 'amount');
|
|
1006
|
+
const amountStringAbs = Precise.stringAbs(amountString);
|
|
932
1007
|
let status = this.parseTransactionStatus(this.safeString(transaction, 'status'));
|
|
933
1008
|
if (status === undefined) {
|
|
934
1009
|
const committed = this.safeBool(transaction, 'committed');
|
|
@@ -938,23 +1013,34 @@ export default class coinbase extends Exchange {
|
|
|
938
1013
|
const currencyId = this.safeString(amountAndCurrencyObject, 'currency');
|
|
939
1014
|
const feeCurrencyId = this.safeString(feeObject, 'currency');
|
|
940
1015
|
const datetime = this.safeString(transaction, 'created_at');
|
|
941
|
-
const
|
|
942
|
-
|
|
1016
|
+
const resource = this.safeString(transaction, 'resource');
|
|
1017
|
+
let type = resource;
|
|
1018
|
+
if (!this.inArray(type, ['deposit', 'withdrawal'])) {
|
|
1019
|
+
if (Precise.stringGt(amountString, '0')) {
|
|
1020
|
+
type = 'deposit';
|
|
1021
|
+
}
|
|
1022
|
+
else if (Precise.stringLt(amountString, '0')) {
|
|
1023
|
+
type = 'withdrawal';
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
const toObject = this.safeDict(transaction, 'to');
|
|
1027
|
+
const addressTo = this.safeString(toObject, 'address');
|
|
1028
|
+
const networkId = this.safeString(network, 'network_name');
|
|
943
1029
|
return {
|
|
944
1030
|
'info': transaction,
|
|
945
1031
|
'id': id,
|
|
946
|
-
'txid': id,
|
|
1032
|
+
'txid': this.safeString(network, 'hash', id),
|
|
947
1033
|
'timestamp': this.parse8601(datetime),
|
|
948
1034
|
'datetime': datetime,
|
|
949
|
-
'network':
|
|
950
|
-
'address':
|
|
951
|
-
'addressTo':
|
|
1035
|
+
'network': this.networkIdToCode(networkId),
|
|
1036
|
+
'address': addressTo,
|
|
1037
|
+
'addressTo': addressTo,
|
|
952
1038
|
'addressFrom': undefined,
|
|
953
1039
|
'tag': undefined,
|
|
954
1040
|
'tagTo': undefined,
|
|
955
1041
|
'tagFrom': undefined,
|
|
956
|
-
'type':
|
|
957
|
-
'amount': this.
|
|
1042
|
+
'type': type,
|
|
1043
|
+
'amount': this.parseNumber(amountStringAbs),
|
|
958
1044
|
'currency': this.safeCurrencyCode(currencyId, currency),
|
|
959
1045
|
'status': status,
|
|
960
1046
|
'updated': this.parse8601(this.safeString(transaction, 'updated_at')),
|
package/js/src/coinex.js
CHANGED
|
@@ -4961,7 +4961,7 @@ export default class coinex extends Exchange {
|
|
|
4961
4961
|
await this.loadMarkets();
|
|
4962
4962
|
const currency = this.currency(code);
|
|
4963
4963
|
const amountToPrecision = this.currencyToPrecision(code, amount);
|
|
4964
|
-
const accountsByType = this.safeDict(this.options, '
|
|
4964
|
+
const accountsByType = this.safeDict(this.options, 'accountsByType', {});
|
|
4965
4965
|
const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
|
|
4966
4966
|
const toId = this.safeString(accountsByType, toAccount, toAccount);
|
|
4967
4967
|
const request = {
|
package/js/src/gate.js
CHANGED
|
@@ -909,22 +909,28 @@ export default class gate extends Exchange {
|
|
|
909
909
|
*/
|
|
910
910
|
const unifiedAccount = this.safeBool(this.options, 'unifiedAccount');
|
|
911
911
|
if (unifiedAccount === undefined) {
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
912
|
+
try {
|
|
913
|
+
//
|
|
914
|
+
// {
|
|
915
|
+
// "user_id": 10406147,
|
|
916
|
+
// "ip_whitelist": [],
|
|
917
|
+
// "currency_pairs": [],
|
|
918
|
+
// "key": {
|
|
919
|
+
// "mode": 1
|
|
920
|
+
// },
|
|
921
|
+
// "tier": 0,
|
|
922
|
+
// "tier_expire_time": "0001-01-01T00:00:00Z",
|
|
923
|
+
// "copy_trading_role": 0
|
|
924
|
+
// }
|
|
925
|
+
//
|
|
926
|
+
const response = await this.privateAccountGetDetail(params);
|
|
927
|
+
const result = this.safeDict(response, 'key', {});
|
|
928
|
+
this.options['unifiedAccount'] = this.safeInteger(result, 'mode') === 2;
|
|
929
|
+
}
|
|
930
|
+
catch (e) {
|
|
931
|
+
// if the request fails, the unifiedAccount is disabled
|
|
932
|
+
this.options['unifiedAccount'] = false;
|
|
933
|
+
}
|
|
928
934
|
}
|
|
929
935
|
}
|
|
930
936
|
async upgradeUnifiedTradeAccount(params = {}) {
|
package/js/src/hyperliquid.d.ts
CHANGED
|
@@ -104,5 +104,6 @@ export default class hyperliquid extends Exchange {
|
|
|
104
104
|
body: any;
|
|
105
105
|
headers: any;
|
|
106
106
|
};
|
|
107
|
+
calculateRateLimiterCost(api: any, method: any, path: any, params: any, config?: {}): any;
|
|
107
108
|
parseCreateOrderArgs(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): {}[];
|
|
108
109
|
}
|
package/js/src/hyperliquid.js
CHANGED
|
@@ -153,7 +153,17 @@ export default class hyperliquid extends Exchange {
|
|
|
153
153
|
'api': {
|
|
154
154
|
'public': {
|
|
155
155
|
'post': {
|
|
156
|
-
'info':
|
|
156
|
+
'info': {
|
|
157
|
+
'cost': 20,
|
|
158
|
+
'byType': {
|
|
159
|
+
'l2Book': 2,
|
|
160
|
+
'allMids': 2,
|
|
161
|
+
'clearinghouseState': 2,
|
|
162
|
+
'orderStatus': 2,
|
|
163
|
+
'spotClearinghouseState': 2,
|
|
164
|
+
'exchangeStatus': 2,
|
|
165
|
+
},
|
|
166
|
+
},
|
|
157
167
|
},
|
|
158
168
|
},
|
|
159
169
|
'private': {
|
|
@@ -3031,6 +3041,16 @@ export default class hyperliquid extends Exchange {
|
|
|
3031
3041
|
}
|
|
3032
3042
|
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
3033
3043
|
}
|
|
3044
|
+
calculateRateLimiterCost(api, method, path, params, config = {}) {
|
|
3045
|
+
if (('byType' in config) && ('type' in params)) {
|
|
3046
|
+
const type = params['type'];
|
|
3047
|
+
const byType = config['byType'];
|
|
3048
|
+
if (type in byType) {
|
|
3049
|
+
return byType[type];
|
|
3050
|
+
}
|
|
3051
|
+
}
|
|
3052
|
+
return this.safeValue(config, 'cost', 1);
|
|
3053
|
+
}
|
|
3034
3054
|
parseCreateOrderArgs(symbol, type, side, amount, price = undefined, params = {}) {
|
|
3035
3055
|
const market = this.market(symbol);
|
|
3036
3056
|
const vaultAddress = this.safeString(params, 'vaultAddress');
|
package/js/src/kraken.js
CHANGED
|
@@ -1492,7 +1492,7 @@ export default class kraken extends Exchange {
|
|
|
1492
1492
|
// {
|
|
1493
1493
|
// "error": [],
|
|
1494
1494
|
// "result": {
|
|
1495
|
-
// "descr": { order: 'buy 0.02100000 ETHUSDT @ limit 330.00' },
|
|
1495
|
+
// "descr": { order: 'buy 0.02100000 ETHUSDT @ limit 330.00' }, // see more examples in "parseOrder"
|
|
1496
1496
|
// "txid": [ 'OEKVV2-IH52O-TPL6GZ' ]
|
|
1497
1497
|
// }
|
|
1498
1498
|
// }
|
|
@@ -1558,9 +1558,10 @@ export default class kraken extends Exchange {
|
|
|
1558
1558
|
}
|
|
1559
1559
|
parseOrderType(status) {
|
|
1560
1560
|
const statuses = {
|
|
1561
|
+
// we dont add "space" delimited orders here (eg. stop loss) because they need separate parsing
|
|
1561
1562
|
'take-profit': 'market',
|
|
1562
|
-
'stop-loss-limit': 'limit',
|
|
1563
1563
|
'stop-loss': 'market',
|
|
1564
|
+
'stop-loss-limit': 'limit',
|
|
1564
1565
|
'take-profit-limit': 'limit',
|
|
1565
1566
|
'trailing-stop-limit': 'limit',
|
|
1566
1567
|
};
|
|
@@ -1568,30 +1569,19 @@ export default class kraken extends Exchange {
|
|
|
1568
1569
|
}
|
|
1569
1570
|
parseOrder(order, market = undefined) {
|
|
1570
1571
|
//
|
|
1571
|
-
// createOrder
|
|
1572
|
+
// createOrder
|
|
1572
1573
|
//
|
|
1573
1574
|
// {
|
|
1574
|
-
// "descr": {
|
|
1575
|
+
// "descr": {
|
|
1576
|
+
// "order": "buy 0.02100000 ETHUSDT @ limit 330.00" // limit orders
|
|
1577
|
+
// "buy 0.12345678 ETHUSDT @ market" // market order
|
|
1578
|
+
// "sell 0.28002676 ETHUSDT @ stop loss 0.0123 -> limit 0.0.1222" // stop order
|
|
1579
|
+
// "sell 0.00100000 ETHUSDT @ stop loss 2677.00 -> limit 2577.00 with 5:1 leverage"
|
|
1580
|
+
// "buy 0.10000000 LTCUSDT @ take profit 75.00000 -> limit 74.00000"
|
|
1581
|
+
// "sell 10.00000000 XRPEUR @ trailing stop +50.0000%" // trailing stop
|
|
1582
|
+
// },
|
|
1575
1583
|
// "txid": [ 'OEKVV2-IH52O-TPL6GZ' ]
|
|
1576
1584
|
// }
|
|
1577
|
-
// {
|
|
1578
|
-
// "txid": [ "TX_ID_HERE" ],
|
|
1579
|
-
// "descr": { "order":"buy 0.12345678 ETHEUR @ market" },
|
|
1580
|
-
// }
|
|
1581
|
-
//
|
|
1582
|
-
//
|
|
1583
|
-
// createOrder for stop orders
|
|
1584
|
-
//
|
|
1585
|
-
// {
|
|
1586
|
-
// "txid":["OSILNC-VQI5Q-775ZDQ"],
|
|
1587
|
-
// "descr":{"order":"sell 167.28002676 ADAXBT @ stop loss 0.00003280 -> limit 0.00003212"}
|
|
1588
|
-
// }
|
|
1589
|
-
//
|
|
1590
|
-
//
|
|
1591
|
-
// {
|
|
1592
|
-
// "txid":["OVHMJV-BZW2V-6NZFWF"],
|
|
1593
|
-
// "descr":{"order":"sell 0.00100000 ETHUSD @ stop loss 2677.00 -> limit 2577.00 with 5:1 leverage"}
|
|
1594
|
-
// }
|
|
1595
1585
|
//
|
|
1596
1586
|
// editOrder
|
|
1597
1587
|
//
|
|
@@ -1671,27 +1661,34 @@ export default class kraken extends Exchange {
|
|
|
1671
1661
|
orderDescription = this.safeString(order, 'descr');
|
|
1672
1662
|
}
|
|
1673
1663
|
let side = undefined;
|
|
1674
|
-
let
|
|
1664
|
+
let rawType = undefined;
|
|
1675
1665
|
let marketId = undefined;
|
|
1676
1666
|
let price = undefined;
|
|
1677
1667
|
let amount = undefined;
|
|
1678
|
-
let
|
|
1668
|
+
let triggerPrice = undefined;
|
|
1679
1669
|
if (orderDescription !== undefined) {
|
|
1680
1670
|
const parts = orderDescription.split(' ');
|
|
1681
1671
|
side = this.safeString(parts, 0);
|
|
1682
1672
|
amount = this.safeString(parts, 1);
|
|
1683
1673
|
marketId = this.safeString(parts, 2);
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1674
|
+
const part4 = this.safeString(parts, 4);
|
|
1675
|
+
const part5 = this.safeString(parts, 5);
|
|
1676
|
+
if (part4 === 'limit' || part4 === 'market') {
|
|
1677
|
+
rawType = part4; // eg, limit, market
|
|
1678
|
+
}
|
|
1679
|
+
else {
|
|
1680
|
+
rawType = part4 + ' ' + part5; // eg. stop loss, take profit, trailing stop
|
|
1681
|
+
}
|
|
1682
|
+
if (rawType === 'stop loss' || rawType === 'take profit') {
|
|
1683
|
+
triggerPrice = this.safeString(parts, 6);
|
|
1687
1684
|
price = this.safeString(parts, 9);
|
|
1688
1685
|
}
|
|
1689
|
-
else if (
|
|
1686
|
+
else if (rawType === 'limit') {
|
|
1690
1687
|
price = this.safeString(parts, 5);
|
|
1691
1688
|
}
|
|
1692
1689
|
}
|
|
1693
1690
|
side = this.safeString(description, 'type', side);
|
|
1694
|
-
|
|
1691
|
+
rawType = this.safeString(description, 'ordertype', rawType); // orderType has dash, e.g. trailing-stop
|
|
1695
1692
|
marketId = this.safeString(description, 'pair', marketId);
|
|
1696
1693
|
const foundMarket = this.findMarketByAltnameOrId(marketId);
|
|
1697
1694
|
let symbol = undefined;
|
|
@@ -1756,17 +1753,33 @@ export default class kraken extends Exchange {
|
|
|
1756
1753
|
trades.push(rawTrade);
|
|
1757
1754
|
}
|
|
1758
1755
|
}
|
|
1759
|
-
|
|
1756
|
+
// as mentioned in #24192 PR, this field is not something consistent/actual
|
|
1757
|
+
// triggerPrice = this.omitZero (this.safeString (order, 'stopprice', triggerPrice));
|
|
1760
1758
|
let stopLossPrice = undefined;
|
|
1761
1759
|
let takeProfitPrice = undefined;
|
|
1762
|
-
|
|
1760
|
+
// the dashed strings are not provided from fields (eg. fetch order)
|
|
1761
|
+
// while spaced strings from "order" sentence (when other fields not available)
|
|
1762
|
+
if (rawType.startsWith('take-profit')) {
|
|
1763
1763
|
takeProfitPrice = this.safeString(description, 'price');
|
|
1764
1764
|
price = this.omitZero(this.safeString(description, 'price2'));
|
|
1765
1765
|
}
|
|
1766
|
-
else if (
|
|
1766
|
+
else if (rawType.startsWith('stop-loss')) {
|
|
1767
1767
|
stopLossPrice = this.safeString(description, 'price');
|
|
1768
1768
|
price = this.omitZero(this.safeString(description, 'price2'));
|
|
1769
1769
|
}
|
|
1770
|
+
else if (rawType === 'take profit') {
|
|
1771
|
+
takeProfitPrice = triggerPrice;
|
|
1772
|
+
}
|
|
1773
|
+
else if (rawType === 'stop loss') {
|
|
1774
|
+
stopLossPrice = triggerPrice;
|
|
1775
|
+
}
|
|
1776
|
+
let finalType = this.parseOrderType(rawType);
|
|
1777
|
+
// unlike from endpoints which provide eg: "take-profit-limit"
|
|
1778
|
+
// for "space-delimited" orders we dont have market/limit suffixes, their format is
|
|
1779
|
+
// eg: `stop loss > limit 123`, so we need to parse them manually
|
|
1780
|
+
if (this.inArray(finalType, ['stop loss', 'take profit'])) {
|
|
1781
|
+
finalType = (price === undefined) ? 'market' : 'limit';
|
|
1782
|
+
}
|
|
1770
1783
|
return this.safeOrder({
|
|
1771
1784
|
'id': id,
|
|
1772
1785
|
'clientOrderId': clientOrderId,
|
|
@@ -1776,13 +1789,13 @@ export default class kraken extends Exchange {
|
|
|
1776
1789
|
'lastTradeTimestamp': undefined,
|
|
1777
1790
|
'status': status,
|
|
1778
1791
|
'symbol': symbol,
|
|
1779
|
-
'type':
|
|
1792
|
+
'type': finalType,
|
|
1780
1793
|
'timeInForce': undefined,
|
|
1781
1794
|
'postOnly': isPostOnly,
|
|
1782
1795
|
'side': side,
|
|
1783
1796
|
'price': price,
|
|
1784
|
-
'stopPrice':
|
|
1785
|
-
'triggerPrice':
|
|
1797
|
+
'stopPrice': triggerPrice,
|
|
1798
|
+
'triggerPrice': triggerPrice,
|
|
1786
1799
|
'takeProfitPrice': takeProfitPrice,
|
|
1787
1800
|
'stopLossPrice': stopLossPrice,
|
|
1788
1801
|
'cost': undefined,
|
package/js/src/lbank.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/lbank.js';
|
|
2
|
-
import type { Balances, Currency, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, int, DepositAddress } from './base/types.js';
|
|
2
|
+
import type { Balances, Currency, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, int, DepositAddress, FundingRates, FundingRate } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class lbank
|
|
5
5
|
* @augments Exchange
|
|
@@ -19,6 +19,9 @@ export default class lbank extends Exchange {
|
|
|
19
19
|
parseOHLCV(ohlcv: any, market?: Market): OHLCV;
|
|
20
20
|
fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
21
21
|
parseBalance(response: any): Balances;
|
|
22
|
+
parseFundingRate(ticker: any, market?: Market): FundingRate;
|
|
23
|
+
fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
|
|
24
|
+
fetchFundingRates(symbols?: Strings, params?: {}): Promise<FundingRates>;
|
|
22
25
|
fetchBalance(params?: {}): Promise<Balances>;
|
|
23
26
|
parseTradingFee(fee: Dict, market?: Market): TradingFeeInterface;
|
|
24
27
|
fetchTradingFee(symbol: string, params?: {}): Promise<TradingFeeInterface>;
|