opinion-clob-sdk 0.1.17__tar.gz → 0.1.19__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 opinion-clob-sdk might be problematic. Click here for more details.
- {opinion_clob_sdk-0.1.17/opinion_clob_sdk.egg-info → opinion_clob_sdk-0.1.19}/PKG-INFO +1 -1
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19/opinion_clob_sdk.egg-info}/PKG-INFO +1 -1
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/opinion_clob_sdk.egg-info/SOURCES.txt +0 -43
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/sdk.py +40 -15
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/setup.py +1 -1
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/MANIFEST.in +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/README.md +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/__init__.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/__init__.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/contract_caller.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/contracts/__init__.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/contracts/conditional_tokens.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/contracts/erc20.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/exception.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/py_order_utils/__init__.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/py_order_utils/builders/__init__.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/py_order_utils/builders/base_builder.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/py_order_utils/builders/exception.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/py_order_utils/builders/order_builder.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/py_order_utils/builders/order_builder_test.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/py_order_utils/constants.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/py_order_utils/model/__init__.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/py_order_utils/model/order.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/py_order_utils/model/order_type.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/py_order_utils/model/sides.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/py_order_utils/model/signatures.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/py_order_utils/signer.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/py_order_utils/utils.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/safe/__init__.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/safe/constants.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/safe/eip712/__init__.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/safe/enums.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/safe/exceptions.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/safe/multisend.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/safe/safe.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/safe/safe_contracts/__init__.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/safe/safe_contracts/compatibility_fallback_handler_v1_3_0.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/safe/safe_contracts/multisend_v1_3_0.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/safe/safe_contracts/safe_v1_3_0.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/safe/safe_contracts/utils.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/safe/safe_signature.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/safe/safe_test.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/safe/safe_tx.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/safe/signatures.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/safe/typing.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/safe/utils.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/config.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/model.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/opinion_clob_sdk.egg-info/dependency_links.txt +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/opinion_clob_sdk.egg-info/requires.txt +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/opinion_clob_sdk.egg-info/top_level.txt +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/setup.cfg +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/tests/test_integration.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/tests/test_model.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/tests/test_order_calculations.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/tests/test_precision.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/tests/test_sdk.py +0 -0
- {opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/verify_api_calls.py +0 -0
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
MANIFEST.in
|
|
2
2
|
README.md
|
|
3
|
-
__init__.py
|
|
4
|
-
config.py
|
|
5
|
-
model.py
|
|
6
|
-
sdk.py
|
|
7
3
|
setup.py
|
|
8
|
-
verify_api_calls.py
|
|
9
4
|
./__init__.py
|
|
10
5
|
./config.py
|
|
11
6
|
./model.py
|
|
@@ -49,44 +44,6 @@ verify_api_calls.py
|
|
|
49
44
|
./chain/safe/safe_contracts/multisend_v1_3_0.py
|
|
50
45
|
./chain/safe/safe_contracts/safe_v1_3_0.py
|
|
51
46
|
./chain/safe/safe_contracts/utils.py
|
|
52
|
-
chain/__init__.py
|
|
53
|
-
chain/contract_caller.py
|
|
54
|
-
chain/exception.py
|
|
55
|
-
chain/contracts/__init__.py
|
|
56
|
-
chain/contracts/conditional_tokens.py
|
|
57
|
-
chain/contracts/erc20.py
|
|
58
|
-
chain/py_order_utils/__init__.py
|
|
59
|
-
chain/py_order_utils/constants.py
|
|
60
|
-
chain/py_order_utils/signer.py
|
|
61
|
-
chain/py_order_utils/utils.py
|
|
62
|
-
chain/py_order_utils/builders/__init__.py
|
|
63
|
-
chain/py_order_utils/builders/base_builder.py
|
|
64
|
-
chain/py_order_utils/builders/exception.py
|
|
65
|
-
chain/py_order_utils/builders/order_builder.py
|
|
66
|
-
chain/py_order_utils/builders/order_builder_test.py
|
|
67
|
-
chain/py_order_utils/model/__init__.py
|
|
68
|
-
chain/py_order_utils/model/order.py
|
|
69
|
-
chain/py_order_utils/model/order_type.py
|
|
70
|
-
chain/py_order_utils/model/sides.py
|
|
71
|
-
chain/py_order_utils/model/signatures.py
|
|
72
|
-
chain/safe/__init__.py
|
|
73
|
-
chain/safe/constants.py
|
|
74
|
-
chain/safe/enums.py
|
|
75
|
-
chain/safe/exceptions.py
|
|
76
|
-
chain/safe/multisend.py
|
|
77
|
-
chain/safe/safe.py
|
|
78
|
-
chain/safe/safe_signature.py
|
|
79
|
-
chain/safe/safe_test.py
|
|
80
|
-
chain/safe/safe_tx.py
|
|
81
|
-
chain/safe/signatures.py
|
|
82
|
-
chain/safe/typing.py
|
|
83
|
-
chain/safe/utils.py
|
|
84
|
-
chain/safe/eip712/__init__.py
|
|
85
|
-
chain/safe/safe_contracts/__init__.py
|
|
86
|
-
chain/safe/safe_contracts/compatibility_fallback_handler_v1_3_0.py
|
|
87
|
-
chain/safe/safe_contracts/multisend_v1_3_0.py
|
|
88
|
-
chain/safe/safe_contracts/safe_v1_3_0.py
|
|
89
|
-
chain/safe/safe_contracts/utils.py
|
|
90
47
|
opinion_clob_sdk.egg-info/PKG-INFO
|
|
91
48
|
opinion_clob_sdk.egg-info/SOURCES.txt
|
|
92
49
|
opinion_clob_sdk.egg-info/dependency_links.txt
|
|
@@ -652,8 +652,8 @@ class Client:
|
|
|
652
652
|
|
|
653
653
|
from opinion_api.models.openapi_cancel_order_request_open_api import OpenapiCancelOrderRequestOpenAPI
|
|
654
654
|
|
|
655
|
-
#
|
|
656
|
-
request_body = OpenapiCancelOrderRequestOpenAPI(
|
|
655
|
+
# Use order_id for API request
|
|
656
|
+
request_body = OpenapiCancelOrderRequestOpenAPI(order_id=order_id)
|
|
657
657
|
result = self.market_api.openapi_order_cancel_post(apikey=self.api_key, cancel_order_req=request_body)
|
|
658
658
|
return result
|
|
659
659
|
|
|
@@ -768,6 +768,7 @@ class Client:
|
|
|
768
768
|
def cancel_all_orders(self, market_id: Optional[int] = None, side: Optional[OrderSide] = None) -> dict:
|
|
769
769
|
"""
|
|
770
770
|
Cancel all open orders, optionally filtered by market and/or side.
|
|
771
|
+
Uses pagination to fetch all orders (max 20 per page).
|
|
771
772
|
|
|
772
773
|
Args:
|
|
773
774
|
market_id: Optional filter - only cancel orders for this market
|
|
@@ -781,18 +782,40 @@ class Client:
|
|
|
781
782
|
'results': List[dict]
|
|
782
783
|
}
|
|
783
784
|
"""
|
|
784
|
-
#
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
785
|
+
# Collect all open orders using pagination
|
|
786
|
+
all_orders_list = []
|
|
787
|
+
page = 1
|
|
788
|
+
limit = 20 # Backend max page size
|
|
789
|
+
max_pages = 100 # Safety limit to prevent infinite loops
|
|
790
|
+
|
|
791
|
+
while page <= max_pages:
|
|
792
|
+
# Get orders for current page
|
|
793
|
+
page_orders = self.get_my_orders(
|
|
794
|
+
market_id=market_id if market_id else 0,
|
|
795
|
+
status='1', # 1 = pending/open orders
|
|
796
|
+
limit=limit,
|
|
797
|
+
page=page
|
|
798
|
+
)
|
|
799
|
+
|
|
800
|
+
# Parse response to get order list
|
|
801
|
+
orders_list = self._parse_list_response(page_orders, f"get open orders page {page}")
|
|
802
|
+
|
|
803
|
+
if not orders_list or len(orders_list) == 0:
|
|
804
|
+
# No more orders on this page
|
|
805
|
+
break
|
|
791
806
|
|
|
792
|
-
|
|
793
|
-
orders_list = self._parse_list_response(all_orders, "get open orders for cancellation")
|
|
807
|
+
all_orders_list.extend(orders_list)
|
|
794
808
|
|
|
795
|
-
|
|
809
|
+
# If we got fewer orders than the limit, we've reached the last page
|
|
810
|
+
if len(orders_list) < limit:
|
|
811
|
+
break
|
|
812
|
+
|
|
813
|
+
page += 1
|
|
814
|
+
|
|
815
|
+
if page > max_pages:
|
|
816
|
+
logging.warning(f"Reached maximum page limit ({max_pages}), there may be more orders")
|
|
817
|
+
|
|
818
|
+
if not all_orders_list or len(all_orders_list) == 0:
|
|
796
819
|
logging.info("No open orders to cancel")
|
|
797
820
|
return {
|
|
798
821
|
'total_orders': 0,
|
|
@@ -803,10 +826,10 @@ class Client:
|
|
|
803
826
|
|
|
804
827
|
# Filter by side if specified
|
|
805
828
|
if side:
|
|
806
|
-
|
|
829
|
+
all_orders_list = [order for order in all_orders_list if int(order.side) == int(side.value)]
|
|
807
830
|
|
|
808
|
-
# Extract order IDs
|
|
809
|
-
order_ids = [order.
|
|
831
|
+
# Extract order IDs from the response
|
|
832
|
+
order_ids = [order.order_id for order in all_orders_list if hasattr(order, 'order_id')]
|
|
810
833
|
|
|
811
834
|
if not order_ids:
|
|
812
835
|
logging.info("No orders match the filter criteria")
|
|
@@ -817,6 +840,8 @@ class Client:
|
|
|
817
840
|
'results': []
|
|
818
841
|
}
|
|
819
842
|
|
|
843
|
+
logging.info(f"Found {len(order_ids)} orders to cancel")
|
|
844
|
+
|
|
820
845
|
# Cancel all orders in batch
|
|
821
846
|
results = self.cancel_orders_batch(order_ids)
|
|
822
847
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/py_order_utils/builders/__init__.py
RENAMED
|
File without changes
|
{opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/py_order_utils/builders/base_builder.py
RENAMED
|
File without changes
|
{opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/py_order_utils/builders/exception.py
RENAMED
|
File without changes
|
{opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/py_order_utils/builders/order_builder.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/py_order_utils/model/order_type.py
RENAMED
|
File without changes
|
|
File without changes
|
{opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/py_order_utils/model/signatures.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/safe/safe_contracts/multisend_v1_3_0.py
RENAMED
|
File without changes
|
{opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/chain/safe/safe_contracts/safe_v1_3_0.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{opinion_clob_sdk-0.1.17 → opinion_clob_sdk-0.1.19}/opinion_clob_sdk.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|