Alpaca-API
Alpaca-API copied to clipboard
Migrate polygon integration from NATS to websocket cluster.
Polygon has seemingly switched their real-time integrations from NATS to a websocker cluster [0]. We should probably switch this over for improved stability [1].
0 - websocket cluster docs 1 - deprecation notices on their github
Also adding an error messages that has been seen on the NATS cluster:
Exception in thread "Thread-0" java.io.IOException: Unable to connect to gnatsd server.
at io.nats.client.impl.NatsConnection.connect(NatsConnection.java:185)
at io.nats.client.impl.NatsImpl.createConnection(NatsImpl.java:28)
at io.nats.client.Nats.createConnection(Nats.java:192)
at io.nats.client.Nats.connect(Nats.java:147)
Additionally, it looks like the API keys that work on the Polygon NATS servers, do not work with the Websocket servers.
This is something that I believe requires some work on Polygon's side before it can be done. As was noted above, we cannot simply switch our SDKs to point to their websockets instead, as the keys are not authorized for websockets. We do intend to continue coordinating with Polygon and change the connection method over when we're able.
Is there a timeline on this +ttt733?
I'd like to second @mtcliatt question. It can be a lot of wasted effort for users to develop against a service that has already been deprecated upstream.
I saw in the latest Alpaca product update email (7/18/19), that there has been progress on migrating to use the Polygon.io WebSockets API. Is there a date when our API keys will work?
I have tried connecting to the API using the same key I used for the NATS connection but am receiving an "authentication failed" message.
➜ wscat --connect wss://socket.polygon.io/stocks
connected (press CTRL+C to quit)
< [{"ev":"status","status":"connected","message":"Connected Successfully"}]
> {"action":"auth","params":"******"}
< [{"ev":"status","status":"auth_failed","message":"authentication failed"}]
The endpoint is wss://alpaca.socket.polygon.io/stocks and you should be able to connect using Alpaca API key today. We will document it soon officially.
Any idea on why this is happening???