intrinio / intrinio-realtime-options-python-sdk

Intrinio Python SDK for Real-Time Option Prices
Apache License 2.0
3 stars 0 forks source link

Client drops connection and fails to reconnect #7

Open Graeme22 opened 6 months ago

Graeme22 commented 6 months ago

Hello, I've been using the client for a couple days now to subscribe to the unusual trade feed. We've noticed some weird behavior when leaving the client running overnight; namely, at some point around midnight the connection is dropped and the attempts to reconnect fail, meaning the client is no longer live in the morning when the market opens.

Here's the relevant logs, the config has the DEBUG logging level:

2024-02-23 00:00:38.000 [optionswatch_data_api] web.1 true 2024-02-23 00:00:38,000 - intrinio_realtime_options - ERROR - Websocket - Error - Connection to remote host was lost.
2024-02-23 00:00:38.000 [optionswatch_data_api] web.1 true 2024-02-23 00:00:38,000 - intrinio_realtime_options - ERROR - Websocket - Error - Connection to remote host was lost.
2024-02-23 00:00:38.000 [optionswatch_data_api] web.1 2024-02-23 00:00:38,000 - intrinio_realtime_options - INFO - Websocket - Closed - None: None
2024-02-23 00:00:38.000 [optionswatch_data_api] web.1 2024-02-23 00:00:38,000 - intrinio_realtime_options - INFO - Websocket - Closed - None: None
2024-02-23 00:00:38.000 [optionswatch_data_api] web.1 2024-02-23 00:00:38,000 - intrinio_realtime_options - INFO - Websocket - Reconnecting...
2024-02-23 00:00:38.000 [optionswatch_data_api] web.1 2024-02-23 00:00:38,000 - intrinio_realtime_options - INFO - Websocket - Reconnecting...

After this nothing happens, so it appears the reconnection process failed.

Relevant client init code:

config: client.Config = client.Config(
    api_key=INTRINIO_API_KEY,
    provider=client.Providers.OPRA,
    num_threads=4,
    log_level=client.LogLevel.DEBUG
)
def build_client():
    return client.Client(
        config, on_unusual_activity=on_unusual_activity_handler
    )
intrinioRealtimeOptionsClient: client.Client = build_client()

@asynccontextmanager
async def intrinio(app: FastAPI):
    logger.info("********* BEGIN START UP *********")
    intrinioRealtimeOptionsClient.start()
    intrinioRealtimeOptionsClient.join_firehose()
    logger.info("******** DONE START UP *********")
    yield
    logger.info("********* BEGIN SHUTTING DOWN *********")
    intrinioRealtimeOptionsClient.stop()
    logger.info("******** STOPPED INTRINIO CLIENT *********")

app = FastAPI(debug=DEBUG, lifespan=intrinio)

This has happened a couple days in a row. As a result we have no confidence in being able to run the client indefinitely. Any ideas as to what the problem could be? Thanks.

Graeme22 commented 5 months ago

Hi, just wondering if this respository is maintained at all?