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
30 changes: 27 additions & 3 deletions hyperliquid/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ def user_state(self, address: str, dex: str = "") -> Any:
Args:
address (str): Onchain address in 42-character hexadecimal format;
e.g. 0x0000000000000000000000000000000000000000.
dex (str): Dex name for HIP-3 builder-deployed perpetuals.
Defaults to "" (the original dex).
Returns:
{
assetPositions: [
Expand Down Expand Up @@ -136,6 +138,8 @@ def open_orders(self, address: str, dex: str = "") -> Any:
Args:
address (str): Onchain address in 42-character hexadecimal format;
e.g. 0x0000000000000000000000000000000000000000.
dex (str): Dex name for HIP-3 builder-deployed perpetuals.
Defaults to "" (the original dex).
Returns: [
{
coin: str,
Expand All @@ -157,6 +161,8 @@ def frontend_open_orders(self, address: str, dex: str = "") -> Any:
Args:
address (str): Onchain address in 42-character hexadecimal format;
e.g. 0x0000000000000000000000000000000000000000.
dex (str): Dex name for HIP-3 builder-deployed perpetuals.
Defaults to "" (the original dex).
Returns: [
{
children:
Expand Down Expand Up @@ -187,6 +193,10 @@ def all_mids(self, dex: str = "") -> Any:

POST /info

Args:
dex (str): Dex name for HIP-3 builder-deployed perpetuals.
Defaults to "" (the original dex).

Returns:
{
ATOM: float string,
Expand All @@ -196,14 +206,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): Dex name for HIP-3 builder-deployed perpetuals.
Defaults to "" (the original dex).

Returns:
[
Expand All @@ -223,10 +235,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 @@ -238,6 +255,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): Dex name for HIP-3 builder-deployed perpetuals.
Defaults to "" (the original dex).

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

Expand All @@ -273,6 +293,10 @@ def meta(self, dex: str = "") -> Meta:

POST /info

Args:
dex (str): Dex name for HIP-3 builder-deployed perpetuals.
Defaults to "" (the original dex).

Returns:
{
universe: [
Expand Down