architect-py 5.0.0b1__py3-none-any.whl → 5.0.0b3__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 (74) hide show
  1. architect_py/__init__.py +10 -3
  2. architect_py/async_client.py +291 -174
  3. architect_py/client_interface.py +19 -18
  4. architect_py/common_types/order_dir.py +12 -6
  5. architect_py/graphql_client/__init__.py +2 -0
  6. architect_py/graphql_client/enums.py +5 -0
  7. architect_py/grpc/__init__.py +25 -7
  8. architect_py/grpc/client.py +13 -5
  9. architect_py/grpc/models/Accounts/AccountsRequest.py +4 -1
  10. architect_py/grpc/models/Algo/AlgoOrder.py +114 -0
  11. architect_py/grpc/models/Algo/{ModifyAlgoOrderRequestForTwapAlgo.py → AlgoOrderRequest.py} +11 -10
  12. architect_py/grpc/models/Algo/AlgoOrdersRequest.py +72 -0
  13. architect_py/grpc/models/Algo/AlgoOrdersResponse.py +27 -0
  14. architect_py/grpc/models/Algo/CreateAlgoOrderRequest.py +56 -0
  15. architect_py/grpc/models/Algo/PauseAlgoRequest.py +42 -0
  16. architect_py/grpc/models/Algo/PauseAlgoResponse.py +20 -0
  17. architect_py/grpc/models/Algo/StartAlgoRequest.py +42 -0
  18. architect_py/grpc/models/Algo/StartAlgoResponse.py +20 -0
  19. architect_py/grpc/models/Algo/StopAlgoRequest.py +42 -0
  20. architect_py/grpc/models/Algo/StopAlgoResponse.py +20 -0
  21. architect_py/grpc/models/Boss/DepositsRequest.py +40 -0
  22. architect_py/grpc/models/Boss/DepositsResponse.py +27 -0
  23. architect_py/grpc/models/Boss/RqdAccountStatisticsRequest.py +42 -0
  24. architect_py/grpc/models/Boss/RqdAccountStatisticsResponse.py +25 -0
  25. architect_py/grpc/models/Boss/StatementUrlRequest.py +40 -0
  26. architect_py/grpc/models/Boss/StatementUrlResponse.py +23 -0
  27. architect_py/grpc/models/Boss/StatementsRequest.py +40 -0
  28. architect_py/grpc/models/Boss/StatementsResponse.py +27 -0
  29. architect_py/grpc/models/Boss/WithdrawalsRequest.py +40 -0
  30. architect_py/grpc/models/Boss/WithdrawalsResponse.py +27 -0
  31. architect_py/grpc/models/Boss/__init__.py +2 -0
  32. architect_py/grpc/models/Folio/HistoricalFillsRequest.py +4 -1
  33. architect_py/grpc/models/Marketdata/L1BookSnapshot.py +16 -2
  34. architect_py/grpc/models/Oms/Cancel.py +67 -19
  35. architect_py/grpc/models/Oms/Order.py +4 -11
  36. architect_py/grpc/models/Oms/PlaceOrderRequest.py +13 -20
  37. architect_py/grpc/models/OptionsMarketdata/OptionsChain.py +30 -0
  38. architect_py/grpc/models/OptionsMarketdata/OptionsChainGreeks.py +30 -0
  39. architect_py/grpc/models/OptionsMarketdata/OptionsChainGreeksRequest.py +47 -0
  40. architect_py/grpc/models/OptionsMarketdata/OptionsChainRequest.py +45 -0
  41. architect_py/grpc/models/OptionsMarketdata/OptionsExpirations.py +29 -0
  42. architect_py/grpc/models/OptionsMarketdata/OptionsExpirationsRequest.py +42 -0
  43. architect_py/grpc/models/OptionsMarketdata/__init__.py +2 -0
  44. architect_py/grpc/models/Symbology/ExecutionInfoRequest.py +47 -0
  45. architect_py/grpc/models/Symbology/ExecutionInfoResponse.py +27 -0
  46. architect_py/grpc/models/definitions.py +457 -790
  47. architect_py/grpc/resolve_endpoint.py +4 -1
  48. architect_py/internal_utils/__init__.py +0 -0
  49. architect_py/internal_utils/no_pandas.py +3 -0
  50. architect_py/tests/conftest.py +11 -6
  51. architect_py/tests/test_marketdata.py +19 -19
  52. architect_py/tests/test_orderflow.py +31 -28
  53. {architect_py-5.0.0b1.dist-info → architect_py-5.0.0b3.dist-info}/METADATA +2 -3
  54. {architect_py-5.0.0b1.dist-info → architect_py-5.0.0b3.dist-info}/RECORD +72 -42
  55. {architect_py-5.0.0b1.dist-info → architect_py-5.0.0b3.dist-info}/WHEEL +1 -1
  56. examples/book_subscription.py +2 -3
  57. examples/candles.py +3 -3
  58. examples/common.py +29 -20
  59. examples/external_cpty.py +4 -4
  60. examples/funding_rate_mean_reversion_algo.py +14 -20
  61. examples/order_sending.py +32 -33
  62. examples/stream_l1_marketdata.py +2 -2
  63. examples/stream_l2_marketdata.py +1 -3
  64. examples/trades.py +2 -2
  65. examples/tutorial_async.py +9 -7
  66. examples/tutorial_sync.py +5 -5
  67. scripts/generate_functions_md.py +3 -1
  68. scripts/generate_sync_interface.py +30 -11
  69. scripts/postprocess_grpc.py +21 -11
  70. scripts/preprocess_grpc_schema.py +174 -113
  71. architect_py/grpc/models/Algo/AlgoOrderForTwapAlgo.py +0 -61
  72. architect_py/grpc/models/Algo/CreateAlgoOrderRequestForTwapAlgo.py +0 -59
  73. {architect_py-5.0.0b1.dist-info → architect_py-5.0.0b3.dist-info}/licenses/LICENSE +0 -0
  74. {architect_py-5.0.0b1.dist-info → architect_py-5.0.0b3.dist-info}/top_level.txt +0 -0
@@ -5,7 +5,6 @@ from __future__ import annotations
5
5
  from architect_py.common_types import OrderDir
6
6
 
7
7
  from decimal import Decimal
8
- from enum import Enum
9
8
  from typing import Annotated, Optional
10
9
 
11
10
  from msgspec import Meta, Struct
@@ -13,12 +12,6 @@ from msgspec import Meta, Struct
13
12
  from .. import definitions
14
13
 
15
14
 
16
- class OrderType(str, Enum):
17
- LIMIT = "LIMIT"
18
- STOP_LOSS_LIMIT = "STOP_LOSS_LIMIT"
19
- TAKE_PROFIT_LIMIT = "TAKE_PROFIT_LIMIT"
20
-
21
-
22
15
  class Order(Struct, omit_defaults=True):
23
16
  a: Annotated[str, Meta(title="account")]
24
17
  d: Annotated[OrderDir, Meta(title="dir")]
@@ -34,7 +27,7 @@ class Order(Struct, omit_defaults=True):
34
27
  ve: Annotated[str, Meta(title="execution_venue")]
35
28
  xq: Annotated[Decimal, Meta(title="filled_quantity")]
36
29
  p: Annotated[Decimal, Meta(title="limit_price")]
37
- k: Annotated[OrderType, Meta(title="order_type")]
30
+ k: Annotated[definitions.OrderType, Meta(title="order_type")]
38
31
  eid: Optional[Annotated[Optional[str], Meta(title="exchange_order_id")]] = None
39
32
  pid: Optional[Annotated[Optional[definitions.OrderId], Meta(title="parent_id")]] = (
40
33
  None
@@ -66,7 +59,7 @@ class Order(Struct, omit_defaults=True):
66
59
  execution_venue: str,
67
60
  filled_quantity: Decimal,
68
61
  limit_price: Decimal,
69
- order_type: OrderType,
62
+ order_type: definitions.OrderType,
70
63
  exchange_order_id: Optional[str] = None,
71
64
  parent_id: Optional[definitions.OrderId] = None,
72
65
  reject_reason: Optional[definitions.OrderRejectReason] = None,
@@ -210,11 +203,11 @@ class Order(Struct, omit_defaults=True):
210
203
  self.p = value
211
204
 
212
205
  @property
213
- def order_type(self) -> OrderType:
206
+ def order_type(self) -> definitions.OrderType:
214
207
  return self.k
215
208
 
216
209
  @order_type.setter
217
- def order_type(self, value: OrderType) -> None:
210
+ def order_type(self, value: definitions.OrderType) -> None:
218
211
  self.k = value
219
212
 
220
213
  @property
@@ -6,7 +6,6 @@ from architect_py.grpc.models.Oms.Order import Order
6
6
  from architect_py.common_types import OrderDir
7
7
 
8
8
  from decimal import Decimal
9
- from enum import Enum
10
9
  from typing import Annotated, Optional
11
10
 
12
11
  from msgspec import Meta, Struct
@@ -14,19 +13,13 @@ from msgspec import Meta, Struct
14
13
  from .. import definitions
15
14
 
16
15
 
17
- class PlaceOrderRequestType(str, Enum):
18
- LIMIT = "LIMIT"
19
- STOP_LOSS_LIMIT = "STOP_LOSS_LIMIT"
20
- TAKE_PROFIT_LIMIT = "TAKE_PROFIT_LIMIT"
21
-
22
-
23
16
  class PlaceOrderRequest(Struct, omit_defaults=True):
24
17
  d: Annotated[OrderDir, Meta(title="dir")]
25
18
  q: Annotated[Decimal, Meta(title="quantity")]
26
19
  s: Annotated[str, Meta(title="symbol")]
27
20
  tif: Annotated[definitions.TimeInForce, Meta(title="time_in_force")]
28
21
  p: Annotated[Decimal, Meta(title="limit_price")]
29
- k: Annotated[PlaceOrderRequestType, Meta(title="place_order_request_type")]
22
+ k: Annotated[definitions.OrderType, Meta(title="order_type")]
30
23
  a: Optional[
31
24
  Annotated[Optional[definitions.AccountIdOrName], Meta(title="account")]
32
25
  ] = None
@@ -63,7 +56,7 @@ class PlaceOrderRequest(Struct, omit_defaults=True):
63
56
  symbol: str,
64
57
  time_in_force: definitions.TimeInForce,
65
58
  limit_price: Decimal,
66
- place_order_request_type: PlaceOrderRequestType,
59
+ order_type: definitions.OrderType,
67
60
  account: Optional[definitions.AccountIdOrName] = None,
68
61
  id: Optional[definitions.OrderId] = None,
69
62
  parent_id: Optional[definitions.OrderId] = None,
@@ -79,7 +72,7 @@ class PlaceOrderRequest(Struct, omit_defaults=True):
79
72
  symbol,
80
73
  time_in_force,
81
74
  limit_price,
82
- place_order_request_type,
75
+ order_type,
83
76
  account,
84
77
  id,
85
78
  parent_id,
@@ -91,7 +84,7 @@ class PlaceOrderRequest(Struct, omit_defaults=True):
91
84
  )
92
85
 
93
86
  def __str__(self) -> str:
94
- return f"PlaceOrderRequest(dir={self.d},quantity={self.q},symbol={self.s},time_in_force={self.tif},limit_price={self.p},place_order_request_type={self.k},account={self.a},id={self.id},parent_id={self.pid},source={self.src},trader={self.u},execution_venue={self.x},post_only={self.po},trigger_price={self.tp})"
87
+ return f"PlaceOrderRequest(dir={self.d},quantity={self.q},symbol={self.s},time_in_force={self.tif},limit_price={self.p},order_type={self.k},account={self.a},id={self.id},parent_id={self.pid},source={self.src},trader={self.u},execution_venue={self.x},post_only={self.po},trigger_price={self.tp})"
95
88
 
96
89
  @property
97
90
  def dir(self) -> OrderDir:
@@ -134,11 +127,11 @@ class PlaceOrderRequest(Struct, omit_defaults=True):
134
127
  self.p = value
135
128
 
136
129
  @property
137
- def place_order_request_type(self) -> PlaceOrderRequestType:
130
+ def order_type(self) -> definitions.OrderType:
138
131
  return self.k
139
132
 
140
- @place_order_request_type.setter
141
- def place_order_request_type(self, value: PlaceOrderRequestType) -> None:
133
+ @order_type.setter
134
+ def order_type(self, value: definitions.OrderType) -> None:
142
135
  self.k = value
143
136
 
144
137
  @property
@@ -217,27 +210,27 @@ class PlaceOrderRequest(Struct, omit_defaults=True):
217
210
  if self.k == "LIMIT":
218
211
  if not all(getattr(self, key) is not None for key in ["po"]):
219
212
  raise ValueError(
220
- f"When field k (place_order_request_type) is of value LIMIT, class PlaceOrderRequest requires fields ['po']"
213
+ f"When field k (order_type) is of value LIMIT, class PlaceOrderRequest requires fields ['po']"
221
214
  )
222
215
  elif any(getattr(self, key) is not None for key in ["tp"]):
223
216
  raise ValueError(
224
- f"When field k (place_order_request_type) is of value LIMIT, class PlaceOrderRequest should not have fields ['tp']"
217
+ f"When field k (order_type) is of value LIMIT, class PlaceOrderRequest should not have fields ['tp']"
225
218
  )
226
219
  elif self.k == "STOP_LOSS_LIMIT":
227
220
  if not all(getattr(self, key) is not None for key in ["tp"]):
228
221
  raise ValueError(
229
- f"When field k (place_order_request_type) is of value STOP_LOSS_LIMIT, class PlaceOrderRequest requires fields ['tp']"
222
+ f"When field k (order_type) is of value STOP_LOSS_LIMIT, class PlaceOrderRequest requires fields ['tp']"
230
223
  )
231
224
  elif any(getattr(self, key) is not None for key in ["po"]):
232
225
  raise ValueError(
233
- f"When field k (place_order_request_type) is of value STOP_LOSS_LIMIT, class PlaceOrderRequest should not have fields ['po']"
226
+ f"When field k (order_type) is of value STOP_LOSS_LIMIT, class PlaceOrderRequest should not have fields ['po']"
234
227
  )
235
228
  elif self.k == "TAKE_PROFIT_LIMIT":
236
229
  if not all(getattr(self, key) is not None for key in ["tp"]):
237
230
  raise ValueError(
238
- f"When field k (place_order_request_type) is of value TAKE_PROFIT_LIMIT, class PlaceOrderRequest requires fields ['tp']"
231
+ f"When field k (order_type) is of value TAKE_PROFIT_LIMIT, class PlaceOrderRequest requires fields ['tp']"
239
232
  )
240
233
  elif any(getattr(self, key) is not None for key in ["po"]):
241
234
  raise ValueError(
242
- f"When field k (place_order_request_type) is of value TAKE_PROFIT_LIMIT, class PlaceOrderRequest should not have fields ['po']"
235
+ f"When field k (order_type) is of value TAKE_PROFIT_LIMIT, class PlaceOrderRequest should not have fields ['po']"
243
236
  )
@@ -0,0 +1,30 @@
1
+ # generated by datamodel-codegen:
2
+ # filename: OptionsMarketdata/OptionsChain.json
3
+
4
+ from __future__ import annotations
5
+
6
+ from typing import List
7
+
8
+ from msgspec import Struct
9
+
10
+ from .. import definitions
11
+
12
+
13
+ class OptionsChain(Struct, omit_defaults=True):
14
+ calls: List[definitions.OptionsContract]
15
+ puts: List[definitions.OptionsContract]
16
+
17
+ # Constructor that takes all field titles as arguments for convenience
18
+ @classmethod
19
+ def new(
20
+ cls,
21
+ calls: List[definitions.OptionsContract],
22
+ puts: List[definitions.OptionsContract],
23
+ ):
24
+ return cls(
25
+ calls,
26
+ puts,
27
+ )
28
+
29
+ def __str__(self) -> str:
30
+ return f"OptionsChain(calls={self.calls},puts={self.puts})"
@@ -0,0 +1,30 @@
1
+ # generated by datamodel-codegen:
2
+ # filename: OptionsMarketdata/OptionsChainGreeks.json
3
+
4
+ from __future__ import annotations
5
+
6
+ from typing import List
7
+
8
+ from msgspec import Struct
9
+
10
+ from .. import definitions
11
+
12
+
13
+ class OptionsChainGreeks(Struct, omit_defaults=True):
14
+ calls: List[definitions.OptionsGreeks]
15
+ puts: List[definitions.OptionsGreeks]
16
+
17
+ # Constructor that takes all field titles as arguments for convenience
18
+ @classmethod
19
+ def new(
20
+ cls,
21
+ calls: List[definitions.OptionsGreeks],
22
+ puts: List[definitions.OptionsGreeks],
23
+ ):
24
+ return cls(
25
+ calls,
26
+ puts,
27
+ )
28
+
29
+ def __str__(self) -> str:
30
+ return f"OptionsChainGreeks(calls={self.calls},puts={self.puts})"
@@ -0,0 +1,47 @@
1
+ # generated by datamodel-codegen:
2
+ # filename: OptionsMarketdata/OptionsChainGreeksRequest.json
3
+
4
+ from __future__ import annotations
5
+ from architect_py.grpc.models.OptionsMarketdata.OptionsChainGreeks import (
6
+ OptionsChainGreeks,
7
+ )
8
+
9
+ from datetime import date
10
+
11
+ from msgspec import Struct
12
+
13
+
14
+ class OptionsChainGreeksRequest(Struct, omit_defaults=True):
15
+ expiration: date
16
+ underlying: str
17
+
18
+ # Constructor that takes all field titles as arguments for convenience
19
+ @classmethod
20
+ def new(
21
+ cls,
22
+ expiration: date,
23
+ underlying: str,
24
+ ):
25
+ return cls(
26
+ expiration,
27
+ underlying,
28
+ )
29
+
30
+ def __str__(self) -> str:
31
+ return f"OptionsChainGreeksRequest(expiration={self.expiration},underlying={self.underlying})"
32
+
33
+ @staticmethod
34
+ def get_response_type():
35
+ return OptionsChainGreeks
36
+
37
+ @staticmethod
38
+ def get_unannotated_response_type():
39
+ return OptionsChainGreeks
40
+
41
+ @staticmethod
42
+ def get_route() -> str:
43
+ return "/json.architect.OptionsMarketdata/OptionsChainGreeks"
44
+
45
+ @staticmethod
46
+ def get_rpc_method():
47
+ return "unary"
@@ -0,0 +1,45 @@
1
+ # generated by datamodel-codegen:
2
+ # filename: OptionsMarketdata/OptionsChainRequest.json
3
+
4
+ from __future__ import annotations
5
+ from architect_py.grpc.models.OptionsMarketdata.OptionsChain import OptionsChain
6
+
7
+ from datetime import date
8
+
9
+ from msgspec import Struct
10
+
11
+
12
+ class OptionsChainRequest(Struct, omit_defaults=True):
13
+ expiration: date
14
+ underlying: str
15
+
16
+ # Constructor that takes all field titles as arguments for convenience
17
+ @classmethod
18
+ def new(
19
+ cls,
20
+ expiration: date,
21
+ underlying: str,
22
+ ):
23
+ return cls(
24
+ expiration,
25
+ underlying,
26
+ )
27
+
28
+ def __str__(self) -> str:
29
+ return f"OptionsChainRequest(expiration={self.expiration},underlying={self.underlying})"
30
+
31
+ @staticmethod
32
+ def get_response_type():
33
+ return OptionsChain
34
+
35
+ @staticmethod
36
+ def get_unannotated_response_type():
37
+ return OptionsChain
38
+
39
+ @staticmethod
40
+ def get_route() -> str:
41
+ return "/json.architect.OptionsMarketdata/OptionsChain"
42
+
43
+ @staticmethod
44
+ def get_rpc_method():
45
+ return "unary"
@@ -0,0 +1,29 @@
1
+ # generated by datamodel-codegen:
2
+ # filename: OptionsMarketdata/OptionsExpirations.json
3
+
4
+ from __future__ import annotations
5
+
6
+ from datetime import date
7
+ from typing import List
8
+
9
+ from msgspec import Struct
10
+
11
+
12
+ class OptionsExpirations(Struct, omit_defaults=True):
13
+ expirations: List[date]
14
+ underlying: str
15
+
16
+ # Constructor that takes all field titles as arguments for convenience
17
+ @classmethod
18
+ def new(
19
+ cls,
20
+ expirations: List[date],
21
+ underlying: str,
22
+ ):
23
+ return cls(
24
+ expirations,
25
+ underlying,
26
+ )
27
+
28
+ def __str__(self) -> str:
29
+ return f"OptionsExpirations(expirations={self.expirations},underlying={self.underlying})"
@@ -0,0 +1,42 @@
1
+ # generated by datamodel-codegen:
2
+ # filename: OptionsMarketdata/OptionsExpirationsRequest.json
3
+
4
+ from __future__ import annotations
5
+ from architect_py.grpc.models.OptionsMarketdata.OptionsExpirations import (
6
+ OptionsExpirations,
7
+ )
8
+
9
+ from msgspec import Struct
10
+
11
+
12
+ class OptionsExpirationsRequest(Struct, omit_defaults=True):
13
+ underlying: str
14
+
15
+ # Constructor that takes all field titles as arguments for convenience
16
+ @classmethod
17
+ def new(
18
+ cls,
19
+ underlying: str,
20
+ ):
21
+ return cls(
22
+ underlying,
23
+ )
24
+
25
+ def __str__(self) -> str:
26
+ return f"OptionsExpirationsRequest(underlying={self.underlying})"
27
+
28
+ @staticmethod
29
+ def get_response_type():
30
+ return OptionsExpirations
31
+
32
+ @staticmethod
33
+ def get_unannotated_response_type():
34
+ return OptionsExpirations
35
+
36
+ @staticmethod
37
+ def get_route() -> str:
38
+ return "/json.architect.OptionsMarketdata/OptionsExpirations"
39
+
40
+ @staticmethod
41
+ def get_rpc_method():
42
+ return "unary"
@@ -0,0 +1,2 @@
1
+ # generated by datamodel-codegen:
2
+ # filename: schemas
@@ -0,0 +1,47 @@
1
+ # generated by datamodel-codegen:
2
+ # filename: Symbology/ExecutionInfoRequest.json
3
+
4
+ from __future__ import annotations
5
+ from architect_py.grpc.models.Symbology.ExecutionInfoResponse import (
6
+ ExecutionInfoResponse,
7
+ )
8
+
9
+ from typing import Optional
10
+
11
+ from msgspec import Struct
12
+
13
+
14
+ class ExecutionInfoRequest(Struct, omit_defaults=True):
15
+ symbol: str
16
+ execution_venue: Optional[str] = None
17
+
18
+ # Constructor that takes all field titles as arguments for convenience
19
+ @classmethod
20
+ def new(
21
+ cls,
22
+ symbol: str,
23
+ execution_venue: Optional[str] = None,
24
+ ):
25
+ return cls(
26
+ symbol,
27
+ execution_venue,
28
+ )
29
+
30
+ def __str__(self) -> str:
31
+ return f"ExecutionInfoRequest(symbol={self.symbol},execution_venue={self.execution_venue})"
32
+
33
+ @staticmethod
34
+ def get_response_type():
35
+ return ExecutionInfoResponse
36
+
37
+ @staticmethod
38
+ def get_unannotated_response_type():
39
+ return ExecutionInfoResponse
40
+
41
+ @staticmethod
42
+ def get_route() -> str:
43
+ return "/json.architect.Symbology/ExecutionInfo"
44
+
45
+ @staticmethod
46
+ def get_rpc_method():
47
+ return "unary"
@@ -0,0 +1,27 @@
1
+ # generated by datamodel-codegen:
2
+ # filename: Symbology/ExecutionInfoResponse.json
3
+
4
+ from __future__ import annotations
5
+
6
+ from typing import Dict
7
+
8
+ from msgspec import Struct
9
+
10
+ from .. import definitions
11
+
12
+
13
+ class ExecutionInfoResponse(Struct, omit_defaults=True):
14
+ execution_info: Dict[str, definitions.ExecutionInfo]
15
+
16
+ # Constructor that takes all field titles as arguments for convenience
17
+ @classmethod
18
+ def new(
19
+ cls,
20
+ execution_info: Dict[str, definitions.ExecutionInfo],
21
+ ):
22
+ return cls(
23
+ execution_info,
24
+ )
25
+
26
+ def __str__(self) -> str:
27
+ return f"ExecutionInfoResponse(execution_info={self.execution_info})"