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.
- architect_py/__init__.py +24 -4
- architect_py/async_client.py +66 -57
- 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.1.6.dist-info}/METADATA +1 -1
- {architect_py-5.1.5.dist-info → architect_py-5.1.6.dist-info}/RECORD +39 -29
- examples/external_cpty.py +2 -1
- 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/generate_functions_md.py +2 -1
- {architect_py-5.1.5.dist-info → architect_py-5.1.6.dist-info}/WHEEL +0 -0
- {architect_py-5.1.5.dist-info → architect_py-5.1.6.dist-info}/licenses/LICENSE +0 -0
- {architect_py-5.1.5.dist-info → architect_py-5.1.6.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
|
|
1
|
-
architect_py/__init__.py,sha256=
|
2
|
-
architect_py/async_client.py,sha256
|
1
|
+
architect_py/__init__.py,sha256=mDbb3T4q4aa1yVWg8pjOgE7xsBUbwTLxR9RjaTWNpcw,17760
|
2
|
+
architect_py/async_client.py,sha256=-8SotKjmDwDaM5yVw7PF4NT8lKk9A1DAnN5gywwehWc,66378
|
3
3
|
architect_py/client.py,sha256=y8w17ZLo_Y2-knH-46qqVGlSJyQHB9qwOPodI9pzN-Q,5192
|
4
|
-
architect_py/client.pyi,sha256=
|
4
|
+
architect_py/client.pyi,sha256=9GFL2Ei4Q6YUf-en6Z7kWJhdO-ayeKfT4VS_Yt2W4lA,25093
|
5
5
|
architect_py/common_types/__init__.py,sha256=fzOdIlKGWVN9V2Onc5z1v2bpvtZ4H9RSFA9ymJcBi3k,197
|
6
6
|
architect_py/common_types/order_dir.py,sha256=ebyWTcXzJWrotkc2D9wNGc6JXbE5I3NLLuAz3I7FTZ8,2191
|
7
7
|
architect_py/common_types/time_in_force.py,sha256=gEDYcNp014Eeb98zJDytiV0hGxHu_QsQndeM6Hk0Wa8,3132
|
@@ -24,14 +24,16 @@ architect_py/graphql_client/search_symbols_query.py,sha256=hbGa6gF-gMWtRYQm2vlCT
|
|
24
24
|
architect_py/graphql_client/user_id_query.py,sha256=tWKJJLgEINzd8e7rYlGklQCnwcwHzYFpCGQvhxQGX20,334
|
25
25
|
architect_py/grpc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
26
26
|
architect_py/grpc/client.py,sha256=qoH-bb-sDjoDlYYmByQVbzYBbCimFY_AmoOLEBDxEtA,4096
|
27
|
-
architect_py/grpc/orderflow.py,sha256=
|
27
|
+
architect_py/grpc/orderflow.py,sha256=4ZvJeiFsD9We8pmiWcGYp003NKapcyhr0KbYCBxSX38,4732
|
28
28
|
architect_py/grpc/resolve_endpoint.py,sha256=r_PBWANIJJ47N5uyPcnefZ21ZE1-mzgACfCBfQpekg8,2621
|
29
|
-
architect_py/grpc/server.py,sha256=
|
29
|
+
architect_py/grpc/server.py,sha256=f-LOSFry40U1a8iHUEAb2JOgIk7NorGC3UbbRk4MUe0,1888
|
30
30
|
architect_py/grpc/utils.py,sha256=5sykLExUNZbcQHcxLCCM9DdOOiJJZcpputGrDtaMifY,667
|
31
|
-
architect_py/grpc/models/__init__.py,sha256=
|
32
|
-
architect_py/grpc/models/definitions.py,sha256=
|
31
|
+
architect_py/grpc/models/__init__.py,sha256=mhtKrrIgjgLZu6JdcgXRNwS4BURm9tWcq9FB_BbIW0U,10325
|
32
|
+
architect_py/grpc/models/definitions.py,sha256=pT1S_f6nO3-OE9Lp6L5hT3w7PFf4yJOgiHq1Yu_v7oU,81615
|
33
33
|
architect_py/grpc/models/Accounts/AccountsRequest.py,sha256=1a88cltSebOb53EdJ0hKEGR7FlmBiibrCtGzLTKqDBY,1524
|
34
34
|
architect_py/grpc/models/Accounts/AccountsResponse.py,sha256=DlXbkd3UbRybblBAfokw-K6nRvLNZgqz7cc0EKiW1zI,636
|
35
|
+
architect_py/grpc/models/Accounts/ResetPaperAccountRequest.py,sha256=PmoU9SPYWSwnD-hEOE3rkJeiRZyQ2k7LT4JYn5Fl6dM,1544
|
36
|
+
architect_py/grpc/models/Accounts/ResetPaperAccountResponse.py,sha256=-49so1Qxl-9QIRByiZ9gj-md3mt-S5oyiuy3vgolCZY,449
|
35
37
|
architect_py/grpc/models/Accounts/__init__.py,sha256=sIyaEvJdP-VmGTGPPqZuRjKn4bc7NUClJ76Gd5uq-5s,57
|
36
38
|
architect_py/grpc/models/Algo/AlgoOrder.py,sha256=ugkS9xU4ujHW3PcZpCKThw76NNkUDNakCVMf3ZnmPMw,3892
|
37
39
|
architect_py/grpc/models/Algo/AlgoOrderRequest.py,sha256=uDqxNv6vKxtkrXyO_8l1kOtVkqEsppq-wCupawmEde8,1022
|
@@ -54,6 +56,8 @@ architect_py/grpc/models/Auth/CreateJwtResponse.py,sha256=G1rsG7f4gMiWK4WVxTZMzF
|
|
54
56
|
architect_py/grpc/models/Auth/__init__.py,sha256=sIyaEvJdP-VmGTGPPqZuRjKn4bc7NUClJ76Gd5uq-5s,57
|
55
57
|
architect_py/grpc/models/Boss/DepositsRequest.py,sha256=DFf4InRz52RQt4tGrbHsDyb_9iyCNFFbQYJL922nNs4,922
|
56
58
|
architect_py/grpc/models/Boss/DepositsResponse.py,sha256=_qJvMEu9MAw-mreuRpUkbHMo7D_vSVJru_HZV2BYPmA,602
|
59
|
+
architect_py/grpc/models/Boss/OptionsTransactionsRequest.py,sha256=liTzqt4kPqZuaK4ajytdWjrWBYPGCyDyX8sbLIz1Z1k,1019
|
60
|
+
architect_py/grpc/models/Boss/OptionsTransactionsResponse.py,sha256=SKVi8OiGJyAWM-wsI3yStBTrGIh2DpwfyI6J5xAolCI,717
|
57
61
|
architect_py/grpc/models/Boss/RqdAccountStatisticsRequest.py,sha256=gp51kcbU-9Iv_7TG-jcIN2owg9NIJDxFl755TJVk2TM,1027
|
58
62
|
architect_py/grpc/models/Boss/RqdAccountStatisticsResponse.py,sha256=6eXUsphh7MwLrGsIq3nt2jRaIrGNozbZy22Fr5uRvww,697
|
59
63
|
architect_py/grpc/models/Boss/StatementUrlRequest.py,sha256=ffOWj7p_lMX9X7s3uB8PnH6hxFUnsHnjoQqu0hchnn8,974
|
@@ -128,12 +132,18 @@ architect_py/grpc/models/Oms/PendingCancelsRequest.py,sha256=jdbBOpCHBlZFAZfF6ur
|
|
128
132
|
architect_py/grpc/models/Oms/PendingCancelsResponse.py,sha256=mWRNRDa489Vdg-r7dJMOmfOO8l57yg8lBMynBDcY60A,628
|
129
133
|
architect_py/grpc/models/Oms/PlaceOrderRequest.py,sha256=DDMkKgsqWVlMhUeidxTlVDHyNdeuPLu29PUwOTd0ijo,9320
|
130
134
|
architect_py/grpc/models/Oms/__init__.py,sha256=sIyaEvJdP-VmGTGPPqZuRjKn4bc7NUClJ76Gd5uq-5s,57
|
131
|
-
architect_py/grpc/models/OptionsMarketdata/OptionsChain.py,sha256=
|
132
|
-
architect_py/grpc/models/OptionsMarketdata/OptionsChainGreeks.py,sha256=
|
133
|
-
architect_py/grpc/models/OptionsMarketdata/OptionsChainGreeksRequest.py,sha256=
|
134
|
-
architect_py/grpc/models/OptionsMarketdata/OptionsChainRequest.py,sha256=
|
135
|
-
architect_py/grpc/models/OptionsMarketdata/
|
136
|
-
architect_py/grpc/models/OptionsMarketdata/
|
135
|
+
architect_py/grpc/models/OptionsMarketdata/OptionsChain.py,sha256=r9vvRUjxNaWz1fIn2ysTQ7A6tLVfetCLuQfrBLqWZY8,702
|
136
|
+
architect_py/grpc/models/OptionsMarketdata/OptionsChainGreeks.py,sha256=Nkn6dgzQAjU6ADgb-yUGDDn_oeD_pj82mV-KBvtwYMM,708
|
137
|
+
architect_py/grpc/models/OptionsMarketdata/OptionsChainGreeksRequest.py,sha256=uhJ4mSniTdyaC5KkrltIVu0BzMFrBu5qTzIIiOY5Lhs,1275
|
138
|
+
architect_py/grpc/models/OptionsMarketdata/OptionsChainRequest.py,sha256=iHbFPyhQMeW92Thcp_zU9ycI3rf4J62YktHfj_pC6hU,1218
|
139
|
+
architect_py/grpc/models/OptionsMarketdata/OptionsContract.py,sha256=umqW3PZV5jj5oNxtNxP3AV5r4iCNJWf5RVZ5bC-CrAg,1228
|
140
|
+
architect_py/grpc/models/OptionsMarketdata/OptionsContractGreeksRequest.py,sha256=lBGX7qJGCrpVffHrRLid40BkvL_adK7R0EHwuH2vtWo,1031
|
141
|
+
architect_py/grpc/models/OptionsMarketdata/OptionsContractRequest.py,sha256=LvrzB4nzkqncNGw2srSoWLw7STFvsZpl6EBd5_5Ilag,1015
|
142
|
+
architect_py/grpc/models/OptionsMarketdata/OptionsExpirations.py,sha256=zNnkv5n7sv57HOGmonf5K32aUE_GSBT_fOOZj1JkIcg,770
|
143
|
+
architect_py/grpc/models/OptionsMarketdata/OptionsExpirationsRequest.py,sha256=KDy9y_ibfzJndz8ZRYvxTcTP7bsgBBJyWeWaqTJMc4w,1173
|
144
|
+
architect_py/grpc/models/OptionsMarketdata/OptionsGreeks.py,sha256=Po3KRAtw7l8BwH1-HNs28vq8vMRaX_ekHN-SgfEXzp8,1541
|
145
|
+
architect_py/grpc/models/OptionsMarketdata/OptionsWraps.py,sha256=24ik_f_CQVv8tRohAd-XDyOllXftCByw9erprnkN-zE,626
|
146
|
+
architect_py/grpc/models/OptionsMarketdata/OptionsWrapsRequest.py,sha256=anfBQxFEtEIYehr7ektSZVUKH7ZyNeLPD6yt9nTp3p0,961
|
137
147
|
architect_py/grpc/models/OptionsMarketdata/__init__.py,sha256=sIyaEvJdP-VmGTGPPqZuRjKn4bc7NUClJ76Gd5uq-5s,57
|
138
148
|
architect_py/grpc/models/Orderflow/Dropcopy.py,sha256=hjcGXX1V-pWJNjirLW2a2-oLbb9WUw_h1nhFh-hPthM,621
|
139
149
|
architect_py/grpc/models/Orderflow/DropcopyRequest.py,sha256=LPJgD2wj4a7p1s8O32q6w7lU_pm4I2lqriPdLqyimUM,1831
|
@@ -163,10 +173,10 @@ architect_py/tests/conftest.py,sha256=XCeq44muZi6i9CxOe9lH7rCmt5pQViWJ_25gSowrLP
|
|
163
173
|
architect_py/tests/test_book_building.py,sha256=biqs8X9bw1YSb6mrCDS-ELesdD-P5F6bE3MYXP0BeQ4,1236
|
164
174
|
architect_py/tests/test_encoding.py,sha256=J61Lk2CDIqgdcsj0-KYBZweYh5EQ4XAXsRyM0fdMqfU,1085
|
165
175
|
architect_py/tests/test_marketdata.py,sha256=W26OrL51ONAclBjBcm7trS1QPXtLLjdgnsbDR2kqtIw,4963
|
166
|
-
architect_py/tests/test_order_entry.py,sha256=
|
176
|
+
architect_py/tests/test_order_entry.py,sha256=Jhot92d8nOg7gq-W99hKlABIBBbFJ7OIYSGYyiogfto,5069
|
167
177
|
architect_py/tests/test_orderflow.py,sha256=b4iohhs7YUoJMevlUfLQyIoVqjam7pl0BPs0dSfZhqM,3951
|
168
178
|
architect_py/tests/test_portfolio_management.py,sha256=Q4pburTDJ53hrq2_aRbNAOG3nwbCEsgZQGbI_AMHLxE,709
|
169
|
-
architect_py/tests/test_positions.py,sha256=
|
179
|
+
architect_py/tests/test_positions.py,sha256=fXtFs9xYJoS_BIRBfq4V_DZDYq3zANLfEQS0jY_EiEo,12551
|
170
180
|
architect_py/tests/test_rounding.py,sha256=qjuPIdX6TbfPtfrzotZx6-Aodf4et7j3AswgQ7DQtm4,1363
|
171
181
|
architect_py/tests/test_symbology.py,sha256=74fbUgoycuViMHHnurE2Dnfao75wWu_cmQMyU5XQcdY,3436
|
172
182
|
architect_py/tests/test_sync_client.py,sha256=teaHrp-CMpKIDsGPdnyxvmuW_a3hgFftnsnPsFHz9Tw,946
|
@@ -176,31 +186,31 @@ architect_py/utils/orderbook.py,sha256=JM02NhHbmK3sNaS2Ara8FBY4TvKvtMIzJW1oVd8KC
|
|
176
186
|
architect_py/utils/pandas.py,sha256=Jyiimf6Y5FbTLotUhSIgOnRHMGz7ZvAqNSCHEwZ9eQU,2599
|
177
187
|
architect_py/utils/price_bands.py,sha256=j7ioSA3dx025CD5E2Vg7XQvmjPvxQb-gzQBfQTovpTw,21874
|
178
188
|
architect_py/utils/symbol_parsing.py,sha256=OjJzk2c6QU2s0aJMSyVEzlWD5Vy-RlakJVW7jNHVDJk,845
|
179
|
-
architect_py-5.1.
|
189
|
+
architect_py-5.1.6.dist-info/licenses/LICENSE,sha256=6P0_5gYN8iPWPZeqA9nxiO3tRQmcSA1ijAVR7C8j1SI,11362
|
180
190
|
examples/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
181
191
|
examples/book_subscription.py,sha256=1WFQN_QCE8cRS_CIv2k0NxqpK37fA9-Ja2Kfxs8vsb8,1461
|
182
192
|
examples/candles.py,sha256=T71TsxbfXCT6mrJZmTgdTKesJFdQhYP_4AsiNK-8KyQ,756
|
183
193
|
examples/config.py,sha256=rv6x7QYJO6ckvpRcwghyJbkL_lTBPnK0u6nKgkYTvxQ,1858
|
184
|
-
examples/external_cpty.py,sha256=
|
185
|
-
examples/funding_rate_mean_reversion_algo.py,sha256=
|
186
|
-
examples/order_sending.py,sha256=
|
187
|
-
examples/orderflow_channel.py,sha256=
|
194
|
+
examples/external_cpty.py,sha256=x2VzR6Z14NqYku4l75o0hTvkAsOMUTtRWL37XUjJQyY,2576
|
195
|
+
examples/funding_rate_mean_reversion_algo.py,sha256=ZAr16v_sP2egcRx1jzl2DxKa66XTgopl8ot30rDx4gc,5650
|
196
|
+
examples/order_sending.py,sha256=kHeXPDyWSjakGYT6ldO8aCw02Kzh6WG_bdHzeAUBUyE,3302
|
197
|
+
examples/orderflow_channel.py,sha256=nAvF1T12wpm2pDvdCQ2QtLWGQiBv3_uBSi97CfC0AzY,2270
|
188
198
|
examples/orderflow_streaming.py,sha256=BtVwCYWBCpytaAFN9u2WPgGCugyNMsGa6nA1dPWuVLs,1300
|
189
|
-
examples/stream_l1_marketdata.py,sha256=
|
190
|
-
examples/stream_l2_marketdata.py,sha256=
|
199
|
+
examples/stream_l1_marketdata.py,sha256=Ojbk0q7A2daPnwqTWSypVoLep9B_eumXuwEH4PbA-fA,781
|
200
|
+
examples/stream_l2_marketdata.py,sha256=lVZsLUJYAPYUpp0voryye2WFZkCzYWVLfb-T4XQ0_Bs,1144
|
191
201
|
examples/termutils.py,sha256=ZZrky5Ftn4UoLPKGffGvUl1Z8CtvDoNjEtUH4S1a_KY,1133
|
192
202
|
examples/trades.py,sha256=0OzWQVTuIrC0KlisY0Tc-3pmWNP0m0-eCSntCV6Qdh8,561
|
193
|
-
examples/tutorial_async.py,sha256=
|
194
|
-
examples/tutorial_sync.py,sha256=
|
203
|
+
examples/tutorial_async.py,sha256=CB_VOOqeYp4Q9vJpmtZeaalQdLgm8yfFu9309P1QnX8,2684
|
204
|
+
examples/tutorial_sync.py,sha256=SAUhpR8z1sqjs6q7sse7X0trjdS3-SqhHyrIutcWRsY,2889
|
195
205
|
scripts/add_imports_to_inits.py,sha256=bryhz6RpKAJsSieVMnXnRyLp8evNkpOsNUkBUPkk1WQ,4518
|
196
206
|
scripts/correct_sync_interface.py,sha256=gTSJLDAT8s-ayN_JqgKbeM6c3DYZOapduS_GIqrvD-A,4134
|
197
|
-
scripts/generate_functions_md.py,sha256
|
207
|
+
scripts/generate_functions_md.py,sha256=X0eS3Htbn3V15qJb6kT19bVHDZaUSGOzXi38k7dazDQ,6261
|
198
208
|
scripts/postprocess_grpc.py,sha256=1A8HCMG3aBAJaORlBTaYyADow8LOcm2EVeRm0xlF0Gc,23606
|
199
209
|
scripts/preprocess_grpc_schema.py,sha256=p9LdoMZzixBSsVx7Dy3_8uJzOy_QwCoVMkAABQKUsBA,22894
|
200
210
|
scripts/prune_graphql_schema.py,sha256=hmfw5FD_iKGKMFkq6H1neZiXXtljFFrOwi2fiusTWE4,6210
|
201
211
|
templates/exceptions.py,sha256=tIHbiO5Q114h9nPwJXsgHvW_bERLwxuNp9Oj41p6t3A,2379
|
202
212
|
templates/juniper_base_client.py,sha256=B8QF4IFSwqBK5UY2aFPbSdYnX9bcwnlxLK4ojPRaW0E,12705
|
203
|
-
architect_py-5.1.
|
204
|
-
architect_py-5.1.
|
205
|
-
architect_py-5.1.
|
206
|
-
architect_py-5.1.
|
213
|
+
architect_py-5.1.6.dist-info/METADATA,sha256=ALcL23Bc3hkkg7Cf6T4cXSUng_ADZ1CCKjTUJv-DQeA,2638
|
214
|
+
architect_py-5.1.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
215
|
+
architect_py-5.1.6.dist-info/top_level.txt,sha256=UjtO97OACFQ9z5MzS-X2wBlt5Ovk1vxakQPKfokI454,40
|
216
|
+
architect_py-5.1.6.dist-info/RECORD,,
|
examples/external_cpty.py
CHANGED
@@ -58,7 +58,8 @@ class MockCptyServicer(CptyServicer, OrderflowServicer):
|
|
58
58
|
def SubscribeOrderflow(self, request, context):
|
59
59
|
context.set_code(grpc.StatusCode.OK)
|
60
60
|
context.send_initial_metadata({})
|
61
|
-
|
61
|
+
print("client subscribed to orderflow")
|
62
|
+
time.sleep(1000)
|
62
63
|
|
63
64
|
|
64
65
|
def serve():
|
@@ -151,14 +151,14 @@ async def print_info(c: AsyncClient):
|
|
151
151
|
async def main():
|
152
152
|
c = await connect_async_client()
|
153
153
|
|
154
|
-
|
155
|
-
await
|
154
|
+
orderflow_channel = await c.orderflow()
|
155
|
+
await orderflow_channel.start()
|
156
156
|
|
157
157
|
await asyncio.gather(
|
158
158
|
update_marketdata(c),
|
159
|
-
step_to_target_position(c,
|
159
|
+
step_to_target_position(c, orderflow_channel),
|
160
160
|
print_info(c),
|
161
|
-
subscribe_and_print_orderflow(c,
|
161
|
+
subscribe_and_print_orderflow(c, orderflow_channel),
|
162
162
|
)
|
163
163
|
await c.close()
|
164
164
|
|
examples/order_sending.py
CHANGED
@@ -22,7 +22,7 @@ async def search_symbol(c: AsyncClient) -> tuple[str, TradableProduct]:
|
|
22
22
|
async def test_send_order(client: AsyncClient, account: str):
|
23
23
|
venue, symbol = await search_symbol(client)
|
24
24
|
|
25
|
-
snapshot = await client.
|
25
|
+
snapshot = await client.get_l1_book_snapshot(symbol=symbol, venue=venue)
|
26
26
|
if snapshot is None:
|
27
27
|
return ValueError(f"Market snapshot for {symbol} is None")
|
28
28
|
|
@@ -34,7 +34,7 @@ async def test_send_order(client: AsyncClient, account: str):
|
|
34
34
|
d = datetime.now(tz=timezone.utc) + timedelta(days=1)
|
35
35
|
gtd = TimeInForce.GTD(d)
|
36
36
|
|
37
|
-
order = await client.
|
37
|
+
order = await client.place_order(
|
38
38
|
symbol=symbol,
|
39
39
|
dir=OrderDir.BUY,
|
40
40
|
quantity=best_bid_quantity,
|
@@ -82,7 +82,7 @@ async def send_NQ_buy_for_mid(client: AsyncClient, account: str):
|
|
82
82
|
if snapshot is None or snapshot.best_ask is None or snapshot.best_bid is None:
|
83
83
|
return ValueError(f"Market snapshot for {NQ_lead_future} is None")
|
84
84
|
|
85
|
-
order = await client.
|
85
|
+
order = await client.place_order(
|
86
86
|
symbol=NQ_lead_future,
|
87
87
|
dir=OrderDir.BUY,
|
88
88
|
quantity=Decimal(1),
|
examples/orderflow_channel.py
CHANGED
@@ -1,56 +1,75 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
#
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
1
|
+
"""
|
2
|
+
Example of using a bidirectional orderflow channel with the Architect OEMS.
|
3
|
+
|
4
|
+
This connection style is ~equivalent to having a websocket.
|
5
|
+
|
6
|
+
This code example sends a series of orders to Architect while concurrently
|
7
|
+
listening to orderflow events. Compare to `examples/orderflow_streaming.py`,
|
8
|
+
which accomplishes the same thing but using a separate asyncio task.
|
9
|
+
|
10
|
+
|
11
|
+
See funding_rate_mean_reversion_algo.py for a more complete example of
|
12
|
+
using the orderflow channel to implement a trading strategy.
|
13
|
+
"""
|
14
|
+
|
15
|
+
import asyncio
|
16
|
+
from decimal import Decimal
|
17
|
+
|
18
|
+
from architect_py import (
|
19
|
+
AsyncClient,
|
20
|
+
OrderDir,
|
21
|
+
OrderType,
|
22
|
+
TimeInForce,
|
23
|
+
)
|
24
|
+
from architect_py.grpc.orderflow import OrderflowChannel, PlaceOrder
|
25
|
+
|
26
|
+
from .config import connect_async_client
|
27
|
+
|
28
|
+
|
29
|
+
async def send_orders(client: AsyncClient, orderflow_channel: OrderflowChannel):
|
30
|
+
symbol = await client.get_front_future("ES CME Futures")
|
31
|
+
print(f"symbol={symbol}")
|
32
|
+
|
33
|
+
while True:
|
34
|
+
await asyncio.sleep(1)
|
35
|
+
snap = await client.get_l1_book_snapshot(symbol, "CME")
|
36
|
+
if snap.best_ask is not None:
|
37
|
+
limit_price = snap.best_ask[0]
|
38
|
+
print(f"\nPlacing buy order at {limit_price}\n")
|
39
|
+
try:
|
40
|
+
# can also CancelOrder
|
41
|
+
req = PlaceOrder.new(
|
42
|
+
symbol=symbol,
|
43
|
+
execution_venue="CME",
|
44
|
+
dir=OrderDir.BUY,
|
45
|
+
quantity=Decimal(1),
|
46
|
+
limit_price=limit_price,
|
47
|
+
post_only=True,
|
48
|
+
time_in_force=TimeInForce.DAY,
|
49
|
+
order_type=OrderType.LIMIT,
|
50
|
+
)
|
51
|
+
print(f"req={req}")
|
52
|
+
await orderflow_channel.send(req)
|
53
|
+
except Exception as e:
|
54
|
+
print(f"Error placing order: {e}")
|
55
|
+
else:
|
56
|
+
print("\nNo ask price from snapshot, doing nothing\n")
|
57
|
+
|
58
|
+
|
59
|
+
async def read_events(orderflow_channel: OrderflowChannel):
|
60
|
+
async for event in orderflow_channel:
|
61
|
+
print(f" --> {event}")
|
62
|
+
|
63
|
+
|
64
|
+
async def main():
|
65
|
+
client = await connect_async_client()
|
66
|
+
|
67
|
+
orderflow_channel = await client.orderflow()
|
68
|
+
|
69
|
+
await asyncio.gather(
|
70
|
+
send_orders(client, orderflow_channel),
|
71
|
+
read_events(orderflow_channel),
|
72
|
+
)
|
73
|
+
|
74
|
+
|
75
|
+
asyncio.run(main())
|
examples/stream_l1_marketdata.py
CHANGED
@@ -8,8 +8,10 @@ from .config import connect_async_client
|
|
8
8
|
async def main():
|
9
9
|
c: AsyncClient = await connect_async_client()
|
10
10
|
|
11
|
+
ES_front_future = await c.get_front_future("ES CME Futures")
|
12
|
+
|
11
13
|
async for snap in c.stream_l1_book_snapshots(
|
12
|
-
symbols=[TradableProduct(
|
14
|
+
symbols=[TradableProduct(ES_front_future)],
|
13
15
|
venue="CME",
|
14
16
|
):
|
15
17
|
best_bid_s = "<no bid>"
|
examples/stream_l2_marketdata.py
CHANGED
@@ -29,7 +29,9 @@ async def print_l2_book(c: AsyncClient, symbol: TradableProduct, venue: str):
|
|
29
29
|
|
30
30
|
async def main():
|
31
31
|
c: AsyncClient = await connect_async_client()
|
32
|
-
|
32
|
+
|
33
|
+
ES_front_future = await c.get_front_future("ES CME Futures")
|
34
|
+
market_symbol = TradableProduct(ES_front_future)
|
33
35
|
venue = "CME"
|
34
36
|
await print_l2_book(c, market_symbol, venue=venue)
|
35
37
|
|
examples/tutorial_async.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import asyncio
|
2
2
|
from decimal import Decimal
|
3
3
|
|
4
|
-
from architect_py import OrderDir, OrderStatus, TradableProduct
|
4
|
+
from architect_py import OrderDir, OrderStatus, OrderType, TradableProduct
|
5
5
|
|
6
6
|
from .config import connect_async_client
|
7
7
|
|
@@ -47,10 +47,11 @@ async def main():
|
|
47
47
|
)
|
48
48
|
== "y"
|
49
49
|
):
|
50
|
-
order = await c.
|
50
|
+
order = await c.place_order(
|
51
51
|
symbol=market,
|
52
52
|
execution_venue=execution_venue,
|
53
53
|
dir=OrderDir.BUY,
|
54
|
+
order_type=OrderType.LIMIT,
|
54
55
|
quantity=quantity,
|
55
56
|
limit_price=limit_price,
|
56
57
|
account=str(account_id),
|
examples/tutorial_sync.py
CHANGED
@@ -2,7 +2,7 @@ import pprint
|
|
2
2
|
import time
|
3
3
|
from decimal import Decimal
|
4
4
|
|
5
|
-
from architect_py import OrderDir, OrderStatus
|
5
|
+
from architect_py import OrderDir, OrderStatus, OrderType
|
6
6
|
from architect_py.utils.nearest_tick import TickRoundMethod
|
7
7
|
|
8
8
|
from .config import connect_client
|
@@ -32,7 +32,7 @@ pprint.pp(product_info)
|
|
32
32
|
# and other ticker info for the given symbol.
|
33
33
|
# this function is an alias for get_l1_book_snapshot
|
34
34
|
print(f"\nMarket snapshot for {product_info.symbol}:")
|
35
|
-
market_snapshot = c.
|
35
|
+
market_snapshot = c.get_l1_book_snapshot(symbol=symbol, venue=venue)
|
36
36
|
|
37
37
|
pprint.pp(market_snapshot)
|
38
38
|
|
@@ -66,10 +66,11 @@ order = None
|
|
66
66
|
if confirm(
|
67
67
|
f"Place a limit order to BUY 1 {symbol} LIMIT {limit_price} on account {account.account.name}?"
|
68
68
|
):
|
69
|
-
order = c.
|
69
|
+
order = c.place_order(
|
70
70
|
symbol=symbol,
|
71
71
|
execution_venue=venue,
|
72
72
|
dir=OrderDir.BUY,
|
73
|
+
order_type=OrderType.LIMIT,
|
73
74
|
quantity=best_bid_quantity,
|
74
75
|
limit_price=limit_price,
|
75
76
|
account=account.account.name,
|
scripts/generate_functions_md.py
CHANGED
@@ -129,6 +129,7 @@ def main(filename):
|
|
129
129
|
)
|
130
130
|
# Alternatively, sort by section name alphabetically:
|
131
131
|
# sorted_sections = sorted(grouped.items())
|
132
|
+
print("# Client Methods")
|
132
133
|
for section, funcs in sorted_sections:
|
133
134
|
emoji = emoji_dict.get(section, "")
|
134
135
|
if emoji == "":
|
@@ -138,7 +139,7 @@ def main(filename):
|
|
138
139
|
# Sort functions by their line number
|
139
140
|
for name, summary, lineno in sorted(funcs, key=lambda x: x[2]):
|
140
141
|
# Exclude private methods
|
141
|
-
if name.startswith("
|
142
|
+
if name.startswith("_"):
|
142
143
|
continue
|
143
144
|
# Only output if summary is non-empty
|
144
145
|
if summary:
|
File without changes
|
File without changes
|
File without changes
|