Error while fetching open interest data from historical API.

I was trying to fetch the OI information using the historical API call. The function as per documentation has the following format:
"def historical_data(self, instrument_token, from_date, to_date, interval, continuous=False, oi=False)".

I've followed this syntax and tried to make the API Call which results in a TypeError. Error message can be seen in the image attached.

The instrument token (12481794) used here is for the symbol RELIANCE21MARFUT. Please check the image for the exact code that I have used to make the API Call.
I've illustrated both with and without using the oi parameter. The latter is throwing the error.
  • sujith
    Can you check if you are using the latest version of pykiteconnect?
  • weebee
    Version according to the __version__ file has value 3.9.2. @sujith
  • rakeshr
    __version__ file has value 3.9.2
    Version looks fine.
    Do you have multiple Python versions installed in your system? Is above the version for the correct package, you are accessing here.
    Make sure, you are using the correct package location. You can go through this thread to know more.
  • weebee
    I have only 1 version of python installed on the system. I have run respective commands on windows command prompt to find relevant information regarding the above queries. I'd like some guidance on the installations, whether they are correct or needs some changes (Note that all the site-packages are within the respective folder of the python location according to the image attached). @rakeshr @sujith
  • rakeshr
    Package details look fine. What about other API calls? Are you able to make other API calls without any issue. Can you try this latest order margin computation once at your end? Here is an example of the same.
  • weebee
    I'm an active user of all Kite API Calls since past 2 years. I think this is the first time I'm facing such an issue with historical API (where in I'm unable to fetch anything at all and ended up in an exception). Even now (including the last trading session, I have deployed scripts which are running successfully) all the other calls seem to work as expected.
    Even the normal historical API call works, only when I use OI (which I'm testing now) as the parameter I'm facing the issue as you can see from the first image. (Also it is referring to oi as a keyword argument which I believe it is not (I might be wrong) since you it is nowhere mentioned in the docs, is this something concerning?
  • weebee
    (Contd.) Also I've tested the following just to be sure:
    1. Kite Ticker (Web socket)
    2. Kite Historical API (without OI as parameter)
    3. Funds
    4. Margins
    5. Instruments
    6. Orders
    7. Positions
    All of the above are working fine. Only issue is Kite Historical API with oi, which leads to an exception as per image in my initial comment. @rakeshr @sujith
  • rakeshr
    rakeshr edited March 25
    Also it is referring to oi as a keyword argument which I believe it is not
    Yes, oi is keyword argument for historical_data method. You can check the documentation here.
    We even tried the same setup as yours(conda, ipython and jupyter notebook) but weren't able to reproduce the above issue. You need to re-check your working setup. We weren't able to re-produce this at any level.
    jupyter notebook


  • weebee
    Update: I ran the Script today, surprisingly it executed and gave results for OI. I haven't changed anything from my end. Exact same code (and even the libraries). I'm not sure what caused it to not run earlier and execute now, but thanks for being patient and responding. You may close the thread too. Cheers!
This discussion has been closed.