attach_funding_to_trades
Documentation for eth_defi.hyperliquid.trade_history.attach_funding_to_trades function.
- attach_funding_to_trades(closed_trades, open_trades, funding_payments)
Attach funding payments to the appropriate round-trip trades.
For each funding payment, finds the trade for that coin active at the payment timestamp and attributes the funding cost/income to it.
Modifies trades in place.
- Parameters
closed_trades (list[eth_defi.hyperliquid.trade_history.RoundTripTrade]) – List of closed round-trip trades.
open_trades (list[eth_defi.hyperliquid.trade_history.RoundTripTrade]) – List of open round-trip trades.
funding_payments (list[eth_defi.hyperliquid.trade_history.FundingPayment]) – Funding payments sorted chronologically.
- Return type
None