File tree 1 file changed +37
-18
lines changed
1 file changed +37
-18
lines changed Original file line number Diff line number Diff line change 41
41
},
42
42
{
43
43
"cell_type" : " code" ,
44
- "execution_count" : 24 ,
44
+ "execution_count" : 25 ,
45
45
"metadata" : {},
46
- "outputs" : [
47
- {
48
- "data" : {
49
- "text/plain" : [
50
- " 10225"
51
- ]
52
- },
53
- "execution_count" : 24 ,
54
- "metadata" : {},
55
- "output_type" : " execute_result"
56
- }
57
- ],
46
+ "outputs" : [],
58
47
"source" : [
59
48
" def itm(price, opt='C', step=100):\n " ,
60
49
" \"\"\"\n " ,
83
72
},
84
73
{
85
74
"cell_type" : " code" ,
86
- "execution_count" : 10 ,
75
+ "execution_count" : 75 ,
87
76
"metadata" : {},
88
77
"outputs" : [],
89
78
"source" : [
90
79
" nifty = pd.read_csv('/home/machine/Downloads/NIFTY 50_Data.csv',\n " ,
91
- " parse_dates=['Date'])"
80
+ " parse_dates=['Date'])\n " ,
81
+ " der = pd.read_hdf('/media/machine/4E1EA2D152455460/data/output/fno_2019.h5')\n " ,
82
+ " der['exp_day'] = der.expiry_dt.dt.day\n " ,
83
+ " \n " ,
84
+ " # Difference between expiry date and date\n " ,
85
+ " der['day_diff'] = (der['expiry_dt'] - der['timestamp']).dt.days\n "
92
86
]
93
87
},
94
88
{
95
89
"cell_type" : " code" ,
96
- "execution_count" : null ,
90
+ "execution_count" : 89 ,
97
91
"metadata" : {},
98
- "outputs" : [],
99
- "source" : []
92
+ "outputs" : [
93
+ {
94
+ "data" : {
95
+ "text/plain" : [
96
+ " 2 2019-01-31\n " ,
97
+ " 1 2019-02-28\n " ,
98
+ " 3 2019-03-28\n " ,
99
+ " 0 2019-04-25\n " ,
100
+ " 4 2019-05-30\n " ,
101
+ " 5 2019-06-27\n " ,
102
+ " dtype: datetime64[ns]"
103
+ ]
104
+ },
105
+ "execution_count" : 89 ,
106
+ "metadata" : {},
107
+ "output_type" : " execute_result"
108
+ }
109
+ ],
110
+ "source" : [
111
+ " # Change your symbol here\n " ,
112
+ " symbol = 'NIFTY'\n " ,
113
+ " # Keep nifty data with monthly options only\n " ,
114
+ " # This hack is incomplete and should be correctly configured\n " ,
115
+ " q = '(symbol==\" {sym}\" ) & (instrument==\" OPTIDX\" ) & (exp_day > 24) & (day_diff<31)'\n " ,
116
+ " df = der.query(q.format(sym=symbol))\n " ,
117
+ " pd.Series(df.expiry_dt.unique()).sort_values()"
118
+ ]
100
119
}
101
120
],
102
121
"metadata" : {
You can’t perform that action at this time.
0 commit comments