architect-py 5.1.5__py3-none-any.whl → 5.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- architect_py/__init__.py +24 -4
- architect_py/async_client.py +66 -57
- architect_py/async_cpty.py +422 -0
- architect_py/client.pyi +2 -34
- architect_py/grpc/models/Accounts/ResetPaperAccountRequest.py +59 -0
- architect_py/grpc/models/Accounts/ResetPaperAccountResponse.py +20 -0
- architect_py/grpc/models/Boss/OptionsTransactionsRequest.py +42 -0
- architect_py/grpc/models/Boss/OptionsTransactionsResponse.py +27 -0
- architect_py/grpc/models/OptionsMarketdata/OptionsChain.py +5 -5
- architect_py/grpc/models/OptionsMarketdata/OptionsChainGreeks.py +5 -5
- architect_py/grpc/models/OptionsMarketdata/OptionsChainGreeksRequest.py +5 -1
- architect_py/grpc/models/OptionsMarketdata/OptionsChainRequest.py +5 -1
- architect_py/grpc/models/OptionsMarketdata/OptionsContract.py +45 -0
- architect_py/grpc/models/OptionsMarketdata/OptionsContractGreeksRequest.py +40 -0
- architect_py/grpc/models/OptionsMarketdata/OptionsContractRequest.py +40 -0
- architect_py/grpc/models/OptionsMarketdata/OptionsExpirations.py +4 -1
- architect_py/grpc/models/OptionsMarketdata/OptionsExpirationsRequest.py +8 -1
- architect_py/grpc/models/OptionsMarketdata/OptionsGreeks.py +58 -0
- architect_py/grpc/models/OptionsMarketdata/OptionsWraps.py +28 -0
- architect_py/grpc/models/OptionsMarketdata/OptionsWrapsRequest.py +40 -0
- architect_py/grpc/models/__init__.py +11 -1
- architect_py/grpc/models/definitions.py +37 -86
- architect_py/grpc/orderflow.py +3 -7
- architect_py/grpc/server.py +1 -3
- architect_py/tests/test_order_entry.py +120 -1
- architect_py/tests/test_positions.py +208 -17
- {architect_py-5.1.5.dist-info → architect_py-5.2.0.dist-info}/METADATA +1 -1
- {architect_py-5.1.5.dist-info → architect_py-5.2.0.dist-info}/RECORD +41 -30
- examples/external_cpty.py +72 -66
- examples/funding_rate_mean_reversion_algo.py +4 -4
- examples/order_sending.py +3 -3
- examples/orderflow_channel.py +75 -56
- examples/stream_l1_marketdata.py +3 -1
- examples/stream_l2_marketdata.py +3 -1
- examples/tutorial_async.py +3 -2
- examples/tutorial_sync.py +4 -3
- scripts/add_imports_to_inits.py +6 -2
- scripts/generate_functions_md.py +2 -1
- {architect_py-5.1.5.dist-info → architect_py-5.2.0.dist-info}/WHEEL +0 -0
- {architect_py-5.1.5.dist-info → architect_py-5.2.0.dist-info}/licenses/LICENSE +0 -0
- {architect_py-5.1.5.dist-info → architect_py-5.2.0.dist-info}/top_level.txt +0 -0
architect_py/__init__.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ruff: noqa:I001
|
2
2
|
|
3
|
-
__version__ = "5.
|
3
|
+
__version__ = "5.2.0"
|
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",
|
architect_py/async_client.py
CHANGED
@@ -146,7 +146,7 @@ class AsyncClient:
|
|
146
146
|
await client.refresh_jwt()
|
147
147
|
|
148
148
|
logging.info("Discovering marketdata endpoints...")
|
149
|
-
await client.
|
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
|
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
|
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
|
-
|
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.
|
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
|
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
|
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
|
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
|
404
|
-
|
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.
|
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.
|
446
|
+
grpc_client = await self._marketdata(marketdata)
|
444
447
|
else:
|
445
|
-
grpc_client = await self.
|
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.
|
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.
|
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.
|
809
|
-
if start.tzinfo
|
810
|
-
raise ValueError(
|
811
|
-
|
812
|
-
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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
|
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.
|
1837
|
+
grpc_client = await self._core()
|
1829
1838
|
|
1830
1839
|
if isinstance(params, SpreaderParams):
|
1831
1840
|
algo = "SPREADER"
|