Files
OpenBB/website/content/sdk/reference/portfolio/po/plot.md
teh_coderer 79046608b6 Docs Fix (#3543)
* 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>
2022-11-25 17:19:08 -05:00

5.6 KiB
Vendored

title, description
title description
plot OpenBB SDK Function

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

plot

Display efficient frontier

Source Code: [link]

openbb.portfolio.po.plot(portfolio_engine: portfolio_optimization.po_engine.PoEngine = None, chart_type: str = "pie", kwargs: Any)

Parameters

Name Type Description Default Optional
portfolio_engine PoEngine Portfolio optimization engine, by default None
Use portfolio.po.load to load a portfolio engine
None True
chart_type str Chart type, by default "pie"
Options are "pie", "hist", "dd" or "rc"
pie True

Returns

This function does not return anything


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']
openbb.portfolio.po.plot(portfolio_engine=p, category="SECTOR", chart_type="pie")
openbb.portfolio.po.plot(portfolio_engine=p, category="SECTOR", chart_type="hist")
openbb.portfolio.po.plot(portfolio_engine=p, category="SECTOR", chart_type="dd")
openbb.portfolio.po.plot(portfolio_engine=p, category="SECTOR", chart_type="rc")
openbb.portfolio.po.plot(portfolio_engine=p, category="SECTOR", chart_type="heat")
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']
openbb.portfolio.po.plot(portfolio_engine=p, category="ASSET_CLASS", chart_type="pie")
openbb.portfolio.po.plot(portfolio_engine=p, category="SECTOR", chart_type="hist")
openbb.portfolio.po.plot(portfolio_engine=p, category="INDUSTRY", chart_type="dd")
openbb.portfolio.po.plot(portfolio_engine=p, category="COUNTRY", chart_type="rc")
openbb.portfolio.po.plot(portfolio_engine=p, category="ASSET_CLASS", chart_type="heat")

Display efficient frontier

Source Code: [link]

openbb.portfolio.po.plot_chart(portfolio_engine: portfolio_optimization.po_engine.PoEngine = None, chart_type: str = "pie", kwargs: Any)

Parameters

Name Type Description Default Optional
portfolio_engine PoEngine Portfolio optimization engine, by default None
Use portfolio.po.load to load a portfolio engine
None True
chart_type str Chart type, by default "pie"
Options are "pie", "hist", "dd" or "rc"
pie True

Returns

This function does not return anything


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']
openbb.portfolio.po.plot(portfolio_engine=p, category="SECTOR", chart_type="pie")
openbb.portfolio.po.plot(portfolio_engine=p, category="SECTOR", chart_type="hist")
openbb.portfolio.po.plot(portfolio_engine=p, category="SECTOR", chart_type="dd")
openbb.portfolio.po.plot(portfolio_engine=p, category="SECTOR", chart_type="rc")
openbb.portfolio.po.plot(portfolio_engine=p, category="SECTOR", chart_type="heat")
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']
openbb.portfolio.po.plot(portfolio_engine=p, category="ASSET_CLASS", chart_type="pie")
openbb.portfolio.po.plot(portfolio_engine=p, category="SECTOR", chart_type="hist")
openbb.portfolio.po.plot(portfolio_engine=p, category="INDUSTRY", chart_type="dd")
openbb.portfolio.po.plot(portfolio_engine=p, category="COUNTRY", chart_type="rc")
openbb.portfolio.po.plot(portfolio_engine=p, category="ASSET_CLASS", chart_type="heat")