feat: add florida module for unified hedging and monitoring

This commit is contained in:
2025-12-29 21:28:43 +01:00
parent 90c4453ab4
commit e6adbaffef
37 changed files with 11901 additions and 0 deletions

View File

@ -0,0 +1,57 @@
# Unified Hedger Logs Explained
This document explains how to read and interpret the `[IDLE]` logs generated by the `unified_hedger.py` system.
## Log Structure
A standard log entry looks like this:
```text
[IDLE] BNB | Px: 861.66 | M: 862.1 | B: 863.4 / S: 860.9 | delta: -0.5818(+0.0332) | Adj: +0.01%, Vol: 1.00, Thr: 0.0873 | PnL: -0.04 | TotPnL: -0.04
```
### Fields Breakdown
| Field | Full Name | Description |
| :--- | :--- | :--- |
| **Px** | Price | The current mid-price of the asset on Hyperliquid. |
| **M** | Mid-Hedge Price | The theoretical price where your Hedge Difference (`Diff`) would be exactly 0 (Perfect Equilibrium). |
| **B** | Buy Trigger | The price at which the bot estimates it will need to **BUY** to rebalance (hedge is too heavy). |
| **S** | Sell Trigger | The price at which the bot estimates it will need to **SELL** to rebalance (hedge is too light). |
| **delta** | Net Target Delta | The total size (in coins) the bot *wants* to be Short. Value is negative for Short. <br> **Format:** `Target (Difference)` <br> *Example:* `-0.5818(+0.0332)` means target is -0.5818, and you are currently +0.0332 away from it (under-hedged, need to sell). |
| **Adj** | Adjustment % | The **Asymmetric Compensation** boost applied to the delta. Positive means the bot is "boosting" the short (anticipating downside), negative means it is reducing it. |
| **Vol** | Volatility Multiplier | A factor (1.0 to 3.0) that widens the threshold during high volatility to prevent chop. |
| **Thr** | Threshold | The dynamic trigger distance. If `Diff` > `Thr`, a trade occurs. |
| **PnL** | Unrealized PnL | The current PnL of your open position on Hyperliquid. |
| **TotPnL** | Total PnL | The sum of Realized PnL (from closed rebalancing trades) + Unrealized PnL. |
---
## Detailed Examples
### Example 1: BNB (Stable)
```text
[IDLE] BNB | Px: 861.66 | M: 862.1 | B: 863.4 / S: 860.9 | delta: -0.5818(+0.0332) | Adj: +0.01%, Vol: 1.00, Thr: 0.0873 | PnL: -0.04 | TotPnL: -0.04
```
* **Status:** The bot wants to be Short `0.5818` BNB.
* **Reality:** It is currently off by `+0.0332` (meaning it has slightly *less* short than it wants).
* **Action:** The difference (`0.0332`) is smaller than the Threshold (`0.0873`), so it does nothing.
* **Triggers:** If price rises to `863.4` (B), it will Buy. If it drops to `860.9` (S), it will Sell.
### Example 2: ETH (Asymmetric Boost)
```text
[IDLE] ETH | Px: 2934.35 | M: 2935.3 | B: 2939.1 / S: 2931.5 | delta: -0.2957(+0.0111) | Adj: -0.35%, Vol: 1.00, Thr: 0.0444 | PnL: 0.05 | TotPnL: -303.71
```
* **Status:** The bot has applied a `-0.35%` adjustment (Adj) because price is likely near a range edge or moving favorably.
* **Delta:** This adjustment reduced the target delta slightly.
* **Safety:** The Volatility is low (`1.00`), keeping the Threshold tight (`0.0444`).
## How Calculations Work
1. **Net Delta:** Sum of all Uniswap V3 position deltas + `Adj` factor.
2. **Diff:** `Target Delta` - `Current Hyperliquid Position`.
3. **Triggers (B/S):** Calculated using the **Gamma** (rate of change of delta).
* `Gamma` tells us "How much does Delta change for a $1 price move?"
* `B = Price + (Threshold + Diff) / Gamma`
* `S = Price - (Threshold - Diff) / Gamma`
* *Note:* These are estimates. In tight ranges, Gamma increases rapidly, so actual trades may happen before these prices are hit.