ccxt 4.2.74 → 4.2.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/CHANGELOG.md +206 -10
- package/README.md +10 -9
- package/build.sh +1 -1
- package/dist/ccxt.browser.js +900 -217
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +4 -1
- package/dist/cjs/src/abstract/tradeogre.js +9 -0
- package/dist/cjs/src/ascendex.js +3 -2
- package/dist/cjs/src/binance.js +2 -0
- package/dist/cjs/src/bingx.js +12 -14
- package/dist/cjs/src/bitmart.js +1 -0
- package/dist/cjs/src/bybit.js +2 -1
- package/dist/cjs/src/coinbase.js +18 -2
- package/dist/cjs/src/coinbaseinternational.js +1 -1
- package/dist/cjs/src/coinex.js +4 -3
- package/dist/cjs/src/gate.js +2 -0
- package/dist/cjs/src/htx.js +1 -0
- package/dist/cjs/src/kraken.js +3 -3
- package/dist/cjs/src/kucoin.js +1 -1
- package/dist/cjs/src/pro/coinbaseinternational.js +1 -1
- package/dist/cjs/src/tradeogre.js +632 -0
- package/js/ccxt.d.ts +5 -2
- package/js/ccxt.js +4 -2
- package/js/src/abstract/binance.d.ts +1 -0
- package/js/src/abstract/binancecoinm.d.ts +1 -0
- package/js/src/abstract/binanceus.d.ts +1 -0
- package/js/src/abstract/binanceusdm.d.ts +1 -0
- package/js/src/abstract/bingx.d.ts +2 -0
- package/js/src/abstract/tradeogre.d.ts +19 -0
- package/js/src/abstract/tradeogre.js +11 -0
- package/js/src/ascendex.d.ts +2 -7
- package/js/src/ascendex.js +3 -2
- package/js/src/base/Exchange.d.ts +5 -5
- package/js/src/base/types.d.ts +7 -1
- package/js/src/binance.d.ts +1 -1
- package/js/src/binance.js +2 -0
- package/js/src/bingx.js +12 -14
- package/js/src/bitmart.d.ts +1 -1
- package/js/src/bitmart.js +2 -1
- package/js/src/bybit.js +2 -1
- package/js/src/coinbase.d.ts +4 -4
- package/js/src/coinbase.js +18 -2
- package/js/src/coinbaseinternational.d.ts +1 -1
- package/js/src/coinbaseinternational.js +1 -1
- package/js/src/coinbasepro.d.ts +2 -2
- package/js/src/coinex.js +4 -3
- package/js/src/coinlist.d.ts +2 -2
- package/js/src/cryptocom.d.ts +2 -2
- package/js/src/currencycom.d.ts +2 -2
- package/js/src/deribit.d.ts +2 -2
- package/js/src/gate.d.ts +1 -1
- package/js/src/gate.js +2 -0
- package/js/src/htx.d.ts +2 -2
- package/js/src/htx.js +1 -0
- package/js/src/huobijp.d.ts +2 -2
- package/js/src/kraken.d.ts +1 -1
- package/js/src/kraken.js +3 -3
- package/js/src/kucoin.d.ts +3 -3
- package/js/src/kucoin.js +1 -1
- package/js/src/luno.d.ts +2 -2
- package/js/src/mexc.d.ts +3 -3
- package/js/src/ndax.d.ts +2 -2
- package/js/src/novadax.d.ts +2 -2
- package/js/src/okx.d.ts +2 -2
- package/js/src/pro/bitfinex2.d.ts +1 -1
- package/js/src/pro/coinbaseinternational.js +1 -1
- package/js/src/tradeogre.d.ts +32 -0
- package/js/src/tradeogre.js +633 -0
- package/js/src/woo.d.ts +2 -2
- package/package.json +1 -1
- package/skip-tests.json +5 -0
|
@@ -0,0 +1,632 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tradeogre$1 = require('./abstract/tradeogre.js');
|
|
4
|
+
var errors = require('./base/errors.js');
|
|
5
|
+
var number = require('./base/functions/number.js');
|
|
6
|
+
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
/**
|
|
10
|
+
* @class tradeogre
|
|
11
|
+
* @augments Exchange
|
|
12
|
+
*/
|
|
13
|
+
class tradeogre extends tradeogre$1 {
|
|
14
|
+
describe() {
|
|
15
|
+
return this.deepExtend(super.describe(), {
|
|
16
|
+
'id': 'tradeogre',
|
|
17
|
+
'name': 'tradeogre',
|
|
18
|
+
'countries': [],
|
|
19
|
+
'rateLimit': 100,
|
|
20
|
+
'version': 'v2',
|
|
21
|
+
'pro': false,
|
|
22
|
+
'has': {
|
|
23
|
+
'CORS': undefined,
|
|
24
|
+
'spot': true,
|
|
25
|
+
'margin': false,
|
|
26
|
+
'swap': false,
|
|
27
|
+
'future': false,
|
|
28
|
+
'option': false,
|
|
29
|
+
'addMargin': false,
|
|
30
|
+
'cancelAllOrders': true,
|
|
31
|
+
'cancelOrder': true,
|
|
32
|
+
'cancelOrders': false,
|
|
33
|
+
'closeAllPositions': false,
|
|
34
|
+
'closePosition': false,
|
|
35
|
+
'createDepositAddress': false,
|
|
36
|
+
'createMarketOrder': false,
|
|
37
|
+
'createOrder': true,
|
|
38
|
+
'createOrders': false,
|
|
39
|
+
'createPostOnlyOrder': false,
|
|
40
|
+
'createReduceOnlyOrder': false,
|
|
41
|
+
'createStopLimitOrder': false,
|
|
42
|
+
'createStopMarketOrder': false,
|
|
43
|
+
'createStopOrder': false,
|
|
44
|
+
'fetchAccounts': false,
|
|
45
|
+
'fetchBalance': true,
|
|
46
|
+
'fetchBorrowInterest': false,
|
|
47
|
+
'fetchBorrowRateHistory': false,
|
|
48
|
+
'fetchClosedOrders': false,
|
|
49
|
+
'fetchCrossBorrowRate': false,
|
|
50
|
+
'fetchCrossBorrowRates': false,
|
|
51
|
+
'fetchDeposit': false,
|
|
52
|
+
'fetchDepositAddress': false,
|
|
53
|
+
'fetchDepositAddresses': false,
|
|
54
|
+
'fetchDepositAddressesByNetwork': false,
|
|
55
|
+
'fetchDeposits': false,
|
|
56
|
+
'fetchDepositsWithdrawals': false,
|
|
57
|
+
'fetchFundingHistory': false,
|
|
58
|
+
'fetchFundingRate': false,
|
|
59
|
+
'fetchFundingRateHistory': false,
|
|
60
|
+
'fetchFundingRates': false,
|
|
61
|
+
'fetchIndexOHLCV': false,
|
|
62
|
+
'fetchIsolatedBorrowRate': false,
|
|
63
|
+
'fetchIsolatedBorrowRates': false,
|
|
64
|
+
'fetchLedger': false,
|
|
65
|
+
'fetchLedgerEntry': false,
|
|
66
|
+
'fetchLeverageTiers': false,
|
|
67
|
+
'fetchMarketLeverageTiers': false,
|
|
68
|
+
'fetchMarkets': true,
|
|
69
|
+
'fetchMarkOHLCV': false,
|
|
70
|
+
'fetchMyTrades': false,
|
|
71
|
+
'fetchOHLCV': false,
|
|
72
|
+
'fetchOpenInterest': false,
|
|
73
|
+
'fetchOpenInterestHistory': false,
|
|
74
|
+
'fetchOpenOrders': true,
|
|
75
|
+
'fetchOrder': true,
|
|
76
|
+
'fetchOrderBook': true,
|
|
77
|
+
'fetchOrderBooks': false,
|
|
78
|
+
'fetchOrders': false,
|
|
79
|
+
'fetchOrderTrades': false,
|
|
80
|
+
'fetchPermissions': false,
|
|
81
|
+
'fetchPosition': false,
|
|
82
|
+
'fetchPositions': false,
|
|
83
|
+
'fetchPositionsForSymbol': false,
|
|
84
|
+
'fetchPositionsRisk': false,
|
|
85
|
+
'fetchPremiumIndexOHLCV': false,
|
|
86
|
+
'fetchTicker': true,
|
|
87
|
+
'fetchTickers': false,
|
|
88
|
+
'fetchTrades': true,
|
|
89
|
+
'fetchTradingLimits': false,
|
|
90
|
+
'fetchTransactionFee': false,
|
|
91
|
+
'fetchTransactionFees': false,
|
|
92
|
+
'fetchTransactions': false,
|
|
93
|
+
'fetchTransfers': false,
|
|
94
|
+
'fetchWithdrawAddresses': false,
|
|
95
|
+
'fetchWithdrawal': false,
|
|
96
|
+
'fetchWithdrawals': false,
|
|
97
|
+
'reduceMargin': false,
|
|
98
|
+
'setLeverage': false,
|
|
99
|
+
'setMargin': false,
|
|
100
|
+
'setMarginMode': false,
|
|
101
|
+
'setPositionMode': false,
|
|
102
|
+
'signIn': false,
|
|
103
|
+
'transfer': false,
|
|
104
|
+
'withdraw': false,
|
|
105
|
+
},
|
|
106
|
+
'urls': {
|
|
107
|
+
'referral': '',
|
|
108
|
+
'logo': 'https://github.com/ccxt/ccxt/assets/43336371/3aa748b7-ea44-45e9-a9e7-b1d207a2578a',
|
|
109
|
+
'api': {
|
|
110
|
+
'rest': 'https://tradeogre.com/api/v1',
|
|
111
|
+
},
|
|
112
|
+
'www': 'https://tradeogre.com',
|
|
113
|
+
'doc': 'https://tradeogre.com/help/api',
|
|
114
|
+
'fees': 'https://tradeogre.com/help/fees',
|
|
115
|
+
},
|
|
116
|
+
'fees': {
|
|
117
|
+
'trading': {
|
|
118
|
+
'maker': this.parseNumber('0.002'),
|
|
119
|
+
'taker': this.parseNumber('0.002'),
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
'api': {
|
|
123
|
+
'public': {
|
|
124
|
+
'get': {
|
|
125
|
+
'markets': 1,
|
|
126
|
+
'orders/{market}': 1,
|
|
127
|
+
'ticker/{market}': 1,
|
|
128
|
+
'history/{market}': 1,
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
'private': {
|
|
132
|
+
'get': {
|
|
133
|
+
'account/balance': 1,
|
|
134
|
+
'account/balances': 1,
|
|
135
|
+
'account/order/{uuid}': 1,
|
|
136
|
+
},
|
|
137
|
+
'post': {
|
|
138
|
+
'order/buy': 1,
|
|
139
|
+
'order/sell': 1,
|
|
140
|
+
'order/cancel': 1,
|
|
141
|
+
'orders': 1,
|
|
142
|
+
'account/orders': 1,
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
'commonCurrencies': {},
|
|
147
|
+
'precisionMode': number.TICK_SIZE,
|
|
148
|
+
'exceptions': {
|
|
149
|
+
'exact': {
|
|
150
|
+
'Must be authorized': errors.AuthenticationError,
|
|
151
|
+
'Market not found': errors.BadRequest,
|
|
152
|
+
'Insufficient funds': errors.InsufficientFunds,
|
|
153
|
+
'Order not found': errors.BadRequest,
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
'options': {},
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
async fetchMarkets(params = {}) {
|
|
160
|
+
/**
|
|
161
|
+
* @method
|
|
162
|
+
* @name tradeogre#fetchMarkets
|
|
163
|
+
* @description retrieves data on all markets for bigone
|
|
164
|
+
* @see https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md#markets
|
|
165
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
166
|
+
* @returns {object[]} an array of objects representing market data
|
|
167
|
+
*/
|
|
168
|
+
const response = await this.publicGetMarkets(params);
|
|
169
|
+
//
|
|
170
|
+
// [
|
|
171
|
+
// {
|
|
172
|
+
// "AEON-BTC": {
|
|
173
|
+
// "initialprice": "0.00022004",
|
|
174
|
+
// "price": "0.00025992",
|
|
175
|
+
// "high": "0.00025992",
|
|
176
|
+
// "low": "0.00022003",
|
|
177
|
+
// "volume": "0.00359066",
|
|
178
|
+
// "bid": "0.00022456",
|
|
179
|
+
// "ask": "0.00025993"
|
|
180
|
+
// }
|
|
181
|
+
// }
|
|
182
|
+
// ]
|
|
183
|
+
//
|
|
184
|
+
const result = [];
|
|
185
|
+
for (let i = 0; i < response.length; i++) {
|
|
186
|
+
const rawMarket = response[i];
|
|
187
|
+
const keys = Object.keys(rawMarket);
|
|
188
|
+
const id = this.safeString(keys, 0);
|
|
189
|
+
const keyParts = id.split('-');
|
|
190
|
+
const baseId = this.safeString(keyParts, 0);
|
|
191
|
+
const quoteId = this.safeString(keyParts, 1);
|
|
192
|
+
const base = this.safeCurrencyCode(baseId);
|
|
193
|
+
const quote = this.safeCurrencyCode(quoteId);
|
|
194
|
+
const market = this.safeMarketStructure({
|
|
195
|
+
'id': id,
|
|
196
|
+
'symbol': base + '/' + quote,
|
|
197
|
+
'base': base,
|
|
198
|
+
'quote': quote,
|
|
199
|
+
'settle': undefined,
|
|
200
|
+
'baseId': baseId,
|
|
201
|
+
'quoteId': quoteId,
|
|
202
|
+
'settleId': undefined,
|
|
203
|
+
'type': 'spot',
|
|
204
|
+
'spot': true,
|
|
205
|
+
'margin': false,
|
|
206
|
+
'swap': false,
|
|
207
|
+
'future': false,
|
|
208
|
+
'option': false,
|
|
209
|
+
'active': true,
|
|
210
|
+
'contract': false,
|
|
211
|
+
'linear': undefined,
|
|
212
|
+
'inverse': undefined,
|
|
213
|
+
'contractSize': undefined,
|
|
214
|
+
'taker': this.fees['trading']['taker'],
|
|
215
|
+
'maker': this.fees['trading']['taker'],
|
|
216
|
+
'expiry': undefined,
|
|
217
|
+
'expiryDatetime': undefined,
|
|
218
|
+
'strike': undefined,
|
|
219
|
+
'optionType': undefined,
|
|
220
|
+
'precision': {
|
|
221
|
+
'amount': this.parseNumber(this.parsePrecision('8')),
|
|
222
|
+
'price': this.parseNumber(this.parsePrecision('8')), // they're not explicit about it
|
|
223
|
+
},
|
|
224
|
+
'limits': {
|
|
225
|
+
'leverage': {
|
|
226
|
+
'min': undefined,
|
|
227
|
+
'max': undefined,
|
|
228
|
+
},
|
|
229
|
+
'amount': {
|
|
230
|
+
'min': undefined,
|
|
231
|
+
'max': undefined,
|
|
232
|
+
},
|
|
233
|
+
'price': {
|
|
234
|
+
'min': undefined,
|
|
235
|
+
'max': undefined,
|
|
236
|
+
},
|
|
237
|
+
'cost': {
|
|
238
|
+
'min': undefined,
|
|
239
|
+
'max': undefined,
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
'created': undefined,
|
|
243
|
+
'info': rawMarket,
|
|
244
|
+
});
|
|
245
|
+
result.push(market);
|
|
246
|
+
}
|
|
247
|
+
return result;
|
|
248
|
+
}
|
|
249
|
+
async fetchTicker(symbol, params = {}) {
|
|
250
|
+
/**
|
|
251
|
+
* @method
|
|
252
|
+
* @name tradeogre#fetchTicker
|
|
253
|
+
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
254
|
+
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
255
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
256
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
257
|
+
*/
|
|
258
|
+
await this.loadMarkets();
|
|
259
|
+
const market = this.market(symbol);
|
|
260
|
+
const request = {
|
|
261
|
+
'market': market['id'],
|
|
262
|
+
};
|
|
263
|
+
const response = await this.publicGetTickerMarket(this.extend(request, params));
|
|
264
|
+
//
|
|
265
|
+
// {
|
|
266
|
+
// "success":true,
|
|
267
|
+
// "initialprice":"0.02502002",
|
|
268
|
+
// "price":"0.02500000",
|
|
269
|
+
// "high":"0.03102001",
|
|
270
|
+
// "low":"0.02500000",
|
|
271
|
+
// "volume":"0.15549958",
|
|
272
|
+
// "bid":"0.02420000",
|
|
273
|
+
// "ask":"0.02625000"
|
|
274
|
+
// }
|
|
275
|
+
//
|
|
276
|
+
return this.parseTicker(response, market);
|
|
277
|
+
}
|
|
278
|
+
parseTicker(ticker, market = undefined) {
|
|
279
|
+
//
|
|
280
|
+
// {
|
|
281
|
+
// "success":true,
|
|
282
|
+
// "initialprice":"0.02502002",
|
|
283
|
+
// "price":"0.02500000",
|
|
284
|
+
// "high":"0.03102001",
|
|
285
|
+
// "low":"0.02500000",
|
|
286
|
+
// "volume":"0.15549958",
|
|
287
|
+
// "bid":"0.02420000",
|
|
288
|
+
// "ask":"0.02625000"
|
|
289
|
+
// }
|
|
290
|
+
//
|
|
291
|
+
return this.safeTicker({
|
|
292
|
+
'symbol': this.safeString(market, 'symbol'),
|
|
293
|
+
'timestamp': undefined,
|
|
294
|
+
'datetime': undefined,
|
|
295
|
+
'high': this.safeString(ticker, 'high'),
|
|
296
|
+
'low': this.safeString(ticker, 'low'),
|
|
297
|
+
'bid': this.safeString(ticker, 'bid'),
|
|
298
|
+
'bidVolume': undefined,
|
|
299
|
+
'ask': this.safeString(ticker, 'ask'),
|
|
300
|
+
'askVolume': undefined,
|
|
301
|
+
'vwap': undefined,
|
|
302
|
+
'open': this.safeString(ticker, 'open'),
|
|
303
|
+
'close': undefined,
|
|
304
|
+
'last': undefined,
|
|
305
|
+
'previousClose': undefined,
|
|
306
|
+
'change': undefined,
|
|
307
|
+
'percentage': undefined,
|
|
308
|
+
'average': undefined,
|
|
309
|
+
'baseVolume': this.safeString(ticker, 'volume'),
|
|
310
|
+
'quoteVolume': undefined,
|
|
311
|
+
'info': ticker,
|
|
312
|
+
}, market);
|
|
313
|
+
}
|
|
314
|
+
async fetchOrderBook(symbol, limit = undefined, params = {}) {
|
|
315
|
+
/**
|
|
316
|
+
* @method
|
|
317
|
+
* @name tradeogre#fetchOrderBook
|
|
318
|
+
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
319
|
+
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
320
|
+
* @param {int} [limit] the maximum amount of order book entries to return
|
|
321
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
322
|
+
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
323
|
+
*/
|
|
324
|
+
await this.loadMarkets();
|
|
325
|
+
const market = this.market(symbol);
|
|
326
|
+
const request = {
|
|
327
|
+
'market': market['id'],
|
|
328
|
+
};
|
|
329
|
+
const response = await this.publicGetOrdersMarket(this.extend(request, params));
|
|
330
|
+
//
|
|
331
|
+
// {
|
|
332
|
+
// "success": true,
|
|
333
|
+
// "buy": {
|
|
334
|
+
// "0.02425501": "36.46986607",
|
|
335
|
+
// "0.02425502": "93.64201137",
|
|
336
|
+
// "0.02425503": "19.02000000",
|
|
337
|
+
// "0.02425515": "115.49000000"
|
|
338
|
+
// }
|
|
339
|
+
//
|
|
340
|
+
const rawBids = this.safeDict(response, 'buy', {});
|
|
341
|
+
const rawAsks = this.safeDict(response, 'sell', {});
|
|
342
|
+
const rawOrderbook = {
|
|
343
|
+
'bids': rawBids,
|
|
344
|
+
'asks': rawAsks,
|
|
345
|
+
};
|
|
346
|
+
const orderbook = this.parseOrderBook(rawOrderbook, symbol);
|
|
347
|
+
return orderbook;
|
|
348
|
+
}
|
|
349
|
+
parseBidsAsks(bidasks, priceKey = 0, amountKey = 1, countOrIdKey = 2) {
|
|
350
|
+
const prices = Object.keys(bidasks);
|
|
351
|
+
const result = [];
|
|
352
|
+
for (let i = 0; i < prices.length; i++) {
|
|
353
|
+
const priceString = this.safeString(prices, i);
|
|
354
|
+
const price = this.safeNumber(prices, i);
|
|
355
|
+
const volume = this.safeNumber(bidasks, priceString);
|
|
356
|
+
result.push([price, volume]);
|
|
357
|
+
}
|
|
358
|
+
return result;
|
|
359
|
+
}
|
|
360
|
+
async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
361
|
+
/**
|
|
362
|
+
* @method
|
|
363
|
+
* @name tradeogre#fetchTrades
|
|
364
|
+
* @description get the list of most recent trades for a particular symbol
|
|
365
|
+
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
366
|
+
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
367
|
+
* @param {int} [limit] the maximum number of trades to fetch
|
|
368
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
369
|
+
* @param {int} params.lastId order id
|
|
370
|
+
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
371
|
+
*/
|
|
372
|
+
await this.loadMarkets();
|
|
373
|
+
const market = this.market(symbol);
|
|
374
|
+
const request = {
|
|
375
|
+
'market': market['id'],
|
|
376
|
+
};
|
|
377
|
+
const response = await this.publicGetHistoryMarket(this.extend(request, params));
|
|
378
|
+
return this.parseTrades(response, market, since, limit);
|
|
379
|
+
}
|
|
380
|
+
parseTrade(trade, market = undefined) {
|
|
381
|
+
//
|
|
382
|
+
// {
|
|
383
|
+
// "date":1515128233,
|
|
384
|
+
// "type":"sell",
|
|
385
|
+
// "price":"0.02454320",
|
|
386
|
+
// "quantity":"0.17614230"
|
|
387
|
+
// }
|
|
388
|
+
//
|
|
389
|
+
const timestamp = this.safeIntegerProduct(trade, 'date', 1000);
|
|
390
|
+
return this.safeTrade({
|
|
391
|
+
'info': trade,
|
|
392
|
+
'id': undefined,
|
|
393
|
+
'timestamp': timestamp,
|
|
394
|
+
'datetime': this.iso8601(timestamp),
|
|
395
|
+
'symbol': this.safeString(market, 'symbol'),
|
|
396
|
+
'order': undefined,
|
|
397
|
+
'type': undefined,
|
|
398
|
+
'side': this.safeString(trade, 'type'),
|
|
399
|
+
'takerOrMaker': undefined,
|
|
400
|
+
'price': this.safeString(trade, 'price'),
|
|
401
|
+
'amount': this.safeString(trade, 'quantity'),
|
|
402
|
+
'cost': undefined,
|
|
403
|
+
'fee': {
|
|
404
|
+
'currency': undefined,
|
|
405
|
+
'cost': undefined,
|
|
406
|
+
},
|
|
407
|
+
}, market);
|
|
408
|
+
}
|
|
409
|
+
async fetchBalance(params = {}) {
|
|
410
|
+
/**
|
|
411
|
+
* @method
|
|
412
|
+
* @name tradeogre#fetchBalance
|
|
413
|
+
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
414
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
415
|
+
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
416
|
+
*/
|
|
417
|
+
await this.loadMarkets();
|
|
418
|
+
const response = await this.privateGetAccountBalances(params);
|
|
419
|
+
const result = this.safeDict(response, 'balances', {});
|
|
420
|
+
return this.parseBalance(result);
|
|
421
|
+
}
|
|
422
|
+
parseBalance(response) {
|
|
423
|
+
//
|
|
424
|
+
// {
|
|
425
|
+
// "USDT": "12"
|
|
426
|
+
// }
|
|
427
|
+
//
|
|
428
|
+
const result = {
|
|
429
|
+
'info': response,
|
|
430
|
+
};
|
|
431
|
+
const keys = Object.keys(response);
|
|
432
|
+
for (let i = 0; i < keys.length; i++) {
|
|
433
|
+
const currencyId = keys[i];
|
|
434
|
+
const balance = response[currencyId];
|
|
435
|
+
const code = this.safeCurrencyCode(currencyId);
|
|
436
|
+
const account = {
|
|
437
|
+
'total': balance,
|
|
438
|
+
};
|
|
439
|
+
result[code] = account;
|
|
440
|
+
}
|
|
441
|
+
return this.safeBalance(result);
|
|
442
|
+
}
|
|
443
|
+
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
444
|
+
/**
|
|
445
|
+
* @method
|
|
446
|
+
* @name tradeogre#createOrder
|
|
447
|
+
* @description create a trade order
|
|
448
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
449
|
+
* @param {string} type not used by tradeogre
|
|
450
|
+
* @param {string} side 'buy' or 'sell'
|
|
451
|
+
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
452
|
+
* @param {float} price the price at which the order is to be fullfilled, in units of the quote currency
|
|
453
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
454
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
455
|
+
*/
|
|
456
|
+
await this.loadMarkets();
|
|
457
|
+
const market = this.market(symbol);
|
|
458
|
+
const request = {
|
|
459
|
+
'market': market['id'],
|
|
460
|
+
'quantity': this.parseToNumeric(this.amountToPrecision(symbol, amount)),
|
|
461
|
+
'price': this.parseToNumeric(this.priceToPrecision(symbol, price)),
|
|
462
|
+
};
|
|
463
|
+
if (type === 'market') {
|
|
464
|
+
throw new errors.BadRequest(this.id + ' createOrder does not support market orders');
|
|
465
|
+
}
|
|
466
|
+
let response = undefined;
|
|
467
|
+
if (side === 'buy') {
|
|
468
|
+
response = await this.privatePostOrderBuy(this.extend(request, params));
|
|
469
|
+
}
|
|
470
|
+
else {
|
|
471
|
+
response = await this.privatePostOrderSell(this.extend(request, params));
|
|
472
|
+
}
|
|
473
|
+
return this.parseOrder(response, market);
|
|
474
|
+
}
|
|
475
|
+
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
476
|
+
/**
|
|
477
|
+
* @method
|
|
478
|
+
* @name tradeogre#cancelOrder
|
|
479
|
+
* @description cancels an open order
|
|
480
|
+
* @param {string} id order id
|
|
481
|
+
* @param {string} symbol unified symbol of the market the order was made in
|
|
482
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
483
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
484
|
+
*/
|
|
485
|
+
await this.loadMarkets();
|
|
486
|
+
const request = {
|
|
487
|
+
'uuid': id,
|
|
488
|
+
};
|
|
489
|
+
const response = await this.privatePostOrderCancel(this.extend(request, params));
|
|
490
|
+
return this.parseOrder(response);
|
|
491
|
+
}
|
|
492
|
+
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
493
|
+
/**
|
|
494
|
+
* @method
|
|
495
|
+
* @name tradeogre#cancelAllOrders
|
|
496
|
+
* @description cancel all open orders
|
|
497
|
+
* @param {string} symbol alpaca cancelAllOrders cannot setting symbol, it will cancel all open orders
|
|
498
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
499
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
500
|
+
*/
|
|
501
|
+
await this.loadMarkets();
|
|
502
|
+
return await this.cancelOrder('all', symbol, params);
|
|
503
|
+
}
|
|
504
|
+
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
505
|
+
/**
|
|
506
|
+
* @method
|
|
507
|
+
* @name tradeogre#fetchOpenOrders
|
|
508
|
+
* @description fetch all unfilled currently open orders
|
|
509
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
510
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
511
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
512
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
513
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
514
|
+
*/
|
|
515
|
+
await this.loadMarkets();
|
|
516
|
+
let market = undefined;
|
|
517
|
+
if (symbol !== undefined) {
|
|
518
|
+
market = this.market(symbol);
|
|
519
|
+
}
|
|
520
|
+
const request = {};
|
|
521
|
+
if (symbol !== undefined) {
|
|
522
|
+
request['market'] = market['id'];
|
|
523
|
+
}
|
|
524
|
+
const response = await this.privatePostAccountOrders(this.extend(request, params));
|
|
525
|
+
return this.parseOrders(response, market, since, limit);
|
|
526
|
+
}
|
|
527
|
+
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
528
|
+
/**
|
|
529
|
+
* @method
|
|
530
|
+
* @name ace#fetchOrder
|
|
531
|
+
* @description fetches information on an order made by the user
|
|
532
|
+
* @see https://github.com/ace-exchange/ace-official-api-docs/blob/master/api_v2.md#open-api---order-status
|
|
533
|
+
* @param {string} symbol unified symbol of the market the order was made in
|
|
534
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
535
|
+
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
536
|
+
*/
|
|
537
|
+
await this.loadMarkets();
|
|
538
|
+
const request = {
|
|
539
|
+
'uuid': id,
|
|
540
|
+
};
|
|
541
|
+
const response = await this.privateGetAccountOrderUuid(this.extend(request, params));
|
|
542
|
+
return this.parseOrder(response, undefined);
|
|
543
|
+
}
|
|
544
|
+
parseOrder(order, market = undefined) {
|
|
545
|
+
//
|
|
546
|
+
//
|
|
547
|
+
// {
|
|
548
|
+
// "uuid": "a40ac710-8dc5-b5a8-aa69-389715197b14",
|
|
549
|
+
// "date": 1514876938,
|
|
550
|
+
// "type": "sell",
|
|
551
|
+
// "price": "0.02621960",
|
|
552
|
+
// "quantity": "1.55772526",
|
|
553
|
+
// "market": "XMR-BTC"
|
|
554
|
+
// }
|
|
555
|
+
//
|
|
556
|
+
const timestamp = this.safeIntegerProduct(order, 'date', 1000);
|
|
557
|
+
const marketId = this.safeString(order, 'market');
|
|
558
|
+
market = this.safeMarket(marketId, market);
|
|
559
|
+
return this.safeOrder({
|
|
560
|
+
'info': order,
|
|
561
|
+
'id': this.safeString(order, 'uuid'),
|
|
562
|
+
'clientOrderId': undefined,
|
|
563
|
+
'timestamp': timestamp,
|
|
564
|
+
'datetime': this.iso8601(timestamp),
|
|
565
|
+
'lastTradeTimestamp': undefined,
|
|
566
|
+
'symbol': market['symbol'],
|
|
567
|
+
'type': undefined,
|
|
568
|
+
'timeInForce': undefined,
|
|
569
|
+
'postOnly': undefined,
|
|
570
|
+
'side': this.safeString(order, 'type'),
|
|
571
|
+
'price': this.safeString(order, 'price'),
|
|
572
|
+
'stopPrice': undefined,
|
|
573
|
+
'amount': this.safeString(order, 'quantity'),
|
|
574
|
+
'cost': undefined,
|
|
575
|
+
'average': undefined,
|
|
576
|
+
'filled': this.safeString(order, 'fulfilled'),
|
|
577
|
+
'remaining': undefined,
|
|
578
|
+
'status': undefined,
|
|
579
|
+
'fee': {
|
|
580
|
+
'currency': undefined,
|
|
581
|
+
'cost': undefined,
|
|
582
|
+
},
|
|
583
|
+
'trades': undefined,
|
|
584
|
+
}, market);
|
|
585
|
+
}
|
|
586
|
+
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
587
|
+
let url = this.urls['api']['rest'] + '/' + this.implodeParams(path, params);
|
|
588
|
+
params = this.omit(params, this.extractParams(path));
|
|
589
|
+
if (method === 'GET') {
|
|
590
|
+
if (Object.keys(params).length) {
|
|
591
|
+
url += '?' + this.urlencode(params);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
if (api === 'private') {
|
|
595
|
+
headers = {
|
|
596
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
597
|
+
'Referer': 'CCXT',
|
|
598
|
+
'authorization': 'Basic ' + this.stringToBase64(this.apiKey + ':' + this.secret),
|
|
599
|
+
};
|
|
600
|
+
if (method !== 'GET') {
|
|
601
|
+
body = this.urlencode(params);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
605
|
+
}
|
|
606
|
+
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
607
|
+
if (response === undefined) {
|
|
608
|
+
return undefined;
|
|
609
|
+
}
|
|
610
|
+
if (!('success' in response)) {
|
|
611
|
+
return undefined;
|
|
612
|
+
}
|
|
613
|
+
//
|
|
614
|
+
// {"success":false,"error":"Must be authorized"}
|
|
615
|
+
//
|
|
616
|
+
const success = this.safeBool(response, 'success');
|
|
617
|
+
if (success) {
|
|
618
|
+
return undefined;
|
|
619
|
+
}
|
|
620
|
+
const successString = this.safeString(response, 'success');
|
|
621
|
+
if (successString === 'true') {
|
|
622
|
+
return undefined;
|
|
623
|
+
}
|
|
624
|
+
const error = this.safeValue(response, 'error');
|
|
625
|
+
const errorCode = this.safeString(error, 'code');
|
|
626
|
+
const feedback = this.id + ' ' + this.json(response);
|
|
627
|
+
this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);
|
|
628
|
+
throw new errors.ExchangeError(feedback);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
module.exports = tradeogre;
|
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 { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.2.
|
|
7
|
+
declare const version = "4.2.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';
|
|
@@ -99,6 +99,7 @@ import poloniexfutures from './src/poloniexfutures.js';
|
|
|
99
99
|
import probit from './src/probit.js';
|
|
100
100
|
import timex from './src/timex.js';
|
|
101
101
|
import tokocrypto from './src/tokocrypto.js';
|
|
102
|
+
import tradeogre from './src/tradeogre.js';
|
|
102
103
|
import upbit from './src/upbit.js';
|
|
103
104
|
import wavesexchange from './src/wavesexchange.js';
|
|
104
105
|
import wazirx from './src/wazirx.js';
|
|
@@ -265,6 +266,7 @@ declare const exchanges: {
|
|
|
265
266
|
probit: typeof probit;
|
|
266
267
|
timex: typeof timex;
|
|
267
268
|
tokocrypto: typeof tokocrypto;
|
|
269
|
+
tradeogre: typeof tradeogre;
|
|
268
270
|
upbit: typeof upbit;
|
|
269
271
|
wavesexchange: typeof wavesexchange;
|
|
270
272
|
wazirx: typeof wazirx;
|
|
@@ -504,6 +506,7 @@ declare const ccxt: {
|
|
|
504
506
|
probit: typeof probit;
|
|
505
507
|
timex: typeof timex;
|
|
506
508
|
tokocrypto: typeof tokocrypto;
|
|
509
|
+
tradeogre: typeof tradeogre;
|
|
507
510
|
upbit: typeof upbit;
|
|
508
511
|
wavesexchange: typeof wavesexchange;
|
|
509
512
|
wazirx: typeof wazirx;
|
|
@@ -513,5 +516,5 @@ declare const ccxt: {
|
|
|
513
516
|
zaif: typeof zaif;
|
|
514
517
|
zonda: typeof zonda;
|
|
515
518
|
} & typeof functions & typeof errors;
|
|
516
|
-
export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange, Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseinternational, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, hyperliquid, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
|
|
519
|
+
export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange, Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseinternational, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, hyperliquid, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, tradeogre, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
|
|
517
520
|
export default ccxt;
|