Fill

Documentation for eth_defi.hyperliquid.position.Fill Python class.

class Fill

Bases: object

Parsed fill data from Hyperliquid API.

This is an intermediate representation of raw API fill data with proper typing.

Attributes summary

coin

Asset symbol

side

Trade side: "B" (buy) or "A" (sell/ask)

size

Fill size

price

Fill price

timestamp_ms

Timestamp in milliseconds

start_position

Position size before this fill

closed_pnl

Closed PnL (for position reductions)

direction_hint

Direction hint from API (e.g., "Open Long", "Close Short")

hash

Transaction hash

order_id

Order ID

trade_id

Trade ID

fee

Fee paid

fee_token

Fee token

timestamp

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”)

hash: str | None

Transaction hash

order_id: int | None

Order ID

trade_id: int | None

Trade ID

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

eth_defi.hyperliquid.position.Fill

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
Return type

None