1+ """Service module for order-related API endpoints."""
2+
13from datetime import datetime
24from typing import Any , Dict , List , Optional , Union
35
@@ -37,9 +39,9 @@ def search(
3739 if end_timestamp :
3840 data ["endTimestamp" ] = end_timestamp .isoformat ()
3941
40- response = self ._client .post ("Order/search" , json = data )
42+ response : Dict [ str , Any ] = self ._client .post ("Order/search" , json = data )
4143 search_response = OrderSearchResponse .model_validate (response )
42- return search_response .orders
44+ return search_response .orders # type: ignore
4345
4446 def search_open (self , account_id : int ) -> List [Order ]:
4547 """
@@ -53,9 +55,9 @@ def search_open(self, account_id: int) -> List[Order]:
5355 """
5456 data = {"accountId" : account_id }
5557
56- response = self ._client .post ("Order/searchOpen" , json = data )
58+ response : Dict [ str , Any ] = self ._client .post ("Order/searchOpen" , json = data )
5759 search_response = OrderSearchResponse .model_validate (response )
58- return search_response .orders
60+ return search_response .orders # type: ignore
5961
6062 def place (
6163 self ,
@@ -107,9 +109,9 @@ def place(
107109 "linkedOrderId" : linked_order_id ,
108110 }
109111
110- response = self ._client .post ("Order/place" , json = data )
112+ response : Dict [ str , Any ] = self ._client .post ("Order/place" , json = data )
111113 placement_response = OrderPlacementResponse .model_validate (response )
112- return placement_response .order_id
114+ return placement_response .order_id # type: ignore
113115
114116 def cancel (self , account_id : int , order_id : int ) -> bool :
115117 """
@@ -124,9 +126,9 @@ def cancel(self, account_id: int, order_id: int) -> bool:
124126 """
125127 data = {"accountId" : account_id , "orderId" : order_id }
126128
127- response = self ._client .post ("Order/cancel" , json = data )
129+ response : Dict [ str , Any ] = self ._client .post ("Order/cancel" , json = data )
128130 cancellation_response = OrderCancellationResponse .model_validate (response )
129- return cancellation_response .success
131+ return cancellation_response .success # type: ignore
130132
131133 def modify (
132134 self ,
@@ -151,7 +153,7 @@ def modify(
151153 Returns:
152154 True if modification was successful, False otherwise
153155 """
154- data = {"accountId" : account_id , "orderId" : order_id }
156+ data : Dict [ str , Any ] = {"accountId" : account_id , "orderId" : order_id }
155157
156158 # Only include fields that are being modified
157159 if size is not None :
@@ -163,6 +165,6 @@ def modify(
163165 if trail_price is not None :
164166 data ["trailPrice" ] = trail_price
165167
166- response = self ._client .post ("Order/modify" , json = data )
168+ response : Dict [ str , Any ] = self ._client .post ("Order/modify" , json = data )
167169 modification_response = OrderModificationResponse .model_validate (response )
168- return modification_response .success
170+ return modification_response .success # type: ignore
0 commit comments