AttributeError: 'FyersModel' object has no attribute 'optionchain'

I am using following code (same as described in the API documentation) to fetch oi data.

fyersModel = fyersModel.FyersModel(token=token, client_id=app_id, is_async=False)
data = {
    "symbol": "NSE:TCS-EQ",
    "strikecount":1,
    "timestamp": ""
}

response = fyersModel.optionchain(data=data)
print(response)

But I receive an error

AttributeError: ‘FyersModel’ object has no attribute ‘optionchain’

Is this method not available in API V3?

Please refer the following document URL:

https://myapi.fyers.in/docsv3#tag/Data-Api/paths/~1DataApi/put

Hi Amey,

Please ensure you have the latest version, fyers-apiv3 3.1.1.

Use the following command:

!pip install fyers-apiv3 --upgrade

Let me know the latest status.

That helped. Thanks a lot!

not working for me even after upgrading

@naresh_janagama is there any impact on websocket after this upgrade? Websocket has stopped working and onmessage is not receiving any data and I am getting following error in the log.

{"level":"ERROR","location":"[exception:108] fyers_logger","message":"module 'websocket' has no attribute 'WebSocketApp'","timestamp":"2024-07-15 09:57:17,617+0530","service":"FyersDataSocket","exception":"Traceback (most recent call last):\n  File \"D:\\python\\projects\\auto-trading\\venv\\lib\\site-packages\\fyers_apiv3\\FyersWebsocket\\data_ws.py\", line 1660, in __init_connection\n    ws = websocket.WebSocketApp(\nAttributeError: module 'websocket' has no attribute 'WebSocketApp'","exception_name":"AttributeError"}

Kindly confirm

@9IC04gMybe Could you please DM your details so that we can connect and check it

@WWhYB2qrsx I have messaged you the details. Please check them and advise.

pip install fyers-apiv3 --upgrade, works greate…

@WWhYB2qrsx Can you please check and reply