mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-25 02:33:10 +00:00
* Update generate_terminal_markdown.py * updates * update workflows * Automated Change * tests * tests * Automated Change * Update test_generate_docs.py * Automated Change * updates * Automated Change * Update gen-docs.yml * Update test.yml * Automated Change * Update test.yml * Automated Change * Update generate_sdk_markdown.py * Automated Change * test * Automated Change * testtt23 * Automated Change * Update generate_sdk_markdown.py * Automated Change * Automated Change * added empting reference folders before autogen docs * updates * Automated Change * update tests gitactions * Automated Change * up * Automated Change * Automated Change * update pytest * Automated Change * tests * Automated Change * examples update * Automated Change * Update generate_sdk_markdown.py * Automated Change * Update test.yml * Update generate_sdk_markdown.py * strip * Automated Change * Workflow : check test update * Automated Change * Automated Change * Automated Change * Update test.yml * Automated Change * Update test.yml * Automated Change * Automated Change * up * Automated Change * Update generate_sdk_markdown.py * Automated Change * update workflows * fix guides * testing * Update gh-pages.yml * Update gh-pages.yml Co-authored-by: tehcoderer <tehcoderer@users.noreply.github.com> Co-authored-by: Jeroen Bouma <jer.bouma@gmail.com> Co-authored-by: Chavithra PARANA <chavithra@gmail.com> Co-authored-by: Chavithra <Chavithra@users.noreply.github.com> Co-authored-by: jose-donato <43375532+jose-donato@users.noreply.github.com> Co-authored-by: jose-donato <jose-donato@users.noreply.github.com>
2.5 KiB
Vendored
2.5 KiB
Vendored
title, description
| title | description |
|---|---|
| show | OpenBB SDK Function |
show
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")