Files
OpenBB/openbb_terminal/reports
montezdesousa be864d01f3 Feature/provider refactoring (#5266)
* remove comment

* replace registry description

* black and add some todos

* remove unused var

* allow description and move provider to title

* fix the data field descriptions

* refactor globalnews

* added `"limit"` to metadata descriptions

* fix cpi command and refactor

* refactored `AnalystEstimates`

* add concat param

* refactored `AvailableIndices` for `economy.available_indices`

* sort and set index to date

* place it inside exception

* move literals to core

* rename descriptions dict

* add descriptions to cpi data

* change description

* black

* refactored `CompanyOverview` for `stocks.fa.overview`

* Updated `DATA_DESCRIPTIONS` in provider metadata

* Updated `symbol` description in `DATA_DESCRIPTIONS`

* fix stock_news alias

* pass standard limit

* fix stock news

* fix to datframe

* rebuild python interface

* refactored `CryptoEOD` for `crypto.load`

* added Field descriptions

* fix polygon stock_news

* fix stock_news data

* ruff

* refactored `DividendCalendar` for `stocks.fa.cal`

* refactored `EarningsCalendar` for `stocks.fa.cal`

* refactored `EarningsCallTranscript` for `stocks.fa.transcript`

* refactored `ExecutiveCompensation` for `stocks.fa.comp`

* first round, refactor registry, executor, map

* ruff

* Allow alias in the provider models for provider specific params

* Updated stock news to use alias in query

* small fixes

* fix interface bug

* black

* exceptions and typing

* ruff

* fix docstring

* sort providers

* push static assets without docstrings

* date Field and optional dates params in `CryptoEOD` for fmp and polygon

* refactored `ForexEOD` for `forex.load`

* add comment

* refactored `ForexPairs` and added Polygon provider

* removed `_price` models from fmp and polygon

* Updated `economy.index` to use `MajorIndicesEOD`

* removed `_price` from sdk models

* refactored `MajorIndicesEOD` for `economy.index`

* refactored `StockEOD` for `stocks.load`

* regenerate sdk

* ruff

* fix bug with global_news

* typing

* add docstrings to registry map

* update docstrings

* add executor query arg

* follow convention

* docstring

* inject provider interface instead

* doc

* safer this way

* docs

* add abstractmethod decorator

* add explicit fetcher property model_name

* remove mode_name prop

* get model name from query params

* force extra params or data to be optional

* replace fetcher list by fetcher dict and black

* explicit depps in prov interface

* explicit depps in prov interface

* no formatted creds

* no formatted creds

* dep injection

* dep injection

* private methods

* just verify credentials

* docstring

* typing and cut doc

* typing

* typing

* typing

* no overkill

* ruff

* don't block if model not found, just warn

* don't block if model not found, just warn

* don't block if model not found, just warn

* empty list if creds None

* check creds before request

* just return the data

* typing

* move query params

* ruff

* move queryparams

* move queryparams

* move queryparams

* fix a bunch o polygon models

* ruff

* partial fix fmp models

* ruff

* refactor more fmps

* create dict by alias

* refactor more fmp endpoints

* bug

* add params to transform query

* ruff

* fix fmp bugs

* has to be annotation

* rewrite static

* typing

* append return type to map

* support return for generic data type

* remove return type for openbb provider

* add todo

* fix small fred typing error

* add more return type info

* better message

* handle multiple types of data (the fetcher should declare them later)

* add comment

* ruff

* handle returns with generic for now (check juan solution)

* fix bug with generic

* fix fmp fetchr dict

* fill return type in the provider lib for docstrings

* polygon stock news

* Update economy_router.py (#5254)

* remove return type stuff

* adapt cpi and overview

* rewrite python interface

* fix to_dataframe

* limit stocks eod output

* rename method

* mypy

* mypy

* mypy chart style

* mypy provider

* mypy ignores

* mypy credentials

* Added Statements Growth endpoints from FMP

* account mypy fix

* privatize account method

* one more mypy

* remove mypy ignore

* rename private method

* Linting

* Docstring generation

* Linting

* move provider.py into __init__.py

* add default to required_credentials -> None

* refactored `KeyExecutives` for `stocks.fa.mgmt`

* refactored `HistoricalEmployees` for `stocks.fa.emp`

* provider docstring

* docstring

* refactored `HistoricalStockSplits` for `stocks.fa.split`

* standardised date in stockeod

* refactored ``InstitutionalOwnership` for `stocks.fa.own`

* removed unused imports

* add `check_fields=False` in `@validator`

* historical dividens

* remove unused helper

* move single used helpers to where they are used

* move single used helpers to where they are used

* move single used helpers to where they are used

* standardise date, vwap in crypto eod and forex eod

* rename __commands__ to __extensions__

* change coverage separator

* the map cannot change sep

* sry

* sry again

* remove comment

* refactored `MajorIndicesConstituents` for `economy.const`

* add some descriptions about provider

* refactored `PriceTargetConsensus` for `stocks.fa.pt`

* refactored `PriceTarget` for `stocks.fa.pta`

* refactored `RevenueBusinessLine` for `stocks.fa.revseg`

* change metadata file name

* docstring

* remove unecessary arg

* ruff & black

* refactored `RevenueGeographic` for `stocks.fa.revgeo`

* refactored `RiskPremium` for `economy.risk`

* refactored `SECFilings` for `stocks.dd.sec`

* refactored `ShareStatistics` for `stocks.fa.shrs`

* refactored `StockInsiderTrading` for `stocks.fa.ins`

* peers

* stock splits

* refactored `KeyMetrics` for `stocks.fa.metrics`

* refactored `StockMultiples` for `stocks.multiples`

* refactor income statement

* rebuild

* fmp balance

* added `StocksOwnership` to `stocks.fa.own`

* added `InstitutionalOwnership` to `stocks.fa.ins_own`

* refactored `StocksOwnership` for `stocks.fa.own`

* cleanup

* refactored `TreasuryRates` for `fixedincome.treasury`

* reorder balance items

* fix polygon bs

* refactored `IncomeStatement` for `stocks.fa.balance`

* refactored base and types

* added static files

* cleanup

* cleanup

* refactored `CashFlowStatement` for `stocks.fa.cash`

* added `stocks/fa` static file

* black and ruff

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>
Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
2023-08-02 18:47:20 +05:30
..

REPORTS

This menu has a different concept from remaining menus. It has 2 main goals:

  • Generate a personalised report.
  • Allow the user to write notes on that notebook (report), as if it was his personal investment diary.

How to create your own personal report

  1. Copy one of the existing notebook reports as a template, e.g. dark_pool.ipynb.

  2. Rename that notebook with a name that reflects what you want this notebook to contain, even including your name.

  3. One of the notebook cells will have a parameters tag, that's where the papermill will parametrize the notebook. Thus, your variables should be declared there.

  4. Remove the function calls that you don't care about to build your own report.

  5. When building your template notebook, there are 2 type of possible things you can do:

    • Create a markdown cell, where you can add a title or a description. E.g.
    ## Analyst Targets
    
    • Create a code cell, where you should both: import a module, and call a function to display a chart or print data. E.g.
    from openbb_terminal.stocks.due_diligence import finviz_view
    
    finviz_view.analyst(ticker=ticker, export='')
    

Note: In order to find the name of the function you want, you should either crawl through the codebase (and ask help in discord) or look into our readthedocs (#TODO).

How to run the report

  1. In config_terminal you may need to change your PAPERMILL_NOTEBOOK_REPORT_PORT from 8888. If the notebook generation fails, it is likely that the port selected is not the correct one.

  2. Start the terminal with python terminal.py

  3. Select reports context, and choose from the options selected - which are derived from the .ipynb jupyter notebook files on the reports folder.

  4. This should prompt you with a filled notebook with name: <date time>_<report name>_<args>.ipynb. E.g. 20210725_193517_dark_pool_AMC.ipynb

  5. Due to the last cell of the notebook, the report is saved by default as .html. E.g. 20210725_193517_dark_pool_AMC.html

    folder = "notebooks/reports/"
    extension = ".ipynb"
    !jupyter nbconvert {report_name} --to html --no-input
    
  6. You can now write your own personal notes on the notebook. By doing:

    • Click on the notebook cell that you are interested in writing your notes
    • On the toolbar click on "+" to add a new cell
    • On the toolbar click on "Cell" -> "Cell Type" -> "Markdown"
    • You're now ready to write your own notes
  7. Once you're happy with your report, you can either:

    • Re-run the last cell, potentially changing output from .html:
    • Or, on the toolbar click on "File" -> "Download as" -> Select your preferred option (e.g. HTML)