ccxt 4.2.22 → 4.2.24
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 +587 -60
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binanceus.js +108 -6
- package/dist/cjs/src/bingx.js +1 -1
- package/dist/cjs/src/bitfinex2.js +186 -0
- package/dist/cjs/src/bitget.js +9 -9
- package/dist/cjs/src/coinbasepro.js +1 -1
- package/dist/cjs/src/coinex.js +23 -2
- package/dist/cjs/src/okx.js +81 -31
- package/dist/cjs/src/phemex.js +12 -3
- package/dist/cjs/src/poloniex.js +1 -1
- package/dist/cjs/src/pro/binance.js +1 -1
- package/dist/cjs/src/pro/bitopro.js +146 -1
- package/dist/cjs/src/pro/hitbtc.js +6 -0
- package/dist/cjs/src/pro/okx.js +11 -3
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binanceus.d.ts +52 -1
- package/js/src/binanceus.js +108 -6
- package/js/src/bingx.js +2 -2
- package/js/src/bitfinex2.d.ts +4 -1
- package/js/src/bitfinex2.js +186 -0
- package/js/src/bitget.js +9 -9
- package/js/src/coinbasepro.js +1 -1
- package/js/src/coinex.js +23 -2
- package/js/src/okx.js +81 -31
- package/js/src/phemex.js +12 -3
- package/js/src/poloniex.js +1 -1
- package/js/src/pro/binance.js +1 -1
- package/js/src/pro/bitopro.d.ts +4 -1
- package/js/src/pro/bitopro.js +147 -2
- package/js/src/pro/hitbtc.js +6 -0
- package/js/src/pro/okx.js +11 -3
- package/package.json +1 -1
- package/skip-tests.json +1 -0
package/dist/cjs/ccxt.js
CHANGED
|
@@ -174,7 +174,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
174
174
|
|
|
175
175
|
//-----------------------------------------------------------------------------
|
|
176
176
|
// this is updated by vss.js when building
|
|
177
|
-
const version = '4.2.
|
|
177
|
+
const version = '4.2.24';
|
|
178
178
|
Exchange["default"].ccxtVersion = version;
|
|
179
179
|
const exchanges = {
|
|
180
180
|
'ace': ace,
|
|
@@ -10,6 +10,7 @@ class binanceus extends binance {
|
|
|
10
10
|
'id': 'binanceus',
|
|
11
11
|
'name': 'Binance US',
|
|
12
12
|
'countries': ['US'],
|
|
13
|
+
'hostname': 'binance.us',
|
|
13
14
|
'rateLimit': 50,
|
|
14
15
|
'certified': false,
|
|
15
16
|
'pro': true,
|
|
@@ -17,10 +18,11 @@ class binanceus extends binance {
|
|
|
17
18
|
'logo': 'https://user-images.githubusercontent.com/1294454/65177307-217b7c80-da5f-11e9-876e-0b748ba0a358.jpg',
|
|
18
19
|
'api': {
|
|
19
20
|
'web': 'https://www.binance.us',
|
|
20
|
-
'sapi': 'https://api.binance.us/sapi/v1',
|
|
21
|
-
'wapi': 'https://api.binance.us/wapi/v3',
|
|
22
21
|
'public': 'https://api.binance.us/api/v3',
|
|
23
22
|
'private': 'https://api.binance.us/api/v3',
|
|
23
|
+
'sapi': 'https://api.binance.us/sapi/v1',
|
|
24
|
+
'sapiV2': 'https://api.binance.us/sapi/v2',
|
|
25
|
+
'sapiV3': 'https://api.binance.us/sapi/v3',
|
|
24
26
|
},
|
|
25
27
|
'www': 'https://www.binance.us',
|
|
26
28
|
'referral': 'https://www.binance.us/?ref=35005074',
|
|
@@ -81,13 +83,13 @@ class binanceus extends binance {
|
|
|
81
83
|
'api': {
|
|
82
84
|
'public': {
|
|
83
85
|
'get': {
|
|
84
|
-
'exchangeInfo': 10,
|
|
85
86
|
'ping': 1,
|
|
86
87
|
'time': 1,
|
|
87
|
-
'
|
|
88
|
+
'exchangeInfo': 10,
|
|
88
89
|
'trades': 1,
|
|
89
|
-
'aggTrades': 1,
|
|
90
90
|
'historicalTrades': 5,
|
|
91
|
+
'aggTrades': 1,
|
|
92
|
+
'depth': { 'cost': 1, 'byLimit': [[100, 1], [500, 5], [1000, 10], [5000, 50]] },
|
|
91
93
|
'klines': 1,
|
|
92
94
|
'ticker/price': { 'cost': 1, 'noSymbol': 2 },
|
|
93
95
|
'avgPrice': 1,
|
|
@@ -98,7 +100,107 @@ class binanceus extends binance {
|
|
|
98
100
|
},
|
|
99
101
|
'private': {
|
|
100
102
|
'get': {
|
|
101
|
-
'
|
|
103
|
+
'account': 10,
|
|
104
|
+
'rateLimit/order': 20,
|
|
105
|
+
'order': 2,
|
|
106
|
+
'openOrders': { 'cost': 3, 'noSymbol': 40 },
|
|
107
|
+
'myTrades': 10,
|
|
108
|
+
'myPreventedMatches': 10,
|
|
109
|
+
'allOrders': 10,
|
|
110
|
+
'orderList': 2,
|
|
111
|
+
'allOrderList': 10,
|
|
112
|
+
'openOrderList': 3,
|
|
113
|
+
},
|
|
114
|
+
'post': {
|
|
115
|
+
'order': 1,
|
|
116
|
+
'order/test': 1,
|
|
117
|
+
'order/cancelReplace': 1,
|
|
118
|
+
'order/oco': 1,
|
|
119
|
+
},
|
|
120
|
+
'delete': {
|
|
121
|
+
'order': 1,
|
|
122
|
+
'openOrders': 1,
|
|
123
|
+
'orderList': 1,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
'sapi': {
|
|
127
|
+
'get': {
|
|
128
|
+
'system/status': 1,
|
|
129
|
+
'asset/assetDistributionHistory': 1,
|
|
130
|
+
'asset/query/trading-fee': 1,
|
|
131
|
+
'asset/query/trading-volume': 1,
|
|
132
|
+
'sub-account/spotSummary': 1,
|
|
133
|
+
'sub-account/status': 1,
|
|
134
|
+
'otc/coinPairs': 1,
|
|
135
|
+
'otc/orders/{orderId}': 1,
|
|
136
|
+
'otc/orders': 1,
|
|
137
|
+
'ocbs/orders': 1,
|
|
138
|
+
'capital/config/getall': 1,
|
|
139
|
+
'capital/withdraw/history': 1,
|
|
140
|
+
'fiatpayment/query/withdraw/history': 1,
|
|
141
|
+
'capital/deposit/address': 1,
|
|
142
|
+
'capital/deposit/hisrec': 1,
|
|
143
|
+
'fiatpayment/query/deposit/history': 1,
|
|
144
|
+
'capital/sub-account/deposit/address': 1,
|
|
145
|
+
'capital/sub-account/deposit/history': 1,
|
|
146
|
+
'asset/query/dust-logs': 1,
|
|
147
|
+
'asset/query/dust-assets': 1,
|
|
148
|
+
'marketing/referral/reward/history': 1,
|
|
149
|
+
'staking/asset': 1,
|
|
150
|
+
'staking/stakingBalance': 1,
|
|
151
|
+
'staking/history': 1,
|
|
152
|
+
'staking/stakingRewardsHistory': 1,
|
|
153
|
+
'custodian/balance': 1,
|
|
154
|
+
'custodian/supportedAssetList': 1,
|
|
155
|
+
'custodian/walletTransferHistory': 1,
|
|
156
|
+
'custodian/custodianTransferHistory': 1,
|
|
157
|
+
'custodian/openOrders': 1,
|
|
158
|
+
'custodian/order': 1,
|
|
159
|
+
'custodian/orderHistory': 1,
|
|
160
|
+
'custodian/tradeHistory': 1,
|
|
161
|
+
'custodian/settlementSetting': 1,
|
|
162
|
+
'custodian/settlementHistory': 1,
|
|
163
|
+
'cl/transferHistory': 1,
|
|
164
|
+
'apipartner/checkEligibility': 1,
|
|
165
|
+
'apipartner/rebateHistory': 1,
|
|
166
|
+
},
|
|
167
|
+
'post': {
|
|
168
|
+
'otc/quotes': 1,
|
|
169
|
+
'otc/orders': 1,
|
|
170
|
+
'fiatpayment/withdraw/apply': 1,
|
|
171
|
+
'capital/withdraw/apply': 1,
|
|
172
|
+
'asset/dust': 10,
|
|
173
|
+
'staking/stake': 1,
|
|
174
|
+
'staking/unstake': 1,
|
|
175
|
+
'custodian/walletTransfer': 1,
|
|
176
|
+
'custodian/custodianTransfer': 1,
|
|
177
|
+
'custodian/undoTransfer': 1,
|
|
178
|
+
'custodian/order': 1,
|
|
179
|
+
'custodian/ocoOrder': 1,
|
|
180
|
+
'cl/transfer': 1,
|
|
181
|
+
},
|
|
182
|
+
'delete': {
|
|
183
|
+
'custodian/cancelOrder': 1,
|
|
184
|
+
'custodian/cancelOrdersBySymbol': 1,
|
|
185
|
+
'custodian/cancelOcoOrder': 1,
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
'sapiV2': {
|
|
189
|
+
'get': {
|
|
190
|
+
'cl/account': 10,
|
|
191
|
+
'cl/alertHistory': 1,
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
'sapiV3': {
|
|
195
|
+
'get': {
|
|
196
|
+
'accountStatus': 1,
|
|
197
|
+
'apiTradingStatus': 1,
|
|
198
|
+
'sub-account/list': 1,
|
|
199
|
+
'sub-account/transfer/history': 1,
|
|
200
|
+
'sub-account/assets': 1,
|
|
201
|
+
},
|
|
202
|
+
'post': {
|
|
203
|
+
'sub-account/transfer': 1,
|
|
102
204
|
},
|
|
103
205
|
},
|
|
104
206
|
},
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -360,7 +360,7 @@ class bingx extends bingx$1 {
|
|
|
360
360
|
'100500': errors.ExchangeError,
|
|
361
361
|
'100503': errors.ExchangeError,
|
|
362
362
|
'80001': errors.BadRequest,
|
|
363
|
-
'80012': errors.
|
|
363
|
+
'80012': errors.InsufficientFunds,
|
|
364
364
|
'80014': errors.BadRequest,
|
|
365
365
|
'80016': errors.OrderNotFound,
|
|
366
366
|
'80017': errors.OrderNotFound,
|
|
@@ -54,6 +54,8 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
54
54
|
'fetchMarkOHLCV': false,
|
|
55
55
|
'fetchMyTrades': true,
|
|
56
56
|
'fetchOHLCV': true,
|
|
57
|
+
'fetchOpenInterest': true,
|
|
58
|
+
'fetchOpenInterestHistory': true,
|
|
57
59
|
'fetchOpenOrder': true,
|
|
58
60
|
'fetchOpenOrders': true,
|
|
59
61
|
'fetchOrder': true,
|
|
@@ -2985,6 +2987,190 @@ class bitfinex2 extends bitfinex2$1 {
|
|
|
2985
2987
|
'previousFundingDatetime': undefined,
|
|
2986
2988
|
};
|
|
2987
2989
|
}
|
|
2990
|
+
async fetchOpenInterest(symbol, params = {}) {
|
|
2991
|
+
/**
|
|
2992
|
+
* @method
|
|
2993
|
+
* @name bitfinex2#fetchOpenInterest
|
|
2994
|
+
* @description retrieves the open interest of a contract trading pair
|
|
2995
|
+
* @see https://docs.bitfinex.com/reference/rest-public-derivatives-status
|
|
2996
|
+
* @param {string} symbol unified CCXT market symbol
|
|
2997
|
+
* @param {object} [params] exchange specific parameters
|
|
2998
|
+
* @returns {object} an [open interest structure]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
2999
|
+
*/
|
|
3000
|
+
await this.loadMarkets();
|
|
3001
|
+
const market = this.market(symbol);
|
|
3002
|
+
const request = {
|
|
3003
|
+
'keys': market['id'],
|
|
3004
|
+
};
|
|
3005
|
+
const response = await this.publicGetStatusDeriv(this.extend(request, params));
|
|
3006
|
+
//
|
|
3007
|
+
// [
|
|
3008
|
+
// [
|
|
3009
|
+
// "tXRPF0:USTF0", // market id
|
|
3010
|
+
// 1706256986000, // millisecond timestamp
|
|
3011
|
+
// null,
|
|
3012
|
+
// 0.512705, // derivative mid price
|
|
3013
|
+
// 0.512395, // underlying spot mid price
|
|
3014
|
+
// null,
|
|
3015
|
+
// 37671483.04, // insurance fund balance
|
|
3016
|
+
// null,
|
|
3017
|
+
// 1706284800000, // timestamp of next funding
|
|
3018
|
+
// 0.00002353, // accrued funding for next period
|
|
3019
|
+
// 317, // next funding step
|
|
3020
|
+
// null,
|
|
3021
|
+
// 0, // current funding
|
|
3022
|
+
// null,
|
|
3023
|
+
// null,
|
|
3024
|
+
// 0.5123016, // mark price
|
|
3025
|
+
// null,
|
|
3026
|
+
// null,
|
|
3027
|
+
// 2233562.03115, // open interest in contracts
|
|
3028
|
+
// null,
|
|
3029
|
+
// null,
|
|
3030
|
+
// null,
|
|
3031
|
+
// 0.0005, // average spread without funding payment
|
|
3032
|
+
// 0.0025 // funding payment cap
|
|
3033
|
+
// ]
|
|
3034
|
+
// ]
|
|
3035
|
+
//
|
|
3036
|
+
return this.parseOpenInterest(response[0], market);
|
|
3037
|
+
}
|
|
3038
|
+
async fetchOpenInterestHistory(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
3039
|
+
/**
|
|
3040
|
+
* @method
|
|
3041
|
+
* @name bitfinex2#fetchOpenInterestHistory
|
|
3042
|
+
* @description retrieves the open interest history of a currency
|
|
3043
|
+
* @see https://docs.bitfinex.com/reference/rest-public-derivatives-status-history
|
|
3044
|
+
* @param {string} symbol unified CCXT market symbol
|
|
3045
|
+
* @param {string} timeframe the time period of each row of data, not used by bitfinex2
|
|
3046
|
+
* @param {int} [since] the time in ms of the earliest record to retrieve as a unix timestamp
|
|
3047
|
+
* @param {int} [limit] the number of records in the response
|
|
3048
|
+
* @param {object} [params] exchange specific parameters
|
|
3049
|
+
* @param {int} [params.until] the time in ms of the latest record to retrieve as a unix timestamp
|
|
3050
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
3051
|
+
* @returns An array of [open interest structures]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
3052
|
+
*/
|
|
3053
|
+
await this.loadMarkets();
|
|
3054
|
+
let paginate = false;
|
|
3055
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOpenInterestHistory', 'paginate');
|
|
3056
|
+
if (paginate) {
|
|
3057
|
+
return await this.fetchPaginatedCallDeterministic('fetchOpenInterestHistory', symbol, since, limit, '8h', params, 5000);
|
|
3058
|
+
}
|
|
3059
|
+
const market = this.market(symbol);
|
|
3060
|
+
let request = {
|
|
3061
|
+
'symbol': market['id'],
|
|
3062
|
+
};
|
|
3063
|
+
if (since !== undefined) {
|
|
3064
|
+
request['start'] = since;
|
|
3065
|
+
}
|
|
3066
|
+
if (limit !== undefined) {
|
|
3067
|
+
request['limit'] = limit;
|
|
3068
|
+
}
|
|
3069
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
3070
|
+
const response = await this.publicGetStatusDerivSymbolHist(this.extend(request, params));
|
|
3071
|
+
//
|
|
3072
|
+
// [
|
|
3073
|
+
// [
|
|
3074
|
+
// 1706295191000, // timestamp
|
|
3075
|
+
// null,
|
|
3076
|
+
// 42152.425382, // derivative mid price
|
|
3077
|
+
// 42133, // spot mid price
|
|
3078
|
+
// null,
|
|
3079
|
+
// 37671589.7853521, // insurance fund balance
|
|
3080
|
+
// null,
|
|
3081
|
+
// 1706313600000, // timestamp of next funding
|
|
3082
|
+
// 0.00018734, // accrued funding for next period
|
|
3083
|
+
// 3343, // next funding step
|
|
3084
|
+
// null,
|
|
3085
|
+
// 0.00007587, // current funding
|
|
3086
|
+
// null,
|
|
3087
|
+
// null,
|
|
3088
|
+
// 42134.1, // mark price
|
|
3089
|
+
// null,
|
|
3090
|
+
// null,
|
|
3091
|
+
// 5775.20348804, // open interest number of contracts
|
|
3092
|
+
// null,
|
|
3093
|
+
// null,
|
|
3094
|
+
// null,
|
|
3095
|
+
// 0.0005, // average spread without funding payment
|
|
3096
|
+
// 0.0025 // funding payment cap
|
|
3097
|
+
// ],
|
|
3098
|
+
// ]
|
|
3099
|
+
//
|
|
3100
|
+
return this.parseOpenInterests(response, market, since, limit);
|
|
3101
|
+
}
|
|
3102
|
+
parseOpenInterest(interest, market = undefined) {
|
|
3103
|
+
//
|
|
3104
|
+
// fetchOpenInterest:
|
|
3105
|
+
//
|
|
3106
|
+
// [
|
|
3107
|
+
// "tXRPF0:USTF0", // market id
|
|
3108
|
+
// 1706256986000, // millisecond timestamp
|
|
3109
|
+
// null,
|
|
3110
|
+
// 0.512705, // derivative mid price
|
|
3111
|
+
// 0.512395, // underlying spot mid price
|
|
3112
|
+
// null,
|
|
3113
|
+
// 37671483.04, // insurance fund balance
|
|
3114
|
+
// null,
|
|
3115
|
+
// 1706284800000, // timestamp of next funding
|
|
3116
|
+
// 0.00002353, // accrued funding for next period
|
|
3117
|
+
// 317, // next funding step
|
|
3118
|
+
// null,
|
|
3119
|
+
// 0, // current funding
|
|
3120
|
+
// null,
|
|
3121
|
+
// null,
|
|
3122
|
+
// 0.5123016, // mark price
|
|
3123
|
+
// null,
|
|
3124
|
+
// null,
|
|
3125
|
+
// 2233562.03115, // open interest in contracts
|
|
3126
|
+
// null,
|
|
3127
|
+
// null,
|
|
3128
|
+
// null,
|
|
3129
|
+
// 0.0005, // average spread without funding payment
|
|
3130
|
+
// 0.0025 // funding payment cap
|
|
3131
|
+
// ]
|
|
3132
|
+
//
|
|
3133
|
+
// fetchOpenInterestHistory:
|
|
3134
|
+
//
|
|
3135
|
+
// [
|
|
3136
|
+
// 1706295191000, // timestamp
|
|
3137
|
+
// null,
|
|
3138
|
+
// 42152.425382, // derivative mid price
|
|
3139
|
+
// 42133, // spot mid price
|
|
3140
|
+
// null,
|
|
3141
|
+
// 37671589.7853521, // insurance fund balance
|
|
3142
|
+
// null,
|
|
3143
|
+
// 1706313600000, // timestamp of next funding
|
|
3144
|
+
// 0.00018734, // accrued funding for next period
|
|
3145
|
+
// 3343, // next funding step
|
|
3146
|
+
// null,
|
|
3147
|
+
// 0.00007587, // current funding
|
|
3148
|
+
// null,
|
|
3149
|
+
// null,
|
|
3150
|
+
// 42134.1, // mark price
|
|
3151
|
+
// null,
|
|
3152
|
+
// null,
|
|
3153
|
+
// 5775.20348804, // open interest number of contracts
|
|
3154
|
+
// null,
|
|
3155
|
+
// null,
|
|
3156
|
+
// null,
|
|
3157
|
+
// 0.0005, // average spread without funding payment
|
|
3158
|
+
// 0.0025 // funding payment cap
|
|
3159
|
+
// ]
|
|
3160
|
+
//
|
|
3161
|
+
const interestLength = interest.length;
|
|
3162
|
+
const openInterestIndex = (interestLength === 23) ? 17 : 18;
|
|
3163
|
+
const timestamp = this.safeInteger(interest, 1);
|
|
3164
|
+
const marketId = this.safeString(interest, 0);
|
|
3165
|
+
return this.safeOpenInterest({
|
|
3166
|
+
'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
|
|
3167
|
+
'openInterestAmount': this.safeNumber(interest, openInterestIndex),
|
|
3168
|
+
'openInterestValue': undefined,
|
|
3169
|
+
'timestamp': timestamp,
|
|
3170
|
+
'datetime': this.iso8601(timestamp),
|
|
3171
|
+
'info': interest,
|
|
3172
|
+
}, market);
|
|
3173
|
+
}
|
|
2988
3174
|
}
|
|
2989
3175
|
|
|
2990
3176
|
module.exports = bitfinex2;
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -44,16 +44,16 @@ class bitget extends bitget$1 {
|
|
|
44
44
|
'createOrder': true,
|
|
45
45
|
'createOrders': true,
|
|
46
46
|
'createOrderWithTakeProfitAndStopLoss': true,
|
|
47
|
-
'createReduceOnlyOrder': false,
|
|
48
|
-
'createStopLossOrder': true,
|
|
49
|
-
'createTakeProfitOrder': true,
|
|
50
47
|
'createPostOnlyOrder': true,
|
|
51
|
-
'
|
|
48
|
+
'createReduceOnlyOrder': false,
|
|
52
49
|
'createStopLimitOrder': true,
|
|
50
|
+
'createStopLossOrder': true,
|
|
53
51
|
'createStopMarketOrder': true,
|
|
52
|
+
'createStopOrder': true,
|
|
53
|
+
'createTakeProfitOrder': true,
|
|
54
|
+
'createTrailingAmountOrder': false,
|
|
54
55
|
'createTrailingPercentOrder': true,
|
|
55
56
|
'createTriggerOrder': true,
|
|
56
|
-
'signIn': false,
|
|
57
57
|
'editOrder': true,
|
|
58
58
|
'fetchAccounts': false,
|
|
59
59
|
'fetchBalance': true,
|
|
@@ -69,12 +69,10 @@ class bitget extends bitget$1 {
|
|
|
69
69
|
'fetchDepositAddress': true,
|
|
70
70
|
'fetchDepositAddresses': false,
|
|
71
71
|
'fetchDeposits': true,
|
|
72
|
+
'fetchDepositsWithdrawals': false,
|
|
72
73
|
'fetchDepositWithdrawFee': 'emulated',
|
|
73
74
|
'fetchDepositWithdrawFees': true,
|
|
74
|
-
'fetchDepositsWithdrawals': false,
|
|
75
75
|
'fetchFundingHistory': true,
|
|
76
|
-
'fetchWithdrawAddresses': false,
|
|
77
|
-
'fetchTransactions': false,
|
|
78
76
|
'fetchFundingRate': true,
|
|
79
77
|
'fetchFundingRateHistory': true,
|
|
80
78
|
'fetchFundingRates': false,
|
|
@@ -98,7 +96,6 @@ class bitget extends bitget$1 {
|
|
|
98
96
|
'fetchOrder': true,
|
|
99
97
|
'fetchOrderBook': true,
|
|
100
98
|
'fetchOrders': false,
|
|
101
|
-
'createTrailingAmountOrder': false,
|
|
102
99
|
'fetchOrderTrades': false,
|
|
103
100
|
'fetchPosition': true,
|
|
104
101
|
'fetchPositionMode': false,
|
|
@@ -111,8 +108,10 @@ class bitget extends bitget$1 {
|
|
|
111
108
|
'fetchTrades': true,
|
|
112
109
|
'fetchTradingFee': true,
|
|
113
110
|
'fetchTradingFees': true,
|
|
111
|
+
'fetchTransactions': false,
|
|
114
112
|
'fetchTransfer': false,
|
|
115
113
|
'fetchTransfers': true,
|
|
114
|
+
'fetchWithdrawAddresses': false,
|
|
116
115
|
'fetchWithdrawal': false,
|
|
117
116
|
'fetchWithdrawals': true,
|
|
118
117
|
'reduceMargin': true,
|
|
@@ -121,6 +120,7 @@ class bitget extends bitget$1 {
|
|
|
121
120
|
'setLeverage': true,
|
|
122
121
|
'setMarginMode': true,
|
|
123
122
|
'setPositionMode': true,
|
|
123
|
+
'signIn': false,
|
|
124
124
|
'transfer': true,
|
|
125
125
|
'withdraw': true,
|
|
126
126
|
},
|
|
@@ -42,8 +42,8 @@ class coinbasepro extends coinbasepro$1 {
|
|
|
42
42
|
'fetchDepositAddress': false,
|
|
43
43
|
'fetchDeposits': true,
|
|
44
44
|
'fetchDepositsWithdrawals': true,
|
|
45
|
-
'fetchLedger': true,
|
|
46
45
|
'fetchFundingRate': false,
|
|
46
|
+
'fetchLedger': true,
|
|
47
47
|
'fetchMarginMode': false,
|
|
48
48
|
'fetchMarkets': true,
|
|
49
49
|
'fetchMyTrades': true,
|
package/dist/cjs/src/coinex.js
CHANGED
|
@@ -3514,11 +3514,17 @@ class coinex extends coinex$1 {
|
|
|
3514
3514
|
* @name coinex#fetchPositions
|
|
3515
3515
|
* @description fetch all open positions
|
|
3516
3516
|
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http033_pending_position
|
|
3517
|
-
* @
|
|
3517
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http033-0_finished_position
|
|
3518
|
+
* @param {string[]} [symbols] list of unified market symbols
|
|
3518
3519
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3520
|
+
* @param {string} [params.method] the method to use 'perpetualPrivateGetPositionPending' or 'perpetualPrivateGetPositionFinished' default is 'perpetualPrivateGetPositionPending'
|
|
3521
|
+
* @param {int} [params.side] *history endpoint only* 0: All, 1: Sell, 2: Buy, default is 0
|
|
3519
3522
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
3520
3523
|
*/
|
|
3521
3524
|
await this.loadMarkets();
|
|
3525
|
+
let defaultMethod = undefined;
|
|
3526
|
+
[defaultMethod, params] = this.handleOptionAndParams(params, 'fetchPositions', 'method', 'perpetualPrivateGetPositionPending');
|
|
3527
|
+
const isHistory = (defaultMethod === 'perpetualPrivateGetPositionFinished');
|
|
3522
3528
|
symbols = this.marketSymbols(symbols);
|
|
3523
3529
|
const request = {};
|
|
3524
3530
|
let market = undefined;
|
|
@@ -3537,7 +3543,22 @@ class coinex extends coinex$1 {
|
|
|
3537
3543
|
market = this.market(symbol);
|
|
3538
3544
|
request['market'] = market['id'];
|
|
3539
3545
|
}
|
|
3540
|
-
|
|
3546
|
+
else {
|
|
3547
|
+
if (isHistory) {
|
|
3548
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchPositions() requires a symbol argument for closed positions');
|
|
3549
|
+
}
|
|
3550
|
+
}
|
|
3551
|
+
if (isHistory) {
|
|
3552
|
+
request['limit'] = 100;
|
|
3553
|
+
request['side'] = this.safeInteger(params, 'side', 0); // 0: All, 1: Sell, 2: Buy
|
|
3554
|
+
}
|
|
3555
|
+
let response = undefined;
|
|
3556
|
+
if (defaultMethod === 'perpetualPrivateGetPositionPending') {
|
|
3557
|
+
response = await this.perpetualPrivateGetPositionPending(this.extend(request, params));
|
|
3558
|
+
}
|
|
3559
|
+
else {
|
|
3560
|
+
response = await this.perpetualPrivateGetPositionFinished(this.extend(request, params));
|
|
3561
|
+
}
|
|
3541
3562
|
//
|
|
3542
3563
|
// {
|
|
3543
3564
|
// "code": 0,
|
package/dist/cjs/src/okx.js
CHANGED
|
@@ -2914,12 +2914,26 @@ class okx extends okx$1 {
|
|
|
2914
2914
|
const request = {
|
|
2915
2915
|
'instId': market['id'],
|
|
2916
2916
|
};
|
|
2917
|
+
let isAlgoOrder = undefined;
|
|
2918
|
+
if ((type === 'trigger') || (type === 'conditional') || (type === 'move_order_stop') || (type === 'oco') || (type === 'iceberg') || (type === 'twap')) {
|
|
2919
|
+
isAlgoOrder = true;
|
|
2920
|
+
}
|
|
2917
2921
|
const clientOrderId = this.safeString2(params, 'clOrdId', 'clientOrderId');
|
|
2918
2922
|
if (clientOrderId !== undefined) {
|
|
2919
|
-
|
|
2923
|
+
if (isAlgoOrder) {
|
|
2924
|
+
request['algoClOrdId'] = clientOrderId;
|
|
2925
|
+
}
|
|
2926
|
+
else {
|
|
2927
|
+
request['clOrdId'] = clientOrderId;
|
|
2928
|
+
}
|
|
2920
2929
|
}
|
|
2921
2930
|
else {
|
|
2922
|
-
|
|
2931
|
+
if (isAlgoOrder) {
|
|
2932
|
+
request['algoId'] = id;
|
|
2933
|
+
}
|
|
2934
|
+
else {
|
|
2935
|
+
request['ordId'] = id;
|
|
2936
|
+
}
|
|
2923
2937
|
}
|
|
2924
2938
|
let stopLossTriggerPrice = this.safeValue2(params, 'stopLossPrice', 'newSlTriggerPx');
|
|
2925
2939
|
let stopLossPrice = this.safeValue(params, 'newSlOrdPx');
|
|
@@ -2931,37 +2945,62 @@ class okx extends okx$1 {
|
|
|
2931
2945
|
const takeProfit = this.safeValue(params, 'takeProfit');
|
|
2932
2946
|
const stopLossDefined = (stopLoss !== undefined);
|
|
2933
2947
|
const takeProfitDefined = (takeProfit !== undefined);
|
|
2934
|
-
if (
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2948
|
+
if (isAlgoOrder) {
|
|
2949
|
+
if ((stopLossTriggerPrice === undefined) && (takeProfitTriggerPrice === undefined)) {
|
|
2950
|
+
throw new errors.BadRequest(this.id + ' editOrder() requires a stopLossPrice or takeProfitPrice parameter for editing an algo order');
|
|
2951
|
+
}
|
|
2952
|
+
if (stopLossTriggerPrice !== undefined) {
|
|
2953
|
+
if (stopLossPrice === undefined) {
|
|
2954
|
+
throw new errors.BadRequest(this.id + ' editOrder() requires a newSlOrdPx parameter for editing an algo order');
|
|
2955
|
+
}
|
|
2956
|
+
request['newSlTriggerPx'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
2957
|
+
request['newSlOrdPx'] = (type === 'market') ? '-1' : this.priceToPrecision(symbol, stopLossPrice);
|
|
2958
|
+
request['newSlTriggerPxType'] = stopLossTriggerPriceType;
|
|
2959
|
+
}
|
|
2960
|
+
if (takeProfitTriggerPrice !== undefined) {
|
|
2961
|
+
if (takeProfitPrice === undefined) {
|
|
2962
|
+
throw new errors.BadRequest(this.id + ' editOrder() requires a newTpOrdPx parameter for editing an algo order');
|
|
2963
|
+
}
|
|
2964
|
+
request['newTpTriggerPx'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
2965
|
+
request['newTpOrdPx'] = (type === 'market') ? '-1' : this.priceToPrecision(symbol, takeProfitPrice);
|
|
2966
|
+
request['newTpTriggerPxType'] = takeProfitTriggerPriceType;
|
|
2967
|
+
}
|
|
2968
|
+
}
|
|
2969
|
+
else {
|
|
2970
|
+
if (stopLossTriggerPrice !== undefined) {
|
|
2971
|
+
request['newSlTriggerPx'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
2972
|
+
request['newSlOrdPx'] = (type === 'market') ? '-1' : this.priceToPrecision(symbol, stopLossPrice);
|
|
2973
|
+
request['newSlTriggerPxType'] = stopLossTriggerPriceType;
|
|
2974
|
+
}
|
|
2975
|
+
if (takeProfitTriggerPrice !== undefined) {
|
|
2976
|
+
request['newTpTriggerPx'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
2977
|
+
request['newTpOrdPx'] = (type === 'market') ? '-1' : this.priceToPrecision(symbol, takeProfitPrice);
|
|
2978
|
+
request['newTpTriggerPxType'] = takeProfitTriggerPriceType;
|
|
2979
|
+
}
|
|
2980
|
+
if (stopLossDefined) {
|
|
2981
|
+
stopLossTriggerPrice = this.safeValue(stopLoss, 'triggerPrice');
|
|
2982
|
+
stopLossPrice = this.safeValue(stopLoss, 'price');
|
|
2983
|
+
const stopLossType = this.safeString(stopLoss, 'type');
|
|
2984
|
+
request['newSlTriggerPx'] = this.priceToPrecision(symbol, stopLossTriggerPrice);
|
|
2985
|
+
request['newSlOrdPx'] = (stopLossType === 'market') ? '-1' : this.priceToPrecision(symbol, stopLossPrice);
|
|
2986
|
+
request['newSlTriggerPxType'] = stopLossTriggerPriceType;
|
|
2987
|
+
}
|
|
2988
|
+
if (takeProfitDefined) {
|
|
2989
|
+
takeProfitTriggerPrice = this.safeValue(takeProfit, 'triggerPrice');
|
|
2990
|
+
takeProfitPrice = this.safeValue(takeProfit, 'price');
|
|
2991
|
+
const takeProfitType = this.safeString(takeProfit, 'type');
|
|
2992
|
+
request['newTpTriggerPx'] = this.priceToPrecision(symbol, takeProfitTriggerPrice);
|
|
2993
|
+
request['newTpOrdPx'] = (takeProfitType === 'market') ? '-1' : this.priceToPrecision(symbol, takeProfitPrice);
|
|
2994
|
+
request['newTpTriggerPxType'] = takeProfitTriggerPriceType;
|
|
2995
|
+
}
|
|
2959
2996
|
}
|
|
2960
2997
|
if (amount !== undefined) {
|
|
2961
2998
|
request['newSz'] = this.amountToPrecision(symbol, amount);
|
|
2962
2999
|
}
|
|
2963
|
-
if (
|
|
2964
|
-
|
|
3000
|
+
if (!isAlgoOrder) {
|
|
3001
|
+
if (price !== undefined) {
|
|
3002
|
+
request['newPx'] = this.priceToPrecision(symbol, price);
|
|
3003
|
+
}
|
|
2965
3004
|
}
|
|
2966
3005
|
params = this.omit(params, ['clOrdId', 'clientOrderId', 'takeProfitPrice', 'stopLossPrice', 'stopLoss', 'takeProfit']);
|
|
2967
3006
|
return this.extend(request, params);
|
|
@@ -2971,7 +3010,8 @@ class okx extends okx$1 {
|
|
|
2971
3010
|
* @method
|
|
2972
3011
|
* @name okx#editOrder
|
|
2973
3012
|
* @description edit a trade order
|
|
2974
|
-
* @see https://www.okx.com/docs-v5/en/#
|
|
3013
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-amend-order
|
|
3014
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-amend-algo-order
|
|
2975
3015
|
* @param {string} id order id
|
|
2976
3016
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
2977
3017
|
* @param {string} type 'market' or 'limit'
|
|
@@ -2999,7 +3039,17 @@ class okx extends okx$1 {
|
|
|
2999
3039
|
await this.loadMarkets();
|
|
3000
3040
|
const market = this.market(symbol);
|
|
3001
3041
|
const request = this.editOrderRequest(id, symbol, type, side, amount, price, params);
|
|
3002
|
-
|
|
3042
|
+
let isAlgoOrder = undefined;
|
|
3043
|
+
if ((type === 'trigger') || (type === 'conditional') || (type === 'move_order_stop') || (type === 'oco') || (type === 'iceberg') || (type === 'twap')) {
|
|
3044
|
+
isAlgoOrder = true;
|
|
3045
|
+
}
|
|
3046
|
+
let response = undefined;
|
|
3047
|
+
if (isAlgoOrder) {
|
|
3048
|
+
response = await this.privatePostTradeAmendAlgos(this.extend(request, params));
|
|
3049
|
+
}
|
|
3050
|
+
else {
|
|
3051
|
+
response = await this.privatePostTradeAmendOrder(this.extend(request, params));
|
|
3052
|
+
}
|
|
3003
3053
|
//
|
|
3004
3054
|
// {
|
|
3005
3055
|
// "code": "0",
|