hemenkapadia / getbhavcopy

Free NSE and BSE data downloader
http://www.getbhavcopy.com
112 stars 48 forks source link

Incorrect identification of current month(-I) next month(-II) and far month (-III) for stocks. #197

Open sparshmultiplier opened 3 years ago

sparshmultiplier commented 3 years ago

I found the following discrepancy while looking at voltas futures script for 12-July-2021.

As per file generated by getbhavcopy: VOLTAS-II,20210712,1020.8,1029.8,1016.25,1019.9,2346,3071000 VOLTAS-III,20210712,1020,1027.7,1016.7,1019.3,94,176000 VOLTAS-I,20210712,0,0,0,1019.25,0,9000

As per NSE bhav copy file:

FUTSTK | VOLTAS | 29-Jul-21 | 0 | XX | 1020.8 | 1029.8 | 1016.25 | 1019.9 | 1019.9 | 2346 | 12012.73 | 3071000 | -71000 | 12-Jul-21 FUTSTK | VOLTAS | 26-Aug-21 | 0 | XX | 1020 | 1027.7 | 1016.7 | 1019.3 | 1019.3 | 94 | 481.15 | 176000 | 8500 | 12-Jul-21 FUTSTK | VOLTAS | 30-Sep-21 | 0 | XX | 0 | 0 | 0 | 1019.25 | 1025.95 | 0 | 0 | 9000 | 0 | 12-Jul-21

I also found that the data for indexes is correct. As per file generated by getbhavcopy: BANKNIFTY-I,20210712,35386,35569.35,35152.05,35311.55,122808,2123250 BANKNIFTY-II,20210712,35601.95,35690,35311,35455.6,2798,107050 BANKNIFTY-III,20210712,35679.95,35839.4,35476.5,35606.95,397,15175

As per NSE bhav copy file:

FUTIDX | BANKNIFTY | 29-Jul-21 | 0 | XX | 35386 | 35569.35 | 35152.05 | 35311.55 | 35311.55 | 122808 | 1086154 | 2123250 | -9350 | 12-Jul-21 FUTIDX | BANKNIFTY | 26-Aug-21 | 0 | XX | 35601.95 | 35690 | 35311 | 35455.6 | 35455.6 | 2798 | 24836.53 | 107050 | 8050 | 12-Jul-21 FUTIDX | BANKNIFTY | 30-Sep-21 | 0 | XX | 35679.95 | 35839.4 | 35476.5 | 35606.95 | 35606.95 | 397 | 3539.32 | 15175 | 450 | 12-Jul-21

silenThunderr commented 3 years ago

I agree

silenThunderr commented 3 years ago

to FIX the same via Options Go to FuturesNSE

Near Month use -III Next Month use -I Far Month use -I

Re download and rebuild data base

image

online-irrational-mind commented 2 years ago

This issue seems to be prevalent in the historical futures data as well.

online-irrational-mind commented 2 years ago

Checking history of the files, seems like the issue was introduced with the introduction of FINNIFTY from 11 Jan 2021 which has 10 line items in the file (i.e. not a multiple of 3). However, the code may be making an assumption that there are always three contracts for each security and iterates through I, II and III in tagging. Due to this whatever follows FINNIFTY is shifted.

sparshmultiplier commented 2 years ago

This requires a code fix as it happens in history and also no specific pattern is found. I suggest creating a map of all dates in bhavcopy with continuous contract identification and then later writing output file using this map.

On Mon, Oct 11, 2021, 11:29 online-irrational-mind @.***> wrote:

Checking history of the files, seems like the issue was introduced with the introduction of FINNIFTY from 11 Jan 2021 which has 10 line items in the file (i.e. not a multiple of 3). However, the code may be making an assumption that there are always three contracts for each security and iterates through I, II and III in tagging. Due to this whatever follows FINNIFTY is shifted.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hemenkapadia/getbhavcopy/issues/197#issuecomment-939704712, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMPZB47ESULF3GWHAFNAZ73UGJ4LXANCNFSM5BFTEFNQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

shyam027 commented 2 years ago

to FIX the same via Options Go to FuturesNSE

Near Month use -III Next Month use -I Far Month use -I

Re download and rebuild data base

image

No, if you fix Banknifty, then Nifty will have the wrong data. In order to properly fix it, this code needs to be rewritten.