Compare commits

..

1 Commits

Author SHA1 Message Date
Nelson Torres 833a4f1d1c 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:30:11 -03:00
1 changed files with 17 additions and 1 deletions

View File

@ -12,7 +12,8 @@ from piker.brokers.deribit.api import (
) )
import sys import sys
import pyqtgraph as pg import pyqtgraph as pg
from pyqtgraph import ScatterPlotItem from PyQt6 import QtCore
from pyqtgraph import ScatterPlotItem, InfiniteLine
from PyQt6.QtWidgets import QApplication from PyQt6.QtWidgets import QApplication
def check_if_complete( def check_if_complete(
@ -135,6 +136,21 @@ async def max_pain_daemon(
) )
plot.addItem(scatter_iv) plot.addItem(scatter_iv)
total_intrinsic_value, max_pain = get_intrinsic_value_and_max_pain(intrinsic_values)
vertical_line = InfiniteLine(
pos=max_pain,
angle=90,
pen=pg.mkPen(color='yellow', width=2, style=QtCore.Qt.PenStyle.DotLine),
label=f'Max pain: {max_pain:,.0f}',
labelOpts={
'position': 0.8,
'color': 'yellow',
'movable': True
}
)
plot.addItem(vertical_line)
def update_oi_by_strikes(msg: tuple): def update_oi_by_strikes(msg: tuple):
nonlocal oi_by_strikes nonlocal oi_by_strikes
if 'oi' == msg[0]: if 'oi' == msg[0]: