ccxt 4.5.5 → 4.5.6
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 +4 -4
- package/dist/ccxt.browser.min.js +15 -15
- package/dist/cjs/ccxt.js +6 -6
- package/dist/cjs/src/abstract/toobit.js +11 -0
- package/dist/cjs/src/abstract/tradeogre.js +1 -1
- package/dist/cjs/src/backpack.js +1 -1
- package/dist/cjs/src/base/Exchange.js +129 -2
- package/dist/cjs/src/bigone.js +4 -4
- package/dist/cjs/src/binance.js +79 -20
- package/dist/cjs/src/bingx.js +5 -2
- package/dist/cjs/src/bitget.js +16 -9
- package/dist/cjs/src/bybit.js +186 -127
- package/dist/cjs/src/coinsph.js +4 -1
- package/dist/cjs/src/cryptocom.js +6 -3
- package/dist/cjs/src/gate.js +1 -1
- package/dist/cjs/src/gemini.js +2 -2
- package/dist/cjs/src/hyperliquid.js +3 -0
- package/dist/cjs/src/kraken.js +6 -2
- package/dist/cjs/src/kucoin.js +1 -2
- package/dist/cjs/src/luno.js +4 -1
- package/dist/cjs/src/mexc.js +4 -1
- package/dist/cjs/src/okcoin.js +4 -1
- package/dist/cjs/src/okx.js +34 -3
- package/dist/cjs/src/phemex.js +1 -1
- package/dist/cjs/src/pro/apex.js +1 -0
- package/dist/cjs/src/pro/backpack.js +1 -1
- package/dist/cjs/src/pro/binance.js +150 -19
- package/dist/cjs/src/pro/bitget.js +332 -76
- package/dist/cjs/src/pro/cex.js +1 -0
- package/dist/cjs/src/pro/independentreserve.js +1 -0
- package/dist/cjs/src/pro/mexc.js +23 -23
- package/dist/cjs/src/pro/okx.js +46 -10
- package/dist/cjs/src/pro/toobit.js +1163 -0
- package/dist/cjs/src/pro/tradeogre.js +1 -1
- package/dist/cjs/src/toobit.js +2999 -0
- package/dist/cjs/src/tradeogre.js +1 -1
- package/js/ccxt.d.ts +8 -8
- package/js/ccxt.js +6 -6
- package/js/src/abstract/myokx.d.ts +1 -0
- package/js/src/abstract/okx.d.ts +1 -0
- package/js/src/abstract/okxus.d.ts +1 -0
- package/js/src/abstract/toobit.d.ts +66 -0
- package/js/src/backpack.js +1 -1
- package/js/src/base/Exchange.d.ts +9 -0
- package/js/src/base/Exchange.js +129 -2
- package/js/src/bigone.js +4 -4
- package/js/src/binance.d.ts +9 -0
- package/js/src/binance.js +79 -20
- package/js/src/bingx.js +5 -2
- package/js/src/bitget.js +16 -9
- package/js/src/bybit.d.ts +8 -0
- package/js/src/bybit.js +186 -127
- package/js/src/coinsph.js +4 -1
- package/js/src/cryptocom.js +6 -3
- package/js/src/gate.js +1 -1
- package/js/src/gemini.js +2 -2
- package/js/src/hyperliquid.js +3 -0
- package/js/src/kraken.d.ts +1 -1
- package/js/src/kraken.js +6 -2
- package/js/src/kucoin.js +1 -2
- package/js/src/luno.js +4 -1
- package/js/src/mexc.js +4 -1
- package/js/src/okcoin.js +4 -1
- package/js/src/okx.js +34 -3
- package/js/src/phemex.js +1 -1
- package/js/src/pro/apex.js +1 -0
- package/js/src/pro/backpack.d.ts +1 -1
- package/js/src/pro/backpack.js +1 -1
- package/js/src/pro/binance.d.ts +24 -0
- package/js/src/pro/binance.js +150 -19
- package/js/src/pro/bitget.d.ts +6 -0
- package/js/src/pro/bitget.js +332 -76
- package/js/src/pro/cex.js +1 -0
- package/js/src/pro/independentreserve.js +1 -0
- package/js/src/pro/mexc.js +23 -23
- package/js/src/pro/okx.d.ts +7 -1
- package/js/src/pro/okx.js +46 -10
- package/js/src/pro/toobit.d.ts +174 -0
- package/js/src/pro/toobit.js +1162 -0
- package/js/src/toobit.d.ts +456 -0
- package/js/src/toobit.js +2992 -0
- package/package.json +1 -1
- package/dist/373.ccxt.browser.js +0 -7630
- package/dist/373.ccxt.browser.min.js +0 -1
- package/js/src/abstract/tradeogre.d.ts +0 -21
- package/js/src/pro/tradeogre.d.ts +0 -49
- package/js/src/pro/tradeogre.js +0 -278
- package/js/src/tradeogre.d.ts +0 -149
- package/js/src/tradeogre.js +0 -872
- /package/js/src/abstract/{tradeogre.js → toobit.js} +0 -0
package/js/src/tradeogre.js
DELETED
|
@@ -1,872 +0,0 @@
|
|
|
1
|
-
// ---------------------------------------------------------------------------
|
|
2
|
-
import Exchange from './abstract/tradeogre.js';
|
|
3
|
-
import { InsufficientFunds, AuthenticationError, BadRequest, ExchangeError, ArgumentsRequired } from './base/errors.js';
|
|
4
|
-
import { TICK_SIZE } from './base/functions/number.js';
|
|
5
|
-
// ---------------------------------------------------------------------------
|
|
6
|
-
/**
|
|
7
|
-
* @class tradeogre
|
|
8
|
-
* @augments Exchange
|
|
9
|
-
*/
|
|
10
|
-
export default class tradeogre extends Exchange {
|
|
11
|
-
describe() {
|
|
12
|
-
return this.deepExtend(super.describe(), {
|
|
13
|
-
'id': 'tradeogre',
|
|
14
|
-
'name': 'tradeogre',
|
|
15
|
-
'countries': [],
|
|
16
|
-
'rateLimit': 100,
|
|
17
|
-
'version': 'v2',
|
|
18
|
-
'pro': true,
|
|
19
|
-
'has': {
|
|
20
|
-
'CORS': undefined,
|
|
21
|
-
'spot': true,
|
|
22
|
-
'margin': false,
|
|
23
|
-
'swap': false,
|
|
24
|
-
'future': false,
|
|
25
|
-
'option': false,
|
|
26
|
-
'addMargin': false,
|
|
27
|
-
'borrowCrossMargin': false,
|
|
28
|
-
'borrowIsolatedMargin': false,
|
|
29
|
-
'borrowMargin': 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
|
-
'fetchAllGreeks': false,
|
|
46
|
-
'fetchBalance': true,
|
|
47
|
-
'fetchBorrowInterest': false,
|
|
48
|
-
'fetchBorrowRate': false,
|
|
49
|
-
'fetchBorrowRateHistories': false,
|
|
50
|
-
'fetchBorrowRateHistory': false,
|
|
51
|
-
'fetchBorrowRates': false,
|
|
52
|
-
'fetchBorrowRatesPerSymbol': false,
|
|
53
|
-
'fetchClosedOrders': false,
|
|
54
|
-
'fetchCrossBorrowRate': false,
|
|
55
|
-
'fetchCrossBorrowRates': false,
|
|
56
|
-
'fetchDeposit': false,
|
|
57
|
-
'fetchDepositAddress': false,
|
|
58
|
-
'fetchDepositAddresses': false,
|
|
59
|
-
'fetchDepositAddressesByNetwork': false,
|
|
60
|
-
'fetchDeposits': false,
|
|
61
|
-
'fetchDepositsWithdrawals': false,
|
|
62
|
-
'fetchFundingHistory': false,
|
|
63
|
-
'fetchFundingInterval': false,
|
|
64
|
-
'fetchFundingIntervals': false,
|
|
65
|
-
'fetchFundingRate': false,
|
|
66
|
-
'fetchFundingRateHistory': false,
|
|
67
|
-
'fetchFundingRates': false,
|
|
68
|
-
'fetchGreeks': false,
|
|
69
|
-
'fetchIndexOHLCV': false,
|
|
70
|
-
'fetchIsolatedBorrowRate': false,
|
|
71
|
-
'fetchIsolatedBorrowRates': false,
|
|
72
|
-
'fetchIsolatedPositions': false,
|
|
73
|
-
'fetchLedger': false,
|
|
74
|
-
'fetchLedgerEntry': false,
|
|
75
|
-
'fetchLeverage': false,
|
|
76
|
-
'fetchLeverages': false,
|
|
77
|
-
'fetchLeverageTiers': false,
|
|
78
|
-
'fetchLiquidations': false,
|
|
79
|
-
'fetchLongShortRatio': false,
|
|
80
|
-
'fetchLongShortRatioHistory': false,
|
|
81
|
-
'fetchMarginAdjustmentHistory': false,
|
|
82
|
-
'fetchMarginMode': false,
|
|
83
|
-
'fetchMarginModes': false,
|
|
84
|
-
'fetchMarketLeverageTiers': false,
|
|
85
|
-
'fetchMarkets': true,
|
|
86
|
-
'fetchMarkOHLCV': false,
|
|
87
|
-
'fetchMarkPrice': false,
|
|
88
|
-
'fetchMarkPrices': false,
|
|
89
|
-
'fetchMyLiquidations': false,
|
|
90
|
-
'fetchMySettlementHistory': false,
|
|
91
|
-
'fetchMyTrades': false,
|
|
92
|
-
'fetchOHLCV': true,
|
|
93
|
-
'fetchOpenInterest': false,
|
|
94
|
-
'fetchOpenInterestHistory': false,
|
|
95
|
-
'fetchOpenInterests': false,
|
|
96
|
-
'fetchOpenOrders': true,
|
|
97
|
-
'fetchOption': false,
|
|
98
|
-
'fetchOptionChain': false,
|
|
99
|
-
'fetchOrder': true,
|
|
100
|
-
'fetchOrderBook': true,
|
|
101
|
-
'fetchOrderBooks': false,
|
|
102
|
-
'fetchOrders': false,
|
|
103
|
-
'fetchOrderTrades': false,
|
|
104
|
-
'fetchPosition': false,
|
|
105
|
-
'fetchPositionHistory': false,
|
|
106
|
-
'fetchPositionMode': false,
|
|
107
|
-
'fetchPositions': false,
|
|
108
|
-
'fetchPositionsForSymbol': false,
|
|
109
|
-
'fetchPositionsHistory': false,
|
|
110
|
-
'fetchPositionsRisk': false,
|
|
111
|
-
'fetchPremiumIndexOHLCV': false,
|
|
112
|
-
'fetchSettlementHistory': false,
|
|
113
|
-
'fetchTicker': true,
|
|
114
|
-
'fetchTickers': true,
|
|
115
|
-
'fetchTrades': true,
|
|
116
|
-
'fetchTradingLimits': false,
|
|
117
|
-
'fetchTransactionFee': false,
|
|
118
|
-
'fetchTransactionFees': false,
|
|
119
|
-
'fetchTransactions': false,
|
|
120
|
-
'fetchTransfers': false,
|
|
121
|
-
'fetchUnderlyingAssets': false,
|
|
122
|
-
'fetchVolatilityHistory': false,
|
|
123
|
-
'fetchWithdrawAddresses': false,
|
|
124
|
-
'fetchWithdrawal': false,
|
|
125
|
-
'fetchWithdrawals': false,
|
|
126
|
-
'reduceMargin': false,
|
|
127
|
-
'repayCrossMargin': false,
|
|
128
|
-
'repayIsolatedMargin': false,
|
|
129
|
-
'setLeverage': false,
|
|
130
|
-
'setMargin': false,
|
|
131
|
-
'setMarginMode': false,
|
|
132
|
-
'setPositionMode': false,
|
|
133
|
-
'signIn': false,
|
|
134
|
-
'transfer': false,
|
|
135
|
-
'withdraw': false,
|
|
136
|
-
},
|
|
137
|
-
'urls': {
|
|
138
|
-
'referral': '',
|
|
139
|
-
'logo': 'https://github.com/ccxt/ccxt/assets/43336371/3aa748b7-ea44-45e9-a9e7-b1d207a2578a',
|
|
140
|
-
'api': {
|
|
141
|
-
'rest': 'https://tradeogre.com/api/v1',
|
|
142
|
-
},
|
|
143
|
-
'www': 'https://tradeogre.com',
|
|
144
|
-
'doc': 'https://tradeogre.com/help/api',
|
|
145
|
-
'fees': 'https://tradeogre.com/help/fees',
|
|
146
|
-
},
|
|
147
|
-
'fees': {
|
|
148
|
-
'trading': {
|
|
149
|
-
'maker': this.parseNumber('0.002'),
|
|
150
|
-
'taker': this.parseNumber('0.002'),
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
'api': {
|
|
154
|
-
'public': {
|
|
155
|
-
'get': {
|
|
156
|
-
'markets': 1,
|
|
157
|
-
'orders/{market}': 1,
|
|
158
|
-
'ticker/{market}': 1,
|
|
159
|
-
'history/{market}': 1,
|
|
160
|
-
'chart/{interval}/{market}/{timestamp}': 1,
|
|
161
|
-
'chart/{interval}/{market}': 1,
|
|
162
|
-
},
|
|
163
|
-
},
|
|
164
|
-
'private': {
|
|
165
|
-
'get': {
|
|
166
|
-
'account/balances': 1,
|
|
167
|
-
'account/order/{uuid}': 1,
|
|
168
|
-
},
|
|
169
|
-
'post': {
|
|
170
|
-
'order/buy': 1,
|
|
171
|
-
'order/sell': 1,
|
|
172
|
-
'order/cancel': 1,
|
|
173
|
-
'orders': 1,
|
|
174
|
-
'account/orders': 1,
|
|
175
|
-
'account/balance': 1,
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
'commonCurrencies': {},
|
|
180
|
-
'precisionMode': TICK_SIZE,
|
|
181
|
-
'exceptions': {
|
|
182
|
-
'exact': {
|
|
183
|
-
'Must be authorized': AuthenticationError,
|
|
184
|
-
'Market not found': BadRequest,
|
|
185
|
-
'Insufficient funds': InsufficientFunds,
|
|
186
|
-
'Order not found': BadRequest,
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
'timeframes': {
|
|
190
|
-
'1m': '1m',
|
|
191
|
-
'15m': '15m',
|
|
192
|
-
'1h': '1h',
|
|
193
|
-
'4h': '4h',
|
|
194
|
-
'1d': '1d',
|
|
195
|
-
'1w': '1w',
|
|
196
|
-
},
|
|
197
|
-
'options': {},
|
|
198
|
-
'features': {
|
|
199
|
-
'spot': {
|
|
200
|
-
'sandbox': false,
|
|
201
|
-
'createOrder': {
|
|
202
|
-
'marginMode': false,
|
|
203
|
-
'triggerPrice': false,
|
|
204
|
-
'triggerDirection': false,
|
|
205
|
-
'triggerPriceType': undefined,
|
|
206
|
-
'stopLossPrice': false,
|
|
207
|
-
'takeProfitPrice': false,
|
|
208
|
-
'attachedStopLossTakeProfit': undefined,
|
|
209
|
-
'timeInForce': {
|
|
210
|
-
'IOC': false,
|
|
211
|
-
'FOK': false,
|
|
212
|
-
'PO': false,
|
|
213
|
-
'GTD': false,
|
|
214
|
-
},
|
|
215
|
-
'hedged': false,
|
|
216
|
-
'trailing': false,
|
|
217
|
-
'leverage': false,
|
|
218
|
-
'marketBuyByCost': false,
|
|
219
|
-
'marketBuyRequiresPrice': false,
|
|
220
|
-
'selfTradePrevention': false,
|
|
221
|
-
'iceberg': false,
|
|
222
|
-
},
|
|
223
|
-
'createOrders': undefined,
|
|
224
|
-
'fetchMyTrades': undefined,
|
|
225
|
-
'fetchOrder': {
|
|
226
|
-
'marginMode': false,
|
|
227
|
-
'trigger': false,
|
|
228
|
-
'trailing': false,
|
|
229
|
-
'symbolRequired': false,
|
|
230
|
-
},
|
|
231
|
-
'fetchOpenOrders': {
|
|
232
|
-
'marginMode': false,
|
|
233
|
-
'limit': undefined,
|
|
234
|
-
'trigger': false,
|
|
235
|
-
'trailing': false,
|
|
236
|
-
'symbolRequired': false,
|
|
237
|
-
},
|
|
238
|
-
'fetchOrders': undefined,
|
|
239
|
-
'fetchClosedOrders': undefined,
|
|
240
|
-
'fetchOHLCV': undefined, // todo
|
|
241
|
-
},
|
|
242
|
-
'swap': {
|
|
243
|
-
'linear': undefined,
|
|
244
|
-
'inverse': undefined,
|
|
245
|
-
},
|
|
246
|
-
'future': {
|
|
247
|
-
'linear': undefined,
|
|
248
|
-
'inverse': undefined,
|
|
249
|
-
},
|
|
250
|
-
},
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* @method
|
|
255
|
-
* @name tradeogre#fetchMarkets
|
|
256
|
-
* @description retrieves data on all markets for bigone
|
|
257
|
-
* @see https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md#markets
|
|
258
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
259
|
-
* @returns {object[]} an array of objects representing market data
|
|
260
|
-
*/
|
|
261
|
-
async fetchMarkets(params = {}) {
|
|
262
|
-
const response = await this.publicGetMarkets(params);
|
|
263
|
-
//
|
|
264
|
-
// [
|
|
265
|
-
// {
|
|
266
|
-
// "AEON-BTC": {
|
|
267
|
-
// "initialprice": "0.00022004",
|
|
268
|
-
// "price": "0.00025992",
|
|
269
|
-
// "high": "0.00025992",
|
|
270
|
-
// "low": "0.00022003",
|
|
271
|
-
// "volume": "0.00359066",
|
|
272
|
-
// "bid": "0.00022456",
|
|
273
|
-
// "ask": "0.00025993"
|
|
274
|
-
// }
|
|
275
|
-
// }
|
|
276
|
-
// ]
|
|
277
|
-
//
|
|
278
|
-
const result = [];
|
|
279
|
-
for (let i = 0; i < response.length; i++) {
|
|
280
|
-
const rawMarket = response[i];
|
|
281
|
-
const keys = Object.keys(rawMarket);
|
|
282
|
-
const id = this.safeString(keys, 0);
|
|
283
|
-
const keyParts = id.split('-');
|
|
284
|
-
const baseId = this.safeString(keyParts, 0);
|
|
285
|
-
const quoteId = this.safeString(keyParts, 1);
|
|
286
|
-
const base = this.safeCurrencyCode(baseId);
|
|
287
|
-
const quote = this.safeCurrencyCode(quoteId);
|
|
288
|
-
const market = this.safeMarketStructure({
|
|
289
|
-
'id': id,
|
|
290
|
-
'symbol': base + '/' + quote,
|
|
291
|
-
'base': base,
|
|
292
|
-
'quote': quote,
|
|
293
|
-
'settle': undefined,
|
|
294
|
-
'baseId': baseId,
|
|
295
|
-
'quoteId': quoteId,
|
|
296
|
-
'settleId': undefined,
|
|
297
|
-
'type': 'spot',
|
|
298
|
-
'spot': true,
|
|
299
|
-
'margin': false,
|
|
300
|
-
'swap': false,
|
|
301
|
-
'future': false,
|
|
302
|
-
'option': false,
|
|
303
|
-
'active': true,
|
|
304
|
-
'contract': false,
|
|
305
|
-
'linear': undefined,
|
|
306
|
-
'inverse': undefined,
|
|
307
|
-
'contractSize': undefined,
|
|
308
|
-
'taker': this.fees['trading']['taker'],
|
|
309
|
-
'maker': this.fees['trading']['maker'],
|
|
310
|
-
'expiry': undefined,
|
|
311
|
-
'expiryDatetime': undefined,
|
|
312
|
-
'strike': undefined,
|
|
313
|
-
'optionType': undefined,
|
|
314
|
-
'precision': {
|
|
315
|
-
'amount': this.parseNumber(this.parsePrecision('8')),
|
|
316
|
-
'price': this.parseNumber(this.parsePrecision('8')), // they're not explicit about it
|
|
317
|
-
},
|
|
318
|
-
'limits': {
|
|
319
|
-
'leverage': {
|
|
320
|
-
'min': undefined,
|
|
321
|
-
'max': undefined,
|
|
322
|
-
},
|
|
323
|
-
'amount': {
|
|
324
|
-
'min': undefined,
|
|
325
|
-
'max': undefined,
|
|
326
|
-
},
|
|
327
|
-
'price': {
|
|
328
|
-
'min': undefined,
|
|
329
|
-
'max': undefined,
|
|
330
|
-
},
|
|
331
|
-
'cost': {
|
|
332
|
-
'min': undefined,
|
|
333
|
-
'max': undefined,
|
|
334
|
-
},
|
|
335
|
-
},
|
|
336
|
-
'created': undefined,
|
|
337
|
-
'info': rawMarket,
|
|
338
|
-
});
|
|
339
|
-
result.push(market);
|
|
340
|
-
}
|
|
341
|
-
return result;
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* @method
|
|
345
|
-
* @name tradeogre#fetchTicker
|
|
346
|
-
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
347
|
-
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
348
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
349
|
-
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
350
|
-
*/
|
|
351
|
-
async fetchTicker(symbol, params = {}) {
|
|
352
|
-
await this.loadMarkets();
|
|
353
|
-
const market = this.market(symbol);
|
|
354
|
-
const request = {
|
|
355
|
-
'market': market['id'],
|
|
356
|
-
};
|
|
357
|
-
const response = await this.publicGetTickerMarket(this.extend(request, params));
|
|
358
|
-
//
|
|
359
|
-
// {
|
|
360
|
-
// "success":true,
|
|
361
|
-
// "initialprice":"0.02502002",
|
|
362
|
-
// "price":"0.02500000",
|
|
363
|
-
// "high":"0.03102001",
|
|
364
|
-
// "low":"0.02500000",
|
|
365
|
-
// "volume":"0.15549958",
|
|
366
|
-
// "bid":"0.02420000",
|
|
367
|
-
// "ask":"0.02625000"
|
|
368
|
-
// }
|
|
369
|
-
//
|
|
370
|
-
return this.parseTicker(response, market);
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* @method
|
|
374
|
-
* @name tradeogre#fetchTickers
|
|
375
|
-
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
376
|
-
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
377
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
378
|
-
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
379
|
-
*/
|
|
380
|
-
async fetchTickers(symbols = undefined, params = {}) {
|
|
381
|
-
await this.loadMarkets();
|
|
382
|
-
symbols = this.marketSymbols(symbols);
|
|
383
|
-
const request = {};
|
|
384
|
-
const response = await this.publicGetMarkets(this.extend(request, params));
|
|
385
|
-
//
|
|
386
|
-
// [
|
|
387
|
-
// {
|
|
388
|
-
// "AAVE-USDT": {
|
|
389
|
-
// "initialprice": "177.20325711",
|
|
390
|
-
// "price": "177.20325711",
|
|
391
|
-
// "high": "177.20325711",
|
|
392
|
-
// "low": "177.20325711",
|
|
393
|
-
// "volume": "0.00000000",
|
|
394
|
-
// "bid": "160.72768581",
|
|
395
|
-
// "ask": "348.99999999",
|
|
396
|
-
// "basename": "Aave"
|
|
397
|
-
// }
|
|
398
|
-
// },
|
|
399
|
-
// ...
|
|
400
|
-
// ]
|
|
401
|
-
//
|
|
402
|
-
const result = {};
|
|
403
|
-
for (let i = 0; i < response.length; i++) {
|
|
404
|
-
const entry = response[i];
|
|
405
|
-
const marketIdArray = Object.keys(entry);
|
|
406
|
-
const marketId = this.safeString(marketIdArray, 0);
|
|
407
|
-
const market = this.safeMarket(marketId);
|
|
408
|
-
const data = entry[marketId];
|
|
409
|
-
const ticker = this.parseTicker(data, market);
|
|
410
|
-
const symbol = ticker['symbol'];
|
|
411
|
-
result[symbol] = ticker;
|
|
412
|
-
}
|
|
413
|
-
return this.filterByArrayTickers(result, 'symbol', symbols);
|
|
414
|
-
}
|
|
415
|
-
parseTicker(ticker, market = undefined) {
|
|
416
|
-
//
|
|
417
|
-
// fetchTicker:
|
|
418
|
-
// {
|
|
419
|
-
// "success":true,
|
|
420
|
-
// "initialprice":"0.02502002",
|
|
421
|
-
// "price":"0.02500000",
|
|
422
|
-
// "high":"0.03102001",
|
|
423
|
-
// "low":"0.02500000",
|
|
424
|
-
// "volume":"0.15549958",
|
|
425
|
-
// "bid":"0.02420000",
|
|
426
|
-
// "ask":"0.02625000"
|
|
427
|
-
// }
|
|
428
|
-
//
|
|
429
|
-
// fetchTickers:
|
|
430
|
-
// {
|
|
431
|
-
// "initialprice": "177.20325711",
|
|
432
|
-
// "price": "177.20325711",
|
|
433
|
-
// "high": "177.20325711",
|
|
434
|
-
// "low": "177.20325711",
|
|
435
|
-
// "volume": "0.00000000",
|
|
436
|
-
// "bid": "160.72768581",
|
|
437
|
-
// "ask": "348.99999999",
|
|
438
|
-
// "basename": "Aave"
|
|
439
|
-
// },
|
|
440
|
-
// ...
|
|
441
|
-
//
|
|
442
|
-
return this.safeTicker({
|
|
443
|
-
'symbol': this.safeString(market, 'symbol'),
|
|
444
|
-
'timestamp': undefined,
|
|
445
|
-
'datetime': undefined,
|
|
446
|
-
'high': this.safeString(ticker, 'high'),
|
|
447
|
-
'low': this.safeString(ticker, 'low'),
|
|
448
|
-
'bid': this.safeString(ticker, 'bid'),
|
|
449
|
-
'bidVolume': undefined,
|
|
450
|
-
'ask': this.safeString(ticker, 'ask'),
|
|
451
|
-
'askVolume': undefined,
|
|
452
|
-
'vwap': undefined,
|
|
453
|
-
'open': this.safeString(ticker, 'initialprice'),
|
|
454
|
-
'close': this.safeString(ticker, 'price'),
|
|
455
|
-
'last': this.safeString(ticker, 'price'),
|
|
456
|
-
'previousClose': undefined,
|
|
457
|
-
'change': undefined,
|
|
458
|
-
'percentage': undefined,
|
|
459
|
-
'average': undefined,
|
|
460
|
-
'baseVolume': this.safeString(ticker, 'volume'),
|
|
461
|
-
'quoteVolume': undefined,
|
|
462
|
-
'info': ticker,
|
|
463
|
-
}, market);
|
|
464
|
-
}
|
|
465
|
-
/**
|
|
466
|
-
* @method
|
|
467
|
-
* @name tradeogre#fetchOHLCV
|
|
468
|
-
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
469
|
-
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
470
|
-
* @param {string} timeframe the length of time each candle represents
|
|
471
|
-
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
472
|
-
* @param {int} [limit] the maximum amount of candles to fetch
|
|
473
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
474
|
-
* @param {int} [params.until] timestamp of the latest candle in ms
|
|
475
|
-
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
476
|
-
*/
|
|
477
|
-
async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
|
|
478
|
-
await this.loadMarkets();
|
|
479
|
-
const market = this.market(symbol);
|
|
480
|
-
const request = {
|
|
481
|
-
'market': market['id'],
|
|
482
|
-
'interval': this.safeString(this.timeframes, timeframe, timeframe),
|
|
483
|
-
};
|
|
484
|
-
let response = undefined;
|
|
485
|
-
const until = this.safeInteger(params, 'until');
|
|
486
|
-
if (until !== undefined) {
|
|
487
|
-
params = this.omit(params, 'until');
|
|
488
|
-
request['timestamp'] = this.parseToInt(until / 1000);
|
|
489
|
-
response = await this.publicGetChartIntervalMarketTimestamp(this.extend(request, params));
|
|
490
|
-
}
|
|
491
|
-
else {
|
|
492
|
-
response = await this.publicGetChartIntervalMarket(this.extend(request, params));
|
|
493
|
-
}
|
|
494
|
-
//
|
|
495
|
-
// [
|
|
496
|
-
// [
|
|
497
|
-
// 1729130040,
|
|
498
|
-
// 67581.47235999,
|
|
499
|
-
// 67581.47235999,
|
|
500
|
-
// 67338.01,
|
|
501
|
-
// 67338.01,
|
|
502
|
-
// 6.72168016
|
|
503
|
-
// ],
|
|
504
|
-
// ]
|
|
505
|
-
//
|
|
506
|
-
return this.parseOHLCVs(response, market, timeframe, since, limit);
|
|
507
|
-
}
|
|
508
|
-
parseOHLCV(ohlcv, market = undefined) {
|
|
509
|
-
//
|
|
510
|
-
// [
|
|
511
|
-
// 1729130040,
|
|
512
|
-
// 67581.47235999,
|
|
513
|
-
// 67581.47235999,
|
|
514
|
-
// 67338.01,
|
|
515
|
-
// 67338.01,
|
|
516
|
-
// 6.72168016
|
|
517
|
-
// ]
|
|
518
|
-
//
|
|
519
|
-
return [
|
|
520
|
-
this.safeTimestamp(ohlcv, 0),
|
|
521
|
-
this.safeNumber(ohlcv, 1),
|
|
522
|
-
this.safeNumber(ohlcv, 2),
|
|
523
|
-
this.safeNumber(ohlcv, 3),
|
|
524
|
-
this.safeNumber(ohlcv, 4),
|
|
525
|
-
this.safeNumber(ohlcv, 5),
|
|
526
|
-
];
|
|
527
|
-
}
|
|
528
|
-
/**
|
|
529
|
-
* @method
|
|
530
|
-
* @name tradeogre#fetchOrderBook
|
|
531
|
-
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
532
|
-
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
533
|
-
* @param {int} [limit] the maximum amount of order book entries to return
|
|
534
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
535
|
-
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
536
|
-
*/
|
|
537
|
-
async fetchOrderBook(symbol, limit = undefined, params = {}) {
|
|
538
|
-
await this.loadMarkets();
|
|
539
|
-
const market = this.market(symbol);
|
|
540
|
-
const request = {
|
|
541
|
-
'market': market['id'],
|
|
542
|
-
};
|
|
543
|
-
const response = await this.publicGetOrdersMarket(this.extend(request, params));
|
|
544
|
-
//
|
|
545
|
-
// {
|
|
546
|
-
// "success": true,
|
|
547
|
-
// "buy": {
|
|
548
|
-
// "0.02425501": "36.46986607",
|
|
549
|
-
// "0.02425502": "93.64201137",
|
|
550
|
-
// "0.02425503": "19.02000000",
|
|
551
|
-
// "0.02425515": "115.49000000"
|
|
552
|
-
// }
|
|
553
|
-
//
|
|
554
|
-
const rawBids = this.safeDict(response, 'buy', {});
|
|
555
|
-
const rawAsks = this.safeDict(response, 'sell', {});
|
|
556
|
-
const rawOrderbook = {
|
|
557
|
-
'bids': rawBids,
|
|
558
|
-
'asks': rawAsks,
|
|
559
|
-
};
|
|
560
|
-
const orderbook = this.parseOrderBook(rawOrderbook, symbol);
|
|
561
|
-
orderbook['nonce'] = this.safeInteger(response, 's');
|
|
562
|
-
return orderbook;
|
|
563
|
-
}
|
|
564
|
-
parseBidsAsks(bidasks, priceKey = 0, amountKey = 1, countOrIdKey = 2) {
|
|
565
|
-
const prices = Object.keys(bidasks);
|
|
566
|
-
const result = [];
|
|
567
|
-
for (let i = 0; i < prices.length; i++) {
|
|
568
|
-
const priceString = this.safeString(prices, i);
|
|
569
|
-
const price = this.safeNumber(prices, i);
|
|
570
|
-
const volume = this.safeNumber(bidasks, priceString);
|
|
571
|
-
result.push([price, volume]);
|
|
572
|
-
}
|
|
573
|
-
return result;
|
|
574
|
-
}
|
|
575
|
-
/**
|
|
576
|
-
* @method
|
|
577
|
-
* @name tradeogre#fetchTrades
|
|
578
|
-
* @description get the list of most recent trades for a particular symbol
|
|
579
|
-
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
580
|
-
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
581
|
-
* @param {int} [limit] the maximum number of trades to fetch
|
|
582
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
583
|
-
* @param {int} params.lastId order id
|
|
584
|
-
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
585
|
-
*/
|
|
586
|
-
async fetchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
587
|
-
await this.loadMarkets();
|
|
588
|
-
const market = this.market(symbol);
|
|
589
|
-
const request = {
|
|
590
|
-
'market': market['id'],
|
|
591
|
-
};
|
|
592
|
-
const response = await this.publicGetHistoryMarket(this.extend(request, params));
|
|
593
|
-
return this.parseTrades(response, market, since, limit);
|
|
594
|
-
}
|
|
595
|
-
parseTrade(trade, market = undefined) {
|
|
596
|
-
//
|
|
597
|
-
// {
|
|
598
|
-
// "date":1515128233,
|
|
599
|
-
// "type":"sell",
|
|
600
|
-
// "price":"0.02454320",
|
|
601
|
-
// "quantity":"0.17614230"
|
|
602
|
-
// }
|
|
603
|
-
//
|
|
604
|
-
const timestamp = this.safeIntegerProduct(trade, 'date', 1000);
|
|
605
|
-
return this.safeTrade({
|
|
606
|
-
'info': trade,
|
|
607
|
-
'id': undefined,
|
|
608
|
-
'timestamp': timestamp,
|
|
609
|
-
'datetime': this.iso8601(timestamp),
|
|
610
|
-
'symbol': this.safeString(market, 'symbol'),
|
|
611
|
-
'order': undefined,
|
|
612
|
-
'type': undefined,
|
|
613
|
-
'side': this.safeString(trade, 'type'),
|
|
614
|
-
'takerOrMaker': undefined,
|
|
615
|
-
'price': this.safeString(trade, 'price'),
|
|
616
|
-
'amount': this.safeString(trade, 'quantity'),
|
|
617
|
-
'cost': undefined,
|
|
618
|
-
'fee': {
|
|
619
|
-
'currency': undefined,
|
|
620
|
-
'cost': undefined,
|
|
621
|
-
},
|
|
622
|
-
}, market);
|
|
623
|
-
}
|
|
624
|
-
/**
|
|
625
|
-
* @method
|
|
626
|
-
* @name tradeogre#fetchBalance
|
|
627
|
-
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
628
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
629
|
-
* @param {string} [params.currency] currency to fetch the balance for
|
|
630
|
-
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
631
|
-
*/
|
|
632
|
-
async fetchBalance(params = {}) {
|
|
633
|
-
await this.loadMarkets();
|
|
634
|
-
let response = undefined;
|
|
635
|
-
const currency = this.safeString(params, 'currency');
|
|
636
|
-
if (currency !== undefined) {
|
|
637
|
-
response = await this.privatePostAccountBalance(params);
|
|
638
|
-
const singleCurrencyresult = {
|
|
639
|
-
'info': response,
|
|
640
|
-
};
|
|
641
|
-
const code = this.safeCurrencyCode(currency);
|
|
642
|
-
const account = {
|
|
643
|
-
'total': this.safeNumber(response, 'balance'),
|
|
644
|
-
'free': this.safeNumber(response, 'available'),
|
|
645
|
-
};
|
|
646
|
-
singleCurrencyresult[code] = account;
|
|
647
|
-
return this.safeBalance(singleCurrencyresult);
|
|
648
|
-
}
|
|
649
|
-
else {
|
|
650
|
-
response = await this.privateGetAccountBalances(params);
|
|
651
|
-
}
|
|
652
|
-
const result = this.safeDict(response, 'balances', {});
|
|
653
|
-
return this.parseBalance(result);
|
|
654
|
-
}
|
|
655
|
-
parseBalance(response) {
|
|
656
|
-
//
|
|
657
|
-
// {
|
|
658
|
-
// "USDT": "12"
|
|
659
|
-
// }
|
|
660
|
-
//
|
|
661
|
-
const result = {
|
|
662
|
-
'info': response,
|
|
663
|
-
};
|
|
664
|
-
const keys = Object.keys(response);
|
|
665
|
-
for (let i = 0; i < keys.length; i++) {
|
|
666
|
-
const currencyId = keys[i];
|
|
667
|
-
const balance = response[currencyId];
|
|
668
|
-
const code = this.safeCurrencyCode(currencyId);
|
|
669
|
-
const account = {
|
|
670
|
-
'total': balance,
|
|
671
|
-
};
|
|
672
|
-
result[code] = account;
|
|
673
|
-
}
|
|
674
|
-
return this.safeBalance(result);
|
|
675
|
-
}
|
|
676
|
-
/**
|
|
677
|
-
* @method
|
|
678
|
-
* @name tradeogre#createOrder
|
|
679
|
-
* @description create a trade order
|
|
680
|
-
* @see https://tradeogre.com/help/api#:~:text=u%20%27%7Bpublic%7D%3A%7Bprivate%7D%27-,Submit%20Buy%20Order
|
|
681
|
-
* @param {string} symbol unified symbol of the market to create an order in
|
|
682
|
-
* @param {string} type must be 'limit'
|
|
683
|
-
* @param {string} side 'buy' or 'sell'
|
|
684
|
-
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
685
|
-
* @param {float} price the price at which the order is to be fulfilled, in units of the quote currency
|
|
686
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
687
|
-
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
688
|
-
*/
|
|
689
|
-
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
690
|
-
await this.loadMarkets();
|
|
691
|
-
const market = this.market(symbol);
|
|
692
|
-
if (type === 'market') {
|
|
693
|
-
throw new BadRequest(this.id + ' createOrder does not support market orders');
|
|
694
|
-
}
|
|
695
|
-
if (price === undefined) {
|
|
696
|
-
throw new ArgumentsRequired(this.id + ' createOrder requires a price parameter');
|
|
697
|
-
}
|
|
698
|
-
const request = {
|
|
699
|
-
'market': market['id'],
|
|
700
|
-
'quantity': this.amountToPrecision(symbol, amount),
|
|
701
|
-
'price': this.priceToPrecision(symbol, price),
|
|
702
|
-
};
|
|
703
|
-
let response = undefined;
|
|
704
|
-
if (side === 'buy') {
|
|
705
|
-
response = await this.privatePostOrderBuy(this.extend(request, params));
|
|
706
|
-
}
|
|
707
|
-
else {
|
|
708
|
-
response = await this.privatePostOrderSell(this.extend(request, params));
|
|
709
|
-
}
|
|
710
|
-
return this.parseOrder(response, market);
|
|
711
|
-
}
|
|
712
|
-
/**
|
|
713
|
-
* @method
|
|
714
|
-
* @name tradeogre#cancelOrder
|
|
715
|
-
* @description cancels an open order
|
|
716
|
-
* @param {string} id order id
|
|
717
|
-
* @param {string} symbol unified symbol of the market the order was made in
|
|
718
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
719
|
-
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
720
|
-
*/
|
|
721
|
-
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
722
|
-
await this.loadMarkets();
|
|
723
|
-
const request = {
|
|
724
|
-
'uuid': id,
|
|
725
|
-
};
|
|
726
|
-
const response = await this.privatePostOrderCancel(this.extend(request, params));
|
|
727
|
-
return this.parseOrder(response);
|
|
728
|
-
}
|
|
729
|
-
/**
|
|
730
|
-
* @method
|
|
731
|
-
* @name tradeogre#cancelAllOrders
|
|
732
|
-
* @description cancel all open orders
|
|
733
|
-
* @param {string} symbol alpaca cancelAllOrders cannot setting symbol, it will cancel all open orders
|
|
734
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
735
|
-
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
736
|
-
*/
|
|
737
|
-
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
738
|
-
await this.loadMarkets();
|
|
739
|
-
const response = await this.cancelOrder('all', symbol, params);
|
|
740
|
-
return [
|
|
741
|
-
response,
|
|
742
|
-
];
|
|
743
|
-
}
|
|
744
|
-
/**
|
|
745
|
-
* @method
|
|
746
|
-
* @name tradeogre#fetchOpenOrders
|
|
747
|
-
* @description fetch all unfilled currently open orders
|
|
748
|
-
* @see https://tradeogre.com/help/api#:~:text=%7B%22success%22%3Atrue%7D-,Get%20Orders,-Method%20(POST)
|
|
749
|
-
* @param {string} symbol unified market symbol of the market orders were made in
|
|
750
|
-
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
751
|
-
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
752
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
753
|
-
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
754
|
-
*/
|
|
755
|
-
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
756
|
-
await this.loadMarkets();
|
|
757
|
-
let market = undefined;
|
|
758
|
-
if (symbol !== undefined) {
|
|
759
|
-
market = this.market(symbol);
|
|
760
|
-
}
|
|
761
|
-
const request = {};
|
|
762
|
-
if (symbol !== undefined) {
|
|
763
|
-
request['market'] = market['id'];
|
|
764
|
-
}
|
|
765
|
-
const response = await this.privatePostAccountOrders(this.extend(request, params));
|
|
766
|
-
return this.parseOrders(response, market, since, limit);
|
|
767
|
-
}
|
|
768
|
-
/**
|
|
769
|
-
* @method
|
|
770
|
-
* @name tradeogre#fetchOrder
|
|
771
|
-
* @description fetches information on an order made by the user
|
|
772
|
-
* @see https://tradeogre.com/help/api#:~:text=market%22%3A%22XMR%2DBTC%22%7D%5D-,Get%20Order,-Method%20(GET)
|
|
773
|
-
* @param {string} id order id
|
|
774
|
-
* @param {string} symbol unified symbol of the market the order was made in
|
|
775
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
776
|
-
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
777
|
-
*/
|
|
778
|
-
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
779
|
-
await this.loadMarkets();
|
|
780
|
-
const request = {
|
|
781
|
-
'uuid': id,
|
|
782
|
-
};
|
|
783
|
-
const response = await this.privateGetAccountOrderUuid(this.extend(request, params));
|
|
784
|
-
return this.parseOrder(response, undefined);
|
|
785
|
-
}
|
|
786
|
-
parseOrder(order, market = undefined) {
|
|
787
|
-
//
|
|
788
|
-
//
|
|
789
|
-
// {
|
|
790
|
-
// "uuid": "a40ac710-8dc5-b5a8-aa69-389715197b14",
|
|
791
|
-
// "date": 1514876938,
|
|
792
|
-
// "type": "sell",
|
|
793
|
-
// "price": "0.02621960",
|
|
794
|
-
// "quantity": "1.55772526",
|
|
795
|
-
// "market": "XMR-BTC"
|
|
796
|
-
// }
|
|
797
|
-
//
|
|
798
|
-
const timestamp = this.safeIntegerProduct(order, 'date', 1000);
|
|
799
|
-
const marketId = this.safeString(order, 'market');
|
|
800
|
-
market = this.safeMarket(marketId, market);
|
|
801
|
-
return this.safeOrder({
|
|
802
|
-
'info': order,
|
|
803
|
-
'id': this.safeString(order, 'uuid'),
|
|
804
|
-
'clientOrderId': undefined,
|
|
805
|
-
'timestamp': timestamp,
|
|
806
|
-
'datetime': this.iso8601(timestamp),
|
|
807
|
-
'lastTradeTimestamp': undefined,
|
|
808
|
-
'symbol': market['symbol'],
|
|
809
|
-
'type': undefined,
|
|
810
|
-
'timeInForce': undefined,
|
|
811
|
-
'postOnly': undefined,
|
|
812
|
-
'side': this.safeString(order, 'type'),
|
|
813
|
-
'price': this.safeString(order, 'price'),
|
|
814
|
-
'triggerPrice': undefined,
|
|
815
|
-
'amount': undefined,
|
|
816
|
-
'cost': undefined,
|
|
817
|
-
'average': undefined,
|
|
818
|
-
'filled': this.safeString(order, 'fulfilled'),
|
|
819
|
-
'remaining': this.safeString(order, 'quantity'),
|
|
820
|
-
'status': undefined,
|
|
821
|
-
'fee': {
|
|
822
|
-
'currency': undefined,
|
|
823
|
-
'cost': undefined,
|
|
824
|
-
},
|
|
825
|
-
'trades': undefined,
|
|
826
|
-
}, market);
|
|
827
|
-
}
|
|
828
|
-
sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
829
|
-
let url = this.urls['api']['rest'] + '/' + this.implodeParams(path, params);
|
|
830
|
-
params = this.omit(params, this.extractParams(path));
|
|
831
|
-
if (method === 'GET') {
|
|
832
|
-
if (Object.keys(params).length) {
|
|
833
|
-
url += '?' + this.urlencode(params);
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
if (api === 'private') {
|
|
837
|
-
headers = {
|
|
838
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
839
|
-
'Referer': 'CCXT',
|
|
840
|
-
'authorization': 'Basic ' + this.stringToBase64(this.apiKey + ':' + this.secret),
|
|
841
|
-
};
|
|
842
|
-
if (method !== 'GET') {
|
|
843
|
-
body = this.urlencode(params);
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
|
847
|
-
}
|
|
848
|
-
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
849
|
-
if (response === undefined) {
|
|
850
|
-
return undefined;
|
|
851
|
-
}
|
|
852
|
-
if (!('success' in response)) {
|
|
853
|
-
return undefined;
|
|
854
|
-
}
|
|
855
|
-
//
|
|
856
|
-
// {"success":false,"error":"Must be authorized"}
|
|
857
|
-
//
|
|
858
|
-
const success = this.safeBool(response, 'success');
|
|
859
|
-
if (success) {
|
|
860
|
-
return undefined;
|
|
861
|
-
}
|
|
862
|
-
const successString = this.safeString(response, 'success');
|
|
863
|
-
if (successString === 'true') {
|
|
864
|
-
return undefined;
|
|
865
|
-
}
|
|
866
|
-
const error = this.safeValue(response, 'error');
|
|
867
|
-
const errorCode = this.safeString(error, 'code');
|
|
868
|
-
const feedback = this.id + ' ' + this.json(response);
|
|
869
|
-
this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);
|
|
870
|
-
throw new ExchangeError(feedback);
|
|
871
|
-
}
|
|
872
|
-
}
|