architect-py 5.1.5__py3-none-any.whl → 5.1.6__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 (39) hide show
  1. architect_py/__init__.py +24 -4
  2. architect_py/async_client.py +66 -57
  3. architect_py/client.pyi +2 -34
  4. architect_py/grpc/models/Accounts/ResetPaperAccountRequest.py +59 -0
  5. architect_py/grpc/models/Accounts/ResetPaperAccountResponse.py +20 -0
  6. architect_py/grpc/models/Boss/OptionsTransactionsRequest.py +42 -0
  7. architect_py/grpc/models/Boss/OptionsTransactionsResponse.py +27 -0
  8. architect_py/grpc/models/OptionsMarketdata/OptionsChain.py +5 -5
  9. architect_py/grpc/models/OptionsMarketdata/OptionsChainGreeks.py +5 -5
  10. architect_py/grpc/models/OptionsMarketdata/OptionsChainGreeksRequest.py +5 -1
  11. architect_py/grpc/models/OptionsMarketdata/OptionsChainRequest.py +5 -1
  12. architect_py/grpc/models/OptionsMarketdata/OptionsContract.py +45 -0
  13. architect_py/grpc/models/OptionsMarketdata/OptionsContractGreeksRequest.py +40 -0
  14. architect_py/grpc/models/OptionsMarketdata/OptionsContractRequest.py +40 -0
  15. architect_py/grpc/models/OptionsMarketdata/OptionsExpirations.py +4 -1
  16. architect_py/grpc/models/OptionsMarketdata/OptionsExpirationsRequest.py +8 -1
  17. architect_py/grpc/models/OptionsMarketdata/OptionsGreeks.py +58 -0
  18. architect_py/grpc/models/OptionsMarketdata/OptionsWraps.py +28 -0
  19. architect_py/grpc/models/OptionsMarketdata/OptionsWrapsRequest.py +40 -0
  20. architect_py/grpc/models/__init__.py +11 -1
  21. architect_py/grpc/models/definitions.py +37 -86
  22. architect_py/grpc/orderflow.py +3 -7
  23. architect_py/grpc/server.py +1 -3
  24. architect_py/tests/test_order_entry.py +120 -1
  25. architect_py/tests/test_positions.py +208 -17
  26. {architect_py-5.1.5.dist-info → architect_py-5.1.6.dist-info}/METADATA +1 -1
  27. {architect_py-5.1.5.dist-info → architect_py-5.1.6.dist-info}/RECORD +39 -29
  28. examples/external_cpty.py +2 -1
  29. examples/funding_rate_mean_reversion_algo.py +4 -4
  30. examples/order_sending.py +3 -3
  31. examples/orderflow_channel.py +75 -56
  32. examples/stream_l1_marketdata.py +3 -1
  33. examples/stream_l2_marketdata.py +3 -1
  34. examples/tutorial_async.py +3 -2
  35. examples/tutorial_sync.py +4 -3
  36. scripts/generate_functions_md.py +2 -1
  37. {architect_py-5.1.5.dist-info → architect_py-5.1.6.dist-info}/WHEEL +0 -0
  38. {architect_py-5.1.5.dist-info → architect_py-5.1.6.dist-info}/licenses/LICENSE +0 -0
  39. {architect_py-5.1.5.dist-info → architect_py-5.1.6.dist-info}/top_level.txt +0 -0
architect_py/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # ruff: noqa:I001
2
2
 
3
- __version__ = "5.1.5"
3
+ __version__ = "5.1.6"
4
4
 
5
5
  from .utils.nearest_tick import TickRoundMethod
6
6
  from .async_client import AsyncClient
@@ -21,6 +21,7 @@ from .grpc.models.definitions import (
21
21
  HealthMetric,
22
22
  HealthStatus,
23
23
  L2BookDiff,
24
+ OptionsTransaction,
24
25
  OrderId,
25
26
  OrderOut,
26
27
  OrderRejectReason,
@@ -29,6 +30,7 @@ from .grpc.models.definitions import (
29
30
  OrderStatus,
30
31
  OrderType,
31
32
  ProductCatalogInfo,
33
+ PutOrCall,
32
34
  RqdAccountStatistics,
33
35
  SortTickersBy,
34
36
  Statement,
@@ -53,7 +55,6 @@ from .grpc.models.definitions import (
53
55
  Future,
54
56
  Perpetual,
55
57
  Unknown,
56
- PutOrCall,
57
58
  SnapshotOrUpdateForStringAndProductCatalogInfo1,
58
59
  SnapshotOrUpdateForStringAndProductCatalogInfo2,
59
60
  SnapshotOrUpdateForStringAndString1,
@@ -73,8 +74,6 @@ from .grpc.models.definitions import (
73
74
  CptyLoginRequest,
74
75
  ExecutionInfo,
75
76
  Fill,
76
- OptionsContract,
77
- OptionsGreeks,
78
77
  OptionsSeriesInfo,
79
78
  OrderAck,
80
79
  OrderCanceled,
@@ -105,6 +104,8 @@ from .grpc.models.definitions import (
105
104
  )
106
105
  from .grpc.models.Accounts.AccountsRequest import AccountsRequest
107
106
  from .grpc.models.Accounts.AccountsResponse import AccountsResponse
107
+ from .grpc.models.Accounts.ResetPaperAccountRequest import ResetPaperAccountRequest
108
+ from .grpc.models.Accounts.ResetPaperAccountResponse import ResetPaperAccountResponse
108
109
  from .grpc.models.Algo.AlgoOrder import AlgoOrder
109
110
  from .grpc.models.Algo.AlgoOrderRequest import AlgoOrderRequest
110
111
  from .grpc.models.Algo.AlgoOrdersRequest import AlgoOrdersRequest
@@ -123,6 +124,8 @@ from .grpc.models.Auth.CreateJwtRequest import CreateJwtRequest
123
124
  from .grpc.models.Auth.CreateJwtResponse import CreateJwtResponse
124
125
  from .grpc.models.Boss.DepositsRequest import DepositsRequest
125
126
  from .grpc.models.Boss.DepositsResponse import DepositsResponse
127
+ from .grpc.models.Boss.OptionsTransactionsRequest import OptionsTransactionsRequest
128
+ from .grpc.models.Boss.OptionsTransactionsResponse import OptionsTransactionsResponse
126
129
  from .grpc.models.Boss.RqdAccountStatisticsRequest import RqdAccountStatisticsRequest
127
130
  from .grpc.models.Boss.RqdAccountStatisticsResponse import RqdAccountStatisticsResponse
128
131
  from .grpc.models.Boss.StatementUrlRequest import StatementUrlRequest
@@ -206,10 +209,18 @@ from .grpc.models.OptionsMarketdata.OptionsChainGreeksRequest import (
206
209
  OptionsChainGreeksRequest,
207
210
  )
208
211
  from .grpc.models.OptionsMarketdata.OptionsChainRequest import OptionsChainRequest
212
+ from .grpc.models.OptionsMarketdata.OptionsContract import OptionsContract
213
+ from .grpc.models.OptionsMarketdata.OptionsContractGreeksRequest import (
214
+ OptionsContractGreeksRequest,
215
+ )
216
+ from .grpc.models.OptionsMarketdata.OptionsContractRequest import OptionsContractRequest
209
217
  from .grpc.models.OptionsMarketdata.OptionsExpirations import OptionsExpirations
210
218
  from .grpc.models.OptionsMarketdata.OptionsExpirationsRequest import (
211
219
  OptionsExpirationsRequest,
212
220
  )
221
+ from .grpc.models.OptionsMarketdata.OptionsGreeks import OptionsGreeks
222
+ from .grpc.models.OptionsMarketdata.OptionsWraps import OptionsWraps
223
+ from .grpc.models.OptionsMarketdata.OptionsWrapsRequest import OptionsWrapsRequest
213
224
  from .grpc.models.Orderflow.Dropcopy import Dropcopy
214
225
  from .grpc.models.Orderflow.DropcopyRequest import DropcopyRequest
215
226
  from .grpc.models.Orderflow.Orderflow import Orderflow
@@ -350,12 +361,19 @@ __all__ = [
350
361
  "OptionsChainGreeksRequest",
351
362
  "OptionsChainRequest",
352
363
  "OptionsContract",
364
+ "OptionsContractGreeksRequest",
365
+ "OptionsContractRequest",
353
366
  "OptionsExerciseType",
354
367
  "OptionsExpirations",
355
368
  "OptionsExpirationsRequest",
356
369
  "OptionsGreeks",
357
370
  "OptionsSeriesInfo",
358
371
  "OptionsSeriesInstance",
372
+ "OptionsTransaction",
373
+ "OptionsTransactionsRequest",
374
+ "OptionsTransactionsResponse",
375
+ "OptionsWraps",
376
+ "OptionsWrapsRequest",
359
377
  "Order",
360
378
  "OrderAck",
361
379
  "OrderCanceled",
@@ -384,6 +402,8 @@ __all__ = [
384
402
  "PruneExpiredSymbolsRequest",
385
403
  "PruneExpiredSymbolsResponse",
386
404
  "PutOrCall",
405
+ "ResetPaperAccountRequest",
406
+ "ResetPaperAccountResponse",
387
407
  "RestartCptyRequest",
388
408
  "RestartCptyResponse",
389
409
  "RqdAccountStatistics",
@@ -146,7 +146,7 @@ class AsyncClient:
146
146
  await client.refresh_jwt()
147
147
 
148
148
  logging.info("Discovering marketdata endpoints...")
149
- await client.discover_marketdata()
149
+ await client._discover_marketdata()
150
150
 
151
151
  return client
152
152
 
@@ -260,7 +260,7 @@ class AsyncClient:
260
260
  except Exception as e:
261
261
  logging.error("Failed to refresh gRPC credentials: %s", e)
262
262
 
263
- def set_jwt(self, jwt: str | None, jwt_expiration: datetime | None = None):
263
+ def _set_jwt(self, jwt: str | None, jwt_expiration: datetime | None = None):
264
264
  """
265
265
  Manually set the JWT for gRPC authentication.
266
266
 
@@ -272,18 +272,18 @@ class AsyncClient:
272
272
  self.jwt = jwt
273
273
  self.jwt_expiration = jwt_expiration
274
274
 
275
- async def discover_marketdata(self):
275
+ async def _discover_marketdata(self):
276
276
  """
277
277
  Load marketdata endpoints from the server config.
278
278
 
279
279
  The Architect core is responsible for telling you where to find marketdata as per
280
280
  its configuration. You can also manually set marketdata endpoints by calling
281
- set_marketdata directly.
281
+ _set_marketdata directly.
282
282
 
283
283
  This method is called on AsyncClient.connect.
284
284
  """
285
285
  try:
286
- grpc_client = await self.core()
286
+ grpc_client = await self._core()
287
287
  req = ConfigRequest()
288
288
  res: ConfigResponse = await grpc_client.unary_unary(req)
289
289
  for venue, endpoint in res.marketdata.items():
@@ -329,7 +329,7 @@ class AsyncClient:
329
329
  except Exception as e:
330
330
  logging.error("Failed to set marketdata endpoint: %s", e)
331
331
 
332
- async def marketdata(self, venue: Venue) -> GrpcClient:
332
+ async def _marketdata(self, venue: Venue) -> GrpcClient:
333
333
  """
334
334
  Get the marketdata client for a venue.
335
335
  """
@@ -364,7 +364,7 @@ class AsyncClient:
364
364
  except Exception as e:
365
365
  logging.error("Failed to set hmart endpoint: %s", e)
366
366
 
367
- async def hmart(self) -> GrpcClient:
367
+ async def _hmart(self) -> GrpcClient:
368
368
  """
369
369
  Get the hmart (historical marketdata service) client.
370
370
  """
@@ -379,7 +379,7 @@ class AsyncClient:
379
379
  self.grpc_hmart.set_jwt(self.jwt)
380
380
  return self.grpc_hmart
381
381
 
382
- async def core(self) -> GrpcClient:
382
+ async def _core(self) -> GrpcClient:
383
383
  """
384
384
  Get the core client.
385
385
  """
@@ -400,8 +400,11 @@ class AsyncClient:
400
400
  res = await self.graphql_client.user_id_query()
401
401
  return res.user_id, res.user_email
402
402
 
403
- async def auth_info(self) -> AuthInfoResponse:
404
- grpc_client = await self.core()
403
+ async def _auth_info(self) -> AuthInfoResponse:
404
+ """
405
+ Gets auth info mapping
406
+ """
407
+ grpc_client = await self._core()
405
408
  req = AuthInfoRequest()
406
409
  res: AuthInfoResponse = await grpc_client.unary_unary(req)
407
410
  return res
@@ -420,7 +423,7 @@ class AsyncClient:
420
423
  """
421
424
  Get cpty status.
422
425
  """
423
- grpc_client = await self.core()
426
+ grpc_client = await self._core()
424
427
  req = CptyStatusRequest(kind=kind, instance=instance)
425
428
  res: CptyStatus = await grpc_client.unary_unary(req)
426
429
  return res
@@ -440,9 +443,9 @@ class AsyncClient:
440
443
  cross-referencing symbols or checking availability.
441
444
  """
442
445
  if marketdata is not None:
443
- grpc_client = await self.marketdata(marketdata)
446
+ grpc_client = await self._marketdata(marketdata)
444
447
  else:
445
- grpc_client = await self.core()
448
+ grpc_client = await self._core()
446
449
  req = SymbolsRequest()
447
450
  res: SymbolsResponse = await grpc_client.unary_unary(req)
448
451
  return res.symbols
@@ -487,6 +490,20 @@ class AsyncClient:
487
490
  None if the symbol does not exist
488
491
  """
489
492
  res = await self.graphql_client.get_product_info_query(symbol)
493
+ if res.product_info is None:
494
+ if "/" in symbol:
495
+ assert ValueError(
496
+ f"Product info not found for symbol: {symbol}.\n"
497
+ "for calling get_product_info, "
498
+ f"symbol {symbol} should not have a quote (ie should not end with /USD);"
499
+ "either use the base() method of TradableProduct, or remove the quote from the symbol"
500
+ )
501
+ raise ValueError(
502
+ f"Product info not found for symbol: {symbol}."
503
+ "Please ensure it is of the form 'ES 20250620 CME Future' or 'AAPL US Equity'."
504
+ "(note that Future and Equity are not completely capitalized)."
505
+ )
506
+
490
507
  return res.product_info
491
508
 
492
509
  async def get_product_infos(
@@ -629,7 +646,7 @@ class AsyncClient:
629
646
  futures.sort()
630
647
  return TradableProduct(futures[0], "USD")
631
648
  else:
632
- grpc_client = await self.marketdata(venue)
649
+ grpc_client = await self._marketdata(venue)
633
650
  req = TickersRequest(
634
651
  symbols=[TradableProduct(f"{future}/USD") for future in futures],
635
652
  k=SortTickersBy.VOLUME_DESC,
@@ -723,7 +740,7 @@ class AsyncClient:
723
740
  symbol: the symbol to get the market status for, e.g. "ES 20250321 CME Future/USD"
724
741
  venue: the venue that the symbol is traded at, e.g. CME
725
742
  """
726
- grpc_client = await self.marketdata(venue)
743
+ grpc_client = await self._marketdata(venue)
727
744
  req = MarketStatusRequest(symbol=str(symbol), venue=venue)
728
745
  res: MarketStatus = await grpc_client.unary_unary(req)
729
746
  return res
@@ -805,25 +822,17 @@ class AsyncClient:
805
822
  as_dataframe: if True, return a pandas DataFrame
806
823
 
807
824
  """
808
- grpc_client = await self.hmart()
809
- if start.tzinfo is not timezone.utc:
810
- raise ValueError(
811
- "start must be a utc datetime:\n"
812
- "for example datetime.now(timezone.utc) or \n"
813
- "dt = datetime(2025, 4, 15, 12, 0, 0, tzinfo=timezone.utc)"
814
- )
815
- if end.tzinfo is not timezone.utc:
816
- raise ValueError(
817
- "end must be a utc datetime:\n"
818
- "for example datetime.now(timezone.utc) or \n"
819
- "dt = datetime(2025, 4, 15, 12, 0, 0, tzinfo=timezone.utc)"
820
- )
825
+ grpc_client = await self._hmart()
826
+ if not start.tzinfo:
827
+ raise ValueError("start time must be timezone-aware")
828
+ if not end.tzinfo:
829
+ raise ValueError("end time must be timezone-aware")
821
830
  req = HistoricalCandlesRequest(
822
831
  venue=venue,
823
832
  symbol=str(symbol),
824
833
  candle_width=candle_width,
825
- start_date=start,
826
- end_date=end,
834
+ start_date=start.astimezone(timezone.utc),
835
+ end_date=end.astimezone(timezone.utc),
827
836
  )
828
837
  res: HistoricalCandlesResponse = await grpc_client.unary_unary(req)
829
838
 
@@ -844,7 +853,7 @@ class AsyncClient:
844
853
  symbol: the symbol to get the l1 book snapshot for
845
854
  venue: the venue that the symbol is traded at
846
855
  """
847
- grpc_client = await self.marketdata(venue)
856
+ grpc_client = await self._marketdata(venue)
848
857
  req = L1BookSnapshotRequest(symbol=str(symbol), venue=venue)
849
858
  res: L1BookSnapshot = await grpc_client.unary_unary(req)
850
859
  return res
@@ -859,7 +868,7 @@ class AsyncClient:
859
868
  symbols: the symbols to get the l1 book snapshots for
860
869
  venue: the venue that the symbols are traded at
861
870
  """
862
- grpc_client = await self.marketdata(venue)
871
+ grpc_client = await self._marketdata(venue)
863
872
  req = L1BookSnapshotsRequest(symbols=symbols)
864
873
  res: ArrayOfL1BookSnapshot = await grpc_client.unary_unary(
865
874
  req # pyright: ignore[reportArgumentType]
@@ -876,7 +885,7 @@ class AsyncClient:
876
885
  symbol: the symbol to get the l2 book snapshot for
877
886
  venue: the venue that the symbol is traded at
878
887
  """
879
- grpc_client = await self.marketdata(venue)
888
+ grpc_client = await self._marketdata(venue)
880
889
  req = L2BookSnapshotRequest(symbol=str(symbol), venue=venue)
881
890
  res: L2BookSnapshot = await grpc_client.unary_unary(req)
882
891
  return res
@@ -885,7 +894,7 @@ class AsyncClient:
885
894
  """
886
895
  Gets the ticker for a symbol.
887
896
  """
888
- grpc_client = await self.marketdata(venue)
897
+ grpc_client = await self._marketdata(venue)
889
898
  req = TickerRequest(symbol=str(symbol), venue=venue)
890
899
  res: Ticker = await grpc_client.unary_unary(req)
891
900
  return res
@@ -904,7 +913,7 @@ class AsyncClient:
904
913
  """
905
914
  Gets the tickers for a list of symbols.
906
915
  """
907
- grpc_client = await self.marketdata(venue)
916
+ grpc_client = await self._marketdata(venue)
908
917
  sort_by = SortTickersBy(sort_by) if sort_by else None
909
918
  symbols = [str(symbol) for symbol in symbols] if symbols else None
910
919
  req = TickersRequest.new(
@@ -936,7 +945,7 @@ class AsyncClient:
936
945
  If symbols=None, subscribe to all symbols available for the venue.
937
946
  venue: the venue to subscribe to
938
947
  """
939
- grpc_client = await self.marketdata(venue)
948
+ grpc_client = await self._marketdata(venue)
940
949
  req = SubscribeL1BookSnapshotsRequest(
941
950
  symbols=list(symbols),
942
951
  venue=venue,
@@ -958,7 +967,7 @@ class AsyncClient:
958
967
  symbol: the symbol to subscribe to
959
968
  venue: the marketdata venue
960
969
  """
961
- grpc_client = await self.marketdata(venue)
970
+ grpc_client = await self._marketdata(venue)
962
971
  req = SubscribeL2BookUpdatesRequest(symbol=str(symbol), venue=venue)
963
972
  async for res in grpc_client.unary_stream(
964
973
  req # pyright: ignore[reportArgumentType]
@@ -991,7 +1000,7 @@ class AsyncClient:
991
1000
  else:
992
1001
  self.l1_books[venue] = {}
993
1002
 
994
- grpc_client = await self.marketdata(venue)
1003
+ grpc_client = await self._marketdata(venue)
995
1004
  book = L1BookSnapshot(symbol, 0, 0)
996
1005
  self.l1_books[venue][symbol] = (
997
1006
  book,
@@ -1069,7 +1078,7 @@ class AsyncClient:
1069
1078
  else:
1070
1079
  self.l2_books[venue] = {}
1071
1080
 
1072
- grpc_client = await self.marketdata(venue)
1081
+ grpc_client = await self._marketdata(venue)
1073
1082
  book = L2BookSnapshot([], [], 0, 0, 0, 0)
1074
1083
  self.l2_books[venue][symbol] = (
1075
1084
  book,
@@ -1128,7 +1137,7 @@ class AsyncClient:
1128
1137
  """
1129
1138
  Subscribe to a stream of trades for a symbol.
1130
1139
  """
1131
- grpc_client = await self.marketdata(venue)
1140
+ grpc_client = await self._marketdata(venue)
1132
1141
  req = SubscribeTradesRequest(symbol=str(symbol), venue=venue)
1133
1142
  async for res in grpc_client.unary_stream(req):
1134
1143
  yield res
@@ -1142,7 +1151,7 @@ class AsyncClient:
1142
1151
  """
1143
1152
  Subscribe to a stream of candles for a symbol.
1144
1153
  """
1145
- grpc_client = await self.marketdata(venue)
1154
+ grpc_client = await self._marketdata(venue)
1146
1155
  req = SubscribeCandlesRequest(
1147
1156
  symbol=str(symbol),
1148
1157
  venue=venue,
@@ -1164,7 +1173,7 @@ class AsyncClient:
1164
1173
  a list of AccountWithPermissions for the user that the API key belongs to
1165
1174
  (use who_am_i to get the user_id / email)
1166
1175
  """
1167
- grpc_client = await self.core()
1176
+ grpc_client = await self._core()
1168
1177
  req = AccountsRequest(paper=self.paper_trading)
1169
1178
  res = await grpc_client.unary_unary(req)
1170
1179
  return res.accounts
@@ -1177,7 +1186,7 @@ class AsyncClient:
1177
1186
  account: account uuid or name
1178
1187
  Examples: "00000000-0000-0000-0000-000000000000", "STONEX:000000/JDoe"
1179
1188
  """
1180
- grpc_client = await self.core()
1189
+ grpc_client = await self._core()
1181
1190
  req = AccountSummaryRequest(account=account)
1182
1191
  res = await grpc_client.unary_unary(req)
1183
1192
  return res
@@ -1217,7 +1226,7 @@ class AsyncClient:
1217
1226
 
1218
1227
  If both arguments are given, the union of matching accounts are returned.
1219
1228
  """
1220
- grpc_client = await self.core()
1229
+ grpc_client = await self._core()
1221
1230
  request = AccountSummariesRequest(
1222
1231
  accounts=accounts,
1223
1232
  trader=trader,
@@ -1234,7 +1243,7 @@ class AsyncClient:
1234
1243
  """
1235
1244
  Get historical sequence of account summaries for the given account.
1236
1245
  """
1237
- grpc_client = await self.core()
1246
+ grpc_client = await self._core()
1238
1247
  if from_inclusive is not None:
1239
1248
  assert from_inclusive.tzinfo is timezone.utc, (
1240
1249
  "from_inclusive must be a utc datetime:\n"
@@ -1282,7 +1291,7 @@ class AsyncClient:
1282
1291
  Returns:
1283
1292
  Open orders that match the union of the filters
1284
1293
  """
1285
- grpc_client = await self.core()
1294
+ grpc_client = await self._core()
1286
1295
  open_orders_request = OpenOrdersRequest(
1287
1296
  venue=venue,
1288
1297
  account=account,
@@ -1331,7 +1340,7 @@ class AsyncClient:
1331
1340
  If order_ids is not specified, then from_inclusive and to_exclusive
1332
1341
  MUST be specified.
1333
1342
  """
1334
- grpc_client = await self.core()
1343
+ grpc_client = await self._core()
1335
1344
 
1336
1345
  if from_inclusive is not None:
1337
1346
  assert from_inclusive.tzinfo is timezone.utc, (
@@ -1372,7 +1381,7 @@ class AsyncClient:
1372
1381
  Args:
1373
1382
  order_id: the order id to get
1374
1383
  """
1375
- grpc_client = await self.core()
1384
+ grpc_client = await self._core()
1376
1385
  req = OpenOrdersRequest.new(
1377
1386
  order_ids=[order_id],
1378
1387
  )
@@ -1396,7 +1405,7 @@ class AsyncClient:
1396
1405
  Args:
1397
1406
  order_ids: a list of order ids to get
1398
1407
  """
1399
- grpc_client = await self.core()
1408
+ grpc_client = await self._core()
1400
1409
  orders_dict: dict[OrderId, Optional[Order]] = {
1401
1410
  order_id: None for order_id in order_ids
1402
1411
  }
@@ -1440,7 +1449,7 @@ class AsyncClient:
1440
1449
  account: account uuid or name
1441
1450
  order_id: the order id to get fills for
1442
1451
  """
1443
- grpc_client = await self.core()
1452
+ grpc_client = await self._core()
1444
1453
  if from_inclusive is not None:
1445
1454
  assert from_inclusive.tzinfo is timezone.utc, (
1446
1455
  "from_inclusive must be a utc datetime:\n"
@@ -1494,7 +1503,7 @@ class AsyncClient:
1494
1503
  print(event)
1495
1504
  ```
1496
1505
  """
1497
- grpc_client = await self.core()
1506
+ grpc_client = await self._core()
1498
1507
  req: SubscribeOrderflowRequest = SubscribeOrderflowRequest(
1499
1508
  account=account, execution_venue=execution_venue, trader=trader
1500
1509
  )
@@ -1564,7 +1573,7 @@ class AsyncClient:
1564
1573
  trigger_price=trigger_price,
1565
1574
  )
1566
1575
  """
1567
- grpc_client = await self.core()
1576
+ grpc_client = await self._core()
1568
1577
 
1569
1578
  res = await asyncio.gather(
1570
1579
  *[
@@ -1603,7 +1612,7 @@ class AsyncClient:
1603
1612
  symbol: the symbol to send the order for
1604
1613
  execution_venue: the execution venue to send the order to,
1605
1614
  if execution_venue is set to None, the OMS will send the order to the primary_exchange
1606
- the primary_exchange can be deduced from `get_product_info`
1615
+ the primary_exchange can be deduced from `get_product_info` (generally will be "CME" or "US-EQUITIES")
1607
1616
  dir: the direction of the order, BUY or SELL
1608
1617
  quantity: the quantity of the order
1609
1618
  limit_price: the limit price of the order
@@ -1625,7 +1634,7 @@ class AsyncClient:
1625
1634
 
1626
1635
  If the order is rejected, the order.reject_reason and order.reject_message will be set
1627
1636
  """
1628
- grpc_client = await self.core()
1637
+ grpc_client = await self._core()
1629
1638
  assert quantity > 0, "quantity must be positive"
1630
1639
 
1631
1640
  if limit_price is not None and price_round_method is not None:
@@ -1772,7 +1781,7 @@ class AsyncClient:
1772
1781
  Returns:
1773
1782
  the CancelFields object
1774
1783
  """
1775
- grpc_client = await self.core()
1784
+ grpc_client = await self._core()
1776
1785
  req = CancelOrderRequest(id=order_id)
1777
1786
  res = await grpc_client.unary_unary(req)
1778
1787
  return res
@@ -1815,7 +1824,7 @@ class AsyncClient:
1815
1824
  # res = await grpc_client.unary_unary(req)
1816
1825
  # return True
1817
1826
 
1818
- async def create_algo_order(
1827
+ async def place_algo_order(
1819
1828
  self,
1820
1829
  *,
1821
1830
  params: SpreaderParams,
@@ -1825,7 +1834,7 @@ class AsyncClient:
1825
1834
  """
1826
1835
  Sends an advanced algo order such as the spreader.
1827
1836
  """
1828
- grpc_client = await self.core()
1837
+ grpc_client = await self._core()
1829
1838
 
1830
1839
  if isinstance(params, SpreaderParams):
1831
1840
  algo = "SPREADER"
architect_py/client.pyi CHANGED
@@ -75,45 +75,14 @@ class Client:
75
75
 
76
76
  Query methods on Client that require auth will call this method internally.
77
77
  """
78
- def set_jwt(self, jwt: str | None, jwt_expiration: datetime | None = None):
79
- """
80
- Manually set the JWT for gRPC authentication.
81
-
82
- Args:
83
- jwt: the JWT to set;
84
- None to clear the JWT
85
- jwt_expiration: when to expire the JWT
86
- """
87
- def discover_marketdata(self) -> None:
88
- """
89
- Load marketdata endpoints from the server config.
90
-
91
- The Architect core is responsible for telling you where to find marketdata as per
92
- its configuration. You can also manually set marketdata endpoints by calling
93
- set_marketdata directly.
94
-
95
- This method is called on Client.connect.
96
- """
97
78
  def set_marketdata(self, venue: Venue, endpoint: str):
98
79
  """
99
80
  Manually set the marketdata endpoint for a venue.
100
81
  """
101
- def marketdata(self, venue: Venue) -> GrpcClient:
102
- """
103
- Get the marketdata client for a venue.
104
- """
105
82
  def set_hmart(self, endpoint: str):
106
83
  """
107
84
  Manually set the hmart (historical marketdata service) endpoint.
108
85
  """
109
- def hmart(self) -> GrpcClient:
110
- """
111
- Get the hmart (historical marketdata service) client.
112
- """
113
- def core(self) -> GrpcClient:
114
- """
115
- Get the core client.
116
- """
117
86
  def who_am_i(self) -> tuple[str, str]:
118
87
  """
119
88
  Gets the user_id and user_email for the user that the API key belongs to.
@@ -121,7 +90,6 @@ class Client:
121
90
  Returns:
122
91
  (user_id, user_email)
123
92
  """
124
- def auth_info(self) -> AuthInfoResponse: ...
125
93
  def cpty_status(self, kind: str, instance: str | None = None) -> CptyStatus:
126
94
  """
127
95
  Get cpty status.
@@ -509,7 +477,7 @@ class Client:
509
477
  symbol: the symbol to send the order for
510
478
  execution_venue: the execution venue to send the order to,
511
479
  if execution_venue is set to None, the OMS will send the order to the primary_exchange
512
- the primary_exchange can be deduced from `get_product_info`
480
+ the primary_exchange can be deduced from `get_product_info` (generally will be "CME" or "US-EQUITIES")
513
481
  dir: the direction of the order, BUY or SELL
514
482
  quantity: the quantity of the order
515
483
  limit_price: the limit price of the order
@@ -569,7 +537,7 @@ class Client:
569
537
  True if all orders were cancelled successfully
570
538
  False if there was an error
571
539
  """
572
- def create_algo_order(self, *, params: SpreaderParams, id: str | None = None, trader: str | None = None):
540
+ def place_algo_order(self, *, params: SpreaderParams, id: str | None = None, trader: str | None = None):
573
541
  """
574
542
  Sends an advanced algo order such as the spreader.
575
543
  """
@@ -0,0 +1,59 @@
1
+ # generated by datamodel-codegen:
2
+ # filename: Accounts/ResetPaperAccountRequest.json
3
+
4
+ from __future__ import annotations
5
+ from architect_py.grpc.models.Accounts.ResetPaperAccountResponse import (
6
+ ResetPaperAccountResponse,
7
+ )
8
+
9
+ from typing import Annotated, Optional
10
+
11
+ from msgspec import Meta, Struct
12
+
13
+ from .. import definitions
14
+
15
+
16
+ class ResetPaperAccountRequest(Struct, omit_defaults=True):
17
+ account: Annotated[
18
+ definitions.AccountIdOrName,
19
+ Meta(
20
+ description="The trader for whom to reset paper accounts. If not specified, defaults to the caller user."
21
+ ),
22
+ ]
23
+ """
24
+ The trader for whom to reset paper accounts. If not specified, defaults to the caller user.
25
+ """
26
+ balance: Optional[int] = None
27
+
28
+ # Constructor that takes all field titles as arguments for convenience
29
+ @classmethod
30
+ def new(
31
+ cls,
32
+ account: definitions.AccountIdOrName,
33
+ balance: Optional[int] = None,
34
+ ):
35
+ return cls(
36
+ account,
37
+ balance,
38
+ )
39
+
40
+ def __str__(self) -> str:
41
+ return (
42
+ f"ResetPaperAccountRequest(account={self.account},balance={self.balance})"
43
+ )
44
+
45
+ @staticmethod
46
+ def get_response_type():
47
+ return ResetPaperAccountResponse
48
+
49
+ @staticmethod
50
+ def get_unannotated_response_type():
51
+ return ResetPaperAccountResponse
52
+
53
+ @staticmethod
54
+ def get_route() -> str:
55
+ return "/json.architect.Accounts/ResetPaperAccount"
56
+
57
+ @staticmethod
58
+ def get_rpc_method():
59
+ return "unary"
@@ -0,0 +1,20 @@
1
+ # generated by datamodel-codegen:
2
+ # filename: Accounts/ResetPaperAccountResponse.json
3
+
4
+ from __future__ import annotations
5
+
6
+ from msgspec import Struct
7
+
8
+
9
+ class ResetPaperAccountResponse(Struct, omit_defaults=True):
10
+ pass
11
+
12
+ # Constructor that takes all field titles as arguments for convenience
13
+ @classmethod
14
+ def new(
15
+ cls,
16
+ ):
17
+ return cls()
18
+
19
+ def __str__(self) -> str:
20
+ return f"ResetPaperAccountResponse()"