* Added github actions for gitflow * Minor changes * Fix plot look when using eval and add query to choices (#3881) (#3898) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> * Testing Gitflow (#3899) * testing gitflow * Name changes * Testing python changes * Added Checkout to Base test * Feature/gitflow (#3900) * Fix plot look when using eval and add query to choices (#3881) (#3901) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> * Gitflow Implementations (#3902) * testing gitflow * Name changes * Testing python changes * Added Checkout to Base test * More minor fixes for merge * Minor fix * Added nightly build * Gitflow Implementations (#3904) * testing gitflow * Name changes * Testing python changes * Added Checkout to Base test * More minor fixes for merge * Minor fix * Added nightly build * Testing Merge * Main --> develop (#3906) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> * GItflow Implementations (#3909) * testing gitflow * Name changes * Testing python changes * Added Checkout to Base test * More minor fixes for merge * Minor fix * Added nightly build * Testing Merge * Merge error fix * Feature/gitflow (#3911) * testing gitflow * Name changes * Testing python changes * Added Checkout to Base test * More minor fixes for merge * Minor fix * Added nightly build * Testing Merge * Merge error fix * Merge fix * merge fix * Merge fix * Merge fix * Merge fix * merge fix * Update develop (#3913) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> * Feature/gitflow (#3914) * testing gitflow * Name changes * Testing python changes * Added Checkout to Base test * More minor fixes for merge * Minor fix * Added nightly build * Testing Merge * Merge error fix * Merge fix * merge fix * Merge fix * Merge fix * Merge fix * merge fix * [Gitflow] - Minor fix * Feature/gitflow (#3921) * testing gitflow * Name changes * Testing python changes * Added Checkout to Base test * More minor fixes for merge * Minor fix * Added nightly build * Testing Merge * Merge error fix * Merge fix * merge fix * Merge fix * Merge fix * Merge fix * merge fix * [Gitflow] - Minor fix * Feature/gitflow (#3914) (#3915) * testing gitflow * Name changes * Testing python changes * Added Checkout to Base test * More minor fixes for merge * Minor fix * Added nightly build * Testing Merge * Merge error fix * Merge fix * merge fix * Merge fix * Merge fix * Merge fix * merge fix * [Gitflow] - Minor fix * Nightly build feature * Added branch name docs * poetry add ccxt@latest (#3920) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * poetry add ccxt@latest Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> * Add crypto dd functions to sdk (#3888) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Add crypto dd functions to sdk * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * Fixes currency and trailmap Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> * Integration tests refactor (#3781) * generate integration tests report * new console report * simple run_scripts * move tests script to folder * add skipping * always display skips * func name * allow running from relative path * rename some vars and time * typo * change portfolio supress and warning * uncomment economy test * rename test controller * multiprocessing * display test progress and available * rename func * mypy * should not be here * small changes * type hinting and docstrings * new subprocesses default * forget context and chunksize * clean len skipt * small comment * fix subproc default with v * minor change * fix path * better this way * make output visible * allow only sequential run with verbose mode * change message * detail * include andrew idea * limit multiprocessing to clone version * fix for package application * must be up here * allow verbose with multiprocessing but warn * update readme * move tests to core * Update README.md * Update README.md * move readme outside * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * parse subproc arg * Update README.md * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * Delete glossary base command * move scripts * ruff * update pyproject.toml * update yfinance * fix futures and economy test, rewrite * rewrite stocks test yfinance dependent * refactor sia to yfinance 0.2... * fix last failing sia tests * black * update reqs Co-authored-by: James Maslek <jmaslek11@gmail.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: Chavithra PARANA <chavithra@gmail.com> * Gitflow - Autodoc (#3922) * Hotfix/dots sources (#3928) * fix: wordwrap * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * fix: str Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> * Update dependency: grpcio (#3937) * Update grpcio * Revert "Update grpcio" This reverts commit 676c50a2bdde5ca64614bddd3eaebbccd68c5994. * Update dependencies * Rebase develop? (#3935) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> * Update installation guides with videos (#3903) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Update installation guides with videos * Add fix for Ruff crashing * Me no longer do what James said * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Jeroen Bouma <jeroenbouma@Jeroens-MacBook-Pro.local> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> * broken link (#3889) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * broken link due to quandl.com redirecting to nasdaq.com, for the link to work and get the appropiate API key you need to remove the period at the end of this link... Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: james <jmaslek11@gmail.com> * Issue #3882 Fixed (#3885) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Issue #3882 Fixed * 2 files reformatted by black * tests added * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * fixed mypy errors Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> * GitFlow - improve check for changes (#3948) Gitflow Implementation * Rewrite and skip yfinance tests (#3953) * economy * fix futures * fix stocks tests * skip unfixable tests * fix ark * Fixed failing badge not used anymore (#3932) Co-authored-by: James Maslek <jmaslek11@gmail.com> * Fix portfolio returns (#3931) * fix inception bug and clean some useless attributes * reorder attributes * add returns and cumulative returns * fix cumulative returns * fix cumulative returns * remove cumulative ret * add some doc and encapsule methods * order detail * add more details on docstrings * wrong docstring * add commnet * Update portfolio_engine.py * fix bug with unsupported type * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * fix table header * fix portfolio integration test * ruff * fix tests * rewrite yfinance call * fix test_draw * test_stocks_helper * bt model * fix comp analysis * fix ftd * fix dd * fix screener Co-authored-by: James Maslek <jmaslek11@gmail.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt> * Put yf.info behind an exchange flag on `load` (#3951) * Put yf.info behind an exchange flag * Guides Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> * Last Price Bug into Previous Close #3865 (#3949) Co-authored-by: James Maslek <jmaslek11@gmail.com> * Add multiple countries option to events (#3938) * allow multiple countries in events cmd * fix test * fix last test * black Co-authored-by: James Maslek <jmaslek11@gmail.com> * Minor Fix for branch name check (#3979) * Gitflow - Added manual trigger to Linting (#3981) * Minor Fix for branch name check * added manual trigger to linting * Linting fix (#3984) Linting fix * Feature/macro convert (#3924) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Issue #3882 Fixed * 2 files reformatted by black * tests added * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * fixed mypy errors * Fixed parser options for currency conversion Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> * Update sma.md (#3956) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * Update sma.md Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> * Update overlap_model.py (#3955) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * Update overlap_model.py Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> * Update vwap.md (#3971) Co-authored-by: James Maslek <jmaslek11@gmail.com> * Update overlap_model.py - wrong typehint (#3970) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * Update overlap_model.py Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> * Bump yfinance to 0.2.4 and fix tests (#3977) * upgrade yfinance to 0.2.4 * fix some tests failing bc yfinance new date format * fix remaining tests * fix tests * rewrite failing test * black * rerecord test * fix get_1y_sp500 test * missing import here Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt> Co-authored-by: James Maslek <jmaslek11@gmail.com> * Add extra error handling for yf in etf (#3985) * Fix the news command and making it more stable (#3965) Co-authored-by: James Maslek <jmaslek11@gmail.com> * Hotfix/bug #3945 (#3963) * Add exception to http requests made by ftd * Formatting Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> * Fix #3787 (#3966) Make the get_equal_weights handle portfolio's with stock's filtered out, due to the stocks having to many NaNs. Co-authored-by: James Maslek <jmaslek11@gmail.com> * Add ticker to the load export file (#3997) * bump * Change export name to have the ticker * revert yaml * Feature/release branch gitflow (#3998) * release branch gitflow implentation * Fix integration tests bugs (#3993) * fix tk * fix newsletters * fix lt * exception on pir * fix attrib bug and remove warning * fix earnings * fix ins, lt, whatif * fillna * fix vis Co-authored-by: James Maslek <jmaslek11@gmail.com> * change .env loading priority (#4005) * [FIX] Pytorch-lightning trainer conflict with TQDM progress bar (#4002) * fix for tqdm progress bar conflict * fix tests Co-authored-by: James Maslek <jmaslek11@gmail.com> * bump * Fix historical futures plot axes (#4006) * change start date to model * rewrite test * ruff * add end date * move futures and update test * return if wrong dates * fix controller test * record mode rewrite model and view Co-authored-by: James Maslek <jmaslek11@gmail.com> * Fix M1 build (#4010) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * adding xgboost explicitly * testing juan sugestion * removing unncessary stuff that the hook deals with Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> * merge the release changes into develop (#4016) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * bump * Update release branch * revert conda yaml * logging hash * Update version number * Added scipy to intel * Add xgboost to intel * add scipy libs to windows only * add scipy sparse * update scipy and pywin * update tests * UPdate installation.md to reflect 2.2 * fix yf unit tests * Try to get futures tests working * Ignore tz in yf download * Found another end date needed * delelte yf cache Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: Chavithra PARANA <chavithra@gmail.com> Co-authored-by: luqazino@gmail.com <luqazino@gmail.com> Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt> * Adds filings function to the Stocks menu (#3910) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * adds filings function * Updates test_print_help.txt * Adds new filings function to SDK documentation. * updates Stocks Menu screenshot to include `filings` * updating unit testing * requested changes * more changes * black * removed a trail here that should have stayed local * adds export flag * correction Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> * Feature - Added Integration Test Automation (#4019) Added integration test to release branch Nightly build on develop branch * Feature/excel sheets (#4023) * bump * Add sheet name to export for base load function * Disable pylint due to known issue with pylint and pandas * Add robust option if file already exists * Abstract the sheet name argument into the export data helper * Feature flag for auto overwrite * add to featflag menu * Add featflag to builds * Remove safety check * Fix test * Quantile Anomaly Detection on Timeseries (#3980) * init commit * model + view * fixes plus doc strings * tests * trail map * remove ) * linting? * fix * refactor * renaming * rename v2 * final chart * linting Co-authored-by: James Maslek <jmaslek11@gmail.com> * Hotfix --> develop (#4027) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * Release/2.2.0 (#4008) * Added github actions for gitflow * Minor changes * Fix plot look when using eval and add query to choices (#3881) (#3898) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> * Testing Gitflow (#3899) * testing gitflow * Name changes * Testing python changes * Added Checkout to Base test * Feature/gitflow (#3900) * Fix plot look when using eval and add query to choices (#3881) (#3901) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> * Gitflow Implementations (#3902) * testing gitflow * Name changes * Testing python changes * Added Checkout to Base test * More minor fixes for merge * Minor fix * Added nightly build * Gitflow Implementations (#3904) * testing gitflow * Name changes * Testing python changes * Added Checkout to Base test * More minor fixes for merge * Minor fix * Added nightly build * Testing Merge * Main --> develop (#3906) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> * GItflow Implementations (#3909) * testing gitflow * Name changes * Testing python changes * Added Checkout to Base test * More minor fixes for merge * Minor fix * Added nightly build * Testing Merge * Merge error fix * Feature/gitflow (#3911) * testing gitflow * Name changes * Testing python changes * Added Checkout to Base test * More minor fixes for merge * Minor fix * Added nightly build * Testing Merge * Merge error fix * Merge fix * merge fix * Merge fix * Merge fix * Merge fix * merge fix * Update develop (#3913) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> * Feature/gitflow (#3914) * testing gitflow * Name changes * Testing python changes * Added Checkout to Base test * More minor fixes for merge * Minor fix * Added nightly build * Testing Merge * Merge error fix * Merge fix * merge fix * Merge fix * Merge fix * Merge fix * merge fix * [Gitflow] - Minor fix * Feature/gitflow (#3921) * testing gitflow * Name changes * Testing python changes * Added Checkout to Base test * More minor fixes for merge * Minor fix * Added nightly build * Testing Merge * Merge error fix * Merge fix * merge fix * Merge fix * Merge fix * Merge fix * merge fix * [Gitflow] - Minor fix * Feature/gitflow (#3914) (#3915) * testing gitflow * Name changes * Testing python changes * Added Checkout to Base test * More minor fixes for merge * Minor fix * Added nightly build * Testing Merge * Merge error fix * Merge fix * merge fix * Merge fix * Merge fix * Merge fix * merge fix * [Gitflow] - Minor fix * Nightly build feature * Added branch name docs * poetry add ccxt@latest (#3920) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * poetry add ccxt@latest Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> * Add crypto dd functions to sdk (#3888) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Add crypto dd functions to sdk * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * Fixes currency and trailmap Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> * Integration tests refactor (#3781) * generate integration tests report * new console report * simple run_scripts * move tests script to folder * add skipping * always display skips * func name * allow running from relative path * rename some vars and time * typo * change portfolio supress and warning * uncomment economy test * rename test controller * multiprocessing * display test progress and available * rename func * mypy * should not be here * small changes * type hinting and docstrings * new subprocesses default * forget context and chunksize * clean len skipt * small comment * fix subproc default with v * minor change * fix path * better this way * make output visible * allow only sequential run with verbose mode * change message * detail * include andrew idea * limit multiprocessing to clone version * fix for package application * must be up here * allow verbose with multiprocessing but warn * update readme * move tests to core * Update README.md * Update README.md * move readme outside * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * parse subproc arg * Update README.md * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * Delete glossary base command * move scripts * ruff * update pyproject.toml * update yfinance * fix futures and economy test, rewrite * rewrite stocks test yfinance dependent * refactor sia to yfinance 0.2... * fix last failing sia tests * black * update reqs Co-authored-by: James Maslek <jmaslek11@gmail.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: Chavithra PARANA <chavithra@gmail.com> * Gitflow - Autodoc (#3922) * Hotfix/dots sources (#3928) * fix: wordwrap * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * fix: str Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> * Update dependency: grpcio (#3937) * Update grpcio * Revert "Update grpcio" This reverts commit 676c50a2bdde5ca64614bddd3eaebbccd68c5994. * Update dependencies * Rebase develop? (#3935) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> * Update installation guides with videos (#3903) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Update installation guides with videos * Add fix for Ruff crashing * Me no longer do what James said * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Jeroen Bouma <jeroenbouma@Jeroens-MacBook-Pro.local> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> * broken link (#3889) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * broken link due to quandl.com redirecting to nasdaq.com, for the link to work and get the appropiate API key you need to remove the period at the end of this link... Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: james <jmaslek11@gmail.com> * Issue #3882 Fixed (#3885) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Issue #3882 Fixed * 2 files reformatted by black * tests added * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * fixed mypy errors Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> * GitFlow - improve check for changes (#3948) Gitflow Implementation * Rewrite and skip yfinance tests (#3953) * economy * fix futures * fix stocks tests * skip unfixable tests * fix ark * Fixed failing badge not used anymore (#3932) Co-authored-by: James Maslek <jmaslek11@gmail.com> * Fix portfolio returns (#3931) * fix inception bug and clean some useless attributes * reorder attributes * add returns and cumulative returns * fix cumulative returns * fix cumulative returns * remove cumulative ret * add some doc and encapsule methods * order detail * add more details on docstrings * wrong docstring * add commnet * Update portfolio_engine.py * fix bug with unsupported type * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * fix table header * fix portfolio integration test * ruff * fix tests * rewrite yfinance call * fix test_draw * test_stocks_helper * bt model * fix comp analysis * fix ftd * fix dd * fix screener Co-authored-by: James Maslek <jmaslek11@gmail.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt> * Put yf.info behind an exchange flag on `load` (#3951) * Put yf.info behind an exchange flag * Guides Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> * Last Price Bug into Previous Close #3865 (#3949) Co-authored-by: James Maslek <jmaslek11@gmail.com> * Add multiple countries option to events (#3938) * allow multiple countries in events cmd * fix test * fix last test * black Co-authored-by: James Maslek <jmaslek11@gmail.com> * Minor Fix for branch name check (#3979) * Gitflow - Added manual trigger to Linting (#3981) * Minor Fix for branch name check * added manual trigger to linting * Linting fix (#3984) Linting fix * Feature/macro convert (#3924) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Issue #3882 Fixed * 2 files reformatted by black * tests added * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * fixed mypy errors * Fixed parser options for currency conversion Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> * Update sma.md (#3956) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * Update sma.md Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> * Update overlap_model.py (#3955) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * Update overlap_model.py Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> * Update vwap.md (#3971) Co-authored-by: James Maslek <jmaslek11@gmail.com> * Update overlap_model.py - wrong typehint (#3970) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * Update overlap_model.py Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> * Bump yfinance to 0.2.4 and fix tests (#3977) * upgrade yfinance to 0.2.4 * fix some tests failing bc yfinance new date format * fix remaining tests * fix tests * rewrite failing test * black * rerecord test * fix get_1y_sp500 test * missing import here Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt> Co-authored-by: James Maslek <jmaslek11@gmail.com> * Add extra error handling for yf in etf (#3985) * Fix the news command and making it more stable (#3965) Co-authored-by: James Maslek <jmaslek11@gmail.com> * Hotfix/bug #3945 (#3963) * Add exception to http requests made by ftd * Formatting Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> * Fix #3787 (#3966) Make the get_equal_weights handle portfolio's with stock's filtered out, due to the stocks having to many NaNs. Co-authored-by: James Maslek <jmaslek11@gmail.com> * Add ticker to the load export file (#3997) * bump * Change export name to have the ticker * revert yaml * Feature/release branch gitflow (#3998) * release branch gitflow implentation * Fix integration tests bugs (#3993) * fix tk * fix newsletters * fix lt * exception on pir * fix attrib bug and remove warning * fix earnings * fix ins, lt, whatif * fillna * fix vis Co-authored-by: James Maslek <jmaslek11@gmail.com> * change .env loading priority (#4005) * [FIX] Pytorch-lightning trainer conflict with TQDM progress bar (#4002) * fix for tqdm progress bar conflict * fix tests Co-authored-by: James Maslek <jmaslek11@gmail.com> * bump * Update release branch * revert conda yaml * logging hash * Fix historical futures plot axes (#4006) * change start date to model * rewrite test * ruff * add end date * move futures and update test * return if wrong dates * fix controller test * record mode rewrite model and view Co-authored-by: James Maslek <jmaslek11@gmail.com> * Update version number * Added scipy to intel * Fix M1 build (#4010) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * adding xgboost explicitly * testing juan sugestion * removing unncessary stuff that the hook deals with Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> * Add xgboost to intel * add scipy libs to windows only * add scipy sparse * update scipy and pywin * update tests * UPdate installation.md to reflect 2.2 * fix yf unit tests * Try to get futures tests working * Ignore tz in yf download * Found another end date needed * delelte yf cache Co-authored-by: luqazino@gmail.com <luqazino@gmail.com> Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: Chavithra PARANA <chavithra@gmail.com> Co-authored-by: jose-donato <43375532+jose-donato@users.noreply.github.com> Co-authored-by: Jeroen Bouma <jer.bouma@gmail.com> Co-authored-by: Jeroen Bouma <jeroenbouma@Jeroens-MacBook-Pro.local> Co-authored-by: Rob-Rychs <Robrychel@gmail.com> Co-authored-by: Mert Nuhuz <mail@mertnuhuz.com> Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt> Co-authored-by: Bongani Bendile <58882596+Bonganibendi@users.noreply.github.com> Co-authored-by: Sergio A. S <sergio-abu@proton.me> Co-authored-by: northern-64bit <75195383+northern-64bit@users.noreply.github.com> Co-authored-by: martinb-bb <105685594+martinb-bb@users.noreply.github.com> * GH Pages fix * Minor fix Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> Co-authored-by: Chavithra PARANA <chavithra@gmail.com> Co-authored-by: jose-donato <43375532+jose-donato@users.noreply.github.com> Co-authored-by: Jeroen Bouma <jer.bouma@gmail.com> Co-authored-by: Jeroen Bouma <jeroenbouma@Jeroens-MacBook-Pro.local> Co-authored-by: Rob-Rychs <Robrychel@gmail.com> Co-authored-by: Mert Nuhuz <mail@mertnuhuz.com> Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt> Co-authored-by: Bongani Bendile <58882596+Bonganibendi@users.noreply.github.com> Co-authored-by: Sergio A. S <sergio-abu@proton.me> Co-authored-by: northern-64bit <75195383+northern-64bit@users.noreply.github.com> Co-authored-by: martinb-bb <105685594+martinb-bb@users.noreply.github.com> * Add back pull request to linting action (#4032) * Fix terminal exit after `--sort p/e` (#4013) * fix scr sort exit * rewrite unit test output * rewind slash replace * rewind slash replace * fix regex * rewrite expected scr tests * black Co-authored-by: James Maslek <jmaslek11@gmail.com> * fix: small typo (#4036) * fix income comparison error (#4029) * Hotfix/fix integration tests (#4025) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * removing leftover test * fix forex test to use simple pairs * fix key error in portfolio test * fix pylint * fix stocks_bt test * fix ca tests * fixing condition * fixing int tests * skipping shroom tests * adding /red * linting * making pre commints happy * linting Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> * Deprecate reddit commands taking too long to connect to PushshiftAPI (#3999) * fix tk * fix newsletters * fix lt * exception on pir * fix attrib bug and remove warning * fix earnings * fix ins, lt, whatif * fillna * fix vis * timeout reddit func * fix interest * black * pylint * pylint again * back to timeout * rewind * deprecate pushshift api commands * rewrite expected Co-authored-by: James Maslek <jmaslek11@gmail.com> * Feature/release branch gitflow (#4034) * release branch gitflow * installer test * Revert intel build fix * poetry install * Mac build poetry fix * Poetry cache clear * Poetry fix * Added cancel * Minor fix * Github Pages fix * GH page fix * Added condition to docker publish * Fix nightly build * Added hotfix to integration test and build gh run * Minor fix * Edit trigger for integration test * minor corrections Co-authored-by: James Maslek <jmaslek11@gmail.com> * Remove hotfix branch from triggers (#4048) * Refactor `stocks/options/voi,vol,oi,chains` (#4017) * Copy paste all the sheet names (#4035) * bump * Update ALL the exports with sheet name option * Update contributing too * Add in sheet name to each docstring * Update tests * Fix the small things for tests * Converting CONTRIBUTING.md back since I put minimal changes in and it complains * Fix terminal exit after `--sort p/e` (#4013) * fix scr sort exit * rewrite unit test output * rewind slash replace * rewind slash replace * fix regex * rewrite expected scr tests * black Co-authored-by: James Maslek <jmaslek11@gmail.com> * fix: small typo (#4036) * fix income comparison error (#4029) * Update tests due to yfinance error * I broke tests and fixed them * Fix tests? * Missed a few sheet name additions * missed one more * Fix some missing sheet_name parameters * Fix a test I broke * Update tests due to changes with sheet_name * Update stocks and common * Mutual funds just because * Portfolio update * Update Forecast * Update Futures * Update ETF * Update Economy * Update Crypto * Update others * Update documentation to explain --sheet-name * It should be None test * Add None for sheet_name since empty string can result in errors * Formatting * Fix tests * Update documentation * Also update the image * Add back to options commands Co-authored-by: james <jmaslek11@gmail.com> Co-authored-by: Jeroen Bouma <jeroenbouma@Jeroens-MacBook-Pro.local> Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: jose-donato <43375532+jose-donato@users.noreply.github.com> Co-authored-by: teh_coderer <me@tehcoderer.com> * Upgrade dependencies for bug and for security vulnerabilities. (#4031) * bump * Resolve multiple safety checks. Update thepassiveinvestor * fix conda yml * `openbb.economy.fred_ids` to always return dataframe (#4058) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * returning always a dataframe * Revert "returning always a dataframe" This reverts commitd5dbf3132f. * returning always a dataframe --------- Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> * Refactor requests throughout (#4033) * bump * Initial function write * Delete this line from yaml * Changed all the main things - Need help on tests * pylint errors * Tests v0 * Tests v1 * Tests v2 --------- Co-authored-by: andrewkenreich <andrew.kenreich@gmail.com> * Bumping yfinance to 0.2.9 and updating ruff (#4059) * Clarifies the Balance example by including, `timeframe = '2021'` (#4072) Companies have not finished reporting F/Y 2022 earnings, including `timeframe='2021'` ensures that results are returned. * Fix incorrect column label in nasdaq_model.py (#4063) * Fix incorrect column label in nasdaq_model.py 'Time (GMT)' changed to 'Time (ET)' * Update tests --------- Co-authored-by: petycomppety <30414255+petycomppety@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> * fix uk daily data (#4078) Co-authored-by: James Maslek <jmaslek11@gmail.com> * Nightly Build Optimization (#4073) Optimize nightly build * Add keywords and descriptions (#4052) Co-authored-by: Jeroen Bouma <jeroenbouma@Jeroens-MacBook-Pro.local> Co-authored-by: James Maslek <jmaslek11@gmail.com> * Update the routine, portfolio and screener files and adjust the documentation (#4021) * Remove undesired example files * Update the documentation for routines * Add in video * Add some additional text * Add in a routines example that can be activated with --example * Remove default old examples * Add portfolio example holdings file * Add portfolio optimization example allocation file * Add example files for the portfolio menus * Remove code that unintentionaly prints the home menu on every routine * Add home instead of / * Remove requirement to add file if you have an example * Ensure portfolio/po/params also talks about docs correctly * Move all routine, portfolio and screener presets to the correct folder * Remove presets since they are moved * Remove presets since they are moved * Same implementation as for file in po * Adjust code so it works with new folder * Adjust code so it works with new folder * Adjust code a little since I changed folder * Update screener documentation to include how to create a screener * Remove old readme * Update documentation to better reflect where to find the files * Also update SDK notes * Update exe with auto complete and more info * Add images * Update images and the last script * Update text to make it more apparent that it has an example attached * Add section for routine scripts on home menu * Make call_about more robust and add record and stop * Update the routine markdown with info about record/stop including video * Update scripts * Update portfolio report * Update tests and report * fix small load bug * rewrite help test * last fix was buggy * example by default * fix po integration test * keep example on arg * adapt integration test * fix portfolio integration test * fix more portfolio integration tests * pa is not an option anymore * portfolio report choices only holdings * update integration test for portfolio report * Small formatting improvements * Remove sleep and fix inconsistent return * Some spelling * oops * Fix tests --------- Co-authored-by: Jeroen Bouma <jeroenbouma@Jeroens-MacBook-Pro.local> Co-authored-by: James Maslek <jmaslek11@gmail.com> Co-authored-by: Diogo Sousa <montezdesousa@gmail.com> * Improve the `stocks/search` command (#4084) * Improve search command * Make it more intuitive * Fix tests * Update the docs * Ok done * Ok done 2 * Ok done 3 * Git update tests that failed * Update commands with --sheet-name that didn't work (#4088) * Update commands with --sheet-name that didn't work * Fix test * oops * Adds auto completion to `news` (#4089) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * returning always a dataframe * Revert "returning always a dataframe" This reverts commitd5dbf3132f. * quick fix to auto complete args --------- Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> * Hotfix/Windows-CLI (#4087) * init * Update windows10_build.yml * Update windows10_build.yml * Update windows10_build.yml * Update windows10_build.yml * Update windows10_build.yml * Update windows10_build.yml * oops --------- Co-authored-by: James Maslek <jmaslek11@gmail.com> * Adds end date to `forex/load` (#4077) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * returning always a dataframe * Revert "returning always a dataframe" This reverts commitd5dbf3132f. * adding end date to the forex load * added some tests * added example * always show msg * rewriting test * updating tests * updating tests * Redo load tests --------- Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: James Maslek <jmaslek11@gmail.com> * Lets release babyyyy * logging hash * Fix yf bug for options and update tests * update windows build to checkout code * switch order --------- Co-authored-by: luqazino@gmail.com <luqazino@gmail.com> Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: Chavithra PARANA <chavithra@gmail.com> Co-authored-by: jose-donato <43375532+jose-donato@users.noreply.github.com> Co-authored-by: Jeroen Bouma <jer.bouma@gmail.com> Co-authored-by: Jeroen Bouma <jeroenbouma@Jeroens-MacBook-Pro.local> Co-authored-by: Rob-Rychs <Robrychel@gmail.com> Co-authored-by: Mert Nuhuz <mail@mertnuhuz.com> Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt> Co-authored-by: Bongani Bendile <58882596+Bonganibendi@users.noreply.github.com> Co-authored-by: Sergio A. S <sergio-abu@proton.me> Co-authored-by: northern-64bit <75195383+northern-64bit@users.noreply.github.com> Co-authored-by: martinb-bb <105685594+martinb-bb@users.noreply.github.com> Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com> Co-authored-by: teh_coderer <me@tehcoderer.com> Co-authored-by: andrewkenreich <andrew.kenreich@gmail.com> Co-authored-by: Peter Oroszvári <30414255+peter-oroszvari@users.noreply.github.com> Co-authored-by: petycomppety <30414255+petycomppety@users.noreply.github.com> Co-authored-by: Diogo Sousa <montezdesousa@gmail.com>
20 KiB
Vendored
1. OpenBB Terminal : Unit Testing
This document is part of the OpenBB Terminal library documentation.
It aims to provide necessary information in order to:
- Run
unit tests - Build
unit tests - Fix failed existing
unit tests - Maintain
unit tests
1.1. Why having unit tests ?
Unit tests purpose is to allow developers to update without fear.
Writing tests that are easy to run will help the person modifying the code to do so quick and with more confidence. Having tests available also decreases the chances that bugs will make it into production and break other parts of the code.
To do that we need unit tests to be :
- fast to write
- fast to run
FAST TO WRITE.
The unit tests is used for testing a single functionality for its correctness of input and the corresponding output. Unit tests are about ensuring that low-level implementation details are rock solid.
FAST TO RUN.
Tests can be slow at times, due to the need to connect with external services. This can be sending a HTTP request or connecting to a database. We can speed this up by using mocks. In case this is not possible, make sure to marked it as slow
2. Run unit tests
In this section we will explain everything you need to run the unit tests on OpenBB Terminal.
2.1. How to install tests dependencies ?
To run the tests you will need first to install the dev-dependencies. By default poetry installs the dev-dependencies when you run this command :
poetry install
If you do not want to install the dev-dependencies you will have to add the option --no-dev like this :
poetry install --no-dev
2.2. How to run tests :
By module
You can run tests on a specific package/module by specifying the path of this package/module, as follows:
pytest tests/openbb_terminal/some_package
pytest tests/openbb_terminal/some_package/some_module.py
By test name
You can run tests by their name with the argument -k
pytest -k "test_function1"
By markers
You can run tests only on specific markers, like this :
pytest -m slow
pytest -k "not slow"
pytest -k "not slow and not network"
You can list the available markers using this command :
pytest --markers
2.3. How to skip tests
Skipping a specific test
You can use the decorator @pytest.mark.skip as below:
import pytest
@pytest.mark.skip
def test_some_function(mocker):
pass
@pytest.mark.skip(reason="This time with a comment")
def test_another_function(mocker):
pass
Skipping the entire test module
import pytest
pytest.skip(msg="Some optional comment.", allow_module_level=True)
def test_some_function(mocker):
pass
3. How to build unit tests
When you contribute a new feature to the Terminal, it's important that tests are added for this particular feature. It is a part of the Checklist for the PR to be approved.
All the unit tests should be insides the tests folder. There should be at most one test module for each module of OpenBB Terminal.
Each test module should follow the same path of the module that it is testing.For instance,
- in order to test the following module
openbb_terminal/stocks/due_diligence/dd_controller.py - a
test moduleshould be added here:tests/openbb_terminal/stocks/due_diligence/test_dd_controller.py
Now that you know where to add tests, let's go through 3 types of unit tests that we have:
3.1. Model Test
As mentioned in the main repo's README, we are following the MVC pattern. The _model.py's job to get the required data, e.g. from an external APIs or scraping.
Therefore, in unit tests for _model.py, the function output is captured and saved when the test is first run. Then, the next time the test is run, the function's returned value is compared with the captured value in the first run, to ensure parity.
Depending on the data type of function output, we can generate the following files:
- csv : for pandas.DataFrame
- json : for python native data type (list, dict, tuple)
- txt : store str or printed output
Examples:
@pytest.fixture(scope="module")
def vcr_config():
return {
"filter_query_parameters": [
("token", "MOCK_TOKEN"),
],
}
@pytest.mark.vcr
@pytest.mark.parametrize(
"ticker",
[
("BTC"),
("BTC-USD"),
],
)
def test_check_supported_ticker(ticker, recorder):
df = sentimentinvestor_model.check_supported_ticker(ticker)
recorder.capture(df)
Several things worth noting here:
- If the model utilizes an API key or token, make sure to filter it insider the
vcr_configfixture inside your test module, similar to the example. This will hide your actual API key / token for security purposes. - Record HTTP requests using the decorator
@pytest.mark.vcr- When run the first time, the VCR will record the requests to
cassettes/test_*.yml - Run it again, and VCR will replay the recorded response when the HTTP request is made. This test is now fast (no real HTTP requests are made anymore), deterministic (the test will continue to pass, even if you have no internet connection or that external APIs go down) and accurate (the response will contain the same headers and body you get from a real request).
- When run the first time, the VCR will record the requests to
- Test out multiple input variables to ensure tests cover multiple edge cases
- Use the decorator
@pytest.mark.parametrizeto specify the inputs for your tests.
- Use the decorator
- Capture the returned df using
recorder.capture(<return_value>)- Next time the test run, return output will be compared against the captured file
- Each fixture / cassette file for a test module should be stored within the same folder. An example with
tests/openbb_terminal/some_package/some_module.py:tests/openbb_terminal/some_package/cassettes/some_module/test_function1.yamltests/openbb_terminal/some_package/txt/some_module/test_function1.csvtests/openbb_terminal/some_package/csv/some_module/test_function1.csvtests/openbb_terminal/some_package/json/some_module/test_function1.json
- You can choose the
cassettename using the@pytest.mark.default_cassettemarker. Here is an example :
@pytest.mark.default_cassette("example.yaml")
@pytest.mark.vcr
def test_default():
assert request("http://httpbin.org/get").text == '{"get": true}'
3.2. View Test
Different from the model.py, view.py module handles how data is displayed, e.g.as a chart or a table.
The view.py has no return statement, and simply prints to stdout. Hence, our unit tests will capture stdout values, and compare against the recorded fixture in subsequent runs.
Example:
@pytest.mark.vcr
@pytest.mark.record_stdout
def test_display_historical(mocker):
# MOCK VISUALIZE_OUTPUT
mocker.patch(target="openbb_terminal.helper_classes.TerminalStyle.visualize_output")
sentimentinvestor_view.display_historical(
ticker="AAPL", start="2021-12-12", end="2021-12-15", export="", raw=True
)
Important notes to go through:
- Use
@pytest.mark.record_stdoutto capturesdtout.- Recorded stdout is saved as fixtures in a txt file
- If your view function only plots a chart, and does not output anything in
sdtout, you can skip unit testing yourview.py - Make sure to mock
visualize_outputmethod.- Inside
visualize_output, we useionto enable interactive mode. However, under Windows, havingionenabled would make tests fail to run. Hence, you should always mockvisualize_output, and henceion
- Inside
3.3. Controller Test
Unit test for _controller.py is the last component you would need to add. Most of the time you won't need to create a _controller.py from scratch. Hence, we will only cover how to add tests for a new command to an existing test_*_controller.py file
Test print help
This test in the test_*_controller.py captured the help text printed to stdout.
Example:
@pytest.mark.vcr(record_mode="none")
@pytest.mark.record_stdout
def test_print_help():
controller = alt_controller.AlternativeDataController(queue=None)
controller.print_help()
Adding an additional feature to the controller.py will alter the help text. Make sure to run the tests with the argument --rewrite-expected to re-generate the text file.
Example: pytest openbb_terminal.cryptocurrency.defi.defi_controller --rewrite-expected
Test call function
This test is to check when controller.py calls a command, the corresponding function from a view.py will be called with the correct arguments.
Example:
@pytest.mark.vcr(record_mode="none")
@pytest.mark.parametrize(
"tested_func, other_args, mocked_func, called_args, called_kwargs",
[
(
"call_aterra",
[
"ust",
"--address=terra1wg2mlrxdmnnkkykgqg4znky86nyrtc45q336yv", # pragma: allowlist secret
],
"terraengineer_view.display_terra_asset_history",
[],
dict(),
),
(
"call_newsletter",
[],
"substack_view.display_newsletters",
[],
dict(),
),
],
)
def test_call_func(
tested_func, mocked_func, other_args, called_args, called_kwargs, mocker
):
path_controller = "openbb_terminal.cryptocurrency.defi.defi_controller"
if mocked_func:
mock = mocker.Mock()
mocker.patch(
target=f"{path_controller}.{mocked_func}",
new=mock,
)
controller = defi_controller.DefiController(queue=None)
getattr(controller, tested_func)(other_args)
if called_args or called_kwargs:
mock.assert_called_once_with(*called_args, **called_kwargs)
else:
mock.assert_called_once()
else:
controller = defi_controller.DefiController(queue=None)
getattr(controller, tested_func)(other_args)
When adding a new feature to an existing menu, there should already be a test_*_controller.py file with the test_call_func() function. You can simply add another tuple under @pytest.mark.parametrize(), which contains:
call_<command>from the controller.py file- Arguments you want to pass in the
call_<command> - The corresponding view function, which will be mocked (Here we only want check if the view function is called at least once. We mock it such that the function won't execute.)
- Arguments you want to pass to the view function. Note that the arguments here need to be the same as arguments in (2). This is to ensure that arguments passed from the controller.py file are passed correctly to function in
view.py
3.4. Fixing existing tests
It is not uncommon that your new feature or bug fixes break the existing code. Understanding a few concepts can help you navigate and fix most common cases.
Before continuing this section, please have a look at our FIXTURES documentation.
TL;DR:
You can run unit tests under a few mode:
--rewrite-expectedwill re-generate the fixtures (csv, json and txt files) if there's detected change.--record-modewill impact both the cassette (yaml) and fixtures (csv, json, txt files)--record-mode=none: searches for existing cassette / fixtures. If there's none, an exception will be thrown.--record-mode=once: creates new fixtures and cassette if they did not exist. If there are already fixtures or cassette, it will take the existing one.--record-mode=rewrite: this rewrites both the cassette and fixtures, even if they already exist.
Scenario 1: Update Fixtures
Let's say you just updated the code in _model.py file, which then altered the recorded output. You can update the fixture files by running the tests with --rewrite-expected argument. This would update the fixtures with latest changes.
Example: pytest openbb_terminal.cryptocurrency.defi.defi_controller --rewrite-expected
Scenario 2: Update both Fixtures and Cassettes
If you want to update existing cassettes and fixtures, use the argument --record-mode=rewrite when running tests.
As existing cassettes and fixtures will be overwritten (if there's any), make sure that you check both, and that they yield expected output.
3.5. How to mock ?
PYTEST-MOCK
A mocker fixture is available through the package pytest-mock.
Here is an example on how to mocker fixture can be used :
def test_something(mocker):
mocker.patch("some_package.some_module")
More information about pytest-mock are available here :
MOCKEYPATCH
There is also a monkeypatch fixture available by default inside pytest.
def test_double(monkeypatch):
monkeypatch.setattr("some_package.some_module", "Some value")
More information about monkeypatch are available here :
3.6. Which helpers are available ?
You can find the available helpers inside the following package/module :
tests/helpers/tests/conftest.py
See also the pytest fixtures which are autoloaded helpers.
3.7. Which fixtures are available ?
You can list all the available pytest fixtures using the following command :
pytest --fixtures
More on custom fixtures here :
3.8. Which markers are available ?
You can list the available markers using this command :
pytest --markers
More information on markers location are available in pytest documentation :
3.9. Known issue / solution
ION Usage
As mentioned earlier, if you are testing for a _view.py module that uses ION, you would need to mock it. With Windows, the charts / graphs are unable to close the graph applications. This would make the tests failed when running with Windows.
You can use the following example below. Once you have mocked the graphs / charts, simply call the display function, which is now a mocked object.
@pytest.mark.vcr
@pytest.mark.record_stdout
def test_display_defi_tvl(mocker):
# MOCK EXPORT_DATA
mocker.patch(target="openbb_terminal.cryptocurrency.defi.llama_view.export_data")
# MOCK VISUALIZE_OUTPUT
mocker.patch(target="openbb_terminal.helper_classes.TerminalStyle.visualize_output")
llama_view.display_defi_tvl(20)
YFINANCE
If a method is using the yfinance library but do not let you pick the start/end dates it will pick the current date each time.
So your test might fail the next days.
To solve that you can filter the start/end date like this :
@pytest.fixture(scope="module")
def vcr_config():
return {
"filter_headers": [("User-Agent", None)],
"filter_query_parameters": [
("period1", "MOCK_PERIOD_1"),
("period2", "MOCK_PERIOD_2"),
("date", "MOCK_DATE"),
],
}
You can also refactor this method to let access to stard/end dates.
USER-AGENT
Some function uses a random User-Agent on the HTTP HEADER when fetching data from an API.
Here is how to filter this random User-Agent.
@pytest.fixture(scope="module")
def vcr_config():
return {
"filter_headers": [("User-Agent", None)],
}
YFINANCE
If you do something like this with yfinance library.
import yfinance as yf
yf.download(tickers="VCYT QSI")
Chances are you requests will be multi-threaded.
Issues : as for now vcrpy seems to be incompatible with multi-threading.
The library vcrpy is used to record cassettes (network calls into yaml files).
Here is a solution to still combine yfinance and vcrpy :
import pytest
import yfinance
yf_download = yf.download
def mock_yf_download(*args, **kwargs):
kwargs["threads"] = False
return yf_download(*args, **kwargs)
@pytest.mark.vcr
def test_ark_orders_view(kwargs_dict, mocker, use_color):
mocker.patch("yfinance.download", side_effect=mock_yf_download)
yf.download(tickers="VCYT QSI")
BROTLI
The library requests doesn't support : brotli comnpression.
Unless brotli library is installed in the environment.
Plus brotli is not in OpenBBTerminal requirements.
So if both of these conditions are fulfilled :
- one generates a cassette with
brotliinstalled in his/her environment - the server choose to send
brotlicompressed data
Then the test might work in local but crash during PullRequest.
BEFORE_RECORD_RESPONSE
The library vcrpy has a before_record_response which accept a filtering function that can be used to filter your cassette content :
import pytest
def my_custom_filter(response):
return response
@pytest.mark.vcr(before_record_response=my_custom_filter)
def test_simple(recorder):
pass
For instance this can be used to reduce the size of a cassette if it's too heavy.
Or to filter sensitive data in the response.
The issue with this before_record_response : it isn't launched at the first run of the test.
More on this here : https://github.com/kevin1024/vcrpy/pull/594
A solution for now is to run this command while initializing the cassettes :
# THE SAME COMMAND NEEDS TO BE RUN TWICE
pytest tests/.../test_some_test_module.py --record-mode=once --rewrite-expected
pytest tests/.../test_some_test_module.py --record-mode=once --rewrite-expected
3.10. List of useful vscode tools for unit tests
VSCODE TESTING
The default testing tool from vscode should let you add breakpoints and run debug on a specific test.
It's a convenient way to see what's inside your test while running.
More information on this tool are available here :
3.11. How to handle dev-dependencies ?
UPDATE PYPROJECT
If a library need to be added or removed from dev-dependencies this can be done directly in the pyproject.toml file.
All the dev-dependencies should be under the tool.poetry.dev-dependencies section, like in this example :
[tool.poetry.dev-dependencies]
pytest = "^6.2.2"
pylint = "^2.7.2"
flake8 = "^3.9.0"
...
EXPORT REQUIREMENTS
After updating the pyproject.toml you will have to export the requirements files using the following commands :
poetry export -f requirements.txt -o requirements.txt --without-hashes --dev
poetry export -f requirements.txt -o requirements-full.txt --extras prediction --extras optimization --without-hashes --dev
4. Maintain unit tests
4.1. What is the PR process ? (in progress)
Here are the steps to write proper tests for Gamestonk :
A. Find right place
B. Verify coverage is above 90%
C. Set the right markers
A. Find right place
Put the code following the same module and package structure than openbb_terminal package.
B. Verify coverage is above 90%
Once you made your PullRequest an automation will let you know whether or not you have the proper amount of tests coverage.
You can also run the following command to check your coverage manually :
pytest --cov --cov-fail-under=90
C. Set the right markers
If parts of your have specificities like :
- being
slow - requiring
networkconnectivity - requiring
authenticationtoAPIs
Then the proper markers should be sent on each test.
The rests of this document is there to provide a deeper comprehension of this steps.
A tests update might be asked whenever the answer to one of the following question is yes :
A. Is this PR fixing bug which was not detected by the current tests ?
B. Is this PR reducing code coverage ?
C. Is this PR adding features ?
D. Is this PR updating features ?
4.2. Which automations are available ?
PULL REQUEST
A github action should comment every Pull Request with the code coverage.
This automation will not enforce any rules regarding tests.
4.3. How to check code coverage ?
PULL REQUEST AUTOMATION
You should be able to see the code coverage on comment of your Pull Requests.
MANUALLY
This is how to manually check code coverage.
pytest --cov=openbb_terminal --cov=terminal --cov-report term-missing
You can also select a specific package/module with the option --cov.
Here is an example where we select only the package stocks\due_diligence :
pytest --cov=openbb_terminal\stocks\due_diligence --cov-report term-missing
PRE-COMMIT
Code coverage and unit tests are not run on pre-commit hooks since it will slow down each commit.