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

get_current_tick auth implementation #25

Open
stevegbrooks opened this issue Jul 6, 2021 · 0 comments
Open

get_current_tick auth implementation #25

stevegbrooks opened this issue Jul 6, 2021 · 0 comments

Comments

@stevegbrooks
Copy link

stevegbrooks commented Jul 6, 2021

When I use get_current_tick in a multithreaded setting (see code below), it fails and prints the message "run jqdatasdk.auth first", and returns None.

When I run any other JQData API function with multithreading it runs successfully (no error) and returns a pd.DataFrame.

My guess is this has to do with the way get_current_tick does its authorization check.

Here's a reproducible example:

import jqdatasdk as jq
from concurrent.futures import ThreadPoolExecutor

jq.auth('138********', '********')

##### Multithreaded doesn't work
MAX_THREADS = 3
executor = ThreadPoolExecutor(MAX_THREADS)
stock_data = (result for result in executor.map(jq.get_current_tick, ['000001.XSHE'])) #prints error
next(stock_data) #returns None
########################

#calling it normally works
jq.get_current_tick(['000001.XSHE'])
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

1 participant