Historical API not working

Ninja2020
I am getting values for 30th September if i give 3 days data. But i am not getting values for 1st and 2nd October data.

Instrument for BANKNIFTY20O0822700CE symbol.

Anyone please guide .
fetchOHLC(ticker, "day",5)
  • sujith
    I can see this response,
    {
    "status": "success",
    "data": {
    "candles": [
    [
    "2020-09-30T00:00:00+0530",
    54.55,
    55,
    26.75,
    39.75,
    62675
    ],
    [
    "2020-10-01T00:00:00+0530",
    60,
    183.75,
    50,
    163.35,
    563400
    ],
    [
    "2020-10-05T00:00:00+0530",
    166.15,
    409,
    166.15,
    288,
    6543350
    ]
    ]
    }
    }
  • sujith
    Are you using OHLC API or historical data API?
  • Ninja2020
    I am using historical data API
  • Ninja2020
    Code was working till last week . Not sure what is the problem this week.
  • sujith
    Can you paste the exact request and response logs?
    You will have to run pykiteconnect in debug mode.
  • Ninja2020
    DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "GET /instruments/historical/9540354/day?instrument_token=9540354&from=2020-10-03&to=2020-10-03&interval=day&continuous=0&oi=1 HTTP/1.1" 200 46
    DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
  • Ninja2020
    DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "GET /instruments/historical/9552386/day?instrument_token=9552386&from=2020-10-04&to=2020-10-04&interval=day&continuous=0&oi=1 HTTP/1.1" 200 46
    DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443

    Look like options historic data not working for today
  • rakeshr
    DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "GET /instruments/historical/9540354/day?instrument_token=9540354&from=2020-10-03&to=2020-10-03&interval=day&continuous=0&oi=1 HTTP/1.1" 200 46
    DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
    We checked for this. Historical Data is working fine for BANKNIFTY20O0821900PE (9540354).
    It's returning blank array for period from=2020-10-03&to=2020-10-03&interval=day, as above mentioned day was trading holiday.
    If you change the from_date to older, you can see older candles.
    Example response:
    DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "GET /instruments/historical/9540354/day?from=2020-09-30+09%3A15%3A00&to=2020-10-03+09%3A16%3A00&interval=day&continuous=0&oi=0 HTTP/1.1" 200 None
    [{'date': datetime.datetime(2020, 10, 1, 0, 0, tzinfo=tzoffset(None, 19800)), 'open': 404.15, 'high': 404.15, 'low': 167.15, 'close': 184.55, 'volume': 922175}]
  • rakeshr
    DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "GET /instruments/historical/9552386/day?instrument_token=9552386&from=2020-10-04&to=2020-10-04&interval=day&continuous=0&oi=1 HTTP/1.1" 200 46
    For this as well, the mentioned date is a trading holiday.
  • Ninja2020
    Thanks Rakesh Sir

    Do i need to code for week ends and trading holidays in my code. Is API won't give yesterday means last trading day data ?
  • sujith
    The API would just return an empty array.
  • Ninja2020
    Is there any sample code to check to see empty array in Python historic data API .

    Note: Last Monday it executed successfully even with weekend holiday .
Sign In or Register to comment.