Navigation

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

    Python API - Historical Data Fetch became arbitrary & DataFrame not coming after TOTP has been imposed

    General Discussion
    0
    2
    59
    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.
    • W
      webseos last edited by webseos

      Historical Data Fetch became very arbitrary its not INTERNET connection problem. Yesterday night at 1 AM midnight all worked perfectly but today now during market hours now 10 AM around DataFrame not coming

      The Code remained same as past before TOTP system using PYTHON

      usr = SmartAPI(api_key,client_code,client_pass, totp)

      if(usr.sessionData['status'] == True):
      smartapiObj = usr.smartapiObj
      else:
      print("SmartAPI Object Session Data is not TRUE, exiting...")
      exit()

      df = None
      status = None
      msg = None
      stockObj = StockClass('NSE', symbol, token_mumber, smartapiObj)
      df, status, msg = stockObj.getDF_Daily(no_of_candles, fromDate, todayDate)

      In the above code the class function stockObj.getDF_Daily() returns DataFrame only with status and message. All worked perfectly before TOTP. and in this function or class nothing about TOTP used. smartapiObj is generated using TOTP only

      The Output shown by program

      Checking NIFTY50 Stocks : Please wait..

      Traceback (most recent call last):
      File "E:\projects\python\talib-smartapi\mainOTP.py", line 108, in <module>
      if df == None or df.empty : # if len(df.columns) == 0:
      File "C:\python\python39\lib\site-packages\pandas\core\generic.py", line 1537,
      in nonzero
      raise ValueError(
      ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(),
      a.item(), a.any() or a.all().

      1 Reply Last reply Reply Quote 0
      • W
        webseos last edited by

        Sometimes TOTP working and sometimes failing shown here : https://smartapi.angelbroking.com/topic/2408/arbitrary-output-of-python-api-sometimes-totp-failing-and-also-historical-data-fetch-failing

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