Releases: alpacahq/alpaca-trade-api-python
Hotfix for Polygon authentication message format
Polygon appears to have changed their authentication message format this morning to this:
{'ev': 'status', 'status': 'auth_success', 'message': 'authenticated'}
Rather than what is in their documentation. This hotfix changes the SDK's expectation to match the new behavior, and may be rolled back depending on whether or not Polygon keeps this message format.
Further Polygon stream improvements
In this release, several code issues with websocket reconnection are fixed. The ability to specify a list of symbols for a websocket handler method to listen (only) for has been added. (To use this, simply specify a list of symbols as strings after the channel pattern in your on()
decorator.) Additionally, an unsubscribe function is provided for the Polygon stream, as well as a configuration option for specifying a non-Alpaca Polygon key in the environment variable POLYGON_KEY_ID
.
Polygon websockets reconnects; Polygon v2 aggregates limit parameter
In this release, we add some basic code for handling automatic reconnection when the Polygon channel closes unexpectedly. The maximum number of reconnection attempts and the delay before a reconnect is attempted can be configured the same way they are configured for the REST API - set the APCA_RETRY_MAX
and APCA_RETRY_WAIT
environment variables to specify these values. Note that this code handles reconnection only for failures that occur after the channel has been opened - if an unexpected closure occurs during the opening of the channel or the authentication to it, an automatic reconnection will not be attempted. We will try to address this in a future release.
Also of note is the addition of a limit parameter to Polygon's historic aggregate API calls. This parameter was previously undocumented in the Polygon API docs, however, we have received confirmation that it is officially supported. You can now specify a maximum number of results you wish to receive when querying their historic aggregate API call.
Please also note that with this release, support for Python 3.5 is ended, as a dependency (the websockets library) supports Python>=3.6. Please upgrade your Python version if necessary.
Fix Polygon stream channel joining
The joining of Polygon streams in v0.31 was broken because it was using the wrong character. This has been fixed in this version.
Polygon Websockets & Aggregate Fix
In this release, we replace the old NATS connection for Polygon streaming with their new websocket endpoint. This change should be largely invisible to users, but we expect that the websocket connection will be more stable and reliable than the NATS connection was. If you wish to change the endpoint that the Polygon websocket attempts to connect to, you may specify it in the environment variable POLYGON_WS_URL
.
Breaking changes:
This release also changes the names of Polygon aggregate fields on the v2 endpoint from their short version to their long versions. This is done for the sake of consistency with the rest of the SDK. Please note that if you were using v2 Polygon aggregates before this release, you will need to update your code to account for the long names.
Change default Alpaca trade API version from v1 to v2
This update simply changes the Alpaca API version used by default from v1 to v2, as new Alpaca accounts now support v2 features. This preference can be overridden by setting the environment variable APCA_API_VERSION
to v1
.
New flag to order API and data endpoint fix for v2
- Add extended_hours flag to POST /orders
- Fix data API endpoint to always use v1
Fix error when Polygon v2 aggregate result is empty
A user discovered that when getting recent aggregate data for companies that have not been traded yet, the result list can be empty and an error would be thrown. This corrects the error and instead returns an empty list.
Add Alpaca API v2 support, update Polygon for v2 aggregate support
This release introduces the ability to configure the version of the Alpaca API to target. This is currently primarily intended for users using Alpaca power accounts. It also includes a new historic_agg_v2() method for Polygon's API. The V2 endpoint reportedly does not experience some of the performance issues users have noticed with the V1 endpoint, so if your code has been having trouble with that, please try the new endpoint.
Add ticker endpoint and fix issue with pandas v0.24
This release adds support for Polygon's ticker snapshot endpoint via the new all_tickers
and snapshot
methods. It also addresses a breaking change in pandas v0.24.