hedge-pnl-engine

Calculate PnL components for cross-exchange hedge strategies on OKX and Binance.

Updated Mar 7, 2026
One-click install
npx skills add https://github.com/kann420/Cross-Arbitrage-Exchange --skill hedge-pnl-engine
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hedge-pnl-engine
Source: https://github.com/kann420/Cross-Arbitrage-Exchange/tree/main/.claude/hedge-pnl-engine
Command: npx skills add https://github.com/kann420/Cross-Arbitrage-Exchange --skill hedge-pnl-engine

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill addresses the complexity and potential for error in calculating Profit and Loss (PnL) for cross-exchange crypto hedging strategies, ensuring accurate accounting of all components like rewards, funding, and fees.

Core Features & Use Cases

  • Standardized PnL Calculation: Provides a deterministic model for PnL components (spot, hedge, rewards, funding, fees) for a specific long spot/earn + short perpetual hedge strategy.
  • Cross-Quote Safety: Explicitly handles and flags strategies where long and short legs use different quote assets (e.g., USDG vs. USDT).
  • Use Case: An investment firm uses this skill to provide clients with a clear, trustworthy dashboard showing the real-time PnL of their crypto hedging positions, distinguishing between market movement gains and yield-driven profits.

Quick Start

Calculate the PnL for the hedge position identified by 'strategy-123' as of the current timestamp.

Frequently Asked Questions about hedge-pnl-engine

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I calculate PnL for a cross-exchange crypto hedge with spot and perpetual positions?

To calculate cross-exchange hedge PnL accurately, you must standardize accounting across all components including spot, hedge, rewards, funding, and fees. This prevents common errors like misattributing rewards or ignoring fees for long spot and short perpetual positions.

What is included in crypto hedge PnL when holding a long earn position and short perpetual?

Crypto hedge PnL includes profit and loss from market movements, carry, rewards, funding rates, and trading fees. Accurately separating yield-driven profits from market gains requires standardizing the accounting of all these components across both exchanges.

How do I calculate hedge PnL when long and short legs use different quote currencies?

Calculating hedge PnL with different quote currencies requires explicit cross-quote safety handling. The calculation model must identify and flag scenarios where the long and short legs use different assets, such as USDG versus USDT, to ensure accurate accounting.

Why does my cross-exchange hedge PnL calculation show incorrect rewards or funding?

Cross-exchange hedge PnL calculations often show incorrect results due to misattributing rewards or ignoring funding and fees. Using a deterministic PnL model standardizes the accounting for each component, ensuring accurate profit and loss tracking.

Can I separate market movement gains from yield-driven profits in a crypto hedge strategy?

Yes, you can separate market movement gains from yield-driven profits by applying a deterministic PnL calculation model. This explicitly breaks down spot, hedge, rewards, funding, and fees to distinguish between market gains and yield profits.

Does the cross-exchange hedge PnL calculation support OKX and Binance platforms?

The cross-exchange hedge PnL calculation supports a strategy involving a long spot or earn position on OKX and a short perpetual hedge on Binance. It standardizes the accounting data from both platforms to prevent calculation errors.