Assignment 1: Simple Data Pre-processing.
Create BANKNIFTY future and option data from
given csv file:
Steps for preparing Future data:
1. Filter BANKNIFTY-I.NFO from Ticker column.
2. Convert Date and Time into a new datetime column.
3. Remove columns: Ticker, Date, Time, Volume, Open Interest.
4. Sort data by datetime.
Output: Your output seems to appear like this.
Steps for preparing Option data:
1. Filter BANKNIFTYxxxxxxxxxxCE.NFO & BANKNIFTYxxxxxxxxxxPE.NFO from ticker column.
Now, Ticker column have value like:
BANKNIFTY03FEB2235000PE.NFO
BANKNIFTY03FEB2235500CE.NFO
BANKNIFTY03FEB2235500CE.NFO
BANKNIFTY03FEB2235500CE.NFO
BANKNIFTY03FEB2235500CE.NFO
BANKNIFTY03FEB2235000PE.NFO => BANKNIFTY | 03FEB22 | 35000PE | .NFO
Extract scrip (35000PE) from ticker and create separate column named scrip.
Extract expiry date (03FEB22) form ticker and create separate column named expiry.
2. Convert Date and Time into a new datetime column.
3. Calculate dte = expiry - Date
4. Filter data by minimum dte value.
5. Remove columns: Ticker, Date, Time, Volume, Open Interest.
6. Sort data by datetime.
Output: Your output seems to appear like this.