RoundTripTrade

Documentation for eth_defi.hyperliquid.trade_history.RoundTripTrade Python class.

class RoundTripTrade

Bases: object

A round-trip trade from position open through close.

Groups individual fills from position-open to position-close with volume-weighted average entry/exit prices, funding costs, and PnL.

For positions that were already open before the data window, is_complete is False and entry_price may be unknown.

Attributes summary

coin

direction

is_open

is_complete

opened_at

closed_at

entry_price

exit_price

max_size

current_size

realised_pnl

funding_pnl

total_fees

net_pnl

unrealised_pnl

fills

funding_payments

duration

fill_count

Methods summary

__init__(coin, direction, is_open, ...[, ...])

__init__(coin, direction, is_open, is_complete, opened_at, closed_at, entry_price, exit_price, max_size, current_size, realised_pnl, funding_pnl, total_fees, net_pnl, unrealised_pnl, fills=<factory>, funding_payments=<factory>, duration=None, fill_count=0, _entry_cost=Decimal('0'), _entry_size=Decimal('0'), _exit_cost=Decimal('0'), _exit_size=Decimal('0'))
Parameters
Return type

None