py_alpaca_api.trading.market
Classes
Functions
|
Create ClockModel from dictionary data. |
Module Contents
- class py_alpaca_api.trading.market.Requests[source]
- 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)[source]
Execute HTTP request with retry logic.
- Parameters:
method – A string representing the HTTP method to be used in the request.
url – A string representing the URL to send the request to.
headers – An optional dictionary containing the headers for the request.
params – An optional dictionary containing the query parameters for the request.
json – An optional dictionary containing the JSON payload for the request.
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.
- class py_alpaca_api.trading.market.ClockModel[source]
- market_time: datetime.datetime
- next_open: datetime.datetime
- next_close: datetime.datetime
- py_alpaca_api.trading.market.clock_class_from_dict(data_dict: dict) ClockModel[source]
Create ClockModel from dictionary data.
- Parameters:
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. –
- class py_alpaca_api.trading.market.Market(base_url: str, headers: dict[str, str])[source]
- clock() py_alpaca_api.models.clock_model.ClockModel[source]
Retrieves the current market clock.
- Returns:
A model containing the current market clock data.
- Return type:
- calendar(start_date: str, end_date: str) pandas.DataFrame[source]
Retrieves the market calendar for the specified date range.
- Parameters:
- Returns:
A DataFrame containing the market calendar data, with columns for the date, settlement date, open time, and close time.
- Return type:
pd.DataFrame