Function to delete all Subscriptions at once

This function is developed over AliceBlue Official Python library.

First You can subscribe to ONGC and TATA Steel to test this function.

alice.subscribe(alice.get_instrument_by_symbol('NSE', 'ONGC-EQ'), LiveFeedType.DEPTH_DATA)
alice.subscribe(alice.get_instrument_by_symbol('NSE', 'TATASTEEL-EQ'), LiveFeedType.DEPTH_DATA)

Then use the following function to delete all the open subscriptions at once. I ended in a for loop in middle but I have fixed it using this thread’s help.

Function to delete all Subscriptions at once

def del_all_subscriptions(subs):
  for x,y  in subs.copy().items():
    alice.unsubscribe(x, y)
#This will delete all Subscriptions

Now if you do this following command, It will post an empty dict confirming the same.