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

Client drops connection and fails to reconnect #7

Open
Graeme22 opened this issue Feb 23, 2024 · 1 comment
Open

Client drops connection and fails to reconnect #7

Graeme22 opened this issue Feb 23, 2024 · 1 comment

Comments

@Graeme22
Copy link

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
Copy link
Author

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

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