RoundTripTrade
Documentation for eth_defi.hyperliquid.trade_history.RoundTripTrade Python class.
- class RoundTripTrade
Bases:
objectA 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_completeisFalseandentry_pricemay be unknown.Attributes summary
coindirectionis_openis_completeopened_atclosed_atentry_priceexit_pricemax_sizecurrent_sizerealised_pnlfunding_pnltotal_feesnet_pnlunrealised_pnlfillsfunding_paymentsdurationfill_countMethods 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
coin (str) –
direction (eth_defi.hyperliquid.position.PositionDirection) –
is_open (bool) –
is_complete (bool) –
opened_at (datetime.datetime) –
closed_at (Optional[datetime.datetime]) –
entry_price (decimal.Decimal) –
exit_price (Optional[decimal.Decimal]) –
max_size (decimal.Decimal) –
current_size (decimal.Decimal) –
realised_pnl (decimal.Decimal) –
funding_pnl (decimal.Decimal) –
total_fees (decimal.Decimal) –
net_pnl (decimal.Decimal) –
unrealised_pnl (Optional[decimal.Decimal]) –
fills (list[eth_defi.hyperliquid.position.Fill]) –
funding_payments (list[eth_defi.hyperliquid.trade_history.FundingPayment]) –
duration (Optional[datetime.timedelta]) –
fill_count (int) –
_entry_cost (decimal.Decimal) –
_entry_size (decimal.Decimal) –
_exit_cost (decimal.Decimal) –
_exit_size (decimal.Decimal) –
- Return type
None