Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions hyperliquid/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,16 @@ def all_mids(self, dex: str = "") -> Any:
"""
return self.post("/info", {"type": "allMids", "dex": dex})

def user_fills(self, address: str) -> Any:
def user_fills(self, address: str, dex: str = "") -> Any:
"""Retrieve a given user's fills.

POST /info

Args:
address (str): Onchain address in 42-character hexadecimal format;
e.g. 0x0000000000000000000000000000000000000000.
dex (str): Perp dex name for HIP-3 builder-deployed perps. Defaults to "",
the first perp dex.

Returns:
[
Expand All @@ -225,10 +227,15 @@ def user_fills(self, address: str) -> Any:
...
]
"""
return self.post("/info", {"type": "userFills", "user": address})
return self.post("/info", {"type": "userFills", "user": address, "dex": dex})

def user_fills_by_time(
self, address: str, start_time: int, end_time: Optional[int] = None, aggregate_by_time: Optional[bool] = False
self,
address: str,
start_time: int,
end_time: Optional[int] = None,
aggregate_by_time: Optional[bool] = False,
dex: str = "",
) -> Any:
"""Retrieve a given user's fills by time.

Expand All @@ -240,6 +247,8 @@ def user_fills_by_time(
start_time (int): Unix timestamp in milliseconds
end_time (Optional[int]): Unix timestamp in milliseconds
aggregate_by_time (Optional[bool]): When true, partial fills are combined when a crossing order gets filled by multiple different resting orders. Resting orders filled by multiple crossing orders will not be aggregated.
dex (str): Perp dex name for HIP-3 builder-deployed perps. Defaults to "",
the first perp dex.

Returns:
[
Expand Down Expand Up @@ -267,6 +276,7 @@ def user_fills_by_time(
"startTime": start_time,
"endTime": end_time,
"aggregateByTime": aggregate_by_time,
"dex": dex,
},
)

Expand All @@ -288,11 +298,15 @@ def meta(self, dex: str = "") -> Meta:
"""
return cast(Meta, self.post("/info", {"type": "meta", "dex": dex}))

def meta_and_asset_ctxs(self) -> Any:
def meta_and_asset_ctxs(self, dex: str = "") -> Any:
"""Retrieve exchange MetaAndAssetCtxs

POST /info

Args:
dex (str): Perp dex name for HIP-3 builder-deployed perps. Defaults to "",
the first perp dex.

Returns:
[
{
Expand Down Expand Up @@ -321,7 +335,7 @@ def meta_and_asset_ctxs(self) -> Any:
...
]
"""
return self.post("/info", {"type": "metaAndAssetCtxs"})
return self.post("/info", {"type": "metaAndAssetCtxs", "dex": dex})

def perp_dexs(self) -> Any:
return self.post("/info", {"type": "perpDexs"})
Expand Down