py_alpaca_api.trading.market ============================ .. py:module:: py_alpaca_api.trading.market Classes ------- .. autoapisummary:: py_alpaca_api.trading.market.Requests py_alpaca_api.trading.market.ClockModel py_alpaca_api.trading.market.Market Functions --------- .. autoapisummary:: py_alpaca_api.trading.market.clock_class_from_dict Module Contents --------------- .. py:class:: Requests .. py:method:: request(method: str, url: str, headers: dict[str, str] | None = None, params: dict[str, str | bool | float | int] | None = None, json: dict[str, Any] | None = None, raw_response: bool = False) Execute HTTP request with retry logic. :param method: A string representing the HTTP method to be used in the request. :param url: A string representing the URL to send the request to. :param headers: An optional dictionary containing the headers for the request. :param params: An optional dictionary containing the query parameters for the request. :param json: An optional dictionary containing the JSON payload for the request. :param raw_response: If True, return the raw response object without status checks. Defaults to False. :returns: The response object returned by the server. :raises APIRequestError: If the response status code is not one of the acceptable statuses (200, 204, 207) and raw_response is False. .. py:class:: ClockModel .. py:attribute:: market_time :type: datetime.datetime .. py:attribute:: is_open :type: bool .. py:attribute:: next_open :type: datetime.datetime .. py:attribute:: next_close :type: datetime.datetime .. py:function:: clock_class_from_dict(data_dict: dict) -> ClockModel Create ClockModel from dictionary data. :param data_dict: A dictionary containing data for creating an instance of `ClockModel`. :returns: An instance of `ClockModel` created using the data from `data_dict`. :raises None.: .. py:class:: Market(base_url: str, headers: dict[str, str]) .. py:method:: clock() -> py_alpaca_api.models.clock_model.ClockModel Retrieves the current market clock. :returns: A model containing the current market clock data. :rtype: ClockModel .. py:method:: calendar(start_date: str, end_date: str) -> pandas.DataFrame Retrieves the market calendar for the specified date range. :param start_date: The start date of the calendar range in the format "YYYY-MM-DD". :type start_date: str :param end_date: The end date of the calendar range in the format "YYYY-MM-DD". :type end_date: str :returns: A DataFrame containing the market calendar data, with columns for the date, settlement date, open time, and close time. :rtype: pd.DataFrame