From 8252022b841751f441b16d626903f2194808f390 Mon Sep 17 00:00:00 2001 From: justinpolygon <123573436+justinpolygon@users.noreply.github.com> Date: Fri, 12 Jan 2024 12:18:51 -0800 Subject: [PATCH] Update async_websocket_rest_handler.py --- .../async_websocket_rest_handler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/tools/async_websocket_rest_handler/async_websocket_rest_handler.py b/examples/tools/async_websocket_rest_handler/async_websocket_rest_handler.py index 30753269..d60a257c 100644 --- a/examples/tools/async_websocket_rest_handler/async_websocket_rest_handler.py +++ b/examples/tools/async_websocket_rest_handler/async_websocket_rest_handler.py @@ -12,6 +12,7 @@ class ApiCallHandler: def __init__(self): self.api_call_queue = asyncio.Queue() self.executor = ThreadPoolExecutor() # Thread pool for running synchronous code + self.client = RESTClient() # Assumes POLYGON_API_KEY is set in the environment async def enqueue_api_call(self, options_ticker): await self.api_call_queue.put(options_ticker) @@ -33,8 +34,7 @@ async def start_processing_api_calls(self): self.api_call_queue.task_done() def get_options_contract(self, options_ticker): - client = RESTClient() # Assumes POLYGON_API_KEY is set in the environment - return client.get_options_contract(options_ticker) + return self.client.get_options_contract(options_ticker) class MessageHandler: