Skip to content

Commit e44ff30

Browse files
Update async_websocket_rest_handler.py (#591)
1 parent c486b06 commit e44ff30

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/tools/async_websocket_rest_handler/async_websocket_rest_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class ApiCallHandler:
1212
def __init__(self):
1313
self.api_call_queue = asyncio.Queue()
1414
self.executor = ThreadPoolExecutor() # Thread pool for running synchronous code
15+
self.client = RESTClient() # Assumes POLYGON_API_KEY is set in the environment
1516

1617
async def enqueue_api_call(self, options_ticker):
1718
await self.api_call_queue.put(options_ticker)
@@ -33,8 +34,7 @@ async def start_processing_api_calls(self):
3334
self.api_call_queue.task_done()
3435

3536
def get_options_contract(self, options_ticker):
36-
client = RESTClient() # Assumes POLYGON_API_KEY is set in the environment
37-
return client.get_options_contract(options_ticker)
37+
return self.client.get_options_contract(options_ticker)
3838

3939

4040
class MessageHandler:

0 commit comments

Comments
 (0)