Too many issues with API

  • Its a shame that you are charging money for an API of this quality. From installation issues to actually running it, there are just too many issues to name. Now that I have purchased it - I regret the quality. I request you to extend my credit for API till the API stabilizes.

    Anyways - I am now unable to retrieve the token

    Traceback (most recent call last):
    File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.1.4\helpers\pydev_pydevd_bundle\", line 3, in Exec
    exec(exp, global_vars, local_vars)
    File "<input>", line 1, in <module>
    File "C:\Users\abbanerjee\AppData\Local\Programs\Python\Python35\lib\site-packages\upstox_api\", line 86, in retrieve_access_token
    pycurl.error: (60, 'SSL certificate problem: unable to get local issuer certificate')

    I checked and aparently its your code issue. In it must be

    import pycurl
    import certifi

    curl = pycurl.Curl()
    curl.setopt(pycurl.CAINFO, certifi.where())
    curl.setopt(pycurl.URL, '')

    Can you please fix it ?

  • Global Moderator

    @abbanerjee It works here. We are in the process of upgrading our certs but that shouldn't cause a problem on your end. The certificate keys are not stored locally or anything.

    It could be because the certificate chain is cached at your end. Can you see if this solution works for you:

  • It works here is not a good enough answer in my opinion. The support is horrible - its basically feels like buyers responsibility to make it work.

  • Global Moderator

    @abbanerjee Please let me know if you are still facing any issues

  • @shrini.viswanath Yes still facing issues. Had a call with the developers.

    I modified the API to solve the security certificate issue reported in the forum. Other issues are still preventing me from using the API. I think most people dont even bother to report the issues and they just give up.

    These are the pending issues:

    1. The python method to get all contracts is called get_master_contract whereas the documentation says getInstruments

    2. As far as I can see u.get_master_contract('NSE_FO') gets only options and not futures

    3. u.get_instrument_by_symbol('NSE_FO', 'BANKNIFTY27JULFUT') returns none

  • Global Moderator


    1. That's the NodeJS documentation. We're using get_master_contract in Python.
    2. Are you sure? You should get both futures and options.
    3. Symbol is wrong. Use BANKNIFTY17JULFUT - 27 represents 2027 while 17 is 2017.


    print(u.get_instrument_by_symbol('NSE_FO', 'BANKNIFTY17JULFUT'));


    Instrument(exchange='NSE_FO', token=49732, parent_token=26009, symbol='banknifty17julfut', name='', closing_price=23255.3, expiry='1501093800000', strike_price=None, tick_size=5.0, lot_size=40, instrument_type='FUTIDX', isin=None)

  • @shrini.viswanath said in Too many issues with API:

    The documentation does not change when I click on python. How do you think I should know what is the right method to call ?

    I dont know what made you comeup with a symbol which is 1 digit different from NSE. In NSE it uses the date of the last thursday of the month which in this case is 27th July and hence the reason I was trying with 27JUL.

    Once I get the contract master, what is the way I should look for a symbol? Can you please give a code example like the one above ?

  • Global Moderator


    I have updated code and documentation here:

    • The code is without pycurl and enum module
    • The documentation is much more extensive

    It will be pushed to master next

  • @shrini.viswanath said in Too many issues with API:

    print(u.get_instrument_by_symbol('NSE_FO', 'BANKNIFTY17JULFUT'))

    Somehow it does not work:

    print(u.get_instrument_by_symbol('NSE_FO', 'BANKNIFTY17JULFUT'))

    Btw -

    print (u.get_balance()) # get balance / margin limits
    print (u.get_profile()) # get profile

    Is working - so the object "u" is correctly instantiated.

  • Global Moderator

    You called get_master_contract first? We're trying to call your registered mobile number but it won't connect.

  • @shrini.viswanath Thats great that you are using requests instead of pycurl. Much more robust.

    Now my subscription is not working

    u.subscribe(u.get_instrument_by_symbol('NSE_FO', 'BANKNIFTY17JULFUT'), LiveFeedType.Full)
    Traceback (most recent call last):
    File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.1.4\helpers\pydev_pydevd_bundle\", line 3, in Exec
    exec(exp, global_vars, local_vars)
    File "<input>", line 1, in <module>
    File "C:\Users\abbanerjee\AppData\Local\Programs\Python\Python35\lib\site-packages\upstox_api\", line 501, in subscribe
    raise TypeError("Required parameter instrument not of type Instrument")
    TypeError: Required parameter instrument not of type Instrument

  • Can you please try again ? My phone is on.

  • Okay - so now after calling u.get_master_contract('nse_fo') it works. Nowhere in the documentation it says that this needs to be a sequence. Now I am able to instantiate the instrument object ...

  • Have not been able to use the API successfully even once until now. Has been a few hours since I purchased the subscription.

    1. The JS API docs mention getLoginUrl when it actually should be getLoginUri
    2. Every parameter which takes a fixed number of options should have all the options listed either there itself or somewhere with a link to it.
      0_1499664036062_Screenshot from 2017-07-10 10:45:27.png
      LTP is ltp and Full is full. I know that. But it should be mentioned everywhere nonetheless.
    3. Optional parameters should specify the default value.
      0_1499664593491_Screenshot from 2017-07-10 10:59:23.png

    Out of day and ioc which is the default. I am guessing it is day. Are the strings I am 'guessing' even correct in the first place?

    0_1499666627512_Screenshot from 2017-07-10 11:15:26.png
    This Quote updates section is downright incorrect. I checked the SDK code, and we are indeed atobing and parsing it.

    1. And then there has been this error, if the rest were not already enough.
    { Error: certificate has expired
        at TLSSocket.<anonymous> (_tls_wrap.js:1098:38)
        at emitNone (events.js:105:13)
        at TLSSocket.emit (events.js:207:7)
        at TLSSocket._finishInit (_tls_wrap.js:628:8)
        at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:458:38) code: 'CERT_HAS_EXPIRED' }
    { message: 'Internal server error' }
    { message: 'Internal server error' }

    With all of this said, I think it is not fair that I pay for a service which I myself am helping get to stability. I hope you understand and compensate for the same.

  • @pranay said in Too many issues with API:
    Hi @pranay,

    Sorry for the inconvenience.

    Documentation issues

    Thanks for pointing out documentation issues. We will work on this and fix it ASAP.

    SSL Error

    There was some issue with SSL Certificate, we resolved this issue today morning and we will see that it doesn't happen again.


  • @yogesh that's all that you have to say? Remarkable.

Log in to reply

Looks like your connection to Upstox Forum was lost, please wait while we try to reconnect.