ccxt 4.2.73 → 4.2.75
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 +1042 -297
- 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/base/Exchange.js +1 -1
- package/dist/cjs/src/bitget.js +62 -50
- package/dist/cjs/src/bitmart.js +1 -0
- package/dist/cjs/src/bybit.js +90 -30
- package/dist/cjs/src/coinbaseinternational.js +1 -1
- package/dist/cjs/src/coinex.js +4 -3
- package/dist/cjs/src/gate.js +1 -0
- package/dist/cjs/src/htx.js +16 -9
- package/dist/cjs/src/hyperliquid.js +2 -1
- package/dist/cjs/src/kraken.js +3 -3
- package/dist/cjs/src/kucoin.js +1 -1
- package/dist/cjs/src/pro/krakenfutures.js +8 -7
- package/dist/cjs/src/tradeogre.js +632 -0
- package/examples/README.md +308 -0
- package/examples/ccxt.pro/html/watchTicker.html +51 -0
- package/examples/ccxt.pro/js/binance-fetch-balance-snapshot-watch-balance-updates.js +55 -0
- package/examples/ccxt.pro/js/binance-https-proxy.js +48 -0
- package/examples/ccxt.pro/js/binance-watch-ohlcv-many-symbols-continuously.js +38 -0
- package/examples/ccxt.pro/js/binance-watch-ohlcv-many-symbols.js +64 -0
- package/examples/ccxt.pro/js/binance-watch-ticker-many-symbols.js +62 -0
- package/examples/ccxt.pro/js/build-ohlcv-many-symbols.js +68 -0
- package/examples/ccxt.pro/js/calculate-ohlcvs-from-trades-warmup.js +82 -0
- package/examples/ccxt.pro/js/calculate-ohlcvs-from-trades.js +59 -0
- package/examples/ccxt.pro/js/exchange-capabitities.js +72 -0
- package/examples/ccxt.pro/js/exchange-close.js +46 -0
- package/examples/ccxt.pro/js/gateio-swap-watch-many-orderbooks.js +30 -0
- package/examples/ccxt.pro/js/gateio-watch-balance.js +23 -0
- package/examples/ccxt.pro/js/gateio-watch-order-book.js +71 -0
- package/examples/ccxt.pro/js/graceful-shutdown.js +43 -0
- package/examples/ccxt.pro/js/many-exchanges-many-streams.js +37 -0
- package/examples/ccxt.pro/js/okex-create-futures-order.js +48 -0
- package/examples/ccxt.pro/js/okex-watch-balance-and-create-order.js +54 -0
- package/examples/ccxt.pro/js/okx-watch-tickers.js +31 -0
- package/examples/ccxt.pro/js/one-exchange-many-different-streams.js +46 -0
- package/examples/ccxt.pro/js/one-exchange-many-streams-2.js +26 -0
- package/examples/ccxt.pro/js/one-exchange-many-streams.js +28 -0
- package/examples/ccxt.pro/js/socks-binance-watch-orderbook.js +30 -0
- package/examples/ccxt.pro/js/watch-fetch-many-exchanges-many-ordersbooks.js +40 -0
- package/examples/ccxt.pro/js/watch-many-exchanges-many-ordersbooks.js +38 -0
- package/examples/ccxt.pro/js/watch-many-exchanges-many-symbols.js +40 -0
- package/examples/ccxt.pro/js/watch-many-orderbooks.js +27 -0
- package/examples/ccxt.pro/js/watch-new-trades-only.js +43 -0
- package/examples/ccxt.pro/js/watch-new-trades.js +42 -0
- package/examples/ccxt.pro/js/watch-trades-many-symbols.js +29 -0
- package/examples/ccxt.pro/js/watch-vs-fetch.js +29 -0
- package/examples/cs/Examples.sln +22 -0
- package/examples/cs/c#.csproj +19 -0
- package/examples/html/basic-cors-proxy.html +46 -0
- package/examples/html/basic-inheritance.html +47 -0
- package/examples/html/basic-poller.html +52 -0
- package/examples/html/basic-rate-limiting.html +49 -0
- package/examples/html/basic.html +43 -0
- package/examples/html/binance-cors-proxy.html +28 -0
- package/examples/html/bitmex-browser-cors-proxy.js +7 -0
- package/examples/html/bitmex-cors.html +46 -0
- package/examples/html/tradingview-charts.html +61 -0
- package/examples/html/webworker/index.html +97 -0
- package/examples/html/webworker/worker.js +43 -0
- package/examples/js/README.md +15 -0
- package/examples/js/advanced-error-handling.js +39 -0
- package/examples/js/aggregate-orderbook.js +54 -0
- package/examples/js/arbitrage-pairs.js +130 -0
- package/examples/js/basic-chart.js +29 -0
- package/examples/js/basic-orderbook-polling.js +13 -0
- package/examples/js/bcc-vs-bch.js +115 -0
- package/examples/js/binance-fetch-all-deposits.js +45 -0
- package/examples/js/binance-fetch-ohlcv-many-symbols-async-await.js +34 -0
- package/examples/js/binance-fetch-ohlcv-many-symbols-promise-then-callbacks.js +33 -0
- package/examples/js/binance-fetchTicker-delivery-vs-future.js +31 -0
- package/examples/js/binance-futures-transfer-from-sub-account-to-master.js +41 -0
- package/examples/js/binance-margin-stop-order.js +39 -0
- package/examples/js/binance-server-time.js +34 -0
- package/examples/js/binance-universal-transfer.js +16 -0
- package/examples/js/bitfinex-fetch-trades.js +35 -0
- package/examples/js/bitfinex2-fetch-trades.js +35 -0
- package/examples/js/bitmex-browser-cors-proxy.js +7 -0
- package/examples/js/bitpanda-fetchMyTrades-reduce.js +36 -0
- package/examples/js/bitrue-fetch-balance.js +28 -0
- package/examples/js/bitstamp-private-api.js +115 -0
- package/examples/js/bitstamp-public-api.js +39 -0
- package/examples/js/bittrex-balance.js +50 -0
- package/examples/js/bittrex-fetch-closed-orders-history.js +69 -0
- package/examples/js/blockchaincom-withdrawal.js +59 -0
- package/examples/js/build-ohlcv-bars.js +48 -0
- package/examples/js/builtin-rate-limiting-rest-poller.js +25 -0
- package/examples/js/bybit-trailing.js +62 -0
- package/examples/js/bybit-updated.cjs +154 -0
- package/examples/js/cli.js +405 -0
- package/examples/js/coinbase-fetch-all-balances.js +36 -0
- package/examples/js/coinex-fetch-all-deposit-addresses-using-fetchDepositAddress.js +47 -0
- package/examples/js/coinex-futures.js +75 -0
- package/examples/js/coinone-fetch-tickers.js +54 -0
- package/examples/js/coinone-markets.js +16 -0
- package/examples/js/compare-two-exchanges-capabilities.js +36 -0
- package/examples/js/cors-proxy.js +5 -0
- package/examples/js/create-order-handle-errors.js +55 -0
- package/examples/js/create-order-position-with-takeprofit-stoploss.js +71 -0
- package/examples/js/create-order-with-retry.js +65 -0
- package/examples/js/create-order-ws-example.js +25 -0
- package/examples/js/create-orders-example.js +17 -0
- package/examples/js/create-trailing-amount-order.js +36 -0
- package/examples/js/create-trailing-percent-order.js +36 -0
- package/examples/js/credentials.json +5 -0
- package/examples/js/custom-proxy-agent-for-js.js +10 -0
- package/examples/js/custom-proxy-url.js +23 -0
- package/examples/js/delta-maintenance-margin-rate-max-leverage.js +60 -0
- package/examples/js/env-variables.js +26 -0
- package/examples/js/error-handling.js +89 -0
- package/examples/js/exchange-capabilities.js +135 -0
- package/examples/js/exchanges-by-volume.js +60 -0
- package/examples/js/exchanges.js +40 -0
- package/examples/js/fetch-all-balances.js +219 -0
- package/examples/js/fetch-all-tickers-to-files-2.js +53 -0
- package/examples/js/fetch-all-tickers-to-files.js +77 -0
- package/examples/js/fetch-balance.js +28 -0
- package/examples/js/fetch-create-deposit-address.js +101 -0
- package/examples/js/fetch-from-many-exchanges-simultaneously.js +21 -0
- package/examples/js/fetch-funding-rate-history.js +25 -0
- package/examples/js/fetch-futures/prettier.config.js +5 -0
- package/examples/js/fetch-futures/src/index.js +25 -0
- package/examples/js/fetch-ohlcv-from-to-mark-index-premium.js +72 -0
- package/examples/js/fetch-ohlcv-many-exchanges-continuosly.js +39 -0
- package/examples/js/fetch-ohlcv.js +16 -0
- package/examples/js/fetch-okex-futures.js +22 -0
- package/examples/js/fetch-orders.js +27 -0
- package/examples/js/fetch-ticker-from-multiple-exchanges.js +35 -0
- package/examples/js/fetch-ticker-where-available.js +75 -0
- package/examples/js/fetch-tickers/build/index.js +19 -0
- package/examples/js/fetch-tickers/prettier.config.js +5 -0
- package/examples/js/fetch-tickers/src/index.js +17 -0
- package/examples/js/gateio-create-batch-order.js +43 -0
- package/examples/js/gateio-futures.js +49 -0
- package/examples/js/gateio-open-close-contract.js +49 -0
- package/examples/js/gateio-swaps.js +74 -0
- package/examples/js/gdax-fetch-trades-pagination.js +29 -0
- package/examples/js/hitbtc2-withdraw.js +61 -0
- package/examples/js/how-to-import-one-exchange-esm.js +10 -0
- package/examples/js/huobi-futures.js +71 -0
- package/examples/js/huobi-open-close-contract.js +63 -0
- package/examples/js/huobi-swaps.js +70 -0
- package/examples/js/huobipro-market-buy-sell-fetch-trading-limits.js +98 -0
- package/examples/js/hybridCJSExample.cjs +19 -0
- package/examples/js/hybridESMExample.js +19 -0
- package/examples/js/idex-fetch-balance.js +13 -0
- package/examples/js/instantiate-all-at-once.js +46 -0
- package/examples/js/instantiate-all-from-json.js +31 -0
- package/examples/js/kraken-create-and-close-position.js +54 -0
- package/examples/js/kraken-fetch-order-trades.js +33 -0
- package/examples/js/kraken-margin-trading.js +89 -0
- package/examples/js/kucoin-rate-limit.js +38 -0
- package/examples/js/latoken-example.js +108 -0
- package/examples/js/live-orderbook.js +106 -0
- package/examples/js/live-ticker.js +80 -0
- package/examples/js/live-tickers.js +74 -0
- package/examples/js/load-all-contracts.js +41 -0
- package/examples/js/load-all-symbols-at-once.js +69 -0
- package/examples/js/load-all-tickers-at-once.js +91 -0
- package/examples/js/load-markets-to-files.js +57 -0
- package/examples/js/looping-over-all-symbols-of-specific-exchanges.js +61 -0
- package/examples/js/looping-over-specific-symbols-of-all-exchanges.js +91 -0
- package/examples/js/margin-loan-borrow-buy-sell-repay.js +70 -0
- package/examples/js/market-status-and-currency-status.js +29 -0
- package/examples/js/ohlcv-console-chart.js +29 -0
- package/examples/js/okex-fetch-closed-orders-archive.js +31 -0
- package/examples/js/okex-transfer.js +51 -0
- package/examples/js/okx-poll-fetch-my-trades.js +37 -0
- package/examples/js/okx-poll-rate-limit.js +48 -0
- package/examples/js/order-book-extra-level-depth-param.js +20 -0
- package/examples/js/phemex-create-order-position-with-takeprofit-stoploss.js +49 -0
- package/examples/js/poll-ohlcv.js +43 -0
- package/examples/js/poloniex-fetch-order-books.js +35 -0
- package/examples/js/poloniex-limits-amount-min.js +62 -0
- package/examples/js/proxy-round-robin.js +98 -0
- package/examples/js/proxy-usage.js +32 -0
- package/examples/js/sample-local-proxy-server-with-cors.js +12 -0
- package/examples/js/search-all-exchanges.js +159 -0
- package/examples/js/shared-load-markets.js +80 -0
- package/examples/js/sort-swap-markets-by-hourly-price-change.js +55 -0
- package/examples/js/symbols.js +110 -0
- package/examples/js/theocean.js +41 -0
- package/examples/js/tickers.js +106 -0
- package/examples/js/validate-paginated-data.js +61 -0
- package/examples/js/watch-OHLCV-For-Symbols.js +15 -0
- package/examples/js/watch-OHLCV.js +12 -0
- package/examples/js/watch-OrderBook-For-Symbols.js +11 -0
- package/examples/js/watch-Trades-For-Symbols.js +11 -0
- package/examples/js/watch-tickers.js +11 -0
- package/examples/js/watchOHLCVForSymbols.js +15 -0
- package/examples/js/watchOrderBookForSymbols.js +11 -0
- package/examples/js/watchPositions-many-exchanges-continuosly.d.ts +2 -0
- package/examples/js/watchPositions-many-exchanges-continuosly.d.ts.map +1 -0
- package/examples/js/watchPositions-many-exchanges-continuosly.js +49 -0
- package/examples/js/watchPositions.d.ts +2 -0
- package/examples/js/watchPositions.d.ts.map +1 -0
- package/examples/js/watchPositions.js +13 -0
- package/examples/js/watchPositionsForSymbols.d.ts +2 -0
- package/examples/js/watchPositionsForSymbols.d.ts.map +1 -0
- package/examples/js/watchPositionsForSymbols.js +14 -0
- package/examples/js/watchTradesForSymbols.js +11 -0
- package/examples/js/withdraw-from-one-exchange-to-another.js +50 -0
- package/examples/php/README.md +7 -0
- package/examples/py/README.md +15 -0
- package/examples/py/playing_with_ccxt_example.ipynb +222 -0
- package/examples/ts/.eslintrc +111 -0
- package/examples/ts/build-ohlcv-bars.ts +53 -0
- package/examples/ts/cli.ts +397 -0
- package/examples/ts/compare-two-exchanges-capabilities.ts +36 -0
- package/examples/ts/create-order-position-with-takeprofit-stoploss.ts +89 -0
- package/examples/ts/create-order-ws-example.ts +33 -0
- package/examples/ts/create-orders-example.ts +21 -0
- package/examples/ts/create-trailing-amount-order.ts +37 -0
- package/examples/ts/create-trailing-percent-order.ts +37 -0
- package/examples/ts/custom-proxy-agent-for-js.ts +14 -0
- package/examples/ts/fetch-futures/package-lock.json +116 -0
- package/examples/ts/fetch-futures/package.json +34 -0
- package/examples/ts/fetch-futures/prettier.config.js +4 -0
- package/examples/ts/fetch-futures/src/index.ts +28 -0
- package/examples/ts/fetch-futures/tsconfig.json +28 -0
- package/examples/ts/fetch-ohlcv-many-exchanges-continuosly.ts +44 -0
- package/examples/ts/fetch-ohlcv.ts +17 -0
- package/examples/ts/fetch-tickers/package-lock.json +116 -0
- package/examples/ts/fetch-tickers/package.json +34 -0
- package/examples/ts/fetch-tickers/prettier.config.js +4 -0
- package/examples/ts/fetch-tickers/src/index.ts +21 -0
- package/examples/ts/fetch-tickers/tsconfig.json +28 -0
- package/examples/ts/how-to-import-one-exchange-esm.ts +11 -0
- package/examples/ts/kraken-create-and-close-position.ts +69 -0
- package/examples/ts/margin-loan-borrow-buy-sell-repay.ts +72 -0
- package/examples/ts/nextjs-page-router/.eslintrc.json +3 -0
- package/examples/ts/nextjs-page-router/README.md +43 -0
- package/examples/ts/nextjs-page-router/next.config.js +6 -0
- package/examples/ts/nextjs-page-router/package-lock.json +7425 -0
- package/examples/ts/nextjs-page-router/package.json +28 -0
- package/examples/ts/nextjs-page-router/postcss.config.js +6 -0
- package/examples/ts/nextjs-page-router/public/favicon.ico +0 -0
- package/examples/ts/nextjs-page-router/src/pages/_app.tsx +6 -0
- package/examples/ts/nextjs-page-router/src/pages/_document.tsx +13 -0
- package/examples/ts/nextjs-page-router/src/pages/balance.tsx +46 -0
- package/examples/ts/nextjs-page-router/src/pages/index.tsx +8 -0
- package/examples/ts/nextjs-page-router/src/pages/tickers.tsx +61 -0
- package/examples/ts/nextjs-page-router/src/styles/globals.css +27 -0
- package/examples/ts/nextjs-page-router/tailwind.config.ts +20 -0
- package/examples/ts/nextjs-page-router/tsconfig.json +22 -0
- package/examples/ts/phemex-create-order-position-with-takeprofit-stoploss.ts +62 -0
- package/examples/ts/proxy-usage.ts +41 -0
- package/examples/ts/sample-local-proxy-server-with-cors.ts +15 -0
- package/examples/ts/watch-OHLCV-For-Symbols.ts +17 -0
- package/examples/ts/watch-OHLCV.ts +14 -0
- package/examples/ts/watch-OrderBook-For-Symbols.ts +13 -0
- package/examples/ts/watch-Trades-For-Symbols.ts +13 -0
- package/examples/ts/watch-tickers.ts +13 -0
- package/examples/ts/watchPositions-many-exchanges-continuosly.ts +53 -0
- package/examples/ts/watchPositions.ts +15 -0
- package/examples/ts/watchPositionsForSymbols.ts +16 -0
- package/examples/tsconfig.json +27 -0
- package/js/ccxt.d.ts +5 -2
- package/js/ccxt.js +4 -2
- 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 +7 -7
- package/js/src/base/Exchange.js +1 -1
- package/js/src/base/types.d.ts +7 -1
- package/js/src/binance.d.ts +1 -1
- package/js/src/bitget.js +62 -50
- package/js/src/bitmart.d.ts +1 -1
- package/js/src/bitmart.js +2 -1
- package/js/src/bybit.d.ts +3 -1
- package/js/src/bybit.js +90 -30
- package/js/src/coinbase.d.ts +4 -4
- 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 +1 -0
- package/js/src/htx.d.ts +2 -2
- package/js/src/htx.js +16 -9
- package/js/src/huobijp.d.ts +2 -2
- package/js/src/hyperliquid.js +2 -1
- 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/krakenfutures.js +8 -7
- 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 +4 -1
- package/skip-tests.json +219 -424
|
@@ -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;
|