trd-utils 0.0.42__tar.gz → 0.0.44__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.

Potentially problematic release.


This version of trd-utils might be problematic. Click here for more details.

Files changed (42) hide show
  1. {trd_utils-0.0.42 → trd_utils-0.0.44}/PKG-INFO +1 -1
  2. {trd_utils-0.0.42 → trd_utils-0.0.44}/pyproject.toml +1 -1
  3. trd_utils-0.0.44/trd_utils/__init__.py +3 -0
  4. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/exchanges/bx_ultra/bx_ultra_client.py +12 -2
  5. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/exchanges/okx/okx_client.py +5 -0
  6. trd_utils-0.0.42/trd_utils/__init__.py +0 -3
  7. {trd_utils-0.0.42 → trd_utils-0.0.44}/LICENSE +0 -0
  8. {trd_utils-0.0.42 → trd_utils-0.0.44}/README.md +0 -0
  9. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/cipher/__init__.py +0 -0
  10. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/common_utils/float_utils.py +0 -0
  11. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/common_utils/wallet_utils.py +0 -0
  12. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/date_utils/__init__.py +0 -0
  13. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/date_utils/datetime_helpers.py +0 -0
  14. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/exchanges/README.md +0 -0
  15. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/exchanges/__init__.py +0 -0
  16. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/exchanges/base_types.py +0 -0
  17. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/exchanges/blofin/__init__.py +0 -0
  18. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/exchanges/blofin/blofin_client.py +0 -0
  19. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/exchanges/blofin/blofin_types.py +0 -0
  20. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/exchanges/bx_ultra/__init__.py +0 -0
  21. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/exchanges/bx_ultra/bx_types.py +0 -0
  22. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/exchanges/bx_ultra/bx_utils.py +0 -0
  23. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/exchanges/errors.py +0 -0
  24. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/exchanges/exchange_base.py +0 -0
  25. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/exchanges/hyperliquid/README.md +0 -0
  26. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/exchanges/hyperliquid/__init__.py +0 -0
  27. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/exchanges/hyperliquid/hyperliquid_client.py +0 -0
  28. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/exchanges/hyperliquid/hyperliquid_types.py +0 -0
  29. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/exchanges/okx/__init__.py +0 -0
  30. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/exchanges/okx/okx_types.py +0 -0
  31. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/exchanges/price_fetcher.py +0 -0
  32. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/html_utils/__init__.py +0 -0
  33. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/html_utils/html_formats.py +0 -0
  34. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/tradingview/__init__.py +0 -0
  35. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/tradingview/tradingview_client.py +0 -0
  36. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/tradingview/tradingview_types.py +0 -0
  37. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/types_helper/__init__.py +0 -0
  38. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/types_helper/base_model.py +0 -0
  39. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/types_helper/decorators.py +0 -0
  40. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/types_helper/model_config.py +0 -0
  41. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/types_helper/ultra_list.py +0 -0
  42. {trd_utils-0.0.42 → trd_utils-0.0.44}/trd_utils/types_helper/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: trd_utils
3
- Version: 0.0.42
3
+ Version: 0.0.44
4
4
  Summary: Common Basic Utils for Python3. By ALiwoto.
5
5
  Keywords: utils,trd_utils,basic-utils,common-utils
6
6
  Author: ALiwoto
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "trd_utils"
3
- version = "0.0.42"
3
+ version = "0.0.44"
4
4
  description = "Common Basic Utils for Python3. By ALiwoto."
5
5
  authors = ["ALiwoto <aminnimaj@gmail.com>"]
6
6
  packages = [
@@ -0,0 +1,3 @@
1
+
2
+ __version__ = "0.0.44"
3
+
@@ -77,6 +77,8 @@ logger = logging.getLogger(__name__)
77
77
  # specific to the current session that is fetching them,
78
78
  user_api_identity_cache: dict[int, int] = {}
79
79
 
80
+ __positions_hidden_warn_map: dict[str, bool] = {}
81
+
80
82
 
81
83
  class BXUltraClient(ExchangeBase, IPriceFetcher):
82
84
  ###########################################################
@@ -940,7 +942,11 @@ class BXUltraClient(ExchangeBase, IPriceFetcher):
940
942
  raise ex
941
943
 
942
944
  if not no_warn:
943
- logger.warning(f"Failed to fetch perp positions of {uid}: {ex}")
945
+ if err_str.find("positions hidden") != -1:
946
+ warn_key = f"perp_{uid}"
947
+ if not __positions_hidden_warn_map.get(warn_key, False):
948
+ __positions_hidden_warn_map[warn_key] = True
949
+ logger.warning(f"Failed to fetch perp positions of {uid}: {ex}")
944
950
  perp_ex = ex
945
951
 
946
952
  try:
@@ -955,7 +961,11 @@ class BXUltraClient(ExchangeBase, IPriceFetcher):
955
961
  raise ex
956
962
 
957
963
  if not no_warn:
958
- logger.warning(f"Failed to fetch std positions of {uid}: {ex}")
964
+ if err_str.find("positions hidden") != -1:
965
+ warn_key = f"std_{uid}"
966
+ if not __positions_hidden_warn_map.get(warn_key, False):
967
+ __positions_hidden_warn_map[warn_key] = True
968
+ logger.warning(f"Failed to fetch std positions of {uid}: {ex}")
959
969
  std_ex = ex
960
970
 
961
971
  if not perp_positions and not std_positions:
@@ -1,3 +1,4 @@
1
+ from decimal import Decimal
1
2
  import json
2
3
  import logging
3
4
  import time
@@ -169,6 +170,8 @@ class OkxClient(ExchangeBase):
169
170
  async def get_unified_trader_positions(
170
171
  self,
171
172
  uid: int | str,
173
+ no_warn: bool = False,
174
+ min_margin: Decimal = 0,
172
175
  ) -> UnifiedTraderPositions:
173
176
  result = await self.get_trader_positions(
174
177
  uid=uid,
@@ -176,6 +179,8 @@ class OkxClient(ExchangeBase):
176
179
  unified_result = UnifiedTraderPositions()
177
180
  unified_result.positions = []
178
181
  for position in result.data[0].pos_data:
182
+ if min_margin and (not position.margin or position.margin < min_margin):
183
+ continue
179
184
  unified_pos = UnifiedPositionInfo()
180
185
  unified_pos.position_id = position.pos_id
181
186
  unified_pos.position_pnl = round(position.realized_pnl, 3)
@@ -1,3 +0,0 @@
1
-
2
- __version__ = "0.0.42"
3
-
File without changes
File without changes