exchanges-wrapper 1.4.13__tar.gz → 1.4.14__tar.gz

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 (21) hide show
  1. {exchanges_wrapper-1.4.13 → exchanges_wrapper-1.4.14}/PKG-INFO +1 -1
  2. {exchanges_wrapper-1.4.13 → exchanges_wrapper-1.4.14}/exchanges_wrapper/__init__.py +1 -1
  3. {exchanges_wrapper-1.4.13 → exchanges_wrapper-1.4.14}/exchanges_wrapper/bybit_parser.py +2 -5
  4. {exchanges_wrapper-1.4.13 → exchanges_wrapper-1.4.14}/exchanges_wrapper/huobi_parser.py +13 -13
  5. {exchanges_wrapper-1.4.13 → exchanges_wrapper-1.4.14}/exchanges_wrapper/okx_parser.py +10 -10
  6. {exchanges_wrapper-1.4.13 → exchanges_wrapper-1.4.14}/LICENSE.md +0 -0
  7. {exchanges_wrapper-1.4.13 → exchanges_wrapper-1.4.14}/README.md +0 -0
  8. {exchanges_wrapper-1.4.13 → exchanges_wrapper-1.4.14}/exchanges_wrapper/api_pb2.py +0 -0
  9. {exchanges_wrapper-1.4.13 → exchanges_wrapper-1.4.14}/exchanges_wrapper/api_pb2_grpc.py +0 -0
  10. {exchanges_wrapper-1.4.13 → exchanges_wrapper-1.4.14}/exchanges_wrapper/bitfinex_parser.py +0 -0
  11. {exchanges_wrapper-1.4.13 → exchanges_wrapper-1.4.14}/exchanges_wrapper/c_structures.py +0 -0
  12. {exchanges_wrapper-1.4.13 → exchanges_wrapper-1.4.14}/exchanges_wrapper/client.py +0 -0
  13. {exchanges_wrapper-1.4.13 → exchanges_wrapper-1.4.14}/exchanges_wrapper/definitions.py +0 -0
  14. {exchanges_wrapper-1.4.13 → exchanges_wrapper-1.4.14}/exchanges_wrapper/errors.py +0 -0
  15. {exchanges_wrapper-1.4.13 → exchanges_wrapper-1.4.14}/exchanges_wrapper/events.py +0 -0
  16. {exchanges_wrapper-1.4.13 → exchanges_wrapper-1.4.14}/exchanges_wrapper/exch_srv.py +0 -0
  17. {exchanges_wrapper-1.4.13 → exchanges_wrapper-1.4.14}/exchanges_wrapper/exch_srv_cfg.toml.template +0 -0
  18. {exchanges_wrapper-1.4.13 → exchanges_wrapper-1.4.14}/exchanges_wrapper/http_client.py +0 -0
  19. {exchanges_wrapper-1.4.13 → exchanges_wrapper-1.4.14}/exchanges_wrapper/proto/exchanges_wrapper/api.proto +0 -0
  20. {exchanges_wrapper-1.4.13 → exchanges_wrapper-1.4.14}/exchanges_wrapper/web_sockets.py +0 -0
  21. {exchanges_wrapper-1.4.13 → exchanges_wrapper-1.4.14}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: exchanges-wrapper
3
- Version: 1.4.13
3
+ Version: 1.4.14
4
4
  Summary: REST API and WebSocket asyncio wrapper with grpc powered multiplexer server
5
5
  Author-email: Thomas Marchand <thomas.marchand@tuta.io>, Jerry Fedorenko <jerry.fedorenko@yahoo.com>
6
6
  Requires-Python: >=3.9
@@ -12,7 +12,7 @@ __maintainer__ = "Jerry Fedorenko"
12
12
  __contact__ = "https://github.com/DogsTailFarmer"
13
13
  __email__ = "jerry.fedorenko@yahoo.com"
14
14
  __credits__ = ["https://github.com/DanyaSWorlD"]
15
- __version__ = "1.4.13"
15
+ __version__ = "1.4.14"
16
16
 
17
17
  from pathlib import Path
18
18
  import shutil
@@ -516,14 +516,11 @@ def order_trade_list(res: [], order_id: str) -> []:
516
516
  "price": price,
517
517
  "qty": str(qty),
518
518
  "quoteQty": quote_qty,
519
+ "commission": str(fee) if fee else '0',
520
+ "commissionAsset": trade['currency'] if fee else '',
519
521
  "time": int(trade['transactionTime']),
520
522
  "isBuyer": trade['side'] == 'Buy',
521
523
  "isMaker": True,
522
524
  "isBestMatch": True,
523
525
  }
524
-
525
- if fee:
526
- trade_rows[trade_id]["commission"] = str(fee)
527
- trade_rows[trade_id]["commissionAsset"] = str(trade['currency'])
528
-
529
526
  return list(trade_rows.values())
@@ -400,10 +400,10 @@ def on_order_update(_order: {}) -> {}:
400
400
  #
401
401
  if event.get('orderStatus') in ('canceled', 'partial-canceled'):
402
402
  status = 'CANCELED'
403
- elif event.get('orderStatus') == 'partial-filled':
404
- status = 'PARTIALLY_FILLED'
405
- elif event.get('orderStatus') == 'filled':
403
+ elif event.get('orderStatus') == 'filled' and cumulative_filled_quantity >= Decimal(order_quantity):
406
404
  status = 'FILLED'
405
+ elif event.get('orderStatus') == 'partial-filled' or cumulative_filled_quantity > 0:
406
+ status = 'PARTIALLY_FILLED'
407
407
  else:
408
408
  status = 'NEW'
409
409
  return {
@@ -445,22 +445,22 @@ def on_order_update(_order: {}) -> {}:
445
445
  def account_trade_list(res: []) -> []:
446
446
  binance_trade_list = []
447
447
  for trade in res:
448
- price = trade.get('price')
449
- qty = trade.get('filled-amount')
448
+ price = trade['price']
449
+ qty = trade['filled-amount']
450
450
  quote_qty = str(Decimal(price) * Decimal(qty))
451
451
  binance_trade = {
452
- "symbol": trade.get('symbol').upper(),
453
- "id": trade.get('trade-id'),
454
- "orderId": trade.get('order-id'),
452
+ "symbol": trade['symbol'].upper(),
453
+ "id": trade['trade-id'],
454
+ "orderId": int(trade['order-id']),
455
455
  "orderListId": -1,
456
456
  "price": price,
457
457
  "qty": qty,
458
458
  "quoteQty": quote_qty,
459
- "commission": trade.get('filled-fees'),
460
- "commissionAsset": trade.get('fee-currency'),
461
- "time": trade.get('created-at'),
462
- "isBuyer": 'buy' in trade.get('type'),
463
- "isMaker": trade.get('role') == 'maker',
459
+ "commission": trade['filled-fees'],
460
+ "commissionAsset": trade['fee-currency'],
461
+ "time": trade['created-at'],
462
+ "isBuyer": 'buy' in trade['type'],
463
+ "isMaker": trade['role'] == 'maker',
464
464
  "isBestMatch": True,
465
465
  }
466
466
  binance_trade_list.append(binance_trade)
@@ -508,22 +508,22 @@ def funding_wallet(res: []) -> []:
508
508
  def order_trade_list(res: []) -> []:
509
509
  binance_trade_list = []
510
510
  for trade in res:
511
- price = trade.get('fillPx')
512
- qty = trade.get('fillSz')
511
+ price = trade['fillPx']
512
+ qty = trade['fillSz']
513
513
  quote_qty = str(Decimal(price) * Decimal(qty))
514
514
  binance_trade = {
515
- "symbol": trade.get('instId').replace('-', ''),
516
- "id": trade.get('tradeId'),
517
- "orderId": trade.get('ordId'),
515
+ "symbol": trade['instId'].replace('-', ''),
516
+ "id": int(trade['tradeId']),
517
+ "orderId": int(trade['ordId']),
518
518
  "orderListId": -1,
519
519
  "price": price,
520
520
  "qty": qty,
521
521
  "quoteQty": quote_qty,
522
- "commission": str(abs(float(trade.get('fee')))),
523
- "commissionAsset": trade.get('feeCcy'),
524
- "time": trade.get('ts'),
525
- "isBuyer": trade.get('side') == 'buy',
526
- "isMaker": trade.get('execType') == 'M',
522
+ "commission": str(abs(float(trade['fee']))),
523
+ "commissionAsset": trade['feeCcy'],
524
+ "time": trade['ts'],
525
+ "isBuyer": trade['side'] == 'buy',
526
+ "isMaker": trade['execType'] == 'M',
527
527
  "isBestMatch": True,
528
528
  }
529
529
  binance_trade_list.append(binance_trade)