Skip to content

Commit 397d18b

Browse files
committed
dates added on hover
1 parent f56cb39 commit 397d18b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

oi_graph/futures_oi.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,13 @@ def get_open_interest(data, symbol):
4747
button = Button(label='Refresh', button_type="success")
4848

4949
# Create plots
50-
p = figure(title='Open interest chart for NIFTY futures')
50+
p = figure(title='Open interest chart for NIFTY futures',
51+
tooltips=[
52+
('date', '@date'),
53+
('value', '$y{0 a}')
54+
])
5155
cols, data = get_open_interest(df, 'NIFTY')
56+
data['date'] = data.timestamp.dt.date.astype(str)
5257
colors = Spectral6[:len(cols)]
5358
source.data = source.from_df(data)
5459
print(cols, colors)
@@ -58,6 +63,7 @@ def get_open_interest(data, symbol):
5863
def update():
5964
symbol = select_symbol.value
6065
cols, data = get_open_interest(df, symbol)
66+
data['date'] = data.timestamp.dt.date.astype(str)
6167
source.data = source.from_df(data)
6268
max_val = data.sum(axis=1).max()
6369
print(cols, symbol, max_val)

0 commit comments

Comments
 (0)