architect-py 5.0.0b2__py3-none-any.whl → 5.1.0b1__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 +80 -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/TickersRequest.py +38 -12
  18. architect_py/grpc/models/Marketdata/Trade.py +0 -1
  19. architect_py/grpc/models/Oms/Order.py +33 -24
  20. architect_py/grpc/models/Oms/PlaceOrderRequest.py +33 -24
  21. architect_py/grpc/models/__init__.py +113 -2
  22. architect_py/grpc/models/definitions.py +2 -32
  23. architect_py/grpc/utils.py +1 -4
  24. architect_py/tests/test_marketdata.py +16 -16
  25. architect_py/tests/test_order_entry.py +1 -2
  26. architect_py/tests/test_orderflow.py +1 -1
  27. architect_py/utils/pandas.py +4 -3
  28. architect_py-5.1.0b1.dist-info/METADATA +66 -0
  29. {architect_py-5.0.0b2.dist-info → architect_py-5.1.0b1.dist-info}/RECORD +48 -67
  30. {architect_py-5.0.0b2.dist-info → architect_py-5.1.0b1.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 +27 -7
  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 +5 -7
  41. examples/tutorial_sync.py +5 -6
  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.0b2.dist-info/METADATA +0 -123
  73. scripts/generate_sync_interface.py +0 -226
  74. {architect_py-5.0.0b2.dist-info → architect_py-5.1.0b1.dist-info}/licenses/LICENSE +0 -0
  75. {architect_py-5.0.0b2.dist-info → architect_py-5.1.0b1.dist-info}/top_level.txt +0 -0
architect_py/__init__.py CHANGED
@@ -1,15 +1,442 @@
1
- __version__ = "5.0.0b2"
1
+ # ruff: noqa:I001
2
2
 
3
+ __version__ = "5.1.0b1"
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 CandleWidth, TimeInForceEnum
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
- "Client",
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
- "TimeInForceEnum",
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
  ]
@@ -18,38 +18,37 @@ from typing import (
18
18
  import grpc
19
19
  import pandas as pd
20
20
 
21
- from architect_py.grpc.models.Oms.Cancel import Cancel
22
- from architect_py.grpc.models.Oms.CancelAllOrdersRequest import CancelAllOrdersRequest
23
- from architect_py.grpc.models.Oms.CancelOrderRequest import CancelOrderRequest
24
- from architect_py.grpc.models.Oms.OpenOrdersRequest import OpenOrdersRequest
25
- from architect_py.grpc.models.Oms.Order import Order
26
- from architect_py.grpc.models.Oms.PlaceOrderRequest import (
27
- PlaceOrderRequest,
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.models.Orderflow.SubscribeOrderflowRequest import (
36
- SubscribeOrderflowRequest,
37
- )
38
-
39
- from .common_types import OrderDir, TradableProduct, Venue
40
- from .graphql_client import GraphQLClient
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: Optional[str] = None,
77
- api_secret: Optional[str] = None,
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:
@@ -106,6 +107,14 @@ class AsyncClient:
106
107
  f"Resolved endpoint {endpoint}: {grpc_host}:{grpc_port} use_ssl={use_ssl}"
107
108
  )
108
109
 
110
+ # Sanity check paper trading on prod environments
111
+ if paper_trading:
112
+ if grpc_host == "app.architect.co" or grpc_host == "staging.architect.co":
113
+ if grpc_port != 10081:
114
+ raise ValueError("Wrong gRPC port for paper trading")
115
+ if graphql_port is not None and graphql_port != 5678:
116
+ raise ValueError("Wrong GraphQL port for paper trading")
117
+
109
118
  client = AsyncClient(
110
119
  api_key=api_key,
111
120
  api_secret=api_secret,
@@ -152,11 +161,6 @@ class AsyncClient:
152
161
  "API secret must be a Base64-encoded string, 44 characters long"
153
162
  )
154
163
 
155
- if paper_trading and (graphql_port is not None or grpc_port is not None):
156
- raise ValueError(
157
- "If paper_trading is True, graphql_port and grpc_port must be None"
158
- )
159
-
160
164
  if graphql_port is None:
161
165
  if paper_trading:
162
166
  graphql_port = 5678
@@ -439,7 +443,7 @@ class AsyncClient:
439
443
 
440
444
  async def get_execution_infos(
441
445
  self,
442
- symbols: Optional[list[TradableProduct]],
446
+ symbols: Optional[list[TradableProduct | str]],
443
447
  execution_venue: Optional[str] = None,
444
448
  ) -> Sequence[ExecutionInfoFields]:
445
449
  """
@@ -455,9 +459,11 @@ class AsyncClient:
455
459
  that were asked for, or in the same order; any duplicates or invalid
456
460
  symbols will be ignored.
457
461
  """
458
- res = await self.graphql_client.get_execution_infos_query(
459
- symbols, execution_venue
460
- )
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)
461
467
  return res.execution_infos
462
468
 
463
469
  async def get_cme_first_notice_date(self, symbol: str) -> Optional[date]:
@@ -499,6 +505,33 @@ class AsyncClient:
499
505
  res = await self.graphql_client.get_future_series_query(series_symbol)
500
506
  return res.futures_series
501
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
+
502
535
  @staticmethod
503
536
  def get_expiration_from_CME_name(name: str) -> Optional[date]:
504
537
  """
@@ -1157,6 +1190,12 @@ class AsyncClient:
1157
1190
  to_exclusive=to_exclusive,
1158
1191
  )
1159
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
+ )
1160
1199
  return orders.orders
1161
1200
 
1162
1201
  async def get_order(self, order_id: OrderId) -> Optional[Order]:
@@ -1302,8 +1341,6 @@ class AsyncClient:
1302
1341
  async for of in client.subscribe_orderflow_stream(request):
1303
1342
  print(of)
1304
1343
  ```
1305
-
1306
- This WILL block the event loop until the stream is closed.
1307
1344
  """
1308
1345
  grpc_client = await self.core()
1309
1346
  request: SubscribeOrderflowRequest = SubscribeOrderflowRequest(
@@ -1348,7 +1385,7 @@ class AsyncClient:
1348
1385
  quantity: Decimal,
1349
1386
  limit_price: Decimal,
1350
1387
  order_type: OrderType = OrderType.LIMIT,
1351
- time_in_force: TimeInForce = TimeInForceEnum.DAY,
1388
+ time_in_force: TimeInForce = TimeInForce.DAY,
1352
1389
  price_round_method: Optional[TickRoundMethod] = None,
1353
1390
  account: Optional[str] = None,
1354
1391
  trader: Optional[str] = None,
@@ -1446,7 +1483,7 @@ class AsyncClient:
1446
1483
  execution_venue: str,
1447
1484
  odir: OrderDir,
1448
1485
  quantity: Decimal,
1449
- time_in_force: TimeInForce = TimeInForceEnum.DAY,
1486
+ time_in_force: TimeInForce = TimeInForce.DAY,
1450
1487
  account: Optional[str] = None,
1451
1488
  fraction_through_market: Decimal = Decimal("0.001"),
1452
1489
  ) -> Order:
@@ -1498,7 +1535,7 @@ class AsyncClient:
1498
1535
  limit_price = ticker.bid_price * (1 - fraction_through_market)
1499
1536
  if price_band and ticker.last_price:
1500
1537
  price_band_reference_price = ticker.last_price - price_band
1501
- limit_price = min(limit_price, price_band_reference_price)
1538
+ limit_price = max(limit_price, price_band_reference_price)
1502
1539
 
1503
1540
  # Conservatively round price to nearest tick
1504
1541
  tick_round_method = (