Code and error please help fast
Also when used on connect function it throws an error saying: DhanFeed.init() got an unexpected keyword argument ‘on_connect’.
Also when used on connect function it throws an error saying: DhanFeed.init() got an unexpected keyword argument ‘on_connect’.
Any updates?
Hello @Akash_Sapkal
Welcome to MadeForTrade community!
Can you confirm which version of DhanHQ Library are you using and if the example code is for that version itself?
V2 version of Dhan HQ library.
The sample code you are using was for V1. Hence, the error. Can you check Github and take latest sample code?
Thanks for prompt reply.
Code i am using: from dhanhq import marketfeed
client_id = “”
access_token = “”
instruments = [(marketfeed.NSE, “50301”, marketfeed.Ticker)]
version = “v2” # Mention Version and set to latest version ‘v2’
try:
data = marketfeed.DhanFeed(client_id, access_token, instruments, version)
while True:
data.run_forever()
response = data.get_data()
print(response)
except Exception as e:
print(e)
Output:
DhanFeed.init() takes 4 positional arguments but 5 were given
Im getting the SAME error. dhanfeed.init() takes 4 positional args but 5 were given. Please fix this. Unable to get any Ltp @Hardik