Historical Data - Invalid segment for continuous data

vm87
vm87 edited February 2022 in Python client
Hi,

I am trying to extract 2 years of day candles for Segment ACC which has Instrument token 5633. But it throws the error "kiteconnect.exceptions.InputException: invalid segment for continuous data". When i change continuous data to 0, i get single day's data. But i am looking to pull 2 years in one go. Do i have to loop through each date and get candles induviudally ?

Code:
lst_candles.append(user.kite.historical_data("5633",
startDate,
endDate,
"day",
1,
0)[0])

Debug Log:
DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "POST /session/token HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "GET /instruments/historical/5633/day?from=2020-01-01+00%3A00%3A00&to=2022-02-25+00%3A00%3A00&interval=day&continuous=1&oi=0 HTTP/1.1" 400 108
Traceback (most recent call last):
raise exp(data["message"], code=r.status_code)
kiteconnect.exceptions.InputException: invalid segment for continuous data

Thanks.
  • SRIJAN
    You don't need to use continuous data for equities. It's only to get expired futures day candles. For equities you can ignore continuous parameter. For day candles,the maximum interval is 2000 days.
  • mb12
    somehow i am getting this error for Weekly Futures of SENSEX as well e.g. kc.historical_data(SENSEX24816FUT (218478597), BFO, day, 2024-05-10 00:00:00+05:30, 2024-08-14 23:59:00+05:30, True, True): InputException invalid segment for continuous data, raising error.

    So continuous does not apply to all futures but only monthly futures? Weekly futures are excluded?
  • rakeshr
    As, the documentation mentions continuous data works for NFO and MCX futures contracts.
    SENSEX24816FUT (218478597), BFO
    This is a BFO exchange contract.
    So continuous does not apply to all futures but only monthly futures? Weekly futures are excluded?
    Yes, for NFO and MCX, continuous data is applicable only for monthly future contracts.
Sign In or Register to comment.