Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs

    API to get Holiday

    General Discussion
    0
    4
    49
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • V
      Vishal.naykawala last edited by

      Is there any API available that tell us today market holiday or not?

      M Mnagesh 2 Replies Last reply Reply Quote 1
      • M
        Moderator_2 @Vishal.naykawala last edited by

        Hi @Vishal-naykawala

        Apologies for delayed response.
        Currently we are not providing the market holidays on smartAPI.

        Thanks & Regards,
        SmartAPI team

        1 Reply Last reply Reply Quote 0
        • Mnagesh
          Mnagesh @Vishal.naykawala last edited by

          @Vishal-naykawala
          We can write our own script to find the market Holidays
          I am having three methods

          1. Web scalping
          2. Excel file holiday data
          3. Directly paste the holiday from know sites into our script

          Now I am full time Algo Trader and successfully developed my own Apps for my personal use.

          1 Reply Last reply Reply Quote 0
          • A
            ayushagarwal last edited by

            You can use NSE API

            import datetime
            
            import pandas as pd
            import requests
            
            
            def is_holiday(date: datetime.date):
                headers = {'user-agent': 'PostmanRuntime/7.26.5'}
                endpoint = "https://www.nseindia.com/api/holiday-master?type=trading"
                response = requests.get(endpoint, headers=headers)
                assert response.status_code == 200, response.json()
                holidays_json = response.json()['FO']
                holidays_df = pd.DataFrame(holidays_json)
                holidays_df['tradingDate'] = pd.to_datetime(holidays_df['tradingDate'])
                return pd.Timestamp(date) in holidays_df['tradingDate'].values
            
            
            1 Reply Last reply Reply Quote 0
            • First post
              Last post