Instrument list format

Shabeershah2002
Shabeershah2002 edited February 2017 in General
Downloaded instrument list having extra commas in between this is leading to error while splitting programmatically

Below instruments have got additional comma (,) after the name before the inverted comma

138278148,540149,TRANSPEBBPH,"TRANSPEK INDUSTRY,",0.0,,0.0,0.05,1,EQ,BSE,BSE:
192148228,750579,POLSONLR,"POLSON,",0.0,,0.0,0.1,1,EQ,BSE,BSE
192149764,750585,IPRINGLTDLR,"IP RINGS,",0.0,,0.0,0.05,1,EQ,BSE,BSE
112645124,440020,SBIB-ML,"STATE BANK OF INDIA,",0.0,,0.0,0.01,1,EQ,BSE,BSE
138198532,539838,DRREDDYBBPH,"DR. REDDY'S LABORATORIES,",0.0,,0.0,0.05,1,EQ,BSE,BSE
138199044,539840,EILBBPH,"EXCELL INDUSTRIES,",0.0,,0.0,0.05,1,EQ,BSE,BSE


is that really required ?, because when we split this with comma delimiter the array is having 13 sometimes and the last few elements going out of boundary etc..
  • sujith
    Hi @Shabeershah2002,
    We will check on Monday and let you know.
  • Shabeershah2002
    any update on this ?
  • pranksterguru
    those are not extra comma, if you count the number of comma in each row it is same..
  • Shabeershah2002
    @ pranksterguru, yes if you count the commas on the symbols which I listed here you will get 12 commas where rest of the symbols which I didn't list only have 11 commas and they are about 70k symbols!!!....... Only these listed symbols have 12 commas, and if you notice one of the comma is coming on the name of the symbol inside the inverted comma, something like "STATE BANK OF INDIA," !! .... what is the need of that comma which really makes head ache
  • pranksterguru
    sorry i understand your question now. i just checked my instruments table and it has comma too. but i didnt have any problem loading them as i am using zerodha's java api

    may be their tech team can help you.
  • Kailash
    @Shabeershah2002 , the data BSE sends has a comma itself. Here's the row from our instruments.csv file
    138278148,540149,TRANSPEBBPH,"TRANSPEK INDUSTRY,",0.0,,0.0,0.05,1,EQ,BSE,BSE

    As you can see, the company name with the trailing comma is inside a pair of quotes " and ". This is perfectly fine.

    Instead of splitting the string with a comma (which is not the correct way to parse a CSV), please use a proper CSV parser library which will take care of quoted fields.
This discussion has been closed.