Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs
    1. Home
    2. Vypy1
    V
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Vypy1

    @Vypy1

    2
    Reputation
    33
    Posts
    17
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Vypy1 Follow

    Best posts made by Vypy1

    • Issue fetching Historical data

      I am facing a peculiar issue in fetching data. This wasn't a problem earlier when I fetched data using the same code. The code below loops through a few different date ranges to fetch data for that date range. I transform the fetched data into data frames of each date range and then concat it to return one single data frame.

      But when I see the excel sheet that I store the data in the dates that I have fetched the data for are arbitrary, it skips a lot of days in between, sometimes skips years. Starts not from the start date I have set and instead from some arbitrary date, I have given a snippet of the result below. Date starts from 2013 instead of requested 2011, it jumps from 2015 to 2018 and then 2019 without retrieving the complete data. Can anyone help here.

      def hist_data():
      
          dfs = []
          frm = ['2015-07-12 09:15', '2020-01-01 09:15']
          until = ['2020-12-31 15:30', '2022-11-17 15:30']
      
          for x, y in zip(frm, until):
      
              try:
                  historicParam = {
                      "exchange": "NSE",
                      "symboltoken": tokens,
                      "interval": 'ONE_DAY',
                      "fromdate": x,
                      "todate": y
                  }
                  dfs.append(pd.DataFrame(obj.getCandleData(historicParam)['data'],
                                          columns=['Date', 'Open', 'High', 'Low', 'Close', 'Volume']))
      
              except Exception as e:
                  print(f'Historic Api failed: {e}')
      
      
          df = pd.concat(x for x in dfs)
          df['Date'] = df['Date'].str.split('T').str[0]
      
          return df
      
      for tokens, symbols in zip(nifty_50['token'], nifty_50['symbol']):
      
          stock_data = hist_data()
          stock_data.to_csv(f'/Users/varadjoshi/Documents/Markets Data/Price Volume Data/Nifty 500 Stocks Data/{symbols}.csv', index=False)
          time.sleep(1)
          print(symbols)
      

      Output in the excel sheet below

      ![f9cd5502-b1d8-4f4d-9944-cffb397e39a3-image.png](/assets/uploads/files/1668693905626-f9cd5502-b1d8-4f4d-9944-cffb397e39a3-image.png) code_text
      
      ![dd9bcd9f-cbb0-4960-a0da-abac7e2a1955-image.png](/assets/uploads/files/1668693836453-dd9bcd9f-cbb0-4960-a0da-abac7e2a1955-image.png) code_text
      ```26/06/15	169.99	170.44	163.28	167.57	2150489
      29/06/15	166.51	166.84	160.28	165.81	1140046
      30/06/15	164.73	170.95	164.12	169.44	1197561
      01/07/15	168.08	170.29	166.03	166.81	792876
      02/07/15	164.42	174.04	164.42	172.46	1866024
      03/07/15	172.89	173.34	168.05	170.86	1611144
      06/07/15	168.05	173.46	166	172.8	2376410
      07/07/15	173.49	177.9	171.5	177.15	1906853
      08/07/15	175.64	175.91	167.57	168.87	3483626
      09/07/15	168.96	169.26	166.24	166.96	1521201
      10/07/15	167.66	169.2	165.33	167.36	655030
      26/12/18	283.81	289.77	277.8	286.35	3413076
      27/12/18	288.95	292.58	277.65	280.03	5553470
      28/12/18	280.55	289.8	280.4	287.83	1932203
      31/12/18	291.04	291.25	285.38	286.32	1383559
      01/01/19	288.23	288.35	282.79	285.2	986138
      02/01/19	285.08	286.77	278.92	281.76	1550368
      03/01/19	281.15	286.41	274.44	277.04	1653258
      04/01/19	277.95	283.99	276.38	280.61	1745111
      07/01/19	284.42	285.29	278.67	282.15	1675020
      08/01/19	279.34	282.3	275.95	279.16	1713143
      09/01/19	280.49	281.7	273.2	277.77	1790489
      10/01/19	277.77	278.95	274.87	277.77	1632163
      11/01/19	277.1	278.16	270.27	273.87	2006360
      14/01/19	270.21	273.23	262.96	265.44	3997561
      15/01/19	265.98	269.91	265.04	268.43	3103563
      16/01/19	267.52	272.51	266.8	270.15	2311584
      17/01/19	271.96	276.35	268.07	270.66	2779574
      18/01/19	272.33	273.14	265.13	266.92	1582590
      posted in Python SDK
      V
      Vypy1

    Latest posts made by Vypy1

    • Angel brokings data provider

      Does anyone know who provides market data to angel broking?

      posted in Python SDK
      V
      Vypy1
    • RE: Issue fetching Historical data

      @admin Thanks admin, I tried this and it works, however earlier I could fetch 2000 records for daily candles. Even this page says I can fetch 2000 days for 1 Day candles

      https://smartapi.angelbroking.com/docs/Historical

      posted in Python SDK
      V
      Vypy1
    • RE: Issue fetching Historical data

      @admin what's the update on this?

      posted in Python SDK
      V
      Vypy1
    • RE: Issue fetching Historical data

      @Vypy1 @admin what's the update here?

      posted in Python SDK
      V
      Vypy1
    • RE: Issue fetching Historical data

      @Vypy1 @admin I have been following up for a response on this and you guys don't care to even respond. What is the issue?

      posted in Python SDK
      V
      Vypy1
    • RE: Issue fetching Historical data

      @Vypy1 @admin waiting for your response

      posted in Python SDK
      V
      Vypy1
    • RE: Issue fetching Historical data

      @Vypy1 @admin what is the update on this?

      posted in Python SDK
      V
      Vypy1
    • RE: Issue fetching Historical data

      @Vypy1 @admin why is there no response on this? You make the API, if your users have a question its better to respond to them than be completely silent about it.

      posted in Python SDK
      V
      Vypy1
    • RE: Issue fetching Historical data

      @Vypy1 @admin any update here?

      posted in Python SDK
      V
      Vypy1
    • RE: Historical API Call returning Max 500 Records for any time frame

      @webseos are you also facing an issue of not getting the right data with the right date range? For e.g. date range in your e.g. is 2020-08-09 but the data you have got is from date range 2020-10-13

      posted in General Discussion
      V
      Vypy1