nado-protocol 0.2.7__py3-none-any.whl → 0.2.8__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.
- nado_protocol/engine_client/query.py +21 -2
- nado_protocol/engine_client/types/__init__.py +1 -0
- nado_protocol/engine_client/types/query.py +14 -1
- {nado_protocol-0.2.7.dist-info → nado_protocol-0.2.8.dist-info}/METADATA +1 -1
- {nado_protocol-0.2.7.dist-info → nado_protocol-0.2.8.dist-info}/RECORD +7 -7
- {nado_protocol-0.2.7.dist-info → nado_protocol-0.2.8.dist-info}/WHEEL +0 -0
- {nado_protocol-0.2.7.dist-info → nado_protocol-0.2.8.dist-info}/entry_points.txt +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import json
|
|
1
2
|
from typing import Optional
|
|
2
3
|
import requests
|
|
3
4
|
|
|
@@ -182,7 +183,10 @@ class EngineQueryClient:
|
|
|
182
183
|
)
|
|
183
184
|
|
|
184
185
|
def get_subaccount_info(
|
|
185
|
-
self,
|
|
186
|
+
self,
|
|
187
|
+
subaccount: str,
|
|
188
|
+
txs: Optional[list[QuerySubaccountInfoTx]] = None,
|
|
189
|
+
pre_state: Optional[bool] = None,
|
|
186
190
|
) -> SubaccountInfoData:
|
|
187
191
|
"""
|
|
188
192
|
Query the engine for the state of a subaccount, including balances.
|
|
@@ -193,11 +197,26 @@ class EngineQueryClient:
|
|
|
193
197
|
txs (list[QuerySubaccountInfoTx], optional): You can optionally provide a list of txs, to get an estimated view
|
|
194
198
|
of what the subaccount state would look like if the transactions were applied.
|
|
195
199
|
|
|
200
|
+
pre_state (bool, optional): When True and txs are provided, returns the subaccount state before the
|
|
201
|
+
transactions were applied in the pre_state field. Defaults to False.
|
|
202
|
+
|
|
196
203
|
Returns:
|
|
197
204
|
SubaccountInfoData: Information about the specified subaccount.
|
|
198
205
|
"""
|
|
206
|
+
txns_str = None
|
|
207
|
+
if txs is not None:
|
|
208
|
+
txns_str = json.dumps([tx.dict() for tx in txs])
|
|
209
|
+
|
|
210
|
+
pre_state_str = None
|
|
211
|
+
if pre_state is not None:
|
|
212
|
+
pre_state_str = str(pre_state).lower()
|
|
213
|
+
|
|
199
214
|
return ensure_data_type(
|
|
200
|
-
self.query(
|
|
215
|
+
self.query(
|
|
216
|
+
QuerySubaccountInfoParams(
|
|
217
|
+
subaccount=subaccount, txns=txns_str, pre_state=pre_state_str
|
|
218
|
+
)
|
|
219
|
+
).data,
|
|
201
220
|
SubaccountInfoData,
|
|
202
221
|
)
|
|
203
222
|
|
|
@@ -101,7 +101,8 @@ class QuerySubaccountInfoParams(NadoBaseModel):
|
|
|
101
101
|
|
|
102
102
|
type = EngineQueryType.SUBACCOUNT_INFO.value
|
|
103
103
|
subaccount: str
|
|
104
|
-
|
|
104
|
+
txns: Optional[str]
|
|
105
|
+
pre_state: Optional[str]
|
|
105
106
|
|
|
106
107
|
|
|
107
108
|
class QuerySubaccountOpenOrdersParams(NadoBaseModel):
|
|
@@ -299,6 +300,17 @@ class OrderData(NadoBaseModel):
|
|
|
299
300
|
placed_at: str
|
|
300
301
|
|
|
301
302
|
|
|
303
|
+
class PreState(NadoBaseModel):
|
|
304
|
+
"""
|
|
305
|
+
Model for subaccount state before simulated transactions were applied.
|
|
306
|
+
"""
|
|
307
|
+
|
|
308
|
+
healths: list[SubaccountHealth]
|
|
309
|
+
health_contributions: list[list[str]]
|
|
310
|
+
spot_balances: list[SpotProductBalance]
|
|
311
|
+
perp_balances: list[PerpProductBalance]
|
|
312
|
+
|
|
313
|
+
|
|
302
314
|
class SubaccountInfoData(NadoBaseModel):
|
|
303
315
|
"""
|
|
304
316
|
Model for detailed info about a subaccount, including balances.
|
|
@@ -314,6 +326,7 @@ class SubaccountInfoData(NadoBaseModel):
|
|
|
314
326
|
perp_balances: list[PerpProductBalance]
|
|
315
327
|
spot_products: list[SpotProduct]
|
|
316
328
|
perp_products: list[PerpProduct]
|
|
329
|
+
pre_state: Optional[PreState]
|
|
317
330
|
|
|
318
331
|
def parse_subaccount_balance(
|
|
319
332
|
self, product_id: int
|
|
@@ -41,11 +41,11 @@ nado_protocol/contracts/loader.py,sha256=_0W3ImcARs1bTu1lLMpHMrRNuEVYjrRWctvnEbK
|
|
|
41
41
|
nado_protocol/contracts/types.py,sha256=km29Md8hCE8yivGdgbgMuQoO7GyE0yOVt9BaJatvjFY,4280
|
|
42
42
|
nado_protocol/engine_client/__init__.py,sha256=RE_MxQaQVIp0K5EDhR1_uTjLJgEJBx2fLnhepc3cuAg,1137
|
|
43
43
|
nado_protocol/engine_client/execute.py,sha256=Tmd1yvLTlvFFaSYqwOWTkzSxdE6QllGB8LHgsOim3Tc,15314
|
|
44
|
-
nado_protocol/engine_client/query.py,sha256=
|
|
45
|
-
nado_protocol/engine_client/types/__init__.py,sha256=
|
|
44
|
+
nado_protocol/engine_client/query.py,sha256=v7PqRsnX5jZskNnBpv38HB7BQ7mi8RBhUgczf5msEIc,16858
|
|
45
|
+
nado_protocol/engine_client/types/__init__.py,sha256=aCw_aNxCRy5PhrYpvUHuB7gQPcxHld9iMV5eTFWdEfw,2737
|
|
46
46
|
nado_protocol/engine_client/types/execute.py,sha256=ANF_QwtJAqb9zvga1fjOIiSDt_wjUo4sbf8rVkc-sQ0,20709
|
|
47
47
|
nado_protocol/engine_client/types/models.py,sha256=JIDyOLUBprGcMKHxW2M53_nCc7hoerglnFvfn7wgdXo,3862
|
|
48
|
-
nado_protocol/engine_client/types/query.py,sha256=
|
|
48
|
+
nado_protocol/engine_client/types/query.py,sha256=5j4KcYUwGAoJFF0m2bmrqYXbU4iJ5IyzUTiEIzn6rh0,12516
|
|
49
49
|
nado_protocol/engine_client/types/stream.py,sha256=F_AKqU4pClzUcM6D9Dc79f6RmraahJzj2-hQSXtQ0vQ,159
|
|
50
50
|
nado_protocol/indexer_client/__init__.py,sha256=ea2exePtguCxJsBlisOQPtnFk8hRmFugeQAuSAaPhoc,922
|
|
51
51
|
nado_protocol/indexer_client/query.py,sha256=aMJoJfKXd9eE4j5me5FPOtsrHY8b5nXCpCV_NCZzh2E,13710
|
|
@@ -76,7 +76,7 @@ nado_protocol/utils/order.py,sha256=Q9TlcotvnB395dPhaKpn0EeN1WNTkpYBTUovlirr1_Y,
|
|
|
76
76
|
nado_protocol/utils/subaccount.py,sha256=WJ7lgU2RekuzJAZH-hhCTbIBlRsl2oHozBm7OEMRV74,495
|
|
77
77
|
nado_protocol/utils/time.py,sha256=tEwmrkc5VdzKLlgkJIAq2ce-nhrduJZNtVPydrrnTHs,360
|
|
78
78
|
nado_protocol/utils/twap.py,sha256=hfBVK0CBa8m4uBArxTnNRoJr3o1rJucyopR_8_9gkOo,6197
|
|
79
|
-
nado_protocol-0.2.
|
|
80
|
-
nado_protocol-0.2.
|
|
81
|
-
nado_protocol-0.2.
|
|
82
|
-
nado_protocol-0.2.
|
|
79
|
+
nado_protocol-0.2.8.dist-info/METADATA,sha256=W26ydlZNiR7NihwnL_gzayKfPKqSWetgcxusYz3ioic,9558
|
|
80
|
+
nado_protocol-0.2.8.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
81
|
+
nado_protocol-0.2.8.dist-info/entry_points.txt,sha256=Df0O9lFc-m0SyOh6_d9FHeG1OT-esxGm-p_z7rTT9h0,340
|
|
82
|
+
nado_protocol-0.2.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|