core.test_hedge_edge
Test APR calculation with zero days to expiry (Edge Case).
Background: APR = (1 + ROI)^(365/days) - 1. If days = 0, we have division by zero in the exponent.
Reasoning: Verify that the function handles 0 days gracefully (e.g., returns 0) instead of crashing.
Test APR calculation with -100% ROI (Edge Case).
Background: If ROI is -1 (total loss), the base (1+ROI) is 0. 0^exponent is 0. APR should be -1 (-100%).
Reasoning: Verify power function handles base 0 correctly.
Test Option Quantities for Strike > Reference Strike (Edge Case).
Background:
The strategy usually buys puts for strikes below the reference (current/min) price
to hedge downside. If Strike > Reference, the formula might imply selling calls or puts?
The code logic: if strike <= reference_strike: ... else: qty = 0.
Reasoning: Verify that strikes above the reference explicitly return 0 quantity, ensuring we don't accidentally hedge upside or enter undefined behavior regions.
Test Days to Expiry with a past date (Edge Case).
Background: If the user inputs an expiry date in the past, days will be negative.
Reasoning: Verify the calculation returns a negative integer, which other functions should handle (e.g. APR returns 0).
Test Put Payoff when Spot ends far above Strike (Edge Case).
Background: If Spot > Strike at expiry, Put is worthless.
Reasoning: Verify payoff is exactly 0.