hcorr
- Model
- Chart
Get historical price correlation. [Source: Yahoo Finance]
Source Code: [link]
openbb.stocks.ca.hcorr(similar: List[str], start_date: Optional[str] = None, end_date: Optional[str] = None, candle_type: str = "a")
Parameters
Name | Type | Description | Default | Optional |
---|---|---|---|---|
similar | List[str] | List of similar tickers. Comparable companies can be accessed through finnhub_peers(), finviz_peers(), polygon_peers(). | None | False |
start_date | Optional[str] | Initial date (e.g., 2021-10-01). Defaults to 1 year back | None | True |
end | Optional[str] | Initial date (e.g., 2021-10-01). Defaults to today | None | True |
candle_type | str | OHLCA column to use for candles or R for returns, by default "a" for Adjusted Close | a | True |
Returns
Type | Description |
---|---|
Tuple[pd.DataFrame, pd.DataFrame] | Dataframe with correlation matrix, Dataframe with historical prices for all comparison stocks |
Correlation heatmap based on historical price comparison
Source Code: [link]
openbb.stocks.ca.hcorr_chart(similar: List[str], start_date: Optional[str] = None, end_date: Optional[str] = None, candle_type: str = "a", display_full_matrix: bool = False, raw: bool = False, external_axes: bool = False, export: str = "", sheet_name: Optional[str] = None)
Parameters
Name | Type | Description | Default | Optional |
---|---|---|---|---|
similar | List[str] | List of similar tickers. Comparable companies can be accessed through finnhub_peers(), finviz_peers(), polygon_peers(). | None | False |
start_date | Optional[str] | Initial date (e.g., 2021-10-01). Defaults to 1 year back | None | True |
end_date | Optional[str] | End date (e.g., 2023-01-01) | None | True |
candle_type | str | OHLCA column to use for candles or R for returns, by default "a" for Adjusted Close | a | True |
display_full_matrix | bool | Optionally display all values in the matrix, rather than masking off half, by default False | False | True |
raw | bool | Whether to display raw data | False | True |
external_axes | bool | Whether to return the figure object or not, by default False | False | True |
export | str | Format to export correlation prices, by default "" | True |
Returns
This function does not return anything