Skip to content

Add docs to exchange API functions#58

Open
perplover wants to merge 1 commit intohyperliquid-dex:masterfrom
perplover:exchange-docs
Open

Add docs to exchange API functions#58
perplover wants to merge 1 commit intohyperliquid-dex:masterfrom
perplover:exchange-docs

Conversation

@perplover
Copy link
Copy Markdown
Contributor

A few changes:

  1. API Docs
  2. Update variable naming from usdc -> usdc_rounded_micros

Comment thread hyperliquid/exchange.py

Note:
- The scheduled time must be at least 5 seconds after the current time.
- Once the scheduled time arrives, all open orders will be canceled.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found having a separate bullet is confusing. The trigger count is incremented when the scheduled time arrives, not when this action is sent.

Suggested change
- Once the scheduled time arrives, all open orders will be canceled.
- Once the scheduled time arrives, all open orders will be canceled and a trigger count is incremented.

Comment thread hyperliquid/exchange.py
# Deprecated in favor of usd_class_transfer
def user_spot_transfer(self, usdc: float, to_perp: bool) -> Any:
usdc = int(round(usdc, 2) * 1e6)
usdc_rounded_micros = int(round(usdc, 2) * 1e6)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer not making this rename. usdc has 6 decimals so this is the actual amount of usdc and is not rounded. Perhaps the input should have been usd instead of usdc, but renaming it now would be a breaking change

Comment thread hyperliquid/exchange.py
Args:
amount (float): The amount of the token to transfer.
destination (str): The destination address (EVM compatible) for the transfer.
token (str): The identifier of the token to be transferred (e.g., "BTC", "ETH").
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These example tokens are not spot tokens. Also the token identifier is a different format

Suggested change
token (str): The identifier of the token to be transferred (e.g., "BTC", "ETH").
token (str): The identifier of the token to be transferred (e.g., "PURR:0xc1fb593aeffbeb02f85e0308e9956a90").

Comment thread hyperliquid/exchange.py
Initiate a withdrawal from the Hyperliquid bridge to a specified destination.

Args:
amount (float): The amount to withdraw. This should be in the base unit of the asset
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this confusing. All withdrawals are in USDC

Suggested change
amount (float): The amount to withdraw. This should be in the base unit of the asset
amount (float): The amount of USD to withdraw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants