How to Import Nse Options EOD

aggy

Active Member
#1
Dear all

can anyone tell me how to import NSE OPTIONS EOD data into AMIBROKER

field values are like these

INSTRUMENT SYMBOL EXP_DATE STR_PRICE OPT_TYPE OPEN_PRICE HI_PRICE LO_PRICE CLOSE_PRICE OPEN_INT* TRD_QTY NO_OF_CONT NO_OF_TRADE NOTION_VAL PR_VAL
OPTIDX NIFTY 26/03/2015 4200 CE 4750 4752.95 4750 4752.95 58650 50 2 2 447573.75 237573.75
OPTIDX NIFTY 26/03/2015 5000 CE 3980 3980 3920 3970.05 345650 1275 51 40 11402535 5027535
OPTIDX NIFTY 26/03/2015 5500 CE 3446.65 3446.65 3435 3435 11100 100 4 4 894220 344220
OPTIDX NIFTY 26/03/2015 6000 CE 2930 2953.35 2930 2953.35 30850 50 2 2 447083.75 147083.75

here is the file download link

Code:
http://speedy.sh/FhxU2/Options-Bhavcopy-03MAR2015.csv
 

Raghuveer

Well-Known Member
#3
anyone ? please help kinda need that one urgent
Not sure what you are asking, so please pardon if I mistook your post completely.

You need a program/macro/method etc to read columns A to E and create a proper Amibroker symbol.
e.g. row one is : OPTIDX NIFTY 26/03/2015 4200 CE
symbol to be created is: NIFTY15MAR4200CE
e.g. OPTSTK ACC 26/03/2015 1540 PE
symbol: ACC15MAR1540PE

Since all are options we can ignore column A.
Select expiry date column C and change format to "Month-year". This gives date as: Mar-15 for 26/03/2015
rows look like: NIFTY Mar-15 4200 CE

How to join date as text and another col text?
How to delete hyphen in "Mar-15"?

Save the file as csv format file.
Open this newly save file in notepad.
row looks like: OPTIDX ,NIFTY ,Mar-15,4200CE ,4200,CE ,
ctrl+h for find and replace all:
Code:
  ,Mar-15,
with
Code:
Mar15
for each expiry month repeat that find and replace all.
find:
Code:
  ,Apr-15,
and replace all with
Code:
Apr15
row looks like: OPTIDX ,NIFTYMar154200,CE ,

find:
Code:
,CE      ,
replace all with:
Code:
CE,
find:
Code:
,PE      ,
replace all with:
Code:
PE,
row looks like: OPTIDX ,NIFTYMar154200CE,

find:
Code:
,SYMBOL    ,EXP_DATE  ,STR_PRICE  ,OPT_TYPE,
replace with:
Code:
,TRADINGSYMBOL,
header line looks like: INSTRUMENT,TRADINGSYMBOL,
Maybe there are other better ways to find and replace.

Save file (as csv). If you find any blanks/comma's in TRADINGSYMBOL carefully use find and replace to remove spaces.

Part of end result:
Code:
INSTRUMENT,TRADINGSYMBOL,OPEN_PRICE ,HI_PRICE   ,LO_PRICE   ,CLOSE_PRICE,OPEN_INT*      ,TRD_QTY          ,NO_OF_CONT       ,NO_OF_TRADE      ,NOTION_VAL        ,PR_VAL            
OPTIDX    ,NIFTYMar154200CE,4796.45,4805.05,4796.45,4805.05,58650,50,2,2,450037.5,240037.5
OPTIDX    ,NIFTYMar155000CE,3990.45,4030,3965,4030,345575,800,32,19,7201840,3201840
OPTIDX    ,NIFTYMar156000CE,3030,3034,3030,3032,30900,50,2,2,451600,151600
OPTIDX    ,NIFTYMar156500CE,2474.7,2541.95,2474.7,2528.7,27125,325,13,7,2928408.75,815908.75
$FORMAT Ticker, Date, Time, Open, High, Low, Close, Volume, OpenInt
We have all format fields except Date. If file name holds date then Date_DMY is the format. In excel create a Date field column and copy the same date as for all cells in column.

You can now create and use the regular ami format file to import as usual.
------------------------------------------------------------------------
Don't use now, just for future use: Another way to join columns-
How to join two adjacent columns?
Insert a new column and enter formula =CONCATENATE(D2,E2)
This joins 4200 CE to give 4200CE
Select this whole column (the one with 4200CE) and cut and insert it next to exp date.
row looks like: OPTIDX NIFTY Mar-15 4200CE 4200 CE
 
Last edited:
#4
above method works

if i was u i would have focused more on getting simplified data source...
in nest if u click -->Data table u get
1 min format data
Trading Symbol,Time,Open,High,Low,Close/Price,Volume

then create format file in amibroker with
# Format definition file generated automatically
# by AmiBroker's ASCII Import Wizard
$FORMAT Ticker, Date_DMY, Time, Open, High, Low, Close, Volume
$SKIPLINES 1
$SEPARATOR ", "
$CONT 1
$GROUP 255
$AUTOADD 1
$ALLOWNEG 1
that can be easily opened in amibroker .... just saying...
and selecting Daily view u can view Eod :xD
 

casoni

Well-Known Member
#5
Hello ,
Best and easy to use is
1] subhalabha
2] GetBhavcopy
you will find more ...search EOD download [ data feed section ] in this forum
 
Last edited: