Navigation

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

    Historic API not returning data for sysmboltokens

    C#/.Net SDK
    3
    11
    79
    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.
    • F
      firosh last edited by

      I tried to fetch the historic data using Historic API using C#.

      When I am trying with the symboltoken 3045 (given in the same code), it is working fine.

      But it is not working for any other symboltokens.

      I have tried multiple symboltokens from the below json file.

      https://margincalculator.angelbroking.com/OpenAPI_File/files/OpenAPIScripMaster.json

      Please help me to solve this.

      A 1 Reply Last reply Reply Quote 0
      • A
        admin @firosh last edited by

        HI @firosh Kinldy post the request for which your are trying to fetch the data.

        F J 3 Replies Last reply Reply Quote 0
        • F
          firosh @admin last edited by

          @admin Later I tried with many stocks, Some are working and many are not still not working.

          There is no code runtime exception

          Below is the request I have tried.

                  CandleRequest cdreq = new CandleRequest();
                  cdreq.exchange = Constants.EXCHANGE_NSE;
                  cdreq.symboltoken = "17351"; // a non working one
                  cdreq.interval = Constants.INTERVAL_ONE_DAY;
                  cdreq.fromdate = DateTime.Now.AddDays(-10).ToString("yyyy-MM-dd 09:15");
                  cdreq.todate = DateTime.Now.AddDays(0).ToString("yyyy-MM-dd 04:00");
                  obj = connect.GetCandleData(cdreq); // obj initialised as per the sample given
                  CandleDataResponse cd = obj.GetCandleDataResponse;
          

          Below are some of the failed symbol tokens.
          (All these symbol tokens are taken from OpenAPIScripMaster.json with "exch_seg":"NSE" )

          17351
          20560
          4598
          5258
          10940
          3518
          1394
          16675
          21770
          3506
          11703
          2412
          2142
          17933
          3321
          13162
          2589
          11532
          1476
          23650
          14008
          11860
          19104
          18431
          19184
          11813
          11522
          79
          11965
          1363
          1363
          22377
          11301
          18889
          7919
          17044
          18102
          14154
          11979
          14428
          9046
          9046
          8311
          18284
          18284
          24595
          24595
          20825
          17794
          3387
          3387
          136
          2649
          21749
          18944
          1313
          14361
          1621
          4184
          4184
          2492
          2492
          685
          685
          14450
          1814
          14203
          2711
          3608
          13342
          6198
          11763
          11050
          1041
          11549
          11549
          426
          426
          21541
          21541
          17675
          10990
          17534
          30835
          13511
          14314
          5097
          7902
          17249
          8840
          3316
          15141
          20877
          17598
          21392
          2987
          2987
          21614
          13300
          11935
          27161
          3396
          18226
          15313
          1782
          6543
          13801
          278
          3162
          10276
          18895
          30392
          31409
          13187
          2616
          13656
          10238
          2481
          2955
          2320
          1494
          16965
          11778
          17659
          2112
          13598
          2043
          29733
          1515
          11671
          13510
          9158
          10515
          19111
          20642
          7506
          28913
          16908
          11817
          24781
          2319
          12022
          15189
          19525
          2328

          A 1 Reply Last reply Reply Quote 0
          • A
            admin @firosh last edited by

            Hi @firosh we will update you on this.

            A 1 Reply Last reply Reply Quote 0
            • A
              admin @admin last edited by

              HI @firosh we tested it for few stocks from above list we are getting the data.Kindly try again and update us.

              1 Reply Last reply Reply Quote 0
              • F
                firosh last edited by

                @admin OK, I will have a thorough again and post the status and findings

                F 1 Reply Last reply Reply Quote 0
                • F
                  firosh @admin last edited by

                  This post is deleted!
                  1 Reply Last reply Reply Quote 0
                  • F
                    firosh @firosh last edited by

                    @admin I had a thorough check regarding this.

                    I was calling the CandleRequest inside a loop for different symbol token

                    when I Added 200ms delay (Thread.Sleep(200);) it worked fine

                    I also tried with 10, 20, 50, 100 instead for 200, but still the issue was there.

                    So what is the actual solution in this case, without Thread.Sleep(200); ?

                    A 1 Reply Last reply Reply Quote 0
                    • A
                      admin @firosh last edited by

                      HI @firosh

                      1. We have some rate limit for calling the historical data function you can check it in below documentation:
                        https://smartapi.angelbroking.com/docs/RateLimit
                        2)Kindly provide us the request and response if the symbols for which you are facing issues.
                      F 1 Reply Last reply Reply Quote 0
                      • F
                        firosh @admin last edited by

                        @admin Yes, that was the issue, I have made multiple request using loops which exceeded the limit.

                        I have modified the code and everything is working fine now.

                        Suggesting to close this issue as resolved

                        Thank you.

                        1 Reply Last reply Reply Quote 0
                        • J
                          jaydip @admin last edited by

                          @admin
                          @jaydip
                          use try catch block

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post