Skip to content

Commit 190e4d6

Browse files
committed
tooltips added for all charts
1 parent 88d01e1 commit 190e4d6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

oi_graph/futures_oi.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,21 +85,30 @@ def get_price_oi(data, symbol):
8585
l0 = price_data['close'].min()
8686
h1 = price_data['open_int'].max()
8787
l1 = price_data['open_int'].min()
88+
8889
p2 = figure(title='Price vs Open Interest',
8990
x_axis_type='datetime', y_range=(l0,h0),
91+
tooltips = [
92+
('date', '@timestamp{%F}'),
93+
('value', '$y{0.00 a}')
94+
],
9095
background_fill_color='beige', background_fill_alpha=0.4)
9196
p2.line('timestamp', 'close', line_width=2, source=prices)
9297
p2.extra_y_ranges = {'foo': Range1d(l1,h1)}
9398
p2.line('timestamp', 'open_int', source=prices, y_range_name='foo',
9499
line_color='firebrick', line_width=2)
95100
p2.add_layout(LinearAxis(y_range_name='foo'), 'right')
96101
p2.yaxis[1].formatter = NumeralTickFormatter(format='0.0 a')
102+
p2.hover.formatters = {'timestamp': 'datetime'}
97103

98104
pct_change = data[['date', 'combined_oi']].copy()
99105
pct_change['date'] = pd.to_datetime(pct_change['date'])
100106
pct_change['chg'] = pct_change.combined_oi.pct_change()
101107
pct_chg.data = pct_chg.from_df(pct_change)
102108
p3 = figure(title='Change in open_interest',
109+
tooltips=[
110+
('change', '$y{0.00%}')
111+
],
103112
background_fill_color='beige', background_fill_alpha=0.4)
104113
p3.vbar(x='index', top='chg', width=0.6,
105114
fill_alpha=0.7, color='gold', source=pct_chg)

0 commit comments

Comments
 (0)