forked from alienbrett/PyAlly
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
24 lines (16 loc) · 638 Bytes
/
test.py
File metadata and controls
24 lines (16 loc) · 638 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import concurrent.futures
import logging
import ally
logger = logging.getLogger(__name__)
a = ally.Ally()
def job():
logger.info("Submitting job")
return a.timesales("spy", startdate="2020-06-19", enddate="2020-06-19", block=False)
with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:
logger.info("Submitting requests")
# Submit all our orders
futures = {executor.submit(job): i for i in range(200)}
logger.info("Submitted!")
logger.info("Getting results...")
for future in concurrent.futures.as_completed(futures):
logger.info("%s #%s", future.result(), futures[future])