Fill
Documentation for eth_defi.hyperliquid.position.Fill Python class.
- class Fill
Bases:
objectParsed fill data from Hyperliquid API.
This is an intermediate representation of raw API fill data with proper typing.
Attributes summary
Asset symbol
Trade side: "B" (buy) or "A" (sell/ask)
Fill size
Fill price
Timestamp in milliseconds
Position size before this fill
Closed PnL (for position reductions)
Direction hint from API (e.g., "Open Long", "Close Short")
Transaction hash
Order ID
Trade ID
Fee paid
Fee token
Convert millisecond timestamp to datetime.
Methods summary
__init__(coin, side, size, price, ...)from_api_response(data)Parse a fill from API response data.
- coin: str
Asset symbol
- side: str
Trade side: “B” (buy) or “A” (sell/ask)
- size: decimal.Decimal
Fill size
- price: decimal.Decimal
Fill price
- timestamp_ms: int
Timestamp in milliseconds
- start_position: decimal.Decimal
Position size before this fill
- closed_pnl: decimal.Decimal
Closed PnL (for position reductions)
- direction_hint: str
Direction hint from API (e.g., “Open Long”, “Close Short”)
- fee: decimal.Decimal
Fee paid
- fee_token: str
Fee token
- classmethod from_api_response(data)
Parse a fill from API response data.
- Parameters
data (dict) – Raw fill dict from API
- Returns
Parsed Fill object
- Return type
- property timestamp: datetime.datetime
Convert millisecond timestamp to datetime.
- __init__(coin, side, size, price, timestamp_ms, start_position, closed_pnl, direction_hint, hash, order_id, trade_id, fee, fee_token)
- Parameters
coin (str) –
side (str) –
size (decimal.Decimal) –
price (decimal.Decimal) –
timestamp_ms (int) –
start_position (decimal.Decimal) –
closed_pnl (decimal.Decimal) –
direction_hint (str) –
hash (str | None) –
order_id (int | None) –
trade_id (int | None) –
fee (decimal.Decimal) –
fee_token (str) –
- Return type
None