Files
OpenBB/website/content/sdk/reference/portfolio/po/plot.md
DidierRLopes 4ad995fdd0 Docs/terminalpro and improvement (#5622)
* 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>
2023-10-30 21:01:29 +00:00

6.2 KiB
Vendored

title, description, keywords
title description keywords
plot This documentation page outlines the functions related to plotting and charting an investment portfolio using the OpenBB's po module. The page provides examples of different chart types such as pie, hist, dd, and rc. It includes necessary parameters for the functions and discusses the usage of a portfolio engine.
plot
tab
po
chart
portfolio
example
pie
hist
dd
rc
engine
type
category
parameters
returns

import HeadTitle from '@site/src/components/General/HeadTitle.tsx';

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

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")