Can we find out if market is live via python api?

Is there any way we can find out that this moment market is open or not?

I want to add this code so that my algorithm doesnot run when there is a holiday on weekday or if its a mocktrading day.

I can parse the nse site and find out if market is open or close but was wondering if we can find that via kite connect python api.

am sure there is no such function available but was wondering if there is any workaround jugaad or trick so that we can find out the market is live or not?

maybe if livestraming is null? = market is closed?
  • Nikhil.A
    @algotrader29 As of now, there's no real way to determine the market status. We do intend to stream market status in the future though.
  • vandanchopra
    Hey, You'd mentioned in June 2017, that you intend to stream market status in future. Any update here ?
    If not, what do you recommend ? What's the workaround here ?
  • rishiswethan
    rishiswethan edited July 25
    def holiday_list():
    h_list = open(config.HOLIDAY_LIST_FILE, 'r')
    holiday_list = []

    for i in h_list.readlines():
    if i.strip() != '':

    return holiday_list
  • rishiswethan
    rishiswethan edited July 25
    You can compare the current date with the dates returned from this function. and check for if the current day is sat and sun and stop trading accordingly, this is how I currently do it. You can update the holiday list every year
  • rakeshr
    No, it's still not live.
    For time being, we will recommend you to create holiday calender list at your end and don't run your program on those day's.Something as below:
    cds_holiday_list = ['2019-04-01','2019-04-17','2019-04-19','2019-05-01','2019-06-05','2019-08-12','2019-08-15','2019-09-02','2019-09-10','2019-10-02','2019-10-08','2019-10-28','2019-11-12','2019-12-25']
Sign In or Register to comment.