ccxt 4.3.75 → 4.3.76
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.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +1 -1
- package/dist/cjs/src/bitmart.js +144 -82
- package/dist/cjs/src/coinbase.js +8 -4
- package/dist/cjs/src/gemini.js +1 -0
- package/dist/cjs/src/htx.js +4 -0
- package/dist/cjs/src/pro/binance.js +24 -0
- package/dist/cjs/src/pro/bitmart.js +9 -8
- package/dist/cjs/src/pro/bybit.js +2 -2
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bitmart.d.ts +2 -0
- package/js/src/abstract/gemini.d.ts +1 -0
- package/js/src/base/Exchange.js +1 -1
- package/js/src/bitmart.js +144 -82
- package/js/src/coinbase.js +8 -4
- package/js/src/gemini.js +1 -0
- package/js/src/htx.js +4 -0
- package/js/src/pro/binance.js +24 -0
- package/js/src/pro/bitmart.js +9 -8
- package/js/src/pro/bybit.js +2 -2
- package/package.json +1 -1
|
@@ -40,8 +40,8 @@ class bitmart extends bitmart$1 {
|
|
|
40
40
|
'private': 'wss://ws-manager-compress.{hostname}/user?protocol=1.1',
|
|
41
41
|
},
|
|
42
42
|
'swap': {
|
|
43
|
-
'public': 'wss://openapi-ws.{hostname}/api?protocol=1.1',
|
|
44
|
-
'private': 'wss://openapi-ws.{hostname}/user?protocol=1.1',
|
|
43
|
+
'public': 'wss://openapi-ws-v2.{hostname}/api?protocol=1.1',
|
|
44
|
+
'private': 'wss://openapi-ws-v2.{hostname}/user?protocol=1.1',
|
|
45
45
|
},
|
|
46
46
|
},
|
|
47
47
|
},
|
|
@@ -135,7 +135,7 @@ class bitmart extends bitmart$1 {
|
|
|
135
135
|
* @method
|
|
136
136
|
* @name bitmart#watchBalance
|
|
137
137
|
* @see https://developer-pro.bitmart.com/en/spot/#private-balance-change
|
|
138
|
-
* @see https://developer-pro.bitmart.com/en/
|
|
138
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#private-assets-channel
|
|
139
139
|
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
140
140
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
141
141
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
@@ -269,7 +269,7 @@ class bitmart extends bitmart$1 {
|
|
|
269
269
|
* @method
|
|
270
270
|
* @name bitmart#watchTrades
|
|
271
271
|
* @see https://developer-pro.bitmart.com/en/spot/#public-trade-channel
|
|
272
|
-
* @see https://developer-pro.bitmart.com/en/
|
|
272
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#public-trade-channel
|
|
273
273
|
* @description get the list of most recent trades for a particular symbol
|
|
274
274
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
275
275
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
@@ -319,6 +319,7 @@ class bitmart extends bitmart$1 {
|
|
|
319
319
|
* @method
|
|
320
320
|
* @name bitmart#watchTicker
|
|
321
321
|
* @see https://developer-pro.bitmart.com/en/spot/#public-ticker-channel
|
|
322
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#public-ticker-channel
|
|
322
323
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
323
324
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
324
325
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -333,7 +334,7 @@ class bitmart extends bitmart$1 {
|
|
|
333
334
|
/**
|
|
334
335
|
* @method
|
|
335
336
|
* @name bitmart#watchTickers
|
|
336
|
-
* @see https://developer-pro.bitmart.com/en/
|
|
337
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#public-ticker-channel
|
|
337
338
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
338
339
|
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
339
340
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -357,7 +358,7 @@ class bitmart extends bitmart$1 {
|
|
|
357
358
|
* @name bitmart#watchOrders
|
|
358
359
|
* @description watches information on multiple orders made by the user
|
|
359
360
|
* @see https://developer-pro.bitmart.com/en/spot/#private-order-progress
|
|
360
|
-
* @see https://developer-pro.bitmart.com/en/
|
|
361
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#private-order-channel
|
|
361
362
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
362
363
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
363
364
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -992,7 +993,7 @@ class bitmart extends bitmart$1 {
|
|
|
992
993
|
* @method
|
|
993
994
|
* @name bitmart#watchOHLCV
|
|
994
995
|
* @see https://developer-pro.bitmart.com/en/spot/#public-kline-channel
|
|
995
|
-
* @see https://developer-pro.bitmart.com/en/
|
|
996
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#public-klinebin-channel
|
|
996
997
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
997
998
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
998
999
|
* @param {string} timeframe the length of time each candle represents
|
|
@@ -1120,7 +1121,7 @@ class bitmart extends bitmart$1 {
|
|
|
1120
1121
|
* @name bitmart#watchOrderBook
|
|
1121
1122
|
* @see https://developer-pro.bitmart.com/en/spot/#public-depth-all-channel
|
|
1122
1123
|
* @see https://developer-pro.bitmart.com/en/spot/#public-depth-increase-channel
|
|
1123
|
-
* @see https://developer-pro.bitmart.com/en/
|
|
1124
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#public-depth-channel
|
|
1124
1125
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
1125
1126
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
1126
1127
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
@@ -166,7 +166,7 @@ class bybit extends bybit$1 {
|
|
|
166
166
|
if (isSpot) {
|
|
167
167
|
url = url[accessibility]['spot'];
|
|
168
168
|
}
|
|
169
|
-
else if (type === 'swap') {
|
|
169
|
+
else if ((type === 'swap') || (type === 'future')) {
|
|
170
170
|
let subType = undefined;
|
|
171
171
|
[subType, params] = this.handleSubTypeAndParams(method, market, params, 'linear');
|
|
172
172
|
url = url[accessibility][subType];
|
|
@@ -2061,7 +2061,7 @@ class bybit extends bybit$1 {
|
|
|
2061
2061
|
this.handleSubscriptionStatus(client, message);
|
|
2062
2062
|
return;
|
|
2063
2063
|
}
|
|
2064
|
-
const topic = this.safeString2(message, 'topic', 'op');
|
|
2064
|
+
const topic = this.safeString2(message, 'topic', 'op', '');
|
|
2065
2065
|
const methods = {
|
|
2066
2066
|
'orderbook': this.handleOrderBook,
|
|
2067
2067
|
'kline': this.handleOHLCV,
|
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.3.
|
|
7
|
+
declare const version = "4.3.75";
|
|
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, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.3.
|
|
41
|
+
const version = '4.3.76';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -61,6 +61,8 @@ interface Exchange {
|
|
|
61
61
|
privateGetContractPrivateCurrentPlanOrder(params?: {}): Promise<implicitReturnType>;
|
|
62
62
|
privateGetContractPrivateTrades(params?: {}): Promise<implicitReturnType>;
|
|
63
63
|
privateGetContractPrivatePositionRisk(params?: {}): Promise<implicitReturnType>;
|
|
64
|
+
privateGetContractPrivateAffilateRebateList(params?: {}): Promise<implicitReturnType>;
|
|
65
|
+
privateGetContractPrivateAffilateTradeList(params?: {}): Promise<implicitReturnType>;
|
|
64
66
|
privatePostAccountSubAccountMainV1SubToMain(params?: {}): Promise<implicitReturnType>;
|
|
65
67
|
privatePostAccountSubAccountSubV1SubToMain(params?: {}): Promise<implicitReturnType>;
|
|
66
68
|
privatePostAccountSubAccountMainV1MainToSub(params?: {}): Promise<implicitReturnType>;
|
|
@@ -55,6 +55,7 @@ interface Exchange {
|
|
|
55
55
|
privatePostV1AccountCreate(params?: {}): Promise<implicitReturnType>;
|
|
56
56
|
privatePostV1AccountList(params?: {}): Promise<implicitReturnType>;
|
|
57
57
|
privatePostV1Heartbeat(params?: {}): Promise<implicitReturnType>;
|
|
58
|
+
privatePostV1Roles(params?: {}): Promise<implicitReturnType>;
|
|
58
59
|
}
|
|
59
60
|
declare abstract class Exchange extends _Exchange {
|
|
60
61
|
}
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -1985,7 +1985,7 @@ export default class Exchange {
|
|
|
1985
1985
|
}
|
|
1986
1986
|
async watchLiquidations(symbol, since = undefined, limit = undefined, params = {}) {
|
|
1987
1987
|
if (this.has['watchLiquidationsForSymbols']) {
|
|
1988
|
-
return this.watchLiquidationsForSymbols([symbol], since, limit, params);
|
|
1988
|
+
return await this.watchLiquidationsForSymbols([symbol], since, limit, params);
|
|
1989
1989
|
}
|
|
1990
1990
|
throw new NotSupported(this.id + ' watchLiquidations() is not supported yet');
|
|
1991
1991
|
}
|
package/js/src/bitmart.js
CHANGED
|
@@ -113,7 +113,8 @@ export default class bitmart extends Exchange {
|
|
|
113
113
|
'urls': {
|
|
114
114
|
'logo': 'https://user-images.githubusercontent.com/1294454/129991357-8f47464b-d0f4-41d6-8a82-34122f0d1398.jpg',
|
|
115
115
|
'api': {
|
|
116
|
-
'
|
|
116
|
+
'spot': 'https://api-cloud.{hostname}',
|
|
117
|
+
'swap': 'https://api-cloud-v2.{hostname}', // bitmart.info for Hong Kong users
|
|
117
118
|
},
|
|
118
119
|
'www': 'https://www.bitmart.com/',
|
|
119
120
|
'doc': 'https://developer-pro.bitmart.com/',
|
|
@@ -204,6 +205,8 @@ export default class bitmart extends Exchange {
|
|
|
204
205
|
'contract/private/current-plan-order': 1.2,
|
|
205
206
|
'contract/private/trades': 10,
|
|
206
207
|
'contract/private/position-risk': 10,
|
|
208
|
+
'contract/private/affilate/rebate-list': 10,
|
|
209
|
+
'contract/private/affilate/trade-list': 10,
|
|
207
210
|
},
|
|
208
211
|
'post': {
|
|
209
212
|
// sub-account endpoints
|
|
@@ -497,8 +500,8 @@ export default class bitmart extends Exchange {
|
|
|
497
500
|
'40045': InvalidOrder,
|
|
498
501
|
'40046': PermissionDenied,
|
|
499
502
|
'40047': PermissionDenied,
|
|
500
|
-
'40048':
|
|
501
|
-
'40049':
|
|
503
|
+
'40048': InvalidOrder,
|
|
504
|
+
'40049': InvalidOrder,
|
|
502
505
|
'40050': InvalidOrder, // 403, Client OrderId duplicated with existing orders
|
|
503
506
|
},
|
|
504
507
|
'broad': {},
|
|
@@ -870,36 +873,43 @@ export default class bitmart extends Exchange {
|
|
|
870
873
|
async fetchContractMarkets(params = {}) {
|
|
871
874
|
const response = await this.publicGetContractPublicDetails(params);
|
|
872
875
|
//
|
|
873
|
-
//
|
|
874
|
-
//
|
|
875
|
-
//
|
|
876
|
-
//
|
|
877
|
-
//
|
|
878
|
-
// "symbols": [
|
|
879
|
-
//
|
|
880
|
-
//
|
|
881
|
-
//
|
|
882
|
-
//
|
|
883
|
-
//
|
|
884
|
-
//
|
|
885
|
-
//
|
|
886
|
-
//
|
|
887
|
-
//
|
|
888
|
-
//
|
|
889
|
-
//
|
|
890
|
-
//
|
|
891
|
-
//
|
|
892
|
-
//
|
|
893
|
-
//
|
|
894
|
-
//
|
|
895
|
-
//
|
|
896
|
-
//
|
|
897
|
-
//
|
|
898
|
-
//
|
|
899
|
-
//
|
|
900
|
-
//
|
|
901
|
-
//
|
|
876
|
+
// {
|
|
877
|
+
// "code": 1000,
|
|
878
|
+
// "message": "Ok",
|
|
879
|
+
// "trace": "9b92a999-9463-4c96-91a4-93ad1cad0d72",
|
|
880
|
+
// "data": {
|
|
881
|
+
// "symbols": [
|
|
882
|
+
// {
|
|
883
|
+
// "symbol": "BTCUSDT",
|
|
884
|
+
// "product_type": 1,
|
|
885
|
+
// "open_timestamp": 1594080000,
|
|
886
|
+
// "expire_timestamp": 0,
|
|
887
|
+
// "settle_timestamp": 0,
|
|
888
|
+
// "base_currency": "BTC",
|
|
889
|
+
// "quote_currency": "USDT",
|
|
890
|
+
// "last_price": "23920",
|
|
891
|
+
// "volume_24h": "18969368",
|
|
892
|
+
// "turnover_24h": "458933659.7858",
|
|
893
|
+
// "index_price": "23945.25191635",
|
|
894
|
+
// "index_name": "BTCUSDT",
|
|
895
|
+
// "contract_size": "0.001",
|
|
896
|
+
// "min_leverage": "1",
|
|
897
|
+
// "max_leverage": "100",
|
|
898
|
+
// "price_precision": "0.1",
|
|
899
|
+
// "vol_precision": "1",
|
|
900
|
+
// "max_volume": "500000",
|
|
901
|
+
// "min_volume": "1",
|
|
902
|
+
// "funding_rate": "0.0001",
|
|
903
|
+
// "expected_funding_rate": "0.00011",
|
|
904
|
+
// "open_interest": "4134180870",
|
|
905
|
+
// "open_interest_value": "94100888927.0433258",
|
|
906
|
+
// "high_24h": "23900",
|
|
907
|
+
// "low_24h": "23100",
|
|
908
|
+
// "change_24h": "0.004"
|
|
909
|
+
// },
|
|
910
|
+
// ]
|
|
902
911
|
// }
|
|
912
|
+
// }
|
|
903
913
|
//
|
|
904
914
|
const data = this.safeValue(response, 'data', {});
|
|
905
915
|
const symbols = this.safeValue(data, 'symbols', []);
|
|
@@ -978,6 +988,7 @@ export default class bitmart extends Exchange {
|
|
|
978
988
|
/**
|
|
979
989
|
* @method
|
|
980
990
|
* @name bitmart#fetchMarkets
|
|
991
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
|
|
981
992
|
* @description retrieves data on all markets for bitmart
|
|
982
993
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
983
994
|
* @returns {object[]} an array of objects representing market data
|
|
@@ -1183,25 +1194,41 @@ export default class bitmart extends Exchange {
|
|
|
1183
1194
|
//
|
|
1184
1195
|
// swap
|
|
1185
1196
|
//
|
|
1186
|
-
//
|
|
1187
|
-
//
|
|
1188
|
-
//
|
|
1189
|
-
//
|
|
1190
|
-
//
|
|
1191
|
-
//
|
|
1192
|
-
//
|
|
1193
|
-
//
|
|
1194
|
-
//
|
|
1195
|
-
//
|
|
1196
|
-
//
|
|
1197
|
-
//
|
|
1197
|
+
// {
|
|
1198
|
+
// "symbol": "BTCUSDT",
|
|
1199
|
+
// "product_type": 1,
|
|
1200
|
+
// "open_timestamp": 1594080000,
|
|
1201
|
+
// "expire_timestamp": 0,
|
|
1202
|
+
// "settle_timestamp": 0,
|
|
1203
|
+
// "base_currency": "BTC",
|
|
1204
|
+
// "quote_currency": "USDT",
|
|
1205
|
+
// "last_price": "23920",
|
|
1206
|
+
// "volume_24h": "18969368",
|
|
1207
|
+
// "turnover_24h": "458933659.7858",
|
|
1208
|
+
// "index_price": "23945.25191635",
|
|
1209
|
+
// "index_name": "BTCUSDT",
|
|
1210
|
+
// "contract_size": "0.001",
|
|
1211
|
+
// "min_leverage": "1",
|
|
1212
|
+
// "max_leverage": "100",
|
|
1213
|
+
// "price_precision": "0.1",
|
|
1214
|
+
// "vol_precision": "1",
|
|
1215
|
+
// "max_volume": "500000",
|
|
1216
|
+
// "min_volume": "1",
|
|
1217
|
+
// "funding_rate": "0.0001",
|
|
1218
|
+
// "expected_funding_rate": "0.00011",
|
|
1219
|
+
// "open_interest": "4134180870",
|
|
1220
|
+
// "open_interest_value": "94100888927.0433258",
|
|
1221
|
+
// "high_24h": "23900",
|
|
1222
|
+
// "low_24h": "23100",
|
|
1223
|
+
// "change_24h": "0.004"
|
|
1224
|
+
// }
|
|
1198
1225
|
//
|
|
1199
1226
|
const result = this.safeList(ticker, 'result', []);
|
|
1200
1227
|
const average = this.safeString2(ticker, 'avg_price', 'index_price');
|
|
1201
1228
|
let marketId = this.safeString2(ticker, 'symbol', 'contract_symbol');
|
|
1202
1229
|
let timestamp = this.safeInteger2(ticker, 'timestamp', 'ts');
|
|
1203
1230
|
let last = this.safeString2(ticker, 'last_price', 'last');
|
|
1204
|
-
let percentage = this.
|
|
1231
|
+
let percentage = this.safeString2(ticker, 'price_change_percent_24h', 'change_24h');
|
|
1205
1232
|
let change = this.safeString(ticker, 'fluctuation');
|
|
1206
1233
|
let high = this.safeString2(ticker, 'high_24h', 'high_price');
|
|
1207
1234
|
let low = this.safeString2(ticker, 'low_24h', 'low_price');
|
|
@@ -1210,8 +1237,8 @@ export default class bitmart extends Exchange {
|
|
|
1210
1237
|
let ask = this.safeString2(ticker, 'best_ask', 'ask_px');
|
|
1211
1238
|
let askVolume = this.safeString2(ticker, 'best_ask_size', 'ask_sz');
|
|
1212
1239
|
let open = this.safeString(ticker, 'open_24h');
|
|
1213
|
-
let baseVolume = this.
|
|
1214
|
-
let quoteVolume = this.
|
|
1240
|
+
let baseVolume = this.safeStringN(ticker, ['base_volume_24h', 'v_24h', 'volume_24h']);
|
|
1241
|
+
let quoteVolume = this.safeStringLowerN(ticker, ['quote_volume_24h', 'qv_24h', 'turnover_24h']);
|
|
1215
1242
|
const listMarketId = this.safeString(result, 0);
|
|
1216
1243
|
if (listMarketId !== undefined) {
|
|
1217
1244
|
marketId = listMarketId;
|
|
@@ -1278,6 +1305,7 @@ export default class bitmart extends Exchange {
|
|
|
1278
1305
|
* @name bitmart#fetchTicker
|
|
1279
1306
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
1280
1307
|
* @see https://developer-pro.bitmart.com/en/spot/#get-ticker-of-a-trading-pair-v3
|
|
1308
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
|
|
1281
1309
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
1282
1310
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1283
1311
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -1287,8 +1315,8 @@ export default class bitmart extends Exchange {
|
|
|
1287
1315
|
const request = {};
|
|
1288
1316
|
let response = undefined;
|
|
1289
1317
|
if (market['swap']) {
|
|
1290
|
-
request['
|
|
1291
|
-
response = await this.
|
|
1318
|
+
request['symbol'] = market['id'];
|
|
1319
|
+
response = await this.publicGetContractPublicDetails(this.extend(request, params));
|
|
1292
1320
|
//
|
|
1293
1321
|
// {
|
|
1294
1322
|
// "message":"OK",
|
|
@@ -1343,7 +1371,6 @@ export default class bitmart extends Exchange {
|
|
|
1343
1371
|
throw new NotSupported(this.id + ' fetchTicker() does not support ' + market['type'] + ' markets, only spot and swap markets are accepted');
|
|
1344
1372
|
}
|
|
1345
1373
|
// fails in naming for contract tickers 'contract_symbol'
|
|
1346
|
-
let tickersById = undefined;
|
|
1347
1374
|
let tickers = [];
|
|
1348
1375
|
let ticker = {};
|
|
1349
1376
|
if (market['spot']) {
|
|
@@ -1351,9 +1378,8 @@ export default class bitmart extends Exchange {
|
|
|
1351
1378
|
}
|
|
1352
1379
|
else {
|
|
1353
1380
|
const data = this.safeDict(response, 'data', {});
|
|
1354
|
-
tickers = this.safeList(data, '
|
|
1355
|
-
|
|
1356
|
-
ticker = this.safeDict(tickersById, market['id']);
|
|
1381
|
+
tickers = this.safeList(data, 'symbols', []);
|
|
1382
|
+
ticker = this.safeValue(tickers, 0, {});
|
|
1357
1383
|
}
|
|
1358
1384
|
return this.parseTicker(ticker, market);
|
|
1359
1385
|
}
|
|
@@ -1363,6 +1389,7 @@ export default class bitmart extends Exchange {
|
|
|
1363
1389
|
* @name bitmart#fetchTickers
|
|
1364
1390
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
1365
1391
|
* @see https://developer-pro.bitmart.com/en/spot/#get-ticker-of-all-pairs-v3
|
|
1392
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-contract-details
|
|
1366
1393
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
1367
1394
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1368
1395
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -1405,29 +1432,45 @@ export default class bitmart extends Exchange {
|
|
|
1405
1432
|
//
|
|
1406
1433
|
}
|
|
1407
1434
|
else if (type === 'swap') {
|
|
1408
|
-
response = await this.
|
|
1435
|
+
response = await this.publicGetContractPublicDetails(params);
|
|
1409
1436
|
//
|
|
1410
|
-
//
|
|
1411
|
-
//
|
|
1412
|
-
//
|
|
1413
|
-
//
|
|
1414
|
-
//
|
|
1415
|
-
//
|
|
1416
|
-
//
|
|
1417
|
-
//
|
|
1418
|
-
//
|
|
1419
|
-
//
|
|
1420
|
-
//
|
|
1421
|
-
//
|
|
1422
|
-
//
|
|
1423
|
-
//
|
|
1424
|
-
//
|
|
1425
|
-
//
|
|
1426
|
-
//
|
|
1427
|
-
//
|
|
1428
|
-
//
|
|
1429
|
-
//
|
|
1430
|
-
//
|
|
1437
|
+
// {
|
|
1438
|
+
// "code": 1000,
|
|
1439
|
+
// "message": "Ok",
|
|
1440
|
+
// "trace": "9b92a999-9463-4c96-91a4-93ad1cad0d72",
|
|
1441
|
+
// "data": {
|
|
1442
|
+
// "symbols": [
|
|
1443
|
+
// {
|
|
1444
|
+
// "symbol": "BTCUSDT",
|
|
1445
|
+
// "product_type": 1,
|
|
1446
|
+
// "open_timestamp": 1594080000,
|
|
1447
|
+
// "expire_timestamp": 0,
|
|
1448
|
+
// "settle_timestamp": 0,
|
|
1449
|
+
// "base_currency": "BTC",
|
|
1450
|
+
// "quote_currency": "USDT",
|
|
1451
|
+
// "last_price": "23920",
|
|
1452
|
+
// "volume_24h": "18969368",
|
|
1453
|
+
// "turnover_24h": "458933659.7858",
|
|
1454
|
+
// "index_price": "23945.25191635",
|
|
1455
|
+
// "index_name": "BTCUSDT",
|
|
1456
|
+
// "contract_size": "0.001",
|
|
1457
|
+
// "min_leverage": "1",
|
|
1458
|
+
// "max_leverage": "100",
|
|
1459
|
+
// "price_precision": "0.1",
|
|
1460
|
+
// "vol_precision": "1",
|
|
1461
|
+
// "max_volume": "500000",
|
|
1462
|
+
// "min_volume": "1",
|
|
1463
|
+
// "funding_rate": "0.0001",
|
|
1464
|
+
// "expected_funding_rate": "0.00011",
|
|
1465
|
+
// "open_interest": "4134180870",
|
|
1466
|
+
// "open_interest_value": "94100888927.0433258",
|
|
1467
|
+
// "high_24h": "23900",
|
|
1468
|
+
// "low_24h": "23100",
|
|
1469
|
+
// "change_24h": "0.004"
|
|
1470
|
+
// },
|
|
1471
|
+
// ]
|
|
1472
|
+
// }
|
|
1473
|
+
// }
|
|
1431
1474
|
//
|
|
1432
1475
|
}
|
|
1433
1476
|
else {
|
|
@@ -1439,7 +1482,7 @@ export default class bitmart extends Exchange {
|
|
|
1439
1482
|
}
|
|
1440
1483
|
else {
|
|
1441
1484
|
const data = this.safeDict(response, 'data', {});
|
|
1442
|
-
tickers = this.safeList(data, '
|
|
1485
|
+
tickers = this.safeList(data, 'symbols', []);
|
|
1443
1486
|
}
|
|
1444
1487
|
const result = {};
|
|
1445
1488
|
for (let i = 0; i < tickers.length; i++) {
|
|
@@ -1462,6 +1505,7 @@ export default class bitmart extends Exchange {
|
|
|
1462
1505
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
1463
1506
|
* @see https://developer-pro.bitmart.com/en/spot/#get-depth-v3
|
|
1464
1507
|
* @see https://developer-pro.bitmart.com/en/futures/#get-market-depth
|
|
1508
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-market-depth
|
|
1465
1509
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
1466
1510
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
1467
1511
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -1753,7 +1797,7 @@ export default class bitmart extends Exchange {
|
|
|
1753
1797
|
* @name bitmart#fetchOHLCV
|
|
1754
1798
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
1755
1799
|
* @see https://developer-pro.bitmart.com/en/spot/#get-history-k-line-v3
|
|
1756
|
-
* @see https://developer-pro.bitmart.com/en/
|
|
1800
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-k-line
|
|
1757
1801
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
1758
1802
|
* @param {string} timeframe the length of time each candle represents
|
|
1759
1803
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -2050,6 +2094,7 @@ export default class bitmart extends Exchange {
|
|
|
2050
2094
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
2051
2095
|
* @see https://developer-pro.bitmart.com/en/spot/#get-spot-wallet-balance
|
|
2052
2096
|
* @see https://developer-pro.bitmart.com/en/futures/#get-contract-assets-detail
|
|
2097
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-contract-assets-keyed
|
|
2053
2098
|
* @see https://developer-pro.bitmart.com/en/spot/#get-account-balance
|
|
2054
2099
|
* @see https://developer-pro.bitmart.com/en/spot/#get-margin-account-details-isolated
|
|
2055
2100
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -2419,6 +2464,8 @@ export default class bitmart extends Exchange {
|
|
|
2419
2464
|
* @see https://developer-pro.bitmart.com/en/spot/#place-margin-order
|
|
2420
2465
|
* @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
|
2421
2466
|
* @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
|
2467
|
+
* @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
|
|
2468
|
+
* @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
|
|
2422
2469
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
2423
2470
|
* @param {string} type 'market', 'limit' or 'trailing' for swap markets only
|
|
2424
2471
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -2667,9 +2714,11 @@ export default class bitmart extends Exchange {
|
|
|
2667
2714
|
params = this.omit(params, 'clientOrderId');
|
|
2668
2715
|
request['client_order_id'] = clientOrderId;
|
|
2669
2716
|
}
|
|
2670
|
-
const leverage = this.safeInteger(params, 'leverage'
|
|
2717
|
+
const leverage = this.safeInteger(params, 'leverage');
|
|
2671
2718
|
params = this.omit(params, ['timeInForce', 'postOnly', 'reduceOnly', 'leverage', 'trailingTriggerPrice', 'trailingPercent', 'triggerPrice', 'stopPrice']);
|
|
2672
|
-
|
|
2719
|
+
if (leverage !== undefined) {
|
|
2720
|
+
request['leverage'] = this.numberToString(leverage);
|
|
2721
|
+
}
|
|
2673
2722
|
return this.extend(request, params);
|
|
2674
2723
|
}
|
|
2675
2724
|
createSpotOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
@@ -2760,6 +2809,8 @@ export default class bitmart extends Exchange {
|
|
|
2760
2809
|
* @see https://developer-pro.bitmart.com/en/spot/#cancel-order-v3-signed
|
|
2761
2810
|
* @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
|
|
2762
2811
|
* @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
|
|
2812
|
+
* @see https://developer-pro.bitmart.com/en/futures/#cancel-order-signed
|
|
2813
|
+
* @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
|
|
2763
2814
|
* @param {string} id order id
|
|
2764
2815
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
2765
2816
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -2912,6 +2963,7 @@ export default class bitmart extends Exchange {
|
|
|
2912
2963
|
* @description cancel all open orders in a market
|
|
2913
2964
|
* @see https://developer-pro.bitmart.com/en/spot/#cancel-all-orders
|
|
2914
2965
|
* @see https://developer-pro.bitmart.com/en/futures/#cancel-all-orders-signed
|
|
2966
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#cancel-all-orders-signed
|
|
2915
2967
|
* @param {string} symbol unified market symbol of the market to cancel orders in
|
|
2916
2968
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2917
2969
|
* @param {string} [params.side] *spot only* 'buy' or 'sell'
|
|
@@ -3150,6 +3202,7 @@ export default class bitmart extends Exchange {
|
|
|
3150
3202
|
* @name bitmart#fetchClosedOrders
|
|
3151
3203
|
* @see https://developer-pro.bitmart.com/en/spot/#account-orders-v4-signed
|
|
3152
3204
|
* @see https://developer-pro.bitmart.com/en/futures/#get-order-history-keyed
|
|
3205
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-order-history-keyed
|
|
3153
3206
|
* @description fetches information on multiple closed orders made by the user
|
|
3154
3207
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
3155
3208
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -3219,6 +3272,7 @@ export default class bitmart extends Exchange {
|
|
|
3219
3272
|
* @see https://developer-pro.bitmart.com/en/spot/#query-order-by-id-v4-signed
|
|
3220
3273
|
* @see https://developer-pro.bitmart.com/en/spot/#query-order-by-clientorderid-v4-signed
|
|
3221
3274
|
* @see https://developer-pro.bitmart.com/en/futures/#get-order-detail-keyed
|
|
3275
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-order-detail-keyed
|
|
3222
3276
|
* @param {string} id the id of the order
|
|
3223
3277
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
3224
3278
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -3952,6 +4006,7 @@ export default class bitmart extends Exchange {
|
|
|
3952
4006
|
* @description transfer currency internally between wallets on the same account, currently only supports transfer between spot and margin
|
|
3953
4007
|
* @see https://developer-pro.bitmart.com/en/spot/#margin-asset-transfer-signed
|
|
3954
4008
|
* @see https://developer-pro.bitmart.com/en/futures/#transfer-signed
|
|
4009
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#transfer-signed
|
|
3955
4010
|
* @param {string} code unified currency code
|
|
3956
4011
|
* @param {float} amount amount to transfer
|
|
3957
4012
|
* @param {string} fromAccount account to transfer from
|
|
@@ -4236,7 +4291,7 @@ export default class bitmart extends Exchange {
|
|
|
4236
4291
|
* @method
|
|
4237
4292
|
* @name bitmart#fetchOpenInterest
|
|
4238
4293
|
* @description Retrieves the open interest of a currency
|
|
4239
|
-
* @see https://developer-pro.bitmart.com/en/
|
|
4294
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-futures-openinterest
|
|
4240
4295
|
* @param {string} symbol Unified CCXT market symbol
|
|
4241
4296
|
* @param {object} [params] exchange specific parameters
|
|
4242
4297
|
* @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
@@ -4292,6 +4347,7 @@ export default class bitmart extends Exchange {
|
|
|
4292
4347
|
* @name bitmart#setLeverage
|
|
4293
4348
|
* @description set the level of leverage for a market
|
|
4294
4349
|
* @see https://developer-pro.bitmart.com/en/futures/#submit-leverage-signed
|
|
4350
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#submit-leverage-signed
|
|
4295
4351
|
* @param {float} leverage the rate of leverage
|
|
4296
4352
|
* @param {string} symbol unified market symbol
|
|
4297
4353
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -4321,7 +4377,7 @@ export default class bitmart extends Exchange {
|
|
|
4321
4377
|
* @method
|
|
4322
4378
|
* @name bitmart#fetchFundingRate
|
|
4323
4379
|
* @description fetch the current funding rate
|
|
4324
|
-
* @see https://developer-pro.bitmart.com/en/
|
|
4380
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-funding-rate
|
|
4325
4381
|
* @param {string} symbol unified market symbol
|
|
4326
4382
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4327
4383
|
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
@@ -4388,6 +4444,7 @@ export default class bitmart extends Exchange {
|
|
|
4388
4444
|
* @name bitmart#fetchPosition
|
|
4389
4445
|
* @description fetch data on a single open contract trade position
|
|
4390
4446
|
* @see https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
|
|
4447
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-risk-details-keyed
|
|
4391
4448
|
* @param {string} symbol unified market symbol of the market the position is held in
|
|
4392
4449
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4393
4450
|
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
@@ -4437,6 +4494,7 @@ export default class bitmart extends Exchange {
|
|
|
4437
4494
|
* @name bitmart#fetchPositions
|
|
4438
4495
|
* @description fetch all open contract positions
|
|
4439
4496
|
* @see https://developer-pro.bitmart.com/en/futures/#get-current-position-keyed
|
|
4497
|
+
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-current-position-risk-details-keyed
|
|
4440
4498
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
4441
4499
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4442
4500
|
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
@@ -4663,7 +4721,11 @@ export default class bitmart extends Exchange {
|
|
|
4663
4721
|
return this.milliseconds();
|
|
4664
4722
|
}
|
|
4665
4723
|
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
4666
|
-
const
|
|
4724
|
+
const parts = path.split('/');
|
|
4725
|
+
// to do: refactor api endpoints with spot/swap sections
|
|
4726
|
+
const category = this.safeString(parts, 0, 'spot');
|
|
4727
|
+
const market = (category === 'spot' || category === 'account') ? 'spot' : 'swap';
|
|
4728
|
+
const baseUrl = this.implodeHostname(this.urls['api'][market]);
|
|
4667
4729
|
let url = baseUrl + '/' + this.implodeParams(path, params);
|
|
4668
4730
|
const query = this.omit(params, this.extractParams(path));
|
|
4669
4731
|
let queryString = '';
|
package/js/src/coinbase.js
CHANGED
|
@@ -270,8 +270,8 @@ export default class coinbase extends Exchange {
|
|
|
270
270
|
},
|
|
271
271
|
'fees': {
|
|
272
272
|
'trading': {
|
|
273
|
-
'taker': this.parseNumber('0.
|
|
274
|
-
'maker': this.parseNumber('0.
|
|
273
|
+
'taker': this.parseNumber('0.012'),
|
|
274
|
+
'maker': this.parseNumber('0.006'),
|
|
275
275
|
'tierBased': true,
|
|
276
276
|
'percentage': true,
|
|
277
277
|
'tiers': {
|
|
@@ -1376,6 +1376,10 @@ export default class coinbase extends Exchange {
|
|
|
1376
1376
|
const marketType = this.safeStringLower(market, 'product_type');
|
|
1377
1377
|
const tradingDisabled = this.safeBool(market, 'trading_disabled');
|
|
1378
1378
|
const stablePairs = this.safeList(this.options, 'stablePairs', []);
|
|
1379
|
+
const defaultTakerFee = this.safeNumber(this.fees['trading'], 'taker');
|
|
1380
|
+
const defaultMakerFee = this.safeNumber(this.fees['trading'], 'maker');
|
|
1381
|
+
const takerFee = this.inArray(id, stablePairs) ? 0.00001 : this.safeNumber(feeTier, 'taker_fee_rate', defaultTakerFee);
|
|
1382
|
+
const makerFee = this.inArray(id, stablePairs) ? 0.0 : this.safeNumber(feeTier, 'maker_fee_rate', defaultMakerFee);
|
|
1379
1383
|
return this.safeMarketStructure({
|
|
1380
1384
|
'id': id,
|
|
1381
1385
|
'symbol': base + '/' + quote,
|
|
@@ -1395,8 +1399,8 @@ export default class coinbase extends Exchange {
|
|
|
1395
1399
|
'contract': false,
|
|
1396
1400
|
'linear': undefined,
|
|
1397
1401
|
'inverse': undefined,
|
|
1398
|
-
'taker':
|
|
1399
|
-
'maker':
|
|
1402
|
+
'taker': takerFee,
|
|
1403
|
+
'maker': makerFee,
|
|
1400
1404
|
'contractSize': undefined,
|
|
1401
1405
|
'expiry': undefined,
|
|
1402
1406
|
'expiryDatetime': undefined,
|