Historical data issue_stock split adjustment

ajay_kalyankar
ajay_kalyankar edited December 2019 in General
Hi,
I downloaded historical data (5 min interval) for many equities.
Found issue with INFY data for 2015-06-12, the OHLC prices are double that of 2015-06-11 or 2015-06-15.
Looks like the adjustment for stock split is not done.

I have two questions -
1. How and when the adjustment is done for splits, bonuses, dividends, corporate actions etc
2. Is this a temporary glitch or do we need to build a mechanism to catch such cases ?

Regards
Ajay
  • rakeshr
    @ajay_kalyankar
    Found issue with INFY data for 2015-06-12, the OHLC prices are double that of 2015-06-11 or 2015-06-15.
    Yes, there was bonus issue of 1:1 on 15 Jun 2015.
    I downloaded historical data (5 min interval) for many equities
    Corporate action adjustment is done only on day candle not on intra day candle.
    1. How and when the adjustment is done for splits, bonuses, dividends, corporate actions etc
    Adjustment is done only for splits, not other corporate actions.And it's mostly done over the coming weekend after corporate action.
    2. Is this a temporary glitch or do we need to build a mechanism to catch such cases ?
    If you see any discrepancy in historical data, you can report it here.
  • ajay_kalyankar
    @rakeshr
    Thanks for the reply.
    If adjustment is done only on day-candle, does that mean we have to do this ourselves on intraday candle ? If yes, then is there any API call which will give split ratios date wise ?
    And in kite charts, the data is adjusted for all time frames. Why not here ?

    Regards
    Ajay


  • rakeshr
    @ajay_kalyankar
    If adjustment is done only on day-candle, does that mean we have to do this ourselves on intraday candle ?
    Yes, you can re-factor post fetching at your end.
    If yes, then is there any API call which will give split ratios date wise ?
    No, we don't have. You can check it manually from BSE website under the corporate action tab.
    And in kite charts, the data is adjusted for all time frames. Why not here ?
    For recent corporate action, we do have intra-day data adjusted.
  • TheRenjithR
    TheRenjithR edited December 2019
    I am getting below error

    Excel does not support datetimes with timezones. Please ensure that datetimes are timezone unaware before writing to Excel.

    For the info my current timezone is India right now as per my system

    I have subscribed "Historical API"

    import pdb
    import datetime
    import pandas as pd
    from kiteconnect import KiteConnect
    import openpyxl
    import xlsxwriter

    api_key = "***"
    api_secret = "***"
    # request_token = "**"
    access_token = ""

    kite = KiteConnect(api_key=api_key)
    print("[*] Generate Access Token :", kite.login_url())
    request_token = input("[*] Enter Your Request Token here: ")
    data = kite.generate_session(request_token, api_secret=api_secret)
    kite.set_access_token(data["access_token"])

    trd_portfolio = {"HDFCBANK": {'token': 341249}}

    token = 341249
    to_date = datetime.datetime.now()
    from_date = to_date - datetime.timedelta(days=30)
    interval = "15minute"

    records = kite.historical_data(token, from_date, to_date, interval)
    df = pd.DataFrame(records)
    df.to_excel("zerodhastocks.xlsx")
    pdb.set_trace()

  • TheRenjithR
    For the info my current timezone is India right now as per my system
  • rakeshr
    @TheRenjithR
    You can have look to this thread.
    Also, don't hijack the thread, try creating a new thread for different queries.
This discussion has been closed.