Problem in websocket connection

I am running my script for a month and suddenly it is showing error. I haven’t changed a single line of code since a month, Error is as below. Please let me know what to do.

File "/Users/AlgoTrading-Final/fyers_ws.py", line 94, in subscribe
    get_symbol_data = self.__construct_send_message(symbol=symbol)
  File "/Users/AlgoTrading-Final/fyers_ws.py", line 137, in __construct_send_message
    quotes_response = get_quotes.json()
  File "/Users/AlgoTrading-Final/venv/lib/python3.9/site-packages/requests/models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Hi @mrx040551-2hu
Which API version you are using

v2

Hi @mrx040551-2hu
Please upgrade to APIv3
This issue we are facingin APIV2 , we are trying to fix it.
However I strongly I recommended you upgrade to APIv3.

@Z4PBvkQGyF I will upgrade to API V3 soon. But please fix this problem for v2 as soon as possible I have many clients using my Algorithm. I can not change versions overnight.

Hi @mrx040551-2hu

We are trying to fix it ASAP.

@Z4PBvkQGyF I am trying to move from v2 to v3 but now it’s giving error that I don’t have permission to use the app. I have been using the same app for a long time and it has all the permissions. What do I need to change?

hi @granddervish

Please go through the docs

https://myapi.fyers.in/docsv3

I am also facing same issue.

From my past experience any change in fyers (new versions) require long time to stabilise. Hence I don’t want to change to V3, I will stay with V2 for few more months. Please rectify this in V2, unless fyers gives a guarantee that V3 is stable.

Hello @Z4PBvkQGyF, will this issue be resolved by today?

Hi Everyone,
Please inform in this thread whenever websocket error(json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)) gets resolved or let us know if we need to upgrade to v3 to use websocket.
Its kind of urgent.
Thank you.

Hi @mrx040551-2hu , @siddhantmohanty007-ciy @shyam.cqj9mxeg @granddervish

This issue has been fixed for APIv2. You can check now.

Please note : Kindly migrate to APIv3 ASAP

Yes, its working well today.

Thanks

Pankaj,

For me moving to V3 means I will have to retest all of my code. Hence it requires proper planning and testing and not trading. We traders are interested in trading not software development. Hence unless there is any advantage why should I move?

Yes @shyam.cqj9mxeg

Me as a trader, I also agree with your point. We don’t need care about software development. But as Software engineer I also tell you , every software development we improve the previous system in the performance and feature wise. We fix the bugs in previous and release a new one which is bug free.
If there is a major update in APIs, it means there are alot of features in new version which is good as well for traders.

Hope you got me.
Thanks

Hi Pankaj,

Where can I get the release notes for V3. It will help me to assess the need for V3, let me as a customer make a choice whether I should upgrade or not. My previous experience with upgrade in early stage is not good. Hence I would not like to upgrade unless feature are really good. like open interest data etc.

Just to give you example, in Web 1.5, VWAP is incorrect. The issue is raised but no resolution yet. Trading without vwap is not possible for me, hence I have reverted back to older version of Web.

Please publish the release notes for V3 API

@shyam.cqj9mxeg
Please go through this part
https://myapi.fyers.in/docsv3#tag/Change-Log

Hi Pankaj,

Thanks for the change log. Your team has done a great job in enhancing the socket features. But I am disappointed with the changes of name. like symbol is Symbol, ip is lp and so one.

These kind of changes affect me a lot. My code base is huge and will require huge testing. Hence I will avoid updating to newer version right now.

These kind of name changes are very common for you guys, but in the software API world, they are show stopper for upgrade by client.

If you have to do that please do that in one go, you did that in V2 and again in V3. I guess you will continue in V4 also.

Look like your team is more of GUI developer hardly any good API experience guys otherwise this would not have happened again and again.

Hi @shyam.cqj9mxeg

Could you please clarify which specific changes you are referring to? It would be helpful if you could provide more details so that I can check on my end. Additionally, I understand that as the developer of your well working model, you may not be able to make direct code changes, but you could consider creating a configuration file where all the variables are defined. This way, if any changes are needed in the future, you would only have to update the values in the configuration file, reducing the need for modifications throughout the codebase. I hope this suggestion helps optimize your system.

HI @Z4PBvkQGyF

Currently i am running sample foreground code from Github and updated to latest Fyersapi 3.03 pkg but what i observe is while LTP is updating, you can see LTT, Total Volume and EXCH time is not updating.

Yesterday also i observed same in MCX crudeoil testing.

just added this much to def on_message() :

    global mCtr

    mCtr += 1
    #print("Response:", message)
    ext     = message['exch_feed_time']
    ltt     = message['last_traded_time']        
    symbol  = message['symbol']
    ltp     = message['ltp']
    ltq     = message['last_traded_qty']
    vol     = message['vol_traded_today']

    ext = datetime.datetime.fromtimestamp(ext).strftime("%H:%M:%S")
    ltt = datetime.datetime.fromtimestamp(ltt).strftime("%H:%M:%S")

    print(ext, ltt, symbol, ltp, ltq, vol, 'c=', mCtr)

Hi Pankaj,

This is from the change log

  • Text updation: “Symbols” changed to “symbol”
  • itt updated to ltt
  • ip updated to lp

These kind of changes are not acceptable as I have to change the code. As far as config file is concern, “Symbol” which is a common attribute in many of your API’s, I am sure its not changed in all API’s. I don’t want to waste my time testing for you and report where all its not changed.

This attitude of mine is due to frustration of your untested roll out plan. I have faced this in past and in V3 also I am seeing the same in some of the discussion thread in this forum.

I just fail to understand why do you have to change the exposed attributes, you can very well change your internal variable, but not the exposed attributes.

If I have to keep changing my code like this, I better change the broker. I guess you understand the frustration which is created due to this.