ccxt-look 1.81.50
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/.cache/eslintcache +1 -0
- package/.dockerignore +6 -0
- package/.eslintignore +1 -0
- package/.gitattributes +5 -0
- package/.readthedocs.yaml +16 -0
- package/CONTRIBUTING.md +1049 -0
- package/LICENSE.txt +21 -0
- package/README.md +537 -0
- package/SECURITY.md +5 -0
- package/build/cleanup-old-tags.js +94 -0
- package/build/countries.js +256 -0
- package/build/export-exchanges.js +520 -0
- package/build/fs.js +51 -0
- package/build/transpile.js +1772 -0
- package/build/vss.js +78 -0
- package/ccxt.browser.js +7 -0
- package/ccxt.d.ts +692 -0
- package/ccxt.js +171 -0
- package/cleanup.sh +2 -0
- package/composer-install.sh +20 -0
- package/dist/ccxt.browser.js +208383 -0
- package/gource.sh +3 -0
- package/index.html +7 -0
- package/js/.eslintrc +87 -0
- package/js/aax.js +2686 -0
- package/js/ascendex.js +2584 -0
- package/js/base/.eslintrc.js +43 -0
- package/js/base/Exchange.js +2371 -0
- package/js/base/Precise.js +283 -0
- package/js/base/errorHierarchy.js +47 -0
- package/js/base/errors.js +55 -0
- package/js/base/functions/crypto.js +158 -0
- package/js/base/functions/encode.js +118 -0
- package/js/base/functions/generic.js +270 -0
- package/js/base/functions/misc.js +138 -0
- package/js/base/functions/number.js +329 -0
- package/js/base/functions/platform.js +38 -0
- package/js/base/functions/string.js +21 -0
- package/js/base/functions/throttle.js +79 -0
- package/js/base/functions/time.js +210 -0
- package/js/base/functions/type.js +66 -0
- package/js/base/functions.js +28 -0
- package/js/bequant.js +32 -0
- package/js/bibox.js +1407 -0
- package/js/bigone.js +1366 -0
- package/js/binance.js +5652 -0
- package/js/binancecoinm.js +46 -0
- package/js/binanceus.js +46 -0
- package/js/binanceusdm.js +49 -0
- package/js/bit2c.js +535 -0
- package/js/bitbank.js +842 -0
- package/js/bitbay.js +16 -0
- package/js/bitbns.js +1073 -0
- package/js/bitcoincom.js +15 -0
- package/js/bitfinex.js +1433 -0
- package/js/bitfinex2.js +2025 -0
- package/js/bitflyer.js +840 -0
- package/js/bitforex.js +614 -0
- package/js/bitget.js +2397 -0
- package/js/bithumb.js +980 -0
- package/js/bitmart.js +2516 -0
- package/js/bitmex.js +1809 -0
- package/js/bitopro.js +1443 -0
- package/js/bitpanda.js +1782 -0
- package/js/bitrue.js +1747 -0
- package/js/bitso.js +1062 -0
- package/js/bitstamp.js +1757 -0
- package/js/bitstamp1.js +343 -0
- package/js/bittrex.js +1876 -0
- package/js/bitvavo.js +1579 -0
- package/js/bkex.js +1233 -0
- package/js/bl3p.js +346 -0
- package/js/blockchaincom.js +969 -0
- package/js/btcalpha.js +680 -0
- package/js/btcbox.js +477 -0
- package/js/btcmarkets.js +1022 -0
- package/js/btctradeua.js +466 -0
- package/js/btcturk.js +734 -0
- package/js/buda.js +946 -0
- package/js/bw.js +1265 -0
- package/js/bybit.js +3372 -0
- package/js/bytetrade.js +1336 -0
- package/js/cdax.js +1646 -0
- package/js/cex.js +1410 -0
- package/js/coinbase.js +1342 -0
- package/js/coinbaseprime.js +31 -0
- package/js/coinbasepro.js +1466 -0
- package/js/coincheck.js +755 -0
- package/js/coinex.js +3400 -0
- package/js/coinfalcon.js +880 -0
- package/js/coinmate.js +794 -0
- package/js/coinone.js +816 -0
- package/js/coinspot.js +345 -0
- package/js/crex24.js +1636 -0
- package/js/cryptocom.js +1832 -0
- package/js/currencycom.js +1748 -0
- package/js/delta.js +1547 -0
- package/js/deribit.js +2148 -0
- package/js/digifinex.js +1585 -0
- package/js/eqonex.js +1660 -0
- package/js/exmo.js +1670 -0
- package/js/fairdesk.js +1231 -0
- package/js/flowbtc.js +35 -0
- package/js/fmfwio.js +34 -0
- package/js/ftx.js +2751 -0
- package/js/ftxus.js +38 -0
- package/js/gateio.js +4174 -0
- package/js/gemini.js +1397 -0
- package/js/hitbtc.js +1343 -0
- package/js/hitbtc3.js +2329 -0
- package/js/hollaex.js +1486 -0
- package/js/huobi.js +5706 -0
- package/js/huobijp.js +1710 -0
- package/js/huobipro.js +18 -0
- package/js/idex.js +1439 -0
- package/js/independentreserve.js +649 -0
- package/js/indodax.js +742 -0
- package/js/itbit.js +722 -0
- package/js/kraken.js +2179 -0
- package/js/kucoin.js +2571 -0
- package/js/kucoinfutures.js +1771 -0
- package/js/kuna.js +809 -0
- package/js/latoken.js +1445 -0
- package/js/lbank.js +760 -0
- package/js/liquid.js +1432 -0
- package/js/luno.js +873 -0
- package/js/lykke.js +1147 -0
- package/js/mercado.js +771 -0
- package/js/mexc.js +3151 -0
- package/js/ndax.js +2233 -0
- package/js/novadax.js +1318 -0
- package/js/oceanex.js +816 -0
- package/js/okcoin.js +3841 -0
- package/js/okex.js +16 -0
- package/js/okex5.js +16 -0
- package/js/okx.js +4795 -0
- package/js/paymium.js +498 -0
- package/js/phemex.js +2957 -0
- package/js/poloniex.js +1674 -0
- package/js/probit.js +1346 -0
- package/js/qtrade.js +1588 -0
- package/js/ripio.js +1061 -0
- package/js/static_dependencies/BN/bn.js +3526 -0
- package/js/static_dependencies/README.md +1 -0
- package/js/static_dependencies/crypto-js/crypto-js.js +5988 -0
- package/js/static_dependencies/elliptic/lib/elliptic/curve/base.js +375 -0
- package/js/static_dependencies/elliptic/lib/elliptic/curve/edwards.js +433 -0
- package/js/static_dependencies/elliptic/lib/elliptic/curve/index.js +8 -0
- package/js/static_dependencies/elliptic/lib/elliptic/curve/mont.js +180 -0
- package/js/static_dependencies/elliptic/lib/elliptic/curve/short.js +938 -0
- package/js/static_dependencies/elliptic/lib/elliptic/curves.js +204 -0
- package/js/static_dependencies/elliptic/lib/elliptic/ec/index.js +240 -0
- package/js/static_dependencies/elliptic/lib/elliptic/ec/key.js +119 -0
- package/js/static_dependencies/elliptic/lib/elliptic/ec/signature.js +24 -0
- package/js/static_dependencies/elliptic/lib/elliptic/eddsa/index.js +145 -0
- package/js/static_dependencies/elliptic/lib/elliptic/eddsa/key.js +100 -0
- package/js/static_dependencies/elliptic/lib/elliptic/eddsa/signature.js +65 -0
- package/js/static_dependencies/elliptic/lib/elliptic/precomputed/secp256k1.js +780 -0
- package/js/static_dependencies/elliptic/lib/elliptic/utils.js +214 -0
- package/js/static_dependencies/elliptic/lib/elliptic.js +22 -0
- package/js/static_dependencies/elliptic/lib/hmac-drbg/hmac-drbg.js +114 -0
- package/js/static_dependencies/fetch-ponyfill/fetch-node.js +39 -0
- package/js/static_dependencies/node-fetch/index.js +1564 -0
- package/js/static_dependencies/node-rsa/NodeRSA.js +223 -0
- package/js/static_dependencies/node-rsa/asn1/ber/errors.js +13 -0
- package/js/static_dependencies/node-rsa/asn1/ber/index.js +21 -0
- package/js/static_dependencies/node-rsa/asn1/ber/reader.js +262 -0
- package/js/static_dependencies/node-rsa/asn1/ber/types.js +36 -0
- package/js/static_dependencies/node-rsa/asn1/index.js +17 -0
- package/js/static_dependencies/node-rsa/encryptEngines/js.js +34 -0
- package/js/static_dependencies/node-rsa/formats/components.js +71 -0
- package/js/static_dependencies/node-rsa/formats/formats.js +31 -0
- package/js/static_dependencies/node-rsa/formats/pkcs1.js +148 -0
- package/js/static_dependencies/node-rsa/formats/pkcs8.js +187 -0
- package/js/static_dependencies/node-rsa/libs/jsbn.js +1252 -0
- package/js/static_dependencies/node-rsa/libs/rsa.js +147 -0
- package/js/static_dependencies/node-rsa/schemes/pkcs1.js +176 -0
- package/js/static_dependencies/node-rsa/schemes/schemes.js +21 -0
- package/js/static_dependencies/node-rsa/utils.js +98 -0
- package/js/static_dependencies/qs/formats.js +18 -0
- package/js/static_dependencies/qs/index.js +11 -0
- package/js/static_dependencies/qs/parse.js +242 -0
- package/js/static_dependencies/qs/stringify.js +269 -0
- package/js/static_dependencies/qs/utils.js +230 -0
- package/js/stex.js +1925 -0
- package/js/test/.eslintrc.js +42 -0
- package/js/test/Exchange/test.balance.js +61 -0
- package/js/test/Exchange/test.borrowRate.js +32 -0
- package/js/test/Exchange/test.currency.js +52 -0
- package/js/test/Exchange/test.fetchBalance.js +23 -0
- package/js/test/Exchange/test.fetchBorrowInterest.js +59 -0
- package/js/test/Exchange/test.fetchBorrowRate.js +32 -0
- package/js/test/Exchange/test.fetchBorrowRates.js +28 -0
- package/js/test/Exchange/test.fetchClosedOrders.js +32 -0
- package/js/test/Exchange/test.fetchCurrencies.js +35 -0
- package/js/test/Exchange/test.fetchDeposits.js +31 -0
- package/js/test/Exchange/test.fetchFundingFees.js +19 -0
- package/js/test/Exchange/test.fetchFundingRateHistory.js +40 -0
- package/js/test/Exchange/test.fetchL2OrderBook.js +23 -0
- package/js/test/Exchange/test.fetchLedger.js +42 -0
- package/js/test/Exchange/test.fetchLeverageTiers.js +33 -0
- package/js/test/Exchange/test.fetchMarketLeverageTiers.js +22 -0
- package/js/test/Exchange/test.fetchMarkets.js +33 -0
- package/js/test/Exchange/test.fetchMyTrades.js +42 -0
- package/js/test/Exchange/test.fetchOHLCV.js +46 -0
- package/js/test/Exchange/test.fetchOpenOrders.js +36 -0
- package/js/test/Exchange/test.fetchOrderBook.js +25 -0
- package/js/test/Exchange/test.fetchOrderBooks.js +35 -0
- package/js/test/Exchange/test.fetchOrders.js +41 -0
- package/js/test/Exchange/test.fetchPositions.js +47 -0
- package/js/test/Exchange/test.fetchStatus.js +35 -0
- package/js/test/Exchange/test.fetchTicker.js +38 -0
- package/js/test/Exchange/test.fetchTickers.js +49 -0
- package/js/test/Exchange/test.fetchTrades.js +39 -0
- package/js/test/Exchange/test.fetchTradingFee.js +18 -0
- package/js/test/Exchange/test.fetchTradingFees.js +22 -0
- package/js/test/Exchange/test.fetchTransactions.js +31 -0
- package/js/test/Exchange/test.fetchWithdrawals.js +31 -0
- package/js/test/Exchange/test.ledgerItem.js +46 -0
- package/js/test/Exchange/test.leverageTier.js +33 -0
- package/js/test/Exchange/test.loadMarkets.js +35 -0
- package/js/test/Exchange/test.market.js +129 -0
- package/js/test/Exchange/test.ohlcv.js +33 -0
- package/js/test/Exchange/test.order.js +62 -0
- package/js/test/Exchange/test.orderbook.js +61 -0
- package/js/test/Exchange/test.position.js +21 -0
- package/js/test/Exchange/test.throttle.js +94 -0
- package/js/test/Exchange/test.ticker.js +95 -0
- package/js/test/Exchange/test.trade.js +68 -0
- package/js/test/Exchange/test.tradingFee.js +34 -0
- package/js/test/Exchange/test.transaction.js +35 -0
- package/js/test/base/.eslintrc +38 -0
- package/js/test/base/functions/test.crypto.js +110 -0
- package/js/test/base/functions/test.datetime.js +62 -0
- package/js/test/base/functions/test.generic.js +152 -0
- package/js/test/base/functions/test.number.js +362 -0
- package/js/test/base/functions/test.time.js +56 -0
- package/js/test/base/functions/test.type.js +53 -0
- package/js/test/base/test.base.js +193 -0
- package/js/test/errors/test.InsufficientFunds.js +86 -0
- package/js/test/errors/test.InvalidNonce.js +64 -0
- package/js/test/errors/test.InvalidOrder.js +35 -0
- package/js/test/errors/test.OrderNotFound.js +39 -0
- package/js/test/test.js +426 -0
- package/js/test/test.timeout_hang.js +12 -0
- package/js/therock.js +1431 -0
- package/js/tidebit.js +632 -0
- package/js/tidex.js +939 -0
- package/js/timex.js +1283 -0
- package/js/upbit.js +1622 -0
- package/js/vcc.js +1353 -0
- package/js/wavesexchange.js +2185 -0
- package/js/wazirx.js +732 -0
- package/js/whitebit.js +1352 -0
- package/js/woo.js +1577 -0
- package/js/xena.js +1948 -0
- package/js/yobit.js +1129 -0
- package/js/zaif.js +647 -0
- package/js/zb.js +4088 -0
- package/js/zipmex.js +40 -0
- package/js/zonda.js +1497 -0
- package/multilang.sh +159 -0
- package/package.json +591 -0
- package/postinstall.js +103 -0
package/js/indodax.js
ADDED
@@ -0,0 +1,742 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
// ---------------------------------------------------------------------------
|
4
|
+
|
5
|
+
const Exchange = require ('./base/Exchange');
|
6
|
+
const { ExchangeError, ArgumentsRequired, InsufficientFunds, InvalidOrder, OrderNotFound, AuthenticationError, BadSymbol } = require ('./base/errors');
|
7
|
+
|
8
|
+
// ---------------------------------------------------------------------------
|
9
|
+
|
10
|
+
module.exports = class indodax extends Exchange {
|
11
|
+
describe () {
|
12
|
+
return this.deepExtend (super.describe (), {
|
13
|
+
'id': 'indodax',
|
14
|
+
'name': 'INDODAX',
|
15
|
+
'countries': [ 'ID' ], // Indonesia
|
16
|
+
// 10 requests per second for making trades => 1000ms / 10 = 100ms
|
17
|
+
// 180 requests per minute (public endpoints) = 2 requests per second => cost = (1000ms / rateLimit) / 2 = 5
|
18
|
+
'rateLimit': 100,
|
19
|
+
'has': {
|
20
|
+
'CORS': undefined,
|
21
|
+
'spot': true,
|
22
|
+
'margin': false,
|
23
|
+
'swap': false,
|
24
|
+
'future': false,
|
25
|
+
'option': false,
|
26
|
+
'addMargin': false,
|
27
|
+
'cancelOrder': true,
|
28
|
+
'createMarketOrder': undefined,
|
29
|
+
'createOrder': true,
|
30
|
+
'createReduceOnlyOrder': false,
|
31
|
+
'fetchBalance': true,
|
32
|
+
'fetchBorrowRate': false,
|
33
|
+
'fetchBorrowRateHistories': false,
|
34
|
+
'fetchBorrowRateHistory': false,
|
35
|
+
'fetchBorrowRates': false,
|
36
|
+
'fetchBorrowRatesPerSymbol': false,
|
37
|
+
'fetchClosedOrders': true,
|
38
|
+
'fetchFundingHistory': false,
|
39
|
+
'fetchFundingRate': false,
|
40
|
+
'fetchFundingRateHistory': false,
|
41
|
+
'fetchFundingRates': false,
|
42
|
+
'fetchIndexOHLCV': false,
|
43
|
+
'fetchLeverage': false,
|
44
|
+
'fetchLeverageTiers': false,
|
45
|
+
'fetchMarkets': true,
|
46
|
+
'fetchMarkOHLCV': false,
|
47
|
+
'fetchMyTrades': undefined,
|
48
|
+
'fetchOpenOrders': true,
|
49
|
+
'fetchOrder': true,
|
50
|
+
'fetchOrderBook': true,
|
51
|
+
'fetchOrders': undefined,
|
52
|
+
'fetchPosition': false,
|
53
|
+
'fetchPositions': false,
|
54
|
+
'fetchPositionsRisk': false,
|
55
|
+
'fetchPremiumIndexOHLCV': false,
|
56
|
+
'fetchTicker': true,
|
57
|
+
'fetchTickers': undefined,
|
58
|
+
'fetchTime': true,
|
59
|
+
'fetchTrades': true,
|
60
|
+
'fetchTradingFee': false,
|
61
|
+
'fetchTradingFees': false,
|
62
|
+
'reduceMargin': false,
|
63
|
+
'setLeverage': false,
|
64
|
+
'setMarginMode': false,
|
65
|
+
'setPositionMode': false,
|
66
|
+
'withdraw': true,
|
67
|
+
},
|
68
|
+
'version': '2.0', // as of 9 April 2018
|
69
|
+
'urls': {
|
70
|
+
'logo': 'https://user-images.githubusercontent.com/51840849/87070508-9358c880-c221-11ea-8dc5-5391afbbb422.jpg',
|
71
|
+
'api': {
|
72
|
+
'public': 'https://indodax.com/api',
|
73
|
+
'private': 'https://indodax.com/tapi',
|
74
|
+
},
|
75
|
+
'www': 'https://www.indodax.com',
|
76
|
+
'doc': 'https://github.com/btcid/indodax-official-api-docs',
|
77
|
+
'referral': 'https://indodax.com/ref/testbitcoincoid/1',
|
78
|
+
},
|
79
|
+
'api': {
|
80
|
+
'public': {
|
81
|
+
'get': {
|
82
|
+
'server_time': 5,
|
83
|
+
'pairs': 5,
|
84
|
+
'price_increments': 5,
|
85
|
+
'summaries': 5,
|
86
|
+
'ticker_all': 5,
|
87
|
+
'{pair}/ticker': 5,
|
88
|
+
'{pair}/trades': 5,
|
89
|
+
'{pair}/depth': 5,
|
90
|
+
},
|
91
|
+
},
|
92
|
+
'private': {
|
93
|
+
'post': {
|
94
|
+
'getInfo': 4,
|
95
|
+
'transHistory': 4, // TODO add fetchDeposits, fetchWithdrawals, fetchTransactionsbyType
|
96
|
+
'trade': 1,
|
97
|
+
'tradeHistory': 4, // TODO add fetchMyTrades
|
98
|
+
'openOrders': 4,
|
99
|
+
'orderHistory': 4,
|
100
|
+
'getOrder': 4,
|
101
|
+
'cancelOrder': 4,
|
102
|
+
'withdrawFee': 4,
|
103
|
+
'withdrawCoin': 4,
|
104
|
+
'listDownline': 4,
|
105
|
+
'checkDownline': 4,
|
106
|
+
'createVoucher': 4, // partner only
|
107
|
+
},
|
108
|
+
},
|
109
|
+
},
|
110
|
+
'fees': {
|
111
|
+
'trading': {
|
112
|
+
'tierBased': false,
|
113
|
+
'percentage': true,
|
114
|
+
'maker': 0,
|
115
|
+
'taker': 0.003,
|
116
|
+
},
|
117
|
+
},
|
118
|
+
'exceptions': {
|
119
|
+
'exact': {
|
120
|
+
'invalid_pair': BadSymbol, // {"error":"invalid_pair","error_description":"Invalid Pair"}
|
121
|
+
'Insufficient balance.': InsufficientFunds,
|
122
|
+
'invalid order.': OrderNotFound,
|
123
|
+
'Invalid credentials. API not found or session has expired.': AuthenticationError,
|
124
|
+
'Invalid credentials. Bad sign.': AuthenticationError,
|
125
|
+
},
|
126
|
+
'broad': {
|
127
|
+
'Minimum price': InvalidOrder,
|
128
|
+
'Minimum order': InvalidOrder,
|
129
|
+
},
|
130
|
+
},
|
131
|
+
// exchange-specific options
|
132
|
+
'options': {
|
133
|
+
'recvWindow': 5 * 1000, // default 5 sec
|
134
|
+
'timeDifference': 0, // the difference between system clock and exchange clock
|
135
|
+
'adjustForTimeDifference': false, // controls the adjustment logic upon instantiation
|
136
|
+
},
|
137
|
+
'commonCurrencies': {
|
138
|
+
'STR': 'XLM',
|
139
|
+
'BCHABC': 'BCH',
|
140
|
+
'BCHSV': 'BSV',
|
141
|
+
'DRK': 'DASH',
|
142
|
+
'NEM': 'XEM',
|
143
|
+
},
|
144
|
+
});
|
145
|
+
}
|
146
|
+
|
147
|
+
nonce () {
|
148
|
+
return this.milliseconds () - this.options['timeDifference'];
|
149
|
+
}
|
150
|
+
|
151
|
+
async fetchTime (params = {}) {
|
152
|
+
const response = await this.publicGetServerTime (params);
|
153
|
+
//
|
154
|
+
// {
|
155
|
+
// "timezone": "UTC",
|
156
|
+
// "server_time": 1571205969552
|
157
|
+
// }
|
158
|
+
//
|
159
|
+
return this.safeInteger (response, 'server_time');
|
160
|
+
}
|
161
|
+
|
162
|
+
async fetchMarkets (params = {}) {
|
163
|
+
const response = await this.publicGetPairs (params);
|
164
|
+
//
|
165
|
+
// [
|
166
|
+
// {
|
167
|
+
// "id": "btcidr",
|
168
|
+
// "symbol": "BTCIDR",
|
169
|
+
// "base_currency": "idr",
|
170
|
+
// "traded_currency": "btc",
|
171
|
+
// "traded_currency_unit": "BTC",
|
172
|
+
// "description": "BTC/IDR",
|
173
|
+
// "ticker_id": "btc_idr",
|
174
|
+
// "volume_precision": 0,
|
175
|
+
// "price_precision": 1000,
|
176
|
+
// "price_round": 8,
|
177
|
+
// "pricescale": 1000,
|
178
|
+
// "trade_min_base_currency": 10000,
|
179
|
+
// "trade_min_traded_currency": 0.00007457,
|
180
|
+
// "has_memo": false,
|
181
|
+
// "memo_name": false,
|
182
|
+
// "has_payment_id": false,
|
183
|
+
// "trade_fee_percent": 0.3,
|
184
|
+
// "url_logo": "https://indodax.com/v2/logo/svg/color/btc.svg",
|
185
|
+
// "url_logo_png": "https://indodax.com/v2/logo/png/color/btc.png",
|
186
|
+
// "is_maintenance": 0
|
187
|
+
// }
|
188
|
+
// ]
|
189
|
+
//
|
190
|
+
const result = [];
|
191
|
+
for (let i = 0; i < response.length; i++) {
|
192
|
+
const market = response[i];
|
193
|
+
const id = this.safeString (market, 'ticker_id');
|
194
|
+
const baseId = this.safeString (market, 'traded_currency');
|
195
|
+
const quoteId = this.safeString (market, 'base_currency');
|
196
|
+
const base = this.safeCurrencyCode (baseId);
|
197
|
+
const quote = this.safeCurrencyCode (quoteId);
|
198
|
+
const isMaintenance = this.safeInteger (market, 'is_maintenance');
|
199
|
+
result.push ({
|
200
|
+
'id': id,
|
201
|
+
'symbol': base + '/' + quote,
|
202
|
+
'base': base,
|
203
|
+
'quote': quote,
|
204
|
+
'settle': undefined,
|
205
|
+
'baseId': baseId,
|
206
|
+
'quoteId': quoteId,
|
207
|
+
'settleId': undefined,
|
208
|
+
'type': 'spot',
|
209
|
+
'spot': true,
|
210
|
+
'margin': false,
|
211
|
+
'swap': false,
|
212
|
+
'future': false,
|
213
|
+
'option': false,
|
214
|
+
'active': isMaintenance ? false : true,
|
215
|
+
'contract': false,
|
216
|
+
'linear': undefined,
|
217
|
+
'inverse': undefined,
|
218
|
+
'taker': this.safeNumber (market, 'trade_fee_percent'),
|
219
|
+
'contractSize': undefined,
|
220
|
+
'expiry': undefined,
|
221
|
+
'expiryDatetime': undefined,
|
222
|
+
'strike': undefined,
|
223
|
+
'optionType': undefined,
|
224
|
+
'percentage': true,
|
225
|
+
'precision': {
|
226
|
+
'amount': parseInt ('8'),
|
227
|
+
'price': this.safeInteger (market, 'price_round'),
|
228
|
+
},
|
229
|
+
'limits': {
|
230
|
+
'leverage': {
|
231
|
+
'min': undefined,
|
232
|
+
'max': undefined,
|
233
|
+
},
|
234
|
+
'amount': {
|
235
|
+
'min': this.safeNumber (market, 'trade_min_traded_currency'),
|
236
|
+
'max': undefined,
|
237
|
+
},
|
238
|
+
'price': {
|
239
|
+
'min': this.safeNumber (market, 'trade_min_base_currency'),
|
240
|
+
'max': undefined,
|
241
|
+
},
|
242
|
+
'cost': {
|
243
|
+
'min': undefined,
|
244
|
+
'max': undefined,
|
245
|
+
},
|
246
|
+
},
|
247
|
+
'info': market,
|
248
|
+
});
|
249
|
+
}
|
250
|
+
return result;
|
251
|
+
}
|
252
|
+
|
253
|
+
parseBalance (response) {
|
254
|
+
const balances = this.safeValue (response, 'return', {});
|
255
|
+
const free = this.safeValue (balances, 'balance', {});
|
256
|
+
const used = this.safeValue (balances, 'balance_hold', {});
|
257
|
+
const timestamp = this.safeTimestamp (balances, 'server_time');
|
258
|
+
const result = {
|
259
|
+
'info': response,
|
260
|
+
'timestamp': timestamp,
|
261
|
+
'datetime': this.iso8601 (timestamp),
|
262
|
+
};
|
263
|
+
const currencyIds = Object.keys (free);
|
264
|
+
for (let i = 0; i < currencyIds.length; i++) {
|
265
|
+
const currencyId = currencyIds[i];
|
266
|
+
const code = this.safeCurrencyCode (currencyId);
|
267
|
+
const account = this.account ();
|
268
|
+
account['free'] = this.safeString (free, currencyId);
|
269
|
+
account['used'] = this.safeString (used, currencyId);
|
270
|
+
result[code] = account;
|
271
|
+
}
|
272
|
+
return this.safeBalance (result);
|
273
|
+
}
|
274
|
+
|
275
|
+
async fetchBalance (params = {}) {
|
276
|
+
await this.loadMarkets ();
|
277
|
+
const response = await this.privatePostGetInfo (params);
|
278
|
+
//
|
279
|
+
// {
|
280
|
+
// "success":1,
|
281
|
+
// "return":{
|
282
|
+
// "server_time":1619562628,
|
283
|
+
// "balance":{
|
284
|
+
// "idr":167,
|
285
|
+
// "btc":"0.00000000",
|
286
|
+
// "1inch":"0.00000000",
|
287
|
+
// },
|
288
|
+
// "balance_hold":{
|
289
|
+
// "idr":0,
|
290
|
+
// "btc":"0.00000000",
|
291
|
+
// "1inch":"0.00000000",
|
292
|
+
// },
|
293
|
+
// "address":{
|
294
|
+
// "btc":"1KMntgzvU7iTSgMBWc11nVuJjAyfW3qJyk",
|
295
|
+
// "1inch":"0x1106c8bb3172625e1f411c221be49161dac19355",
|
296
|
+
// "xrp":"rwWr7KUZ3ZFwzgaDGjKBysADByzxvohQ3C",
|
297
|
+
// "zrx":"0x1106c8bb3172625e1f411c221be49161dac19355"
|
298
|
+
// },
|
299
|
+
// "user_id":"276011",
|
300
|
+
// "name":"",
|
301
|
+
// "email":"testbitcoincoid@mailforspam.com",
|
302
|
+
// "profile_picture":null,
|
303
|
+
// "verification_status":"unverified",
|
304
|
+
// "gauth_enable":true
|
305
|
+
// }
|
306
|
+
// }
|
307
|
+
//
|
308
|
+
return this.parseBalance (response);
|
309
|
+
}
|
310
|
+
|
311
|
+
async fetchOrderBook (symbol, limit = undefined, params = {}) {
|
312
|
+
await this.loadMarkets ();
|
313
|
+
const request = {
|
314
|
+
'pair': this.marketId (symbol),
|
315
|
+
};
|
316
|
+
const orderbook = await this.publicGetPairDepth (this.extend (request, params));
|
317
|
+
return this.parseOrderBook (orderbook, symbol, undefined, 'buy', 'sell');
|
318
|
+
}
|
319
|
+
|
320
|
+
parseTicker (ticker, market = undefined) {
|
321
|
+
//
|
322
|
+
// {
|
323
|
+
// "high":"0.01951",
|
324
|
+
// "low":"0.01877",
|
325
|
+
// "vol_eth":"39.38839319",
|
326
|
+
// "vol_btc":"0.75320886",
|
327
|
+
// "last":"0.01896",
|
328
|
+
// "buy":"0.01896",
|
329
|
+
// "sell":"0.019",
|
330
|
+
// "server_time":1565248908
|
331
|
+
// }
|
332
|
+
//
|
333
|
+
const symbol = this.safeSymbol (undefined, market);
|
334
|
+
const timestamp = this.safeTimestamp (ticker, 'server_time');
|
335
|
+
const baseVolume = 'vol_' + market['baseId'].toLowerCase ();
|
336
|
+
const quoteVolume = 'vol_' + market['quoteId'].toLowerCase ();
|
337
|
+
const last = this.safeString (ticker, 'last');
|
338
|
+
return this.safeTicker ({
|
339
|
+
'symbol': symbol,
|
340
|
+
'timestamp': timestamp,
|
341
|
+
'datetime': this.iso8601 (timestamp),
|
342
|
+
'high': this.safeString (ticker, 'high'),
|
343
|
+
'low': this.safeString (ticker, 'low'),
|
344
|
+
'bid': this.safeString (ticker, 'buy'),
|
345
|
+
'bidVolume': undefined,
|
346
|
+
'ask': this.safeString (ticker, 'sell'),
|
347
|
+
'askVolume': undefined,
|
348
|
+
'vwap': undefined,
|
349
|
+
'open': undefined,
|
350
|
+
'close': last,
|
351
|
+
'last': last,
|
352
|
+
'previousClose': undefined,
|
353
|
+
'change': undefined,
|
354
|
+
'percentage': undefined,
|
355
|
+
'average': undefined,
|
356
|
+
'baseVolume': this.safeString (ticker, baseVolume),
|
357
|
+
'quoteVolume': this.safeString (ticker, quoteVolume),
|
358
|
+
'info': ticker,
|
359
|
+
}, market, false);
|
360
|
+
}
|
361
|
+
|
362
|
+
async fetchTicker (symbol, params = {}) {
|
363
|
+
await this.loadMarkets ();
|
364
|
+
const market = this.market (symbol);
|
365
|
+
const request = {
|
366
|
+
'pair': market['id'],
|
367
|
+
};
|
368
|
+
const response = await this.publicGetPairTicker (this.extend (request, params));
|
369
|
+
//
|
370
|
+
// {
|
371
|
+
// "ticker": {
|
372
|
+
// "high":"0.01951",
|
373
|
+
// "low":"0.01877",
|
374
|
+
// "vol_eth":"39.38839319",
|
375
|
+
// "vol_btc":"0.75320886",
|
376
|
+
// "last":"0.01896",
|
377
|
+
// "buy":"0.01896",
|
378
|
+
// "sell":"0.019",
|
379
|
+
// "server_time":1565248908
|
380
|
+
// }
|
381
|
+
// }
|
382
|
+
//
|
383
|
+
const ticker = this.safeValue (response, 'ticker', {});
|
384
|
+
return this.parseTicker (ticker, market);
|
385
|
+
}
|
386
|
+
|
387
|
+
parseTrade (trade, market = undefined) {
|
388
|
+
const timestamp = this.safeTimestamp (trade, 'date');
|
389
|
+
return this.safeTrade ({
|
390
|
+
'id': this.safeString (trade, 'tid'),
|
391
|
+
'info': trade,
|
392
|
+
'timestamp': timestamp,
|
393
|
+
'datetime': this.iso8601 (timestamp),
|
394
|
+
'symbol': this.safeSymbol (undefined, market),
|
395
|
+
'type': undefined,
|
396
|
+
'side': this.safeString (trade, 'type'),
|
397
|
+
'order': undefined,
|
398
|
+
'takerOrMaker': undefined,
|
399
|
+
'price': this.safeString (trade, 'price'),
|
400
|
+
'amount': this.safeString (trade, 'amount'),
|
401
|
+
'cost': undefined,
|
402
|
+
'fee': undefined,
|
403
|
+
}, market);
|
404
|
+
}
|
405
|
+
|
406
|
+
async fetchTrades (symbol, since = undefined, limit = undefined, params = {}) {
|
407
|
+
await this.loadMarkets ();
|
408
|
+
const market = this.market (symbol);
|
409
|
+
const request = {
|
410
|
+
'pair': market['id'],
|
411
|
+
};
|
412
|
+
const response = await this.publicGetPairTrades (this.extend (request, params));
|
413
|
+
return this.parseTrades (response, market, since, limit);
|
414
|
+
}
|
415
|
+
|
416
|
+
parseOrderStatus (status) {
|
417
|
+
const statuses = {
|
418
|
+
'open': 'open',
|
419
|
+
'filled': 'closed',
|
420
|
+
'cancelled': 'canceled',
|
421
|
+
};
|
422
|
+
return this.safeString (statuses, status, status);
|
423
|
+
}
|
424
|
+
|
425
|
+
parseOrder (order, market = undefined) {
|
426
|
+
//
|
427
|
+
// {
|
428
|
+
// "order_id": "12345",
|
429
|
+
// "submit_time": "1392228122",
|
430
|
+
// "price": "8000000",
|
431
|
+
// "type": "sell",
|
432
|
+
// "order_ltc": "100000000",
|
433
|
+
// "remain_ltc": "100000000"
|
434
|
+
// }
|
435
|
+
//
|
436
|
+
// market closed orders - note that the price is very high
|
437
|
+
// and does not reflect actual price the order executed at
|
438
|
+
//
|
439
|
+
// {
|
440
|
+
// "order_id": "49326856",
|
441
|
+
// "type": "sell",
|
442
|
+
// "price": "1000000000",
|
443
|
+
// "submit_time": "1618314671",
|
444
|
+
// "finish_time": "1618314671",
|
445
|
+
// "status": "filled",
|
446
|
+
// "order_xrp": "30.45000000",
|
447
|
+
// "remain_xrp": "0.00000000"
|
448
|
+
// }
|
449
|
+
let side = undefined;
|
450
|
+
if ('type' in order) {
|
451
|
+
side = order['type'];
|
452
|
+
}
|
453
|
+
const status = this.parseOrderStatus (this.safeString (order, 'status', 'open'));
|
454
|
+
let symbol = undefined;
|
455
|
+
let cost = undefined;
|
456
|
+
const price = this.safeString (order, 'price');
|
457
|
+
let amount = undefined;
|
458
|
+
let remaining = undefined;
|
459
|
+
if (market !== undefined) {
|
460
|
+
symbol = market['symbol'];
|
461
|
+
let quoteId = market['quoteId'];
|
462
|
+
let baseId = market['baseId'];
|
463
|
+
if ((market['quoteId'] === 'idr') && ('order_rp' in order)) {
|
464
|
+
quoteId = 'rp';
|
465
|
+
}
|
466
|
+
if ((market['baseId'] === 'idr') && ('remain_rp' in order)) {
|
467
|
+
baseId = 'rp';
|
468
|
+
}
|
469
|
+
cost = this.safeString (order, 'order_' + quoteId);
|
470
|
+
if (!cost) {
|
471
|
+
amount = this.safeString (order, 'order_' + baseId);
|
472
|
+
remaining = this.safeString (order, 'remain_' + baseId);
|
473
|
+
}
|
474
|
+
}
|
475
|
+
const timestamp = this.safeInteger (order, 'submit_time');
|
476
|
+
const fee = undefined;
|
477
|
+
const id = this.safeString (order, 'order_id');
|
478
|
+
return this.safeOrder ({
|
479
|
+
'info': order,
|
480
|
+
'id': id,
|
481
|
+
'clientOrderId': undefined,
|
482
|
+
'timestamp': timestamp,
|
483
|
+
'datetime': this.iso8601 (timestamp),
|
484
|
+
'lastTradeTimestamp': undefined,
|
485
|
+
'symbol': symbol,
|
486
|
+
'type': 'limit',
|
487
|
+
'timeInForce': undefined,
|
488
|
+
'postOnly': undefined,
|
489
|
+
'side': side,
|
490
|
+
'price': price,
|
491
|
+
'stopPrice': undefined,
|
492
|
+
'cost': cost,
|
493
|
+
'average': undefined,
|
494
|
+
'amount': amount,
|
495
|
+
'filled': undefined,
|
496
|
+
'remaining': remaining,
|
497
|
+
'status': status,
|
498
|
+
'fee': fee,
|
499
|
+
'trades': undefined,
|
500
|
+
});
|
501
|
+
}
|
502
|
+
|
503
|
+
async fetchOrder (id, symbol = undefined, params = {}) {
|
504
|
+
if (symbol === undefined) {
|
505
|
+
throw new ArgumentsRequired (this.id + ' fetchOrder() requires a symbol');
|
506
|
+
}
|
507
|
+
await this.loadMarkets ();
|
508
|
+
const market = this.market (symbol);
|
509
|
+
const request = {
|
510
|
+
'pair': market['id'],
|
511
|
+
'order_id': id,
|
512
|
+
};
|
513
|
+
const response = await this.privatePostGetOrder (this.extend (request, params));
|
514
|
+
const orders = response['return'];
|
515
|
+
const order = this.parseOrder (this.extend ({ 'id': id }, orders['order']), market);
|
516
|
+
return this.extend ({ 'info': response }, order);
|
517
|
+
}
|
518
|
+
|
519
|
+
async fetchOpenOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
520
|
+
await this.loadMarkets ();
|
521
|
+
let market = undefined;
|
522
|
+
const request = {};
|
523
|
+
if (symbol !== undefined) {
|
524
|
+
market = this.market (symbol);
|
525
|
+
request['pair'] = market['id'];
|
526
|
+
}
|
527
|
+
const response = await this.privatePostOpenOrders (this.extend (request, params));
|
528
|
+
const rawOrders = response['return']['orders'];
|
529
|
+
// { success: 1, return: { orders: null }} if no orders
|
530
|
+
if (!rawOrders) {
|
531
|
+
return [];
|
532
|
+
}
|
533
|
+
// { success: 1, return: { orders: [ ... objects ] }} for orders fetched by symbol
|
534
|
+
if (symbol !== undefined) {
|
535
|
+
return this.parseOrders (rawOrders, market, since, limit);
|
536
|
+
}
|
537
|
+
// { success: 1, return: { orders: { marketid: [ ... objects ] }}} if all orders are fetched
|
538
|
+
const marketIds = Object.keys (rawOrders);
|
539
|
+
let exchangeOrders = [];
|
540
|
+
for (let i = 0; i < marketIds.length; i++) {
|
541
|
+
const marketId = marketIds[i];
|
542
|
+
const marketOrders = rawOrders[marketId];
|
543
|
+
market = this.markets_by_id[marketId];
|
544
|
+
const parsedOrders = this.parseOrders (marketOrders, market, since, limit);
|
545
|
+
exchangeOrders = this.arrayConcat (exchangeOrders, parsedOrders);
|
546
|
+
}
|
547
|
+
return exchangeOrders;
|
548
|
+
}
|
549
|
+
|
550
|
+
async fetchClosedOrders (symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
551
|
+
if (symbol === undefined) {
|
552
|
+
throw new ArgumentsRequired (this.id + ' fetchOrders() requires a symbol argument');
|
553
|
+
}
|
554
|
+
await this.loadMarkets ();
|
555
|
+
const request = {};
|
556
|
+
let market = undefined;
|
557
|
+
if (symbol !== undefined) {
|
558
|
+
market = this.market (symbol);
|
559
|
+
symbol = market['symbol'];
|
560
|
+
request['pair'] = market['id'];
|
561
|
+
}
|
562
|
+
const response = await this.privatePostOrderHistory (this.extend (request, params));
|
563
|
+
let orders = this.parseOrders (response['return']['orders'], market);
|
564
|
+
orders = this.filterBy (orders, 'status', 'closed');
|
565
|
+
return this.filterBySymbolSinceLimit (orders, symbol, since, limit);
|
566
|
+
}
|
567
|
+
|
568
|
+
async createOrder (symbol, type, side, amount, price = undefined, params = {}) {
|
569
|
+
if (type !== 'limit') {
|
570
|
+
throw new ExchangeError (this.id + ' createOrder() allows limit orders only');
|
571
|
+
}
|
572
|
+
await this.loadMarkets ();
|
573
|
+
const market = this.market (symbol);
|
574
|
+
const request = {
|
575
|
+
'pair': market['id'],
|
576
|
+
'type': side,
|
577
|
+
'price': price,
|
578
|
+
};
|
579
|
+
const currency = market['baseId'];
|
580
|
+
if (side === 'buy') {
|
581
|
+
request[market['quoteId']] = amount * price;
|
582
|
+
} else {
|
583
|
+
request[market['baseId']] = amount;
|
584
|
+
}
|
585
|
+
request[currency] = amount;
|
586
|
+
const result = await this.privatePostTrade (this.extend (request, params));
|
587
|
+
const data = this.safeValue (result, 'return', {});
|
588
|
+
const id = this.safeString (data, 'order_id');
|
589
|
+
return {
|
590
|
+
'info': result,
|
591
|
+
'id': id,
|
592
|
+
};
|
593
|
+
}
|
594
|
+
|
595
|
+
async cancelOrder (id, symbol = undefined, params = {}) {
|
596
|
+
if (symbol === undefined) {
|
597
|
+
throw new ArgumentsRequired (this.id + ' cancelOrder() requires a symbol argument');
|
598
|
+
}
|
599
|
+
const side = this.safeValue (params, 'side');
|
600
|
+
if (side === undefined) {
|
601
|
+
throw new ArgumentsRequired (this.id + ' cancelOrder() requires an extra "side" param');
|
602
|
+
}
|
603
|
+
await this.loadMarkets ();
|
604
|
+
const market = this.market (symbol);
|
605
|
+
const request = {
|
606
|
+
'order_id': id,
|
607
|
+
'pair': market['id'],
|
608
|
+
'type': side,
|
609
|
+
};
|
610
|
+
return await this.privatePostCancelOrder (this.extend (request, params));
|
611
|
+
}
|
612
|
+
|
613
|
+
async withdraw (code, amount, address, tag = undefined, params = {}) {
|
614
|
+
[ tag, params ] = this.handleWithdrawTagAndParams (tag, params);
|
615
|
+
this.checkAddress (address);
|
616
|
+
await this.loadMarkets ();
|
617
|
+
const currency = this.currency (code);
|
618
|
+
// Custom string you need to provide to identify each withdrawal.
|
619
|
+
// Will be passed to callback URL (assigned via website to the API key)
|
620
|
+
// so your system can identify the request and confirm it.
|
621
|
+
// Alphanumeric, max length 255.
|
622
|
+
const requestId = this.milliseconds ();
|
623
|
+
// Alternatively:
|
624
|
+
// let requestId = this.uuid ();
|
625
|
+
const request = {
|
626
|
+
'currency': currency['id'],
|
627
|
+
'withdraw_amount': amount,
|
628
|
+
'withdraw_address': address,
|
629
|
+
'request_id': requestId.toString (),
|
630
|
+
};
|
631
|
+
if (tag) {
|
632
|
+
request['withdraw_memo'] = tag;
|
633
|
+
}
|
634
|
+
const response = await this.privatePostWithdrawCoin (this.extend (request, params));
|
635
|
+
//
|
636
|
+
// {
|
637
|
+
// "success": 1,
|
638
|
+
// "status": "approved",
|
639
|
+
// "withdraw_currency": "xrp",
|
640
|
+
// "withdraw_address": "rwWr7KUZ3ZFwzgaDGjKBysADByzxvohQ3C",
|
641
|
+
// "withdraw_amount": "10000.00000000",
|
642
|
+
// "fee": "2.00000000",
|
643
|
+
// "amount_after_fee": "9998.00000000",
|
644
|
+
// "submit_time": "1509469200",
|
645
|
+
// "withdraw_id": "xrp-12345",
|
646
|
+
// "txid": "",
|
647
|
+
// "withdraw_memo": "123123"
|
648
|
+
// }
|
649
|
+
//
|
650
|
+
return this.parseTransaction (response, currency);
|
651
|
+
}
|
652
|
+
|
653
|
+
parseTransaction (transaction, currency = undefined) {
|
654
|
+
//
|
655
|
+
// withdraw
|
656
|
+
//
|
657
|
+
// {
|
658
|
+
// "success": 1,
|
659
|
+
// "status": "approved",
|
660
|
+
// "withdraw_currency": "xrp",
|
661
|
+
// "withdraw_address": "rwWr7KUZ3ZFwzgaDGjKBysADByzxvohQ3C",
|
662
|
+
// "withdraw_amount": "10000.00000000",
|
663
|
+
// "fee": "2.00000000",
|
664
|
+
// "amount_after_fee": "9998.00000000",
|
665
|
+
// "submit_time": "1509469200",
|
666
|
+
// "withdraw_id": "xrp-12345",
|
667
|
+
// "txid": "",
|
668
|
+
// "withdraw_memo": "123123"
|
669
|
+
// }
|
670
|
+
//
|
671
|
+
currency = this.safeCurrency (undefined, currency);
|
672
|
+
return {
|
673
|
+
'id': this.safeString (transaction, 'withdraw_id'),
|
674
|
+
'txid': this.safeString (transaction, 'txid'),
|
675
|
+
'timestamp': undefined,
|
676
|
+
'datetime': undefined,
|
677
|
+
'network': undefined,
|
678
|
+
'addressFrom': undefined,
|
679
|
+
'address': undefined,
|
680
|
+
'addressTo': undefined,
|
681
|
+
'amount': undefined,
|
682
|
+
'type': undefined,
|
683
|
+
'currency': currency['code'],
|
684
|
+
'status': undefined,
|
685
|
+
'updated': undefined,
|
686
|
+
'tagFrom': undefined,
|
687
|
+
'tag': undefined,
|
688
|
+
'tagTo': undefined,
|
689
|
+
'comment': undefined,
|
690
|
+
'fee': undefined,
|
691
|
+
'info': transaction,
|
692
|
+
};
|
693
|
+
}
|
694
|
+
|
695
|
+
sign (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
696
|
+
let url = this.urls['api'][api];
|
697
|
+
if (api === 'public') {
|
698
|
+
url += '/' + this.implodeParams (path, params);
|
699
|
+
} else {
|
700
|
+
this.checkRequiredCredentials ();
|
701
|
+
body = this.urlencode (this.extend ({
|
702
|
+
'method': path,
|
703
|
+
'timestamp': this.nonce (),
|
704
|
+
'recvWindow': this.options['recvWindow'],
|
705
|
+
}, params));
|
706
|
+
headers = {
|
707
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
708
|
+
'Key': this.apiKey,
|
709
|
+
'Sign': this.hmac (this.encode (body), this.encode (this.secret), 'sha512'),
|
710
|
+
};
|
711
|
+
}
|
712
|
+
return { 'url': url, 'method': method, 'body': body, 'headers': headers };
|
713
|
+
}
|
714
|
+
|
715
|
+
handleErrors (code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
716
|
+
if (response === undefined) {
|
717
|
+
return;
|
718
|
+
}
|
719
|
+
// { success: 0, error: "invalid order." }
|
720
|
+
// or
|
721
|
+
// [{ data, ... }, { ... }, ... ]
|
722
|
+
if (Array.isArray (response)) {
|
723
|
+
return; // public endpoints may return []-arrays
|
724
|
+
}
|
725
|
+
const error = this.safeValue (response, 'error', '');
|
726
|
+
if (!('success' in response) && error === '') {
|
727
|
+
return; // no 'success' property on public responses
|
728
|
+
}
|
729
|
+
if (this.safeInteger (response, 'success', 0) === 1) {
|
730
|
+
// { success: 1, return: { orders: [] }}
|
731
|
+
if (!('return' in response)) {
|
732
|
+
throw new ExchangeError (this.id + ': malformed response: ' + this.json (response));
|
733
|
+
} else {
|
734
|
+
return;
|
735
|
+
}
|
736
|
+
}
|
737
|
+
const feedback = this.id + ' ' + body;
|
738
|
+
this.throwExactlyMatchedException (this.exceptions['exact'], error, feedback);
|
739
|
+
this.throwBroadlyMatchedException (this.exceptions['broad'], error, feedback);
|
740
|
+
throw new ExchangeError (feedback); // unknown message
|
741
|
+
}
|
742
|
+
};
|