Alpaca-trade-api

Latest version: v3.2.0

Safety actively analyzes 681844 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 7 of 10

0.40

In this release, support has been added for the order replacement and account configuration APIs. Documentation for these can be found here: [https://docs.alpaca.markets/api-documentation/api-v2/orders/](orders) and [https://docs.alpaca.markets/api-documentation/api-v2/account-configuration](account configurations). Order replacement allows you to update an order without having to first go through the process of cancelling it and waiting to receive confirmation that the cancel worked. Account configurations allows you to specify some account-level behavior. The following parameters can currently be configured in this way:
- `no_shorting`: Allows you to prevent new short sales from happening - if you attempt a short sale with this set to true, you'll receive an "insufficient qty" error.
- `dtbp_check`: Controls [https://docs.alpaca.markets/user-protections/#day-trade-margin-call-dtmc-protection-at-alpaca](Day Trading Margin Call) checks. Please see our documentation for more information on the options.
- `trade_confirm_email`: If "none" (the string, not python's `None`) is specified, emails for order fills are not sent.
- `suspend_trade`: If true, new orders are blocked.

Additionally, an issue was fixed where user code exceptions would be swallowed by the websocket handler code, which could lead to some errors being difficult to debug.

0.38

In this release, automatic reconnection was added for the Alpaca Websocket stream. This should help with cases in which the network connection is unstable or where the machine running an application using the SDK may go to sleep or otherwise pause execution. Additionally, a fix was made for cases in which async code was using the SDK's websocket connection, and support for OAuth authentication was added.

0.36

We've added a few new methods to the Alpaca API, described below.

`cancel_all_orders()`: Cancels all open orders.
`close_position(symbol)`: Closes any open position for the given symbol at market price.
`close_all_positions()`: Closes all open positions at market price.

Official documentation can be found here:
https://docs.alpaca.markets/api-documentation/api-v2/orders/#cancel-all-orders
https://docs.alpaca.markets/api-documentation/api-v2/positions/#close-all-positions

0.35

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.

0.34

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`.

0.33

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.

Page 7 of 10

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.