Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client.subscribe custom on_message callback #110

Closed
crypt0inf0 opened this issue Dec 19, 2023 · 3 comments
Closed

client.subscribe custom on_message callback #110

crypt0inf0 opened this issue Dec 19, 2023 · 3 comments

Comments

@crypt0inf0
Copy link

How to use custom on_message on neo_api_client.subscribe

live_data = {}

def on_feed(message):
    global live_data
    try:
        print(f"message : {message}")
        for i in message:
            live_data[i['ts']] = i['ltp']
    except Exception as e:
        print(f"Error {e}")

inst_tokens = [{"instrument_token": "65373", "exchange_segment": "nse_fo"}]

def stream():
    c.subscribe(instrument_tokens=inst_tokens, on_message=on_feed)

Thread(target=stream).start()

@Kotak-Neo Can you add this functionality?

@crypt0inf0
Copy link
Author

i use #63

@Kotak-Neo
Copy link
Owner

We are soon releasing a new version which will contain the same. Will keep you guys posted :)

@Hari3115
Copy link

@Kotak-Neo When is the new version coming up? the callback function is not working for anyone trying it lately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants