Skip to content

how can use ack module in websocket #2

Description

@jpatel26596

acess_token="XXXXXXXXXXXXX"
token_list = {"action": "subscribe", "key": ["feed","ack"], "value": [""]}
feed = {"action": "feed", "key": ["full"], "value": ["NC20000"]}
#unsubscribefeed = {"action":"unsubscribe","key":["feed"],"value":[""]}
ack= {"action": "ack", "key": [""], "value": [customer number]}
sws = SharekhanWebSocket(access_token)
def on_data(wsapp, message):
data = json.loads(message)

print(data)

def on_open(wsapp):
print("on open")
sws.subscribe(token_list)
sws.fetchData(feed)
sws.fetchData(ack)

# sws.unsubscribe(unsubscribefeed)
#sws.close_connection()

def on_error(wsapp, error):
print(error)
def on_close(wsapp):
print("Close")

Assign the callbacks.

sws.on_open = on_open
sws.on_data = on_data
sws.on_error = on_error
sws.on_close = on_close
sws.connect()

can anyone help me to use ack module and what response we can expect , i got feed module sorted and getting data for token "NC20000" but not getting response for ack , i tried to create a buy sell trade limit order, but got no response in console ,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions