architect-py 5.1.3__py3-none-any.whl → 5.1.4rc1__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.
- architect_py/__init__.py +19 -1
- architect_py/async_client.py +133 -39
- architect_py/client.py +15 -1
- architect_py/client.pyi +25 -7
- architect_py/grpc/client.py +37 -13
- architect_py/grpc/models/AlgoHelper/AlgoParamTypes.py +31 -0
- architect_py/grpc/models/AlgoHelper/__init__.py +2 -0
- architect_py/grpc/models/Auth/AuthInfoRequest.py +37 -0
- architect_py/grpc/models/Auth/AuthInfoResponse.py +30 -0
- architect_py/grpc/models/Folio/AccountHistoryRequest.py +35 -4
- architect_py/grpc/models/Marketdata/L1BookSnapshot.py +11 -3
- architect_py/grpc/models/Marketdata/TickersRequest.py +4 -1
- architect_py/grpc/models/Oms/Order.py +38 -14
- architect_py/grpc/models/Oms/PlaceOrderRequest.py +38 -14
- architect_py/grpc/models/__init__.py +4 -1
- architect_py/grpc/models/definitions.py +154 -0
- architect_py/grpc/orderflow.py +138 -0
- architect_py/tests/test_order_entry.py +9 -6
- architect_py/tests/test_orderflow.py +116 -27
- {architect_py-5.1.3.dist-info → architect_py-5.1.4rc1.dist-info}/METADATA +1 -1
- {architect_py-5.1.3.dist-info → architect_py-5.1.4rc1.dist-info}/RECORD +27 -22
- examples/funding_rate_mean_reversion_algo.py +23 -47
- scripts/correct_sync_interface.py +5 -2
- scripts/postprocess_grpc.py +17 -2
- {architect_py-5.1.3.dist-info → architect_py-5.1.4rc1.dist-info}/WHEEL +0 -0
- {architect_py-5.1.3.dist-info → architect_py-5.1.4rc1.dist-info}/licenses/LICENSE +0 -0
- {architect_py-5.1.3.dist-info → architect_py-5.1.4rc1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
# generated by datamodel-codegen:
|
2
|
+
# filename: AlgoHelper/AlgoParamTypes.json
|
3
|
+
|
4
|
+
from __future__ import annotations
|
5
|
+
|
6
|
+
from typing import List, Union
|
7
|
+
|
8
|
+
from msgspec import Struct
|
9
|
+
|
10
|
+
from .. import definitions
|
11
|
+
|
12
|
+
|
13
|
+
class AlgoParamTypes(Struct, omit_defaults=True):
|
14
|
+
"""
|
15
|
+
this is used to coerce creation of the params in the schema.json
|
16
|
+
"""
|
17
|
+
|
18
|
+
spreader: List[Union[definitions.SpreaderParams, definitions.SpreaderStatus]]
|
19
|
+
|
20
|
+
# Constructor that takes all field titles as arguments for convenience
|
21
|
+
@classmethod
|
22
|
+
def new(
|
23
|
+
cls,
|
24
|
+
spreader: List[Union[definitions.SpreaderParams, definitions.SpreaderStatus]],
|
25
|
+
):
|
26
|
+
return cls(
|
27
|
+
spreader,
|
28
|
+
)
|
29
|
+
|
30
|
+
def __str__(self) -> str:
|
31
|
+
return f"AlgoParamTypes(spreader={self.spreader})"
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# generated by datamodel-codegen:
|
2
|
+
# filename: Auth/AuthInfoRequest.json
|
3
|
+
|
4
|
+
from __future__ import annotations
|
5
|
+
from architect_py.grpc.models.Auth.AuthInfoResponse import AuthInfoResponse
|
6
|
+
|
7
|
+
from msgspec import Struct
|
8
|
+
|
9
|
+
|
10
|
+
class AuthInfoRequest(Struct, omit_defaults=True):
|
11
|
+
pass
|
12
|
+
|
13
|
+
# Constructor that takes all field titles as arguments for convenience
|
14
|
+
@classmethod
|
15
|
+
def new(
|
16
|
+
cls,
|
17
|
+
):
|
18
|
+
return cls()
|
19
|
+
|
20
|
+
def __str__(self) -> str:
|
21
|
+
return f"AuthInfoRequest()"
|
22
|
+
|
23
|
+
@staticmethod
|
24
|
+
def get_response_type():
|
25
|
+
return AuthInfoResponse
|
26
|
+
|
27
|
+
@staticmethod
|
28
|
+
def get_unannotated_response_type():
|
29
|
+
return AuthInfoResponse
|
30
|
+
|
31
|
+
@staticmethod
|
32
|
+
def get_route() -> str:
|
33
|
+
return "/json.architect.Auth/AuthInfo"
|
34
|
+
|
35
|
+
@staticmethod
|
36
|
+
def get_rpc_method():
|
37
|
+
return "unary"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# generated by datamodel-codegen:
|
2
|
+
# filename: Auth/AuthInfoResponse.json
|
3
|
+
|
4
|
+
from __future__ import annotations
|
5
|
+
|
6
|
+
from typing import Optional
|
7
|
+
|
8
|
+
from msgspec import Struct
|
9
|
+
|
10
|
+
from .. import definitions
|
11
|
+
|
12
|
+
|
13
|
+
class AuthInfoResponse(Struct, omit_defaults=True):
|
14
|
+
original_user_id: Optional[definitions.UserId] = None
|
15
|
+
user_id: Optional[definitions.UserId] = None
|
16
|
+
|
17
|
+
# Constructor that takes all field titles as arguments for convenience
|
18
|
+
@classmethod
|
19
|
+
def new(
|
20
|
+
cls,
|
21
|
+
original_user_id: Optional[definitions.UserId] = None,
|
22
|
+
user_id: Optional[definitions.UserId] = None,
|
23
|
+
):
|
24
|
+
return cls(
|
25
|
+
original_user_id,
|
26
|
+
user_id,
|
27
|
+
)
|
28
|
+
|
29
|
+
def __str__(self) -> str:
|
30
|
+
return f"AuthInfoResponse(original_user_id={self.original_user_id},user_id={self.user_id})"
|
@@ -4,10 +4,10 @@
|
|
4
4
|
from __future__ import annotations
|
5
5
|
from architect_py.grpc.models.Folio.AccountHistoryResponse import AccountHistoryResponse
|
6
6
|
|
7
|
-
from datetime import datetime
|
8
|
-
from typing import Optional
|
7
|
+
from datetime import datetime, time
|
8
|
+
from typing import Annotated, Optional
|
9
9
|
|
10
|
-
from msgspec import Struct
|
10
|
+
from msgspec import Meta, Struct
|
11
11
|
|
12
12
|
from .. import definitions
|
13
13
|
|
@@ -15,6 +15,31 @@ from .. import definitions
|
|
15
15
|
class AccountHistoryRequest(Struct, omit_defaults=True):
|
16
16
|
account: definitions.AccountIdOrName
|
17
17
|
from_inclusive: Optional[datetime] = None
|
18
|
+
granularity: Optional[definitions.AccountHistoryGranularity] = None
|
19
|
+
limit: Optional[
|
20
|
+
Annotated[
|
21
|
+
Optional[int],
|
22
|
+
Meta(
|
23
|
+
description="Default maximum of 100 data points. If the number of data points between from_inclusive and to_exclusive exceeds the limit, the response will be truncated. Data is always returned in descending timestamp order."
|
24
|
+
),
|
25
|
+
]
|
26
|
+
] = None
|
27
|
+
"""
|
28
|
+
Default maximum of 100 data points. If the number of data points between from_inclusive and to_exclusive exceeds the limit, the response will be truncated. Data is always returned in descending timestamp order.
|
29
|
+
"""
|
30
|
+
time_of_day: Optional[
|
31
|
+
Annotated[
|
32
|
+
Optional[time],
|
33
|
+
Meta(
|
34
|
+
description="For daily granularity, the UTC time of day to use for each day.\n\nCurrently the seconds and subseconds parts are ignored."
|
35
|
+
),
|
36
|
+
]
|
37
|
+
] = None
|
38
|
+
"""
|
39
|
+
For daily granularity, the UTC time of day to use for each day.
|
40
|
+
|
41
|
+
Currently the seconds and subseconds parts are ignored.
|
42
|
+
"""
|
18
43
|
to_exclusive: Optional[datetime] = None
|
19
44
|
|
20
45
|
# Constructor that takes all field titles as arguments for convenience
|
@@ -23,16 +48,22 @@ class AccountHistoryRequest(Struct, omit_defaults=True):
|
|
23
48
|
cls,
|
24
49
|
account: definitions.AccountIdOrName,
|
25
50
|
from_inclusive: Optional[datetime] = None,
|
51
|
+
granularity: Optional[definitions.AccountHistoryGranularity] = None,
|
52
|
+
limit: Optional[int] = None,
|
53
|
+
time_of_day: Optional[time] = None,
|
26
54
|
to_exclusive: Optional[datetime] = None,
|
27
55
|
):
|
28
56
|
return cls(
|
29
57
|
account,
|
30
58
|
from_inclusive,
|
59
|
+
granularity,
|
60
|
+
limit,
|
61
|
+
time_of_day,
|
31
62
|
to_exclusive,
|
32
63
|
)
|
33
64
|
|
34
65
|
def __str__(self) -> str:
|
35
|
-
return f"AccountHistoryRequest(account={self.account},from_inclusive={self.from_inclusive},to_exclusive={self.to_exclusive})"
|
66
|
+
return f"AccountHistoryRequest(account={self.account},from_inclusive={self.from_inclusive},granularity={self.granularity},limit={self.limit},time_of_day={self.time_of_day},to_exclusive={self.to_exclusive})"
|
36
67
|
|
37
68
|
@staticmethod
|
38
69
|
def get_response_type():
|
@@ -13,7 +13,15 @@ from msgspec import Meta, Struct
|
|
13
13
|
class L1BookSnapshot(Struct, omit_defaults=True):
|
14
14
|
s: Annotated[str, Meta(title="symbol")]
|
15
15
|
tn: Annotated[int, Meta(ge=0, title="timestamp_ns")]
|
16
|
-
ts: Annotated[
|
16
|
+
ts: Annotated[
|
17
|
+
int,
|
18
|
+
Meta(
|
19
|
+
description="Time that the exchange stamped the message", title="timestamp"
|
20
|
+
),
|
21
|
+
]
|
22
|
+
"""
|
23
|
+
Time that the exchange stamped the message
|
24
|
+
"""
|
17
25
|
a: Optional[
|
18
26
|
Annotated[
|
19
27
|
List[Decimal], Meta(description="(price, quantity)", title="best_ask")
|
@@ -34,13 +42,13 @@ class L1BookSnapshot(Struct, omit_defaults=True):
|
|
34
42
|
Annotated[
|
35
43
|
Optional[int],
|
36
44
|
Meta(
|
37
|
-
description="Time that Architect feed received the message
|
45
|
+
description="Time that Architect feed received the message that updated the BBO",
|
38
46
|
title="recv_time",
|
39
47
|
),
|
40
48
|
]
|
41
49
|
] = None
|
42
50
|
"""
|
43
|
-
Time that Architect feed received the message
|
51
|
+
Time that Architect feed received the message that updated the BBO
|
44
52
|
"""
|
45
53
|
rtn: Optional[Annotated[Optional[int], Meta(title="recv_time_ns")]] = None
|
46
54
|
|
@@ -13,6 +13,7 @@ from .. import definitions
|
|
13
13
|
|
14
14
|
class TickersRequest(Struct, omit_defaults=True):
|
15
15
|
i: Optional[Annotated[Optional[int], Meta(title="offset")]] = None
|
16
|
+
include_options: Optional[bool] = None
|
16
17
|
k: Optional[
|
17
18
|
Annotated[Optional[definitions.SortTickersBy], Meta(title="sort_by")]
|
18
19
|
] = None
|
@@ -25,6 +26,7 @@ class TickersRequest(Struct, omit_defaults=True):
|
|
25
26
|
def new(
|
26
27
|
cls,
|
27
28
|
offset: Optional[int] = None,
|
29
|
+
include_options: Optional[bool] = None,
|
28
30
|
sort_by: Optional[definitions.SortTickersBy] = None,
|
29
31
|
limit: Optional[int] = None,
|
30
32
|
symbols: Optional[List[str]] = None,
|
@@ -32,6 +34,7 @@ class TickersRequest(Struct, omit_defaults=True):
|
|
32
34
|
):
|
33
35
|
return cls(
|
34
36
|
offset,
|
37
|
+
include_options,
|
35
38
|
sort_by,
|
36
39
|
limit,
|
37
40
|
symbols,
|
@@ -39,7 +42,7 @@ class TickersRequest(Struct, omit_defaults=True):
|
|
39
42
|
)
|
40
43
|
|
41
44
|
def __str__(self) -> str:
|
42
|
-
return f"TickersRequest(offset={self.i},sort_by={self.k},limit={self.n},symbols={self.symbols},venue={self.venue})"
|
45
|
+
return f"TickersRequest(offset={self.i},include_options={self.include_options},sort_by={self.k},limit={self.n},symbols={self.symbols},venue={self.venue})"
|
43
46
|
|
44
47
|
@property
|
45
48
|
def offset(self) -> Optional[int]:
|
@@ -51,6 +51,10 @@ class Order(Struct, omit_defaults=True):
|
|
51
51
|
p: Optional[Annotated[Decimal, Meta(title="limit_price")]] = None
|
52
52
|
po: Optional[Annotated[bool, Meta(title="post_only")]] = None
|
53
53
|
tp: Optional[Annotated[Decimal, Meta(title="trigger_price")]] = None
|
54
|
+
sl: Optional[
|
55
|
+
Annotated[Optional[definitions.TriggerLimitOrderType], Meta(title="stop_loss")]
|
56
|
+
] = None
|
57
|
+
tpp: Optional[Annotated[Optional[Decimal], Meta(title="take_profit_price")]] = None
|
54
58
|
|
55
59
|
# Constructor that takes all field titles as arguments for convenience
|
56
60
|
@classmethod
|
@@ -79,6 +83,8 @@ class Order(Struct, omit_defaults=True):
|
|
79
83
|
limit_price: Optional[Decimal] = None,
|
80
84
|
post_only: Optional[bool] = None,
|
81
85
|
trigger_price: Optional[Decimal] = None,
|
86
|
+
stop_loss: Optional[definitions.TriggerLimitOrderType] = None,
|
87
|
+
take_profit_price: Optional[Decimal] = None,
|
82
88
|
):
|
83
89
|
return cls(
|
84
90
|
account,
|
@@ -104,10 +110,12 @@ class Order(Struct, omit_defaults=True):
|
|
104
110
|
limit_price,
|
105
111
|
post_only,
|
106
112
|
trigger_price,
|
113
|
+
stop_loss,
|
114
|
+
take_profit_price,
|
107
115
|
)
|
108
116
|
|
109
117
|
def __str__(self) -> str:
|
110
|
-
return f"Order(account={self.a},dir={self.d},id={self.id},status={self.o},quantity={self.q},symbol={self.s},source={self.src},time_in_force={self.tif},recv_time_ns={self.tn},recv_time={self.ts},trader={self.u},execution_venue={self.ve},filled_quantity={self.xq},order_type={self.k},exchange_order_id={self.eid},parent_id={self.pid},reject_reason={self.r},reject_message={self.rm},is_short_sale={self.ss},average_fill_price={self.xp},limit_price={self.p},post_only={self.po},trigger_price={self.tp})"
|
118
|
+
return f"Order(account={self.a},dir={self.d},id={self.id},status={self.o},quantity={self.q},symbol={self.s},source={self.src},time_in_force={self.tif},recv_time_ns={self.tn},recv_time={self.ts},trader={self.u},execution_venue={self.ve},filled_quantity={self.xq},order_type={self.k},exchange_order_id={self.eid},parent_id={self.pid},reject_reason={self.r},reject_message={self.rm},is_short_sale={self.ss},average_fill_price={self.xp},limit_price={self.p},post_only={self.po},trigger_price={self.tp},stop_loss={self.sl},take_profit_price={self.tpp})"
|
111
119
|
|
112
120
|
@property
|
113
121
|
def account(self) -> str:
|
@@ -285,20 +293,27 @@ class Order(Struct, omit_defaults=True):
|
|
285
293
|
def trigger_price(self, value: Optional[Decimal]) -> None:
|
286
294
|
self.tp = value
|
287
295
|
|
296
|
+
@property
|
297
|
+
def stop_loss(self) -> Optional[definitions.TriggerLimitOrderType]:
|
298
|
+
return self.sl
|
299
|
+
|
300
|
+
@stop_loss.setter
|
301
|
+
def stop_loss(self, value: Optional[definitions.TriggerLimitOrderType]) -> None:
|
302
|
+
self.sl = value
|
303
|
+
|
304
|
+
@property
|
305
|
+
def take_profit_price(self) -> Optional[Decimal]:
|
306
|
+
return self.tpp
|
307
|
+
|
308
|
+
@take_profit_price.setter
|
309
|
+
def take_profit_price(self, value: Optional[Decimal]) -> None:
|
310
|
+
self.tpp = value
|
311
|
+
|
288
312
|
def __post_init__(self):
|
289
|
-
if self.k == "
|
290
|
-
if not all(getattr(self, key) is not None for key in []):
|
291
|
-
raise ValueError(
|
292
|
-
f"When field k (order_type) is of value MARKET, class Order requires fields []"
|
293
|
-
)
|
294
|
-
elif any(getattr(self, key) is not None for key in ["p", "po", "tp"]):
|
295
|
-
raise ValueError(
|
296
|
-
f"When field k (order_type) is of value MARKET, class Order should not have fields ['p', 'po', 'tp']"
|
297
|
-
)
|
298
|
-
elif self.k == "LIMIT":
|
313
|
+
if self.k == "LIMIT":
|
299
314
|
if not all(getattr(self, key) is not None for key in ["p", "po"]):
|
300
315
|
raise ValueError(
|
301
|
-
f"When field k (order_type) is of value LIMIT, class Order requires fields ['p', 'po']"
|
316
|
+
f"When field k (order_type) is of value LIMIT, class Order requires fields ['limit_price (p)', 'post_only (po)']"
|
302
317
|
)
|
303
318
|
elif any(getattr(self, key) is not None for key in ["tp"]):
|
304
319
|
raise ValueError(
|
@@ -307,7 +322,7 @@ class Order(Struct, omit_defaults=True):
|
|
307
322
|
elif self.k == "STOP_LOSS_LIMIT":
|
308
323
|
if not all(getattr(self, key) is not None for key in ["p", "tp"]):
|
309
324
|
raise ValueError(
|
310
|
-
f"When field k (order_type) is of value STOP_LOSS_LIMIT, class Order requires fields ['p', 'tp']"
|
325
|
+
f"When field k (order_type) is of value STOP_LOSS_LIMIT, class Order requires fields ['limit_price (p)', 'trigger_price (tp)']"
|
311
326
|
)
|
312
327
|
elif any(getattr(self, key) is not None for key in ["po"]):
|
313
328
|
raise ValueError(
|
@@ -316,9 +331,18 @@ class Order(Struct, omit_defaults=True):
|
|
316
331
|
elif self.k == "TAKE_PROFIT_LIMIT":
|
317
332
|
if not all(getattr(self, key) is not None for key in ["p", "tp"]):
|
318
333
|
raise ValueError(
|
319
|
-
f"When field k (order_type) is of value TAKE_PROFIT_LIMIT, class Order requires fields ['p', 'tp']"
|
334
|
+
f"When field k (order_type) is of value TAKE_PROFIT_LIMIT, class Order requires fields ['limit_price (p)', 'trigger_price (tp)']"
|
320
335
|
)
|
321
336
|
elif any(getattr(self, key) is not None for key in ["po"]):
|
322
337
|
raise ValueError(
|
323
338
|
f"When field k (order_type) is of value TAKE_PROFIT_LIMIT, class Order should not have fields ['po']"
|
324
339
|
)
|
340
|
+
elif self.k == "BRACKET":
|
341
|
+
if not all(getattr(self, key) is not None for key in ["p", "po"]):
|
342
|
+
raise ValueError(
|
343
|
+
f"When field k (order_type) is of value BRACKET, class Order requires fields ['limit_price (p)', 'post_only (po)']"
|
344
|
+
)
|
345
|
+
elif any(getattr(self, key) is not None for key in ["tp"]):
|
346
|
+
raise ValueError(
|
347
|
+
f"When field k (order_type) is of value BRACKET, class Order should not have fields ['tp']"
|
348
|
+
)
|
@@ -46,6 +46,10 @@ class PlaceOrderRequest(Struct, omit_defaults=True):
|
|
46
46
|
p: Optional[Annotated[Decimal, Meta(title="limit_price")]] = None
|
47
47
|
po: Optional[Annotated[bool, Meta(title="post_only")]] = None
|
48
48
|
tp: Optional[Annotated[Decimal, Meta(title="trigger_price")]] = None
|
49
|
+
sl: Optional[
|
50
|
+
Annotated[Optional[definitions.TriggerLimitOrderType], Meta(title="stop_loss")]
|
51
|
+
] = None
|
52
|
+
tpp: Optional[Annotated[Optional[Decimal], Meta(title="take_profit_price")]] = None
|
49
53
|
|
50
54
|
# Constructor that takes all field titles as arguments for convenience
|
51
55
|
@classmethod
|
@@ -65,6 +69,8 @@ class PlaceOrderRequest(Struct, omit_defaults=True):
|
|
65
69
|
limit_price: Optional[Decimal] = None,
|
66
70
|
post_only: Optional[bool] = None,
|
67
71
|
trigger_price: Optional[Decimal] = None,
|
72
|
+
stop_loss: Optional[definitions.TriggerLimitOrderType] = None,
|
73
|
+
take_profit_price: Optional[Decimal] = None,
|
68
74
|
):
|
69
75
|
return cls(
|
70
76
|
dir,
|
@@ -81,10 +87,12 @@ class PlaceOrderRequest(Struct, omit_defaults=True):
|
|
81
87
|
limit_price,
|
82
88
|
post_only,
|
83
89
|
trigger_price,
|
90
|
+
stop_loss,
|
91
|
+
take_profit_price,
|
84
92
|
)
|
85
93
|
|
86
94
|
def __str__(self) -> str:
|
87
|
-
return f"PlaceOrderRequest(dir={self.d},quantity={self.q},symbol={self.s},time_in_force={self.tif},order_type={self.k},account={self.a},id={self.id},parent_id={self.pid},source={self.src},trader={self.u},execution_venue={self.x},limit_price={self.p},post_only={self.po},trigger_price={self.tp})"
|
95
|
+
return f"PlaceOrderRequest(dir={self.d},quantity={self.q},symbol={self.s},time_in_force={self.tif},order_type={self.k},account={self.a},id={self.id},parent_id={self.pid},source={self.src},trader={self.u},execution_venue={self.x},limit_price={self.p},post_only={self.po},trigger_price={self.tp},stop_loss={self.sl},take_profit_price={self.tpp})"
|
88
96
|
|
89
97
|
@property
|
90
98
|
def dir(self) -> OrderDir:
|
@@ -190,6 +198,22 @@ class PlaceOrderRequest(Struct, omit_defaults=True):
|
|
190
198
|
def trigger_price(self, value: Optional[Decimal]) -> None:
|
191
199
|
self.tp = value
|
192
200
|
|
201
|
+
@property
|
202
|
+
def stop_loss(self) -> Optional[definitions.TriggerLimitOrderType]:
|
203
|
+
return self.sl
|
204
|
+
|
205
|
+
@stop_loss.setter
|
206
|
+
def stop_loss(self, value: Optional[definitions.TriggerLimitOrderType]) -> None:
|
207
|
+
self.sl = value
|
208
|
+
|
209
|
+
@property
|
210
|
+
def take_profit_price(self) -> Optional[Decimal]:
|
211
|
+
return self.tpp
|
212
|
+
|
213
|
+
@take_profit_price.setter
|
214
|
+
def take_profit_price(self, value: Optional[Decimal]) -> None:
|
215
|
+
self.tpp = value
|
216
|
+
|
193
217
|
@staticmethod
|
194
218
|
def get_response_type():
|
195
219
|
return Order
|
@@ -207,19 +231,10 @@ class PlaceOrderRequest(Struct, omit_defaults=True):
|
|
207
231
|
return "unary"
|
208
232
|
|
209
233
|
def __post_init__(self):
|
210
|
-
if self.k == "
|
211
|
-
if not all(getattr(self, key) is not None for key in []):
|
212
|
-
raise ValueError(
|
213
|
-
f"When field k (order_type) is of value MARKET, class PlaceOrderRequest requires fields []"
|
214
|
-
)
|
215
|
-
elif any(getattr(self, key) is not None for key in ["p", "po", "tp"]):
|
216
|
-
raise ValueError(
|
217
|
-
f"When field k (order_type) is of value MARKET, class PlaceOrderRequest should not have fields ['p', 'po', 'tp']"
|
218
|
-
)
|
219
|
-
elif self.k == "LIMIT":
|
234
|
+
if self.k == "LIMIT":
|
220
235
|
if not all(getattr(self, key) is not None for key in ["p", "po"]):
|
221
236
|
raise ValueError(
|
222
|
-
f"When field k (order_type) is of value LIMIT, class PlaceOrderRequest requires fields ['p', 'po']"
|
237
|
+
f"When field k (order_type) is of value LIMIT, class PlaceOrderRequest requires fields ['limit_price (p)', 'post_only (po)']"
|
223
238
|
)
|
224
239
|
elif any(getattr(self, key) is not None for key in ["tp"]):
|
225
240
|
raise ValueError(
|
@@ -228,7 +243,7 @@ class PlaceOrderRequest(Struct, omit_defaults=True):
|
|
228
243
|
elif self.k == "STOP_LOSS_LIMIT":
|
229
244
|
if not all(getattr(self, key) is not None for key in ["p", "tp"]):
|
230
245
|
raise ValueError(
|
231
|
-
f"When field k (order_type) is of value STOP_LOSS_LIMIT, class PlaceOrderRequest requires fields ['p', 'tp']"
|
246
|
+
f"When field k (order_type) is of value STOP_LOSS_LIMIT, class PlaceOrderRequest requires fields ['limit_price (p)', 'trigger_price (tp)']"
|
232
247
|
)
|
233
248
|
elif any(getattr(self, key) is not None for key in ["po"]):
|
234
249
|
raise ValueError(
|
@@ -237,9 +252,18 @@ class PlaceOrderRequest(Struct, omit_defaults=True):
|
|
237
252
|
elif self.k == "TAKE_PROFIT_LIMIT":
|
238
253
|
if not all(getattr(self, key) is not None for key in ["p", "tp"]):
|
239
254
|
raise ValueError(
|
240
|
-
f"When field k (order_type) is of value TAKE_PROFIT_LIMIT, class PlaceOrderRequest requires fields ['p', 'tp']"
|
255
|
+
f"When field k (order_type) is of value TAKE_PROFIT_LIMIT, class PlaceOrderRequest requires fields ['limit_price (p)', 'trigger_price (tp)']"
|
241
256
|
)
|
242
257
|
elif any(getattr(self, key) is not None for key in ["po"]):
|
243
258
|
raise ValueError(
|
244
259
|
f"When field k (order_type) is of value TAKE_PROFIT_LIMIT, class PlaceOrderRequest should not have fields ['po']"
|
245
260
|
)
|
261
|
+
elif self.k == "BRACKET":
|
262
|
+
if not all(getattr(self, key) is not None for key in ["p", "po"]):
|
263
|
+
raise ValueError(
|
264
|
+
f"When field k (order_type) is of value BRACKET, class PlaceOrderRequest requires fields ['limit_price (p)', 'post_only (po)']"
|
265
|
+
)
|
266
|
+
elif any(getattr(self, key) is not None for key in ["tp"]):
|
267
|
+
raise ValueError(
|
268
|
+
f"When field k (order_type) is of value BRACKET, class PlaceOrderRequest should not have fields ['tp']"
|
269
|
+
)
|
@@ -11,6 +11,9 @@ from .Algo.StartAlgoRequest import StartAlgoRequest
|
|
11
11
|
from .Algo.StartAlgoResponse import StartAlgoResponse
|
12
12
|
from .Algo.StopAlgoRequest import StopAlgoRequest
|
13
13
|
from .Algo.StopAlgoResponse import StopAlgoResponse
|
14
|
+
from .AlgoHelper.AlgoParamTypes import AlgoParamTypes
|
15
|
+
from .Auth.AuthInfoRequest import AuthInfoRequest
|
16
|
+
from .Auth.AuthInfoResponse import AuthInfoResponse
|
14
17
|
from .Auth.CreateJwtRequest import CreateJwtRequest
|
15
18
|
from .Auth.CreateJwtResponse import CreateJwtResponse
|
16
19
|
from .Boss.DepositsRequest import DepositsRequest
|
@@ -110,4 +113,4 @@ from .Symbology.UploadProductCatalogResponse import UploadProductCatalogResponse
|
|
110
113
|
from .Symbology.UploadSymbologyRequest import UploadSymbologyRequest
|
111
114
|
from .Symbology.UploadSymbologyResponse import UploadSymbologyResponse
|
112
115
|
|
113
|
-
__all__ = ["AccountsRequest", "AccountsResponse", "AlgoOrder", "AlgoOrderRequest", "AlgoOrdersRequest", "AlgoOrdersResponse", "CreateAlgoOrderRequest", "PauseAlgoRequest", "PauseAlgoResponse", "StartAlgoRequest", "StartAlgoResponse", "StopAlgoRequest", "StopAlgoResponse", "CreateJwtRequest", "CreateJwtResponse", "DepositsRequest", "DepositsResponse", "RqdAccountStatisticsRequest", "RqdAccountStatisticsResponse", "StatementUrlRequest", "StatementUrlResponse", "StatementsRequest", "StatementsResponse", "WithdrawalsRequest", "WithdrawalsResponse", "ConfigRequest", "ConfigResponse", "RestartCptyRequest", "RestartCptyResponse", "CptyRequest", "CptyResponse", "CptyStatus", "CptyStatusRequest", "CptysRequest", "CptysResponse", "AccountHistoryRequest", "AccountHistoryResponse", "AccountSummariesRequest", "AccountSummariesResponse", "AccountSummary", "AccountSummaryRequest", "HistoricalFillsRequest", "HistoricalFillsResponse", "HistoricalOrdersRequest", "HistoricalOrdersResponse", "HealthCheckRequest", "HealthCheckResponse", "ArrayOfL1BookSnapshot", "Candle", "HistoricalCandlesRequest", "HistoricalCandlesResponse", "L1BookSnapshot", "L1BookSnapshotRequest", "L1BookSnapshotsRequest", "L2BookSnapshot", "L2BookSnapshotRequest", "L2BookUpdate", "Liquidation", "MarketStatus", "MarketStatusRequest", "SubscribeCandlesRequest", "SubscribeCurrentCandlesRequest", "SubscribeL1BookSnapshotsRequest", "SubscribeL2BookUpdatesRequest", "SubscribeLiquidationsRequest", "SubscribeManyCandlesRequest", "SubscribeTickersRequest", "SubscribeTradesRequest", "Ticker", "TickerRequest", "TickerUpdate", "TickersRequest", "TickersResponse", "Trade", "Cancel", "CancelAllOrdersRequest", "CancelAllOrdersResponse", "CancelOrderRequest", "OpenOrdersRequest", "OpenOrdersResponse", "Order", "PendingCancelsRequest", "PendingCancelsResponse", "PlaceOrderRequest", "OptionsChain", "OptionsChainGreeks", "OptionsChainGreeksRequest", "OptionsChainRequest", "OptionsExpirations", "OptionsExpirationsRequest", "Dropcopy", "DropcopyRequest", "Orderflow", "OrderflowRequest", "SubscribeOrderflowRequest", "DownloadProductCatalogRequest", "DownloadProductCatalogResponse", "ExecutionInfoRequest", "ExecutionInfoResponse", "PruneExpiredSymbolsRequest", "PruneExpiredSymbolsResponse", "SubscribeSymbology", "SymbologyRequest", "SymbologySnapshot", "SymbologyUpdate", "SymbolsRequest", "SymbolsResponse", "UploadProductCatalogRequest", "UploadProductCatalogResponse", "UploadSymbologyRequest", "UploadSymbologyResponse"]
|
116
|
+
__all__ = ["AccountsRequest", "AccountsResponse", "AlgoOrder", "AlgoOrderRequest", "AlgoOrdersRequest", "AlgoOrdersResponse", "CreateAlgoOrderRequest", "PauseAlgoRequest", "PauseAlgoResponse", "StartAlgoRequest", "StartAlgoResponse", "StopAlgoRequest", "StopAlgoResponse", "AlgoParamTypes", "AuthInfoRequest", "AuthInfoResponse", "CreateJwtRequest", "CreateJwtResponse", "DepositsRequest", "DepositsResponse", "RqdAccountStatisticsRequest", "RqdAccountStatisticsResponse", "StatementUrlRequest", "StatementUrlResponse", "StatementsRequest", "StatementsResponse", "WithdrawalsRequest", "WithdrawalsResponse", "ConfigRequest", "ConfigResponse", "RestartCptyRequest", "RestartCptyResponse", "CptyRequest", "CptyResponse", "CptyStatus", "CptyStatusRequest", "CptysRequest", "CptysResponse", "AccountHistoryRequest", "AccountHistoryResponse", "AccountSummariesRequest", "AccountSummariesResponse", "AccountSummary", "AccountSummaryRequest", "HistoricalFillsRequest", "HistoricalFillsResponse", "HistoricalOrdersRequest", "HistoricalOrdersResponse", "HealthCheckRequest", "HealthCheckResponse", "ArrayOfL1BookSnapshot", "Candle", "HistoricalCandlesRequest", "HistoricalCandlesResponse", "L1BookSnapshot", "L1BookSnapshotRequest", "L1BookSnapshotsRequest", "L2BookSnapshot", "L2BookSnapshotRequest", "L2BookUpdate", "Liquidation", "MarketStatus", "MarketStatusRequest", "SubscribeCandlesRequest", "SubscribeCurrentCandlesRequest", "SubscribeL1BookSnapshotsRequest", "SubscribeL2BookUpdatesRequest", "SubscribeLiquidationsRequest", "SubscribeManyCandlesRequest", "SubscribeTickersRequest", "SubscribeTradesRequest", "Ticker", "TickerRequest", "TickerUpdate", "TickersRequest", "TickersResponse", "Trade", "Cancel", "CancelAllOrdersRequest", "CancelAllOrdersResponse", "CancelOrderRequest", "OpenOrdersRequest", "OpenOrdersResponse", "Order", "PendingCancelsRequest", "PendingCancelsResponse", "PlaceOrderRequest", "OptionsChain", "OptionsChainGreeks", "OptionsChainGreeksRequest", "OptionsChainRequest", "OptionsExpirations", "OptionsExpirationsRequest", "Dropcopy", "DropcopyRequest", "Orderflow", "OrderflowRequest", "SubscribeOrderflowRequest", "DownloadProductCatalogRequest", "DownloadProductCatalogResponse", "ExecutionInfoRequest", "ExecutionInfoResponse", "PruneExpiredSymbolsRequest", "PruneExpiredSymbolsResponse", "SubscribeSymbology", "SymbologyRequest", "SymbologySnapshot", "SymbologyUpdate", "SymbolsRequest", "SymbolsResponse", "UploadProductCatalogRequest", "UploadProductCatalogResponse", "UploadSymbologyRequest", "UploadSymbologyResponse"]
|