Files
OpenBB/openbb_terminal/forecast/forecast_controller.py
Pratyush Shukla a42c5604e3 [Release] 4.1.5 (#6190)
* Parameterize `obbject.to_df` with `index` and `sort_by` (#5877)

* Parameterize obbject.to_df with index and sort_by

* unit tests for obbject

* keep using the date as default to use on  basemode_to_df()

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* Changes to the `obb.fixedincome.corporate.hqm()` output (#5876)

* changes to the hqm output

* typo

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* Refactor method in RegistryMap (#5879)

* refactor extract_info

* add comment

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* remove Literal from providers in OBBject (#5882)

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* Fix version (#5883)

* Fix version

* Fix linter on terminal

* Refactor package builder (#5880)

* breakdown builder + remove black

* rebuild

* rebuild

* rebuild

* rename method

* format built code without black

* we still lint if it's available

* fix existing tests

* add linter tests

* add black to dev deps

* auto_build as instance method

* reorder methods

* typing

---------

Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt>

* small refactor for simplification (#5886)

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* Fix bug. Add router test. (#5888)

* Fix bug. Add router test.

* Simplify

* separate pylint between platform + terminal (#5892)

* separate pylint b/w platform + terminal

* Explicitly set pylint check scope to files in the diff

---------

Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>

* sync descriptions (#5893)

* Add REST API docs page with advanced settings configuration (#5890)

* Don't mention docker in a list of python envs

* Create a REST API page

* Update docs to get api keys from the hub

* Update installation instructions

* Mention requirement of poetry and toml in source installation section

* move rest page up to the top. and add url to google colab example notebook

---------

Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>

* fix a v3 syntax example (#5891)

* Adds federal reserve data points (#5885)

* Allow optional input for 2-month treasury rates and add FederalReserve rates model

The commit includes two main changes. One being the modification to the standard treasury rate models, where the 2-month input field is now optional, and a default value is set to none. The other main change is the addition of a new module for the FederalReserve treasury rates model, which includes query parameters, a data model, and a data fetcher.

* Add Money Measures models and commands

This commit introduces new Money Measures models to handle money-related data, defines Money Measures commands in the economy router, and implements the Federal Reserve Money Measures model. The core model includes fields like start_date, end_date, and various components of the money supply. The new command added to the economy router allows the querying of these data.

* Add Federal Reserve Money Measures test file

This commit adds a test case file for the Federal Reserve Money Measures fetcher in the Federal Reserve module. The test case includes simulating a GET request and the corresponding expected response from the server.

* Cleanup

* Sneaky unformatted integration tests

* its a dawg life for me ...... ruff

* add the fed funds rate

* didnt mean to commmit this

* black

* this is why we should pre commit kids

* change install name

* add providers to int tests

* review comments + commit static

* replace nan with None

* fix float on None

* get rid of nans for nulls for json handling

* change `_` to `-` in readme pip install.

* Update __init__.py docstring

---------

Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>
Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>

* Check if outdated (#5898)

* Add econometrics API tests (#5899)

* Docs/excel update (#5889)

* update xl docs

* update syntax line

* update again

* Fix pylint scope (#5895)

* Allow optional input for 2-month treasury rates and add FederalReserve rates model

The commit includes two main changes. One being the modification to the standard treasury rate models, where the 2-month input field is now optional, and a default value is set to none. The other main change is the addition of a new module for the FederalReserve treasury rates model, which includes query parameters, a data model, and a data fetcher.

* Add Money Measures models and commands

This commit introduces new Money Measures models to handle money-related data, defines Money Measures commands in the economy router, and implements the Federal Reserve Money Measures model. The core model includes fields like start_date, end_date, and various components of the money supply. The new command added to the economy router allows the querying of these data.

* Add Federal Reserve Money Measures test file

This commit adds a test case file for the Federal Reserve Money Measures fetcher in the Federal Reserve module. The test case includes simulating a GET request and the corresponding expected response from the server.

* Cleanup

* Sneaky unformatted integration tests

* its a dawg life for me ...... ruff

* add the fed funds rate

* didnt mean to commmit this

* black

* this is why we should pre commit kids

* change install name

* add providers to int tests

* review comments + commit static

* replace nan with None

* fix float on None

* get rid of nans for nulls for json handling

* change `_` to `-` in readme pip install.

* Update __init__.py docstring

* Debug pylint

* Adjust the fetch depth

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>
Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>

* fix `from openbb import obb` asyncio lock in python REPL (#5896)

Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>
Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* feature/financials - PR for working on structure of financial statements. (#5794)

* balance sheet draft

* balance_sheet draft

* cash_flow draft

* income_statement draft

* intrinio financials

* description

* period field

* ruff

* income statement

* field

* label - gross profit ratio

* cash flow statement

* investing order

* add option for caching to cashflow

* add caching to balance and income

* typos and update order for financial institutions

* replace 0 values with None

* add financial ratios from intrinio

* black

* missing test params

* balance cassette

* query param description

* symbol list warning

* black

* handle BRK-A and symbols with a dash for Intrinio

* fix typo error

* add free cash flow to bottom of cash flow statement

* amortization_expense

* dev_install.py

* undo dev_install.. wrong branch

* cash flow order things

* standardized cash flow

* fields

* integration tests

* cash flow model validator

* more polygon cash

* black

* black

* Delete openbb_sdk/providers/polygon/openbb_polygon/utils/definitions.py

wrong file

* balance sheet

* some cleanup

* ruff

* income statement

* black

* test params

* financial ratios async update

* recapture fmp and polygon tests

* yFinance financials

* yfinance tests

* delete financial_statements standard model

* intrinio balance sheet order

* fiscal year standard param

* remove file accidentally committed

* add reported_financials end point

* fiscal_year param for reported_financials

* fix url

* fmp test cassette

* add safe-guard with warning for fiscal year before 2008

* periods can only be annual and quarter

* url in docstring correction

* add fiscal_year param to intrinio standardized financials and ratios

* fix fmp ratios

* black

* rename fields as per Minh

* rogue field

* black

* Fix typo in a docstring

* Resolve linting errors

* type ignore

* disable=unused-argument

* changing the arg name cc @minhhoang1023

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>
Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>

* docs/legacy-install: Add warning at top of page - Instructions on this page are for installing the Terminal (#5904)

* add warning at top of page - instructions are for installing the Terminal app

* pip install openbb-nightly

* hotfix/financials-field-maps: Updates A Couple FMP/Polygon Income Statement Fields (#5907)

* update income statement fields

* another polygon field

* ratio -> margin

* black

* explicit fmp fields

* add reported_currency for standardized intrinio

* # pylint: disable=unused-argument

* another unused-argument

* black..

* patch tests

* polygon income: eps -> basic earnings per share

* re-capture terminal portfolio menu test

---------

Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>

* Fix test (#5916)

* Fix test

* Skip ultima integration tests

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* hotfix/fmp-price-performance-zeros: Replace returned zero with None and normalize percent values. (#5918)

* replace zeros with none and normalize percents

* pylint unused argument

* Update index.md (#5906)

* Release/4.1.0 (#5901)

* Hotfix/terminal tests (#5919)

* skip supressed arguments

* silent way of customly load on quote

* specify source for call_load

* docs/platform-faq: Start Platform FAQ page with bullet points on Platform vs SDK (#5914)

* platform vs sdk faq page

* add data and data providers faq section and some style cards

* typo

* makes changes as per reviews

* openbb-nightly as a way to install everything

* jupyter-lab instead of jupyter

---------

Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt>

* hotfix/backend - Initialize OpenBBFigure (#5912)

* create backend

* openbb_figure

* black

* pylint

* pylint again

---------

Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt>

* hotfix/yf-futures-historical: yfinance historical futures multi-ticker support and symbol parsing (#5923)

* multi-ticker support for yfinance futures historical

* raise-missing-from

* integration test params

* equity_historical adjusted kwargs

* pylint unused argument

* Docs/excel examples (#5920)

* regen excel md

* add syntax + basic example

* fix example

* create json with docs map

* update docs to latest functions.json + remove tiingo

* remove space from examples

* minor fix

* remove spaces

* remove spaces

* bug fix: remove folder before generating

* fix typo

* add link to appsource

* fix

* Update templates.md

* regenerate content

* change docs colors

* fix light mode

* add back tiingo

* update functions.json

* templates go later

* remove Library from reference

* Make the excel markdown being generated at runtime

* fix reference cards having commands under menu

* remove excel/reference folder since this is built at runtime by gh-pages action

* black formatting

* improve title

* add excel to the main page

* add excel image bg

* make excel sidebar show up next to pro

* improve main page

* small fix for platform page title

* update basics page

* add tip to autocomplete

---------

Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt>

* Re-record tests and fix symbol bug (#5924)

* Re-record tests and fix symbol bug

* nordvpn us ftw

* @IgorWounds says "SPY >> IOO"

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* Docs/bug fix (#5926)

* fix pro link

* fix wrong example

* Introduces a limit argument for the `equity.fundamental.trailing_dividend_yield` endpoint (#5925)

* introduces a limit argument for the equity.fundamental.trailing_dividend_yield endpoint

* add default args to test

* Add json_schema_extra to openapi.json (#5930)

Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>

* feature/standardize-quote: Proposal to Standardize EquityQuote (#5922)

* standardize EquityQuote

* intrinio reference

* rogue comma

* pylint

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* hotfix/fmp-rev-segments: Adds Fiscal Period to busines/geographic segments revenue. (#5921)

* add fiscal_period to revenue by geography and business line

* data description and unused imports

* update test cassette

* Allow multiple symbols `equity.profile` (#5929)

* allow multiple symbols

* pylint

* pylint ignore position

* change callback to helper func

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>
Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>

* Add filtering to AV historical price (#5928)

* add filtering to av historical price

* lints

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* Fix vwap FMP error (#5936)

* Fix vwap FMP error

* Linting

* Painlint

* Add date filter + symbols to comp (#5931)

* add date filter + symbols to comp

* make sure year is in d

* tests fix

* Improving Platform's import time (#5894)

* missing decorator

* missing optional statements

* us-gov to optional and right position

* removing redundant call

* lazy load mappings

* docstrings

* introducing the extension loader class

* misleading docstring

* using the extension loader on the router

* using the extension loader on the credentials

* docstrings

* lazy load of entry points

* checkout dev_install

* using the extension loader to get the entry points instead of recalling the function

* improved auth service and charting service

* using the extension loader on the registry

* typos

* adding properties to extension loader for easy access

* using the extension loader on the package builder

* avoiding circular imports by using forward references

* fix charting service tests

* test for the extension loader

* Update openbb_platform/core/openbb_core/app/model/credentials.py

Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>

* Update openbb_platform/core/openbb_core/app/router.py

Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>

* Update openbb_platform/core/openbb_core/provider/registry.py

Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>

* adjustments

---------

Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>

* Disable auto_build on test run (#5937)

* Disable auto_build on test run

* Move to conftest

* Update excel docs (#5940)

* update basics

* update reference generator

* Categorize release notes based on labels for OpenBB Platform (#5943)

* Categorize release notes based on labels for OpenBB Platform

* Add environment variable for GitHub token in labels-PR.yml

* Update labeler.yml to use "enhancement" label for feature branches

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* Custom deprecation message in API endpoints and Python commands (#5942)

* add custom deprecation message feature in routers

* add custom deprecation message feature in package builder

* using an actual DeprecationWarning instead

* fix tests

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>

* Hotfix/remove unused workflow (#5945)

* Disable auto_build on test run

* Remove unused workflow

* Revert

* Hotfix/fix typo (#5948)

* Disable auto_build on test run

* Fix typo

* Revert

* docs/data-models-url: Fix URLs on Development Page (#5944)

* fix url to the standard models

* github links

* `equity.fundamental.dividends`: allow filter by date (#5932)

* allow filter by date

* ruff

* pylint

* fix tests

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* Create Excel templates page (#5947)

* create templates page

* Update index.mdx

* fix description

* update card

* remove clsx

* Update index.mdx

* Update index.mdx

* Update index.mdx

* Update index.mdx

* min height

* min height

* improve excel docs and point towards hub

---------

Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt>

* hotfix/intrinio-dividends-limit: Fix Limit Param Alias (#5951)

* fix limit param

* pylint unused argument, recapture test cassette

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* Docs/remove core refs (#5957)

* remove references to core: PathHandler + ProviderInterface

* remove unused function

* add comment

* regenerate

* fix a few examples

* add comment

* rename file

* Excel tutorials on the docs (#5956)

* update workflows name to tutorial

* update title

* get barebones to bring in Excel videos

* tutorial excel videos in

* hotfix/float-values: Convert Intrinio balance sheet values to float type (#5961)

* convert intrinio balance sheet values to float type

* unused import

* typo in alias dict

* Update to OpenBB Add-in for Excel (#5965)

* Log custom headers (#5966)

* add custom headers

* fix: send on startup and defaults

* pylint

* unittests

* move government-us to community in dev_install (#5963)

* fix: adds logic to check whther user is logged in on hub (#5941)

Co-authored-by: Luqman <luqazino@gmail.com>

* hotfix/fix-company-filings: Fixes too many mandatory fields. (#5909)

* Fixes too many mandatory fields.

* black

* black again

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>
Co-authored-by: James Maslek <jmaslek11@gmail.com>

* `equity.estimates.price_target` - Integrate with Benzinga (#5946)

* deprecation message

* fix lints

* adding equity.estimates.ratings and fmp as its provider

* unit tests for fmp

* removing unused file

* typos

* add benzinga to AnalystRatings

* revert changes to estimates router

* moving it to price target instead

* reverting changes

* fmp support for multiple ticker

* benzinga price target

* ruffy

* unused argument

* fix type hints

* tests for the new fetcher

* new integration tests

* fixing tests

* missing std arg

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [DEPRECATION] `index.market` renamed to `index.price.historical` (#5962)

* deprecate index.market and add index.price.historical

* add index.historical standard model

* add index.historical provider models

* index extension tests

* provider tests

* linting

* bug fix (#5969)

* Uppercase excel reference (#5958)

* uppercase reference

* fix name header

* add tab title

* remove reference excel folder

* add to gitignore excel reference files

---------

Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt>

* move templates (#5970)

* Release 4.1.1. (#5964)

* update dev_install

* fix effr test

* Update dev_install.py

* fix fundamental balance test

* fix equity price historical test

* fix price target model

* black

* rebuild static files

* update publish.md

* fixed dev_install

* update publishing doc

* updated `openbb-core` to 1.1.1

* updated extensions

* updated providers

* updated `openbb` package

* updated static extension map

* updated publishing doc

* fixed toml for `openbb-finra`

* @jmaslek yfinance IS DEFAULT

* updated static

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>
Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>

* Fix link to discord channel (#5910)

Co-authored-by: James Maslek <jmaslek11@gmail.com>

* Fixing Posthog handler for thread safety (#5968)

* fixing posthog handler for thread safety

* removing loggging init from the global scope - per sensei juan

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* Update labeler.yml and labels-PR.yml (#5974)

* hotfix/ allow multiple `identify` calls (#5976)

* allow multiple `identify` calls

* Update posthog_handler.py

* regex out any invisible control character from sales_conditions field (#5977)

* docs/http-requests: Contributor Guide For Building HTTP Requests (#5973)

* contributor guide for http requests

* add a docstring

* add section on get_querystring

* extra space

* add note for people installing PyPI in a zsh terminal shell

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* feature/add-yfinance-functions: Add equity.profile for yFinance (#5978)

* equity profile for yFinance

* pylint

* equity quote

* unused imports

* remove yfinance from extras in toml (#5982)

* Release OpenBB Platform v`4.1.3` (#5983)

* fixing pyproject.toml

* adding pandas-ta to technical package for publishing

* bumping technical

* test for pyproject toml

* feature/cboe-async: Refactor Cboe for Async (#5900)

* refactor cboe for async

* codespell

* unused imports

* pylint

* more pylint

* platform metadata

* classmethod decorator

* test params

* intrinio quote

* test param names

* date in test needs to be a datetime.date not string

* make fmp unix timestamp tz-aware and normalize percent change

* different way of parsing datetime string

* recapture cboe equity historical test

* unused import

* index snapshot update

* black

* extension map

* pylint

* cboe pyproject.toml

* proposal to standardize equity_quote

* one more file

* removing changes on static assets

* index_historical

* index_historical again

* last_time -> last_timestamp

* obsolete router path

* fix tests

* test param

* restore market index deprecation that I forgot about

* fixing tests

---------

Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>

* Fix typo in  website/README.md (#5980)

* Fix typo in  website/README.md

* Update linting.yml

* Update linting.yml

* Update linting.yml

* Change ref conditions

* Update linting.yml

---------

Co-authored-by: Luqman <luqman.bello@openbb.finance>
Co-authored-by: Luqman <luqazino@gmail.com>

* Hotfix/th etfs (#5959)

* added etf trading hours

* black formatter

---------

Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>
Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt>
Co-authored-by: Luqman <luqazino@gmail.com>

* feature/finviz-provider: Adds Community Finviz Provider Extension (#5952)

* add finviz provider

* recapture tests

* recapture tests again?

* invalid test param

* static packages

* units_measurement -> unit_measurement

* static packages as core only

* openbb_core version bump in pyproject.toml

* try adding user-agent to test response

* fix tests

* linting

* provider model cosmetic changes

* fix install script and typo in openbb toml

* static

* fix: re-record unittests

* empty data error

* definitions as a file

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>
Co-authored-by: Diogo Sousa <montezdesousa@gmail.com>

* Add support for multiple symbols on `obb.equity.price.historical` (#5984)

* av - support for multiple symbols

* tiingo - support for multiple symbols

* include symbol only if necessary

* update extension descriptions page (#5985)

* remove useless file (#5991)

* added symbol to headers (#5981)

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* Fixing Docs Typos (#5955)

* fixed typo

* fixed stocka typo

---------

Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>
Co-authored-by: James Maslek <jmaslek11@gmail.com>
Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt>

* fix nasdaq test cassettes (#5989)

* don't include `custom_headers` in openapi schema (#5994)

* hotfix/intrinio-index: Drop None Rows From intrinio Historical Index (#5987)

* drop None rows from intrinio historical indexes

* add empty data error

* static assets

* hotfix/insider-trading: Fix #5988 (#5990)

* fix validation errors

* empty strings

* validator

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Co-authored-by: teh_coderer <me@tehcoderer.com>

* CI listing quick fix (#6002)

* BIGGGG LINTING

* fixing lints

* fixing lints

* black

* very ruff

* no export

* fix hedge_view again

* lints

* platform lints

* lints

* black

* black it @hjoaquim

* fix some more linting

---------

Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>

* Release `openbb-finviz` `1.0.0` to the public (#6000)

* set version to `1.0.0`

* Set correct dep version in main package

* Add `finviz` to table

* Auto Labelling for OpenBB Excel Docs Changes (#5998)

* Update pull request labels

* Update labeler.yml with new label for Excel files

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [Feature] - Support for custom examples in router commands (#5993)

* Disable auto_build on test run

* Add support for custom router examples

* Revert odd file change

* Fix API pollution

* Refactor examples with @montezdesousa

* Check if model is inside the PI

* Fix

* feat: add & fix examples (#6001)

* feat: add & fix examples

* fix: ruff + comment

* feat: read parameter pool from file

* feat: typing + unit test

* Disable auto_build on test run

* Add field order to OBBject

* Revert

* lint and revert

* fix test

---------

Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>
Co-authored-by: Diogo Sousa <montezdesousa@gmail.com>

* hotfix/intrinio-options-date: Fix comparing values between str and datetime (#5997)

* fix compare between str and datetime

* unused argument

* get_weekday

* lint

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [Feature] - Field order added to the OBBject extra as preference (#5999)

* Disable auto_build on test run

* Add field order to OBBject

* Improvements

* Remove noxfile

* Disable auto_build on test run

* Add field order to OBBject

* Revert

* lint

* Add docs

* Not sure how this happened

* lint

* Update `openbb-devtools` (#6008)

* update deps

* unpinned package versions from gh linting action

* codespell

* updated black dependency

* linting

* linting

* linting

* pin codespell version

* black

* black again

* install devtools in linting action

* format w new black (#6009)

* format w new black

* format w new black

* black again

* black the terminal

* ignoring unused arguments

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* remove reviewpad (#6010)

* Remove Ultima provider (#6012)

* Add OECD unemployment (+more) + data cache idea (#5917)

* Add OECD unemployment + data cache idea

* Docstring edits

* Tests

* Add composite leading indicator

* i truested ruff --fix too much

* Add short + long term interest rates

* pylint

* pylint2

* was not committing.  my b

* add csv cache + make it default.  remove pyarrow from poetry

* Clean up

* Didnt run on this file.  My bad

* Why was this ignored /shrug

* pylint

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* Feature/improved pr template (#6018)

* format w new black

* Revert "format w new black"

This reverts commit 74b9619cc6.

* better pr templates

* developer template

* [Feature] - Custom deprecation (#6005)

* custom deprecation

* custom deprecation

* using the new deprecation

* custom deprecation on the package builder

* remove comment

* ruff

* black

* static assets

* tests

* using parametrization instead

* test for deprecated endpoints (#6014)

* Deprecation warning on the reference docs (#6015)

* typo/fix

* bring back methods needed for markdown generation

* add deprecation warning to docs

* contributor docs for deprecating endpoints - tks @deeleeramone

* small changes on publishing procedure per @the-praxs

* moving the deprecation summary class to deprecation file instead

* explanation on class variables

* Update website/content/platform/development/contributor-guidelines/deprecating_endpoints.md

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* Update website/content/platform/development/contributor-guidelines/deprecating_endpoints.md

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* Update website/content/platform/development/contributor-guidelines/deprecating_endpoints.md

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* Update openbb_platform/openbb/package/index.py

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* Update website/content/platform/development/contributor-guidelines/deprecating_endpoints.md

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* Update website/content/platform/development/contributor-guidelines/deprecating_endpoints.md

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* deprecating on 4.3 instead @the-praxs

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* [BugFix] Fix package builder (#6022)

* fix: remove specific imports

* adjustments for correct deprecation

* static assets

---------

Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>

* [Feature] Add support for multiple tags in `historical_attributes` and `latest_attributes` (#6013)

* historical attributes standard model -
* add support multiple tags
* add `tag` field in data

* add support for multiple tags in historical attributes

* set correct return type in `callback` function

* latest attributes standard model -
* add support for multiple tags
* add `tag` field in data

* add support for multiple tags in latest attributes

* add test params for the attributes endpoints

* add support for multiple `symbol` and add `symbol` field in the data

* modified code to fetch data from multiple symbols and throw warning as per @deeleeramone

* add params for testing multiple symbols

* linting

* fix test params

* fixed condition to check if its a `Dict` type

* updated intrinio fetcher tests for the statements

* updated static

* [feature]: feature/overview-to-profile: Deprecate `equity.fundamental.overview()` and move to `equity.profile()` (#6011)

* fmp overview to equity profile

* deprecation warning

* urls

* wrangle fields

* black

* pylint unused argument

* insert additional securityID fields to standard model

* custom deprecation using OpenBBDeprecationWarning

* typo - need to have the deprecated=True flag

* static assets

* fix non related test

* minor adjustment - removing the need for the try/except block - using the get and pop removes the need for key existance checking. cc @deeleeramone

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt>

* [BugFix] - Remove duplicate code (#6025)

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* remove `SectorNews` from router and standard models (#6026)

* feature/more-yfinance: Adds some more to openbb-yfinance (#5979)

* equity profile for yFinance

* pylint

* equity quote

* unused imports

* price target consensus

* add currency field

* add share_statistics

* don't append empty result to results

* key executives

* missing definition in key_executives

* pylint

* key metrics

* add currency to key metrics

* add etf_info

* rename trailing_annual_dividend -> dividend_rate_ttm

* add institutions count to share_statistics

* add historical dividends

* add logic for start-end dates to historical_dividends

* recapture the test..?

* funny test

* filter on tests?

* record test with clean cache..?

* year_price_change -> price_return_1y in key_metrics

* black

* make descriptions clear for beta and dividend_yield fields

* add description field to standard model

* updated static

* clear description of shares_implied_outstanding field

* updated static for equity

* clean descriptions

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* feature/commodities-lbma-fixing: Adds Commodity Extension and LBMA Gold/Silver daily fixing levels (#5760)

* add commodity extension and add lbma fixing endpoint

* dev_install.py

* readme url

* renovate the standard model

* makes a query_params model for nasdaq data link

* literal not optional

* unused imports

* missing test params

* test cassette

* DataLink query param description

* test file import

* actually fix import

* from openbb_core.provider.....

* ruff

* another import statement

* black

* async router

* move query_params

* update version

* version numbers

* extension_map

* satisfy pylint?

* pylint

* Update pyproject.toml

* black

* poetry lock

* Update extension_map.json

* Update __extensions__.py

* Update module_map.json

* clean descriptions

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* Improve UX for `obb.news` (#5986)

* adding date,start_date and end_date to std params

* add date to special params which should've another type

* change types to dateType

* change helper to accomadate changes in types

* date filtering

* using the date filtering for all providers

* date params on the std model instead

* adding the right type

* filtering dates on world news

* integration tests

* fix descriptions

* static assets

* black

* Revert "black"

This reverts commit 7288b59f87.

* lint

* addressing @montezdesousa suggestion: removing qua 31 jan 2024 15:01:20 WET from standard models and using it only on benzing

* tests accordingly

* static assets

* black

---------

Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>
Co-authored-by: teh_coderer <me@tehcoderer.com>
Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [BugFix] - Improve Standardization - `IndexHistorical` (#6030)

* format w new black

* Revert "format w new black"

This reverts commit 74b9619cc6.

* small adjustment on the test

* index historical

* adjust tests accordingly

* keep the test skipped

* match tests w python

* fix tests

* keep the skip

* fix test

* [Feature] - Refactor Response Model (#6024)

* Start refactor with @montezdesousa

* feat: add response model inside openapi_extra

* feat: find+replace return types

* fix: ruff

* Feature/api response by provider (#6029)

* init

* Update router.py

* Update registry_map.py

* check dicts

* lint

* exclude provider on data model for package build

* `results_type_repr` logic for `Annotated`, ignore provider field in `_extract_data`

---------

Co-authored-by: Diogo Sousa <montezdesousa@gmail.com>
Co-authored-by: teh_coderer <me@tehcoderer.com>

* [BugFix] - Improve Standardization - `CotSearch` (#6031)

* format w new black

* Revert "format w new black"

This reverts commit 74b9619cc6.

* small adjustment on the test

* index historical

* adjust tests accordingly

* keep the test skipped

* match tests w python

* use cache as std field

* fix tests

* fix tests

* keep the skip

* fix test

* adding missing param

* fix tests accordingly

* Docs/byod (#5996)

* add byod to reference

* fix: rename add-in name

* feat: add data conectors page

* fix: additional notes

* tiny tweaks

* update functions.json and openapi.json

* fix: fix bug in hedge controller

* fix: another bug hedgecontroller

* black

---------

Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt>

* Feature/ex-dividend: Renames "date" columns as "ex_dividend_date" for Dividend Calendar and Historical Dividends (#6006)

* date -> ex_dividend_date

* nasdaq historical dividends

* black

* pylint

* intrinio alias_dict

* dividend_currency -> currency

* yfinance field name

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [BugFix] - Adds a timezone to the Unix timestamp conversion to correct localization errors. (#6023)

* fix: remove specific imports

* make polygon historical tz-aware

* undo including that commit

* that PR wasn't supposed to be there.

* pylint unused argument

* fix polygon crypto historical intervals

* pylint

* new cassette

* fix the rest of the polygon historical price query params

* black

* pylint..

* integration test param

* appease daylight savings handling

* paginate for crypto currency and index

* black

* raise EmptyDataError when no results instead of returning an empty list

* ruff

---------

Co-authored-by: Diogo Sousa <montezdesousa@gmail.com>

* Hotfix/wrong pydantic validator (#6037)

* format w new black

* Revert "format w new black"

This reverts commit 74b9619cc6.

* Use field_validator instead

* fix openapi schema fields `to_snake` (#6036)

* Fix data connectors link typo (#6038)

* [BugFix] - Improve Standardization - `EquitySearch` (#6033)

* format w new black

* Revert "format w new black"

This reverts commit 74b9619cc6.

* small adjustment on the test

* index historical

* adjust tests accordingly

* keep the test skipped

* match tests w python

* use cache as std field

* fix tests

* fix tests

* use_cache as std

* adjust tests

* keep the skip

* re-record test

* black

* Docs / only display results for current platform (#6017)

* Update index.js

* Update index.js

* yfinance

* tzcache no longer exists

* fixxy

* ruff

---------

Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt>
Co-authored-by: James Maslek <jmaslek11@gmail.com>
Co-authored-by: Andrew <andrew.kenreich@gmail.com>

* Improve the docstrings (#6040)

* Improve the docstrings (#6041)

Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt>

* dont run base tests with v4 label (#6046)

* Sync excel reference (#6039)

* sync excel reference

* fix: change delimiter to comma

* feat: update data connectors

* test skipping wf

* Update unit-test.yml

* Update unit-test.yml

* test skipping wf

* watch label changes

* Update unit-test.yml

* [Enhancement] - Improve `news` router docs and examples (#6047)

* better docs

* static assets

* Feature/platform standardization notebook (#6049)

* Add platform standardization overview notebook to examples

* Add py.typed marker to openbb-fred

* [Enhancement] - Improve `currency` router docs and examples (#6045)

* currency search

* reference rates

* historical price

* static assets

---------

Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>

* display warnings based on preference (#6051)

* [Enhancement] - Improve `crypto` router docs and examples (#6048)

* crypto search add validation for '-'-separated pairs

* set default query value to None

* improve /crypto description with custom examples

* improve /crypto/price/historical description with custom examples

* updated static for crypto menu

* ignore line too long

* linting

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* Final Implementation of Changelog V2 (#6050)

* Updated the release drafter to process the released changelog for OpenBB Platform

* Update release drafter configuration

* Add OpenBB Documentation Changes and Create Release

* Update process_changelog.py path in draft-release.yml

* Update release-drafter version and save changelog

* Copy changelog with python

* Update draft-release.yml to save Changelog

* Update draft-release.yml

* Encode and save Changelog to Base64

* Update Changelog saving method

* Update Changelog format

* Update CHANGELOG.md with release notes

* Fix draft release workflow

* Add cat command to print CHANGELOG.md

* Add platform-drafter.yml and update release-drafter.yml and draft-release.yml

* Commented out config-name in release-drafter step

* Update branch name validation and process_changelog.py

* Refactor process_changelog.py to improve readability and maintainability

* Refactor process_changelog.py to handle file I/O errors and remove duplicate PR entries

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* improve discriminator logic, fix package return type docs (#6052)

* improve discriminator logic, fix package return type docs

* Update registry_map.py

* build package

* Update registry_map.py

* defaults

* Update registry_map.py

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* Add LLM tools example notebook (#6053)

* Add LLM tools example notebook

* Update README, rename example notebook

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* Remove the  preference (#6055)

Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>

* [Feature] - Standardise multiple symbols input (#6056)

* feat: remove list of str

* fix: update cpi

* package builder + cpi

* build

* fix: update unittests

* fix: check_item

* fix: unittests

* Improve the docstrings (#6057)

* update economy router docstrings (#6058)

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [BugFix] Fix OECD Long Term Interest Rate (#6060)

* fix long term interest rate

* pylint unused argument

* [Bugfix] - Fix economic calendar country (#6059)

* fix economic calendar country

* lint

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [HotFix] Index Router Docstrings & `sp500_multiples()` Cleanup (#6063)

* sp500 multiples cleanup

* remove dict from standard model

* static pacakge

* pylint

* [Feature] FMP Current Holdings (#6043)

* add fmp current holdings to etf holdings

* pylint unused argument

---------

Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>
Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [Feature] - Replace symbols in company/news (#6061)

* feat: replace symbols in /news

* fix: integration tests

* fix: integration tests api

* fix: typo

* Update test_intrinio_fetchers.py

* [Enhancement] Add function examples to router. (#6042)

* options router

* fixedincome router

* futures router

* missing comma

* static assets

* futures router

---------

Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>
Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [Enhancement] Add function examples to Regulators Router (#6054)

* options router

* fixedincome router

* futures router

* missing comma

* static assets

* futures router

* sec router

* cftc router

* black

---------

Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>
Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [BugFix] Fix World News (#6064)

* fix fmp

* fix intrinio

* fix biztoc

* actually commit intrinio fix

* fix tiingo

* unused import

* fix tests

* black

* ruff

* benzinga empty strings

* codespell

* fix test?

* more empty strings

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [Feature] - remove unused validators from standard models (#6067)

* update standard models

* lint

* Update USD Liquidity Example Notebook for V4 (#5902)

* Update USD Liquidity Example Notebook for V4

* delete some v3 text in the copperToGold

* Update README.md

* findSymbols preview image

* Google Colab preview image

* financialStatements preview

* content tsx file

* ### title

* convert tsx to json

* indent size

* double quote keys.json

* trailing commas

* Update content.json

* patch

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Co-authored-by: James Maslek <jmaslek11@gmail.com>

* Fix QA Examples (#6072)

* [Feature] - Ensure Bugfix branches can only do PRs to `develop` branches (#6073)

* bugfix branch name checks and few fixes on the linting not to run on pushes to branches outside PRs

* Update branch naming guidelines link

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* Feature/charting obbject (#5938)

* fix circular import issues on the obbject extension framework

* settings available on the obbject

* extension init

* charting assets and code

* introduce to_chart functionality

* removes the to_chart method from obbject in detriment of the one from the obbject extension

* Update openbb_platform/obbject_extensions/charting/charting/__init__.py

Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>

* fix on the show method

* adding the example to the to_chart docstring

* copying the exsting README from charting extension - needs to be revamped

* moving to openbb_charting instead

* update the pyproject.toml file

* pydocstyle

* versions

* better docstrings

* making accessors public

* removing unnecessary credentials variable cc @montezdesousa

* removing access to extra/metadata and use designated private attrs instead

* Fixes linting for the logging service (#5992)

* lints

* typing.Type instead

* deprecating ChartingService to use the new extension instead - adding function discovery capabilities using it

* tests for the obbject charting extension

* removing charting service from command runner

* filter functions not implemented in the module

* remove charting service tests

* removing charting service on the tests for int tests

* charting integration tests

* removing charting service file

* removing old charting extension code

* revamp builder

* fix obbject tests

* fix command_runner tests

* removing openbb_figure_table

* better website docs

* reviewed readme

* unsetting api key for posthog (pywry) windows

* added debug_mode to the system settings

* removing api key

* update nightly script

* fix tests

* black

* black

* Revert "black"

This reverts commit 21d76ad689.

* Revert "black"

This reverts commit 0904653fd7.

* black for henrique

* returning a list instead

* better docstrings

* removing unnecessary indicators docstring

* typo

* black

* intentional access to protected member

* changes to publish script

* filtering deleted files

* black

* adding render argument

* fixing the df_to_basemodel function: it should include the index in the columns either if flagged or if the index is named

* adding the hability to add you own data to to_chart method

* tests

* black

* disable protected access

* accept kwargs to eg. save image

* adjustment cc Igor

* add if statement for protection

* remove unused return typing

* fix technical charting views

* better error message cc @IgorWounds

* better structure and fix test

* Revert "better structure and fix test"

This reverts commit 612ea6117c.

* Revert "better error message cc @IgorWounds"

This reverts commit 3d7ee53878.

---------

Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>
Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>
Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Co-authored-by: James Maslek <jmaslek11@gmail.com>

* Fix CAPM example (#6075)

* Start removing dead v3 commands for deprecation (#6070)

* Yeet tokenterminal

* Yeet crypto/onchain/hr and gwei

* yeet luna

* yeet coinglass

* yeet dps/ctb

* yeet reddit

* yeet covid

* actually not yeeting

hide yfinance future warning

* yeet options/hedge

* not yeeting.  i18n words

* something happened on accident

* still fixing

* git reset/git checkout -f 2516cfbc72 website/content

* still not sure whats going on

* Edit workflow to not look at deleted files + change bootup message

* Dont pin the workflow to my branch always lol

* Remove askobb

* [Feature]  - Comma separated string and list inputs (#6062)

* feat: balancesheet

* feat: income statement

* fix: cash flow statement

* feat: financial ratios

* feat: reported financials

* feat: revenue business line

* feat: revenue per geography

* fix: warnings

* Update balance_sheet.py

* fix: remove warning imports

* feat: balance sheet growth

* feat: calendar ipo

* feat: cashflow growth

* feat: __validators__

* fix: typing

* fix: validator msg

* feat: trailing dividend_yield

* feat: short volume

* feat: share statistics

* feat: price target + consensus

* fix: update validator

* feat: historical dividends

* feat: key executives

* fix: getattr directly

* fix: type hint validator

* fix: add default to getattr

* typo

* feat: otc

* feat: options chains

* fix: remove list validators

* feat: add validator dict to fetchers

* lint

* update standard models

* lint

* feat: rename validator

* fix: ownership

* feat: query params description

* fix: balance yfinance

* key execs, income statement

* remove change

* fix: revenue geographic

* fix: disable pylint

* fix: unusual + balance

* unit test validator

* minor fix

* explicit validators

* update test

* feat: multiple items allowed

* rebuild

* move check_single_value

* crypto historical

* order providers

* fix typing

* rename extra dict

* marking multiple items allowed

* Revert "marking multiple items allowed"

This reverts commit 7da04817e1.

* error msg

* fix: default provider runtime vs configuration

* minor fix

* docstring

* revert default changes

* get provider before executing cmd

* fix container bug

* clean filter

* add comment

* prevent bad defaults

* update docstring

* typing

* fix

* black

* fix docstring generation

* [Feature] - Mark multiple item fetchers (#6074)

* feat: price target

* bezinga company news

* equity quote

* marking multiple items allowed

* more multiple items

* black

* rebuild

* another batch

* rebuild

* another

* cpi

* move prop

* rebuild

---------

Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>

* rename var

* update msg

* rename func

* fix test

* mypy

* ruff

---------

Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>

* [Feature] Add Regional Data Endpoint from FRED (#6071)

* add regional data endpoint from FRED

* codespell

* ruff

* sort imports

* add provder='fred' to integration test

* thought I already sorted those imports..

* pylint..

* more test params....

* even more test params...

* even more test params....

* static assets

* reconfigure params

* ruff

* alias dict

* recapture cassette

* router doctstring

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [BugFix] - Fix most integration tests (#6082)

* Fix most integration tests

* Lint

* Fix price_target column for Benzinga (#6083)

* Release/4.1.4 (#6081)

* static assets

* patch version increase

* core update

* bumping versions

* bump finviz version

* bump versions

* bump versions on package.extension

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>

* Add dates to /quantitative as needed. (#6078)

* Add dates to /quantitative as needed.

Run new black

* Fix tests

* Pycharm is weird sometimes

* uncommit

* Add default window + error handling + mistake

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [Feature] Add end point: `etf.equity_exposure()` with FMP provider (#6079)

* add etf.equity_exposure from FMP

* empty data error

* recapture cassette

* pylint unused argument

* Fix router example typo

* fix test...?

* static file to fix test?

* fix test..?

* __json_schema_extra__

* black

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Co-authored-by: James Maslek <jmaslek11@gmail.com>

* [BugFix] Fix Equity Integration Tests (#6086)

* fix equity integration tests

* black

* pylint

* black

* black

* move df_apply to helpers

* unused import

* remove file that shouldn't have been added

* oops. didn't remove a couple lines

* [Enhancement] Add `analyst_search` to the Equity/Estimates Router (#6088)

* standardize price_target

* add analyst search

* black

* more black

* ruff

* linter, test parmas

* last missing param

* get rid of convert to upper

* ruff

* pylint

* [BugFix] - Fix POST docstring examples (#6095)

* Fix POST docstring examples.

* Move router examples to command decorator

* [BugFix] Fix `treasury_rates()` (#6092)

* fix treasury_rates

* drop rows with no data

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* clean up the remains from my yeeting (#6089)

* clean up the remains from my yeeting

* was not careful

* Add ETF examples (#6102)

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* [BugFix] Fix integration tests (#6100)

* fix int tests

* fix obbject int tests

* fix quant tests

* fix index tests

* use python 3.10 instead

* remove cache

* end_date < start_date

* [Enhancement]: Add TMX data provider extension. (#5913)

* dev install

* add TMX provider extension

* normalize ytm and coupopn_rate values

* black

* codespell

* ruff

* black again

* pylint

* ftw

* undo what Pylint thinks is best

* more black

* renovate insider_trading standard model

* fix tests

* typo

* tests

* empty string

* pylint unused argument

* nans for some reason

* black

* static files

* static files with openbb-tmx installed this time

* yfinance TypeError..?

* NA -> N/A

* update for version bump

* list exchange-calendars as tmx dependency

* eod chains date -> eod_date

* new line

* not that file

* more black

* one more black

* fix weird merge thing

* ruff

* index constituents params

* insider trading

* fixing things

* black

* black AGAIN

* news integration params

* the other missing param

* ruff

* historical dividends field update

* add json_schema_extra

* gainers

* symbols -> symbol

* company news symbol

* unit test param

* review items

* wrangle a rogue field

* index router example

* company news thing - symbols -> symbol

* field name map

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt>
Co-authored-by: James Maslek <jmaslek11@gmail.com>

* [Feature] - OBB.GET (#6097)

* create OBB.GET and data slicer page

* remove quotes

* format description

* wording

* functions.json

* sidebar position

* remove if stamente

* [Docs] Remove Reference to `to_chart` in OBBject. (#6096)

* remove reference to to_chart in OBBject.

* put chart description back in OBBject properties

* [Feature] - Create openbb assets folder (#6101)

* create openbb assets folder

* fix unittest

* rebuild

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [BugFix] Fixes to_df() where the date series contains multiple TZ-offsets. (#6099)

* allow mixed utc offset in a tz-aware date column

* enforce ascending from all providers for price.historical

* fix tests

* add comments and apply treatment to basemodel_from_df before JSON output

* yfinance consistency

* add unit test

* add unit test

* better test

* ruff

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* Update the quantitative extension to make more sense (#6087)

* Split out a rolling submenu for the rolling functions

* Make a performance and a stats submenu.

* Test the statistics functions

* lint

* lint

* dupe test

* pylint

* ruff

* Try tests quick

* black magic signature funcs

* fix my custom tests

* Fix the existing imports/urls

* push the api update

* okay I figured out whats going on

* this should be all  of them

* Correct docstringing examples

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>

* [BugFix] Fix ECB Yield Curve (#6108)

* fix ecb yield curve

* standard model update

* Update unit-test workflow to check for changes to openbb_platform (#6109)

* [Bug fix] - Fix package mypy (#6110)

* fix: package mypy

* types

* black

* [Feature] - Equity router descriptions & examples (#6103)

* feat: equity/calendar

* feat: compare router

* fix descriptions

* darkpool + discovery

* fix paragraph issues

* fix descriptions

* fundamental part 1

* fundamental part2

* transcipts

* ownership

* fix

* price

* shorts

* Update darkpool_router.py

* minor fix

* shorts examples

* examples

* ruff

* black

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [Feature] - Add `exception_handler` decorator to static (#6112)

* add exception handler decorator

* add exception handler decorator code

* updated static

* rebuild to fix docstring indentation

---------

Co-authored-by: Diogo Sousa <montezdesousa@gmail.com>

* update extensions list (#6114)

* add missing field descriptions to yfinance equity price historical (#6116)

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* remove charting extension env var (#6118)

* [BugFix] Fix Company News (#6111)

* fix company news

* update tests

* multiple symbols for polygon

* don't include pageSize in Benzinga querystring, fixed as 100

* remove extra space

* black

* unused imports

* make benzinga test cassette smaller

* missing params

* clear empty strings

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [BugFix] Allow Multiple Symbols in `equity.fundamental.metrics()` from `yfinance` (#6124)

* allow multiple symbols in key_metrics from yfinance

* field order thing

* remove unnecessary function (#6125)

* [Docs] Update OpenBB Copilot docs (#6106)

* WIP: Tweak description.

* WIP: Experimenting with react-player

* WIP: Add copilot docs.

* fixes videos width/height

* WIP: Refine videos and copy.

* WIP: Add last videos and sections.

* Add bring-your-own-copilot section.

* Tweak grammar.

* Add copilot link.

* Fix typos.

---------

Co-authored-by: jose-donato <43375532+jose-donato@users.noreply.github.com>

* [Enhancement] Add Previous Close to DATA_DESCRIPTIONS (#6120)

* add data description for previous close

* ..just the one

* update the model tripped by this change

---------

Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>

* added australia as a country also (#6131)

* [Bug fix] - Fix regulator cik map standard model (#6129)

* Fix regulator cik map standard model

* fix description

* Update cik_map.py

* increase timeout to 30 (#6115)

Co-authored-by: James Maslek <jmaslek11@gmail.com>

* clean up some v3 deps (#6105)

* clean up some v3 deps

* forgot we need to do the requirements txt files

* not sure it matters, but run ruff + black

* am addicted to bug fixes

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>

* [Bug fix] - explicit multiple items docstring (#6127)

* explicit multiple items docstring

* rebuiild

* rebuild again

---------

Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>

* [Feature] Pretty Pydantic `ValidationError` exceptions (#6130)

* fix validator in fmp IndexHistorical model

* make ValidationError pretty

* modify arg error

* linting fmp IndexHistorical

* black

* remove unused code

* tmx etf info (#6132)

Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>

* [Feature] - Platform V4 Markdown Generator V2 (#6094)

* add recent `openapi.json`

* fix data types in models

* removed `openapi.json`

* set default date value as None in PolygonCurrencyPairs class

* add function to generate reference.json file

* reworked function to improve readability

* reword function to add seo metadata

* add functions for creating markdown sections

* add code to extract data card markdown title

* add additional functions for generating index and data models file

* extract first sentence of the description for cards

* code cleanup and documentation

* linting

* linting polygon models

* add openbb import statement in create_reference_markdown_examples function

* add POST method functions

* cleanup; reworked generate_reference_index_files function

* moved development section to 7th position in the sidebar

* fix POST function params default value

add standard flag to QueryParams and Data fields

cleanup

* add type expansion from package_builder.MethodDefinition

* sort data models cards alphabetically

make printing less verbose

* make MAX_CARDS global

display less content in cards in Commannds section

* cleanup

* Remove '_' from the cards under Commands section

* " to ' in econometrics/causality

* replace ' with " in ReferenceCard for reference dir index files

* remove extra . from the quantile function description

* shoutout to @deeleeramone for finding POST method description bug!

* set correct value for standard field

* handle BaseModel types in provider data fields

* unit tests for the platform markdown generator v2

* yeet 'Default' and 'Optional' columns in the 'Data' section

* last minute bug fix

* add info for multiple symbols

* make multiple items info same as platform static

* organize sections properly

* sort reference sub-directories alphabetically

* extra space in 'OBBject extra' description

* add type expansion for fields with multiple items

POST method cleanup

---------

Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>
Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [Docs] Adds Example Notebook for the Implied Earnings Move (#6128)

* adds example notebook for the implied earnings move

* remove commented out line

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>

* [Feature] - Sync with new openapi.json (#6137)

* feat: create data tabs

* fix: uncomment

* fix: remove unecessary comment

* sort side bar

* comment

* uncomment

* use .dev functions.json + clean traverse

* fix futures example

* fix example

* point to .co

* Fix the v3 markdown generation workflow (#6138)

* fix workflow

* debug time

* see if the docs generate at least

* ahhhh i found it

* getting there

* put the test first

* some keys cleanup

* small change to error message

* update functions.json (#6140)

* fix intraday check in charting ta_class (#6119)

Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt>

* [BugFix] Display EconDB as source for macro (#6143)

* [BugFix] Disable Intrinio `InstitutionalOwnership` model (#6142)

* disable fetcher in init and fetcher tests

* disable provider test params from equity python and api tests

* updated static

* add more examples into findSymbols (#6139)

Co-authored-by: James Maslek <jmaslek11@gmail.com>

* [BugFix] Fix SEC ETF Holdings Parsing Exception (#6121)

* fix etf holdings

* linting

* black

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>

* Docs/update xl docs (#6145)

* remove print

* update obb.get docs

* example

* md lint

* fix get reference (#6147)

* [BugFix] Filter OECD data using `start_date` and `end_date` parameters (#6144)

* move constant dicts to constants.py

filter by start_date and end_date

* black

* black again again

* Merge 'main' into 'develop' (#6151)

* Release/3.2.4 (#5696)

* test

* ultima description (#5541)

* Updating showcase page (#5543)

* updating showcase page

* use sdk instead

* add new bot command autopost docs (#5530)

add new bot command autopost docs to docs.openbb.co

Co-authored-by: James Maslek <jmaslek11@gmail.com>

* Hotfix/ultima improvements (#5553)

* tweaks for monetization

* fix linting issue

* fix: Modify 'load' behavior to append data to existing sheet (#5503)

* fix: Modify 'load' behavior to append data to existing sheet

Details:
- Added logic to detect existing sheet and append data if present.
- There is no direct way to append on the sheet, so I am reading the sheet to get the last row number and then writing after that row number.

Resolves: #5472

* Fixed 'worksheet not found' error during export to an existing sheet

* Changes:
* Now if the sheet exists in the xlsx file it will ask the user if he
  wants to replace/append/create new sheet

---------

Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>

* added platform API integration test to Nightly build (#5571)

* Add columns to `stocks/search` (#5565)

* Add columns to `stocks/search`

isin, cusip, figi, composite_figi, shareclass_figi

* Update test_search[False].txt

* Update test_search[True].txt

* Delete tests/openbb_terminal/stocks/cassettes/test_stocks_helper/test_search.yaml

* Create test_search.yaml

---------

Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>

* updating ultima urls (#5587)

* fix: A value is trying to be set on a copy of a slice from a DataFrame #5582 (#5591)

* Update README.md (#5598)

* Hotfix/econometrics export filename fix (#5508)

* fix: Modify 'load' behavior to append data to existing sheet

Details:
- Added logic to detect existing sheet and append data if present.
- There is no direct way to append on the sheet, so I am reading the sheet to get the last row number and then writing after that row number.

Resolves: #5472

* Added --export option for exporting to a desired file in /econometrics menu

* Added a -f/--file option to provide the filename for export.
Made -t/--type and -f/--file mutually exclusive.
If -f is not given, -t is required and the filename will be generated based on the time and module.

* Revert `helper_funcs.py` to original state

* Made some arguments not required.

* Minor changes asked by @deeleeramone

* No sheet name

* black

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>
Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>

* FIX #5600 Updated the Twitter logo to X logo (#5601)

* Change Ultima paragraph (#5624)

* change ultima paragraph

* remove old paragraph

* Update CONTRIBUTING.md (#5623)

* mobile line-brake fixed (#5604)

In the mobile view (media max 400px ), the text line "Installation >>" appears broken into smaller segments.

Co-authored-by: James Maslek <jmaslek11@gmail.com>

* 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>

* Add light blue banner, blue when clicking sidebar + fix link in docusaurus.config.js (#5627)

* typo

* pro docs tab coloring

* sidebar selection blue

* redirecting missing

* fix docs (#5646)

* Fix the redirect for intro to the correct url for docs (#5658)

* fix the redirect for intro to the correct url for docs

* fix code linting

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>

* Improve Pro documentation further (#5641)

* small improvement

* Fix TutorialVideo for mobile view

* main page terminal pro docs

* jose whelp

* placeholder index file that needs to be removed

* fix: fixes sidebar, removes unused index.md

* update link to api keys

* update api keys link

* fix hyperlinks in terminal helper

* fix a few more links

* fix some more links

* linter

* black linter

* improve main docs page for each product

* small refactor

* header to take to main page of product

* run OpenAI script to generate SEO for pro content

---------

Co-authored-by: jose-donato <43375532+jose-donato@users.noreply.github.com>

* Update folders.md

* Update integrate-your-own-backend.md

* Update index.md

* Update settings.md (#5665)

* fix front matter (#5667)

* #5633 adding comma every 1000 (#5652)

* #5633 adding comma every 1000

* pylint

---------

Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>

* Hotfix/reports model render report sanitize inputs (#5669)

* Adding more robust special character handling to create_output_path().Addresses https://github.com/OpenBB-finance/OpenBBTerminal/issues/5299

* Running black linter on code to conform to OBB style guides.

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>
Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>

* hotfix/fix-gov-histcont: Fix #5650 - /stocks/gov/histcont (#5676)

* fix histcont

* some cleanup

* remove sort line

* 12-31 not 12-12

* columns_keep_types

* remove space in regex (#5675)

* Pin openai (#5685)

* Clarified stocks/ta empty recom object message (#5468)

* Clarified stocks/ta empty recom object message

* black

* lint

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>

* improved market cap value extraction (#5169)

* improved market cap value extraction

* pylint

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>

* 3.2.3->3.2.4

* Changelogs

* new changelog

---------

Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt>
Co-authored-by: Andrew <andrew.kenreich@gmail.com>
Co-authored-by: Adi Sai <adithya.sairam1@gmail.com>
Co-authored-by: Sandip Saha <sandipsmoto@gmail.com>
Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>
Co-authored-by: Luqman <luqazino@gmail.com>
Co-authored-by: Adwait <111136306+AdwaitSalankar@users.noreply.github.com>
Co-authored-by: Abhishek Amar <66067391+abhishek-amar@users.noreply.github.com>
Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt>
Co-authored-by: professssor <62937125+professssor@users.noreply.github.com>
Co-authored-by: Farookh Zaheer Siddiqui <129654632+FarukhS52@users.noreply.github.com>
Co-authored-by: MAX SHESTOV <57421753+maxxsh@users.noreply.github.com>
Co-authored-by: jose-donato <zmcdonato@gmail.com>
Co-authored-by: jose-donato <43375532+jose-donato@users.noreply.github.com>
Co-authored-by: Mohamad Fadil <fadil.parves@gmail.com>
Co-authored-by: Ramazan <guvencramazan@outlook.com>
Co-authored-by: joshuabuildsthings <joshuabuildsthings@users.noreply.github.com>
Co-authored-by: wojda <114031148+polooner@users.noreply.github.com>
Co-authored-by: Bim Phomthong <118195204+bimbolimbo@users.noreply.github.com>

* Release/4.0.1 (#5840)

* test

* ultima description (#5541)

* Updating showcase page (#5543)

* updating showcase page

* use sdk instead

* add new bot command autopost docs (#5530)

add new bot command autopost docs to docs.openbb.co

Co-authored-by: James Maslek <jmaslek11@gmail.com>

* Hotfix/ultima improvements (#5553)

* tweaks for monetization

* fix linting issue

* fix: Modify 'load' behavior to append data to existing sheet (#5503)

* fix: Modify 'load' behavior to append data to existing sheet

Details:
- Added logic to detect existing sheet and append data if present.
- There is no direct way to append on the sheet, so I am reading the sheet to get the last row number and then writing after that row number.

Resolves: #5472

* Fixed 'worksheet not found' error during export to an existing sheet

* Changes:
* Now if the sheet exists in the xlsx file it will ask the user if he
  wants to replace/append/create new sheet

---------

Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>

* added platform API integration test to Nightly build (#5571)

* Add columns to `stocks/search` (#5565)

* Add columns to `stocks/search`

isin, cusip, figi, composite_figi, shareclass_figi

* Update test_search[False].txt

* Update test_search[True].txt

* Delete tests/openbb_terminal/stocks/cassettes/test_stocks_helper/test_search.yaml

* Create test_search.yaml

---------

Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>

* updating ultima urls (#5587)

* fix: A value is trying to be set on a copy of a slice from a DataFrame #5582 (#5591)

* Update README.md (#5598)

* Hotfix/econometrics export filename fix (#5508)

* fix: Modify 'load' behavior to append data to existing sheet

Details:
- Added logic to detect existing sheet and append data if present.
- There is no direct way to append on the sheet, so I am reading the sheet to get the last row number and then writing after that row number.

Resolves: #5472

* Added --export option for exporting to a desired file in /econometrics menu

* Added a -f/--file option to provide the filename for export.
Made -t/--type and -f/--file mutually exclusive.
If -f is not given, -t is required and the filename will be generated based on the time and module.

* Revert `helper_funcs.py` to original state

* Made some arguments not required.

* Minor changes asked by @deeleeramone

* No sheet name

* black

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>
Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>

* FIX #5600 Updated the Twitter logo to X logo (#5601)

* Change Ultima paragraph (#5624)

* change ultima paragraph

* remove old paragraph

* Update CONTRIBUTING.md (#5623)

* mobile line-brake fixed (#5604)

In the mobile view (media max 400px ), the text line "Installation >>" appears broken into smaller segments.

Co-authored-by: James Maslek <jmaslek11@gmail.com>

* 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>

* Add light blue banner, blue when clicking sidebar + fix link in docusaurus.config.js (#5627)

* typo

* pro docs tab coloring

* sidebar selection blue

* redirecting missing

* fix docs (#5646)

* Fix the redirect for intro to the correct url for docs (#5658)

* fix the redirect for intro to the correct url for docs

* fix code linting

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>

* Improve Pro documentation further (#5641)

* small improvement

* Fix TutorialVideo for mobile view

* main page terminal pro docs

* jose whelp

* placeholder index file that needs to be removed

* fix: fixes sidebar, removes unused index.md

* update link to api keys

* update api keys link

* fix hyperlinks in terminal helper

* fix a few more links

* fix some more links

* linter

* black linter

* improve main docs page for each product

* small refactor

* header to take to main page of product

* run OpenAI script to generate SEO for pro content

---------

Co-authored-by: jose-donato <43375532+jose-donato@users.noreply.github.com>

* Update folders.md

* Update integrate-your-own-backend.md

* Update index.md

* Update settings.md (#5665)

* fix front matter (#5667)

* #5633 adding comma every 1000 (#5652)

* #5633 adding comma every 1000

* pylint

---------

Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>

* Hotfix/reports model render report sanitize inputs (#5669)

* Adding more robust special character handling to create_output_path().Addresses https://github.com/OpenBB-finance/OpenBBTerminal/issues/5299

* Running black linter on code to conform to OBB style guides.

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>
Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>

* hotfix/fix-gov-histcont: Fix #5650 - /stocks/gov/histcont (#5676)

* fix histcont

* some cleanup

* remove sort line

* 12-31 not 12-12

* columns_keep_types

* remove space in regex (#5675)

* Pin openai (#5685)

* Clarified stocks/ta empty recom object message (#5468)

* Clarified stocks/ta empty recom object message

* black

* lint

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>

* improved market cap value extraction (#5169)

* improved market cap value extraction

* pylint

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>

* Release/3.2.4 (#5704)

* 3.2.3->3.2.4

* Changelogs

* new changelog

* OpenBB Platform v4 (#5225)

* change location

* check something

* add cache

* fixed auth w/@IgorWounds and @montezdesousa

* fixes for econometrics

* include Darren auth suggestions

* some routers included if dev + chg hub backend var

* coverage router should not be here

* update docker readme

* forgot to check auth here

* Change extension imports

* update docstrings and readme

* headers function wasnt being called, just referenced

* relative import

* econometrics add headers everywhere

* Fix QA

* Fix TA

* Fix test

* Fix python interface QA and TA

* Lint

* Cleanup

* Change path

* make the changes and some etf models

* tests for command_runner

* ruff

* solving naming issues on pytest

* Update some docstrings, fix typos and lint

* solving econometrics instantiating wrong openbb

* chaging the way pytest runs

* messing around with the imports

* ruff

* Change template to add platform considerations (#5533)

* change template to add platform considerations

* @the-praxs suggestions

* solving __pycache__ issue

* removing typo

* ci yml

* making linters happy (i guess)

* Improve Omega Ratio and docstrings

* chaging pro validation hash

* ruff

* Fix OLS Summary and lint

* Add OECD Provider for economy extension (#5534)

* Add record to docs

* update a couple of cboe models

* Fix econometrics bugs. Make tests pass. Lint.

* black

* ruff

* pydantic v2: remove deprecated Extra

* pydantic v2: self.dict -> self.model_dump

* revert pydantic

* revert the revert

* try 1: pin urllib3 < 2

* Revert "try 1: pin urllib3 < 2"

This reverts commit 3736c311cb.

* Revert dep

* Fix

* re-lock

* Skip all tests when doing cspell in pre-commit

* Resolve linter errors

* Add OECD to install script

* Add OECD

* Resolve more linter errors

* Exclude static files of v4 python from ruff

* More linting

* Another attempt to resolve even more linting errors

* Change how Literal is used

* ticker. symbol. consistent. @piiq

* change ticker field in Stock Search to is_symbol

* Update Cboe model for stocks_search -> is_symbol parameter.

* Fix issue

* Lint

* Small QA to rename SDK to Platform (#5544)

* SDK -> Platform in docs

* renamed in core

* renamed in openbb `init`

* `sdk` variable renamed as `platform`

---------

Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>

* `validator` -> `field_validator` in standard models

* Standard convention for multi-ticker symbols  (#5549)

* standardize symbol input param in forex and crypto historical data

* static

* linting

* Fix stock_search integration test params

* Update dependencies and linting on the CI (#5550)

* Remove ruff and black from platform dependencies

* Update codespell configuration

* Lint python code

* Add toml and tomli to root dev dependencies

* Update requirements.txt files

* Fix buggy docstring in python package methods (#5548)

* fix buggy docstring for methods

* remove space

* fix typing

* avoid name collision with validator

* Revert "avoid name collision with validator"

This reverts commit 8a30a44555.

* typing

* rebuild

* python 3.8, ParamSpec not available

* lint

* ruff noqa

* Merge with develop (#5551)

* Charting extension integration tests (#5547)

* initial proposal for integration tests on the charting extension

* int tests for charting generation

* python generator

* ruff

* boilerplate templates

* python tests

* tests for the api

* using body instead so data don't get redefined

* unit tests for coverage

* ruff

* docstrings

* unnecessary access to keys()

* Add trading economics economic calendar

* dev install

* Data Models disposition on the website (#5538)

* pydantic v4

* flat structure

* md files

* Revert "md files"

This reverts commit bd2170e2ad.

* improve command descriptions

* nice title and description

* human readble data model names on left panel

* implementation details section

* content markdown files

* markdown versioned files

* showcase page

* updates

---------

Co-authored-by: tehcoderer <me@tehcoderer.com>

* everything except tests

* fix `datetime.date` import in fetcher test

* modified url to remove `api_key` placeholder

* record test

* api key is called c here

* fixed fetcher test for api key

* recorded tests

* refactor

* life is ruff

* codespell

* Make Intrinio options chains great again (#5540)

* add multithreading

* cleanup

* linting

* use dateutil.parser

* removed `TICKER_EXCEPTIONS`

* modified `date` and `type` fields in standard model

* set alias for `date` and `type` to match standards

* static

* static

* Hotfix/fix post tests (#5555)

* Fix econometrics

* Fix ta

* Fix qa. Remove intrinio to not be rate limited

* Lint

* Fix typo

* obbject tests (#5558)

* obbject tests

* ruff

* fix dev_install

* fix unittests

* black on nox

* black on nox

* nox

* fix fetcher test so it can compare dates

* fix intrinio tests

* ruff

* change to model_dum() instead (#5561)

* Passing tests (#5560)

* Passing tests

* fix options

* Fix most tests and bugs

* fix forex missing params

* make symbol upper in polygon fx pairs

* fix fixedincome integration tests (#5564)

* Fixing charting api integration tests (#5562)

* fixing charting api integration tests

* black

* fix stocks less five API fails

* fix the 5 failing stocks integration tests

* recapture fmp stock news unit test

* fix fmp forex api test

* couple more forex integration fixes

* changing the request to always use the legacy session. @jmaslek this is was broken for 3.8 and 3.9; with this change apparently all versions work - lemme know if you see any issue with this change

* ruff

* fix ta

* add missing param

* fix testers for the api

* fix globalnews to use images instead of image

* remove unncessary pandas import

* econcal int tests

* update gitignore

* fix get_querystring to support lists

* add missing parameters

---------

Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>
Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt>

* Stock Historical standardization and UX improvements (#5457)

* polygon add interval standard param

* attempt at standardization

* Alpha Vantage params standardization

* rename `get_intervals` and fixed bug for extracting wrong value

* missed changing it in `extract_data`

* linting

* polygon cleanup

* modified `start_date` & `end_date` type to `datetime` from `dateType`

* standardized intrinio stock historical params

* fixed yfinance

* linting

* revert start and end date to dateType from datetime

* fix alpha vantage

* changed param

* fix intrinio infinite loop

* `validator` is `field_validator`

* revert time params and fixed intervals

* `outputsize` alias set in `Field`

* set interval description using in-build dict

* yfinance stock param standardization

* static

* intrinio cleanup

* Polygon add api params as `PrivateAttr`

* modified yfinance params to `PrivateAttr`

* intrinio remove overriding date params

* fixed description for AV adjusted param

* fix alpha vantage intraday not working

* re-record and pass unit tests

* pass integration tests

* Update test

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* Fix econcal endpoint (#5567)

* fix econcal for python interface

* fix econcal tests

* fix non supported json output

* Fixes FMP index endpoint to get 1 day interval data (#5535)

* fix FMP endpoint for getting index data for `1day` interval

* fix `open` type to prevent validation error

* modifed `validator` to `field_validator`

* type of fields is `StrictFloat`

* re-record and pass test

* linting

* `validator` -> `field_validator`, a3'd everything

* Fix regression in tests. Lint

* updating the integration test actions

* Fix typo

* Fix typo

* Fix import

* Publish versions `a3` to Pypi (#5568)

* bump versions and script to publish

* small improvements

* uncomment exception

* openbb

* publishing guidelines

* improve docs

* add providers to economy api

* make symbol required in stock_quote

* Fix keys

* Fix oecd

* add comma

* revert

* Add quotes

* Sleep

* Improve tests

* Improve

* Feature/query transform (#5566)

* inject query into transform_data

* swap query and data

* update missing fetchers

* last test failing

* sig test fetcher

* black

* av add `query` to `transform_data` call

* transform_data: missing refactoring

* fix uvicorn command in the doc

* Automated examples (#5576)

* Automated examples

* Fix bug

* Lint

* static assets built on 3.8

* Revert "static assets built on 3.8"

This reverts commit fb82ff7bd9.

* remove assets

* static assets on 3.8

* static assets on 3.8

* Wrap in quotes

* Improve wrap

* minor fix

* rebuild 3.8

* Fix bug

* Fix edge case

* Lint

* rebuild

---------

Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>
Co-authored-by: Diogo Sousa <montezdesousa@gmail.com>

* use SecretStr for sensitive fields (#5578)

* use SecretStr for sensitive fields

* fix

* docstring

* Add tests for provider (#5583)

* Add tests for provider

* Test standard models

* Lint

* Fix standard model issues.

Co-authored-by: @the-praxs

* linting

* `symbol` -> `is_symbol` in `economy.index_search`

* static

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* feature/v4-biztoc-provider: Adds Biztoc provider and GlobalNews (#5546)

* add biztoc provider

* duplicate field

* black

* request headers

* recapture test

* move stuff around

* add integration tests

* duplicate OECD entry in dev_install

* duplicate entry for oecd in pyproject.toml

* Add Biztoc to workflow

* update readme: credentials

* Add Preferences to README

* improve tests

* fix biztoc

* obbject pylint

* Bug fix: serializ SecretStr before dumping to json

* export credentials as json (#5592)

* Check for wrong, changed, or outdated params. (#5597)

* Improving `economy.cpi` for the FRED data (#5602)

* remove multiindex using coding magic

* Update field descriptions

---------

Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>

* Improve error message.

* Improve

* Test tests (#5607)

* Test tests

* Add test

* 4.0.0a4 PyPI publishing (#5608)

* changes to publish

* fix mini conflict

* typo

* cleaned `descriptions.py`

* fix description in `cpi.py`

* Add ETF extension to v4 (#5609)

* Add etf extension with search data model

* Add FMP ETF search

* Add fetcher tests

* Add ETF historical price from yfinance (#5610)

* Add etf extension with search data model

* Add FMP ETF search

* Add fetcher tests

* Add etf historical price standard model and route

* Add etf historical data from yfinance

* Add unit tests

* Fix linter error. Organize imports

* Update test data

* Revert common descriptions erased by CPI PR

* remove `symbol` from data for `stocks.ca.peers`

* Test docstrings (#5613)

* Test docstrings

* fix minor bugs w/@IgorWounds

* static only w/@IgorWounds

* fix `importance` param in `economy.econcal`

* right static only w/@IgorWounds

* Fix econcal and add tests to noxfile

* fix econcal static

* re-record

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* Clean up the newly created ETF extension (#5611)

* Add ETF to dev_install bundle

* Add integration tests for openbb-etf

* Patch integration test generator scripts to produce lintable code

* Add py.typed markers for extensions

* user preferences descriptions (#5593)

* user preferences descriptions

* typo

* Feature/v4-sec-provider: Add SEC provider to V4 (#5556)

* coerce string type, add default=None

* add sec provider and FTD function

* update description

* ruff

* data model definitions in standard model already

* duplicate oecd entries in dev_install and pyproject

* actually commit

* integration test

* add stock search to SEC

* add company filings for SEC provider

* integration tests

* remove duplicated line

* ruff

* **kwargs in Transform Data

* some helper functions for later

* black

* add helper for mutual fund and etf lookup

* add some SEC lookup helpers to a new regulators extension

* black

* ruff

* fix test param

* take institution filter out of sec stock_search

* ruff

* remove URL that codespell doesn't like

* add cik-to-ticker map

* add litigations rss feed

* make openbb-regulators a dependency of openbb-sec

* add SIC search

* improve ftd and remove BeautifulSoup from SEC dependencies

* fix parsing the zip files pre-2009

* ruff

* update descriptions

* recapture ftd test

* tests params

* typo

* change limit param to 1 in test_sec_stock_ftd

* Add didiers to_records method (#5588)

* Add didiers to_records

* unused import

* Bring back polars + do what igor suggested

* Make the output consistent with what it was.

* Black ?

* spelling.  oops.  almost like we have a pre commit or something

* Feature/v4-price-performance: % returns for various horizons, comparable across multiple tickers. (#5618)

* coerce string type, add default=None

* add price_performance endpoint from FMP

* black

* extra period in docstring

* ruff

* forgot one file

* Feature/ipo-calendar: V4 IPO Calendar (#5605)

* coerce string type, add default=None

* add intrinio ipo calendar

* fix typo

* sort __init__

* fix description

* make requested changes

* update test params

* black

* test updates

* etf integration

* Add disc router and WSJ provider

* OBBject extensions (#5612)

* changes to core

* bug?

* docstring

* doc

* Update credentials.py

* fix model_dump

* create extensions

* fix docstring

* doc

* revert change query_exc

* doc

* fix container test

* redirect obbject test patch

* doc

* rename method

* move decorator to extension file

* rename method extend_obbject

* changes in creds model

* avoid credential racing

* doc

* rename prop

* doc

* doc

* remove comment

* comment some code

* free extension names

* docstring

* doc

* docs

* Hotfix/fix-v4-economic-calendar: Add FMP to Econ Calendar and fix some TE bugs (#5580)

* coerce string type, add default=None

* adds fmp to economic calendar and fixes some things with TE

* ruff

* etf integration test

* missing provider for test

* rename te cassette to economic_calendar

* fix test

* rename tests

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>

* Add stocks disc endpoints (#5630)

* Add stocks disc endpoints

* Explicit

* Lint

* Add tests

* Bump timeout

* Feature/disc router (#5616)

* Add disc router and WSJ provider

* Lint

* Lint

* Move endpoints under ETF router

* Update etf_performance.py

* Add ETF info and sector exposure from FMP (#5620)

* Add ETF info from FMP

* Add integration tests

* Add unit tests

* Add etf sectors endpoint

* Add etf sectors fmp endpoint

* Omit nested sector list from fmp info data

* Update tests and test data

* Update test data

* Specify provider explicitly in integration tests

* Update tests

* Skip yfinance etf historical test

* Fix linter errors after the merge

* Fix more linter errors

* Fix failing and add missing tests

* Fix integration tests

* Fix calendar ipo tests

* Add ETF holdings and holding report dates from FMP (#5629)

* Add ETF info from FMP

* Add integration tests

* Add unit tests

* Add etf sectors endpoint

* Add etf sectors fmp endpoint

* Omit nested sector list from fmp info data

* Update tests and test data

* Update test data

* Specify provider explicitly in integration tests

* Update tests

* Skip yfinance etf historical test

* Add etf holdings and holdings date routes and standard models

* Add fmp holdings and holding dates fetchers

* Update holdings fetcher to properly handle date object inputs

* Add unit tests

* Add integration tests

* Black after merge

* Fix test input data format

* Disc router for equities. (#5640)

* Disc router for equities.

* add tests

* Bug fixes in financial statements (#5537)

* `validator` to `field_validator` in standard models

* Polygon add `ttm` to `period` param

* Revert "Polygon add `ttm` to `period` param"

* Polygon add `ttm` to param `period`

* `EarningsCallTranscript` standard model removed `quarter` param

* use `tag` instead of `name` for correct field name

* fix url for intrinio income statement

* modified intrinio cash flow `transform_data` function

* set optional data fields and validate dates

* fix insider trading not fetching recent data

* linting

* refactoring

* refactoring

* set param alias in fmp stock insider provider model

* get all quarter data for intrinio

* add `limit` param to `stocks.fa.ins`

* refactoring and linting

* removed additional comment

* linting

* re-recorded and fix tests

* cash flow standard model field type to `StrictFloat`

* Intrinio cash flow model fixed to get all quarters' data

* linting

* refactoring

* financial statement standard model field type to `StrictFloat`

* Intrinio financial statement model get all quarter data

* set `period` type to `Optional[str]`

* add `period` param to balance sheet provider models

* add `period` param to cash flow provider models

* use alias in model dump

* remove `ttm` from `period` param

* revamped intrinio financials

* fixed incorrect description for `limit` param

* modified tests for `balance`, `cash` and `income`

* re-recorded tests

* skipped intrinio financial statement fetcher tests

* Add ETF county weighting command with FMP data (#5645)

* Remove code that wrongfully infers the filing date as end of quarter

* Add etf countries command with fmp data

* Add countries command to etf router

* Update sector and country weighting fmp models

* Fix docstring typo

* Add unit tests and update mock data

* Add integration tests for etf.countries

* Bring back missing integration tests

* Fix economic calendar integration tests

* fix missing data in intrinio financials

* removed inutile params from Polygon financial statement models

* Intrinio IPO overhaul

* tests fixed and re-recorded

* Add ETF holdings performance with FMP data (#5659)

* Add etf holdings performance endpoint

* Add tests

* Fix failing polygon fetcher tests

* Split long holdings lists into chunks and update test data

* Change chunk length to 500 tickers

* Add stock search from FMP (#5642)

Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>

* Feature/v4 pypi (#5579)

* improvements to the publish script

* move scripts

* initial script that builds the package

* adjustments on the docs

* test pypi workflow

* add hour and minute to version

* black

* ruff

* duplicate file

* moving files instead

* build throught the script instead

* update nox file

* integration tests workflow

* change workflow

* fix dev_install

* fix in sed cmd

* testing the platform only

* commenting out the publishing

* fix run commands

* improvements to the publish script and doc

* fix publish script

* updating the script and the workflow

* feature/v4-pypi nightly (#5589)

* init

* Update nightly.py

* cleanup

* init file

* not referencing dev_utils

* updating obb platform key

* revert

* Increase warmup time

* project name on pyproject and adding the --pre flag on readme

* moving to the build folder

* fix noxfile

* reflecting the moves on the import statements

* fix pyproject path

* ruff

* fix paths

* fix super typo

* update workflows

* moving the pypi terminal files into its folder

---------

Co-authored-by: teh_coderer <me@tehcoderer.com>
Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>

* economy.calendar nasdaq (#5628)

* add quandl econcal

* unittest

* add integration tests

* replace &nbsp

* fix bug TE importance

* small fix

* remove stuff from quandl

* add nasdaq provider

* add nasdaq to install files

* Update test_economy_api.py

* test

* quandl leftovers

* remove quandl econcal test

* lint

* replace &nbsp

* ruff

* lint

* update nasdaq gmt

* validate countries

* here

* no need for this

* fix calendar tests

* static

* static

* remove error

* static

* readme + website

* readme

* remove changes TE

* typo

* fix unittest

* fix tests

* Update __init__.py

* Update economic_calendar.py

* revamped model and added helpers for date range

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* Feature/v4-dividend-calendar: Adds Nasdaq dividend calendar and moves the command out of fundamental_analysis (#5672)

* add nasdaq dividend calendar and move out of fundamental_analysis

* black

* ruff

* add random-user-agent to pyproject.toml

* add nasdaq ipo calendar

* add nasdaq flag for SPO to IPO calendar

* add spo test param

* black

* dividend test

* fix transform_query - nasdaq_calendar_ipo

* bring back different headers for ipo calendar

* remove references to test

* Add disc endpoints (#5660)

* Add Quandl top retail

* Add tests

* Add Seeking Alpha

* Add Filings

* Change Provider

* Fix test

* Add dev_install

* static

* static correct

* y u forget me

* updated deps

* static

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* using dev install (#5673)

* Expanding the `fixedincome` menu (#5655)

* models and fetcher

* making the fetcher visible

* std model

* adding the command

* improvements to the models

* typo

* adding the command

* imrpovements to dwpcr

* standard model for ecb int rates

* adding the fetcher for fred

* standard model of ice bofa

* add ice_bofa command

* ruff

* ice bofa fetcher

* moody std model

* moody

* std model

* add cp command

* unused import

* cp

* spot

* ruff

* hqm

* tmc

* ffrmc

* tbffr

* ruff

* typing fixes

* buggy dates

* fred fetcher tests

* ruff

* adding ecb as a provider

* adding new provider related stuff

* adding the new command eu_ycvr

* models

* test for ecb fetcher

* Feature/v4 fixedincome int tests (#5661)

* integration tests

* happy ruff

* mini adjustment

* ruff

* typo

* verbose type

* fix tests

* docstrings everywhere and an happy pydocstyle

* fix tests

* Feature/user-cache-dir: Add User Preference for the Cache Directory (#5621)

* add user preference for storing cached data

* ruff

* fix tests?

* fix test key error..?

* etf integration test fix

* add cache dir to SEC

* black

* improve docs structure for V4 (#5586)

* improve docs structure for V4

* moving over changes

* Add Docs to the navbar

* add some, re-order sidebar

* fix sentence

* add docs install to source instructions

* insert a couple of links, fix a typo

* big terminal docs usage revamps

* improve toggle component for tutorials

* get rid of TOCs for all terminal docs for consistency and simplicity

* improve platform docs

* improve bot docs content structure

* remove index from bot docs

* improve ON THIS PAGE to only display TOC if at least 1 element

* make edit this page text and icon on same line

* add author and date to docs

* add basic syntax page to usage

* sidebar order for usage section

* move api start command to the top with the import python import

* some install page additions

* small improvement

* refactor routines section

* Update introduction-to-routines.md

* Update pipeline-of-commands.md

* Update introduction-to-routines.md

* Update routines-for-power-users.md

* Update community-routines.md

* update keyboard hotkey macros

* askobb page

* Update askobb-feature.md

* Update index.md

* Update index.md

* Update index.md

* Update index.md

* fix images

* remove HeadTitle from all files where it exist

* get rid of extra spacing in markdown

* small update

* small edit

* need index at the start because of main path when homepage of docs

* use openAI to create SEO for front matter on my behalf

* remove table of content from sdk page

* finish improving metadata SEO for SDK docs

* update duplicate header

* update HeadTitle to be more specific on product

* remove index from bot telegram reference

* delete duplicated title for platform reference

* another update

* Hotfix/econometrics export filename fix (#5508)

* fix: Modify 'load' behavior to append data to existing sheet

Details:
- Added logic to detect existing sheet and append data if present.
- There is no direct way to append on the sheet, so I am reading the sheet to get the last row number and then writing after that row number.

Resolves: #5472

* Added --export option for exporting to a desired file in /econometrics menu

* Added a -f/--file option to provide the filename for export.
Made -t/--type and -f/--file mutually exclusive.
If -f is not given, -t is required and the filename will be generated based on the time and module.

* Revert `helper_funcs.py` to original state

* Made some arguments not required.

* Minor changes asked by @deeleeramone

* No sheet name

* black

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>
Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>

* FIX #5600 Updated the Twitter logo to X logo (#5601)

* Change Ultima paragraph (#5624)

* change ultima paragraph

* remove old paragraph

* Update CONTRIBUTING.md (#5623)

* mobile line-brake fixed (#5604)

In the mobile view (media max 400px ), the text line "Installation >>" appears broken into smaller segments.

Co-authored-by: James Maslek <jmaslek11@gmail.com>

* start PR so screenshots can get attached via GitHub website

* Update qa.md

* 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>

* Add light blue banner, blue when clicking sidebar + fix link in docusaurus.config.js (#5627)

* typo

* pro docs tab coloring

* sidebar selection blue

* redirecting missing

* Update crypto introduction.md

* titles

* another title

* Update crypto dd.md

* Update defi.md

* Update disc.md

* Update nft.md

* Update onchain.md

* Update ov.md

* Update introduction.md

updates URL

* Update introduction.md

add HeadTitle

* Update ba.md

* Update comparison.md

* Update dark-pool-shorts.md

* Update disc.md

* fix docs (#5646)

* Update fa.md

* Update gov.md

* Update ins.md

* Update tradinghours.md

* Delete website/content/terminal/menus/stocks/options/screener.md

* Update Options introduction.md

* Update screener head title

* Update screener TOC

* Update econometrics.md

* Update economy head title

* Update etf.md

* codespell

* Fix the redirect for intro to the correct url for docs (#5658)

* fix the redirect for intro to the correct url for docs

* fix code linting

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>

* Contributing guidelines (#5615)

* intro section

* what's expected sections

* improve sections

* improve sections and move how to add a data point

* moving qa under contributor

* better intro

* moving the sharing section

* better expectations

* small intro to the contributor guidelines

* moving things under the contributor section

* there is no pre commits on the platform yet

* dependency management

* best practices for extensions

* typo

* collapse options subfolder

* codespell

* Improve Pro documentation further (#5641)

* small improvement

* Fix TutorialVideo for mobile view

* main page terminal pro docs

* jose whelp

* placeholder index file that needs to be removed

* fix: fixes sidebar, removes unused index.md

* update link to api keys

* update api keys link

* fix hyperlinks in terminal helper

* fix a few more links

* fix some more links

* linter

* black linter

* improve main docs page for each product

* small refactor

* header to take to main page of product

* run OpenAI script to generate SEO for pro content

---------

Co-authored-by: jose-donato <43375532+jose-donato@users.noreply.github.com>

* Update folders.md

* Update integrate-your-own-backend.md

* Update index.md

* Update fixedincome.md

* url

* Update forecast.md

* Update settings.md (#5665)

* Update forex.md

* fix front matter (#5667)

* Fix conflict markers that got into markdown during previous merges

* Fix front matter list formatting

* Fix typo

* small thing

* fix hyperlinks

* Update .codespell.ignore

* output_type options

* Architectural considerations

* Update sidebar to hide pro section by default

* Minor copy changes

* TET pattern

* import statements

* clarification on preferences

* Minor copy changes

* Lint markdown and python

* fix: open index on collapsible root elements

* remove old content

* options title

* Fix linting errors

* Refactor sidebar label to url mapping condition

---------

Co-authored-by: andrewkenreich <andrew.kenreich@gmail.com>
Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>
Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>
Co-authored-by: Sandip Saha <sandipsmoto@gmail.com>
Co-authored-by: James Maslek <jmaslek11@gmail.com>
Co-authored-by: professssor <62937125+professssor@users.noreply.github.com>
Co-authored-by: Farookh Zaheer Siddiqui <129654632+FarukhS52@users.noreply.github.com>
Co-authored-by: MAX SHESTOV <57421753+maxxsh@users.noreply.github.com>
Co-authored-by: jose-donato <zmcdonato@gmail.com>
Co-authored-by: jose-donato <43375532+jose-donato@users.noreply.github.com>
Co-authored-by: Mohamad Fadil <fadil.parves@gmail.com>
Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>

* Add multi-ticker support to etf_countries (#5670)

* add multi-ticker support to etf_countries

* remove commented-out lines

* normalized percent points

* percent -> percentage

* Fix Nasdaq Econ Calendar Fetcher (#5668)

* fix nasdaq econ cal request

* more html tags

* add random-user-agent to pyproject

* another edge case - 24H -> 00:00

* Feature/v4-unusual-options: Adds unusual options endpoint. (#5677)

* add unusual options fro Intrinio

* test params

* move sorting

* Change type

* update FMP fetcher to use the V4 endpoint (#5681)

* Fix price performance not parsed correctly when there is only 1 ticker (#5678)

* Add crypto search standard model and FMP data for it (#5679)

* Apply renaming to news data (#5684)

* inegration complete

* reformatted for black

* fix ruff issues

* revised integration

* changes to versions in pyproject.toml and updated lock files

* Rename models

* Update tests

* Fix typos here and there

* Update routers

* Apply rename to ultima

* Properly mock api key

* Mock ultima api key

---------

Co-authored-by: Adi Sai <adithya.sairam1@gmail.com>

* Feature/v4-market-snapshots: Adds full market snapshots (#5473)

* add stocks market snapshots from fmp

* add fmp fetcher test

* unused imports

* add polygon to market_snapshots

* update fmp market_snapshots

* black

* pydantic2 things

* updates

* change validate_obj to model_validate

* polygon cleanup

* tests

* descriptions

* black

* data description

* minor adjustments, using less local variables, improving readability and removing pandas

* better structure

* minor adjustments

* lint

* fix int tests

---------

Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>

* Add NBBO Quotes, with historical, to `obb.stocks.quote()` (#5617)

* coerce string type, add default=None

* add polygon stock quote

* limit cleanup

* add greater/less than to params

* limit param

* black

* tests

* fix tests

* test_etf

* rename model and function to NBBO

* add standard model for nbbo

* improve standardization

* not redifining builtin max

* fix input params

* integration test params

* removing unused import

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* revamped code

* re-recorded nbbo test

* added symbol validator

* added alias in field

* Stock news -> Company news

---------

Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>
Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>
Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>

* hotfix/update-quandl-to-nasdaq: Merge Quandl + Nasdaq (#5682)

* merge quandl nd nasdaq

* dev_install.py

* test param name

* economy python integration test

* Add more input types to data processing commands (#5453)

* adding more supported types to data processing commands

* ruff

* removing unused import

* docstrings

* data processing types covertion

* data description

* test filters

* ruff

* fix package builder tests

* ruff

* removing print

* Add stocks/dps module (#5638)

* short volume

* pyproject missed

* add sec short interest with days to cover

* Add FINRA OTC endopoint

* some tests

* rest of unit tests

* Integratin test scripts

* dev install

* linters caught by pre commit

* lines too long

* Last test files

* maybe it needs a lock file?

* thanks pratty

* Maybe ill actually listen to pratty next time

* sec test date freeze

* I cant hit buttons

* re record tests

* tests 3

* Stockgrid test

* regen int test

* more testing

* lint

* moved these fns

* dis killing me

* one more test

* last one

* Update integration tests

* Fix tests picking up wrong dps route

---------

Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>

* Rename Forex to Currency (#5687)

* restore fields as optional (#5686)

* Rename Crypto (#5689)

* added `crypto.price.historical`

* static

* fix tests

* fix incorrect label

* Move model from sec to finra (#5692)

* Update toml

* fixed deps

* add openbb-etf lock file

* cleanup

* cleanup (#5694)

* Rename Fixed Income (#5695)

* Rename Fixed Income

* Add routers

* Rename stocks to equity (#5688)

* Rename stocks folder

* Rename openbb_stocks package

* Rename routers

* Reroute equity menu

* Update routes based on feedback

* StockNews -> EquityNews

* StockInfo -> EquityProfile

* Rename Equity calendars

* Equity peers rename

* Rename discovery

* Rename fundamental

* Rename price command models

* Rename shorts

* Update charting router

* Fix seeking alpha upcoming release date

* Fix linting errors

* Update tests

* Fix tests

* Skip econometrics api tests because it's python only

* Update integration tests and test data

* Historical analyst estimates

* Skip cboe options chain test. Unable to record vcr cassette

* re-record cboe cassettes

* Document CBOE unit test creation caveats

---------

Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>

* Feature/files-for-igor: Adding a few standard models for Igor (#5699)

* add some standard models for Igor

* codespell

* update descriptions

* Add devtools metapackage (#5703)

* Add openbb-devtools metapackage

* adding devtools to the dev_install script

---------

Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>

* Rename econometrics commands to be more verbose (#5702)

* Expose command to model map (#5706)

* Rename ta qa (#5708)

* Rename ta folder

* Rename ta to technical

* Rename qa folder

* Rename qa to quantitative

* Rename the actual routes in quantitative

* Equity cleanup (#5707)

* cleanup

* static

* renaming to equity cc @the-praxs

* Proof reading

---------

Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>
Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>

* Don't enforce imperative for first word of the docstring

* Remove ultima from default extensions

* Rename `economy` and create `index` extension (#5705)

* renamed economy and re-recorded tests

* static

* market indices

* european indices

* fred indices

* index constituents

* tests

* correct package name

* oops

* static

* linting

* Move COT commands to regulators

* Rename economy.list to available_indices

* Rename GDP models and clean up

* Fix charting tests

* Drop _indices from available_indices command

* Fix obbject to_dict test

---------

Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>

* Rename etf/disc (#5715)

* Docs/v4-working-docs: PR to Work on V4 Docs (#5693)

* Revert changes related to pydantic2 made into v3 code

* Revert fred model changes in v3

* Revert pydantic2 databento model changes in v2

* Update some names and v3 lock file

* Clean up openbb/package before the beta release

* Platform publishing procedure (#5701)

* update instructions

* introducing the version script

* publish message

* fix platform path

* reflecting version changes

* getting version from installed packages instead

* removing toml from dependencies

* Changes to get `a7` out (#5697)

* changes to get a7 out

* etf menu on the pyproject.toml

* poetry lock

* bump `openbb-etf` to `a5` to match version

* updated deps

* removing ultima

* removing references to a4 cc @the-praxs

* Bump index menu version

* poetry lock

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>
Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>

* Update publishing instructions

* Bump core dependencies in extensions and providers

* Add changes to the publish script following the beta release

* Update the versions in static extension map and openbb metapackage

---------

Co-authored-by: James Maslek <jmaslek11@gmail.com>
Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>
Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>
Co-authored-by: Diogo Sousa <montezdesousa@gmail.com>
Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>
Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>
Co-authored-by: tehcoderer <me@tehcoderer.com>
Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt>
Co-authored-by: andrewkenreich <andrew.kenreich@gmail.com>
Co-authored-by: Sandip Saha <sandipsmoto@gmail.com>
Co-authored-by: professssor <62937125+professssor@users.noreply.github.com>
Co-authored-by: Farookh Zaheer Siddiqui <129654632+FarukhS52@users.noreply.github.com>
Co-authored-by: MAX SHESTOV <57421753+maxxsh@users.noreply.github.com>
Co-authored-by: jose-donato <zmcdonato@gmail.com>
Co-authored-by: jose-donato <43375532+jose-donato@users.noreply.github.com>
Co-authored-by: Mohamad Fadil <fadil.parves@gmail.com>
Co-authored-by: Adi Sai <adithya.sairam1@gmail.com>

* Hotfix/pypi openbb terminal (#5719)

* renaming the project

* documentation changes

* Finishing touches to the publishing procedure (#5728)

* finishing touches to the publishing procedure

* grammar improvements

* Run tests on develop (#5725)

* Run tests on develop

* Add a check that files changes in platform

* Seprate Intrinio financials data tags into a different command (#5723)

* add `ebit` field in income statement standard model

* only add required data tags

* remove calculations data

* use `name` key instead of `tag` key

* set `period` as required in data

* remove `period` and `cik` from provider models

* add `equity/fundamental/search_financial_attributes` with tests

* clean descriptions file

* add `equity/fundamental/financial_attributes` with tests

* set `value` as `Optional`

* Fix threadpool test error (#5734)

* Remove ultima from deps (#5736)

* remove ultima from deps

* skip ultima test

* black

* change skip location

* try except statement to avoid error on the ci

* new currency reference rates pr (#5724)

* point files to linters (#5739)

* remove news from equity (#5741)

* Add tiingo provider (#5740)

* first commit

* things

* Add news endpoints

* CryptoHistorical

* Add currency and trailing dividend yield

* things working

* deps

* fix pre commit things

* tests?

* black on the tests

* pratty told me to add it

* integration tests

* added helpers

* crypto revamped

* currency revamped

* trailing dividend yield revamped

* equity historical revamped

* company news overhauled

* global news overhauled

* remove `tags` param from news models

* crypto correct `exchanges` description

* james smh

* re-recorded fetcher tests

* fixed integration tests

* econometrics smh

* james smh again

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* Add `derivatives` extension for `futures` and `options` (#5742)

* removed options and futures

* add derivatives extension

* cleanup

* bug #5649 (#5722)

* bug #5649

* fixing --a upmom, downmom

---------

Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>

* Rename the fmp search -> screener (#5744)

* Rename the fmp search -> screener

* misses some

* i cant copy paste

* docs/fix-urls: Updates the Terminal About URLs to match `/develop` (#5720)

* update Terminal about URLs and some other broken links

* ruff

* intro

* changing the heading levels

* dependency management sections

* structure

* developer guides

* structure

* contributor guides

* keywords and descriptions

* broken urls

* cool cards

* Cool cards (#5727)

* tidy up terminal/content

* some more tidy up

* fix styling for platform that was missing

* more tidy up

* improve color for dark and light mode

* create new reference card for more basic cards

* rename back to menus

* implement all index.md for terminal, except reference

* improve bot title

* more refactoring

* fix remaining index

* header styling

* more styling

* heheheheheheeh

* Revert "heheheheheheeh"

This reverts commit 7d095fcfd2.

* Ccards (#5733)

* links

* more links

* improved styling and chevron aligned to title

* fix index.mdx urls for Terminal

* update package.json

* update index.mdx

* fix generation

* spelling

* toolkit_extensions

* update data extensions

* couple of links

* add tiingo to data extensions list

---------

Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>
Co-authored-by: andrewkenreich <andrew.kenreich@gmail.com>
Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt>
Co-authored-by: James Maslek <jmaslek11@gmail.com>

* Stock leftover cleanup (#5745)

* change to equity in `.md` files

* `HistoricalStockSplits`->`HistoricalSplits`

* `StockInsiderTrading`->`InsiderTrading`

* sorry fmp

* `EquityHistorical` cleanup

* `EquityNBBO` cleanup

* .md leftover

* the last of stocks

* Hotfix/urllib to dev group (#5732)

* use the urllib3 dependency on the dev group instead

* adapt the version script for the nightlies - if it's a nightly the package distribution name will have a different name

* add dev dependencies to the dev installation bc of the ci

* updating the import on validate_call according to: https://docs.pydantic.dev/latest/concepts/validation_decorator/
the way we were importing it breaks if pydantic=2.5
@montezdesousa

* loosing urllib3 version specification on the provider and adding it to platform dev deps

* rmeoving urllib from top level deps; and removing --with dev flag

* changing to ^ instead

* Revert "changing to ^ instead"

This reverts commit 7300904e9f.

* unnecessary dep

---------

Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>
Co-authored-by: James Maslek <jmaslek11@gmail.com>

* feature/v4-bop - Add ECB Balance of Payments (Replaces #5716) (#5726)

* add ecb balance of payments

* missing __init__.py files

* Nasdaq calendar earnings and fix FMP calendar earnings (#5718)

Co-authored-by: James Maslek <jmaslek11@gmail.com>

* feature/us-treasury-auctions: Adds Treasury Auctions endpoint and provider for US Government Data. (#5746)

* add government_us provider and treasury auctions endpoint

* black

* add param for cusip

* move logic for setting default start/end date

* Update hub<>platform credentials map (#5749)

* update hub<>platform credentials map

* typo

* Add API settings schema to system settings (#5743)

Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>

* Skip checking creds (#5737)

* skip checking creds

* fix bug

* ok mypy

* add comment

* rename required_credentials

* fix

* fix top_retail bug

* don't require creds in some nasdaq fetchers

* black

* this was not here before

* fix tests

* update fetcher test

* update contributing guidelines

* Fix Quote (#5752)

* Fix Quote

* fixed return type and model validation

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* Wrap up renaming global news to world news on a model level (#5750)

* Wrap up renaming global news to world news on a model level

* cleanup

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* Remove eod from docstrings (#5751)

* Wrap up renaming global news to world news on a model level

* Remove "end of day" from historical price model docstrings

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* Massive docstring cleanup (#5755)

* sec router remove command

* standard models cleanup

* fmp cleanup

* av cleanup

* benzinga cleanup

* biztoc cleanup

* cboe cleanup

* ecb cleanup

* finra cleanup

* fred cleanup

* us cleanup

* intrinio cleanup

* nasdaq cleanup

* oecd cleanup

* polygon cleanup

* sec cleanup

* seeking alpha cleanup

* stockgrid cleanup

* tiingo cleanup

* tradingeconomics cleanup

* ultima cleanup

* wsj cleanup

* yfinance cleanup

* sec router lint

* fix date query param description

* Updates system and api settings (#5753)

* remove uncessary import on rest api

* remove FrozenField and add api.version

* allow setup from json

* remove id tag

* computed field is better

* formatting

---------

Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>

* Squeeze build time (#5756)

* squeeze build time

* bug fix

* fix test

* typo?

* rebuild

* keep tradingeconomics

* docs/working-docs: Working V4 Docs PR (#5747)

* post-install clarification, fix links

* more links

* change word

* toolkit cleanup

* rename 'contributing' to 'development'

* update extensions

* some urls

* Update sdk-platform and v4-develop in urls (#5730)

* Update sdk-platform and v4-develop in urls

* Seprate Intrinio financials data tags into a different command (#5723)

* add `ebit` field in income statement standard model

* only add required data tags

* remove calculations data

* use `name` key instead of `tag` key

* set `period` as required in data

* remove `period` and `cik` from provider models

* add `equity/fundamental/search_financial_attributes` with tests

* clean descriptions file

* add `equity/fundamental/financial_attributes` with tests

* set `value` as `Optional`

* Fix threadpool test error (#5734)

* Remove ultima from deps (#5736)

* remove ultima from deps

* skip ultima test

* black

* c…

* More v3 removals (#6141)

* remove ultima + althub

* move twitter keys

* economy kill bigmac + remove eval + plot+ stored data

* am losing track

* oanda is next

* brokers now

* fix sdk in case anyone wants it

* missed an sdk endpoint

* spec file

* small edits for installer

* stop the int tests on these

* always be fixin bugs

* some more removals

* [Enhancement] Show the source of error in exception traceback (#6153)

* show source of error

* restructure code for readability

* Improve the OECD requests (#6152)

* remove ultima + althub

* move twitter keys

* Enhance caching + more specific urls

* Update urls for stir

* LTIR

* cli

* one v3 file to fix

* Typing edits + gdp dates + gdp all countries

* Tests

* lint

* not sure why those didnt record

* handle the fact that we artifically add some start dates and end dates

* fix dates with actual solution not weird patch

* lint

* adds AlphaVantage to historical_eps (#6155)

* [BugFix] Fix FMP Market Snapshots (#6160)

* fix FMP market snapshots

* exception handling

* model type

* forgot one line

* fix test

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [Feature] - Excel help page (#6165)

* create help page

* rename file

* words

* words

* more issues

* less words

* minor fix

* email

* no bare urls

* unused attribute

* ruff

* [Feature] Add Currency Snapshots With Data From FMP (#6162)

* add obb.currency.snapshots() endpoint and create new standard model

* add standard model

* static assets

* add couple of comments

* codespell

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [Feature] Add `form_13f` Endpoint to `equity.ownership` (#6122)

* add form_13f endpoint

* review things

* option_type validator

* black

* codespell

* add some comments to the code

* remove duplicated process

* static file

* remove warning

* static why no one updates you :-(

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>
Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [Bug fix] - Run charting tests again (#6167)

* run tests again

* forgot these 2

* [Enhancement] Slightly Change The Order of intrinio Cash Flow (#6168)

* fix order of intrinio cash flow

* apparently homebrew takes priority, deleted that black

* [Bug fix] - Fix integration tests (#6170)

* fix integration tests

* rebuild

* unittest

* [Bug fix] - Handle multiple items with arbitrary type (#6171)

* handle multiple items with arbitrary type

* minor fix

* ruff

* inequality

* integration tests

* test

* pylint

* fix tests

* fix category

* ruff

* [Feature] Custom choices (#6169)

* custom choices

* remove unnecessary choices from the extra info

* static assets

* simpler way to pop choices on extra

* Getting json_schema_extra without changing the original dict

---------

Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>

* exception in debug mode shows complete argument (#6174)

* [Bugfix] - Lower case validator in standard models (#6172)

* add to_lower validator

* change validator name

* docstrings

* fix interval

* [Enhancement] Standardize "X".price.historical Intervals and Params (#6146)

* FMP

* tiingo

* yfinance

* intrinio

* polygon

* fmp interval descriptions

* alpha_vantage

* update unit tests

* tests

* static files

* black

* black

* black again

* codespell

* codespell again

* futures historical

* ruff

* some more black

* pylint

* now black again

* test params

* skip deprecated

* fmp test cassette

* fix some tests

* fix test_query

* fix bad symbol in toolkit integration tests

* attempt at parameter deprecation warning

* Fix edge case

* test params

* more test params

* that's the ticket

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [Feature] - refactor examples (#6154)

* remove auto examples and split python from api

* add missing exampels

* rebuild

* query params focstring

* black

* add scoped examples

* group model imports in the router

* unblock api

* fix

* classify examples

* fix package identation

* black sig

* fix indentation without linter

* fix python examples

* remove doc

* pylint

* again

* add model validators

* commodity, crypto, currency

* filter examples

* fix python examples

* fix filter and build

* undo toml change

* add comment

* oop

* comment

* typing

* lint

* Update router.py

* Update econometrics_router.py

* fix to_python

* to_python

* to_python

* black

* fix multiple line field descriptions

* remove circular import

* add missing import

* pass indent as object attr

* doc

* doc

* this looks better

* forgot this

* fix: new examples adapted

* fix prev commit

* avoid future problems

* Update ownership_router.py

* rebuild + remove todo

* make description mandatory for python examples

* simple indent

* append_examples func works for both website and docstring

* Add example unit tests

* Edit example unit tests

* fix validator

* this works

* fix to_python

* fix mandatory docstrings

* typing

* shorter error msgs

* economy router

* fix more examples

* more examples

* more examples

* more examples

* field desc

* minor fix

* fix etf examples

* handling types better

* lint

* rename method

* rename var

* docstring + move method

* typing

* prompt

* rebuild

* prompt fix in PythonEx

* fix examples without model

* example mock data

* add get_field_type func to get field data type

* panel data

* mock data

* fix

* fix

* docstring

* ohlcv

* pylint

* quantitaive router

* simplify mock data

* fix remaining quantitative routers

* a bit more flexibility for examples

* lint

* mock dat from sample

* docstring

* assertion

* bugfix

* minor fix

* technical

* fix integration tests

* fix docstring

* econometrics examples

* econometrics examples

* remove warning

* add technical examples

* fix bad examples

* fix more examples

* update test rules

* remoce old pydantic referenc

* fix bug in treasury prices

* fix quantitative examples

* discovery router

* equity shorts

* equity shorts

* fix currency pairs

* fix sec_router example

* fix panel data to support all funcs

* black

* more examples fixes

* simplify test

* rebuild

* test doc

* add provider to some ex

* ^

* last

* add provider

* rebuild

* working examples

* noqa

* pylint

* pylint

* clean

* minor fix

* fix test

* lint

* ruff

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>
Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [Enhancement] Improve Intrinio Unusual Options (#6177)

* improve intrinio unusual options

* static files

* fix test

* really fix the test

* added code to get new examples as string (#6181)

* [Feature] Add Tradier Provider Extension (#6178)

* add tradier provider

* python 3-9 tz parsing

* unused argument

* add handling for cassette playback on GitHub

* sort equity historical nicely

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>

* [Feature] - Create static asset tests (#6182)

* Create static asset tests

* Lint

* Add labels for  `breaking_changes` tag (#6184)

* Add labels for  breaking changes***

***Update release-drafter configuration

* Update release-drafter.yml to include emoji for OpenBB Platform Breaking Changes

* [Bugfix] - Fix equity/price/historical w/ alphavantage (#6183)

* fix premium endpoint bug

* lint

* [Enhancement] Allow Multiple Symbols For Intrinio Key Metrics (#6186)

* improve intrinio key metrics

* type thing

* some thing

* ruff

* handle date type (#6185)

* Release bug fixes (#6187)

* release bug fixes

* rebuild

---------

Co-authored-by: Pratyush Shukla <ps4534@nyu.edu>

* [BugFix] Update `README` for Platform (#6189)

* update readme

* prevent oopsies

* beta versions

* print extensions name

* update toml with beta versions

* [BugFix] Raise Alpha Vantage API Error (#6188)

* raise API error

* handle more API error messages

* handle bad data

---------

Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>
Co-authored-by: Diogo Sousa <montezdesousa@gmail.com>

* bump versions for all packages

* update extensions

* update econ cal headers (#6191)

* fix for obbject extensions not added in extension map

* updated extension map

* update lock files

* fix maybe for SDK v3 docs

* Revert "Merge branch 'main' into release/4.1.5"

This reverts commit 5b333dbcd2, reversing
changes made to e4beecf5ef.

* Revert "fix for obbject extensions not added in extension map"

This reverts commit b6bd2b9d5e.

* Revert "updated extension map"

This reverts commit 9ed74fee19.

* don't get del files for terminal

* expiration choice u killing me

* bad mypy

* no linting for terminal v3

* add TODO

* disable pylint for sec files

---------

Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt>
Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>
Co-authored-by: James Maslek <jmaslek11@gmail.com>
Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>
Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>
Co-authored-by: teh_coderer <me@tehcoderer.com>
Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt>
Co-authored-by: Luqman <luqazino@gmail.com>
Co-authored-by: minhhoang1023 <40023817+minhhoang1023@users.noreply.github.com>
Co-authored-by: jose-donato <43375532+jose-donato@users.noreply.github.com>
Co-authored-by: Ayrton Parkinson <ayrton.parkinson1@gmail.com>
Co-authored-by: northern-64bit <75195383+northern-64bit@users.noreply.github.com>
Co-authored-by: Luqman <luqman.bello@openbb.finance>
Co-authored-by: Eric Li <38477812+EricLi-Dev@users.noreply.github.com>
Co-authored-by: Diogo Sousa <montezdesousa@gmail.com>
Co-authored-by: Andrew <andrew.kenreich@gmail.com>
Co-authored-by: Michael Struwig <mnicstruwig@gmail.com>
Co-authored-by: capital0 <72140796+capital0@users.noreply.github.com>
Co-authored-by: Ben Van Doren <benvandoren@users.noreply.github.com>
Co-authored-by: Adi Sai <adithya.sairam1@gmail.com>
Co-authored-by: Sandip Saha <sandipsmoto@gmail.com>
Co-authored-by: Adwait <111136306+AdwaitSalankar@users.noreply.github.com>
Co-authored-by: Abhishek Amar <66067391+abhishek-amar@users.noreply.github.com>
Co-authored-by: professssor <62937125+professssor@users.noreply.github.com>
Co-authored-by: Farookh Zaheer Siddiqui <129654632+FarukhS52@users.noreply.github.com>
Co-authored-by: MAX SHESTOV <57421753+maxxsh@users.noreply.github.com>
Co-authored-by: jose-donato <zmcdonato@gmail.com>
Co-authored-by: Mohamad Fadil <fadil.parves@gmail.com>
Co-authored-by: Ramazan <guvencramazan@outlook.com>
Co-authored-by: joshuabuildsthings <joshuabuildsthings@users.noreply.github.com>
Co-authored-by: wojda <114031148+polooner@users.noreply.github.com>
Co-authored-by: Bim Phomthong <118195204+bimbolimbo@users.noreply.github.com>
Co-authored-by: Ramazan <guvencramazan@yandex.com>
Co-authored-by: omahs <73983677+omahs@users.noreply.github.com>
2024-03-12 08:16:42 -04:00

3573 lines
124 KiB
Python

"""Forecast Controller Module"""
__docformat__ = "numpy"
# pylint: disable=C0302,too-many-branches,too-many-arguments,R0904,R0902,W0707
# flake8: noqa
# IMPORT STANDARD
import argparse
import logging
from typing import Any, Dict, List, Optional
# IMPORT THIRDPARTY
import pandas as pd
import psutil
try:
import darts
import torch
darts_latest = "0.23.0"
# check darts version
if darts.__version__ != darts_latest:
print(f"You are currently using Darts version {darts.__version__}")
print(
"Follow instructions on creating a new conda environment with the latest "
f"Darts version ({darts_latest}):"
)
print("https://my.openbb.co/app/sdk/installation")
except ModuleNotFoundError:
raise ModuleNotFoundError(
"Please install the forecast version of the terminal. Instructions can be found "
"under the python tab: https://my.openbb.co/app/sdk/installation"
)
try:
import whisper
import transformers
from whisper.tokenizer import LANGUAGES, TO_LANGUAGE_CODE
from openbb_terminal.forecast.whisper_utils import str2bool
transformers_ver = transformers.__version__
# if imports are successful, set flag to True
WHISPER_AVAILABLE = True
except ModuleNotFoundError:
raise ModuleNotFoundError(
"Please use poetry to install latest whisper model and dependencies. \n"
"poetry install -E forecast \n"
"\n"
"If you are not using poetry, please install whisper model. Instructions can be found here: \n"
"https://github.com/openai/whisper \n"
"Please install the transformers library with the following command: \n"
"pip install transformers \n"
)
# ignore pylint(ungrouped-imports)
# pylint: disable=ungrouped-imports
# IMPORT INTERNAL
from openbb_terminal.core.session.current_user import get_current_user
from openbb_terminal.common import common_model
from openbb_terminal.custom_prompt_toolkit import NestedCompleter
from openbb_terminal.decorators import log_start_end
from openbb_terminal.helper_funcs import (
check_positive,
check_positive_float,
NO_EXPORT,
EXPORT_ONLY_FIGURES_ALLOWED,
EXPORT_ONLY_RAW_DATA_ALLOWED,
log_and_raise,
valid_date,
parse_and_split_input,
check_non_negative,
check_positive_float_list,
check_list_values,
check_valid_date,
)
from openbb_terminal.menu import session
from openbb_terminal.parent_classes import BaseController
from openbb_terminal.rich_config import console, MenuText
from openbb_terminal.forecast import (
anom_view,
autoarima_view,
autoces_view,
autoets_view,
autoselect_view,
brnn_view,
expo_model,
expo_view,
forecast_model,
forecast_view,
helpers,
linregr_view,
mstl_view,
nbeats_view,
nhits_view,
regr_view,
rnn_view,
rwd_view,
seasonalnaive_view,
tcn_view,
tft_view,
theta_view,
trans_view,
whisper_model,
timegpt_view,
)
logger = logging.getLogger(__name__)
empty_df = pd.DataFrame()
def check_greater_than_one(value) -> int:
"""Argparse type to check positive int above 1"""
new_value = int(value)
if new_value <= 1:
log_and_raise(
argparse.ArgumentTypeError(
f"{value} is an invalid positive int value. Must be greater than 1."
)
)
return new_value
class ForecastController(BaseController):
"""Forecast class"""
CHOICES_COMMANDS: List[str] = [
"load",
"show",
"plot",
"clean",
"combine",
"setndays",
"desc",
"corr",
"rename",
"delete",
"export",
"ema",
"sto",
"rsi",
"roc",
"mom",
"delta",
"atr",
"signal",
"autoselect",
"autoarima",
"autoces",
"autoets",
"mstl",
"rwd",
"seasonalnaive",
"expo",
"theta",
"rnn",
"brnn",
"nbeats",
"tcn",
"regr",
"linregr",
"trans",
"tft",
"season",
"which",
"nhits",
"anom",
"whisper",
"timegpt",
]
pandas_plot_choices = [
"line",
"scatter",
"bar",
"barh",
"hist",
"box",
"kde",
"area",
"pie",
"hexbin",
]
disclaimer = """
All models are for educational purposes only. The techniques available in this menu are not
fine tuned or guaranteed to work. Backtesting results is not a guarantee of future accuracy.
Investing involves monetary risk that OpenBB does not take a role in. Please research any
prediction techniques fully before attempting to use. OpenBB is not liable for any loss or
damages."""
PATH = "/forecast/"
CHOICES_GENERATION = True
loaded_dataset_cols = "\n"
list_dataset_cols: list = list()
def __init__(
self,
ticker: str = "",
data: pd.DataFrame = empty_df,
queue: Optional[List[str]] = None,
):
"""Constructor"""
super().__init__(queue)
self.files: List[str] = []
self.choices = {}
# The full file name with extension, this allows the rest command to work
self.files_full: List[List[str]] = []
self.datasets: Dict[str, pd.DataFrame] = dict()
self.MINIMUM_DATA_LENGTH = 100
self.ndays = 5
if ticker and not data.empty:
data = data.reset_index()
data.columns = data.columns.map(lambda x: x.lower().replace(" ", "_"))
self.files.append(ticker)
self.datasets[ticker] = data
self.loaded_dataset_cols = "\n"
self.loaded_dataset_cols += (
f" {ticker} {(20 - len(ticker)) * ' '}: "
f"{', '.join(data.columns)}\n"
)
for col in data.columns:
self.list_dataset_cols.append(f"{ticker}.{col}")
self.DATA_TYPES: List[str] = ["int", "float", "str", "bool", "category", "date"]
self.signs: Dict[Any, Any] = {
"div": "/",
"mul": "*",
"add": "+",
"sub": "-",
"mod": "%",
"pow": "**",
}
self.DATA_FILES = forecast_model.get_default_files()
# setting device on GPU if available, else CPU
self.device = "cuda" if torch.cuda.is_available() else "cpu"
self.comp_ram = f"{round(psutil.virtual_memory().total / (1024.0 ** 3),2)}G"
self.rec_data_size = f"{(psutil.virtual_memory().total / (1024.0 ** 3))//3}G"
self.torch_version = torch.__version__
self.darts_version = darts.__version__
if session and get_current_user().preferences.USE_PROMPT_TOOLKIT:
choices: dict = self.choices_default
self.choices = choices
self.completer = NestedCompleter.from_nested_dict(choices)
def call_exit(self, _) -> None:
"""Process exit terminal command from forecast menu."""
self.save_class()
for _ in range(self.PATH.count("/") + 1):
self.queue.insert(0, "quit")
def get_dataset_columns(self):
return {
f"{dataset}.{column}": {column: None, dataset: None}
for dataset, dataframe in self.datasets.items()
for column in dataframe.columns
}
def parse_input(self, an_input: str) -> List:
"""Parse controller input
Overrides the parent class function to handle YouTube video URL conventions.
See `BaseController.parse_input()` for details.
"""
# Filtering out YouTube video parameters like "v=" and removing the domain name
youtube_filter = r"(youtube\.com/watch\?v=)"
custom_filters = [youtube_filter]
commands = parse_and_split_input(
an_input=an_input.replace("https://", ""), custom_filters=custom_filters
)
return commands
def update_runtime_choices(self):
# Load in any newly exported files
self.DATA_FILES = forecast_model.get_default_files()
if session and get_current_user().preferences.USE_PROMPT_TOOLKIT:
choices: dict = self.choices_default # type: ignore
self.choices = choices
self.completer = NestedCompleter.from_nested_dict(choices)
def refresh_datasets_on_menu(self):
"""Refresh datasets on menu with new columns when adding new features"""
self.list_dataset_cols = list()
maxfile = max(len(file) for file in self.files)
self.loaded_dataset_cols = "\n"
for dataset, data in self.datasets.items():
self.loaded_dataset_cols += (
f" {dataset} {(maxfile - len(dataset)) * ' '}: "
f"{', '.join(data.columns)}\n"
)
for col in data.columns:
self.list_dataset_cols.append(f"{dataset}.{col}")
def print_help(self):
"""Print help"""
self.update_runtime_choices()
current_user = get_current_user()
mt = MenuText("forecast/")
mt.add_param("_disclaimer_", self.disclaimer)
mt.add_raw("\n")
mt.add_param(
"_data_loc",
f"\n\t{current_user.preferences.USER_EXPORTS_DIRECTORY}\n"
f"\t{current_user.preferences.USER_CUSTOM_IMPORTS_DIRECTORY}",
)
mt.add_raw("\n")
mt.add_cmd("load")
mt.add_raw("\n")
mt.add_param("_loaded", self.loaded_dataset_cols)
mt.add_info("_exploration_")
mt.add_cmd("show", self.files)
mt.add_cmd("plot", self.files)
mt.add_cmd("clean", self.files)
mt.add_cmd("combine", self.files)
mt.add_cmd("setndays", self.ndays)
mt.add_cmd("desc", self.files)
mt.add_cmd("corr", self.files)
mt.add_cmd("season", self.files)
mt.add_cmd("delete", self.files)
mt.add_cmd("rename", self.files)
mt.add_cmd("export", self.files)
mt.add_raw("\n")
mt.add_info("_feateng_")
mt.add_cmd("ema", self.files)
mt.add_cmd("sto", self.files)
mt.add_cmd("rsi", self.files)
mt.add_cmd("roc", self.files)
mt.add_cmd("mom", self.files)
mt.add_cmd("delta", self.files)
mt.add_cmd("atr", self.files)
mt.add_cmd("signal", self.files)
mt.add_raw("\n")
mt.add_info("_tsforecasting_")
mt.add_cmd("autoselect", self.files)
mt.add_cmd("autoarima", self.files)
mt.add_cmd("autoces", self.files)
mt.add_cmd("autoets", self.files)
mt.add_cmd("mstl", self.files)
mt.add_cmd("rwd", self.files)
mt.add_cmd("seasonalnaive", self.files)
mt.add_cmd("expo", self.files)
mt.add_cmd("theta", self.files)
mt.add_cmd("linregr", self.files)
mt.add_cmd("regr", self.files)
mt.add_cmd("rnn", self.files)
mt.add_cmd("brnn", self.files)
mt.add_cmd("nbeats", self.files)
mt.add_cmd("nhits", self.files)
mt.add_cmd("tcn", self.files)
mt.add_cmd("trans", self.files)
mt.add_cmd("tft", self.files)
mt.add_raw("\n")
mt.add_info("_anomaly_")
mt.add_cmd("anom", self.files)
mt.add_raw("\n")
mt.add_info("_misc_")
mt.add_cmd("timegpt", self.files)
mt.add_cmd("whisper", WHISPER_AVAILABLE)
console.print(text=mt.menu_text, menu="Forecast")
def custom_reset(self):
"""Class specific component of reset command"""
if self.files_full:
queue = ["forecast"]
for file, alias in self.files_full:
load = f"'load {file}"
if alias:
load += f" -a {alias}'"
else:
load += "'"
queue.append(load)
return queue
return []
def add_standard_args(
self,
parser: argparse.ArgumentParser,
target_dataset: bool = False,
target_column: bool = False,
period: Optional[int] = None,
n_days: bool = False,
seasonal: Optional[str] = None,
periods: bool = False,
window: bool = False,
train_split: bool = False,
input_chunk_length: bool = False,
output_chunk_length: bool = False,
force_reset: bool = False,
save_checkpoints: bool = False,
model_save_name: Optional[str] = None,
n_epochs: bool = False,
model_type: bool = False,
dropout: Optional[float] = None,
batch_size: Optional[int] = None,
learning_rate: bool = False,
past_covariates: bool = False,
all_past_covariates: bool = False,
lags: bool = False,
hidden_size: int = 0,
n_jumps: bool = False,
end: bool = False,
start: bool = False,
residuals: bool = False,
forecast_only: bool = False,
naive: bool = False,
explainability_raw: bool = False,
export_pred_raw: bool = False,
metric: bool = False,
):
if hidden_size:
parser.add_argument(
"--hidden-size",
action="store",
dest="hidden_size",
default=hidden_size,
type=check_positive,
help="Size for feature maps for each hidden RNN layer (h_n)",
)
if past_covariates:
parser.add_argument(
"--past-covariates",
action="store",
dest="past_covariates",
default=None,
type=str,
help="Past covariates(columns/features) in same dataset. Comma separated.",
)
if all_past_covariates:
parser.add_argument(
"--all-past-covariates",
action="store_true",
dest="all_past_covariates",
default=False,
help="Adds all rows as past covariates except for date and the target column.",
)
if naive:
parser.add_argument(
"--naive",
action="store_true",
dest="naive",
default=False,
help="Show the naive baseline for a model.",
)
if target_dataset:
parser.add_argument(
"-d",
"--dataset",
help="The name of the dataset you want to select",
dest="target_dataset",
type=str,
choices=list(self.datasets.keys()),
)
if target_column:
parser.add_argument(
"-c",
"--target-column",
help="The name of the specific column you want to use",
dest="target_column",
type=str,
default="close",
)
if period is not None:
parser.add_argument(
"--period",
help="The period to use",
dest="period",
type=check_greater_than_one,
default=period,
)
if n_days:
parser.add_argument(
"-n",
"--n-days",
action="store",
dest="n_days",
type=check_positive,
default=self.ndays,
help="prediction days.",
)
if seasonal is not None:
parser.add_argument(
"-s",
"--seasonal",
action="store",
dest="seasonal",
choices=expo_model.SEASONS,
default=seasonal,
help="Seasonality: N: None, A: Additive, M: Multiplicative.",
)
if periods:
parser.add_argument(
"-p",
"--periods",
action="store",
dest="seasonal_periods",
type=check_positive,
default=7,
help="Seasonal periods: 4: Quarterly, 7: Daily",
)
if window:
parser.add_argument(
"-w",
"--window",
action="store",
dest="start_window",
default=0.85,
type=check_positive_float,
help="Start point for rolling training and forecast window. 0.0-1.0",
)
if train_split:
parser.add_argument(
"-t",
"--train-split",
action="store",
dest="train_split",
default=0.85,
type=check_positive_float,
help="Start point for rolling training and forecast window. 0.0-1.0",
)
if input_chunk_length:
parser.add_argument(
"-i",
"--input-chunk-length",
action="store",
dest="input_chunk_length",
default=14,
type=check_positive,
help="Number of past time steps for forecasting module at prediction time.",
)
if output_chunk_length:
parser.add_argument(
"-o",
"--output-chunk-length",
action="store",
dest="output_chunk_length",
default=5,
type=check_positive,
help="The length of the forecast of the model.",
)
if force_reset:
parser.add_argument(
"--force-reset",
action="store",
dest="force_reset",
default=True,
type=bool,
help="""If set to True, any previously-existing model with the same name will be reset
(all checkpoints will be discarded).""",
)
if save_checkpoints:
parser.add_argument(
"--save-checkpoints",
action="store",
dest="save_checkpoints",
default=True,
type=bool,
help="Whether to automatically save the untrained model and checkpoints.",
)
if model_save_name is not None:
parser.add_argument(
"--model-save-name",
type=str,
action="store",
dest="model_save_name",
default=model_save_name,
help="Name of the model to save.",
)
if n_epochs:
parser.add_argument(
"--n-epochs",
action="store",
dest="n_epochs",
default=300,
type=check_positive,
help="Number of epochs over which to train the model.",
)
if model_type:
parser.add_argument(
"--model-type",
type=str,
action="store",
dest="model_type",
default="LSTM",
help='Enter a string specifying the RNN module type ("RNN", "LSTM" or "GRU")',
)
if dropout is not None:
parser.add_argument(
"--dropout",
action="store",
dest="dropout",
default=dropout,
type=check_positive_float,
help="Fraction of neurons affected by Dropout, from 0 to 1.",
)
if batch_size is not None:
parser.add_argument(
"--batch-size",
action="store",
dest="batch_size",
default=batch_size,
type=check_positive,
help="Number of time series (input and output) used in each training pass",
)
if end:
parser.add_argument(
"--end",
action="store",
type=valid_date,
dest="s_end_date",
default=None,
help="The end date (format YYYY-MM-DD) to select for testing",
)
if start:
parser.add_argument(
"--start",
action="store",
type=valid_date,
dest="s_start_date",
default=None,
help="The start date (format YYYY-MM-DD) to select for testing",
)
if learning_rate:
parser.add_argument(
"--learning-rate",
action="store",
dest="learning_rate",
default=1e-3,
type=check_positive_float,
help="Learning rate during training.",
)
if n_jumps:
parser.add_argument(
"-j",
"--jumps",
action="store",
dest="n_jumps",
type=check_positive,
default=1,
help="number of jumps in training data.",
)
if lags:
parser.add_argument(
"--lags",
action="store",
dest="lags",
type=check_greater_than_one,
default=14,
help="Lagged target values used to predict the next time step.",
)
if residuals:
parser.add_argument(
"--residuals",
help="Show the residuals for the model.",
action="store_true",
default=False,
dest="residuals",
)
if forecast_only:
parser.add_argument(
"--forecast-only",
help="Do not plot the historical data without forecasts.",
action="store_true",
default=False,
dest="forecast_only",
)
if explainability_raw:
parser.add_argument(
"--explainability-raw",
action="store_true",
dest="explainability_raw",
default=False,
help="Prints out a raw dataframe showing explainability results.",
)
if export_pred_raw:
parser.add_argument(
"--export-pred-raw",
action="store_true",
dest="export_pred_raw",
default=False,
help="Export predictions to a csv file.",
)
if metric:
parser.add_argument(
"--metric",
type=str,
action="store",
dest="metric",
default="mape",
choices=["rmse", "mse", "mape", "smape"],
help="Calculate precision based on a specific metric (rmse, mse, mape)",
)
# if user does not put in --dataset
return parser
def load(self, ticker: str, data: pd.DataFrame):
"""Loads news dataframes into memory"""
# check if data has minimum number of rows
if ticker and len(data) < self.MINIMUM_DATA_LENGTH:
console.print(
f"[red]Dataset is smaller than recommended minimum {self.MINIMUM_DATA_LENGTH} data points. [/red]"
)
console.print(
f"[red]Please increase the number of data points for [ {ticker} ] and try again.[/red]"
)
return
if not data.empty:
data.columns = data.columns.map(lambda x: x.lower().replace(" ", "_"))
# If the index is a date, move this into a normal column
if data.index.name == "date":
data = data.reset_index()
# Convert date to datetime
# TODO: for now we drop time, once we add handling for time remove this
if "date" in data.columns:
data["date"] = data["date"].apply(helpers.dt_format)
data["date"] = pd.to_datetime(data["date"])
# if we import a custom dataset, remove the old index "unnamed:_0"
if "unnamed:_0" in data.columns:
# Some loaded datasets have the date as unnamed, which is not helpful
if check_valid_date(data["unnamed:_0"].iloc[0]):
data["date"] = data["unnamed:_0"].copy()
data = data.drop(columns=["unnamed:_0"])
self.files.append(ticker)
self.datasets[ticker] = data
# Process new datasets to be updated
self.list_dataset_cols = list()
maxfile = max(len(file) for file in self.files)
self.loaded_dataset_cols = "\n"
for dataset, x_data in self.datasets.items():
self.loaded_dataset_cols += (
f" {dataset} {(maxfile - len(dataset)) * ' '}: "
f"{', '.join(x_data.columns)}\n"
)
for col in data.columns:
self.list_dataset_cols.append(f"{dataset}.{col}")
@log_start_end(log=logger)
def call_load(self, other_args: List[str]):
"""Process load"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="load",
description="Load custom dataset (from previous export, custom imports).",
)
parser.add_argument(
"-f",
"--file",
help="File to load data in (can be custom import, may have been exported before.)",
choices=self.DATA_FILES.keys(),
type=str,
)
parser.add_argument(
"-a",
"--alias",
help="Alias name to give to the dataset",
type=str,
)
parser.add_argument(
"--sheet-name",
dest="sheet_name",
default=None,
nargs="+",
help="Name of excel sheet to save data to. Only valid for .xlsx files.",
)
# Load in any newly exported files
self.DATA_FILES = forecast_model.get_default_files()
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "-f")
ns_parser = self.parse_known_args_and_warn(parser, other_args)
if ns_parser:
if ns_parser.file:
file = ns_parser.file
if ns_parser.alias:
alias = ns_parser.alias
else:
if "." in ns_parser.file:
alias = ".".join(ns_parser.file.split(".")[:-1])
else:
alias = ns_parser.file
# check if this dataset has been added already
if alias in self.files:
console.print(
"[red]The file/dataset selected has already been loaded.[/red]\n"
)
return
data = common_model.load(
file,
data_files=self.DATA_FILES,
data_examples={},
sheet_name=(
" ".join(ns_parser.sheet_name) if ns_parser.sheet_name else None
),
)
if not data.empty:
self.files_full.append([ns_parser.file, ns_parser.alias])
self.load(alias, data)
self.update_runtime_choices()
# Show selected dataframe on console
@log_start_end(log=logger)
def call_which(self, other_args: List[str]):
"""Process which command"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="which",
description="Show library versions of required packages.",
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
)
if ns_parser:
console.print(
f"[green]Current Compute Device (CPU or GPU):[/green] {self.device.upper()}"
)
console.print(f"[green]Current RAM:[/green] {self.comp_ram}")
console.print(
f"[green]Recommended Max dataset size based on current RAM:[/green] {self.rec_data_size}"
)
console.print(f"[green]Torch version:[/green] {self.torch_version}")
console.print(f"[green]Darts version:[/green] {self.darts_version}")
# Show selected dataframe on console
@log_start_end(log=logger)
def call_show(self, other_args: List[str]):
"""Process show command"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="show",
description="Show a portion of the DataFrame",
)
parser.add_argument(
"-n",
"--name",
type=str,
choices=self.files,
dest="name",
help="The name of the database you want to show data for",
)
parser.add_argument(
"-s",
"--sortby",
help="Sort based on a column in the DataFrame",
nargs="+",
type=str,
dest="sortby",
default="",
)
parser.add_argument(
"-r",
"--reverse",
action="store_true",
dest="reverse",
default=False,
help=(
"Data is sorted in descending order by default. "
"Reverse flag will sort it in an ascending way. "
"Only works when raw data is displayed."
),
)
parser.add_argument(
"--limit-col",
action="store",
dest="limit_col",
default=10,
type=check_positive,
help="Set the number of columns to display when showing the dataset",
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "-n")
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
EXPORT_ONLY_RAW_DATA_ALLOWED,
limit=10,
)
if ns_parser:
if not ns_parser.name:
dataset_names = list(self.datasets.keys())
else:
dataset_names = [ns_parser.name]
for name in dataset_names:
df = self.datasets[name]
if name in self.datasets and self.datasets[name].empty:
console.print(
f"[red]No data available for {ns_parser.name}.[/red]\n"
)
elif ns_parser.sortby:
sort_column = " ".join(ns_parser.sortby)
if sort_column not in self.datasets[name].columns:
console.print(
f"[red]{sort_column} not a valid column."
"Showing without sorting.\n[/red]"
)
else:
df = df.sort_values(by=sort_column, ascending=ns_parser.reverse)
forecast_view.show_df(
df, ns_parser.limit, ns_parser.limit_col, name, ns_parser.export
)
@log_start_end(log=logger)
def call_rename(self, other_args: List[str]):
"""Process rename"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="rename",
description="The column you want to rename from a dataset.",
)
parser.add_argument(
"-d",
"--dataset",
help="Dataset that will get a column renamed",
dest="dataset",
choices=self.datasets.keys(),
type=str,
)
parser.add_argument(
"-o",
"--oldcol",
help="Old column from dataset to be renamed",
dest="oldcol",
type=str,
required="-h" not in other_args,
)
parser.add_argument(
"-n",
"--newcol",
help="New column from dataset to be renamed",
dest="newcol",
type=str,
required="-h" not in other_args,
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "-d")
ns_parser = self.parse_known_args_and_warn(parser, other_args, NO_EXPORT)
if ns_parser:
dataset = ns_parser.dataset
column_old = ns_parser.oldcol
column_new = ns_parser.newcol
if dataset not in self.datasets:
console.print(
f"Not able to find the dataset {dataset}. Please choose one of "
f"the following: {', '.join(self.datasets)}"
)
else:
self.datasets[dataset] = forecast_model.rename_column(
self.datasets[dataset], column_old, column_new
)
self.update_runtime_choices()
self.refresh_datasets_on_menu()
console.print(
f"[green]Successfully renamed {column_old} into {column_new}, in {dataset}[/green]"
)
@log_start_end(log=logger)
def call_setndays(self, other_args: List[str]):
"""Process setndays command"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="setndays",
description="Set the number of days to forecast",
)
parser.add_argument(
"-n",
"--n-days",
help="Number of days to forecast",
dest="n_days",
type=check_positive,
default=5,
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "-n")
ns_parser = self.parse_known_args_and_warn(parser, other_args, NO_EXPORT)
if ns_parser:
self.ndays = ns_parser.n_days
console.print(
f"[green]Number of days to forecast set to {self.ndays}[/green]"
)
self.update_runtime_choices()
# Show selected dataframe on console
@log_start_end(log=logger)
def call_desc(self, other_args: List[str]):
"""Process descriptive stats command"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="desc",
description="Show descriptive statistics of a dataset",
)
# if user does not put in --dataset
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(parser, target_dataset=True)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
EXPORT_ONLY_RAW_DATA_ALLOWED,
)
if ns_parser:
# check proper file name is provided
if not ns_parser.target_dataset:
console.print(
"[red]Please select a valid dataset with the -d flag.\n[/red]"
)
return
df = self.datasets[ns_parser.target_dataset]
forecast_view.describe_df(
df,
ns_parser.target_dataset,
ns_parser.export,
sheet_name=(
" ".join(ns_parser.sheet_name) if ns_parser.sheet_name else None
),
)
@log_start_end(log=logger)
def call_plot(self, other_args: List[str]):
"""Process plot command"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="plot",
description="Plot data based on the index",
)
parser.add_argument(
"-v",
"--values",
help="Dataset.column values to be displayed in a plot. Use comma to separate multiple",
choices=self.get_dataset_columns(),
dest="values",
type=str,
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "-v")
ns_parser = self.parse_known_args_and_warn(
parser, other_args, export_allowed=EXPORT_ONLY_FIGURES_ALLOWED
)
if not ns_parser:
return
if not ns_parser.values:
console.print(
"[red]Please select a valid dataset with the -d flag.\n[/red]"
)
return
values = [x.strip() for x in ns_parser.values.split(",")]
target_df = values[0].split(".")[0]
if target_df not in self.datasets:
console.print(
"[red]Please select a valid dataset with the -d flag.\n[/red]"
)
return
for value in values:
if value.split(".")[0] != target_df:
console.print("[red]Please enter values from the same dataset.\n[/red]")
return
forecast_view.display_plot(
self.datasets[target_df],
[x.split(".")[1] for x in values],
ns_parser.export,
)
@log_start_end(log=logger)
def call_season(self, other_args: List[str]):
"""Process season command"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="season",
description="The seasonality for a given column",
)
parser.add_argument(
"-d",
"--dataset",
help="Dataset.column values to be displayed in a plot",
dest="values",
choices=self.get_dataset_columns(),
type=str,
)
parser.add_argument(
"-m",
help="A time lag to highlight on the plot",
dest="m",
type=int,
default=None,
)
parser.add_argument(
"--max_lag",
help="The maximal lag order to consider",
dest="max_lag",
type=int,
default=24,
)
parser.add_argument(
"-a",
"--alpha",
help="The confidence interval to display",
dest="alpha",
type=float,
default=0.05,
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "-v")
ns_parser = self.parse_known_args_and_warn(
parser, other_args, export_allowed=EXPORT_ONLY_FIGURES_ALLOWED
)
if not ns_parser:
return
if not ns_parser.values:
console.print(
"[red]Please select a valid dataset with the -d flag.\n[/red]"
)
return
try:
dataset, col = ns_parser.values.split(".")
data = self.datasets[dataset]
except ValueError:
console.print("[red]Please enter 'dataset'.'column'.[/red]\n")
return
forecast_view.display_seasonality(
data=data,
column=col,
export=ns_parser.export,
m=ns_parser.m,
max_lag=ns_parser.max_lag,
alpha=ns_parser.alpha,
)
@log_start_end(log=logger)
def call_corr(self, other_args: List[str]):
"""Process correlation command"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="corr",
description="Plot correlation coefficients.",
)
# if user does not put in --dataset
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(parser, target_dataset=True)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
EXPORT_ONLY_FIGURES_ALLOWED,
)
if ns_parser:
# check proper file name is provided
if not ns_parser.target_dataset:
console.print(
"[red]Please select a valid dataset with the -d flag.\n[/red]"
)
return
data = self.datasets[ns_parser.target_dataset]
forecast_view.display_corr(
data,
ns_parser.export,
)
@log_start_end(log=logger)
def call_combine(self, other_args: List[str]):
"""Process combine"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="combine",
description="Combine two entire datasets, or add specific columns. Add specific"
"columns with the syntax: <datasetX.column2>",
)
parser.add_argument(
"--dataset",
help="Dataset to add columns to",
dest="dataset",
choices=list(self.datasets.keys()),
)
# pylint: disable=consider-using-dict-items
column_choices = [
f"{x}.{y}" for x in self.datasets for y in self.datasets[x].columns
]
column_choices.extend(list(self.datasets))
parser.add_argument(
"-c",
"--columns",
help="The columns we want to add <dataset.column>",
dest="columns",
choices=column_choices,
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
ns_parser = self.parse_known_args_and_warn(parser, other_args, NO_EXPORT)
if ns_parser:
if ns_parser.dataset not in self.datasets:
console.print(
f"Not able to find the dataset {ns_parser.dataset}. Please choose one of "
f"the following: {', '.join(self.datasets)}"
)
return
data = self.datasets[ns_parser.dataset]
for option in ns_parser.columns.split(","):
if "." in option:
dataset, col = option.split(".")
columns = [col]
else:
dataset = option
columns = [x for x in self.datasets[dataset].columns if x != "date"]
if dataset not in self.datasets:
console.print(
f"Not able to find the dataset {dataset}. Please choose one of "
f"the following: {', '.join(self.datasets)}"
)
continue
for column in columns:
data = forecast_model.combine_dfs(
data, self.datasets[dataset], column, dataset
)
self.datasets[ns_parser.dataset] = data
self.update_runtime_choices()
self.refresh_datasets_on_menu()
console.print(
f"[green]Successfully added {ns_parser.columns} into {ns_parser.dataset}[/green]"
)
@log_start_end(log=logger)
def call_clean(self, other_args: List[str]):
"""Process clean"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="clean",
description="Clean a dataset by filling and dropping NaN values.",
)
parser.add_argument(
"-f",
"--fill",
help="The method of filling NaNs. This has options to fill rows (rfill, rbfill, rffill) or fill "
"columns (cfill, cbfill, cffill). Furthermore, it has the option to forward fill and backward fill "
"(up to --limit) which refer to how many rows/columns can be set equal to the last non-NaN value",
dest="fill",
choices=["rfill", "cfill", "rbfill", "cbfill", "rffill", "bffill"],
default="",
)
parser.add_argument(
"--drop",
help="The method of dropping NaNs. This either has the option rdrop (drop rows that contain NaNs) "
"or cdrop (drop columns that contain NaNs)",
dest="drop",
choices=["rdrop", "cdrop"],
default="",
)
# if user does not put in --dataset
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(parser, target_dataset=True)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
NO_EXPORT,
limit=5,
)
if ns_parser:
# check proper file name is provided
if not ns_parser.target_dataset:
console.print(
"[red]Please select a valid dataset with the -d flag.\n[/red]"
)
return
(
self.datasets[ns_parser.target_dataset],
clean_status,
) = forecast_model.clean(
self.datasets[ns_parser.target_dataset],
ns_parser.fill,
ns_parser.drop,
ns_parser.limit,
)
if not clean_status:
console.print(
f"[green]Successfully cleaned '{ns_parser.target_dataset}' dataset[/green]"
)
else:
console.print(f"[red]{ns_parser.name} still contains NaNs.[/red]")
@log_start_end(log=logger)
def call_ema(self, other_args: List[str]):
"""Process EMA"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="ema",
description="Add exponential moving average to dataset based on specific column.",
)
# if user does not put in --dataset
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser, target_dataset=True, period=10, target_column=True
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
NO_EXPORT,
)
if ns_parser:
# check proper file name is provided
if not helpers.check_parser_input(ns_parser, self.datasets):
return
self.datasets[ns_parser.target_dataset] = forecast_model.add_ema(
self.datasets[ns_parser.target_dataset],
ns_parser.target_column,
ns_parser.period,
)
console.print(
f"Successfully added 'EMA_{ns_parser.period}' to '{ns_parser.target_dataset}' dataset"
)
# update forecast menu with new column on modified dataset
self.refresh_datasets_on_menu()
self.update_runtime_choices()
@log_start_end(log=logger)
def call_sto(self, other_args: List[str]):
"""Process Stochastic Oscillator"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="sto",
description="Add in Stochastic Oscillator %K and %D",
)
parser.add_argument(
"--close-col",
help="Close column name to use for Stochastic Oscillator",
dest="close_col",
type=str,
default="close",
)
parser.add_argument(
"--high-col",
help="High column name to use for Stochastic Oscillator",
dest="high_col",
type=str,
default="high",
)
parser.add_argument(
"--low-col",
help="Low column name to use for Stochastic Oscillator",
dest="low_col",
type=str,
default="low",
)
# if user does not put in --dataset
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(parser, target_dataset=True, period=10)
ns_parser = self.parse_known_args_and_warn(
parser, other_args, NO_EXPORT, limit=5
)
if ns_parser:
# check proper file name is provided
if not ns_parser.target_dataset:
console.print(
"[red]Please select a valid dataset with the -d flag.\n[/red]"
)
return
df = forecast_model.add_sto(
self.datasets[ns_parser.target_dataset],
close_column=ns_parser.close_col,
high_column=ns_parser.high_col,
low_column=ns_parser.low_col,
period=ns_parser.period,
)
if not df.empty:
self.datasets[ns_parser.target_dataset] = df
console.print(
f"Successfully added 'STOCH&D_{ns_parser.period}' to '{ns_parser.target_dataset}' dataset"
)
# update forecast menu with new column on modified dataset
self.refresh_datasets_on_menu()
self.update_runtime_choices()
def handle_delete(self, dataset, column):
if dataset not in self.datasets:
console.print(
f"Not able to find the dataset {dataset}. Please choose one of "
f"the following: {', '.join(self.datasets)}"
)
else:
forecast_model.delete_column(self.datasets[dataset], column)
@log_start_end(log=logger)
def call_delete(self, other_args: List[str]):
"""Process delete"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="delete",
description="The column you want to delete from a dataset.",
)
parser.add_argument(
"--delete",
help="The columns you want to delete from a dataset. Use format: <dataset.column> or"
" multiple with <dataset.column>,<datasetb.column2>",
dest="delete",
choices=self.get_dataset_columns(),
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--delete")
ns_parser = self.parse_known_args_and_warn(parser, other_args, NO_EXPORT)
if ns_parser:
if "," in ns_parser.delete:
for option in ns_parser.delete:
print(option)
dataset, column = option.split(".")
self.handle_delete(dataset, column)
else:
dataset, column = ns_parser.delete.split(".")
self.handle_delete(dataset, column)
self.update_runtime_choices()
self.refresh_datasets_on_menu()
console.print(f"[green]Successfully deleted {ns_parser.delete}[/green]")
@log_start_end(log=logger)
def call_rsi(self, other_args: List[str]):
"""Process RSI"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="rsi",
description="Add rsi to dataset based on specific column.",
)
# if user does not put in --dataset
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser, target_dataset=True, target_column=True, period=10
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
NO_EXPORT,
)
if ns_parser:
# check proper file name is provided
if not ns_parser.target_dataset:
console.print(
"[red]Please select a valid dataset with the -d flag.\n[/red]"
)
return
self.datasets[ns_parser.target_dataset] = forecast_model.add_rsi(
self.datasets[ns_parser.target_dataset],
ns_parser.target_column,
ns_parser.period,
)
console.print(
f"Successfully added 'RSI_{ns_parser.period}_{ns_parser.target_column}' "
f"to '{ns_parser.target_dataset}' dataset"
)
# update forecast menu with new column on modified dataset
self.refresh_datasets_on_menu()
self.update_runtime_choices()
@log_start_end(log=logger)
def call_roc(self, other_args: List[str]):
"""Process ROC"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="roc",
description="Add rate of change to dataset based on specific column.",
)
# if user does not put in --dataset
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser, target_dataset=True, target_column=True, period=10
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
NO_EXPORT,
)
if ns_parser:
# check proper file name is provided
if not helpers.check_parser_input(ns_parser, self.datasets):
return
self.datasets[ns_parser.target_dataset] = forecast_model.add_roc(
self.datasets[ns_parser.target_dataset],
ns_parser.target_column,
ns_parser.period,
)
console.print(
f"Successfully added 'ROC_{ns_parser.period}' to '{ns_parser.target_dataset}' dataset"
)
# update forecast menu with new column on modified dataset
self.refresh_datasets_on_menu()
self.update_runtime_choices()
@log_start_end(log=logger)
def call_mom(self, other_args: List[str]):
"""Process Momentum"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="mom",
description="Add momentum to dataset based on specific column.",
)
# if user does not put in --dataset
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser, target_dataset=True, target_column=True, period=10
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
NO_EXPORT,
)
if ns_parser:
# check proper file name is provided
if not helpers.check_parser_input(ns_parser, self.datasets):
return
self.datasets[ns_parser.target_dataset] = forecast_model.add_momentum(
self.datasets[ns_parser.target_dataset],
ns_parser.target_column,
ns_parser.period,
)
console.print(
f"Successfully added 'Momentum_{ns_parser.period}' to '{ns_parser.target_dataset}' dataset"
)
# update forecast menu with new column on modified dataset
self.refresh_datasets_on_menu()
self.update_runtime_choices()
@log_start_end(log=logger)
def call_delta(self, other_args: List[str]):
"""Process %Change (Delta)"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="delta",
description="Add %Change (Delta) to dataset based on specific column.",
)
# if user does not put in --dataset
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(parser, target_dataset=True, target_column=True)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
NO_EXPORT,
)
if ns_parser:
# check proper file name is provided
if not helpers.check_parser_input(ns_parser, self.datasets):
return
self.datasets[ns_parser.target_dataset] = forecast_model.add_delta(
self.datasets[ns_parser.target_dataset], ns_parser.target_column
)
console.print(
f"Successfully added 'Delta_{ns_parser.target_column}' to '{ns_parser.target_dataset}' dataset"
)
# update forecast menu with new column on modified dataset
self.refresh_datasets_on_menu()
self.update_runtime_choices()
@log_start_end(log=logger)
def call_atr(self, other_args: List[str]):
"""Process Average True Range"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="atr",
description="Add Average True Range to dataset of specific stock ticker.",
)
parser.add_argument(
"--close-col",
help="Close column name to use for Average True Range.",
dest="close_col",
type=str,
default="close",
)
parser.add_argument(
"--high-col",
help="High column name to use for Average True Range.",
dest="high_col",
type=str,
default="high",
)
parser.add_argument(
"--low-col",
help="Low column name to use for Average True Range.",
dest="low_col",
type=str,
default="low",
)
# if user does not put in --dataset
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(parser, target_dataset=True, target_column=True)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
NO_EXPORT,
)
if ns_parser:
# check proper file name is provided
if not helpers.check_parser_input(ns_parser, self.datasets):
return
self.datasets[ns_parser.target_dataset] = forecast_model.add_atr(
self.datasets[ns_parser.target_dataset],
close_column=ns_parser.close_col,
high_column=ns_parser.high_col,
low_column=ns_parser.low_col,
)
# check if true range was added
if "true_range" in self.datasets[ns_parser.target_dataset].columns:
console.print(
f"Successfully added 'Average True Range' to '{ns_parser.target_dataset}' dataset"
)
else:
console.print(
"Could not add 'Average True Range' as it does not have one/all specific columns (low/close/high)"
)
# update forecast menu with new column on modified dataset
self.refresh_datasets_on_menu()
self.update_runtime_choices()
@log_start_end(log=logger)
def call_signal(self, other_args: List[str]):
"""Process Price Signal"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="signal",
description="""Add price signal to dataset based on closing price.
1 if the signal is that short term price will go up as compared to the long term.
0 if the signal is that short term price will go down as compared to the long term.
""",
)
# if user does not put in --dataset
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(parser, target_dataset=True, target_column=True)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
NO_EXPORT,
)
if ns_parser:
# check proper file name is provided
if not helpers.check_parser_input(ns_parser, self.datasets):
return
self.datasets[ns_parser.target_dataset] = forecast_model.add_signal(
self.datasets[ns_parser.target_dataset],
target_column=ns_parser.target_column,
)
console.print(
f"Successfully added 'Price Signal' to '{ns_parser.target_dataset}' dataset"
)
# update forecast menu with new column on modified dataset
self.refresh_datasets_on_menu()
self.update_runtime_choices()
@log_start_end(log=logger)
def call_export(self, other_args: List[str]):
"""Process export command"""
parser = argparse.ArgumentParser(
add_help=False,
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prog="export",
description="Export dataset to Excel",
)
parser.add_argument(
"-t",
"--type",
help="The file type you wish to export to",
dest="type",
choices=common_model.file_types,
type=str,
default="xlsx",
)
parser.add_argument(
"--sheet-name",
help="The name of the sheet to export to when type is XLSX.",
dest="sheet_name",
type=str,
default="",
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(parser, target_dataset=True)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
export_allowed=NO_EXPORT,
)
if not helpers.check_parser_input(ns_parser, self.datasets, "ignore_column"):
return
forecast_view.export_df(
self.datasets[ns_parser.target_dataset],
ns_parser.type,
ns_parser.target_dataset,
ns_parser.sheet_name,
)
# Best Statistical Model
@log_start_end(log=logger)
def call_autoselect(self, other_args: List[str]):
"""Process autoselect command"""
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
prog="autoselect",
description="""
Perform Automatic Statistical Forecast
(select best statistical model from AutoARIMA, AutoETS, AutoCES, MSTL, ...)
""",
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser,
target_dataset=True,
target_column=True,
n_days=True,
seasonal="A",
periods=True,
window=True,
residuals=True,
forecast_only=True,
start=True,
end=True,
naive=True,
export_pred_raw=True,
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
export_allowed=EXPORT_ONLY_FIGURES_ALLOWED,
)
# TODO Convert this to multi series
if ns_parser:
if not helpers.check_parser_input(ns_parser, self.datasets):
return
autoselect_view.display_autoselect_forecast(
data=self.datasets[ns_parser.target_dataset],
dataset_name=ns_parser.target_dataset,
n_predict=ns_parser.n_days,
target_column=ns_parser.target_column,
seasonal_periods=ns_parser.seasonal_periods,
start_window=ns_parser.start_window,
forecast_horizon=ns_parser.n_days,
export=ns_parser.export,
residuals=ns_parser.residuals,
forecast_only=ns_parser.forecast_only,
start_date=ns_parser.s_start_date,
end_date=ns_parser.s_end_date,
naive=ns_parser.naive,
export_pred_raw=ns_parser.export_pred_raw,
)
# AutoARIMA Model
@log_start_end(log=logger)
def call_autoarima(self, other_args: List[str]):
"""Process autoarima command"""
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
prog="autoarima",
description="""
Perform Automatic ARIMA forecast:
https://nixtla.github.io/statsforecast/examples/getting_started_with_auto_arima_and_ets.html
""",
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser,
target_dataset=True,
target_column=True,
n_days=True,
seasonal="A",
periods=True,
window=True,
residuals=True,
forecast_only=True,
start=True,
end=True,
naive=True,
export_pred_raw=True,
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
export_allowed=EXPORT_ONLY_FIGURES_ALLOWED,
)
# TODO Convert this to multi series
if ns_parser:
if not helpers.check_parser_input(ns_parser, self.datasets):
return
autoarima_view.display_autoarima_forecast(
data=self.datasets[ns_parser.target_dataset],
dataset_name=ns_parser.target_dataset,
n_predict=ns_parser.n_days,
target_column=ns_parser.target_column,
seasonal_periods=ns_parser.seasonal_periods,
start_window=ns_parser.start_window,
forecast_horizon=ns_parser.n_days,
export=ns_parser.export,
residuals=ns_parser.residuals,
forecast_only=ns_parser.forecast_only,
start_date=ns_parser.s_start_date,
end_date=ns_parser.s_end_date,
naive=ns_parser.naive,
export_pred_raw=ns_parser.export_pred_raw,
)
# AutoCES Model
@log_start_end(log=logger)
def call_autoces(self, other_args: List[str]):
"""Process autoces command"""
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
prog="autoces",
description="""
Perform Automatic Complex Exponential Smoothing forecast:
https://nixtla.github.io/statsforecast/models.html#autoces
""",
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser,
target_dataset=True,
target_column=True,
n_days=True,
seasonal="A",
periods=True,
window=True,
residuals=True,
forecast_only=True,
start=True,
end=True,
naive=True,
export_pred_raw=True,
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
export_allowed=EXPORT_ONLY_FIGURES_ALLOWED,
)
# TODO Convert this to multi series
if ns_parser:
if not helpers.check_parser_input(ns_parser, self.datasets):
return
autoces_view.display_autoces_forecast(
data=self.datasets[ns_parser.target_dataset],
dataset_name=ns_parser.target_dataset,
n_predict=ns_parser.n_days,
target_column=ns_parser.target_column,
seasonal_periods=ns_parser.seasonal_periods,
start_window=ns_parser.start_window,
forecast_horizon=ns_parser.n_days,
export=ns_parser.export,
residuals=ns_parser.residuals,
forecast_only=ns_parser.forecast_only,
start_date=ns_parser.s_start_date,
end_date=ns_parser.s_end_date,
naive=ns_parser.naive,
export_pred_raw=ns_parser.export_pred_raw,
)
# AutoETS Model
@log_start_end(log=logger)
def call_autoets(self, other_args: List[str]):
"""Process autoets command"""
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
prog="autoets",
description="""
Perform Automatic ETS (Error, Trend, Seasonality) forecast:
https://nixtla.github.io/statsforecast/examples/getting_started_with_auto_arima_and_ets.html
""",
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser,
target_dataset=True,
target_column=True,
n_days=True,
seasonal="A",
periods=True,
window=True,
residuals=True,
forecast_only=True,
start=True,
end=True,
naive=True,
export_pred_raw=True,
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
export_allowed=EXPORT_ONLY_FIGURES_ALLOWED,
)
# TODO Convert this to multi series
if ns_parser:
if not helpers.check_parser_input(ns_parser, self.datasets):
return
autoets_view.display_autoets_forecast(
data=self.datasets[ns_parser.target_dataset],
dataset_name=ns_parser.target_dataset,
n_predict=ns_parser.n_days,
target_column=ns_parser.target_column,
seasonal_periods=ns_parser.seasonal_periods,
start_window=ns_parser.start_window,
forecast_horizon=ns_parser.n_days,
export=ns_parser.export,
residuals=ns_parser.residuals,
forecast_only=ns_parser.forecast_only,
start_date=ns_parser.s_start_date,
end_date=ns_parser.s_end_date,
naive=ns_parser.naive,
export_pred_raw=ns_parser.export_pred_raw,
)
# MSTL Model
@log_start_end(log=logger)
def call_mstl(self, other_args: List[str]):
"""Process mstl command"""
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
prog="mstl",
description="""
Perform Multiple Seasonalities and Trend using Loess (MSTL) forecast:
https://nixtla.github.io/statsforecast/examples/multipleseasonalities.html
""",
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser,
target_dataset=True,
target_column=True,
n_days=True,
seasonal="A",
periods=True,
window=True,
residuals=True,
forecast_only=True,
start=True,
end=True,
naive=True,
export_pred_raw=True,
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
export_allowed=EXPORT_ONLY_FIGURES_ALLOWED,
)
# TODO Convert this to multi series
if ns_parser:
if not helpers.check_parser_input(ns_parser, self.datasets):
return
mstl_view.display_mstl_forecast(
data=self.datasets[ns_parser.target_dataset],
dataset_name=ns_parser.target_dataset,
n_predict=ns_parser.n_days,
target_column=ns_parser.target_column,
seasonal_periods=ns_parser.seasonal_periods,
start_window=ns_parser.start_window,
forecast_horizon=ns_parser.n_days,
export=ns_parser.export,
residuals=ns_parser.residuals,
forecast_only=ns_parser.forecast_only,
start_date=ns_parser.s_start_date,
end_date=ns_parser.s_end_date,
naive=ns_parser.naive,
export_pred_raw=ns_parser.export_pred_raw,
)
# RWD Model
@log_start_end(log=logger)
def call_rwd(self, other_args: List[str]):
"""Process rwd command"""
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
prog="rwd",
description="""
Perform Random Walk with Drift forecast:
https://nixtla.github.io/statsforecast/models.html#randomwalkwithdrift
""",
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser,
target_dataset=True,
target_column=True,
n_days=True,
seasonal="A",
periods=False,
window=True,
residuals=True,
forecast_only=True,
start=True,
end=True,
naive=True,
export_pred_raw=True,
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
export_allowed=EXPORT_ONLY_FIGURES_ALLOWED,
)
# TODO Convert this to multi series
if ns_parser:
if not helpers.check_parser_input(ns_parser, self.datasets):
return
rwd_view.display_rwd_forecast(
data=self.datasets[ns_parser.target_dataset],
dataset_name=ns_parser.target_dataset,
n_predict=ns_parser.n_days,
target_column=ns_parser.target_column,
start_window=ns_parser.start_window,
forecast_horizon=ns_parser.n_days,
export=ns_parser.export,
residuals=ns_parser.residuals,
forecast_only=ns_parser.forecast_only,
start_date=ns_parser.s_start_date,
end_date=ns_parser.s_end_date,
naive=ns_parser.naive,
export_pred_raw=ns_parser.export_pred_raw,
)
# SeasonalNaive Model
@log_start_end(log=logger)
def call_seasonalnaive(self, other_args: List[str]):
"""Process seasonalnaive command"""
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
prog="seasonalnaive",
description="""
Perform SeasonalNaive forecasting:
https://nixtla.github.io/statsforecast/models.html#seasonalnaive
""",
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser,
target_dataset=True,
target_column=True,
n_days=True,
seasonal="A",
periods=True,
window=True,
residuals=True,
forecast_only=True,
start=True,
end=True,
naive=True,
export_pred_raw=True,
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
export_allowed=EXPORT_ONLY_FIGURES_ALLOWED,
)
# TODO Convert this to multi series
if ns_parser:
if not helpers.check_parser_input(ns_parser, self.datasets):
return
seasonalnaive_view.display_seasonalnaive_forecast(
data=self.datasets[ns_parser.target_dataset],
dataset_name=ns_parser.target_dataset,
n_predict=ns_parser.n_days,
target_column=ns_parser.target_column,
seasonal_periods=ns_parser.seasonal_periods,
start_window=ns_parser.start_window,
forecast_horizon=ns_parser.n_days,
export=ns_parser.export,
residuals=ns_parser.residuals,
forecast_only=ns_parser.forecast_only,
start_date=ns_parser.s_start_date,
end_date=ns_parser.s_end_date,
naive=ns_parser.naive,
export_pred_raw=ns_parser.export_pred_raw,
)
# EXPO Model
@log_start_end(log=logger)
def call_expo(self, other_args: List[str]):
"""Process expo command"""
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
prog="expo",
description="""
Perform Probabilistic Exponential Smoothing forecast:
https://unit8co.github.io/darts/generated_api/darts.models.forecasting.exponential_smoothing.html
""",
)
parser.add_argument(
"--trend",
action="store",
dest="trend",
choices=expo_model.TRENDS,
default="A",
help="Trend: N: None, A: Additive, M: Multiplicative.",
)
parser.add_argument(
"--dampen",
action="store",
dest="dampen",
default="F",
help="Dampening",
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser,
target_dataset=True,
target_column=True,
n_days=True,
seasonal="A",
periods=True,
window=True,
residuals=True,
forecast_only=True,
start=True,
end=True,
naive=True,
export_pred_raw=True,
metric=True,
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
export_allowed=EXPORT_ONLY_FIGURES_ALLOWED,
)
# TODO Convert this to multi series
if ns_parser:
if not helpers.check_parser_input(ns_parser, self.datasets):
return
expo_view.display_expo_forecast(
data=self.datasets[ns_parser.target_dataset],
dataset_name=ns_parser.target_dataset,
n_predict=ns_parser.n_days,
target_column=ns_parser.target_column,
trend=ns_parser.trend,
seasonal=ns_parser.seasonal,
seasonal_periods=ns_parser.seasonal_periods,
dampen=ns_parser.dampen,
start_window=ns_parser.start_window,
forecast_horizon=ns_parser.n_days,
export=ns_parser.export,
residuals=ns_parser.residuals,
forecast_only=ns_parser.forecast_only,
start_date=ns_parser.s_start_date,
end_date=ns_parser.s_end_date,
naive=ns_parser.naive,
export_pred_raw=ns_parser.export_pred_raw,
metric=ns_parser.metric,
)
@log_start_end(log=logger)
def call_theta(self, other_args: List[str]):
"""Process theta command"""
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
prog="theta",
description="""
Perform Theta forecast:
https://unit8co.github.io/darts/generated_api/darts.models.forecasting.theta.html
""",
)
# if user does not put in --dataset
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser,
target_dataset=True,
n_days=True,
target_column=True,
seasonal="M",
periods=True,
window=True,
residuals=True,
forecast_only=True,
start=True,
end=True,
naive=True,
export_pred_raw=True,
metric=True,
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
export_allowed=EXPORT_ONLY_FIGURES_ALLOWED,
)
if ns_parser:
if not helpers.check_parser_input(ns_parser, self.datasets):
return
theta_view.display_theta_forecast(
data=self.datasets[ns_parser.target_dataset],
dataset_name=ns_parser.target_dataset,
n_predict=ns_parser.n_days,
target_column=ns_parser.target_column,
seasonal=ns_parser.seasonal,
seasonal_periods=ns_parser.seasonal_periods,
start_window=ns_parser.start_window,
forecast_horizon=ns_parser.n_days,
export=ns_parser.export,
residuals=ns_parser.residuals,
forecast_only=ns_parser.forecast_only,
start_date=ns_parser.s_start_date,
end_date=ns_parser.s_end_date,
naive=ns_parser.naive,
export_pred_raw=ns_parser.export_pred_raw,
metric=ns_parser.metric,
)
@log_start_end(log=logger)
def call_rnn(self, other_args: List[str]):
"""Process RNN command"""
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
prog="rnn",
description="""
Perform RNN forecast (Vanilla RNN, LSTM, GRU):
https://unit8co.github.io/darts/generated_api/darts.models.forecasting.rnn_model.html
""",
)
# RNN Hyperparameters
parser.add_argument(
"--hidden-dim",
action="store",
dest="hidden_dim",
default=20,
type=check_positive,
help="Size for feature maps for each hidden RNN layer (h_n)",
)
parser.add_argument(
"--training_length",
action="store",
dest="training_length",
default=20,
type=check_positive,
help="""The length of both input (target and covariates) and output (target) time series used during training.
Generally speaking, training_length should have a higher value than input_chunk_length because otherwise
during training the RNN is never run for as many iterations as it will during training.""",
)
# if user does not put in --dataset
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser,
target_dataset=True,
n_days=True,
target_column=True,
train_split=True,
input_chunk_length=True,
force_reset=True,
save_checkpoints=True,
model_save_name="rnn_model",
n_epochs=True,
model_type=True,
dropout=0,
batch_size=32,
learning_rate=True,
residuals=True,
forecast_only=True,
start=True,
end=True,
naive=True,
export_pred_raw=True,
metric=True,
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
export_allowed=EXPORT_ONLY_FIGURES_ALLOWED,
)
if ns_parser:
if not helpers.check_parser_input(ns_parser, self.datasets):
return
rnn_view.display_rnn_forecast(
data=self.datasets[ns_parser.target_dataset],
dataset_name=ns_parser.target_dataset,
n_predict=ns_parser.n_days,
target_column=ns_parser.target_column,
train_split=ns_parser.train_split,
forecast_horizon=ns_parser.n_days,
model_type=ns_parser.model_type,
hidden_dim=ns_parser.hidden_dim,
dropout=ns_parser.dropout,
batch_size=ns_parser.batch_size,
n_epochs=ns_parser.n_epochs,
learning_rate=ns_parser.learning_rate,
model_save_name=ns_parser.model_save_name,
training_length=ns_parser.training_length,
input_chunk_size=ns_parser.input_chunk_length,
force_reset=ns_parser.force_reset,
save_checkpoints=ns_parser.save_checkpoints,
export=ns_parser.export,
residuals=ns_parser.residuals,
forecast_only=ns_parser.forecast_only,
start_date=ns_parser.s_start_date,
end_date=ns_parser.s_end_date,
naive=ns_parser.naive,
export_pred_raw=ns_parser.export_pred_raw,
metric=ns_parser.metric,
)
@log_start_end(log=logger)
def call_nbeats(self, other_args: List[str]):
"""Process NBEATS command"""
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
prog="nbeats",
description="""
Perform NBEATS forecast (Neural Bayesian Estimation of Time Series):
https://unit8co.github.io/darts/generated_api/darts.models.forecasting.nbeats.html
""",
)
# NBEATS Hyperparameters
parser.add_argument(
"--num_stacks",
action="store",
dest="num_stacks",
default=10,
type=check_positive_float,
help="The number of stacks that make up the whole model.",
)
parser.add_argument(
"--num_blocks",
action="store",
dest="num_blocks",
default=3,
type=check_positive,
help="The number of blocks making up every stack.",
)
parser.add_argument(
"--num_layers",
action="store",
dest="num_layers",
default=4,
type=check_positive,
help="""The number of fully connected layers preceding the final forking layers
in each block of every stack.""",
)
parser.add_argument(
"--layer_widths",
action="store",
dest="layer_widths",
default=512,
type=check_positive,
help="""Determines the number of neurons that make up each fully connected layer
in each block of every stack""",
)
# if user does not put in --dataset
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser,
target_dataset=True,
n_days=True,
target_column=True,
train_split=True,
input_chunk_length=True,
output_chunk_length=True,
save_checkpoints=True,
force_reset=True,
model_save_name="nbeats_model",
learning_rate=True,
n_epochs=True,
batch_size=800,
past_covariates=True,
all_past_covariates=True,
residuals=True,
forecast_only=True,
start=True,
end=True,
naive=True,
export_pred_raw=True,
metric=True,
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
export_allowed=EXPORT_ONLY_FIGURES_ALLOWED,
)
if ns_parser:
if not helpers.check_parser_input(ns_parser, self.datasets):
return
covariates = helpers.clean_covariates(
ns_parser, self.datasets[ns_parser.target_dataset]
)
nbeats_view.display_nbeats_forecast(
data=self.datasets[ns_parser.target_dataset],
dataset_name=ns_parser.target_dataset,
n_predict=ns_parser.n_days,
target_column=ns_parser.target_column,
past_covariates=covariates,
train_split=ns_parser.train_split,
forecast_horizon=ns_parser.n_days,
input_chunk_length=ns_parser.input_chunk_length,
output_chunk_length=ns_parser.output_chunk_length,
num_stacks=ns_parser.num_stacks,
num_blocks=ns_parser.num_blocks,
num_layers=ns_parser.num_layers,
layer_widths=ns_parser.layer_widths,
batch_size=ns_parser.batch_size,
n_epochs=ns_parser.n_epochs,
learning_rate=ns_parser.learning_rate,
model_save_name=ns_parser.model_save_name,
force_reset=ns_parser.force_reset,
save_checkpoints=ns_parser.save_checkpoints,
export=ns_parser.export,
residuals=ns_parser.residuals,
forecast_only=ns_parser.forecast_only,
start_date=ns_parser.s_start_date,
end_date=ns_parser.s_end_date,
naive=ns_parser.naive,
export_pred_raw=ns_parser.export_pred_raw,
metric=ns_parser.metric,
)
@log_start_end(log=logger)
def call_tcn(self, other_args: List[str]):
"""Process TCN command"""
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
prog="tcn",
description="""
Perform TCN forecast:
https://unit8co.github.io/darts/generated_api/darts.models.forecasting.tcn_model.html
""",
)
# TCN Hyperparameters
parser.add_argument(
"--num-filters",
action="store",
dest="num_filters",
default=3,
type=check_positive,
help="The number of filters in a convolutional layer of the TCN",
)
parser.add_argument(
"--weight-norm",
action="store",
dest="weight_norm",
default=True,
type=bool,
help="Boolean value indicating whether to use weight normalization.",
)
parser.add_argument(
"--dilation-base",
action="store",
dest="dilation_base",
default=2,
type=check_positive,
help="The base of the exponent that will determine the dilation on every level.",
)
# if user does not put in --dataset
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser,
target_dataset=True,
n_days=True,
target_column=True,
train_split=True,
past_covariates=True,
all_past_covariates=True,
save_checkpoints=True,
force_reset=True,
model_save_name="tcn_model",
learning_rate=True,
n_epochs=True,
dropout=0.1,
batch_size=32,
input_chunk_length=True,
output_chunk_length=True,
residuals=True,
forecast_only=True,
start=True,
end=True,
naive=True,
export_pred_raw=True,
metric=True,
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
export_allowed=EXPORT_ONLY_FIGURES_ALLOWED,
)
if ns_parser:
# check proper file name is provided
if not helpers.check_parser_input(ns_parser, self.datasets):
return
covariates = helpers.clean_covariates(
ns_parser, self.datasets[ns_parser.target_dataset]
)
tcn_view.display_tcn_forecast(
data=self.datasets[ns_parser.target_dataset],
dataset_name=ns_parser.target_dataset,
n_predict=ns_parser.n_days,
target_column=ns_parser.target_column,
past_covariates=covariates,
train_split=ns_parser.train_split,
forecast_horizon=ns_parser.n_days,
input_chunk_length=ns_parser.input_chunk_length,
output_chunk_length=ns_parser.output_chunk_length,
dropout=ns_parser.dropout,
num_filters=ns_parser.num_filters,
weight_norm=ns_parser.weight_norm,
dilation_base=ns_parser.dilation_base,
batch_size=ns_parser.batch_size,
n_epochs=ns_parser.n_epochs,
learning_rate=ns_parser.learning_rate,
model_save_name=ns_parser.model_save_name,
force_reset=ns_parser.force_reset,
save_checkpoints=ns_parser.save_checkpoints,
export=ns_parser.export,
residuals=ns_parser.residuals,
forecast_only=ns_parser.forecast_only,
start_date=ns_parser.s_start_date,
end_date=ns_parser.s_end_date,
naive=ns_parser.naive,
export_pred_raw=ns_parser.export_pred_raw,
metric=ns_parser.metric,
)
@log_start_end(log=logger)
def call_regr(self, other_args: List[str]):
"""Process REGR command"""
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
prog="regr",
description="""
Perform a regression forecast:
https://unit8co.github.io/darts/generated_api/darts.models.forecasting.regression_model.html
""",
)
# if user does not put in --dataset
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser,
output_chunk_length=True,
train_split=True,
past_covariates=True,
all_past_covariates=True,
n_days=True,
target_dataset=True,
target_column=True,
lags=True,
residuals=True,
forecast_only=True,
start=True,
end=True,
naive=True,
explainability_raw=True,
export_pred_raw=True,
metric=True,
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
export_allowed=EXPORT_ONLY_FIGURES_ALLOWED,
)
if ns_parser:
# check proper file name is provided
if not helpers.check_parser_input(ns_parser, self.datasets):
return
covariates = helpers.clean_covariates(
ns_parser, self.datasets[ns_parser.target_dataset]
)
regr_view.display_regression(
data=self.datasets[ns_parser.target_dataset],
dataset_name=ns_parser.target_dataset,
n_predict=ns_parser.n_days,
target_column=ns_parser.target_column,
past_covariates=covariates,
train_split=ns_parser.train_split,
forecast_horizon=ns_parser.n_days,
output_chunk_length=ns_parser.output_chunk_length,
lags=ns_parser.lags,
export=ns_parser.export,
residuals=ns_parser.residuals,
forecast_only=ns_parser.forecast_only,
start_date=ns_parser.s_start_date,
end_date=ns_parser.s_end_date,
naive=ns_parser.naive,
explainability_raw=ns_parser.explainability_raw,
export_pred_raw=ns_parser.export_pred_raw,
metric=ns_parser.metric,
)
@log_start_end(log=logger)
def call_linregr(self, other_args: List[str]):
"""Process LINREGR command"""
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
prog="linregr",
description="""
Perform a linear regression forecast:
https://unit8co.github.io/darts/generated_api/darts.models.forecasting.linear_regression_model.html
""",
)
# if user does not put in --dataset
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser,
lags=True,
output_chunk_length=True,
train_split=True,
past_covariates=True,
all_past_covariates=True,
target_column=True,
n_days=True,
target_dataset=True,
residuals=True,
forecast_only=True,
start=True,
end=True,
naive=True,
explainability_raw=True,
export_pred_raw=True,
metric=True,
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
export_allowed=EXPORT_ONLY_FIGURES_ALLOWED,
)
if ns_parser:
if not helpers.check_parser_input(ns_parser, self.datasets):
return
covariates = helpers.clean_covariates(
ns_parser, self.datasets[ns_parser.target_dataset]
)
linregr_view.display_linear_regression(
data=self.datasets[ns_parser.target_dataset],
dataset_name=ns_parser.target_dataset,
n_predict=ns_parser.n_days,
target_column=ns_parser.target_column,
past_covariates=covariates,
train_split=ns_parser.train_split,
forecast_horizon=ns_parser.n_days,
output_chunk_length=ns_parser.output_chunk_length,
lags=ns_parser.lags,
export=ns_parser.export,
residuals=ns_parser.residuals,
forecast_only=ns_parser.forecast_only,
start_date=ns_parser.s_start_date,
end_date=ns_parser.s_end_date,
naive=ns_parser.naive,
explainability_raw=ns_parser.explainability_raw,
export_pred_raw=ns_parser.export_pred_raw,
metric=ns_parser.metric,
)
@log_start_end(log=logger)
def call_brnn(self, other_args: List[str]):
"""Process BRNN command"""
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
prog="brnn",
description="""
Perform BRNN forecast (Vanilla RNN, LSTM, GRU):
https://unit8co.github.io/darts/generated_api/darts.models.forecasting.block_rnn_model.html
""",
)
# BRNN Hyperparameters
parser.add_argument(
"--n-rnn-layers",
action="store",
dest="n_rnn_layers",
default=1,
type=check_positive,
help="Number of layers in the RNN module.",
)
# if user does not put in --dataset
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser,
save_checkpoints=True,
force_reset=True,
model_save_name="brnn_model",
learning_rate=True,
n_epochs=True,
batch_size=32,
dropout=0,
input_chunk_length=True,
output_chunk_length=True,
model_type=True,
train_split=True,
past_covariates=True,
all_past_covariates=True,
target_dataset=True,
n_days=True,
target_column=True,
residuals=True,
forecast_only=True,
start=True,
end=True,
naive=True,
export_pred_raw=True,
metric=True,
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
export_allowed=EXPORT_ONLY_FIGURES_ALLOWED,
)
if ns_parser:
if not helpers.check_parser_input(ns_parser, self.datasets):
return
covariates = helpers.clean_covariates(
ns_parser, self.datasets[ns_parser.target_dataset]
)
brnn_view.display_brnn_forecast(
data=self.datasets[ns_parser.target_dataset],
dataset_name=ns_parser.target_dataset,
n_predict=ns_parser.n_days,
target_column=ns_parser.target_column,
past_covariates=covariates,
train_split=ns_parser.train_split,
forecast_horizon=ns_parser.n_days,
input_chunk_length=ns_parser.input_chunk_length,
output_chunk_length=ns_parser.output_chunk_length,
model_type=ns_parser.model_type,
n_rnn_layers=ns_parser.n_rnn_layers,
dropout=ns_parser.dropout,
batch_size=ns_parser.batch_size,
n_epochs=ns_parser.n_epochs,
learning_rate=ns_parser.learning_rate,
model_save_name=ns_parser.model_save_name,
force_reset=ns_parser.force_reset,
save_checkpoints=ns_parser.save_checkpoints,
export=ns_parser.export,
residuals=ns_parser.residuals,
forecast_only=ns_parser.forecast_only,
start_date=ns_parser.s_start_date,
end_date=ns_parser.s_end_date,
naive=ns_parser.naive,
export_pred_raw=ns_parser.export_pred_raw,
metric=ns_parser.metric,
)
@log_start_end(log=logger)
def call_trans(self, other_args: List[str]):
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
prog="trans",
description="""
Perform Transformer Forecast:
https://unit8co.github.io/darts/generated_api/darts.models.forecasting.transformer_model.html
""",
)
parser.add_argument(
"--d-model",
action="store",
dest="d_model",
default=64,
type=check_positive,
help="Number of expected features in inputs.",
)
parser.add_argument(
"--nhead",
action="store",
dest="nhead",
default=4,
type=check_positive,
help="Number of head in the attention mechanism.",
)
parser.add_argument(
"--num_encoder_layers",
action="store",
dest="num_encoder_layers",
default=3,
type=check_positive,
help="The number of encoder layers in the encoder.",
)
parser.add_argument(
"--num_decoder_layers",
action="store",
dest="num_decoder_layers",
default=3,
type=check_positive,
help="The number of decoder layers in the encoder.",
)
parser.add_argument(
"--dim_feedforward",
action="store",
dest="dim_feedforward",
default=512,
type=check_positive,
help="The dimension of the feedforward model.",
)
parser.add_argument(
"--activation",
action="store",
dest="activation",
default="relu",
choices=["relu", "gelu"],
type=str,
help="Number of LSTM layers.",
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser,
n_days=True,
target_column=True,
target_dataset=True,
past_covariates=True,
all_past_covariates=True,
train_split=True,
input_chunk_length=True,
output_chunk_length=True,
dropout=0,
batch_size=32,
n_epochs=True,
model_save_name="trans_model",
force_reset=True,
save_checkpoints=True,
residuals=True,
forecast_only=True,
start=True,
end=True,
naive=True,
export_pred_raw=True,
metric=True,
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
export_allowed=EXPORT_ONLY_FIGURES_ALLOWED,
)
if ns_parser:
if not helpers.check_parser_input(ns_parser, self.datasets):
return
covariates = helpers.clean_covariates(
ns_parser, self.datasets[ns_parser.target_dataset]
)
trans_view.display_trans_forecast(
data=self.datasets[ns_parser.target_dataset],
dataset_name=ns_parser.target_dataset,
n_predict=ns_parser.n_days,
target_column=ns_parser.target_column,
past_covariates=covariates,
train_split=ns_parser.train_split,
forecast_horizon=ns_parser.n_days,
input_chunk_length=ns_parser.input_chunk_length,
output_chunk_length=ns_parser.output_chunk_length,
d_model=ns_parser.d_model,
nhead=ns_parser.nhead,
num_encoder_layers=ns_parser.num_encoder_layers,
num_decoder_layers=ns_parser.num_decoder_layers,
dim_feedforward=ns_parser.dim_feedforward,
activation=ns_parser.activation,
dropout=ns_parser.dropout,
n_epochs=ns_parser.n_epochs,
batch_size=ns_parser.batch_size,
model_save_name=ns_parser.model_save_name,
force_reset=ns_parser.force_reset,
save_checkpoints=ns_parser.save_checkpoints,
export=ns_parser.export,
residuals=ns_parser.residuals,
forecast_only=ns_parser.forecast_only,
start_date=ns_parser.s_start_date,
end_date=ns_parser.s_end_date,
naive=ns_parser.naive,
export_pred_raw=ns_parser.export_pred_raw,
metric=ns_parser.metric,
)
@log_start_end(log=logger)
def call_tft(self, other_args: List[str]):
"""Process TFT command"""
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
prog="tft",
description="""
Perform TFT forecast (Temporal Fusion Transformer):
https://unit8co.github.io/darts/generated_api/darts.models.forecasting.tft_model.html
""",
)
parser.add_argument(
"--lstm-layers",
action="store",
dest="lstm_layers",
default=1,
type=check_positive,
help="Number of LSTM layers.",
)
parser.add_argument(
"--num-attention-heads",
action="store",
dest="num_attention_heads",
default=4,
type=check_positive,
help="Number of attention heads.",
)
parser.add_argument(
"--full-attention",
action="store_true",
dest="full_attention",
default=False,
help="Whether to apply a multi-head attention query.",
)
parser.add_argument(
"--hidden-continuous-size",
action="store",
dest="hidden_continuous_size",
default=8,
type=check_positive,
help="Default hidden size for processing continuous variables.",
)
# if user does not put in --dataset
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser,
save_checkpoints=True,
target_dataset=True,
n_days=True,
force_reset=True,
model_save_name="tft_model",
train_split=True,
hidden_size=16,
batch_size=32,
n_epochs=True,
dropout=0.1,
input_chunk_length=True,
output_chunk_length=True,
past_covariates=True,
all_past_covariates=True,
target_column=True,
residuals=True,
forecast_only=True,
start=True,
end=True,
naive=True,
export_pred_raw=True,
metric=True,
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
export_allowed=EXPORT_ONLY_FIGURES_ALLOWED,
)
if ns_parser:
if not helpers.check_parser_input(ns_parser, self.datasets):
return
covariates = helpers.clean_covariates(
ns_parser, self.datasets[ns_parser.target_dataset]
)
tft_view.display_tft_forecast(
data=self.datasets[ns_parser.target_dataset],
dataset_name=ns_parser.target_dataset,
n_predict=ns_parser.n_days,
target_column=ns_parser.target_column,
past_covariates=covariates,
train_split=ns_parser.train_split,
forecast_horizon=ns_parser.n_days,
input_chunk_length=ns_parser.input_chunk_length,
output_chunk_length=ns_parser.output_chunk_length,
hidden_size=ns_parser.hidden_size,
lstm_layers=ns_parser.lstm_layers,
num_attention_heads=ns_parser.num_attention_heads,
full_attention=ns_parser.full_attention,
dropout=ns_parser.dropout,
hidden_continuous_size=ns_parser.hidden_continuous_size,
n_epochs=ns_parser.n_epochs,
batch_size=ns_parser.batch_size,
model_save_name=ns_parser.model_save_name,
force_reset=ns_parser.force_reset,
save_checkpoints=ns_parser.save_checkpoints,
export=ns_parser.export,
residuals=ns_parser.residuals,
forecast_only=ns_parser.forecast_only,
start_date=ns_parser.s_start_date,
end_date=ns_parser.s_end_date,
naive=ns_parser.naive,
export_pred_raw=ns_parser.export_pred_raw,
metric=ns_parser.metric,
)
@log_start_end(log=logger)
def call_nhits(self, other_args: List[str]):
"""Process nhits command"""
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
prog="nhits",
description="""
Perform nhits forecast:
https://unit8co.github.io/darts/generated_api/darts.models.forecasting.tft_model.html
""",
)
parser.add_argument(
"--num-stacks",
dest="num_stacks",
type=check_positive,
default=3,
help="The number of stacks that make up the model",
)
parser.add_argument(
"--num-blocks",
dest="num_blocks",
type=check_positive,
default=1,
help="The number of blocks making up every stack",
)
parser.add_argument(
"--num-layers",
dest="num_layers",
type=check_positive,
default=2,
help="The number of fully connected layers",
)
parser.add_argument(
"--layer_widths",
dest="layer_widths",
type=check_positive,
default=512,
help="The number of neurons in each layer",
)
parser.add_argument(
"--activation",
dest="activation",
type=str,
default="ReLU",
choices=[
"ReLU",
"RReLU",
"PReLU",
"Softplus",
"Tanh",
"SELU",
"LeakyReLU",
"Sigmoid",
],
help="The desired activation",
)
parser.add_argument(
"--max_pool_1d",
action="store_true",
dest="maxpool1d",
default=True,
help="Whether to use max_pool_1d or AvgPool1d",
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser,
save_checkpoints=True,
target_dataset=True,
n_days=True,
force_reset=True,
model_save_name="nhits_model",
train_split=True,
dropout=0.1,
input_chunk_length=True,
output_chunk_length=True,
batch_size=32,
n_epochs=True,
past_covariates=True,
all_past_covariates=True,
target_column=True,
residuals=True,
forecast_only=True,
start=True,
end=True,
naive=True,
export_pred_raw=True,
metric=True,
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
export_allowed=EXPORT_ONLY_FIGURES_ALLOWED,
)
if ns_parser:
if not helpers.check_parser_input(ns_parser, self.datasets):
return
covariates = helpers.clean_covariates(
ns_parser, self.datasets[ns_parser.target_dataset]
)
nhits_view.display_nhits_forecast(
data=self.datasets[ns_parser.target_dataset],
dataset_name=ns_parser.target_dataset,
n_predict=ns_parser.n_days,
target_column=ns_parser.target_column,
past_covariates=covariates,
train_split=ns_parser.train_split,
forecast_horizon=ns_parser.n_days,
input_chunk_length=ns_parser.input_chunk_length,
output_chunk_length=ns_parser.output_chunk_length,
num_stacks=ns_parser.num_stacks,
num_blocks=ns_parser.num_blocks,
num_layers=ns_parser.num_layers,
layer_widths=ns_parser.layer_widths,
activation=ns_parser.activation,
max_pool_1d=ns_parser.maxpool1d,
batch_size=ns_parser.batch_size,
n_epochs=ns_parser.n_epochs,
dropout=ns_parser.dropout,
model_save_name=ns_parser.model_save_name,
force_reset=ns_parser.force_reset,
save_checkpoints=ns_parser.save_checkpoints,
export=ns_parser.export,
residuals=ns_parser.residuals,
forecast_only=ns_parser.forecast_only,
start_date=ns_parser.s_start_date,
end_date=ns_parser.s_end_date,
naive=ns_parser.naive,
export_pred_raw=ns_parser.export_pred_raw,
metric=ns_parser.metric,
)
@log_start_end(log=logger)
def call_anom(self, other_args: List[str]):
"""Process ANOM command"""
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
prog="anom",
description="""
Perform a Quantile Anomaly detection on a given dataset:
https://unit8co.github.io/darts/generated_api/darts.ad.detectors.quantile_detector.html
""",
)
# if user does not put in --dataset
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
parser = self.add_standard_args(
parser,
train_split=True,
target_column=True,
target_dataset=True,
forecast_only=True,
start=True,
end=True,
)
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
export_allowed=EXPORT_ONLY_FIGURES_ALLOWED,
)
if ns_parser:
if not helpers.check_parser_input(ns_parser, self.datasets):
return
anom_view.display_anomaly_detection(
data=self.datasets[ns_parser.target_dataset],
dataset_name=ns_parser.target_dataset,
target_column=ns_parser.target_column,
train_split=ns_parser.train_split,
export=ns_parser.export,
start_date=ns_parser.s_start_date,
end_date=ns_parser.s_end_date,
)
@log_start_end(log=logger)
def call_whisper(self, other_args: List[str]):
"""Utilize Whisper Model to transcribe a video. Currently only supports Youtube URLS"""
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
prog="whisper",
description="""
Utilize Whisper Model to transcribe a video. Currently only supports Youtube URLS:
https://github.com/openai/whisper
""",
)
parser.add_argument(
"--video",
dest="video",
type=str,
default="",
help="video URLs to transcribe",
)
parser.add_argument(
"--model_name",
dest="model_name",
choices=whisper.available_models(),
default="base",
help="name of the Whisper model to use",
)
parser.add_argument(
"--subtitles_format",
dest="subtitles_format",
type=str,
choices=["vtt", "srt"],
help="the subtitle format to output",
)
parser.add_argument(
"--verbose",
dest="verbose",
type=str2bool,
default=False,
help="Whether to print out the progress and debug messages",
)
parser.add_argument(
"--task",
dest="task",
type=str,
choices=["transcribe", "translate"],
help="whether to perform X->X speech recognition ('transcribe') or X->English translation ('translate')",
)
parser.add_argument(
"--language",
dest="language",
type=str,
default=None,
choices=sorted(LANGUAGES.keys())
+ sorted([k.title() for k in TO_LANGUAGE_CODE.keys()]),
help="language spoken in the audio, skip to perform language detection",
)
parser.add_argument(
"--breaklines",
dest="breaklines",
type=int,
default=0,
help="Whether to break lines into a bottom-heavy pyramid shape if line length exceeds N characters. 0 disables line breaking.",
)
parser.add_argument(
"--save",
dest="save",
type=str,
default=get_current_user().preferences.USER_FORECAST_WHISPER_DIRECTORY,
help="Directory to save the subtitles file",
)
parser = self.add_standard_args(
parser,
)
if other_args and "--video" not in other_args:
other_args.insert(0, "--video")
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
)
if ns_parser:
if ns_parser.save is None:
ns_parser.save = (
get_current_user().preferences.USER_FORECAST_WHISPER_DIRECTORY
)
whisper_model.transcribe_and_summarize(
video=ns_parser.video,
model_name=ns_parser.model_name,
subtitles_format=ns_parser.subtitles_format,
verbose=ns_parser.verbose,
task=ns_parser.task,
language=ns_parser.language,
breaklines=ns_parser.breaklines,
output_dir=ns_parser.save,
)
# TimeGPT Model
@log_start_end(log=logger)
def call_timegpt(self, other_args: List[str]):
"""Process expo command"""
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
add_help=False,
prog="timegpt",
description="""
TODO: Update me
""",
)
parser.add_argument(
"--horizon",
action="store",
dest="horizon",
type=check_positive,
default=12,
help="Forecasting horizon",
)
parser.add_argument(
"--freq",
action="store",
dest="freq",
choices=["H", "D", "W", "M", "MS", "B"],
default=None,
help="Frequency of the data.",
)
parser.add_argument(
"--finetune",
action="store",
dest="finetune",
type=check_non_negative,
default=0,
help="Number of steps used to finetune TimeGPT in the new data.",
)
parser.add_argument(
"--ci",
action="store",
dest="confidence",
type=check_positive_float_list,
default=[80, 90],
help="Number of steps used to finetune TimeGPT in the new data.",
)
parser.add_argument(
"--cleanex",
action="store_false",
help="Clean exogenous signal before making forecasts using TimeGPT.",
dest="cleanex",
default=True,
)
parser.add_argument(
"--timecol",
action="store",
dest="timecol",
default="ds",
type=str,
help="Dataframe column that represents datetime",
)
parser.add_argument(
"--targetcol",
action="store",
dest="targetcol",
default="y",
type=str,
help="Dataframe column that represents the target to forecast for",
)
parser.add_argument(
"--sheet-name",
help="The name of the sheet to export to when type is XLSX.",
dest="sheet_name",
type=str,
default="",
)
parser.add_argument(
"--datefeatures",
help="Specifies which date attributes have highest weight according to model.",
dest="date_features",
type=check_list_values(["auto", "year", "month", "week", "day", "weekday"]),
default=[],
)
parser = self.add_standard_args(
parser,
target_dataset=True,
target_column=True,
start=True,
end=True,
residuals=True,
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "--dataset")
ns_parser = self.parse_known_args_and_warn(
parser,
other_args,
export_allowed=EXPORT_ONLY_FIGURES_ALLOWED,
)
if ns_parser:
timegpt_view.display_timegpt_forecast(
data=self.datasets[ns_parser.target_dataset],
dataset_name=ns_parser.target_dataset,
time_col=ns_parser.timecol,
target_col=ns_parser.targetcol,
forecast_horizon=ns_parser.horizon,
freq=ns_parser.freq,
levels=ns_parser.confidence,
finetune_steps=ns_parser.finetune,
clean_ex_first=ns_parser.cleanex,
export=ns_parser.export,
sheet_name=ns_parser.sheet_name,
start_date=ns_parser.s_start_date,
end_date=ns_parser.s_end_date,
residuals=ns_parser.residuals,
date_features=ns_parser.date_features,
)