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.
- architect_py/__init__.py +432 -5
- architect_py/async_client.py +77 -43
- architect_py/client.py +11 -4
- architect_py/client.pyi +504 -0
- architect_py/common_types/__init__.py +2 -1
- architect_py/common_types/time_in_force.py +94 -0
- architect_py/common_types/tradable_product.py +9 -0
- architect_py/graphql_client/__init__.py +1 -216
- architect_py/graphql_client/client.py +2 -1043
- architect_py/graphql_client/enums.py +0 -72
- architect_py/graphql_client/fragments.py +4 -152
- architect_py/grpc/__init__.py +0 -143
- architect_py/grpc/client.py +6 -1
- architect_py/grpc/models/Core/RestartCptyRequest.py +40 -0
- architect_py/grpc/models/Core/RestartCptyResponse.py +20 -0
- architect_py/grpc/models/Marketdata/Liquidation.py +0 -1
- architect_py/grpc/models/Marketdata/Ticker.py +14 -1
- architect_py/grpc/models/Marketdata/TickersRequest.py +38 -12
- architect_py/grpc/models/Marketdata/Trade.py +0 -1
- architect_py/grpc/models/Oms/Order.py +33 -24
- architect_py/grpc/models/Oms/PlaceOrderRequest.py +33 -24
- architect_py/grpc/models/__init__.py +113 -2
- architect_py/grpc/models/definitions.py +2 -32
- architect_py/grpc/utils.py +1 -4
- architect_py/tests/test_order_entry.py +2 -3
- architect_py/tests/test_orderflow.py +1 -1
- architect_py/utils/pandas.py +4 -3
- architect_py-5.1.0.dist-info/METADATA +66 -0
- {architect_py-5.0.0b3.dist-info → architect_py-5.1.0.dist-info}/RECORD +48 -67
- {architect_py-5.0.0b3.dist-info → architect_py-5.1.0.dist-info}/WHEEL +1 -1
- examples/book_subscription.py +1 -2
- examples/candles.py +1 -3
- examples/common.py +1 -2
- examples/external_cpty.py +2 -2
- examples/funding_rate_mean_reversion_algo.py +9 -6
- examples/order_sending.py +29 -9
- examples/stream_l1_marketdata.py +1 -2
- examples/stream_l2_marketdata.py +1 -2
- examples/trades.py +1 -2
- examples/tutorial_async.py +6 -8
- examples/tutorial_sync.py +6 -7
- scripts/add_imports_to_inits.py +146 -0
- scripts/correct_sync_interface.py +143 -0
- scripts/postprocess_grpc.py +57 -11
- scripts/preprocess_grpc_schema.py +2 -0
- scripts/prune_graphql_schema.py +187 -0
- architect_py/client_interface.py +0 -63
- architect_py/common_types/scalars.py +0 -25
- architect_py/graphql_client/cancel_all_orders_mutation.py +0 -17
- architect_py/graphql_client/cancel_order_mutation.py +0 -23
- architect_py/graphql_client/create_jwt.py +0 -17
- architect_py/graphql_client/get_account_history_query.py +0 -27
- architect_py/graphql_client/get_account_query.py +0 -23
- architect_py/graphql_client/get_account_summaries_query.py +0 -27
- architect_py/graphql_client/get_account_summary_query.py +0 -25
- architect_py/graphql_client/get_candle_snapshot_query.py +0 -27
- architect_py/graphql_client/get_fills_query.py +0 -69
- architect_py/graphql_client/get_historical_orders_query.py +0 -27
- architect_py/graphql_client/get_l_1_book_snapshot_query.py +0 -21
- architect_py/graphql_client/get_l_1_book_snapshots_query.py +0 -23
- architect_py/graphql_client/get_l_2_book_snapshot_query.py +0 -25
- architect_py/graphql_client/get_market_status_query.py +0 -25
- architect_py/graphql_client/get_open_orders_query.py +0 -25
- architect_py/graphql_client/list_accounts_query.py +0 -23
- architect_py/graphql_client/place_order_mutation.py +0 -23
- architect_py/graphql_client/subscribe_candles.py +0 -16
- architect_py/graphql_client/subscribe_orderflow.py +0 -100
- architect_py/graphql_client/subscribe_trades.py +0 -27
- architect_py/graphql_client/user_email_query.py +0 -17
- architect_py/internal_utils/__init__.py +0 -0
- architect_py/internal_utils/no_pandas.py +0 -3
- architect_py-5.0.0b3.dist-info/METADATA +0 -123
- scripts/generate_sync_interface.py +0 -226
- {architect_py-5.0.0b3.dist-info → architect_py-5.1.0.dist-info}/licenses/LICENSE +0 -0
- {architect_py-5.0.0b3.dist-info → architect_py-5.1.0.dist-info}/top_level.txt +0 -0
architect_py/__init__.py
CHANGED
@@ -1,15 +1,442 @@
|
|
1
|
-
|
1
|
+
# ruff: noqa:I001
|
2
2
|
|
3
|
+
__version__ = "5.1.0"
|
4
|
+
|
5
|
+
from .utils.nearest_tick import TickRoundMethod
|
3
6
|
from .async_client import AsyncClient
|
4
7
|
from .client import Client
|
5
|
-
from .common_types import OrderDir, TradableProduct
|
6
|
-
from .grpc import
|
8
|
+
from .common_types import OrderDir, TradableProduct, TimeInForce, Venue
|
9
|
+
from .grpc.models.definitions import (
|
10
|
+
AccountIdOrName,
|
11
|
+
AccountPosition,
|
12
|
+
AccountStatistics,
|
13
|
+
AlgoOrderStatus,
|
14
|
+
CancelStatus,
|
15
|
+
CandleWidth,
|
16
|
+
CptyLogoutRequest,
|
17
|
+
DateTimeOrUtc,
|
18
|
+
Deposit,
|
19
|
+
HealthMetric,
|
20
|
+
HealthStatus,
|
21
|
+
L2BookDiff,
|
22
|
+
OrderId,
|
23
|
+
OrderOut,
|
24
|
+
OrderRejectReason,
|
25
|
+
OrderSource,
|
26
|
+
OrderStale,
|
27
|
+
OrderStatus,
|
28
|
+
OrderType,
|
29
|
+
ProductCatalogInfo,
|
30
|
+
RqdAccountStatistics,
|
31
|
+
SortTickersBy,
|
32
|
+
Statement,
|
33
|
+
TraderIdOrEmail,
|
34
|
+
UserId,
|
35
|
+
Withdrawal,
|
36
|
+
AccountPermissions,
|
37
|
+
AliasKind,
|
38
|
+
DerivativeKind,
|
39
|
+
FillKind,
|
40
|
+
Unit,
|
41
|
+
MinOrderQuantityUnit,
|
42
|
+
OptionsExerciseType,
|
43
|
+
PriceDisplayFormat,
|
44
|
+
Fiat,
|
45
|
+
Commodity,
|
46
|
+
Crypto,
|
47
|
+
Equity,
|
48
|
+
Index,
|
49
|
+
Future,
|
50
|
+
Perpetual,
|
51
|
+
Unknown,
|
52
|
+
PutOrCall,
|
53
|
+
SnapshotOrUpdateForStringAndProductCatalogInfo1,
|
54
|
+
SnapshotOrUpdateForStringAndProductCatalogInfo2,
|
55
|
+
SnapshotOrUpdateForStringAndString1,
|
56
|
+
SnapshotOrUpdateForStringAndString2,
|
57
|
+
SimpleDecimal,
|
58
|
+
Varying1,
|
59
|
+
Varying,
|
60
|
+
AccountName,
|
61
|
+
OptionLike,
|
62
|
+
EventContractSeriesInstance2,
|
63
|
+
OptionsSeriesInstance,
|
64
|
+
SpreadLeg,
|
65
|
+
Outcome,
|
66
|
+
AberrantFill,
|
67
|
+
CancelReject,
|
68
|
+
CptyLoginRequest,
|
69
|
+
ExecutionInfo,
|
70
|
+
Fill,
|
71
|
+
OptionsContract,
|
72
|
+
OptionsGreeks,
|
73
|
+
OptionsSeriesInfo,
|
74
|
+
OrderAck,
|
75
|
+
OrderCanceled,
|
76
|
+
OrderCanceling,
|
77
|
+
OrderReject,
|
78
|
+
SnapshotOrUpdateForAliasKindAndSnapshotOrUpdateForStringAndString1,
|
79
|
+
SnapshotOrUpdateForAliasKindAndSnapshotOrUpdateForStringAndString2,
|
80
|
+
SnapshotOrUpdateForStringAndOptionsSeriesInfo1,
|
81
|
+
SnapshotOrUpdateForStringAndOptionsSeriesInfo2,
|
82
|
+
SnapshotOrUpdateForStringAndSnapshotOrUpdateForStringAndProductCatalogInfo1,
|
83
|
+
SnapshotOrUpdateForStringAndSnapshotOrUpdateForStringAndProductCatalogInfo2,
|
84
|
+
Account,
|
85
|
+
FutureSpread,
|
86
|
+
Option,
|
87
|
+
SnapshotOrUpdateForStringAndExecutionInfo1,
|
88
|
+
SnapshotOrUpdateForStringAndExecutionInfo2,
|
89
|
+
Enumerated,
|
90
|
+
EventContractSeriesInstance1,
|
91
|
+
AccountWithPermissions,
|
92
|
+
SnapshotOrUpdateForStringAndSnapshotOrUpdateForStringAndExecutionInfo1,
|
93
|
+
SnapshotOrUpdateForStringAndSnapshotOrUpdateForStringAndExecutionInfo2,
|
94
|
+
EventContract,
|
95
|
+
ProductInfo,
|
96
|
+
SnapshotOrUpdateForStringAndProductInfo1,
|
97
|
+
SnapshotOrUpdateForStringAndProductInfo2,
|
98
|
+
)
|
99
|
+
from .grpc.models.Accounts.AccountsRequest import AccountsRequest
|
100
|
+
from .grpc.models.Accounts.AccountsResponse import AccountsResponse
|
101
|
+
from .grpc.models.Algo.AlgoOrder import AlgoOrder
|
102
|
+
from .grpc.models.Algo.AlgoOrderRequest import AlgoOrderRequest
|
103
|
+
from .grpc.models.Algo.AlgoOrdersRequest import AlgoOrdersRequest
|
104
|
+
from .grpc.models.Algo.AlgoOrdersResponse import AlgoOrdersResponse
|
105
|
+
from .grpc.models.Algo.CreateAlgoOrderRequest import CreateAlgoOrderRequest
|
106
|
+
from .grpc.models.Algo.PauseAlgoRequest import PauseAlgoRequest
|
107
|
+
from .grpc.models.Algo.PauseAlgoResponse import PauseAlgoResponse
|
108
|
+
from .grpc.models.Algo.StartAlgoRequest import StartAlgoRequest
|
109
|
+
from .grpc.models.Algo.StartAlgoResponse import StartAlgoResponse
|
110
|
+
from .grpc.models.Algo.StopAlgoRequest import StopAlgoRequest
|
111
|
+
from .grpc.models.Algo.StopAlgoResponse import StopAlgoResponse
|
112
|
+
from .grpc.models.Auth.CreateJwtRequest import CreateJwtRequest
|
113
|
+
from .grpc.models.Auth.CreateJwtResponse import CreateJwtResponse
|
114
|
+
from .grpc.models.Boss.DepositsRequest import DepositsRequest
|
115
|
+
from .grpc.models.Boss.DepositsResponse import DepositsResponse
|
116
|
+
from .grpc.models.Boss.RqdAccountStatisticsRequest import RqdAccountStatisticsRequest
|
117
|
+
from .grpc.models.Boss.RqdAccountStatisticsResponse import RqdAccountStatisticsResponse
|
118
|
+
from .grpc.models.Boss.StatementUrlRequest import StatementUrlRequest
|
119
|
+
from .grpc.models.Boss.StatementUrlResponse import StatementUrlResponse
|
120
|
+
from .grpc.models.Boss.StatementsRequest import StatementsRequest
|
121
|
+
from .grpc.models.Boss.StatementsResponse import StatementsResponse
|
122
|
+
from .grpc.models.Boss.WithdrawalsRequest import WithdrawalsRequest
|
123
|
+
from .grpc.models.Boss.WithdrawalsResponse import WithdrawalsResponse
|
124
|
+
from .grpc.models.Core.ConfigRequest import ConfigRequest
|
125
|
+
from .grpc.models.Core.ConfigResponse import ConfigResponse
|
126
|
+
from .grpc.models.Core.RestartCptyRequest import RestartCptyRequest
|
127
|
+
from .grpc.models.Core.RestartCptyResponse import RestartCptyResponse
|
128
|
+
from .grpc.models.Cpty.CptyRequest import CptyRequest
|
129
|
+
from .grpc.models.Cpty.CptyResponse import CptyResponse
|
130
|
+
from .grpc.models.Cpty.CptyStatus import CptyStatus
|
131
|
+
from .grpc.models.Cpty.CptyStatusRequest import CptyStatusRequest
|
132
|
+
from .grpc.models.Cpty.CptysRequest import CptysRequest
|
133
|
+
from .grpc.models.Cpty.CptysResponse import CptysResponse
|
134
|
+
from .grpc.models.Folio.AccountHistoryRequest import AccountHistoryRequest
|
135
|
+
from .grpc.models.Folio.AccountHistoryResponse import AccountHistoryResponse
|
136
|
+
from .grpc.models.Folio.AccountSummariesRequest import AccountSummariesRequest
|
137
|
+
from .grpc.models.Folio.AccountSummariesResponse import AccountSummariesResponse
|
138
|
+
from .grpc.models.Folio.AccountSummary import AccountSummary
|
139
|
+
from .grpc.models.Folio.AccountSummaryRequest import AccountSummaryRequest
|
140
|
+
from .grpc.models.Folio.HistoricalFillsRequest import HistoricalFillsRequest
|
141
|
+
from .grpc.models.Folio.HistoricalFillsResponse import HistoricalFillsResponse
|
142
|
+
from .grpc.models.Folio.HistoricalOrdersRequest import HistoricalOrdersRequest
|
143
|
+
from .grpc.models.Folio.HistoricalOrdersResponse import HistoricalOrdersResponse
|
144
|
+
from .grpc.models.Health.HealthCheckRequest import HealthCheckRequest
|
145
|
+
from .grpc.models.Health.HealthCheckResponse import HealthCheckResponse
|
146
|
+
from .grpc.models.Marketdata.ArrayOfL1BookSnapshot import ArrayOfL1BookSnapshot
|
147
|
+
from .grpc.models.Marketdata.Candle import Candle
|
148
|
+
from .grpc.models.Marketdata.HistoricalCandlesRequest import HistoricalCandlesRequest
|
149
|
+
from .grpc.models.Marketdata.HistoricalCandlesResponse import HistoricalCandlesResponse
|
150
|
+
from .grpc.models.Marketdata.L1BookSnapshot import L1BookSnapshot
|
151
|
+
from .grpc.models.Marketdata.L1BookSnapshotRequest import L1BookSnapshotRequest
|
152
|
+
from .grpc.models.Marketdata.L1BookSnapshotsRequest import L1BookSnapshotsRequest
|
153
|
+
from .grpc.models.Marketdata.L2BookSnapshot import L2BookSnapshot
|
154
|
+
from .grpc.models.Marketdata.L2BookSnapshotRequest import L2BookSnapshotRequest
|
155
|
+
from .grpc.models.Marketdata.L2BookUpdate import L2BookUpdate
|
156
|
+
from .grpc.models.Marketdata.Liquidation import Liquidation
|
157
|
+
from .grpc.models.Marketdata.MarketStatus import MarketStatus
|
158
|
+
from .grpc.models.Marketdata.MarketStatusRequest import MarketStatusRequest
|
159
|
+
from .grpc.models.Marketdata.SubscribeCandlesRequest import SubscribeCandlesRequest
|
160
|
+
from .grpc.models.Marketdata.SubscribeCurrentCandlesRequest import (
|
161
|
+
SubscribeCurrentCandlesRequest,
|
162
|
+
)
|
163
|
+
from .grpc.models.Marketdata.SubscribeL1BookSnapshotsRequest import (
|
164
|
+
SubscribeL1BookSnapshotsRequest,
|
165
|
+
)
|
166
|
+
from .grpc.models.Marketdata.SubscribeL2BookUpdatesRequest import (
|
167
|
+
SubscribeL2BookUpdatesRequest,
|
168
|
+
)
|
169
|
+
from .grpc.models.Marketdata.SubscribeLiquidationsRequest import (
|
170
|
+
SubscribeLiquidationsRequest,
|
171
|
+
)
|
172
|
+
from .grpc.models.Marketdata.SubscribeManyCandlesRequest import (
|
173
|
+
SubscribeManyCandlesRequest,
|
174
|
+
)
|
175
|
+
from .grpc.models.Marketdata.SubscribeTickersRequest import SubscribeTickersRequest
|
176
|
+
from .grpc.models.Marketdata.SubscribeTradesRequest import SubscribeTradesRequest
|
177
|
+
from .grpc.models.Marketdata.Ticker import Ticker
|
178
|
+
from .grpc.models.Marketdata.TickerRequest import TickerRequest
|
179
|
+
from .grpc.models.Marketdata.TickerUpdate import TickerUpdate
|
180
|
+
from .grpc.models.Marketdata.TickersRequest import TickersRequest
|
181
|
+
from .grpc.models.Marketdata.TickersResponse import TickersResponse
|
182
|
+
from .grpc.models.Marketdata.Trade import Trade
|
183
|
+
from .grpc.models.Oms.Cancel import Cancel
|
184
|
+
from .grpc.models.Oms.CancelAllOrdersRequest import CancelAllOrdersRequest
|
185
|
+
from .grpc.models.Oms.CancelAllOrdersResponse import CancelAllOrdersResponse
|
186
|
+
from .grpc.models.Oms.CancelOrderRequest import CancelOrderRequest
|
187
|
+
from .grpc.models.Oms.OpenOrdersRequest import OpenOrdersRequest
|
188
|
+
from .grpc.models.Oms.OpenOrdersResponse import OpenOrdersResponse
|
189
|
+
from .grpc.models.Oms.Order import Order
|
190
|
+
from .grpc.models.Oms.PendingCancelsRequest import PendingCancelsRequest
|
191
|
+
from .grpc.models.Oms.PendingCancelsResponse import PendingCancelsResponse
|
192
|
+
from .grpc.models.Oms.PlaceOrderRequest import PlaceOrderRequest
|
193
|
+
from .grpc.models.OptionsMarketdata.OptionsChain import OptionsChain
|
194
|
+
from .grpc.models.OptionsMarketdata.OptionsChainGreeks import OptionsChainGreeks
|
195
|
+
from .grpc.models.OptionsMarketdata.OptionsChainGreeksRequest import (
|
196
|
+
OptionsChainGreeksRequest,
|
197
|
+
)
|
198
|
+
from .grpc.models.OptionsMarketdata.OptionsChainRequest import OptionsChainRequest
|
199
|
+
from .grpc.models.OptionsMarketdata.OptionsExpirations import OptionsExpirations
|
200
|
+
from .grpc.models.OptionsMarketdata.OptionsExpirationsRequest import (
|
201
|
+
OptionsExpirationsRequest,
|
202
|
+
)
|
203
|
+
from .grpc.models.Orderflow.Dropcopy import Dropcopy
|
204
|
+
from .grpc.models.Orderflow.DropcopyRequest import DropcopyRequest
|
205
|
+
from .grpc.models.Orderflow.Orderflow import Orderflow
|
206
|
+
from .grpc.models.Orderflow.OrderflowRequest import OrderflowRequest
|
207
|
+
from .grpc.models.Orderflow.SubscribeOrderflowRequest import SubscribeOrderflowRequest
|
208
|
+
from .grpc.models.Symbology.DownloadProductCatalogRequest import (
|
209
|
+
DownloadProductCatalogRequest,
|
210
|
+
)
|
211
|
+
from .grpc.models.Symbology.DownloadProductCatalogResponse import (
|
212
|
+
DownloadProductCatalogResponse,
|
213
|
+
)
|
214
|
+
from .grpc.models.Symbology.ExecutionInfoRequest import ExecutionInfoRequest
|
215
|
+
from .grpc.models.Symbology.ExecutionInfoResponse import ExecutionInfoResponse
|
216
|
+
from .grpc.models.Symbology.PruneExpiredSymbolsRequest import PruneExpiredSymbolsRequest
|
217
|
+
from .grpc.models.Symbology.PruneExpiredSymbolsResponse import (
|
218
|
+
PruneExpiredSymbolsResponse,
|
219
|
+
)
|
220
|
+
from .grpc.models.Symbology.SubscribeSymbology import SubscribeSymbology
|
221
|
+
from .grpc.models.Symbology.SymbologyRequest import SymbologyRequest
|
222
|
+
from .grpc.models.Symbology.SymbologySnapshot import SymbologySnapshot
|
223
|
+
from .grpc.models.Symbology.SymbologyUpdate import SymbologyUpdate
|
224
|
+
from .grpc.models.Symbology.SymbolsRequest import SymbolsRequest
|
225
|
+
from .grpc.models.Symbology.SymbolsResponse import SymbolsResponse
|
226
|
+
from .grpc.models.Symbology.UploadProductCatalogRequest import (
|
227
|
+
UploadProductCatalogRequest,
|
228
|
+
)
|
229
|
+
from .grpc.models.Symbology.UploadProductCatalogResponse import (
|
230
|
+
UploadProductCatalogResponse,
|
231
|
+
)
|
232
|
+
from .grpc.models.Symbology.UploadSymbologyRequest import UploadSymbologyRequest
|
233
|
+
from .grpc.models.Symbology.UploadSymbologyResponse import UploadSymbologyResponse
|
7
234
|
|
8
235
|
__all__ = [
|
236
|
+
"AberrantFill",
|
237
|
+
"Account",
|
238
|
+
"AccountHistoryRequest",
|
239
|
+
"AccountHistoryResponse",
|
240
|
+
"AccountIdOrName",
|
241
|
+
"AccountName",
|
242
|
+
"AccountPermissions",
|
243
|
+
"AccountPosition",
|
244
|
+
"AccountStatistics",
|
245
|
+
"AccountSummariesRequest",
|
246
|
+
"AccountSummariesResponse",
|
247
|
+
"AccountSummary",
|
248
|
+
"AccountSummaryRequest",
|
249
|
+
"AccountWithPermissions",
|
250
|
+
"AccountsRequest",
|
251
|
+
"AccountsResponse",
|
252
|
+
"AlgoOrder",
|
253
|
+
"AlgoOrderRequest",
|
254
|
+
"AlgoOrderStatus",
|
255
|
+
"AlgoOrdersRequest",
|
256
|
+
"AlgoOrdersResponse",
|
257
|
+
"AliasKind",
|
258
|
+
"ArrayOfL1BookSnapshot",
|
9
259
|
"AsyncClient",
|
10
|
-
"
|
260
|
+
"Cancel",
|
261
|
+
"CancelAllOrdersRequest",
|
262
|
+
"CancelAllOrdersResponse",
|
263
|
+
"CancelOrderRequest",
|
264
|
+
"CancelReject",
|
265
|
+
"CancelStatus",
|
266
|
+
"Candle",
|
11
267
|
"CandleWidth",
|
268
|
+
"Client",
|
269
|
+
"Commodity",
|
270
|
+
"ConfigRequest",
|
271
|
+
"ConfigResponse",
|
272
|
+
"CptyLoginRequest",
|
273
|
+
"CptyLogoutRequest",
|
274
|
+
"CptyRequest",
|
275
|
+
"CptyResponse",
|
276
|
+
"CptyStatus",
|
277
|
+
"CptyStatusRequest",
|
278
|
+
"CptysRequest",
|
279
|
+
"CptysResponse",
|
280
|
+
"CreateAlgoOrderRequest",
|
281
|
+
"CreateJwtRequest",
|
282
|
+
"CreateJwtResponse",
|
283
|
+
"Crypto",
|
284
|
+
"DateTimeOrUtc",
|
285
|
+
"Deposit",
|
286
|
+
"DepositsRequest",
|
287
|
+
"DepositsResponse",
|
288
|
+
"DerivativeKind",
|
289
|
+
"DownloadProductCatalogRequest",
|
290
|
+
"DownloadProductCatalogResponse",
|
291
|
+
"Dropcopy",
|
292
|
+
"DropcopyRequest",
|
293
|
+
"Enumerated",
|
294
|
+
"Equity",
|
295
|
+
"EventContract",
|
296
|
+
"EventContractSeriesInstance1",
|
297
|
+
"EventContractSeriesInstance2",
|
298
|
+
"ExecutionInfo",
|
299
|
+
"ExecutionInfoRequest",
|
300
|
+
"ExecutionInfoResponse",
|
301
|
+
"Fiat",
|
302
|
+
"Fill",
|
303
|
+
"FillKind",
|
304
|
+
"Future",
|
305
|
+
"FutureSpread",
|
306
|
+
"HealthCheckRequest",
|
307
|
+
"HealthCheckResponse",
|
308
|
+
"HealthMetric",
|
309
|
+
"HealthStatus",
|
310
|
+
"HistoricalCandlesRequest",
|
311
|
+
"HistoricalCandlesResponse",
|
312
|
+
"HistoricalFillsRequest",
|
313
|
+
"HistoricalFillsResponse",
|
314
|
+
"HistoricalOrdersRequest",
|
315
|
+
"HistoricalOrdersResponse",
|
316
|
+
"Index",
|
317
|
+
"L1BookSnapshot",
|
318
|
+
"L1BookSnapshotRequest",
|
319
|
+
"L1BookSnapshotsRequest",
|
320
|
+
"L2BookDiff",
|
321
|
+
"L2BookSnapshot",
|
322
|
+
"L2BookSnapshotRequest",
|
323
|
+
"L2BookUpdate",
|
324
|
+
"Liquidation",
|
325
|
+
"MarketStatus",
|
326
|
+
"MarketStatusRequest",
|
327
|
+
"MinOrderQuantityUnit",
|
328
|
+
"OpenOrdersRequest",
|
329
|
+
"OpenOrdersResponse",
|
330
|
+
"Option",
|
331
|
+
"OptionLike",
|
332
|
+
"OptionsChain",
|
333
|
+
"OptionsChainGreeks",
|
334
|
+
"OptionsChainGreeksRequest",
|
335
|
+
"OptionsChainRequest",
|
336
|
+
"OptionsContract",
|
337
|
+
"OptionsExerciseType",
|
338
|
+
"OptionsExpirations",
|
339
|
+
"OptionsExpirationsRequest",
|
340
|
+
"OptionsGreeks",
|
341
|
+
"OptionsSeriesInfo",
|
342
|
+
"OptionsSeriesInstance",
|
343
|
+
"Order",
|
344
|
+
"OrderAck",
|
345
|
+
"OrderCanceled",
|
346
|
+
"OrderCanceling",
|
12
347
|
"OrderDir",
|
348
|
+
"OrderId",
|
349
|
+
"OrderOut",
|
350
|
+
"OrderReject",
|
351
|
+
"OrderRejectReason",
|
352
|
+
"OrderSource",
|
353
|
+
"OrderStale",
|
354
|
+
"OrderStatus",
|
355
|
+
"OrderType",
|
356
|
+
"Orderflow",
|
357
|
+
"OrderflowRequest",
|
358
|
+
"Outcome",
|
359
|
+
"PauseAlgoRequest",
|
360
|
+
"PauseAlgoResponse",
|
361
|
+
"PendingCancelsRequest",
|
362
|
+
"PendingCancelsResponse",
|
363
|
+
"Perpetual",
|
364
|
+
"PlaceOrderRequest",
|
365
|
+
"PriceDisplayFormat",
|
366
|
+
"ProductCatalogInfo",
|
367
|
+
"ProductInfo",
|
368
|
+
"PruneExpiredSymbolsRequest",
|
369
|
+
"PruneExpiredSymbolsResponse",
|
370
|
+
"PutOrCall",
|
371
|
+
"RestartCptyRequest",
|
372
|
+
"RestartCptyResponse",
|
373
|
+
"RqdAccountStatistics",
|
374
|
+
"RqdAccountStatisticsRequest",
|
375
|
+
"RqdAccountStatisticsResponse",
|
376
|
+
"SimpleDecimal",
|
377
|
+
"SnapshotOrUpdateForAliasKindAndSnapshotOrUpdateForStringAndString1",
|
378
|
+
"SnapshotOrUpdateForAliasKindAndSnapshotOrUpdateForStringAndString2",
|
379
|
+
"SnapshotOrUpdateForStringAndExecutionInfo1",
|
380
|
+
"SnapshotOrUpdateForStringAndExecutionInfo2",
|
381
|
+
"SnapshotOrUpdateForStringAndOptionsSeriesInfo1",
|
382
|
+
"SnapshotOrUpdateForStringAndOptionsSeriesInfo2",
|
383
|
+
"SnapshotOrUpdateForStringAndProductCatalogInfo1",
|
384
|
+
"SnapshotOrUpdateForStringAndProductCatalogInfo2",
|
385
|
+
"SnapshotOrUpdateForStringAndProductInfo1",
|
386
|
+
"SnapshotOrUpdateForStringAndProductInfo2",
|
387
|
+
"SnapshotOrUpdateForStringAndSnapshotOrUpdateForStringAndExecutionInfo1",
|
388
|
+
"SnapshotOrUpdateForStringAndSnapshotOrUpdateForStringAndExecutionInfo2",
|
389
|
+
"SnapshotOrUpdateForStringAndSnapshotOrUpdateForStringAndProductCatalogInfo1",
|
390
|
+
"SnapshotOrUpdateForStringAndSnapshotOrUpdateForStringAndProductCatalogInfo2",
|
391
|
+
"SnapshotOrUpdateForStringAndString1",
|
392
|
+
"SnapshotOrUpdateForStringAndString2",
|
393
|
+
"SortTickersBy",
|
394
|
+
"SpreadLeg",
|
395
|
+
"StartAlgoRequest",
|
396
|
+
"StartAlgoResponse",
|
397
|
+
"Statement",
|
398
|
+
"StatementUrlRequest",
|
399
|
+
"StatementUrlResponse",
|
400
|
+
"StatementsRequest",
|
401
|
+
"StatementsResponse",
|
402
|
+
"StopAlgoRequest",
|
403
|
+
"StopAlgoResponse",
|
404
|
+
"SubscribeCandlesRequest",
|
405
|
+
"SubscribeCurrentCandlesRequest",
|
406
|
+
"SubscribeL1BookSnapshotsRequest",
|
407
|
+
"SubscribeL2BookUpdatesRequest",
|
408
|
+
"SubscribeLiquidationsRequest",
|
409
|
+
"SubscribeManyCandlesRequest",
|
410
|
+
"SubscribeOrderflowRequest",
|
411
|
+
"SubscribeSymbology",
|
412
|
+
"SubscribeTickersRequest",
|
413
|
+
"SubscribeTradesRequest",
|
414
|
+
"SymbologyRequest",
|
415
|
+
"SymbologySnapshot",
|
416
|
+
"SymbologyUpdate",
|
417
|
+
"SymbolsRequest",
|
418
|
+
"SymbolsResponse",
|
419
|
+
"TickRoundMethod",
|
420
|
+
"Ticker",
|
421
|
+
"TickerRequest",
|
422
|
+
"TickerUpdate",
|
423
|
+
"TickersRequest",
|
424
|
+
"TickersResponse",
|
425
|
+
"TimeInForce",
|
13
426
|
"TradableProduct",
|
14
|
-
"
|
427
|
+
"Trade",
|
428
|
+
"TraderIdOrEmail",
|
429
|
+
"Unit",
|
430
|
+
"Unknown",
|
431
|
+
"UploadProductCatalogRequest",
|
432
|
+
"UploadProductCatalogResponse",
|
433
|
+
"UploadSymbologyRequest",
|
434
|
+
"UploadSymbologyResponse",
|
435
|
+
"UserId",
|
436
|
+
"Varying",
|
437
|
+
"Varying1",
|
438
|
+
"Venue",
|
439
|
+
"Withdrawal",
|
440
|
+
"WithdrawalsRequest",
|
441
|
+
"WithdrawalsResponse",
|
15
442
|
]
|
architect_py/async_client.py
CHANGED
@@ -18,38 +18,37 @@ from typing import (
|
|
18
18
|
import grpc
|
19
19
|
import pandas as pd
|
20
20
|
|
21
|
-
|
22
|
-
from architect_py.
|
23
|
-
from architect_py.
|
24
|
-
from architect_py.
|
25
|
-
from architect_py.
|
26
|
-
|
27
|
-
|
21
|
+
# cannot do architect_py import * due to circular import
|
22
|
+
from architect_py.common_types import OrderDir, TimeInForce, TradableProduct, Venue
|
23
|
+
from architect_py.graphql_client import GraphQLClient
|
24
|
+
from architect_py.graphql_client.exceptions import GraphQLClientGraphQLMultiError
|
25
|
+
from architect_py.graphql_client.fragments import (
|
26
|
+
ExecutionInfoFields,
|
27
|
+
ProductInfoFields,
|
28
|
+
)
|
29
|
+
from architect_py.grpc.client import GrpcClient
|
30
|
+
from architect_py.grpc.models import *
|
31
|
+
from architect_py.grpc.models.definitions import (
|
32
|
+
AccountIdOrName,
|
33
|
+
AccountWithPermissions,
|
34
|
+
CandleWidth,
|
35
|
+
L2BookDiff,
|
36
|
+
OrderId,
|
37
|
+
OrderSource,
|
38
|
+
OrderType,
|
39
|
+
SortTickersBy,
|
40
|
+
TraderIdOrEmail,
|
28
41
|
)
|
29
|
-
from architect_py.grpc.models.Orderflow.Orderflow import Orderflow
|
30
42
|
from architect_py.grpc.models.Orderflow.OrderflowRequest import (
|
31
|
-
OrderflowRequest,
|
32
43
|
OrderflowRequest_route,
|
33
44
|
OrderflowRequestUnannotatedResponseType,
|
34
45
|
)
|
35
|
-
from architect_py.grpc.
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
from .
|
40
|
-
from .
|
41
|
-
from .graphql_client.exceptions import GraphQLClientGraphQLMultiError
|
42
|
-
from .graphql_client.fragments import (
|
43
|
-
ExecutionInfoFields,
|
44
|
-
ProductInfoFields,
|
45
|
-
)
|
46
|
-
from .grpc import *
|
47
|
-
from .grpc.client import GrpcClient
|
48
|
-
from .utils.nearest_tick import TickRoundMethod
|
49
|
-
from .utils.orderbook import update_orderbook_side
|
50
|
-
from .utils.pandas import candles_to_dataframe
|
51
|
-
from .utils.price_bands import price_band_pairs
|
52
|
-
from .utils.symbol_parsing import nominative_expiration
|
46
|
+
from architect_py.grpc.resolve_endpoint import resolve_endpoint
|
47
|
+
from architect_py.utils.nearest_tick import TickRoundMethod
|
48
|
+
from architect_py.utils.orderbook import update_orderbook_side
|
49
|
+
from architect_py.utils.pandas import candles_to_dataframe
|
50
|
+
from architect_py.utils.price_bands import price_band_pairs
|
51
|
+
from architect_py.utils.symbol_parsing import nominative_expiration
|
53
52
|
|
54
53
|
|
55
54
|
class AsyncClient:
|
@@ -73,8 +72,8 @@ class AsyncClient:
|
|
73
72
|
@staticmethod
|
74
73
|
async def connect(
|
75
74
|
*,
|
76
|
-
api_key:
|
77
|
-
api_secret:
|
75
|
+
api_key: str,
|
76
|
+
api_secret: str,
|
78
77
|
paper_trading: bool,
|
79
78
|
endpoint: str = "https://app.architect.co",
|
80
79
|
graphql_port: Optional[int] = None,
|
@@ -83,6 +82,8 @@ class AsyncClient:
|
|
83
82
|
"""
|
84
83
|
Connect to an Architect installation.
|
85
84
|
|
85
|
+
An `api_key` and `api_secret` can be created at https://app.architect.co/api-keys
|
86
|
+
|
86
87
|
Raises ValueError if the API key and secret are not the correct length or contain invalid characters.
|
87
88
|
"""
|
88
89
|
if paper_trading:
|
@@ -442,7 +443,7 @@ class AsyncClient:
|
|
442
443
|
|
443
444
|
async def get_execution_infos(
|
444
445
|
self,
|
445
|
-
symbols: Optional[list[TradableProduct]],
|
446
|
+
symbols: Optional[list[TradableProduct | str]],
|
446
447
|
execution_venue: Optional[str] = None,
|
447
448
|
) -> Sequence[ExecutionInfoFields]:
|
448
449
|
"""
|
@@ -458,9 +459,11 @@ class AsyncClient:
|
|
458
459
|
that were asked for, or in the same order; any duplicates or invalid
|
459
460
|
symbols will be ignored.
|
460
461
|
"""
|
461
|
-
|
462
|
-
symbols
|
463
|
-
|
462
|
+
if symbols is not None:
|
463
|
+
tps = [TradableProduct(symbol) for symbol in symbols]
|
464
|
+
else:
|
465
|
+
tps = None
|
466
|
+
res = await self.graphql_client.get_execution_infos_query(tps, execution_venue)
|
464
467
|
return res.execution_infos
|
465
468
|
|
466
469
|
async def get_cme_first_notice_date(self, symbol: str) -> Optional[date]:
|
@@ -502,6 +505,33 @@ class AsyncClient:
|
|
502
505
|
res = await self.graphql_client.get_future_series_query(series_symbol)
|
503
506
|
return res.futures_series
|
504
507
|
|
508
|
+
async def get_front_future(
|
509
|
+
self, series_symbol: str, venue: str, by_volume: bool = True
|
510
|
+
) -> str:
|
511
|
+
"""
|
512
|
+
Gets the future with the most volume in a series.
|
513
|
+
|
514
|
+
Args:
|
515
|
+
series_symbol: the futures series
|
516
|
+
e.g. "ES CME Futures" would yield the lead future for the ES series
|
517
|
+
venue: the venue to get the lead future for, e.g. "CME"
|
518
|
+
by_volume: if True, sort by volume; otherwise sort by expiration date
|
519
|
+
|
520
|
+
Returns:
|
521
|
+
The lead future symbol
|
522
|
+
"""
|
523
|
+
futures = await self.get_futures_series(series_symbol)
|
524
|
+
if not by_volume:
|
525
|
+
futures.sort()
|
526
|
+
return futures[0]
|
527
|
+
else:
|
528
|
+
grpc_client = await self.marketdata(venue)
|
529
|
+
req = TickersRequest(
|
530
|
+
symbols=futures, k=SortTickersBy.VOLUME_DESC, venue=venue
|
531
|
+
)
|
532
|
+
res: TickersResponse = await grpc_client.unary_unary(req)
|
533
|
+
return res.tickers[0].symbol
|
534
|
+
|
505
535
|
@staticmethod
|
506
536
|
def get_expiration_from_CME_name(name: str) -> Optional[date]:
|
507
537
|
"""
|
@@ -1160,6 +1190,12 @@ class AsyncClient:
|
|
1160
1190
|
to_exclusive=to_exclusive,
|
1161
1191
|
)
|
1162
1192
|
orders = await grpc_client.unary_unary(historical_orders_request)
|
1193
|
+
if orders is None:
|
1194
|
+
raise ValueError(
|
1195
|
+
"No orders found for the given filters. "
|
1196
|
+
"If order_ids is not specified, then from_inclusive and to_exclusive "
|
1197
|
+
"MUST be specified."
|
1198
|
+
)
|
1163
1199
|
return orders.orders
|
1164
1200
|
|
1165
1201
|
async def get_order(self, order_id: OrderId) -> Optional[Order]:
|
@@ -1305,8 +1341,6 @@ class AsyncClient:
|
|
1305
1341
|
async for of in client.subscribe_orderflow_stream(request):
|
1306
1342
|
print(of)
|
1307
1343
|
```
|
1308
|
-
|
1309
|
-
This WILL block the event loop until the stream is closed.
|
1310
1344
|
"""
|
1311
1345
|
grpc_client = await self.core()
|
1312
1346
|
request: SubscribeOrderflowRequest = SubscribeOrderflowRequest(
|
@@ -1351,7 +1385,7 @@ class AsyncClient:
|
|
1351
1385
|
quantity: Decimal,
|
1352
1386
|
limit_price: Decimal,
|
1353
1387
|
order_type: OrderType = OrderType.LIMIT,
|
1354
|
-
time_in_force: TimeInForce =
|
1388
|
+
time_in_force: TimeInForce = TimeInForce.DAY,
|
1355
1389
|
price_round_method: Optional[TickRoundMethod] = None,
|
1356
1390
|
account: Optional[str] = None,
|
1357
1391
|
trader: Optional[str] = None,
|
@@ -1447,9 +1481,9 @@ class AsyncClient:
|
|
1447
1481
|
id: Optional[OrderId] = None,
|
1448
1482
|
symbol: TradableProduct | str,
|
1449
1483
|
execution_venue: str,
|
1450
|
-
|
1484
|
+
dir: OrderDir,
|
1451
1485
|
quantity: Decimal,
|
1452
|
-
time_in_force: TimeInForce =
|
1486
|
+
time_in_force: TimeInForce = TimeInForce.DAY,
|
1453
1487
|
account: Optional[str] = None,
|
1454
1488
|
fraction_through_market: Decimal = Decimal("0.001"),
|
1455
1489
|
) -> Order:
|
@@ -1461,7 +1495,7 @@ class AsyncClient:
|
|
1461
1495
|
id: in case user wants to generate their own order id, otherwise it will be generated automatically
|
1462
1496
|
symbol: the symbol to send the order for
|
1463
1497
|
execution_venue: the execution venue to send the order to
|
1464
|
-
|
1498
|
+
dir: the direction of the order
|
1465
1499
|
quantity: the quantity of the order
|
1466
1500
|
time_in_force: the time in force of the order
|
1467
1501
|
account: the account to send the order for
|
@@ -1482,7 +1516,7 @@ class AsyncClient:
|
|
1482
1516
|
|
1483
1517
|
price_band = price_band_pairs.get(symbol, None)
|
1484
1518
|
|
1485
|
-
if
|
1519
|
+
if dir == OrderDir.BUY:
|
1486
1520
|
if ticker.ask_price is None:
|
1487
1521
|
raise ValueError(
|
1488
1522
|
f"Failed to send market order with reason: no ask price for {symbol}"
|
@@ -1501,11 +1535,11 @@ class AsyncClient:
|
|
1501
1535
|
limit_price = ticker.bid_price * (1 - fraction_through_market)
|
1502
1536
|
if price_band and ticker.last_price:
|
1503
1537
|
price_band_reference_price = ticker.last_price - price_band
|
1504
|
-
limit_price =
|
1538
|
+
limit_price = max(limit_price, price_band_reference_price)
|
1505
1539
|
|
1506
1540
|
# Conservatively round price to nearest tick
|
1507
1541
|
tick_round_method = (
|
1508
|
-
TickRoundMethod.FLOOR if
|
1542
|
+
TickRoundMethod.FLOOR if dir == OrderDir.BUY else TickRoundMethod.CEIL
|
1509
1543
|
)
|
1510
1544
|
|
1511
1545
|
execution_info = await self.get_execution_info(
|
@@ -1522,7 +1556,7 @@ class AsyncClient:
|
|
1522
1556
|
id=id,
|
1523
1557
|
symbol=symbol,
|
1524
1558
|
execution_venue=execution_venue,
|
1525
|
-
|
1559
|
+
dir=dir,
|
1526
1560
|
quantity=quantity,
|
1527
1561
|
account=account,
|
1528
1562
|
order_type=OrderType.LIMIT,
|