BrokerClient#

class alpaca.broker.client.BrokerClient(api_key: Optional[str] = None, secret_key: Optional[str] = None, api_version: str = 'v1', sandbox: bool = True, raw_data: bool = False, url_override: Optional[str] = None)#

Client for accessing Broker API services

Note on the `handle_pagination` param you’ll see across these methods

By default, these methods will attempt to handle the fact that the API paginates results for the specific endpoint for you by returning it all as one List.

However, that could:

1. Take a long time if there are many results to paginate or if you request a small page size and have moderate network latency 2. Use up a large amount of memory to build all the results at once

So for those cases where a single list all at once would be prohibitive you can specify what kind of pagination you want with the handle_pagination parameter. Please see the PaginationType enum for an explanation as to what the different values mean for what you get back.

__init__(api_key: Optional[str] = None, secret_key: Optional[str] = None, api_version: str = 'v1', sandbox: bool = True, raw_data: bool = False, url_override: Optional[str] = None)#
Parameters:
  • api_key (Optional[str]) – Broker API key - set sandbox to true if using sandbox keys. Defaults to None.

  • secret_key (Optional[str]) – Broker API secret key - set sandbox to true if using sandbox keys. Defaults to None.

  • api_version (str) – API version. Defaults to ‘v1’.

  • sandbox (bool) – True if using sandbox mode. Defaults to True.

  • raw_data (bool) – True if you want raw response instead of wrapped responses. Defaults to False. This has not been implemented yet.

  • url_override (Optional[str]) – A url to override and use as the base url.