mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-03 16:02:04 +00:00
* add first iteration of content for Terminal Pro * Update index.md * Update dashboards.md * Update folders.md * Update grouping.md * Update report.md * Update templates.md * Update quick-start.md * Update index.md * Update index.md * Update home.md * Update news.md * Update index.md * Update index.md * Update index.md * Update data-provider.md * Update chat-with-widget.md * Update data-manipulation.md * Update forecasting.md * fix: images self closing tags * fix: only pro visitors can see pro * inter font * improve SEO content and restructuring * add new package for toggle on tutorials * move folder around * improve main page of each prod * small updates and improvements * fix logo above * small improvement in headtitle for portfolio funcs * fix typos from OpenAI's GPT-4 * fix _category_ json * remove generic SEO words * add script that generates SEO for documentation * add missing file * remove sdk warning message * fix links for andrew --------- Co-authored-by: jose-donato <zmcdonato@gmail.com> Co-authored-by: jose-donato <43375532+jose-donato@users.noreply.github.com> Co-authored-by: andrewkenreich <andrew.kenreich@gmail.com>
3.0 KiB
Vendored
3.0 KiB
Vendored
title, description, keywords
| title | description | keywords | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| show | This documentation page talks about the 'show' function from OpenBB's portfolio optimization module. It details how to display portfolio optimization results using categories and portfolio engines. |
|
import HeadTitle from '@site/src/components/General/HeadTitle.tsx';
Show portfolio optimization results
Source Code: [link]
openbb.portfolio.po.show(portfolio_engine: portfolio_optimization.po_engine.PoEngine, category: str = None)
Parameters
| Name | Type | Description | Default | Optional |
|---|---|---|---|---|
| portfolio_engine | PoEngine | Portfolio optimization engine Use portfolio.po.load to load a portfolio engine |
None | False |
| category | str | Category to show, by default None After loading a portfolio with portfolio.po.load you can usethe object method get_available_categories() to get a list of available categories.You can also use the object method set_categories_dict() to set a custom dictionaryof categories. The dictionary must contain "CURRENT_INVESTED_AMOUNT" and "CURRENT_WEIGHTS" as keys as shown in the example below. |
None | True |
Returns
| Type | Description |
|---|---|
| Union[pd.DataFrame, Tuple[pd.DataFrame, pd.DataFrame]] | Portfolio weights and categories |
Examples
from openbb_terminal.sdk import openbb
p = openbb.portfolio.po.load(symbols=["AAPL", "MSFT", "AMZN"])
d = {
"SECTOR": {
"AAPL": "INFORMATION TECHNOLOGY",
"MSFT": "INFORMATION TECHNOLOGY",
"AMZN": "CONSUMER DISCRETIONARY",
},
"CURRENT_INVESTED_AMOUNT": {
"AAPL": "100000.0",
"MSFT": "200000.0",
"AMZN": "300000.0",
},
"CURRENCY": {
"AAPL": "USD",
"MSFT": "USD",
"AMZN": "USD",
},
}
p.set_categories_dict(categories=d)
weights, performance = openbb.portfolio.po.equal(portfolio_engine=p)
p.get_available_categories()
['SECTOR']
weights_df, category_df = openbb.portfolio.po.show(portfolio_engine=p, category="SECTOR")
from openbb_terminal.sdk import openbb
p = openbb.portfolio.po.load(symbols_file_path="~/openbb_terminal/miscellaneous/portfolio_examples/allocation/60_40_Portfolio.xlsx")
weights, performance = openbb.portfolio.po.equal(portfolio_engine=p)
p.get_available_categories()
['ASSET_CLASS',
'SECTOR',
'INDUSTRY',
'COUNTRY',
'CURRENT_INVESTED_AMOUNT',
'CURRENCY']
weights_df, category_df = openbb.portfolio.po.show(portfolio_engine=p, category="ASSET_CLASS")