Idirect-Tech / Breeze-Python-SDK

The official Python client library for the ICICI Securities trading APIs
MIT License
58 stars 30 forks source link

Bug in get_historical_data_v2(), needs immediate attention!!! #114

Open saugatapaul1010 opened 1 month ago

saugatapaul1010 commented 1 month ago

I am trying to run this simple code for fetching historical data for 1-second interval for Nifty.

from breeze_connect import BreezeConnect
breeze_client = BreezeConnect("********************************")
breeze_client.generate_session(api_secret="********************************", session_token="********")

data = breeze_client.get_historical_data_v2(interval='1second', 
                                            from_date="2015-01-01T10:15:00.000Z",
                                            to_date="2015-01-01T10:30:00.000Z",
                                            stock_code='nifty',
                                            exchange_code='nse',
                                            product_type='cash')

The problem is the API endpoint is not behaving the way it' expected to. There are several issues:

  1. First, I get the response as {'Error': None, 'Status': 200, 'Success': []}, if I keep the interval to 1-second and if I change the interval to 1-minute, I get the below response.
  'Error': None,
  'Status': 200,
  'Success': [
    {
      'close': 8267.7,
      'datetime': '2015-01-01 10:15:00',
      'exchange_code': 'NSE',
      'high': 8267.7,
      'low': 8267.7,
      'open': 8267.7,
      'stock_code': 'NIFTY',
      'volume': 0
    },
    {
      'close': 8268.15,
      'datetime': '2015-01-01 10:16:00',
      'exchange_code': 'NSE',
      'high': 8268.15,
      'low': 8268.15,
      'open': 8268.15,
      'stock_code': 'NIFTY',
      'volume': 0
    },
    {
      'close': 8266.45,
      'datetime': '2015-01-01 10:17:00',
      'exchange_code': 'NSE',
      'high': 8266.45,
      'low': 8266.45,
      'open': 8266.45,
      'stock_code': 'NIFTY',
      'volume': 0
    },
    {
      'close': 8267.05,
      'datetime': '2015-01-01 10:18:00',
      'exchange_code': 'NSE',
      'high': 8267.05,
      'low': 8267.05,
      'open': 8267.05,
      'stock_code': 'NIFTY',
      'volume': 0
    },
    {
      'close': 8267.05,
      'datetime': '2015-01-01 10:19:00',
      'exchange_code': 'NSE',
      'high': 8267.05,
      'low': 8267.05,
      'open': 8267.05,
      'stock_code': 'NIFTY',
      'volume': 0
    },
    {
      'close': 8268.85,
      'datetime': '2015-01-01 10:20:00',
      'exchange_code': 'NSE',
      'high': 8268.85,
      'low': 8268.85,
      'open': 8268.85,
      'stock_code': 'NIFTY',
      'volume': 0
    },
    {
      'close': 8269.0,
      'datetime': '2015-01-01 10:21:00',
      'exchange_code': 'NSE',
      'high': 8269.0,
      'low': 8269.0,
      'open': 8269.0,
      'stock_code': 'NIFTY',
      'volume': 0
    },
    {
      'close': 8269.35,
      'datetime': '2015-01-01 10:22:00',
      'exchange_code': 'NSE',
      'high': 8269.35,
      'low': 8269.35,
      'open': 8269.35,
      'stock_code': 'NIFTY',
      'volume': 0
    },
    {
      'close': 8269.55,
      'datetime': '2015-01-01 10:23:00',
      'exchange_code': 'NSE',
      'high': 8269.55,
      'low': 8269.55,
      'open': 8269.55,
      'stock_code': 'NIFTY',
      'volume': 0
    },
    {
      'close': 8269.15,
      'datetime': '2015-01-01 10:24:00',
      'exchange_code': 'NSE',
      'high': 8269.15,
      'low': 8269.15,
      'open': 8269.15,
      'stock_code': 'NIFTY',
      'volume': 0
    },
    {
      'close': 8269.35,
      'datetime': '2015-01-01 10:25:00',
      'exchange_code': 'NSE',
      'high': 8269.35,
      'low': 8269.35,
      'open': 8269.35,
      'stock_code': 'NIFTY',
      'volume': 0
    },
    {
      'close': 8269.15,
      'datetime': '2015-01-01 10:26:00',
      'exchange_code': 'NSE',
      'high': 8269.15,
      'low': 8269.15,
      'open': 8269.15,
      'stock_code': 'NIFTY',
      'volume': 0
    },
    {
      'close': 8269.35,
      'datetime': '2015-01-01 10:27:00',
      'exchange_code': 'NSE',
      'high': 8269.35,
      'low': 8269.35,
      'open': 8269.35,
      'stock_code': 'NIFTY',
      'volume': 0
    },
    {
      'close': 8269.25,
      'datetime': '2015-01-01 10:28:00',
      'exchange_code': 'NSE',
      'high': 8269.25,
      'low': 8269.25,
      'open': 8269.25,
      'stock_code': 'NIFTY',
      'volume': 0
    },
    {
      'close': 8268.8,
      'datetime': '2015-01-01 10:29:00',
      'exchange_code': 'NSE',
      'high': 8268.8,
      'low': 8268.8,
      'open': 8268.8,
      'stock_code': 'NIFTY',
      'volume': 0
    },
    {
      'close': 8268.25,
      'datetime': '2015-01-01 10:30:00',
      'exchange_code': 'NSE',
      'high': 8268.25,
      'low': 8268.25,
      'open': 8268.25,
      'stock_code': 'NIFTY',
      'volume': 0
    }
  ]
}

Logically, If I can retrieve data for 1st Jan, 2015 from 9:15 to 9:30 using 1 minute interval, I should also be able to do the same for 1 second interval right? Also, if no data is getting retrieved, why is this not reflected in the error status in the JSON response?

PS : The exact same code for my pipeline ran successfully even couple of weeks back when I had used it to download historical data for nifty. But for some weird reason, this is not working for 1-second interval, now (as of 14th July, 2024).

  1. Another major issue is that seems some exceptions are not handled properly. If I use the below code,
data = breeze_client.get_historical_data_v2(
interval='1second', 
from_date="2015-01-01T10:15:00.000Z",
to_date="2015-01-01T10:30:00.000Z",
stock_code='nifty',
exchange_code='nse',
product_type='cash')

I am still getting this response {'Error': None, 'Status': 200, 'Success': []}, which is clearly wrong because the stock_code is invalid. My data retrieval pipeline is breaking because of this reason. What should I do to fix this?

I have tested this using breeze-connect 1.0.56 and 1.0.51 and I have tested this in both Windows & Linux. But it's not working at this point of time, but it used to work previously (the exact same code), for 1 second interval. And when I say it used to work previously, that means in past, I was able to download 1second data for 1st Jan 2015, from 9:15 to 9:30. Can you please look into this urgently?

iamsuvhro commented 1 month ago

I am also facing the same issue in my local and also I have attached the screenshot.

ss

Idirect-Tech commented 1 month ago

Dear Suvhradip,

We are providing historical 1 second interval data from 2019.

[E29CF836]

Thanks & Regards,

Hiten Solanki,

Team Breeze API,

ICICI Securities


From: Suvhradip Ghosh @.> Sent: Monday, July 15, 2024 12:42 PM To: Idirect-Tech/Breeze-Python-SDK @.> Cc: Subscribed @.***> Subject: Re: [Idirect-Tech/Breeze-Python-SDK] Bug in get_historical_data_v2(), needs immediate attention!!! (Issue #114)

CAUTION: This email originated from outside the organization! Do not click links, open attachments or reply, unless you recognize the sender's email address! Use 'Report suspicious Email' button in the toolbar to report Phishing mails. Beware!

I am also facing the same issue in my local and also I have attached the screenshot.

ss.png (view on web)https://github.com/user-attachments/assets/b57aff81-2360-48ff-af0e-c016cdc7cb95

— Reply to this email directly, view it on GitHubhttps://github.com/Idirect-Tech/Breeze-Python-SDK/issues/114#issuecomment-2227834872, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A3TQZ47BBY542QCFZHIC373ZMNY7FAVCNFSM6AAAAABK3DL7A2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRXHAZTIOBXGI. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Print this mail only if absolutely necessary. Save Paper. Save Trees." "The information contained in this e-mail and any attachments to this message are intended for the exclusive use of the intended recipient and may contain proprietary, confidential or legally privileged information. If you are not the intended recipient, please note that you are not authorised to disseminate, distribute or copy this e-mail or any parts of it or act upon/rely on the contents of this e-mail in any manner. Please notify the sender immediately by e-mail and destroy all copies of this e-mail and any attachments. Please also note that ICICI Bank or its subsidiaries and associated companies, (collectively "ICICI Group"), are unable to exercise control or ensure the integrity of/over the contents of the information contained in e-mail transmissions and that any views expressed in this e-mail are not endorsed by/binding on the ICICI Group unless the sender does so expressly with due authority of ICICI Group. Before opening any attachments please check them for viruses and defects and please note that ICICI Group accepts no liability or responsibility for any damage caused by any virus that may be transmitted by this email. Any unauthorized use of this email or any attachment(s) may be treated as infringement of right(s) including right of privacy under the applicable laws of India including Information and Technology Act, 2000. Thank you for your cooperation. Regulatory Disclosures are available on https://www.icicisecurities.com (for institutional business) and www.icicidirect.com (for retail business).

saugatapaul1010 commented 1 month ago

Hi Hiten Solanki, is there any policy change? Because, I am pretty sure that few months back, I downloaded the data for Nifty during the same time interval for 1 second (for 2015). According to what was written 4 months back, we had access to 1-sec tick by tick data for the last 10 years (from the present date). So why this sudden change of rules now? What do I need to do now in order to get historical data for Nifty from the beginning of time till today? Do you have any paid subscriptions that I can use?

saugatapaul1010 commented 3 weeks ago

Hi Hiten, any update on this?

Idirect-Tech commented 3 weeks ago

Dear Saugata,

Thank you for showing interest in Breeze API.

We provide 1 minute interval candle data from 03-Jan-2011 onwards.

For 1 seconds data, We provide data from May-2018 onwards for 1 second interval depending on Indices contract launched date in the market.

[E29CF836] Thanks & Regards, Akash Sapkal, Team Breeze API, ICICI Securities


From: Saugata Paul @.> Sent: 26 July 2024 14:51 To: Idirect-Tech/Breeze-Python-SDK @.> Cc: BREEZEAPI @.>; Comment @.> Subject: Re: [Idirect-Tech/Breeze-Python-SDK] Bug in get_historical_data_v2(), needs immediate attention!!! (Issue #114)

CAUTION: This email originated from outside the organization! Do not click links, open attachments or reply, unless you recognize the sender's email address! Use 'Report suspicious Email' button in the toolbar to report Phishing mails. Beware!

Hi Hiten, any update on this?

— Reply to this email directly, view it on GitHubhttps://github.com/Idirect-Tech/Breeze-Python-SDK/issues/114#issuecomment-2252326471, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A3TQZ477BWULYZ36GRKHAL3ZOIIKDAVCNFSM6AAAAABK3DL7A2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJSGMZDMNBXGE. You are receiving this because you commented.Message ID: @.***>

Print this mail only if absolutely necessary. Save Paper. Save Trees." "The information contained in this e-mail and any attachments to this message are intended for the exclusive use of the intended recipient and may contain proprietary, confidential or legally privileged information. If you are not the intended recipient, please note that you are not authorised to disseminate, distribute or copy this e-mail or any parts of it or act upon/rely on the contents of this e-mail in any manner. Please notify the sender immediately by e-mail and destroy all copies of this e-mail and any attachments. Please also note that ICICI Bank or its subsidiaries and associated companies, (collectively "ICICI Group"), are unable to exercise control or ensure the integrity of/over the contents of the information contained in e-mail transmissions and that any views expressed in this e-mail are not endorsed by/binding on the ICICI Group unless the sender does so expressly with due authority of ICICI Group. Before opening any attachments please check them for viruses and defects and please note that ICICI Group accepts no liability or responsibility for any damage caused by any virus that may be transmitted by this email. Any unauthorized use of this email or any attachment(s) may be treated as infringement of right(s) including right of privacy under the applicable laws of India including Information and Technology Act, 2000. Thank you for your cooperation. Regulatory Disclosures are available on https://www.icicisecurities.com (for institutional business) and www.icicidirect.com (for retail business).

saugatapaul1010 commented 2 weeks ago

Hi Icici Breeze team. My algo trading software is ready. But I am not being able to use it because I primarily trade in MCX exchange, either in Crude Oil or Natural Gas. Currently I do not have any way to use the historical data from Crude Oil through Breeze, due to which my deployment is halted currently. I wish to know, is there are any near plans to make the commodities data accessible through Breeze API?

Idirect-Tech commented 2 weeks ago

Dear User,

Thank you for showing interest in Breeze API.

MCX trading is not available on Breeze API.

[E29CF836] Thanks & Regards, Akash Sapkal, Team Breeze API, ICICI Securities


From: Saugata Paul @.> Sent: 04 August 2024 17:24 To: Idirect-Tech/Breeze-Python-SDK @.> Cc: BREEZEAPI @.>; Comment @.> Subject: Re: [Idirect-Tech/Breeze-Python-SDK] Bug in get_historical_data_v2(), needs immediate attention!!! (Issue #114)

CAUTION: This email originated from outside the organization! Do not click links, open attachments or reply, unless you recognize the sender's email address! Use 'Report suspicious Email' button in the toolbar to report Phishing mails. Beware!

Hi Icici Breeze team. My algo trading software is ready. But I am not being able to use it because I primarily trade in MCX exchange, either in Crude Oil or Natural Gas. Currently I do not have any way to use the historical data from Crude Oil through Breeze, due to which my deployment is halted currently. I wish to know, is there are any near plans to make the commodities data accessible through Breeze API?

— Reply to this email directly, view it on GitHubhttps://github.com/Idirect-Tech/Breeze-Python-SDK/issues/114#issuecomment-2267515089, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A3TQZ45C7PZWZFTI5AVQ3T3ZPYI7NAVCNFSM6AAAAABK3DL7A2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRXGUYTKMBYHE. You are receiving this because you commented.Message ID: @.***>

Print this mail only if absolutely necessary. Save Paper. Save Trees." "The information contained in this e-mail and any attachments to this message are intended for the exclusive use of the intended recipient and may contain proprietary, confidential or legally privileged information. If you are not the intended recipient, please note that you are not authorised to disseminate, distribute or copy this e-mail or any parts of it or act upon/rely on the contents of this e-mail in any manner. Please notify the sender immediately by e-mail and destroy all copies of this e-mail and any attachments. Please also note that ICICI Bank or its subsidiaries and associated companies, (collectively "ICICI Group"), are unable to exercise control or ensure the integrity of/over the contents of the information contained in e-mail transmissions and that any views expressed in this e-mail are not endorsed by/binding on the ICICI Group unless the sender does so expressly with due authority of ICICI Group. Before opening any attachments please check them for viruses and defects and please note that ICICI Group accepts no liability or responsibility for any damage caused by any virus that may be transmitted by this email. Any unauthorized use of this email or any attachment(s) may be treated as infringement of right(s) including right of privacy under the applicable laws of India including Information and Technology Act, 2000. Thank you for your cooperation. Regulatory Disclosures are available on https://www.icicisecurities.com (for institutional business) and www.icicidirect.com (for retail business).