architect-py 5.0.0b3__py3-none-any.whl → 5.1.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.
Files changed (75) hide show
  1. architect_py/__init__.py +432 -5
  2. architect_py/async_client.py +77 -43
  3. architect_py/client.py +11 -4
  4. architect_py/client.pyi +504 -0
  5. architect_py/common_types/__init__.py +2 -1
  6. architect_py/common_types/time_in_force.py +94 -0
  7. architect_py/common_types/tradable_product.py +9 -0
  8. architect_py/graphql_client/__init__.py +1 -216
  9. architect_py/graphql_client/client.py +2 -1043
  10. architect_py/graphql_client/enums.py +0 -72
  11. architect_py/graphql_client/fragments.py +4 -152
  12. architect_py/grpc/__init__.py +0 -143
  13. architect_py/grpc/client.py +6 -1
  14. architect_py/grpc/models/Core/RestartCptyRequest.py +40 -0
  15. architect_py/grpc/models/Core/RestartCptyResponse.py +20 -0
  16. architect_py/grpc/models/Marketdata/Liquidation.py +0 -1
  17. architect_py/grpc/models/Marketdata/Ticker.py +14 -1
  18. architect_py/grpc/models/Marketdata/TickersRequest.py +38 -12
  19. architect_py/grpc/models/Marketdata/Trade.py +0 -1
  20. architect_py/grpc/models/Oms/Order.py +33 -24
  21. architect_py/grpc/models/Oms/PlaceOrderRequest.py +33 -24
  22. architect_py/grpc/models/__init__.py +113 -2
  23. architect_py/grpc/models/definitions.py +2 -32
  24. architect_py/grpc/utils.py +1 -4
  25. architect_py/tests/test_order_entry.py +2 -3
  26. architect_py/tests/test_orderflow.py +1 -1
  27. architect_py/utils/pandas.py +4 -3
  28. architect_py-5.1.0.dist-info/METADATA +66 -0
  29. {architect_py-5.0.0b3.dist-info → architect_py-5.1.0.dist-info}/RECORD +48 -67
  30. {architect_py-5.0.0b3.dist-info → architect_py-5.1.0.dist-info}/WHEEL +1 -1
  31. examples/book_subscription.py +1 -2
  32. examples/candles.py +1 -3
  33. examples/common.py +1 -2
  34. examples/external_cpty.py +2 -2
  35. examples/funding_rate_mean_reversion_algo.py +9 -6
  36. examples/order_sending.py +29 -9
  37. examples/stream_l1_marketdata.py +1 -2
  38. examples/stream_l2_marketdata.py +1 -2
  39. examples/trades.py +1 -2
  40. examples/tutorial_async.py +6 -8
  41. examples/tutorial_sync.py +6 -7
  42. scripts/add_imports_to_inits.py +146 -0
  43. scripts/correct_sync_interface.py +143 -0
  44. scripts/postprocess_grpc.py +57 -11
  45. scripts/preprocess_grpc_schema.py +2 -0
  46. scripts/prune_graphql_schema.py +187 -0
  47. architect_py/client_interface.py +0 -63
  48. architect_py/common_types/scalars.py +0 -25
  49. architect_py/graphql_client/cancel_all_orders_mutation.py +0 -17
  50. architect_py/graphql_client/cancel_order_mutation.py +0 -23
  51. architect_py/graphql_client/create_jwt.py +0 -17
  52. architect_py/graphql_client/get_account_history_query.py +0 -27
  53. architect_py/graphql_client/get_account_query.py +0 -23
  54. architect_py/graphql_client/get_account_summaries_query.py +0 -27
  55. architect_py/graphql_client/get_account_summary_query.py +0 -25
  56. architect_py/graphql_client/get_candle_snapshot_query.py +0 -27
  57. architect_py/graphql_client/get_fills_query.py +0 -69
  58. architect_py/graphql_client/get_historical_orders_query.py +0 -27
  59. architect_py/graphql_client/get_l_1_book_snapshot_query.py +0 -21
  60. architect_py/graphql_client/get_l_1_book_snapshots_query.py +0 -23
  61. architect_py/graphql_client/get_l_2_book_snapshot_query.py +0 -25
  62. architect_py/graphql_client/get_market_status_query.py +0 -25
  63. architect_py/graphql_client/get_open_orders_query.py +0 -25
  64. architect_py/graphql_client/list_accounts_query.py +0 -23
  65. architect_py/graphql_client/place_order_mutation.py +0 -23
  66. architect_py/graphql_client/subscribe_candles.py +0 -16
  67. architect_py/graphql_client/subscribe_orderflow.py +0 -100
  68. architect_py/graphql_client/subscribe_trades.py +0 -27
  69. architect_py/graphql_client/user_email_query.py +0 -17
  70. architect_py/internal_utils/__init__.py +0 -0
  71. architect_py/internal_utils/no_pandas.py +0 -3
  72. architect_py-5.0.0b3.dist-info/METADATA +0 -123
  73. scripts/generate_sync_interface.py +0 -226
  74. {architect_py-5.0.0b3.dist-info → architect_py-5.1.0.dist-info}/licenses/LICENSE +0 -0
  75. {architect_py-5.0.0b3.dist-info → architect_py-5.1.0.dist-info}/top_level.txt +0 -0
@@ -1,25 +0,0 @@
1
- # Generated by ariadne-codegen
2
- # Source: queries.graphql
3
-
4
- from pydantic import Field
5
-
6
- from .base_model import BaseModel
7
- from .fragments import AccountSummaryFields
8
-
9
-
10
- class GetAccountSummaryQuery(BaseModel):
11
- folio: "GetAccountSummaryQueryFolio"
12
-
13
-
14
- class GetAccountSummaryQueryFolio(BaseModel):
15
- account_summary: "GetAccountSummaryQueryFolioAccountSummary" = Field(
16
- alias="accountSummary"
17
- )
18
-
19
-
20
- class GetAccountSummaryQueryFolioAccountSummary(AccountSummaryFields):
21
- pass
22
-
23
-
24
- GetAccountSummaryQuery.model_rebuild()
25
- GetAccountSummaryQueryFolio.model_rebuild()
@@ -1,27 +0,0 @@
1
- # Generated by ariadne-codegen
2
- # Source: queries.graphql
3
-
4
- from typing import List
5
-
6
- from pydantic import Field
7
-
8
- from .base_model import BaseModel
9
- from .fragments import CandleFields
10
-
11
-
12
- class GetCandleSnapshotQuery(BaseModel):
13
- marketdata: "GetCandleSnapshotQueryMarketdata"
14
-
15
-
16
- class GetCandleSnapshotQueryMarketdata(BaseModel):
17
- historical_candles: List["GetCandleSnapshotQueryMarketdataHistoricalCandles"] = (
18
- Field(alias="historicalCandles")
19
- )
20
-
21
-
22
- class GetCandleSnapshotQueryMarketdataHistoricalCandles(CandleFields):
23
- pass
24
-
25
-
26
- GetCandleSnapshotQuery.model_rebuild()
27
- GetCandleSnapshotQueryMarketdata.model_rebuild()
@@ -1,69 +0,0 @@
1
- # Generated by ariadne-codegen
2
- # Source: queries.graphql
3
-
4
- from datetime import datetime
5
- from decimal import Decimal
6
- from typing import Annotated, List, Optional
7
- from uuid import UUID
8
-
9
- from pydantic import BeforeValidator, Field
10
-
11
- from architect_py.common_types import OrderDir
12
- from architect_py.common_types.order_dir import graphql_parse_order_dir
13
-
14
- from .base_model import BaseModel
15
- from .enums import FillKind
16
-
17
-
18
- class GetFillsQuery(BaseModel):
19
- folio: "GetFillsQueryFolio"
20
-
21
-
22
- class GetFillsQueryFolio(BaseModel):
23
- historical_fills: "GetFillsQueryFolioHistoricalFills" = Field(
24
- alias="historicalFills"
25
- )
26
-
27
-
28
- class GetFillsQueryFolioHistoricalFills(BaseModel):
29
- fills: List["GetFillsQueryFolioHistoricalFillsFills"]
30
- aberrant_fills: List["GetFillsQueryFolioHistoricalFillsAberrantFills"] = Field(
31
- alias="aberrantFills"
32
- )
33
-
34
-
35
- class GetFillsQueryFolioHistoricalFillsFills(BaseModel):
36
- fill_id: UUID = Field(alias="fillId")
37
- fill_kind: FillKind = Field(alias="fillKind")
38
- execution_venue: str = Field(alias="executionVenue")
39
- exchange_fill_id: Optional[str] = Field(alias="exchangeFillId")
40
- order_id: Optional[str] = Field(alias="orderId")
41
- trader: Optional[str]
42
- account: Optional[UUID]
43
- symbol: str
44
- dir: Annotated[OrderDir, BeforeValidator(graphql_parse_order_dir)]
45
- quantity: Decimal
46
- price: Decimal
47
- recv_time: Optional[datetime] = Field(alias="recvTime")
48
- trade_time: Optional[datetime] = Field(alias="tradeTime")
49
-
50
-
51
- class GetFillsQueryFolioHistoricalFillsAberrantFills(BaseModel):
52
- fill_id: UUID = Field(alias="fillId")
53
- fill_kind: Optional[FillKind] = Field(alias="fillKind")
54
- execution_venue: str = Field(alias="executionVenue")
55
- exchange_fill_id: Optional[str] = Field(alias="exchangeFillId")
56
- order_id: Optional[str] = Field(alias="orderId")
57
- trader: Optional[str]
58
- account: Optional[UUID]
59
- symbol: Optional[str]
60
- dir: Optional[Annotated[OrderDir, BeforeValidator(graphql_parse_order_dir)]]
61
- quantity: Optional[Decimal]
62
- price: Optional[Decimal]
63
- recv_time: Optional[datetime] = Field(alias="recvTime")
64
- trade_time: Optional[datetime] = Field(alias="tradeTime")
65
-
66
-
67
- GetFillsQuery.model_rebuild()
68
- GetFillsQueryFolio.model_rebuild()
69
- GetFillsQueryFolioHistoricalFills.model_rebuild()
@@ -1,27 +0,0 @@
1
- # Generated by ariadne-codegen
2
- # Source: queries.graphql
3
-
4
- from typing import List
5
-
6
- from pydantic import Field
7
-
8
- from .base_model import BaseModel
9
- from .fragments import OrderFields
10
-
11
-
12
- class GetHistoricalOrdersQuery(BaseModel):
13
- folio: "GetHistoricalOrdersQueryFolio"
14
-
15
-
16
- class GetHistoricalOrdersQueryFolio(BaseModel):
17
- historical_orders: List["GetHistoricalOrdersQueryFolioHistoricalOrders"] = Field(
18
- alias="historicalOrders"
19
- )
20
-
21
-
22
- class GetHistoricalOrdersQueryFolioHistoricalOrders(OrderFields):
23
- pass
24
-
25
-
26
- GetHistoricalOrdersQuery.model_rebuild()
27
- GetHistoricalOrdersQueryFolio.model_rebuild()
@@ -1,21 +0,0 @@
1
- # Generated by ariadne-codegen
2
- # Source: queries.graphql
3
-
4
- from .base_model import BaseModel
5
- from .fragments import MarketTickerFields
6
-
7
-
8
- class GetL1BookSnapshotQuery(BaseModel):
9
- marketdata: "GetL1BookSnapshotQueryMarketdata"
10
-
11
-
12
- class GetL1BookSnapshotQueryMarketdata(BaseModel):
13
- ticker: "GetL1BookSnapshotQueryMarketdataTicker"
14
-
15
-
16
- class GetL1BookSnapshotQueryMarketdataTicker(MarketTickerFields):
17
- pass
18
-
19
-
20
- GetL1BookSnapshotQuery.model_rebuild()
21
- GetL1BookSnapshotQueryMarketdata.model_rebuild()
@@ -1,23 +0,0 @@
1
- # Generated by ariadne-codegen
2
- # Source: queries.graphql
3
-
4
- from typing import List
5
-
6
- from .base_model import BaseModel
7
- from .fragments import MarketTickerFields
8
-
9
-
10
- class GetL1BookSnapshotsQuery(BaseModel):
11
- marketdata: "GetL1BookSnapshotsQueryMarketdata"
12
-
13
-
14
- class GetL1BookSnapshotsQueryMarketdata(BaseModel):
15
- tickers: List["GetL1BookSnapshotsQueryMarketdataTickers"]
16
-
17
-
18
- class GetL1BookSnapshotsQueryMarketdataTickers(MarketTickerFields):
19
- pass
20
-
21
-
22
- GetL1BookSnapshotsQuery.model_rebuild()
23
- GetL1BookSnapshotsQueryMarketdata.model_rebuild()
@@ -1,25 +0,0 @@
1
- # Generated by ariadne-codegen
2
- # Source: queries.graphql
3
-
4
- from pydantic import Field
5
-
6
- from .base_model import BaseModel
7
- from .fragments import L2BookFields
8
-
9
-
10
- class GetL2BookSnapshotQuery(BaseModel):
11
- marketdata: "GetL2BookSnapshotQueryMarketdata"
12
-
13
-
14
- class GetL2BookSnapshotQueryMarketdata(BaseModel):
15
- l_2_book_snapshot: "GetL2BookSnapshotQueryMarketdataL2BookSnapshot" = Field(
16
- alias="l2BookSnapshot"
17
- )
18
-
19
-
20
- class GetL2BookSnapshotQueryMarketdataL2BookSnapshot(L2BookFields):
21
- pass
22
-
23
-
24
- GetL2BookSnapshotQuery.model_rebuild()
25
- GetL2BookSnapshotQueryMarketdata.model_rebuild()
@@ -1,25 +0,0 @@
1
- # Generated by ariadne-codegen
2
- # Source: queries.graphql
3
-
4
- from pydantic import Field
5
-
6
- from .base_model import BaseModel
7
- from .fragments import MarketStatusFields
8
-
9
-
10
- class GetMarketStatusQuery(BaseModel):
11
- marketdata: "GetMarketStatusQueryMarketdata"
12
-
13
-
14
- class GetMarketStatusQueryMarketdata(BaseModel):
15
- market_status: "GetMarketStatusQueryMarketdataMarketStatus" = Field(
16
- alias="marketStatus"
17
- )
18
-
19
-
20
- class GetMarketStatusQueryMarketdataMarketStatus(MarketStatusFields):
21
- pass
22
-
23
-
24
- GetMarketStatusQuery.model_rebuild()
25
- GetMarketStatusQueryMarketdata.model_rebuild()
@@ -1,25 +0,0 @@
1
- # Generated by ariadne-codegen
2
- # Source: queries.graphql
3
-
4
- from typing import List
5
-
6
- from pydantic import Field
7
-
8
- from .base_model import BaseModel
9
- from .fragments import OrderFields
10
-
11
-
12
- class GetOpenOrdersQuery(BaseModel):
13
- oms: "GetOpenOrdersQueryOms"
14
-
15
-
16
- class GetOpenOrdersQueryOms(BaseModel):
17
- open_orders: List["GetOpenOrdersQueryOmsOpenOrders"] = Field(alias="openOrders")
18
-
19
-
20
- class GetOpenOrdersQueryOmsOpenOrders(OrderFields):
21
- pass
22
-
23
-
24
- GetOpenOrdersQuery.model_rebuild()
25
- GetOpenOrdersQueryOms.model_rebuild()
@@ -1,23 +0,0 @@
1
- # Generated by ariadne-codegen
2
- # Source: queries.graphql
3
-
4
- from typing import List
5
-
6
- from .base_model import BaseModel
7
- from .fragments import AccountWithPermissionsFields
8
-
9
-
10
- class ListAccountsQuery(BaseModel):
11
- user: "ListAccountsQueryUser"
12
-
13
-
14
- class ListAccountsQueryUser(BaseModel):
15
- accounts: List["ListAccountsQueryUserAccounts"]
16
-
17
-
18
- class ListAccountsQueryUserAccounts(AccountWithPermissionsFields):
19
- pass
20
-
21
-
22
- ListAccountsQuery.model_rebuild()
23
- ListAccountsQueryUser.model_rebuild()
@@ -1,23 +0,0 @@
1
- # Generated by ariadne-codegen
2
- # Source: queries.graphql
3
-
4
- from pydantic import Field
5
-
6
- from .base_model import BaseModel
7
- from .fragments import OrderFields
8
-
9
-
10
- class PlaceOrderMutation(BaseModel):
11
- oms: "PlaceOrderMutationOms"
12
-
13
-
14
- class PlaceOrderMutationOms(BaseModel):
15
- place_order: "PlaceOrderMutationOmsPlaceOrder" = Field(alias="placeOrder")
16
-
17
-
18
- class PlaceOrderMutationOmsPlaceOrder(OrderFields):
19
- pass
20
-
21
-
22
- PlaceOrderMutation.model_rebuild()
23
- PlaceOrderMutationOms.model_rebuild()
@@ -1,16 +0,0 @@
1
- # Generated by ariadne-codegen
2
- # Source: queries.graphql
3
-
4
- from .base_model import BaseModel
5
- from .fragments import CandleFields
6
-
7
-
8
- class SubscribeCandles(BaseModel):
9
- candles: "SubscribeCandlesCandles"
10
-
11
-
12
- class SubscribeCandlesCandles(CandleFields):
13
- pass
14
-
15
-
16
- SubscribeCandles.model_rebuild()
@@ -1,100 +0,0 @@
1
- # Generated by ariadne-codegen
2
- # Source: queries.graphql
3
-
4
- from datetime import datetime
5
- from decimal import Decimal
6
- from typing import Annotated, Literal, Optional, Union
7
- from uuid import UUID
8
-
9
- from pydantic import BeforeValidator, Field
10
-
11
- from architect_py.common_types import OrderDir
12
- from architect_py.common_types.order_dir import graphql_parse_order_dir
13
-
14
- from .base_model import BaseModel
15
- from .enums import FillKind
16
- from .fragments import OrderFields
17
-
18
-
19
- class SubscribeOrderflow(BaseModel):
20
- orderflow: Union[
21
- "SubscribeOrderflowOrderflowOrder",
22
- "SubscribeOrderflowOrderflowOrderAck",
23
- "SubscribeOrderflowOrderflowGqlOrderReject",
24
- "SubscribeOrderflowOrderflowOrderOut",
25
- "SubscribeOrderflowOrderflowOrderStale",
26
- "SubscribeOrderflowOrderflowCancel",
27
- "SubscribeOrderflowOrderflowCancelReject",
28
- "SubscribeOrderflowOrderflowOrderCanceling",
29
- "SubscribeOrderflowOrderflowOrderCanceled",
30
- "SubscribeOrderflowOrderflowFill",
31
- "SubscribeOrderflowOrderflowAberrantFill",
32
- ] = Field(discriminator="typename__")
33
-
34
-
35
- class SubscribeOrderflowOrderflowOrder(OrderFields):
36
- typename__: Literal["Order"] = Field(alias="__typename")
37
-
38
-
39
- class SubscribeOrderflowOrderflowOrderAck(BaseModel):
40
- typename__: Literal["OrderAck"] = Field(alias="__typename")
41
- order_id: str = Field(alias="orderId")
42
-
43
-
44
- class SubscribeOrderflowOrderflowGqlOrderReject(BaseModel):
45
- typename__: Literal["GqlOrderReject"] = Field(alias="__typename")
46
- order_id: str = Field(alias="orderId")
47
- reason: str
48
- message: Optional[str]
49
-
50
-
51
- class SubscribeOrderflowOrderflowOrderOut(BaseModel):
52
- typename__: Literal["OrderOut"] = Field(alias="__typename")
53
- order_id: str = Field(alias="orderId")
54
-
55
-
56
- class SubscribeOrderflowOrderflowOrderStale(BaseModel):
57
- typename__: Literal["OrderStale"] = Field(alias="__typename")
58
- order_id: str = Field(alias="orderId")
59
-
60
-
61
- class SubscribeOrderflowOrderflowCancel(BaseModel):
62
- typename__: Literal["Cancel"] = Field(alias="__typename")
63
-
64
-
65
- class SubscribeOrderflowOrderflowCancelReject(BaseModel):
66
- typename__: Literal["CancelReject"] = Field(alias="__typename")
67
- order_id: str = Field(alias="orderId")
68
- message: Optional[str]
69
-
70
-
71
- class SubscribeOrderflowOrderflowOrderCanceling(BaseModel):
72
- typename__: Literal["OrderCanceling"] = Field(alias="__typename")
73
-
74
-
75
- class SubscribeOrderflowOrderflowOrderCanceled(BaseModel):
76
- typename__: Literal["OrderCanceled"] = Field(alias="__typename")
77
- order_id: str = Field(alias="orderId")
78
- cancel_id: Optional[UUID] = Field(alias="cancelId")
79
-
80
-
81
- class SubscribeOrderflowOrderflowFill(BaseModel):
82
- typename__: Literal["Fill"] = Field(alias="__typename")
83
- fill_order_id: Optional[str] = Field(alias="fillOrderId")
84
- fill_id: UUID = Field(alias="fillId")
85
- fill_kind: FillKind = Field(alias="fillKind")
86
- execution_venue: str = Field(alias="executionVenue")
87
- exchange_fill_id: Optional[str] = Field(alias="exchangeFillId")
88
- symbol: str
89
- dir: Annotated[OrderDir, BeforeValidator(graphql_parse_order_dir)]
90
- quantity: Decimal
91
- price: Decimal
92
- recv_time: Optional[datetime] = Field(alias="recvTime")
93
- trade_time: Optional[datetime] = Field(alias="tradeTime")
94
-
95
-
96
- class SubscribeOrderflowOrderflowAberrantFill(BaseModel):
97
- typename__: Literal["AberrantFill"] = Field(alias="__typename")
98
-
99
-
100
- SubscribeOrderflow.model_rebuild()
@@ -1,27 +0,0 @@
1
- # Generated by ariadne-codegen
2
- # Source: queries.graphql
3
-
4
- from datetime import datetime
5
- from decimal import Decimal
6
- from typing import Annotated, Optional
7
-
8
- from pydantic import BeforeValidator
9
-
10
- from architect_py.common_types import OrderDir
11
- from architect_py.common_types.order_dir import graphql_parse_order_dir
12
-
13
- from .base_model import BaseModel
14
-
15
-
16
- class SubscribeTrades(BaseModel):
17
- trades: "SubscribeTradesTrades"
18
-
19
-
20
- class SubscribeTradesTrades(BaseModel):
21
- timestamp: Optional[datetime]
22
- direction: Optional[Annotated[OrderDir, BeforeValidator(graphql_parse_order_dir)]]
23
- price: Decimal
24
- size: Decimal
25
-
26
-
27
- SubscribeTrades.model_rebuild()
@@ -1,17 +0,0 @@
1
- # Generated by ariadne-codegen
2
- # Source: queries.graphql
3
-
4
- from pydantic import Field
5
-
6
- from .base_model import BaseModel
7
-
8
-
9
- class UserEmailQuery(BaseModel):
10
- user: "UserEmailQueryUser"
11
-
12
-
13
- class UserEmailQueryUser(BaseModel):
14
- user_email: str = Field(alias="userEmail")
15
-
16
-
17
- UserEmailQuery.model_rebuild()
File without changes
@@ -1,3 +0,0 @@
1
- from typing import Never
2
-
3
- DataFrame = Never
@@ -1,123 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: architect-py
3
- Version: 5.0.0b3
4
- Summary: Python SDK for the Architect trading platform and brokerage.
5
- Author-email: "Architect Financial Technologies, Inc." <hello@architect.co>
6
- License-Expression: Apache-2.0
7
- Classifier: Programming Language :: Python :: 3
8
- Classifier: Operating System :: OS Independent
9
- Classifier: Development Status :: 4 - Beta
10
- Requires-Python: <4,>=3.10
11
- Description-Content-Type: text/markdown
12
- License-File: LICENSE
13
- Requires-Dist: asyncio>=3
14
- Requires-Dist: gql[httpx]<4,>=3.5.0
15
- Requires-Dist: grpcio>=1.66.1
16
- Requires-Dist: msgspec<0.20,>=0.19
17
- Requires-Dist: pandas>=2
18
- Requires-Dist: pydantic~=2.10
19
- Requires-Dist: websockets>=11
20
- Requires-Dist: dnspython>=2.0
21
- Dynamic: license-file
22
-
23
- # [![Architect](https://avatars.githubusercontent.com/u/116864654?s=29&v=2)](https://architect.co) architect_py
24
- [![PyPI version](https://img.shields.io/pypi/v/architect-py.svg)](https://pypi.org/project/architect-py/)
25
-
26
- A fully-featured Python SDK for trading on [Architect](https://architect.co).
27
-
28
- Just some of the features of this SDK: symbology, portfolio management, order entry, advanced algos, and marketdata subscriptions.
29
-
30
- Also, it is compatible with Jupyter notebooks! Check the [examples for an example notebook](examples/jupyter_example.ipynb).
31
-
32
- ## Installation
33
-
34
- - pip: `pip install architect-py`
35
- - poetry: `poetry add architect-py`
36
- - uv: `uv add architect-py`
37
-
38
- ## API keys for the brokerage
39
-
40
- API keys/secrets for the brokerage can be generated on the [user account page](https://app.architect.co/user/account).
41
-
42
-
43
- ## Example usage
44
-
45
- `AsyncClient` and `Client` are the entryways into making calls to the Architect backend.
46
- Note that the sync `Client` does not have access to any subscription functions, because they are async by nature.
47
-
48
-
49
- ```python
50
- import asyncio
51
-
52
- from architect_py.async_client import AsyncClient
53
- from architect_py.scalars import TradableProduct
54
-
55
- async def main():
56
- c = await AsyncClient.connect(
57
- host="<your installation domain>", # e.g. app.architect.co for the brokerage
58
- api_key="<api key>",
59
- api_secret="<api secret>"
60
- paper_trading=True,
61
- )
62
- print(await c.who_am_i())
63
-
64
- series = await async_client.get_cme_futures_series("ES CME Futures")
65
- front_ES_future = series[0][1]
66
-
67
- s = c.subscribe_trades_stream(front_ES_future)
68
- async for trade in s:
69
- print(trade)
70
-
71
- asyncio.run(main())
72
- ```
73
-
74
- ```python
75
- from architect_py.client import Client
76
-
77
- def main():
78
- c = Client(
79
- host="<your installation domain>",
80
- api_key="<api key>",
81
- api_secret="<api secret>"
82
- paper_trading=True,
83
- )
84
- print(c.who_am_i())
85
-
86
- print(client.get_account_summaries())
87
-
88
- print(client.search_symbols("ES"))
89
- ```
90
-
91
- While the AsyncClient is the recommended way to use the Architect API, the Client instead without any familiarity with `async/await`.
92
- The sync clients and async clients usage is identical, except one removes the `await` before the call. The only exception to this is that the sync client does not support any subscriptions, because they are inherently asynchronous.
93
-
94
- Check the `examples` folder or the `architect_py/tests` folders for example usages.
95
-
96
-
97
- ## Method catalog
98
-
99
- Check out the [FUNCTIONS.md](FUNCTIONS.md) file to see a catalog of methods.
100
-
101
- ---
102
-
103
-
104
- ### Running examples from this package
105
-
106
- Clone this repository to run examples in the `examples` directory. This package
107
- uses poetry for dependency management. To enter a poetry virtual environment, make
108
- sure you have [poetry](https://python-poetry.org/docs/) installed and run the
109
- following from the repository root.
110
-
111
- ```bash
112
- poetry shell
113
- poetry install --sync
114
-
115
- export ARCHITECT_HOST="<your installation domain>"
116
- export ARCHITECT_API_KEY="<api key>"
117
- export ARCHITECT_API_SECRET="<api secret>"
118
-
119
- python -m examples.trades
120
- ```
121
-
122
- You can exit the poetry shell by running `exit`. Environment variables set
123
- within the shell are not persisted.