ccxt 4.2.74__py2.py3-none-any.whl → 4.2.75__py2.py3-none-any.whl

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.
Files changed (53) hide show
  1. ccxt/__init__.py +3 -1
  2. ccxt/abstract/tradeogre.py +16 -0
  3. ccxt/ascendex.py +5 -4
  4. ccxt/async_support/__init__.py +3 -1
  5. ccxt/async_support/ascendex.py +5 -4
  6. ccxt/async_support/base/exchange.py +1 -1
  7. ccxt/async_support/bitmart.py +2 -0
  8. ccxt/async_support/coinbase.py +4 -4
  9. ccxt/async_support/coinbasepro.py +2 -2
  10. ccxt/async_support/coinex.py +4 -3
  11. ccxt/async_support/coinlist.py +2 -2
  12. ccxt/async_support/cryptocom.py +2 -2
  13. ccxt/async_support/currencycom.py +2 -2
  14. ccxt/async_support/deribit.py +2 -2
  15. ccxt/async_support/gate.py +1 -0
  16. ccxt/async_support/htx.py +2 -2
  17. ccxt/async_support/huobijp.py +2 -2
  18. ccxt/async_support/kraken.py +3 -3
  19. ccxt/async_support/kucoin.py +3 -3
  20. ccxt/async_support/luno.py +2 -2
  21. ccxt/async_support/mexc.py +2 -2
  22. ccxt/async_support/ndax.py +2 -2
  23. ccxt/async_support/novadax.py +2 -2
  24. ccxt/async_support/okx.py +2 -2
  25. ccxt/async_support/tradeogre.py +598 -0
  26. ccxt/async_support/woo.py +2 -2
  27. ccxt/base/exchange.py +3 -3
  28. ccxt/base/types.py +8 -1
  29. ccxt/bitmart.py +2 -0
  30. ccxt/coinbase.py +4 -4
  31. ccxt/coinbasepro.py +2 -2
  32. ccxt/coinex.py +4 -3
  33. ccxt/coinlist.py +2 -2
  34. ccxt/cryptocom.py +2 -2
  35. ccxt/currencycom.py +2 -2
  36. ccxt/deribit.py +2 -2
  37. ccxt/gate.py +1 -0
  38. ccxt/htx.py +2 -2
  39. ccxt/huobijp.py +2 -2
  40. ccxt/kraken.py +3 -3
  41. ccxt/kucoin.py +3 -3
  42. ccxt/luno.py +2 -2
  43. ccxt/mexc.py +2 -2
  44. ccxt/ndax.py +2 -2
  45. ccxt/novadax.py +2 -2
  46. ccxt/okx.py +2 -2
  47. ccxt/pro/__init__.py +1 -1
  48. ccxt/tradeogre.py +598 -0
  49. ccxt/woo.py +2 -2
  50. {ccxt-4.2.74.dist-info → ccxt-4.2.75.dist-info}/METADATA +9 -8
  51. {ccxt-4.2.74.dist-info → ccxt-4.2.75.dist-info}/RECORD +53 -50
  52. {ccxt-4.2.74.dist-info → ccxt-4.2.75.dist-info}/WHEEL +0 -0
  53. {ccxt-4.2.74.dist-info → ccxt-4.2.75.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,598 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ # PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+
6
+ from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.tradeogre import ImplicitAPI
8
+ from ccxt.base.types import IndexType, Int, Market, Num, Order, OrderSide, OrderType, Str, Ticker
9
+ from ccxt.base.errors import ExchangeError
10
+ from ccxt.base.errors import BadRequest
11
+ from ccxt.base.errors import InsufficientFunds
12
+ from ccxt.base.errors import AuthenticationError
13
+ from ccxt.base.decimal_to_precision import TICK_SIZE
14
+
15
+
16
+ class tradeogre(Exchange, ImplicitAPI):
17
+
18
+ def describe(self):
19
+ return self.deep_extend(super(tradeogre, self).describe(), {
20
+ 'id': 'tradeogre',
21
+ 'name': 'tradeogre',
22
+ 'countries': [],
23
+ 'rateLimit': 100,
24
+ 'version': 'v2',
25
+ 'pro': False,
26
+ 'has': {
27
+ 'CORS': None,
28
+ 'spot': True,
29
+ 'margin': False,
30
+ 'swap': False,
31
+ 'future': False,
32
+ 'option': False,
33
+ 'addMargin': False,
34
+ 'cancelAllOrders': True,
35
+ 'cancelOrder': True,
36
+ 'cancelOrders': False,
37
+ 'closeAllPositions': False,
38
+ 'closePosition': False,
39
+ 'createDepositAddress': False,
40
+ 'createMarketOrder': False,
41
+ 'createOrder': True,
42
+ 'createOrders': False,
43
+ 'createPostOnlyOrder': False,
44
+ 'createReduceOnlyOrder': False,
45
+ 'createStopLimitOrder': False,
46
+ 'createStopMarketOrder': False,
47
+ 'createStopOrder': False,
48
+ 'fetchAccounts': False,
49
+ 'fetchBalance': True,
50
+ 'fetchBorrowInterest': False,
51
+ 'fetchBorrowRateHistory': False,
52
+ 'fetchClosedOrders': False,
53
+ 'fetchCrossBorrowRate': False,
54
+ 'fetchCrossBorrowRates': False,
55
+ 'fetchDeposit': False,
56
+ 'fetchDepositAddress': False,
57
+ 'fetchDepositAddresses': False,
58
+ 'fetchDepositAddressesByNetwork': False,
59
+ 'fetchDeposits': False,
60
+ 'fetchDepositsWithdrawals': False,
61
+ 'fetchFundingHistory': False,
62
+ 'fetchFundingRate': False,
63
+ 'fetchFundingRateHistory': False,
64
+ 'fetchFundingRates': False,
65
+ 'fetchIndexOHLCV': False,
66
+ 'fetchIsolatedBorrowRate': False,
67
+ 'fetchIsolatedBorrowRates': False,
68
+ 'fetchLedger': False,
69
+ 'fetchLedgerEntry': False,
70
+ 'fetchLeverageTiers': False,
71
+ 'fetchMarketLeverageTiers': False,
72
+ 'fetchMarkets': True,
73
+ 'fetchMarkOHLCV': False,
74
+ 'fetchMyTrades': False,
75
+ 'fetchOHLCV': False,
76
+ 'fetchOpenInterest': False,
77
+ 'fetchOpenInterestHistory': False,
78
+ 'fetchOpenOrders': True,
79
+ 'fetchOrder': True,
80
+ 'fetchOrderBook': True,
81
+ 'fetchOrderBooks': False,
82
+ 'fetchOrders': False,
83
+ 'fetchOrderTrades': False,
84
+ 'fetchPermissions': False,
85
+ 'fetchPosition': False,
86
+ 'fetchPositions': False,
87
+ 'fetchPositionsForSymbol': False,
88
+ 'fetchPositionsRisk': False,
89
+ 'fetchPremiumIndexOHLCV': False,
90
+ 'fetchTicker': True,
91
+ 'fetchTickers': False,
92
+ 'fetchTrades': True,
93
+ 'fetchTradingLimits': False,
94
+ 'fetchTransactionFee': False,
95
+ 'fetchTransactionFees': False,
96
+ 'fetchTransactions': False,
97
+ 'fetchTransfers': False,
98
+ 'fetchWithdrawAddresses': False,
99
+ 'fetchWithdrawal': False,
100
+ 'fetchWithdrawals': False,
101
+ 'reduceMargin': False,
102
+ 'setLeverage': False,
103
+ 'setMargin': False,
104
+ 'setMarginMode': False,
105
+ 'setPositionMode': False,
106
+ 'signIn': False,
107
+ 'transfer': False,
108
+ 'withdraw': False,
109
+ },
110
+ 'urls': {
111
+ 'referral': '',
112
+ 'logo': 'https://github.com/ccxt/ccxt/assets/43336371/3aa748b7-ea44-45e9-a9e7-b1d207a2578a',
113
+ 'api': {
114
+ 'rest': 'https://tradeogre.com/api/v1',
115
+ },
116
+ 'www': 'https://tradeogre.com',
117
+ 'doc': 'https://tradeogre.com/help/api',
118
+ 'fees': 'https://tradeogre.com/help/fees',
119
+ },
120
+ 'fees': {
121
+ 'trading': {
122
+ 'maker': self.parse_number('0.002'),
123
+ 'taker': self.parse_number('0.002'),
124
+ },
125
+ },
126
+ 'api': {
127
+ 'public': {
128
+ 'get': {
129
+ 'markets': 1,
130
+ 'orders/{market}': 1,
131
+ 'ticker/{market}': 1,
132
+ 'history/{market}': 1,
133
+ },
134
+ },
135
+ 'private': {
136
+ 'get': {
137
+ 'account/balance': 1,
138
+ 'account/balances': 1,
139
+ 'account/order/{uuid}': 1,
140
+ },
141
+ 'post': {
142
+ 'order/buy': 1,
143
+ 'order/sell': 1,
144
+ 'order/cancel': 1,
145
+ 'orders': 1,
146
+ 'account/orders': 1,
147
+ },
148
+ },
149
+ },
150
+ 'commonCurrencies': {
151
+ },
152
+ 'precisionMode': TICK_SIZE,
153
+ 'exceptions': {
154
+ 'exact': {
155
+ 'Must be authorized': AuthenticationError,
156
+ 'Market not found': BadRequest,
157
+ 'Insufficient funds': InsufficientFunds,
158
+ 'Order not found': BadRequest,
159
+ },
160
+ },
161
+ 'options': {
162
+ },
163
+ })
164
+
165
+ async def fetch_markets(self, params={}):
166
+ """
167
+ retrieves data on all markets for bigone
168
+ :see: https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md#markets
169
+ :param dict [params]: extra parameters specific to the exchange API endpoint
170
+ :returns dict[]: an array of objects representing market data
171
+ """
172
+ response = await self.publicGetMarkets(params)
173
+ #
174
+ # [
175
+ # {
176
+ # "AEON-BTC": {
177
+ # "initialprice": "0.00022004",
178
+ # "price": "0.00025992",
179
+ # "high": "0.00025992",
180
+ # "low": "0.00022003",
181
+ # "volume": "0.00359066",
182
+ # "bid": "0.00022456",
183
+ # "ask": "0.00025993"
184
+ # }
185
+ # }
186
+ # ]
187
+ #
188
+ result = []
189
+ for i in range(0, len(response)):
190
+ rawMarket = response[i]
191
+ keys = list(rawMarket.keys())
192
+ id = self.safe_string(keys, 0)
193
+ keyParts = id.split('-')
194
+ baseId = self.safe_string(keyParts, 0)
195
+ quoteId = self.safe_string(keyParts, 1)
196
+ base = self.safe_currency_code(baseId)
197
+ quote = self.safe_currency_code(quoteId)
198
+ market = self.safe_market_structure({
199
+ 'id': id,
200
+ 'symbol': base + '/' + quote,
201
+ 'base': base,
202
+ 'quote': quote,
203
+ 'settle': None,
204
+ 'baseId': baseId,
205
+ 'quoteId': quoteId,
206
+ 'settleId': None,
207
+ 'type': 'spot',
208
+ 'spot': True,
209
+ 'margin': False,
210
+ 'swap': False,
211
+ 'future': False,
212
+ 'option': False,
213
+ 'active': True,
214
+ 'contract': False,
215
+ 'linear': None,
216
+ 'inverse': None,
217
+ 'contractSize': None,
218
+ 'taker': self.fees['trading']['taker'],
219
+ 'maker': self.fees['trading']['taker'],
220
+ 'expiry': None,
221
+ 'expiryDatetime': None,
222
+ 'strike': None,
223
+ 'optionType': None,
224
+ 'precision': {
225
+ 'amount': self.parse_number(self.parse_precision('8')),
226
+ 'price': self.parse_number(self.parse_precision('8')), # they're not explicit about it
227
+ },
228
+ 'limits': {
229
+ 'leverage': {
230
+ 'min': None,
231
+ 'max': None,
232
+ },
233
+ 'amount': {
234
+ 'min': None,
235
+ 'max': None,
236
+ },
237
+ 'price': {
238
+ 'min': None,
239
+ 'max': None,
240
+ },
241
+ 'cost': {
242
+ 'min': None,
243
+ 'max': None,
244
+ },
245
+ },
246
+ 'created': None,
247
+ 'info': rawMarket,
248
+ })
249
+ result.append(market)
250
+ return result
251
+
252
+ async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
253
+ """
254
+ fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
255
+ :param str symbol: unified symbol of the market to fetch the ticker for
256
+ :param dict [params]: extra parameters specific to the exchange API endpoint
257
+ :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
258
+ """
259
+ await self.load_markets()
260
+ market = self.market(symbol)
261
+ request = {
262
+ 'market': market['id'],
263
+ }
264
+ response = await self.publicGetTickerMarket(self.extend(request, params))
265
+ #
266
+ # {
267
+ # "success":true,
268
+ # "initialprice":"0.02502002",
269
+ # "price":"0.02500000",
270
+ # "high":"0.03102001",
271
+ # "low":"0.02500000",
272
+ # "volume":"0.15549958",
273
+ # "bid":"0.02420000",
274
+ # "ask":"0.02625000"
275
+ # }
276
+ #
277
+ return self.parse_ticker(response, market)
278
+
279
+ def parse_ticker(self, ticker, market: Market = None):
280
+ #
281
+ # {
282
+ # "success":true,
283
+ # "initialprice":"0.02502002",
284
+ # "price":"0.02500000",
285
+ # "high":"0.03102001",
286
+ # "low":"0.02500000",
287
+ # "volume":"0.15549958",
288
+ # "bid":"0.02420000",
289
+ # "ask":"0.02625000"
290
+ # }
291
+ #
292
+ return self.safe_ticker({
293
+ 'symbol': self.safe_string(market, 'symbol'),
294
+ 'timestamp': None,
295
+ 'datetime': None,
296
+ 'high': self.safe_string(ticker, 'high'),
297
+ 'low': self.safe_string(ticker, 'low'),
298
+ 'bid': self.safe_string(ticker, 'bid'),
299
+ 'bidVolume': None,
300
+ 'ask': self.safe_string(ticker, 'ask'),
301
+ 'askVolume': None,
302
+ 'vwap': None,
303
+ 'open': self.safe_string(ticker, 'open'),
304
+ 'close': None,
305
+ 'last': None,
306
+ 'previousClose': None,
307
+ 'change': None,
308
+ 'percentage': None,
309
+ 'average': None,
310
+ 'baseVolume': self.safe_string(ticker, 'volume'),
311
+ 'quoteVolume': None,
312
+ 'info': ticker,
313
+ }, market)
314
+
315
+ async def fetch_order_book(self, symbol: str, limit: Int = None, params={}):
316
+ """
317
+ fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
318
+ :param str symbol: unified symbol of the market to fetch the order book for
319
+ :param int [limit]: the maximum amount of order book entries to return
320
+ :param dict [params]: extra parameters specific to the exchange API endpoint
321
+ :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
322
+ """
323
+ await self.load_markets()
324
+ market = self.market(symbol)
325
+ request = {
326
+ 'market': market['id'],
327
+ }
328
+ response = await self.publicGetOrdersMarket(self.extend(request, params))
329
+ #
330
+ # {
331
+ # "success": True,
332
+ # "buy": {
333
+ # "0.02425501": "36.46986607",
334
+ # "0.02425502": "93.64201137",
335
+ # "0.02425503": "19.02000000",
336
+ # "0.02425515": "115.49000000"
337
+ # }
338
+ #
339
+ rawBids = self.safe_dict(response, 'buy', {})
340
+ rawAsks = self.safe_dict(response, 'sell', {})
341
+ rawOrderbook = {
342
+ 'bids': rawBids,
343
+ 'asks': rawAsks,
344
+ }
345
+ orderbook = self.parse_order_book(rawOrderbook, symbol)
346
+ return orderbook
347
+
348
+ def parse_bids_asks(self, bidasks, priceKey: IndexType = 0, amountKey: IndexType = 1, countOrIdKey: IndexType = 2):
349
+ prices = list(bidasks.keys())
350
+ result = []
351
+ for i in range(0, len(prices)):
352
+ priceString = self.safe_string(prices, i)
353
+ price = self.safe_number(prices, i)
354
+ volume = self.safe_number(bidasks, priceString)
355
+ result.append([price, volume])
356
+ return result
357
+
358
+ async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}):
359
+ """
360
+ get the list of most recent trades for a particular symbol
361
+ :param str symbol: unified symbol of the market to fetch trades for
362
+ :param int [since]: timestamp in ms of the earliest trade to fetch
363
+ :param int [limit]: the maximum number of trades to fetch
364
+ :param dict [params]: extra parameters specific to the exchange API endpoint
365
+ :param int params['lastId']: order id
366
+ :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
367
+ """
368
+ await self.load_markets()
369
+ market = self.market(symbol)
370
+ request = {
371
+ 'market': market['id'],
372
+ }
373
+ response = await self.publicGetHistoryMarket(self.extend(request, params))
374
+ return self.parse_trades(response, market, since, limit)
375
+
376
+ def parse_trade(self, trade, market: Market = None):
377
+ #
378
+ # {
379
+ # "date":1515128233,
380
+ # "type":"sell",
381
+ # "price":"0.02454320",
382
+ # "quantity":"0.17614230"
383
+ # }
384
+ #
385
+ timestamp = self.safe_integer_product(trade, 'date', 1000)
386
+ return self.safe_trade({
387
+ 'info': trade,
388
+ 'id': None,
389
+ 'timestamp': timestamp,
390
+ 'datetime': self.iso8601(timestamp),
391
+ 'symbol': self.safe_string(market, 'symbol'),
392
+ 'order': None,
393
+ 'type': None,
394
+ 'side': self.safe_string(trade, 'type'),
395
+ 'takerOrMaker': None,
396
+ 'price': self.safe_string(trade, 'price'),
397
+ 'amount': self.safe_string(trade, 'quantity'),
398
+ 'cost': None,
399
+ 'fee': {
400
+ 'currency': None,
401
+ 'cost': None,
402
+ },
403
+ }, market)
404
+
405
+ async def fetch_balance(self, params={}):
406
+ """
407
+ query for balance and get the amount of funds available for trading or funds locked in orders
408
+ :param dict [params]: extra parameters specific to the exchange API endpoint
409
+ :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
410
+ """
411
+ await self.load_markets()
412
+ response = await self.privateGetAccountBalances(params)
413
+ result = self.safe_dict(response, 'balances', {})
414
+ return self.parse_balance(result)
415
+
416
+ def parse_balance(self, response):
417
+ #
418
+ # {
419
+ # "USDT": "12"
420
+ # }
421
+ #
422
+ result = {
423
+ 'info': response,
424
+ }
425
+ keys = list(response.keys())
426
+ for i in range(0, len(keys)):
427
+ currencyId = keys[i]
428
+ balance = response[currencyId]
429
+ code = self.safe_currency_code(currencyId)
430
+ account = {
431
+ 'total': balance,
432
+ }
433
+ result[code] = account
434
+ return self.safe_balance(result)
435
+
436
+ async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
437
+ """
438
+ create a trade order
439
+ :param str symbol: unified symbol of the market to create an order in
440
+ :param str type: not used by tradeogre
441
+ :param str side: 'buy' or 'sell'
442
+ :param float amount: how much of currency you want to trade in units of base currency
443
+ :param float price: the price at which the order is to be fullfilled, in units of the quote currency
444
+ :param dict [params]: extra parameters specific to the exchange API endpoint
445
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
446
+ """
447
+ await self.load_markets()
448
+ market = self.market(symbol)
449
+ request = {
450
+ 'market': market['id'],
451
+ 'quantity': self.parse_to_numeric(self.amount_to_precision(symbol, amount)),
452
+ 'price': self.parse_to_numeric(self.price_to_precision(symbol, price)),
453
+ }
454
+ if type == 'market':
455
+ raise BadRequest(self.id + ' createOrder does not support market orders')
456
+ response = None
457
+ if side == 'buy':
458
+ response = await self.privatePostOrderBuy(self.extend(request, params))
459
+ else:
460
+ response = await self.privatePostOrderSell(self.extend(request, params))
461
+ return self.parse_order(response, market)
462
+
463
+ async def cancel_order(self, id: str, symbol: Str = None, params={}):
464
+ """
465
+ cancels an open order
466
+ :param str id: order id
467
+ :param str symbol: unified symbol of the market the order was made in
468
+ :param dict [params]: extra parameters specific to the exchange API endpoint
469
+ :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
470
+ """
471
+ await self.load_markets()
472
+ request = {
473
+ 'uuid': id,
474
+ }
475
+ response = await self.privatePostOrderCancel(self.extend(request, params))
476
+ return self.parse_order(response)
477
+
478
+ async def cancel_all_orders(self, symbol: Str = None, params={}):
479
+ """
480
+ cancel all open orders
481
+ :param str symbol: alpaca cancelAllOrders cannot setting symbol, it will cancel all open orders
482
+ :param dict [params]: extra parameters specific to the exchange API endpoint
483
+ :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
484
+ """
485
+ await self.load_markets()
486
+ return await self.cancel_order('all', symbol, params)
487
+
488
+ async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
489
+ """
490
+ fetch all unfilled currently open orders
491
+ :param str symbol: unified market symbol of the market orders were made in
492
+ :param int [since]: the earliest time in ms to fetch orders for
493
+ :param int [limit]: the maximum number of order structures to retrieve
494
+ :param dict [params]: extra parameters specific to the exchange API endpoint
495
+ :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
496
+ """
497
+ await self.load_markets()
498
+ market = None
499
+ if symbol is not None:
500
+ market = self.market(symbol)
501
+ request = {}
502
+ if symbol is not None:
503
+ request['market'] = market['id']
504
+ response = await self.privatePostAccountOrders(self.extend(request, params))
505
+ return self.parse_orders(response, market, since, limit)
506
+
507
+ async def fetch_order(self, id: str, symbol: Str = None, params={}):
508
+ """
509
+ fetches information on an order made by the user
510
+ :see: https://github.com/ace-exchange/ace-official-api-docs/blob/master/api_v2.md#open-api---order-status
511
+ :param str symbol: unified symbol of the market the order was made in
512
+ :param dict [params]: extra parameters specific to the exchange API endpoint
513
+ :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
514
+ """
515
+ await self.load_markets()
516
+ request = {
517
+ 'uuid': id,
518
+ }
519
+ response = await self.privateGetAccountOrderUuid(self.extend(request, params))
520
+ return self.parse_order(response, None)
521
+
522
+ def parse_order(self, order, market: Market = None) -> Order:
523
+ #
524
+ #
525
+ # {
526
+ # "uuid": "a40ac710-8dc5-b5a8-aa69-389715197b14",
527
+ # "date": 1514876938,
528
+ # "type": "sell",
529
+ # "price": "0.02621960",
530
+ # "quantity": "1.55772526",
531
+ # "market": "XMR-BTC"
532
+ # }
533
+ #
534
+ timestamp = self.safe_integer_product(order, 'date', 1000)
535
+ marketId = self.safe_string(order, 'market')
536
+ market = self.safe_market(marketId, market)
537
+ return self.safe_order({
538
+ 'info': order,
539
+ 'id': self.safe_string(order, 'uuid'),
540
+ 'clientOrderId': None,
541
+ 'timestamp': timestamp,
542
+ 'datetime': self.iso8601(timestamp),
543
+ 'lastTradeTimestamp': None,
544
+ 'symbol': market['symbol'],
545
+ 'type': None,
546
+ 'timeInForce': None,
547
+ 'postOnly': None,
548
+ 'side': self.safe_string(order, 'type'),
549
+ 'price': self.safe_string(order, 'price'),
550
+ 'stopPrice': None,
551
+ 'amount': self.safe_string(order, 'quantity'),
552
+ 'cost': None,
553
+ 'average': None,
554
+ 'filled': self.safe_string(order, 'fulfilled'),
555
+ 'remaining': None,
556
+ 'status': None,
557
+ 'fee': {
558
+ 'currency': None,
559
+ 'cost': None,
560
+ },
561
+ 'trades': None,
562
+ }, market)
563
+
564
+ def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
565
+ url = self.urls['api']['rest'] + '/' + self.implode_params(path, params)
566
+ params = self.omit(params, self.extract_params(path))
567
+ if method == 'GET':
568
+ if params:
569
+ url += '?' + self.urlencode(params)
570
+ if api == 'private':
571
+ headers = {
572
+ 'Content-Type': 'application/x-www-form-urlencoded',
573
+ 'Referer': 'CCXT',
574
+ 'authorization': 'Basic ' + self.string_to_base64(self.apiKey + ':' + self.secret),
575
+ }
576
+ if method != 'GET':
577
+ body = self.urlencode(params)
578
+ return {'url': url, 'method': method, 'body': body, 'headers': headers}
579
+
580
+ def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
581
+ if response is None:
582
+ return None
583
+ if not ('success' in response):
584
+ return None
585
+ #
586
+ # {"success":false,"error":"Must be authorized"}
587
+ #
588
+ success = self.safe_bool(response, 'success')
589
+ if success:
590
+ return None
591
+ successString = self.safe_string(response, 'success')
592
+ if successString == 'true':
593
+ return None
594
+ error = self.safe_value(response, 'error')
595
+ errorCode = self.safe_string(error, 'code')
596
+ feedback = self.id + ' ' + self.json(response)
597
+ self.throw_exactly_matched_exception(self.exceptions['exact'], errorCode, feedback)
598
+ raise ExchangeError(feedback)
ccxt/async_support/woo.py CHANGED
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.woo import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Bool, Currency, Int, Leverage, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Account, Balances, Bool, Currency, Int, Leverage, Market, MarketType, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Trade, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import ArgumentsRequired
@@ -1675,7 +1675,7 @@ class woo(Exchange, ImplicitAPI):
1675
1675
  trades = self.safe_list(response, 'rows', [])
1676
1676
  return self.parse_trades(trades, market, since, limit, params)
1677
1677
 
1678
- async def fetch_accounts(self, params={}):
1678
+ async def fetch_accounts(self, params={}) -> List[Account]:
1679
1679
  """
1680
1680
  fetch all the accounts associated with a profile
1681
1681
  :param dict [params]: extra parameters specific to the exchange API endpoint
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.2.74'
7
+ __version__ = '4.2.75'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -31,7 +31,7 @@ from ccxt.base.decimal_to_precision import decimal_to_precision
31
31
  from ccxt.base.decimal_to_precision import DECIMAL_PLACES, TICK_SIZE, NO_PADDING, TRUNCATE, ROUND, ROUND_UP, ROUND_DOWN, SIGNIFICANT_DIGITS
32
32
  from ccxt.base.decimal_to_precision import number_to_string
33
33
  from ccxt.base.precise import Precise
34
- from ccxt.base.types import Account, Currency, IndexType, OrderSide, OrderType, Trade, OrderRequest, Market, MarketType, Str, Num
34
+ from ccxt.base.types import BalanceAccount, Currency, IndexType, OrderSide, OrderType, Trade, OrderRequest, Market, MarketType, Str, Num
35
35
 
36
36
  # -----------------------------------------------------------------------------
37
37
 
@@ -4384,7 +4384,7 @@ class Exchange(object):
4384
4384
  else:
4385
4385
  raise NotSupported(self.id + ' fetchDepositAddress() is not supported yet')
4386
4386
 
4387
- def account(self) -> Account:
4387
+ def account(self) -> BalanceAccount:
4388
4388
  return {
4389
4389
  'free': None,
4390
4390
  'used': None,
ccxt/base/types.py CHANGED
@@ -71,12 +71,19 @@ class Balance(TypedDict):
71
71
  debt: NotRequired[Num]
72
72
 
73
73
 
74
- class Account(TypedDict):
74
+ class BalanceAccount(TypedDict):
75
75
  free: Str
76
76
  used: Str
77
77
  total: Str
78
78
 
79
79
 
80
+ class Account(TypedDict):
81
+ id: Str
82
+ type: Str
83
+ code: Str
84
+ info: Dict[str, Any]
85
+
86
+
80
87
  class Trade(TypedDict):
81
88
  info: Dict[str, Any]
82
89
  amount: Num
ccxt/bitmart.py CHANGED
@@ -19,6 +19,7 @@ from ccxt.base.errors import InvalidAddress
19
19
  from ccxt.base.errors import InvalidOrder
20
20
  from ccxt.base.errors import OrderNotFound
21
21
  from ccxt.base.errors import NotSupported
22
+ from ccxt.base.errors import NetworkError
22
23
  from ccxt.base.errors import RateLimitExceeded
23
24
  from ccxt.base.errors import ExchangeNotAvailable
24
25
  from ccxt.base.errors import OnMaintenance
@@ -365,6 +366,7 @@ class bitmart(Exchange, ImplicitAPI):
365
366
  '70000': ExchangeError, # 200, no data
366
367
  '70001': BadRequest, # 200, request param can not be null
367
368
  '70002': BadSymbol, # 200, symbol is invalid
369
+ '70003': NetworkError, # {"code":70003,"trace":"81a9d57b63be4819b65d3065e6a4682b.105.17105295323593915","message":"net error, please try later","data":null}
368
370
  '71001': BadRequest, # 200, after is invalid
369
371
  '71002': BadRequest, # 200, before is invalid
370
372
  '71003': BadRequest, # 200, request after or before is invalid