We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 397d18b commit 2220b1bCopy full SHA for 2220b1b
oi_graph/futures_oi.py
@@ -36,6 +36,22 @@ def get_open_interest(data, symbol):
36
pct_pivot = pivot.pct_change()*100
37
return (list(pivot.columns), pivot.reset_index())
38
39
+def get_price_oi(data, symbol):
40
+ """
41
+ Get the price and combined open_interest for the symbol
42
+ data
43
+ dataframe with all data
44
+ symbol
45
+ symbol to extract data
46
47
+ temp = data[data.symbol == symbol]
48
+ grouped = temp.groupby('timestamp')
49
+ agg = grouped.agg({'open_int': sum, 'close': 'mean'}).reset_index()
50
+ agg['date'] = agg.timestamp.dt.date.astype(str)
51
+ agg['index'] = range(len(agg))
52
+ return agg
53
+
54
55
output_file('futures_oi.html')
56
df = load_data()
57
symbols = list(df.symbol.unique())
0 commit comments