Skip to content

Commit 92d29f2

Browse files
committed
black formatting
1 parent d5e7555 commit 92d29f2

2 files changed

Lines changed: 18 additions & 17 deletions

File tree

examples/appl_example.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858

5959

6060
# plot fitted IV smile as 2D plot
61-
# est_appl.plot_iv(observations="range", x_axis="strike")
62-
# plt.show()
61+
est_appl.plot_iv(observations="range", x_axis="strike")
62+
plt.show()
6363

6464

6565
# return SVI parameters
@@ -154,7 +154,7 @@
154154
print("\nTesting Plotting...")
155155
try:
156156
import matplotlib.pyplot as plt
157-
157+
158158
# 1. VolCurve Plot
159159
# Pick the first available expiry
160160
expiry_to_plot = appl_surface.expiries[0]
@@ -168,7 +168,7 @@
168168
fig_pdf = dist.plot(kind="pdf", title="Implied PDF (100 days)")
169169
# plt.show() # Uncomment to see plot
170170
print("Distribution.plot() successful")
171-
171+
172172
except ImportError:
173173
print("Matplotlib not installed, skipping plotting tests")
174174
except Exception as e:

oipd/interface/volatility.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def iv_smile(
173173
174174
Returns:
175175
DataFrame containing:
176-
176+
177177
- ``strike``: Strike levels.
178178
- ``fitted_iv``: Fitted implied volatility from the calibrated model.
179179
- ``market_iv``: *(if include_observed=True)* Mid-price implied volatility
@@ -203,31 +203,32 @@ def iv_smile(
203203

204204
def plot(self, **kwargs) -> Any:
205205
"""Plot the fitted implied volatility smile.
206-
206+
207207
Args:
208208
**kwargs: Arguments forwarded to ``oipd.presentation.iv_plotting.plot_iv_smile``.
209-
209+
210210
Returns:
211211
matplotlib.figure.Figure: The plot figure.
212-
"""
212+
"""
213213
smile_df = self.iv_smile()
214-
214+
215215
# Map our column names to what plot_iv_smile expects
216-
plot_df = smile_df.rename(columns={
217-
"market_bid_iv": "bid_iv",
218-
"market_ask_iv": "ask_iv",
219-
"market_last_iv": "last_iv"
220-
})
216+
plot_df = smile_df.rename(
217+
columns={
218+
"market_bid_iv": "bid_iv",
219+
"market_ask_iv": "ask_iv",
220+
"market_last_iv": "last_iv",
221+
}
222+
)
221223

222224
# Extract reference price (forward) for log-moneyness plotting
223225
reference = None
224226
forward_price = self._metadata.get("forward_price")
225227
if forward_price is not None:
226228
reference = ReferenceAnnotation(
227-
value=float(forward_price),
228-
label=f"Forward: {float(forward_price):.2f}"
229+
value=float(forward_price), label=f"Forward: {float(forward_price):.2f}"
229230
)
230-
231+
231232
# If no reference price is available, default to strike axis to avoid errors
232233
if reference is None and "axis_mode" not in kwargs:
233234
kwargs["axis_mode"] = "strike"

0 commit comments

Comments
 (0)