Compare commits

..

1 Commits

Author SHA1 Message Date
Nelson Torres dc2e41e550 Add Plot
Here is the `plot_graph()` that is in char of the bars, scatter and vertical line plot items.

Also all the necessary code  for the graph to be shown.
2025-02-04 17:52:52 -03:00
1 changed files with 3 additions and 3 deletions

View File

@ -99,8 +99,6 @@ async def max_pain_daemon(
"""Update the bar graph with new open interest data."""
plot.clear()
intrinsic_values = get_total_intrinsic_values(oi_by_strikes)
for strike_str in sorted(oi_by_strikes, key=lambda x: int(x)):
strike = int(strike_str)
calls_val = float(oi_by_strikes[strike_str]['C'])
@ -124,6 +122,8 @@ async def max_pain_daemon(
)
plot.addItem(bar_p)
for strike_str in sorted(intrinsic_values, key=lambda x: int(x)):
strike = int(strike_str)
total_val = float(intrinsic_values[strike_str]['total']) / 100000
scatter_iv = ScatterPlotItem(
@ -136,7 +136,7 @@ async def max_pain_daemon(
)
plot.addItem(scatter_iv)
_, max_pain = get_intrinsic_value_and_max_pain(intrinsic_values)
total_intrinsic_value, max_pain = get_intrinsic_value_and_max_pain(intrinsic_values)
vertical_line = InfiniteLine(
pos=max_pain,