architect-py 5.1.3__py3-none-any.whl → 5.1.4rc1__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 +19 -1
- architect_py/async_client.py +133 -39
- architect_py/client.py +15 -1
- architect_py/client.pyi +25 -7
- architect_py/grpc/client.py +37 -13
- architect_py/grpc/models/AlgoHelper/AlgoParamTypes.py +31 -0
- architect_py/grpc/models/AlgoHelper/__init__.py +2 -0
- architect_py/grpc/models/Auth/AuthInfoRequest.py +37 -0
- architect_py/grpc/models/Auth/AuthInfoResponse.py +30 -0
- architect_py/grpc/models/Folio/AccountHistoryRequest.py +35 -4
- architect_py/grpc/models/Marketdata/L1BookSnapshot.py +11 -3
- architect_py/grpc/models/Marketdata/TickersRequest.py +4 -1
- architect_py/grpc/models/Oms/Order.py +38 -14
- architect_py/grpc/models/Oms/PlaceOrderRequest.py +38 -14
- architect_py/grpc/models/__init__.py +4 -1
- architect_py/grpc/models/definitions.py +154 -0
- architect_py/grpc/orderflow.py +138 -0
- architect_py/tests/test_order_entry.py +9 -6
- architect_py/tests/test_orderflow.py +116 -27
- {architect_py-5.1.3.dist-info → architect_py-5.1.4rc1.dist-info}/METADATA +1 -1
- {architect_py-5.1.3.dist-info → architect_py-5.1.4rc1.dist-info}/RECORD +27 -22
- examples/funding_rate_mean_reversion_algo.py +23 -47
- scripts/correct_sync_interface.py +5 -2
- scripts/postprocess_grpc.py +17 -2
- {architect_py-5.1.3.dist-info → architect_py-5.1.4rc1.dist-info}/WHEEL +0 -0
- {architect_py-5.1.3.dist-info → architect_py-5.1.4rc1.dist-info}/licenses/LICENSE +0 -0
- {architect_py-5.1.3.dist-info → architect_py-5.1.4rc1.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
|
|
1
|
-
architect_py/__init__.py,sha256=
|
2
|
-
architect_py/async_client.py,sha256=
|
3
|
-
architect_py/client.py,sha256=
|
4
|
-
architect_py/client.pyi,sha256=
|
1
|
+
architect_py/__init__.py,sha256=0Uioyr5yLNKBcAFs-5GM69vfhriy3dEgTc4CvWXpNQU,16669
|
2
|
+
architect_py/async_client.py,sha256=u6NKAi2XEn6FgVbrVhbTRAS-k01KG0CymH336Vaj5F8,64255
|
3
|
+
architect_py/client.py,sha256=y8w17ZLo_Y2-knH-46qqVGlSJyQHB9qwOPodI9pzN-Q,5192
|
4
|
+
architect_py/client.pyi,sha256=AAcbKshjX9CA1PSRTdd0wNWHYhxqGMZWVHR2q2T_9WQ,25434
|
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
|
@@ -23,12 +23,13 @@ architect_py/graphql_client/juniper_base_client.py,sha256=0kbAihyRgEP3n28zRumoST
|
|
23
23
|
architect_py/graphql_client/search_symbols_query.py,sha256=hbGa6gF-gMWtRYQm2vlCTPDex8RWrJ4Yn4nT0VRQnCQ,614
|
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
|
-
architect_py/grpc/client.py,sha256=
|
26
|
+
architect_py/grpc/client.py,sha256=qoH-bb-sDjoDlYYmByQVbzYBbCimFY_AmoOLEBDxEtA,4096
|
27
|
+
architect_py/grpc/orderflow.py,sha256=XKysE11lK7yKXMctLvNTqq4g5F_DoKJT_8Jx37bgTLE,4836
|
27
28
|
architect_py/grpc/resolve_endpoint.py,sha256=r_PBWANIJJ47N5uyPcnefZ21ZE1-mzgACfCBfQpekg8,2621
|
28
29
|
architect_py/grpc/server.py,sha256=Abmdfe1eYbctVgzoJYBBBLpd7UD70FbYQLtJImSyRzs,1934
|
29
30
|
architect_py/grpc/utils.py,sha256=5sykLExUNZbcQHcxLCCM9DdOOiJJZcpputGrDtaMifY,667
|
30
|
-
architect_py/grpc/models/__init__.py,sha256=
|
31
|
-
architect_py/grpc/models/definitions.py,sha256=
|
31
|
+
architect_py/grpc/models/__init__.py,sha256=DVsP-OURNPSlFKWxQGShF7ytvOUJc2_fQ-ng5kOh1X8,9366
|
32
|
+
architect_py/grpc/models/definitions.py,sha256=abSEQX32IinuM7ZQnhC6USBWAy-JU8-JgajtYSQx1EA,82191
|
32
33
|
architect_py/grpc/models/Accounts/AccountsRequest.py,sha256=1a88cltSebOb53EdJ0hKEGR7FlmBiibrCtGzLTKqDBY,1524
|
33
34
|
architect_py/grpc/models/Accounts/AccountsResponse.py,sha256=DlXbkd3UbRybblBAfokw-K6nRvLNZgqz7cc0EKiW1zI,636
|
34
35
|
architect_py/grpc/models/Accounts/__init__.py,sha256=sIyaEvJdP-VmGTGPPqZuRjKn4bc7NUClJ76Gd5uq-5s,57
|
@@ -44,6 +45,10 @@ architect_py/grpc/models/Algo/StartAlgoResponse.py,sha256=mS5kF5NEreJo6cNu4HFoDk
|
|
44
45
|
architect_py/grpc/models/Algo/StopAlgoRequest.py,sha256=pKmj0L9cNTfuA682QnM87PjRBcJ_IsWPvKJdulK8Nwo,997
|
45
46
|
architect_py/grpc/models/Algo/StopAlgoResponse.py,sha256=_HTDziNPpcVHTABHP-bdHGgro-lQRC44zf8J0Hv5dbA,418
|
46
47
|
architect_py/grpc/models/Algo/__init__.py,sha256=sIyaEvJdP-VmGTGPPqZuRjKn4bc7NUClJ76Gd5uq-5s,57
|
48
|
+
architect_py/grpc/models/AlgoHelper/AlgoParamTypes.py,sha256=U-zgHxcPlND283rqjvWkFPWlYORTKNQDRAAmbr3SepE,779
|
49
|
+
architect_py/grpc/models/AlgoHelper/__init__.py,sha256=sIyaEvJdP-VmGTGPPqZuRjKn4bc7NUClJ76Gd5uq-5s,57
|
50
|
+
architect_py/grpc/models/Auth/AuthInfoRequest.py,sha256=9MfFQzf2O4SZ156Bb-bJrTIT1uMpbMiv7XlD0E0MHzk,825
|
51
|
+
architect_py/grpc/models/Auth/AuthInfoResponse.py,sha256=mok-7QUahZUlzBAosuQ5ng0ESSdcWLfXIywt3rgvYn4,813
|
47
52
|
architect_py/grpc/models/Auth/CreateJwtRequest.py,sha256=3ezxlv3LbqZhM00kUrdn5OtYBGVMCZtw05m8NNOYMTI,1110
|
48
53
|
architect_py/grpc/models/Auth/CreateJwtResponse.py,sha256=G1rsG7f4gMiWK4WVxTZMzFSy08z80nQCnZHJWWfXDNQ,483
|
49
54
|
architect_py/grpc/models/Auth/__init__.py,sha256=sIyaEvJdP-VmGTGPPqZuRjKn4bc7NUClJ76Gd5uq-5s,57
|
@@ -70,7 +75,7 @@ architect_py/grpc/models/Cpty/CptyStatusRequest.py,sha256=5eYYL2L5TmFKgoUuAInvFS
|
|
70
75
|
architect_py/grpc/models/Cpty/CptysRequest.py,sha256=th1vto4vclExgZD4HwXaNy87amRP2oM1ix4WLetnIW8,801
|
71
76
|
architect_py/grpc/models/Cpty/CptysResponse.py,sha256=cQiRp3VEewfcCKRxqdXpMT2EEZujO3h9LZtHATBDPtk,568
|
72
77
|
architect_py/grpc/models/Cpty/__init__.py,sha256=sIyaEvJdP-VmGTGPPqZuRjKn4bc7NUClJ76Gd5uq-5s,57
|
73
|
-
architect_py/grpc/models/Folio/AccountHistoryRequest.py,sha256=
|
78
|
+
architect_py/grpc/models/Folio/AccountHistoryRequest.py,sha256=62zM93rALjckq8y5sA-6OvtB6zwpUOIXRtUik_tehQA,2837
|
74
79
|
architect_py/grpc/models/Folio/AccountHistoryResponse.py,sha256=3CUKPrqbUpH1MRYFZi2Q4dfN-nzcM6OxM_FA5pA_OyQ,622
|
75
80
|
architect_py/grpc/models/Folio/AccountSummariesRequest.py,sha256=epYjLFc1cMblp04li_WSCIcl4bFJEjDedJNO9D2x1bg,1595
|
76
81
|
architect_py/grpc/models/Folio/AccountSummariesResponse.py,sha256=YoJddUl0TB1pkoI7C_avt94RSL9ZCf2u8_kOYpewRGI,678
|
@@ -88,7 +93,7 @@ architect_py/grpc/models/Marketdata/ArrayOfL1BookSnapshot.py,sha256=Os13kKncZgwo
|
|
88
93
|
architect_py/grpc/models/Marketdata/Candle.py,sha256=VDGh7cDiDhu91dAxARLMJkE2CqJvOLL4m1Z8u-cK9KE,8259
|
89
94
|
architect_py/grpc/models/Marketdata/HistoricalCandlesRequest.py,sha256=uJvsHOn2gXD9w4ybk1iXu4Z1LJ4g5g89y_DIwAMUChY,1587
|
90
95
|
architect_py/grpc/models/Marketdata/HistoricalCandlesResponse.py,sha256=_LGtTw6dVMtF0U6N7l68IbxDDMcooOEW7YsJaoLtniY,604
|
91
|
-
architect_py/grpc/models/Marketdata/L1BookSnapshot.py,sha256=
|
96
|
+
architect_py/grpc/models/Marketdata/L1BookSnapshot.py,sha256=T4dNmwvAPy0XZ-yZIufhNi4Zyhx8uT1--XPHsX6KvvI,3661
|
92
97
|
architect_py/grpc/models/Marketdata/L1BookSnapshotRequest.py,sha256=9TxfqAivsmZgmIuIemmX6A9bTvMvVU6rWYDGi86gZZg,1072
|
93
98
|
architect_py/grpc/models/Marketdata/L1BookSnapshotsRequest.py,sha256=TFGnuPfTcHMSO849WnEPj1a52RsVReAEWqQ9Fb3La1g,1189
|
94
99
|
architect_py/grpc/models/Marketdata/L2BookSnapshot.py,sha256=MEyDSZ6LfAtyujGLRZ6pts5o7UNIp8A9_kqV6K7Y-k8,2572
|
@@ -108,7 +113,7 @@ architect_py/grpc/models/Marketdata/SubscribeTradesRequest.py,sha256=7P8FyNx6wij
|
|
108
113
|
architect_py/grpc/models/Marketdata/Ticker.py,sha256=O4kJK1RyThYgfpvIr9mgRWAAkYgwwAKgOhEhbfDo9b4,11592
|
109
114
|
architect_py/grpc/models/Marketdata/TickerRequest.py,sha256=Ay--5JKgCfdvlVWD2H6YSa_66NC3Dt6c-XK8JkbWhus,1008
|
110
115
|
architect_py/grpc/models/Marketdata/TickerUpdate.py,sha256=sJ4wvCeGckMV30HwAcAsEMQbCzjN31OxF19q70jdxok,437
|
111
|
-
architect_py/grpc/models/Marketdata/TickersRequest.py,sha256=
|
116
|
+
architect_py/grpc/models/Marketdata/TickersRequest.py,sha256=x6UlQdAisnXgs3vbghQY3nuiFccSU3ueU0YJVAKaKUs,2359
|
112
117
|
architect_py/grpc/models/Marketdata/TickersResponse.py,sha256=CLzKx-ItwH9-Qq8YruFhXh7TmtHwzNRMEOPJ9LQD9co,574
|
113
118
|
architect_py/grpc/models/Marketdata/Trade.py,sha256=RKZq_HUDLxIE41caDrwf99V0c48kH2pm3XRCn5RLcEQ,2476
|
114
119
|
architect_py/grpc/models/Marketdata/__init__.py,sha256=sIyaEvJdP-VmGTGPPqZuRjKn4bc7NUClJ76Gd5uq-5s,57
|
@@ -118,10 +123,10 @@ architect_py/grpc/models/Oms/CancelAllOrdersResponse.py,sha256=YM1H_nrV4RhpLMEwS
|
|
118
123
|
architect_py/grpc/models/Oms/CancelOrderRequest.py,sha256=0yJysCf0IcwUevEqVnAkIm-OkOAbp_vOwh1p1ljSsp8,1939
|
119
124
|
architect_py/grpc/models/Oms/OpenOrdersRequest.py,sha256=5Uv9ndI2WqRJgOWNLeKcIV8czb0ff6wHUW0gokeBktg,1804
|
120
125
|
architect_py/grpc/models/Oms/OpenOrdersResponse.py,sha256=HT4YXjbbwdp2rLLXxoetF33DGe2j403soMLme2p18ts,592
|
121
|
-
architect_py/grpc/models/Oms/Order.py,sha256=
|
126
|
+
architect_py/grpc/models/Oms/Order.py,sha256=slEem8b898Hh1Uckc_mhvN2bthVgB-JfDjAlN5uxs94,11683
|
122
127
|
architect_py/grpc/models/Oms/PendingCancelsRequest.py,sha256=jdbBOpCHBlZFAZfF6urJZXXa5Dr5cTRR3AJ9ss4rY6E,1620
|
123
128
|
architect_py/grpc/models/Oms/PendingCancelsResponse.py,sha256=mWRNRDa489Vdg-r7dJMOmfOO8l57yg8lBMynBDcY60A,628
|
124
|
-
architect_py/grpc/models/Oms/PlaceOrderRequest.py,sha256=
|
129
|
+
architect_py/grpc/models/Oms/PlaceOrderRequest.py,sha256=DDMkKgsqWVlMhUeidxTlVDHyNdeuPLu29PUwOTd0ijo,9320
|
125
130
|
architect_py/grpc/models/Oms/__init__.py,sha256=sIyaEvJdP-VmGTGPPqZuRjKn4bc7NUClJ76Gd5uq-5s,57
|
126
131
|
architect_py/grpc/models/OptionsMarketdata/OptionsChain.py,sha256=8Sdp57aUXlW13X1POlBKxxaEZofwRZ7VGDLzq1l9GoU,732
|
127
132
|
architect_py/grpc/models/OptionsMarketdata/OptionsChainGreeks.py,sha256=Jhb5CM4t84EdETDO3SOakHkuaWG30Dm4lREpKgBFzFM,742
|
@@ -158,8 +163,8 @@ architect_py/tests/conftest.py,sha256=XCeq44muZi6i9CxOe9lH7rCmt5pQViWJ_25gSowrLP
|
|
158
163
|
architect_py/tests/test_book_building.py,sha256=biqs8X9bw1YSb6mrCDS-ELesdD-P5F6bE3MYXP0BeQ4,1236
|
159
164
|
architect_py/tests/test_encoding.py,sha256=J61Lk2CDIqgdcsj0-KYBZweYh5EQ4XAXsRyM0fdMqfU,1085
|
160
165
|
architect_py/tests/test_marketdata.py,sha256=W26OrL51ONAclBjBcm7trS1QPXtLLjdgnsbDR2kqtIw,4963
|
161
|
-
architect_py/tests/test_order_entry.py,sha256=
|
162
|
-
architect_py/tests/test_orderflow.py,sha256=
|
166
|
+
architect_py/tests/test_order_entry.py,sha256=5HDjzNJOC7lSx4driP4mDJr9HuR2cFTwO8s1haGXl9E,1284
|
167
|
+
architect_py/tests/test_orderflow.py,sha256=b4iohhs7YUoJMevlUfLQyIoVqjam7pl0BPs0dSfZhqM,3951
|
163
168
|
architect_py/tests/test_portfolio_management.py,sha256=Q4pburTDJ53hrq2_aRbNAOG3nwbCEsgZQGbI_AMHLxE,709
|
164
169
|
architect_py/tests/test_rounding.py,sha256=cAQ1-tWOVgxENt0Fzs9YcFDdDDYmCtOHvAA_w76wy9g,1417
|
165
170
|
architect_py/tests/test_symbology.py,sha256=74fbUgoycuViMHHnurE2Dnfao75wWu_cmQMyU5XQcdY,3436
|
@@ -170,13 +175,13 @@ architect_py/utils/orderbook.py,sha256=JM02NhHbmK3sNaS2Ara8FBY4TvKvtMIzJW1oVd8KC
|
|
170
175
|
architect_py/utils/pandas.py,sha256=QHz2ynj4T92FobuzRaNoH3ypArHoSDCiGtZ3PVXJ2vo,1017
|
171
176
|
architect_py/utils/price_bands.py,sha256=j7ioSA3dx025CD5E2Vg7XQvmjPvxQb-gzQBfQTovpTw,21874
|
172
177
|
architect_py/utils/symbol_parsing.py,sha256=OjJzk2c6QU2s0aJMSyVEzlWD5Vy-RlakJVW7jNHVDJk,845
|
173
|
-
architect_py-5.1.
|
178
|
+
architect_py-5.1.4rc1.dist-info/licenses/LICENSE,sha256=6P0_5gYN8iPWPZeqA9nxiO3tRQmcSA1ijAVR7C8j1SI,11362
|
174
179
|
examples/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
175
180
|
examples/book_subscription.py,sha256=1WFQN_QCE8cRS_CIv2k0NxqpK37fA9-Ja2Kfxs8vsb8,1461
|
176
181
|
examples/candles.py,sha256=T71TsxbfXCT6mrJZmTgdTKesJFdQhYP_4AsiNK-8KyQ,756
|
177
182
|
examples/config.py,sha256=rv6x7QYJO6ckvpRcwghyJbkL_lTBPnK0u6nKgkYTvxQ,1858
|
178
183
|
examples/external_cpty.py,sha256=xxGXONXwoWIS8ys0SgxHLSmntAi1BlwV2NR9WD1kvpc,2527
|
179
|
-
examples/funding_rate_mean_reversion_algo.py,sha256=
|
184
|
+
examples/funding_rate_mean_reversion_algo.py,sha256=gv35eKiJeyU7-A6hPtFLsXxmgUxFQSMPYKV-gh2afo0,5650
|
180
185
|
examples/order_sending.py,sha256=0M5eK20nDO5KXJZV-yidC7HR_RHP3uJL9f-q9FF0BIs,3313
|
181
186
|
examples/orderflow_channel.py,sha256=L6W9aZS95Xmjl1IvrKA1Cp06r9-QOERsBETLOg3EImk,1891
|
182
187
|
examples/orderflow_streaming.py,sha256=BtVwCYWBCpytaAFN9u2WPgGCugyNMsGa6nA1dPWuVLs,1300
|
@@ -187,14 +192,14 @@ examples/trades.py,sha256=0OzWQVTuIrC0KlisY0Tc-3pmWNP0m0-eCSntCV6Qdh8,561
|
|
187
192
|
examples/tutorial_async.py,sha256=FNMjP2WmszRB0OXoMbshJ775LoPDzm55UZICa9ztr5w,2639
|
188
193
|
examples/tutorial_sync.py,sha256=w5Sqa0YFh0XnpoXuhD3WsKRKpR5cuTTNb7pCp-Aqnz0,2846
|
189
194
|
scripts/add_imports_to_inits.py,sha256=bryhz6RpKAJsSieVMnXnRyLp8evNkpOsNUkBUPkk1WQ,4518
|
190
|
-
scripts/correct_sync_interface.py,sha256=
|
195
|
+
scripts/correct_sync_interface.py,sha256=gTSJLDAT8s-ayN_JqgKbeM6c3DYZOapduS_GIqrvD-A,4134
|
191
196
|
scripts/generate_functions_md.py,sha256=-rVRhbHlDodGH2a32UCsMLIpgXtDvOhBmkHa0RqDpCA,6232
|
192
|
-
scripts/postprocess_grpc.py,sha256=
|
197
|
+
scripts/postprocess_grpc.py,sha256=1A8HCMG3aBAJaORlBTaYyADow8LOcm2EVeRm0xlF0Gc,23606
|
193
198
|
scripts/preprocess_grpc_schema.py,sha256=p9LdoMZzixBSsVx7Dy3_8uJzOy_QwCoVMkAABQKUsBA,22894
|
194
199
|
scripts/prune_graphql_schema.py,sha256=hmfw5FD_iKGKMFkq6H1neZiXXtljFFrOwi2fiusTWE4,6210
|
195
200
|
templates/exceptions.py,sha256=tIHbiO5Q114h9nPwJXsgHvW_bERLwxuNp9Oj41p6t3A,2379
|
196
201
|
templates/juniper_base_client.py,sha256=B8QF4IFSwqBK5UY2aFPbSdYnX9bcwnlxLK4ojPRaW0E,12705
|
197
|
-
architect_py-5.1.
|
198
|
-
architect_py-5.1.
|
199
|
-
architect_py-5.1.
|
200
|
-
architect_py-5.1.
|
202
|
+
architect_py-5.1.4rc1.dist-info/METADATA,sha256=Gd5QTs95v6beJuMU2dT-kJHkEeZWs0jmpd-i8Q4-3dk,2641
|
203
|
+
architect_py-5.1.4rc1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
204
|
+
architect_py-5.1.4rc1.dist-info/top_level.txt,sha256=UjtO97OACFQ9z5MzS-X2wBlt5Ovk1vxakQPKfokI454,40
|
205
|
+
architect_py-5.1.4rc1.dist-info/RECORD,,
|
@@ -4,7 +4,7 @@ Do *NOT* run this script in production. This script is for educational purposes
|
|
4
4
|
|
5
5
|
import asyncio
|
6
6
|
from decimal import Decimal
|
7
|
-
from typing import
|
7
|
+
from typing import Optional
|
8
8
|
|
9
9
|
from architect_py import (
|
10
10
|
AsyncClient,
|
@@ -13,16 +13,15 @@ from architect_py import (
|
|
13
13
|
TimeInForce,
|
14
14
|
TradableProduct,
|
15
15
|
)
|
16
|
-
from architect_py.graphql_client.exceptions import GraphQLClientHttpError
|
17
16
|
from architect_py.grpc.models.Orderflow.Orderflow import (
|
18
17
|
TaggedOrderAck,
|
19
18
|
TaggedOrderOut,
|
20
19
|
TaggedOrderReject,
|
21
20
|
)
|
22
21
|
from architect_py.grpc.models.Orderflow.OrderflowRequest import (
|
23
|
-
OrderflowRequest,
|
24
22
|
PlaceOrder,
|
25
23
|
)
|
24
|
+
from architect_py.grpc.orderflow import OrderflowChannel
|
26
25
|
|
27
26
|
from .config import connect_async_client
|
28
27
|
|
@@ -36,23 +35,6 @@ target_position = 0
|
|
36
35
|
current_position = 0
|
37
36
|
|
38
37
|
|
39
|
-
class OrderflowRequester:
|
40
|
-
def __init__(self):
|
41
|
-
self.queue: asyncio.Queue[OrderflowRequest] = asyncio.Queue()
|
42
|
-
|
43
|
-
async def __aiter__(self) -> AsyncIterator[OrderflowRequest]:
|
44
|
-
while True:
|
45
|
-
value = await self.queue.get() # Wait for a value
|
46
|
-
yield value # Yield it when available
|
47
|
-
|
48
|
-
async def __anext__(self) -> OrderflowRequest:
|
49
|
-
return await self.queue.get()
|
50
|
-
|
51
|
-
async def put(self, value: OrderflowRequest) -> None:
|
52
|
-
# OrderflowRequest contains: PlaceOrder, CancelOrder, CancelAllOrders
|
53
|
-
await self.queue.put(value) # Put value into the queue
|
54
|
-
|
55
|
-
|
56
38
|
async def update_marketdata(c: AsyncClient):
|
57
39
|
while True:
|
58
40
|
ticker = await c.get_ticker(tradable_product, venue)
|
@@ -81,30 +63,23 @@ async def update_marketdata(c: AsyncClient):
|
|
81
63
|
|
82
64
|
|
83
65
|
async def subscribe_and_print_orderflow(
|
84
|
-
c: AsyncClient,
|
85
|
-
):
|
86
|
-
try:
|
87
|
-
stream = c.orderflow(orderflow_requester)
|
88
|
-
"""
|
89
|
-
subscribe_orderflow_stream is a duplex_stream meaning that it is a stream that can be read from and written to.
|
90
|
-
This is a stream that will be used to send orders to the Architect and receive order updates from the Architect.
|
91
|
-
"""
|
92
|
-
async for orderflow in stream:
|
93
|
-
if isinstance(orderflow, TaggedOrderAck):
|
94
|
-
print(f"<!> ACK {orderflow.order_id}")
|
95
|
-
if isinstance(orderflow, TaggedOrderReject):
|
96
|
-
print(f"<!> REJECT {orderflow.id} {orderflow.r}: {orderflow.rm}")
|
97
|
-
# reject reason, reject message
|
98
|
-
elif isinstance(orderflow, TaggedOrderOut):
|
99
|
-
print(f"<!> OUT {orderflow.id}")
|
100
|
-
except GraphQLClientHttpError as e:
|
101
|
-
print(e.status_code)
|
102
|
-
print(e.response.json())
|
103
|
-
|
104
|
-
|
105
|
-
async def step_to_target_position(
|
106
|
-
c: AsyncClient, orderflow_requester: OrderflowRequester
|
66
|
+
c: AsyncClient, orderflow_manager: OrderflowChannel
|
107
67
|
):
|
68
|
+
"""
|
69
|
+
subscribe_orderflow_stream is a duplex_stream meaning that it is a stream that can be read from and written to.
|
70
|
+
This is a stream that will be used to send orders to the Architect and receive order updates from the Architect.
|
71
|
+
"""
|
72
|
+
async for orderflow in orderflow_manager:
|
73
|
+
if isinstance(orderflow, TaggedOrderAck):
|
74
|
+
print(f"<!> ACK {orderflow.order_id}")
|
75
|
+
if isinstance(orderflow, TaggedOrderReject):
|
76
|
+
print(f"<!> REJECT {orderflow.id} {orderflow.r}: {orderflow.rm}")
|
77
|
+
# reject reason, reject message
|
78
|
+
elif isinstance(orderflow, TaggedOrderOut):
|
79
|
+
print(f"<!> OUT {orderflow.id}")
|
80
|
+
|
81
|
+
|
82
|
+
async def step_to_target_position(c: AsyncClient, orderflow_manager: OrderflowChannel):
|
108
83
|
while True:
|
109
84
|
await asyncio.sleep(10)
|
110
85
|
# check open orders
|
@@ -147,7 +122,7 @@ async def step_to_target_position(
|
|
147
122
|
)
|
148
123
|
|
149
124
|
if order is not None:
|
150
|
-
await
|
125
|
+
await orderflow_manager.send(
|
151
126
|
order
|
152
127
|
) # this will add the order to the queue to send over
|
153
128
|
|
@@ -176,13 +151,14 @@ async def print_info(c: AsyncClient):
|
|
176
151
|
async def main():
|
177
152
|
c = await connect_async_client()
|
178
153
|
|
179
|
-
|
154
|
+
orderflow_manager = await c.orderflow()
|
155
|
+
await orderflow_manager.start()
|
180
156
|
|
181
157
|
await asyncio.gather(
|
182
158
|
update_marketdata(c),
|
183
|
-
step_to_target_position(c,
|
159
|
+
step_to_target_position(c, orderflow_manager),
|
184
160
|
print_info(c),
|
185
|
-
subscribe_and_print_orderflow(c,
|
161
|
+
subscribe_and_print_orderflow(c, orderflow_manager),
|
186
162
|
)
|
187
163
|
await c.close()
|
188
164
|
|
@@ -65,8 +65,11 @@ def add_correct_docstring_and_correct_the_init(content: str):
|
|
65
65
|
param_parts = [str(p) for p in pos_params]
|
66
66
|
|
67
67
|
# turn Optional[Type] into Type | None
|
68
|
-
opt_re = re.compile(r"\b(?:Optional|Option)\[(
|
69
|
-
param_parts = [
|
68
|
+
opt_re = re.compile(r"\b(?:Optional|Option)\[(.+)]", re.DOTALL)
|
69
|
+
param_parts = [
|
70
|
+
opt_re.sub(lambda m: f"{m.group(1)} | None", s) # Optional[T] → T | None
|
71
|
+
for s in param_parts
|
72
|
+
]
|
70
73
|
|
71
74
|
param_str = ", ".join(param_parts)
|
72
75
|
|
scripts/postprocess_grpc.py
CHANGED
@@ -358,12 +358,25 @@ def add_post_processing_to_unflattened_types(content: str, json_data: dict) -> s
|
|
358
358
|
)
|
359
359
|
union_keys = set.union(*map(set, enum_variant_to_other_required_keys.values()))
|
360
360
|
|
361
|
+
if_statement_used = False
|
361
362
|
for i, (enum_value, required_keys) in enumerate(
|
362
363
|
enum_variant_to_other_required_keys.items()
|
363
364
|
):
|
364
|
-
conditional = "
|
365
|
+
conditional = "elif" if if_statement_used else "if"
|
365
366
|
title = properties[enum_tag]["title"]
|
366
367
|
req_keys_subset = [key for key in required_keys if key not in common_keys]
|
368
|
+
|
369
|
+
if not req_keys_subset:
|
370
|
+
continue
|
371
|
+
|
372
|
+
req_keys_titles = []
|
373
|
+
for key in req_keys_subset:
|
374
|
+
key_title = properties[key].get("title")
|
375
|
+
if key_title is None:
|
376
|
+
req_keys_titles.append(key)
|
377
|
+
else:
|
378
|
+
req_keys_titles.append(f"{key_title} ({key})")
|
379
|
+
|
367
380
|
should_be_empty_keys: list[str] = list(union_keys - set(required_keys))
|
368
381
|
|
369
382
|
req_keys_subset.sort()
|
@@ -373,12 +386,14 @@ def add_post_processing_to_unflattened_types(content: str, json_data: dict) -> s
|
|
373
386
|
f' {conditional} self.{enum_tag} == "{enum_value}":\n'
|
374
387
|
f" if not all(getattr(self, key) is not None for key in {req_keys_subset}):\n"
|
375
388
|
f' raise ValueError(f"When field {enum_tag} ({title}) is of value {enum_value}, '
|
376
|
-
f'class {class_title} requires fields {
|
389
|
+
f'class {class_title} requires fields {req_keys_titles}")\n'
|
377
390
|
f" elif any(getattr(self, key) is not None for key in {should_be_empty_keys}):\n"
|
378
391
|
f' raise ValueError(f"When field {enum_tag} ({title}) is of value {enum_value}, '
|
379
392
|
f'class {class_title} should not have fields {should_be_empty_keys}")\n'
|
380
393
|
)
|
381
394
|
|
395
|
+
if_statement_used = True
|
396
|
+
|
382
397
|
return "".join(lines)
|
383
398
|
|
384
399
|
|
File without changes
|
File without changes
|
File without changes
|