architect-py 5.1.5__py3-none-any.whl → 5.2.0__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 +24 -4
- architect_py/async_client.py +66 -57
- architect_py/async_cpty.py +422 -0
- architect_py/client.pyi +2 -34
- architect_py/grpc/models/Accounts/ResetPaperAccountRequest.py +59 -0
- architect_py/grpc/models/Accounts/ResetPaperAccountResponse.py +20 -0
- architect_py/grpc/models/Boss/OptionsTransactionsRequest.py +42 -0
- architect_py/grpc/models/Boss/OptionsTransactionsResponse.py +27 -0
- architect_py/grpc/models/OptionsMarketdata/OptionsChain.py +5 -5
- architect_py/grpc/models/OptionsMarketdata/OptionsChainGreeks.py +5 -5
- architect_py/grpc/models/OptionsMarketdata/OptionsChainGreeksRequest.py +5 -1
- architect_py/grpc/models/OptionsMarketdata/OptionsChainRequest.py +5 -1
- architect_py/grpc/models/OptionsMarketdata/OptionsContract.py +45 -0
- architect_py/grpc/models/OptionsMarketdata/OptionsContractGreeksRequest.py +40 -0
- architect_py/grpc/models/OptionsMarketdata/OptionsContractRequest.py +40 -0
- architect_py/grpc/models/OptionsMarketdata/OptionsExpirations.py +4 -1
- architect_py/grpc/models/OptionsMarketdata/OptionsExpirationsRequest.py +8 -1
- architect_py/grpc/models/OptionsMarketdata/OptionsGreeks.py +58 -0
- architect_py/grpc/models/OptionsMarketdata/OptionsWraps.py +28 -0
- architect_py/grpc/models/OptionsMarketdata/OptionsWrapsRequest.py +40 -0
- architect_py/grpc/models/__init__.py +11 -1
- architect_py/grpc/models/definitions.py +37 -86
- architect_py/grpc/orderflow.py +3 -7
- architect_py/grpc/server.py +1 -3
- architect_py/tests/test_order_entry.py +120 -1
- architect_py/tests/test_positions.py +208 -17
- {architect_py-5.1.5.dist-info → architect_py-5.2.0.dist-info}/METADATA +1 -1
- {architect_py-5.1.5.dist-info → architect_py-5.2.0.dist-info}/RECORD +41 -30
- examples/external_cpty.py +72 -66
- examples/funding_rate_mean_reversion_algo.py +4 -4
- examples/order_sending.py +3 -3
- examples/orderflow_channel.py +75 -56
- examples/stream_l1_marketdata.py +3 -1
- examples/stream_l2_marketdata.py +3 -1
- examples/tutorial_async.py +3 -2
- examples/tutorial_sync.py +4 -3
- scripts/add_imports_to_inits.py +6 -2
- scripts/generate_functions_md.py +2 -1
- {architect_py-5.1.5.dist-info → architect_py-5.2.0.dist-info}/WHEEL +0 -0
- {architect_py-5.1.5.dist-info → architect_py-5.2.0.dist-info}/licenses/LICENSE +0 -0
- {architect_py-5.1.5.dist-info → architect_py-5.2.0.dist-info}/top_level.txt +0 -0
@@ -7,6 +7,7 @@ from architect_py.grpc.models.OptionsMarketdata.OptionsChainGreeks import (
|
|
7
7
|
)
|
8
8
|
|
9
9
|
from datetime import date
|
10
|
+
from typing import Optional
|
10
11
|
|
11
12
|
from msgspec import Struct
|
12
13
|
|
@@ -14,6 +15,7 @@ from msgspec import Struct
|
|
14
15
|
class OptionsChainGreeksRequest(Struct, omit_defaults=True):
|
15
16
|
expiration: date
|
16
17
|
underlying: str
|
18
|
+
wrap: Optional[str] = None
|
17
19
|
|
18
20
|
# Constructor that takes all field titles as arguments for convenience
|
19
21
|
@classmethod
|
@@ -21,14 +23,16 @@ class OptionsChainGreeksRequest(Struct, omit_defaults=True):
|
|
21
23
|
cls,
|
22
24
|
expiration: date,
|
23
25
|
underlying: str,
|
26
|
+
wrap: Optional[str] = None,
|
24
27
|
):
|
25
28
|
return cls(
|
26
29
|
expiration,
|
27
30
|
underlying,
|
31
|
+
wrap,
|
28
32
|
)
|
29
33
|
|
30
34
|
def __str__(self) -> str:
|
31
|
-
return f"OptionsChainGreeksRequest(expiration={self.expiration},underlying={self.underlying})"
|
35
|
+
return f"OptionsChainGreeksRequest(expiration={self.expiration},underlying={self.underlying},wrap={self.wrap})"
|
32
36
|
|
33
37
|
@staticmethod
|
34
38
|
def get_response_type():
|
@@ -5,6 +5,7 @@ from __future__ import annotations
|
|
5
5
|
from architect_py.grpc.models.OptionsMarketdata.OptionsChain import OptionsChain
|
6
6
|
|
7
7
|
from datetime import date
|
8
|
+
from typing import Optional
|
8
9
|
|
9
10
|
from msgspec import Struct
|
10
11
|
|
@@ -12,6 +13,7 @@ from msgspec import Struct
|
|
12
13
|
class OptionsChainRequest(Struct, omit_defaults=True):
|
13
14
|
expiration: date
|
14
15
|
underlying: str
|
16
|
+
wrap: Optional[str] = None
|
15
17
|
|
16
18
|
# Constructor that takes all field titles as arguments for convenience
|
17
19
|
@classmethod
|
@@ -19,14 +21,16 @@ class OptionsChainRequest(Struct, omit_defaults=True):
|
|
19
21
|
cls,
|
20
22
|
expiration: date,
|
21
23
|
underlying: str,
|
24
|
+
wrap: Optional[str] = None,
|
22
25
|
):
|
23
26
|
return cls(
|
24
27
|
expiration,
|
25
28
|
underlying,
|
29
|
+
wrap,
|
26
30
|
)
|
27
31
|
|
28
32
|
def __str__(self) -> str:
|
29
|
-
return f"OptionsChainRequest(expiration={self.expiration},underlying={self.underlying})"
|
33
|
+
return f"OptionsChainRequest(expiration={self.expiration},underlying={self.underlying},wrap={self.wrap})"
|
30
34
|
|
31
35
|
@staticmethod
|
32
36
|
def get_response_type():
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# generated by datamodel-codegen:
|
2
|
+
# filename: OptionsMarketdata/OptionsContract.json
|
3
|
+
|
4
|
+
from __future__ import annotations
|
5
|
+
|
6
|
+
from datetime import date
|
7
|
+
from decimal import Decimal
|
8
|
+
from typing import Optional
|
9
|
+
|
10
|
+
from msgspec import Struct
|
11
|
+
|
12
|
+
from .. import definitions
|
13
|
+
from ..Marketdata.Ticker import Ticker
|
14
|
+
|
15
|
+
|
16
|
+
class OptionsContract(Struct, omit_defaults=True):
|
17
|
+
expiration: date
|
18
|
+
put_or_call: definitions.PutOrCall
|
19
|
+
strike: Decimal
|
20
|
+
ticker: Ticker
|
21
|
+
underlying: str
|
22
|
+
in_the_money: Optional[bool] = None
|
23
|
+
|
24
|
+
# Constructor that takes all field titles as arguments for convenience
|
25
|
+
@classmethod
|
26
|
+
def new(
|
27
|
+
cls,
|
28
|
+
expiration: date,
|
29
|
+
put_or_call: definitions.PutOrCall,
|
30
|
+
strike: Decimal,
|
31
|
+
ticker: Ticker,
|
32
|
+
underlying: str,
|
33
|
+
in_the_money: Optional[bool] = None,
|
34
|
+
):
|
35
|
+
return cls(
|
36
|
+
expiration,
|
37
|
+
put_or_call,
|
38
|
+
strike,
|
39
|
+
ticker,
|
40
|
+
underlying,
|
41
|
+
in_the_money,
|
42
|
+
)
|
43
|
+
|
44
|
+
def __str__(self) -> str:
|
45
|
+
return f"OptionsContract(expiration={self.expiration},put_or_call={self.put_or_call},strike={self.strike},ticker={self.ticker},underlying={self.underlying},in_the_money={self.in_the_money})"
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# generated by datamodel-codegen:
|
2
|
+
# filename: OptionsMarketdata/OptionsContractGreeksRequest.json
|
3
|
+
|
4
|
+
from __future__ import annotations
|
5
|
+
from architect_py.grpc.models.OptionsMarketdata.OptionsGreeks import OptionsGreeks
|
6
|
+
|
7
|
+
from msgspec import Struct
|
8
|
+
|
9
|
+
|
10
|
+
class OptionsContractGreeksRequest(Struct, omit_defaults=True):
|
11
|
+
tradable_product: str
|
12
|
+
|
13
|
+
# Constructor that takes all field titles as arguments for convenience
|
14
|
+
@classmethod
|
15
|
+
def new(
|
16
|
+
cls,
|
17
|
+
tradable_product: str,
|
18
|
+
):
|
19
|
+
return cls(
|
20
|
+
tradable_product,
|
21
|
+
)
|
22
|
+
|
23
|
+
def __str__(self) -> str:
|
24
|
+
return f"OptionsContractGreeksRequest(tradable_product={self.tradable_product})"
|
25
|
+
|
26
|
+
@staticmethod
|
27
|
+
def get_response_type():
|
28
|
+
return OptionsGreeks
|
29
|
+
|
30
|
+
@staticmethod
|
31
|
+
def get_unannotated_response_type():
|
32
|
+
return OptionsGreeks
|
33
|
+
|
34
|
+
@staticmethod
|
35
|
+
def get_route() -> str:
|
36
|
+
return "/json.architect.OptionsMarketdata/OptionsContractGreeks"
|
37
|
+
|
38
|
+
@staticmethod
|
39
|
+
def get_rpc_method():
|
40
|
+
return "unary"
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# generated by datamodel-codegen:
|
2
|
+
# filename: OptionsMarketdata/OptionsContractRequest.json
|
3
|
+
|
4
|
+
from __future__ import annotations
|
5
|
+
from architect_py.grpc.models.OptionsMarketdata.OptionsContract import OptionsContract
|
6
|
+
|
7
|
+
from msgspec import Struct
|
8
|
+
|
9
|
+
|
10
|
+
class OptionsContractRequest(Struct, omit_defaults=True):
|
11
|
+
tradable_product: str
|
12
|
+
|
13
|
+
# Constructor that takes all field titles as arguments for convenience
|
14
|
+
@classmethod
|
15
|
+
def new(
|
16
|
+
cls,
|
17
|
+
tradable_product: str,
|
18
|
+
):
|
19
|
+
return cls(
|
20
|
+
tradable_product,
|
21
|
+
)
|
22
|
+
|
23
|
+
def __str__(self) -> str:
|
24
|
+
return f"OptionsContractRequest(tradable_product={self.tradable_product})"
|
25
|
+
|
26
|
+
@staticmethod
|
27
|
+
def get_response_type():
|
28
|
+
return OptionsContract
|
29
|
+
|
30
|
+
@staticmethod
|
31
|
+
def get_unannotated_response_type():
|
32
|
+
return OptionsContract
|
33
|
+
|
34
|
+
@staticmethod
|
35
|
+
def get_route() -> str:
|
36
|
+
return "/json.architect.OptionsMarketdata/OptionsContract"
|
37
|
+
|
38
|
+
@staticmethod
|
39
|
+
def get_rpc_method():
|
40
|
+
return "unary"
|
@@ -12,6 +12,7 @@ from msgspec import Struct
|
|
12
12
|
class OptionsExpirations(Struct, omit_defaults=True):
|
13
13
|
expirations: List[date]
|
14
14
|
underlying: str
|
15
|
+
wrap: str
|
15
16
|
|
16
17
|
# Constructor that takes all field titles as arguments for convenience
|
17
18
|
@classmethod
|
@@ -19,11 +20,13 @@ class OptionsExpirations(Struct, omit_defaults=True):
|
|
19
20
|
cls,
|
20
21
|
expirations: List[date],
|
21
22
|
underlying: str,
|
23
|
+
wrap: str,
|
22
24
|
):
|
23
25
|
return cls(
|
24
26
|
expirations,
|
25
27
|
underlying,
|
28
|
+
wrap,
|
26
29
|
)
|
27
30
|
|
28
31
|
def __str__(self) -> str:
|
29
|
-
return f"OptionsExpirations(expirations={self.expirations},underlying={self.underlying})"
|
32
|
+
return f"OptionsExpirations(expirations={self.expirations},underlying={self.underlying},wrap={self.wrap})"
|
@@ -6,24 +6,31 @@ from architect_py.grpc.models.OptionsMarketdata.OptionsExpirations import (
|
|
6
6
|
OptionsExpirations,
|
7
7
|
)
|
8
8
|
|
9
|
+
from typing import Optional
|
10
|
+
|
9
11
|
from msgspec import Struct
|
10
12
|
|
11
13
|
|
12
14
|
class OptionsExpirationsRequest(Struct, omit_defaults=True):
|
13
15
|
underlying: str
|
16
|
+
wrap: Optional[str] = None
|
14
17
|
|
15
18
|
# Constructor that takes all field titles as arguments for convenience
|
16
19
|
@classmethod
|
17
20
|
def new(
|
18
21
|
cls,
|
19
22
|
underlying: str,
|
23
|
+
wrap: Optional[str] = None,
|
20
24
|
):
|
21
25
|
return cls(
|
22
26
|
underlying,
|
27
|
+
wrap,
|
23
28
|
)
|
24
29
|
|
25
30
|
def __str__(self) -> str:
|
26
|
-
return
|
31
|
+
return (
|
32
|
+
f"OptionsExpirationsRequest(underlying={self.underlying},wrap={self.wrap})"
|
33
|
+
)
|
27
34
|
|
28
35
|
@staticmethod
|
29
36
|
def get_response_type():
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# generated by datamodel-codegen:
|
2
|
+
# filename: OptionsMarketdata/OptionsGreeks.json
|
3
|
+
|
4
|
+
from __future__ import annotations
|
5
|
+
|
6
|
+
from datetime import date
|
7
|
+
from decimal import Decimal
|
8
|
+
|
9
|
+
from msgspec import Struct
|
10
|
+
|
11
|
+
from .. import definitions
|
12
|
+
|
13
|
+
|
14
|
+
class OptionsGreeks(Struct, omit_defaults=True):
|
15
|
+
delta: Decimal
|
16
|
+
expiration: date
|
17
|
+
gamma: Decimal
|
18
|
+
implied_volatility: Decimal
|
19
|
+
put_or_call: definitions.PutOrCall
|
20
|
+
rho: Decimal
|
21
|
+
strike: Decimal
|
22
|
+
symbol: str
|
23
|
+
theta: Decimal
|
24
|
+
underlying: str
|
25
|
+
vega: Decimal
|
26
|
+
|
27
|
+
# Constructor that takes all field titles as arguments for convenience
|
28
|
+
@classmethod
|
29
|
+
def new(
|
30
|
+
cls,
|
31
|
+
delta: Decimal,
|
32
|
+
expiration: date,
|
33
|
+
gamma: Decimal,
|
34
|
+
implied_volatility: Decimal,
|
35
|
+
put_or_call: definitions.PutOrCall,
|
36
|
+
rho: Decimal,
|
37
|
+
strike: Decimal,
|
38
|
+
symbol: str,
|
39
|
+
theta: Decimal,
|
40
|
+
underlying: str,
|
41
|
+
vega: Decimal,
|
42
|
+
):
|
43
|
+
return cls(
|
44
|
+
delta,
|
45
|
+
expiration,
|
46
|
+
gamma,
|
47
|
+
implied_volatility,
|
48
|
+
put_or_call,
|
49
|
+
rho,
|
50
|
+
strike,
|
51
|
+
symbol,
|
52
|
+
theta,
|
53
|
+
underlying,
|
54
|
+
vega,
|
55
|
+
)
|
56
|
+
|
57
|
+
def __str__(self) -> str:
|
58
|
+
return f"OptionsGreeks(delta={self.delta},expiration={self.expiration},gamma={self.gamma},implied_volatility={self.implied_volatility},put_or_call={self.put_or_call},rho={self.rho},strike={self.strike},symbol={self.symbol},theta={self.theta},underlying={self.underlying},vega={self.vega})"
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# generated by datamodel-codegen:
|
2
|
+
# filename: OptionsMarketdata/OptionsWraps.json
|
3
|
+
|
4
|
+
from __future__ import annotations
|
5
|
+
|
6
|
+
from typing import List
|
7
|
+
|
8
|
+
from msgspec import Struct
|
9
|
+
|
10
|
+
|
11
|
+
class OptionsWraps(Struct, omit_defaults=True):
|
12
|
+
underlying: str
|
13
|
+
wraps: List[str]
|
14
|
+
|
15
|
+
# Constructor that takes all field titles as arguments for convenience
|
16
|
+
@classmethod
|
17
|
+
def new(
|
18
|
+
cls,
|
19
|
+
underlying: str,
|
20
|
+
wraps: List[str],
|
21
|
+
):
|
22
|
+
return cls(
|
23
|
+
underlying,
|
24
|
+
wraps,
|
25
|
+
)
|
26
|
+
|
27
|
+
def __str__(self) -> str:
|
28
|
+
return f"OptionsWraps(underlying={self.underlying},wraps={self.wraps})"
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# generated by datamodel-codegen:
|
2
|
+
# filename: OptionsMarketdata/OptionsWrapsRequest.json
|
3
|
+
|
4
|
+
from __future__ import annotations
|
5
|
+
from architect_py.grpc.models.OptionsMarketdata.OptionsWraps import OptionsWraps
|
6
|
+
|
7
|
+
from msgspec import Struct
|
8
|
+
|
9
|
+
|
10
|
+
class OptionsWrapsRequest(Struct, omit_defaults=True):
|
11
|
+
underlying: str
|
12
|
+
|
13
|
+
# Constructor that takes all field titles as arguments for convenience
|
14
|
+
@classmethod
|
15
|
+
def new(
|
16
|
+
cls,
|
17
|
+
underlying: str,
|
18
|
+
):
|
19
|
+
return cls(
|
20
|
+
underlying,
|
21
|
+
)
|
22
|
+
|
23
|
+
def __str__(self) -> str:
|
24
|
+
return f"OptionsWrapsRequest(underlying={self.underlying})"
|
25
|
+
|
26
|
+
@staticmethod
|
27
|
+
def get_response_type():
|
28
|
+
return OptionsWraps
|
29
|
+
|
30
|
+
@staticmethod
|
31
|
+
def get_unannotated_response_type():
|
32
|
+
return OptionsWraps
|
33
|
+
|
34
|
+
@staticmethod
|
35
|
+
def get_route() -> str:
|
36
|
+
return "/json.architect.OptionsMarketdata/OptionsWraps"
|
37
|
+
|
38
|
+
@staticmethod
|
39
|
+
def get_rpc_method():
|
40
|
+
return "unary"
|
@@ -1,5 +1,7 @@
|
|
1
1
|
from .Accounts.AccountsRequest import AccountsRequest
|
2
2
|
from .Accounts.AccountsResponse import AccountsResponse
|
3
|
+
from .Accounts.ResetPaperAccountRequest import ResetPaperAccountRequest
|
4
|
+
from .Accounts.ResetPaperAccountResponse import ResetPaperAccountResponse
|
3
5
|
from .Algo.AlgoOrder import AlgoOrder
|
4
6
|
from .Algo.AlgoOrderRequest import AlgoOrderRequest
|
5
7
|
from .Algo.AlgoOrdersRequest import AlgoOrdersRequest
|
@@ -18,6 +20,8 @@ from .Auth.CreateJwtRequest import CreateJwtRequest
|
|
18
20
|
from .Auth.CreateJwtResponse import CreateJwtResponse
|
19
21
|
from .Boss.DepositsRequest import DepositsRequest
|
20
22
|
from .Boss.DepositsResponse import DepositsResponse
|
23
|
+
from .Boss.OptionsTransactionsRequest import OptionsTransactionsRequest
|
24
|
+
from .Boss.OptionsTransactionsResponse import OptionsTransactionsResponse
|
21
25
|
from .Boss.RqdAccountStatisticsRequest import RqdAccountStatisticsRequest
|
22
26
|
from .Boss.RqdAccountStatisticsResponse import RqdAccountStatisticsResponse
|
23
27
|
from .Boss.StatementUrlRequest import StatementUrlRequest
|
@@ -89,8 +93,14 @@ from .OptionsMarketdata.OptionsChain import OptionsChain
|
|
89
93
|
from .OptionsMarketdata.OptionsChainGreeks import OptionsChainGreeks
|
90
94
|
from .OptionsMarketdata.OptionsChainGreeksRequest import OptionsChainGreeksRequest
|
91
95
|
from .OptionsMarketdata.OptionsChainRequest import OptionsChainRequest
|
96
|
+
from .OptionsMarketdata.OptionsContract import OptionsContract
|
97
|
+
from .OptionsMarketdata.OptionsContractGreeksRequest import OptionsContractGreeksRequest
|
98
|
+
from .OptionsMarketdata.OptionsContractRequest import OptionsContractRequest
|
92
99
|
from .OptionsMarketdata.OptionsExpirations import OptionsExpirations
|
93
100
|
from .OptionsMarketdata.OptionsExpirationsRequest import OptionsExpirationsRequest
|
101
|
+
from .OptionsMarketdata.OptionsGreeks import OptionsGreeks
|
102
|
+
from .OptionsMarketdata.OptionsWraps import OptionsWraps
|
103
|
+
from .OptionsMarketdata.OptionsWrapsRequest import OptionsWrapsRequest
|
94
104
|
from .Orderflow.Dropcopy import Dropcopy
|
95
105
|
from .Orderflow.DropcopyRequest import DropcopyRequest
|
96
106
|
from .Orderflow.Orderflow import Orderflow
|
@@ -113,4 +123,4 @@ from .Symbology.UploadProductCatalogResponse import UploadProductCatalogResponse
|
|
113
123
|
from .Symbology.UploadSymbologyRequest import UploadSymbologyRequest
|
114
124
|
from .Symbology.UploadSymbologyResponse import UploadSymbologyResponse
|
115
125
|
|
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"]
|
126
|
+
__all__ = ["AccountsRequest", "AccountsResponse", "ResetPaperAccountRequest", "ResetPaperAccountResponse", "AlgoOrder", "AlgoOrderRequest", "AlgoOrdersRequest", "AlgoOrdersResponse", "CreateAlgoOrderRequest", "PauseAlgoRequest", "PauseAlgoResponse", "StartAlgoRequest", "StartAlgoResponse", "StopAlgoRequest", "StopAlgoResponse", "AlgoParamTypes", "AuthInfoRequest", "AuthInfoResponse", "CreateJwtRequest", "CreateJwtResponse", "DepositsRequest", "DepositsResponse", "OptionsTransactionsRequest", "OptionsTransactionsResponse", "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", "OptionsContract", "OptionsContractGreeksRequest", "OptionsContractRequest", "OptionsExpirations", "OptionsExpirationsRequest", "OptionsGreeks", "OptionsWraps", "OptionsWrapsRequest", "Dropcopy", "DropcopyRequest", "Orderflow", "OrderflowRequest", "SubscribeOrderflowRequest", "DownloadProductCatalogRequest", "DownloadProductCatalogResponse", "ExecutionInfoRequest", "ExecutionInfoResponse", "PruneExpiredSymbolsRequest", "PruneExpiredSymbolsResponse", "SubscribeSymbology", "SymbologyRequest", "SymbologySnapshot", "SymbologyUpdate", "SymbolsRequest", "SymbolsResponse", "UploadProductCatalogRequest", "UploadProductCatalogResponse", "UploadSymbologyRequest", "UploadSymbologyResponse"]
|
@@ -12,8 +12,6 @@ from typing import Annotated, Dict, List, Literal, Optional, Union
|
|
12
12
|
|
13
13
|
from msgspec import Meta, Struct
|
14
14
|
|
15
|
-
from .Marketdata.Ticker import Ticker
|
16
|
-
|
17
15
|
|
18
16
|
class AccountHistoryGranularity(str, Enum):
|
19
17
|
FiveMinutes = "FiveMinutes"
|
@@ -435,6 +433,38 @@ class L2BookDiff(Struct, omit_defaults=True):
|
|
435
433
|
return datetime.fromtimestamp(self.ts)
|
436
434
|
|
437
435
|
|
436
|
+
class OptionsTransaction(Struct, omit_defaults=True):
|
437
|
+
clearing_firm_account: str
|
438
|
+
quantity: Decimal
|
439
|
+
timestamp: datetime
|
440
|
+
tradable_product: str
|
441
|
+
transaction_type: str
|
442
|
+
price: Optional[Decimal] = None
|
443
|
+
|
444
|
+
# Constructor that takes all field titles as arguments for convenience
|
445
|
+
@classmethod
|
446
|
+
def new(
|
447
|
+
cls,
|
448
|
+
clearing_firm_account: str,
|
449
|
+
quantity: Decimal,
|
450
|
+
timestamp: datetime,
|
451
|
+
tradable_product: str,
|
452
|
+
transaction_type: str,
|
453
|
+
price: Optional[Decimal] = None,
|
454
|
+
):
|
455
|
+
return cls(
|
456
|
+
clearing_firm_account,
|
457
|
+
quantity,
|
458
|
+
timestamp,
|
459
|
+
tradable_product,
|
460
|
+
transaction_type,
|
461
|
+
price,
|
462
|
+
)
|
463
|
+
|
464
|
+
def __str__(self) -> str:
|
465
|
+
return f"OptionsTransaction(clearing_firm_account={self.clearing_firm_account},quantity={self.quantity},timestamp={self.timestamp},tradable_product={self.tradable_product},transaction_type={self.transaction_type},price={self.price})"
|
466
|
+
|
467
|
+
|
438
468
|
OrderId = Annotated[
|
439
469
|
str, Meta(description="System-unique, persistent order identifiers")
|
440
470
|
]
|
@@ -604,6 +634,11 @@ class ProductCatalogInfo(Struct, omit_defaults=True):
|
|
604
634
|
return f"ProductCatalogInfo(exchange={self.exchange},exchange_product={self.exchange_product},category={self.category},cqg_contract_symbol={self.cqg_contract_symbol},info_url={self.info_url},long_description={self.long_description},multiplier={self.multiplier},price_display_format={self.price_display_format},quote_currency={self.quote_currency},schedule_description={self.schedule_description},settle_method={self.settle_method},short_description={self.short_description},sub_category={self.sub_category})"
|
605
635
|
|
606
636
|
|
637
|
+
class PutOrCall(str, Enum):
|
638
|
+
P = "P"
|
639
|
+
C = "C"
|
640
|
+
|
641
|
+
|
607
642
|
class RqdAccountStatistics(Struct, omit_defaults=True):
|
608
643
|
account_number: str
|
609
644
|
account_type: Optional[str] = None
|
@@ -1120,11 +1155,6 @@ class Unknown(Struct, omit_defaults=True):
|
|
1120
1155
|
return f"Unknown(product_type={self.product_type})"
|
1121
1156
|
|
1122
1157
|
|
1123
|
-
class PutOrCall(str, Enum):
|
1124
|
-
P = "P"
|
1125
|
-
C = "C"
|
1126
|
-
|
1127
|
-
|
1128
1158
|
class SnapshotOrUpdateForStringAndProductCatalogInfo1(Struct, omit_defaults=True):
|
1129
1159
|
snapshot: Dict[str, ProductCatalogInfo]
|
1130
1160
|
|
@@ -1955,85 +1985,6 @@ class Fill(Struct, omit_defaults=True):
|
|
1955
1985
|
self.xid = value
|
1956
1986
|
|
1957
1987
|
|
1958
|
-
class OptionsContract(Struct, omit_defaults=True):
|
1959
|
-
expiration: date
|
1960
|
-
put_or_call: PutOrCall
|
1961
|
-
strike: Decimal
|
1962
|
-
ticker: Ticker
|
1963
|
-
underlying: str
|
1964
|
-
in_the_money: Optional[bool] = None
|
1965
|
-
|
1966
|
-
# Constructor that takes all field titles as arguments for convenience
|
1967
|
-
@classmethod
|
1968
|
-
def new(
|
1969
|
-
cls,
|
1970
|
-
expiration: date,
|
1971
|
-
put_or_call: PutOrCall,
|
1972
|
-
strike: Decimal,
|
1973
|
-
ticker: Ticker,
|
1974
|
-
underlying: str,
|
1975
|
-
in_the_money: Optional[bool] = None,
|
1976
|
-
):
|
1977
|
-
return cls(
|
1978
|
-
expiration,
|
1979
|
-
put_or_call,
|
1980
|
-
strike,
|
1981
|
-
ticker,
|
1982
|
-
underlying,
|
1983
|
-
in_the_money,
|
1984
|
-
)
|
1985
|
-
|
1986
|
-
def __str__(self) -> str:
|
1987
|
-
return f"OptionsContract(expiration={self.expiration},put_or_call={self.put_or_call},strike={self.strike},ticker={self.ticker},underlying={self.underlying},in_the_money={self.in_the_money})"
|
1988
|
-
|
1989
|
-
|
1990
|
-
class OptionsGreeks(Struct, omit_defaults=True):
|
1991
|
-
delta: Decimal
|
1992
|
-
expiration: date
|
1993
|
-
gamma: Decimal
|
1994
|
-
implied_volatility: Decimal
|
1995
|
-
put_or_call: PutOrCall
|
1996
|
-
rho: Decimal
|
1997
|
-
strike: Decimal
|
1998
|
-
symbol: str
|
1999
|
-
theta: Decimal
|
2000
|
-
underlying: str
|
2001
|
-
vega: Decimal
|
2002
|
-
|
2003
|
-
# Constructor that takes all field titles as arguments for convenience
|
2004
|
-
@classmethod
|
2005
|
-
def new(
|
2006
|
-
cls,
|
2007
|
-
delta: Decimal,
|
2008
|
-
expiration: date,
|
2009
|
-
gamma: Decimal,
|
2010
|
-
implied_volatility: Decimal,
|
2011
|
-
put_or_call: PutOrCall,
|
2012
|
-
rho: Decimal,
|
2013
|
-
strike: Decimal,
|
2014
|
-
symbol: str,
|
2015
|
-
theta: Decimal,
|
2016
|
-
underlying: str,
|
2017
|
-
vega: Decimal,
|
2018
|
-
):
|
2019
|
-
return cls(
|
2020
|
-
delta,
|
2021
|
-
expiration,
|
2022
|
-
gamma,
|
2023
|
-
implied_volatility,
|
2024
|
-
put_or_call,
|
2025
|
-
rho,
|
2026
|
-
strike,
|
2027
|
-
symbol,
|
2028
|
-
theta,
|
2029
|
-
underlying,
|
2030
|
-
vega,
|
2031
|
-
)
|
2032
|
-
|
2033
|
-
def __str__(self) -> str:
|
2034
|
-
return f"OptionsGreeks(delta={self.delta},expiration={self.expiration},gamma={self.gamma},implied_volatility={self.implied_volatility},put_or_call={self.put_or_call},rho={self.rho},strike={self.strike},symbol={self.symbol},theta={self.theta},underlying={self.underlying},vega={self.vega})"
|
2035
|
-
|
2036
|
-
|
2037
1988
|
class OptionsSeriesInfo(Struct, omit_defaults=True):
|
2038
1989
|
derivative_kind: DerivativeKind
|
2039
1990
|
exercise_type: OptionsExerciseType
|
architect_py/grpc/orderflow.py
CHANGED
@@ -4,12 +4,8 @@ from typing import TYPE_CHECKING, Any, AsyncGenerator, AsyncIterator, Optional,
|
|
4
4
|
|
5
5
|
import grpc.aio
|
6
6
|
|
7
|
-
from architect_py.grpc.models.Orderflow.Orderflow import
|
8
|
-
from architect_py.grpc.models.Orderflow.OrderflowRequest import
|
9
|
-
OrderflowRequest,
|
10
|
-
OrderflowRequest_route,
|
11
|
-
OrderflowRequestUnannotatedResponseType,
|
12
|
-
)
|
7
|
+
from architect_py.grpc.models.Orderflow.Orderflow import *
|
8
|
+
from architect_py.grpc.models.Orderflow.OrderflowRequest import *
|
13
9
|
|
14
10
|
if TYPE_CHECKING:
|
15
11
|
from architect_py.async_client import AsyncClient
|
@@ -120,7 +116,7 @@ class OrderflowChannel:
|
|
120
116
|
self, request_iterator: AsyncIterator[OrderflowRequest]
|
121
117
|
) -> AsyncGenerator[Orderflow, None]:
|
122
118
|
"""Low-level wrapper around Architect’s gRPC bidirectional stream."""
|
123
|
-
grpc_client = await self._client.
|
119
|
+
grpc_client = await self._client._core()
|
124
120
|
decoder = grpc_client.get_decoder(OrderflowRequestUnannotatedResponseType)
|
125
121
|
|
126
122
|
stub: grpc.aio.StreamStreamMultiCallable = grpc_client.channel.stream_stream(
|
architect_py/grpc/server.py
CHANGED
@@ -41,9 +41,7 @@ class OrderflowServicer(object):
|
|
41
41
|
|
42
42
|
|
43
43
|
def add_OrderflowServicer_to_server(servicer, server):
|
44
|
-
decoder = msgspec.json.Decoder(
|
45
|
-
type=SubscribeOrderflowRequest.get_unannotated_response_type()
|
46
|
-
)
|
44
|
+
decoder = msgspec.json.Decoder(type=SubscribeOrderflowRequest)
|
47
45
|
rpc_method_handlers = {
|
48
46
|
"SubscribeOrderflow": grpc.unary_stream_rpc_method_handler(
|
49
47
|
servicer.SubscribeOrderflow,
|