Hi team, I have been trying to subscribe 200 instruments, but can not. Somehow dhanhq python library throws an error. I have tried with multiple instruments list and can not find any solution… Can you please help me resolve this. Thanks in advance.
My code -
# More basic code here, main code starts below
async def on_connect(instance):
print("Connected!")
async def on_message(instance, message):
print(message)
feed = marketfeed.DhanFeed(client_id=client_id,
access_token=access_token,
instruments=instruments[:100],
subscription_code=subscription_code,
on_connect=on_connect,
on_message=on_message
)
print(f'Total subscribed instruments right now: {len(feed.instruments)}. Subscribing more...')
feed.subscribe_symbols(subscription_code, instruments[99:200])
print(f'Total subscribed instruments right now: {len(feed.instruments)}. Going to run feed now.')
feed.run_forever()
My error:
C:\___DHANHQ_PACKAGE_LOCATION_HERE___\dhanhq\marketfeed.py:79: RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Total subscribed instruments right now: 100. Subscribing more...
Total subscribed instruments right now: 200. Going to run feed now.
Connected!
Connected!
Connection has been closed