mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 04:31:13 +00:00
Release/2.3.0 (#4090)
* 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>
This commit is contained in:
62
.github/workflows/build-release.yml
vendored
Normal file
62
.github/workflows/build-release.yml
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
name: Build & Release
|
||||
|
||||
env:
|
||||
OPENBB_ENABLE_QUICK_EXIT: true
|
||||
OPENBB_LOG_COLLECT: false
|
||||
OPENBB_USE_ION: false
|
||||
OPENBB_USE_PROMPT_TOOLKIT: false
|
||||
PIP_DEFAULT_TIMEOUT: 100
|
||||
PYTHONNOUSERSITE: 1
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- release/*
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
actions: write
|
||||
|
||||
jobs:
|
||||
trigger-windows-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Trigger Windows Build
|
||||
uses: aurelien-baudet/workflow-dispatch@v2
|
||||
with:
|
||||
workflow: windows10_build.yml
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
wait-for-completion-timeout: 2h
|
||||
|
||||
trigger-macos-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Trigger M1 MacOs Build
|
||||
uses: aurelien-baudet/workflow-dispatch@v2
|
||||
with:
|
||||
workflow: m1_macos_build.yml
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
wait-for-completion-timeout: 2h
|
||||
|
||||
trigger-intel-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Trigger Intel MacOs Build
|
||||
uses: aurelien-baudet/workflow-dispatch@v2
|
||||
with:
|
||||
workflow: intel_macos_build.yml
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
wait-for-completion-timeout: 2h
|
||||
|
||||
trigger-docker-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Trigger docker Build
|
||||
uses: aurelien-baudet/workflow-dispatch@v2
|
||||
with:
|
||||
workflow: docker.yml
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
1
.github/workflows/docker.yml
vendored
1
.github/workflows/docker.yml
vendored
@@ -40,3 +40,4 @@ jobs:
|
||||
- name: Publishing the Docker image
|
||||
run: |
|
||||
docker push "${OPENBBTERMINAL_DOCKER_POETRY_IMAGE}"
|
||||
if: startsWith(github.ref, 'refs/heads/main')
|
||||
|
||||
52
.github/workflows/integration-test.yml
vendored
Normal file
52
.github/workflows/integration-test.yml
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
name: Integration Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- release/*
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
integration-tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
if: github.event_name == 'push'
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Checkout specific ref
|
||||
if: github.event_name == 'pull_request'
|
||||
run: git fetch origin ${{ github.event.pull_request.head.ref }} && git checkout FETCH_HEAD
|
||||
|
||||
- name: Setup Python 3.9
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.9"
|
||||
architecture: x64
|
||||
|
||||
- name: Install Poetry
|
||||
uses: snok/install-poetry@v1
|
||||
with:
|
||||
version: 1.1.13
|
||||
virtualenvs-create: true
|
||||
virtualenvs-in-project: true
|
||||
|
||||
- name: Load cached venv
|
||||
id: cached-poetry-dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: .venv
|
||||
key: venv-${{ runner.os }}-v1-${{ hashFiles('**/poetry.lock') }}
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
|
||||
run: poetry install --no-interaction -E optimization
|
||||
|
||||
- name: Run integration tests
|
||||
run: |
|
||||
source $VENV
|
||||
python terminal.py /home/runner/work/OpenBBTerminal/OpenBBTerminal/openbb_terminal/miscellaneous/integration_tests_scripts -t
|
||||
8
.github/workflows/intel_macos_build.yml
vendored
8
.github/workflows/intel_macos_build.yml
vendored
@@ -1,12 +1,20 @@
|
||||
name: Intel MacOS Build
|
||||
|
||||
env:
|
||||
OPENBB_ENABLE_QUICK_EXIT: true
|
||||
OPENBB_LOG_COLLECT: false
|
||||
OPENBB_USE_ION: false
|
||||
OPENBB_USE_PROMPT_TOOLKIT: false
|
||||
OPENBB_FILE_OVERWRITE: true
|
||||
PIP_DEFAULT_TIMEOUT: 100
|
||||
PYTHONNOUSERSITE: 1
|
||||
|
||||
on: workflow_dispatch
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
Build:
|
||||
name: Intel MacOS Build
|
||||
|
||||
8
.github/workflows/linting.yml
vendored
8
.github/workflows/linting.yml
vendored
@@ -5,9 +5,12 @@ env:
|
||||
OPENBB_LOG_COLLECT: false
|
||||
OPENBB_USE_ION: false
|
||||
OPENBB_USE_PROMPT_TOOLKIT: false
|
||||
OPENBB_FILE_OVERWRITE: true
|
||||
PIP_DEFAULT_TIMEOUT: 100
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, edited]
|
||||
push:
|
||||
branches:
|
||||
- 'feature/*'
|
||||
@@ -16,7 +19,7 @@ on:
|
||||
|
||||
# Cancel previous runs that are not yet completed.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
group: ${{ github.event_name }}-${{ github.repository }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
@@ -40,7 +43,7 @@ jobs:
|
||||
restore-keys: ${{ runner.os }}-linting-${{ hashFiles('**/poetry.lock') }}
|
||||
|
||||
- run: |
|
||||
pip install bandit black codespell mypy==0.982 pyupgrade safety pylint==2.15.2 packaging==22 ruff==0.0.212
|
||||
pip install bandit black codespell mypy==0.982 pyupgrade safety pylint==2.15.2 packaging==22 ruff==0.0.236
|
||||
pip install types-pytz types-requests types-termcolor types-tabulate types-PyYAML types-python-dateutil types-setuptools types-six
|
||||
- run: bandit -x ./tests -r . || true
|
||||
- run: black --diff --check .
|
||||
@@ -48,7 +51,6 @@ jobs:
|
||||
- run: ruff .
|
||||
- run: mypy --ignore-missing-imports openbb_terminal
|
||||
- run: shopt -s globstar && pyupgrade --py38-plus **/*.py
|
||||
- run: safety check
|
||||
- run: |
|
||||
pylint terminal.py openbb_terminal tests
|
||||
|
||||
|
||||
15
.github/workflows/m1_macos_build.yml
vendored
15
.github/workflows/m1_macos_build.yml
vendored
@@ -1,12 +1,20 @@
|
||||
name: M1 MacOS Build
|
||||
|
||||
env:
|
||||
OPENBB_ENABLE_QUICK_EXIT: true
|
||||
OPENBB_LOG_COLLECT: false
|
||||
OPENBB_USE_ION: false
|
||||
OPENBB_USE_PROMPT_TOOLKIT: false
|
||||
OPENBB_FILE_OVERWRITE: true
|
||||
PIP_DEFAULT_TIMEOUT: 100
|
||||
PYTHONNOUSERSITE: 1
|
||||
|
||||
on: workflow_dispatch
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
Build:
|
||||
name: M1 MacOS Build
|
||||
@@ -45,16 +53,21 @@ jobs:
|
||||
activate-environment: build_env
|
||||
auto-activate-base: false
|
||||
use-only-tar-bz2: true # Needed for caching some reason
|
||||
|
||||
- name: Run Poetry
|
||||
run: poetry install
|
||||
run: poetry install -vvv
|
||||
|
||||
- name: Install Pyinstaller
|
||||
run: poetry install -E installer
|
||||
|
||||
- name: Poetry Install Portfolio Optimization and Forecasting Toolkits
|
||||
run: poetry install -E all
|
||||
|
||||
- name: Install Specific Papermill
|
||||
run: |
|
||||
pip uninstall papermill -y
|
||||
pip install git+https://github.com/nteract/papermill.git@main
|
||||
|
||||
# This is basically the same as build4mac.sh
|
||||
- name: Build Bundle
|
||||
run: |
|
||||
|
||||
1
.github/workflows/mac.yml
vendored
1
.github/workflows/mac.yml
vendored
@@ -5,6 +5,7 @@ env:
|
||||
OPENBB_USE_ION: false
|
||||
OPENBB_USE_PROMPT_TOOLKIT: false
|
||||
PIP_DEFAULT_TIMEOUT: 100
|
||||
OPENBB_FILE_OVERWRITE: true
|
||||
PYTHONNOUSERSITE: 1
|
||||
on:
|
||||
push:
|
||||
|
||||
117
.github/workflows/nightly-build.yml
vendored
117
.github/workflows/nightly-build.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Nightly Build on the develop branch
|
||||
name: Nightly Build
|
||||
|
||||
env:
|
||||
OPENBB_ENABLE_QUICK_EXIT: true
|
||||
@@ -6,91 +6,52 @@ env:
|
||||
OPENBB_USE_ION: false
|
||||
OPENBB_USE_PROMPT_TOOLKIT: false
|
||||
PIP_DEFAULT_TIMEOUT: 100
|
||||
OPENBB_FILE_OVERWRITE: true
|
||||
PYTHONNOUSERSITE: 1
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
permissions:
|
||||
actions: write
|
||||
|
||||
jobs:
|
||||
Windows-Build:
|
||||
name: Windows10 Build
|
||||
runs-on: [self-hosted, Windows, x64]
|
||||
# Configuring -------------
|
||||
trigger-windows-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup Windows Git Configuration # This is under the assumption that git is already installed on the system
|
||||
run: |
|
||||
Set-ItemProperty 'HKLM:\System\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -value 1
|
||||
git config --system core.longpaths true
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2.4.2
|
||||
- name: Trigger Windows Build
|
||||
uses: aurelien-baudet/workflow-dispatch@v2
|
||||
with:
|
||||
ref: develop
|
||||
|
||||
- name: Activate Base & Create OpenBB Environment
|
||||
run: |
|
||||
conda activate base
|
||||
conda env create -n obb --file build/conda/conda-3-9-env-full.yaml
|
||||
conda init
|
||||
conda activate obb
|
||||
conda env list
|
||||
- name: Poetry Install
|
||||
# Conda activate needs to be run every time because of the way that the workflow steps work
|
||||
# on powershell where it creates a new shell every time for every step
|
||||
run: |
|
||||
conda activate obb
|
||||
poetry install
|
||||
- name: Poetry Install Portfolio Optimization and Forecasting Toolkits
|
||||
run: |
|
||||
conda activate obb
|
||||
poetry install -E all
|
||||
- name: Poetry Install Installer
|
||||
run: |
|
||||
conda activate obb
|
||||
poetry install -E installer
|
||||
- name: Install Specific Papermill
|
||||
run: |
|
||||
conda activate obb
|
||||
pip uninstall papermill -y
|
||||
pip install git+https://github.com/nteract/papermill.git@main
|
||||
# Building ------------
|
||||
- name: Build Terminal.spec file
|
||||
run: |
|
||||
conda activate obb
|
||||
pyinstaller build/pyinstaller/terminal.spec --clean
|
||||
- name: Move Files into App Folder
|
||||
run: cp -r .\dist\OpenBBTerminal\ .\build\nsis\app\
|
||||
# don't need this because log collection is turned off
|
||||
# - name: Remove Log Data
|
||||
# run: Remove-Item .\build\nsis\app\openbb_terminal\logs\ -Recurse
|
||||
- name: Build Exe File
|
||||
run: |
|
||||
conda activate obb
|
||||
C:\'.\Program Files (x86)\'\nsis\makensis.exe .\build\nsis\setup.nsi
|
||||
- name: Save Build Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
workflow: windows10_build.yml
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
wait-for-completion-timeout: 2h
|
||||
|
||||
trigger-macos-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Trigger M1 MacOs Build
|
||||
uses: aurelien-baudet/workflow-dispatch@v2
|
||||
with:
|
||||
name: Windows EXE Artifact
|
||||
path: '.\build\nsis\OpenBB Terminal Setup.exe'
|
||||
- name: Run Integration Tests
|
||||
run: |
|
||||
dist\OpenBBTerminal\OpenBBTerminal.exe C:\Users\Administrator\actions-runner\_work\OpenBBTerminal\OpenBBTerminal\openbb_terminal\miscellaneous\scripts -t
|
||||
# Cleaning ------------------------
|
||||
# Make sure to add Remove-Item C:\Users\Administrator\Desktop\OPENBB-exports -Recurse whenever integration tests get fixed
|
||||
- name: Remove Previous Build
|
||||
run: |
|
||||
Remove-Item '.\build\nsis\OpenBB Terminal Setup.exe' -Recurse
|
||||
Remove-Item .\build\nsis\app\ -Recurse
|
||||
Remove-Item .\dist\ -Recurse
|
||||
Remove-Item .\build\terminal\ -Recurse
|
||||
- name: Deactivate & Remove Conda Environment
|
||||
run: |
|
||||
conda deactivate obb
|
||||
conda deactivate base
|
||||
conda env remove -n obb
|
||||
Remove-Item C:\Users\Administrator\miniconda3\envs\obb\ -Recurse
|
||||
workflow: m1_macos_build.yml
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
wait-for-completion-timeout: 2h
|
||||
|
||||
trigger-intel-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Trigger Intel MacOs Build
|
||||
uses: aurelien-baudet/workflow-dispatch@v2
|
||||
with:
|
||||
workflow: intel_macos_build.yml
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
wait-for-completion-timeout: 2h
|
||||
|
||||
trigger-docker-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Trigger docker Build
|
||||
uses: aurelien-baudet/workflow-dispatch@v2
|
||||
with:
|
||||
workflow: docker.yml
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
1
.github/workflows/test.yml
vendored
1
.github/workflows/test.yml
vendored
@@ -4,6 +4,7 @@ env:
|
||||
OPENBB_LOG_COLLECT: false
|
||||
OPENBB_USE_ION: false
|
||||
OPENBB_USE_PROMPT_TOOLKIT: false
|
||||
OPENBB_FILE_OVERWRITE: true
|
||||
PIP_DEFAULT_TIMEOUT: 100
|
||||
|
||||
on: [workflow_dispatch]
|
||||
|
||||
1
.github/workflows/unit-test.yml
vendored
1
.github/workflows/unit-test.yml
vendored
@@ -5,6 +5,7 @@ env:
|
||||
OPENBB_LOG_COLLECT: false
|
||||
OPENBB_USE_ION: false
|
||||
OPENBB_USE_PROMPT_TOOLKIT: false
|
||||
OPENBB_FILE_OVERWRITE: true
|
||||
PIP_DEFAULT_TIMEOUT: 100
|
||||
|
||||
on:
|
||||
|
||||
1
.github/workflows/windows.yml
vendored
1
.github/workflows/windows.yml
vendored
@@ -4,6 +4,7 @@ env:
|
||||
OPENBB_LOG_COLLECT: false
|
||||
OPENBB_USE_ION: false
|
||||
OPENBB_USE_PROMPT_TOOLKIT: false
|
||||
OPENBB_FILE_OVERWRITE: true
|
||||
PIP_DEFAULT_TIMEOUT: 100
|
||||
PYTHONNOUSERSITE: 1
|
||||
on:
|
||||
|
||||
104
.github/workflows/windows10_build.yml
vendored
104
.github/workflows/windows10_build.yml
vendored
@@ -1,4 +1,5 @@
|
||||
name: Windows10 Build
|
||||
|
||||
env:
|
||||
OPENBB_ENABLE_QUICK_EXIT: true
|
||||
OPENBB_LOG_COLLECT: false
|
||||
@@ -6,50 +7,74 @@ env:
|
||||
OPENBB_USE_PROMPT_TOOLKIT: false
|
||||
PIP_DEFAULT_TIMEOUT: 100
|
||||
PYTHONNOUSERSITE: 1
|
||||
|
||||
on: workflow_dispatch
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
Windows-Build:
|
||||
name: Windows10 Build
|
||||
runs-on: [self-hosted, Windows, x64]
|
||||
name: Windows10 Build ENV
|
||||
runs-on: windows-latest
|
||||
# Configuring -------------
|
||||
steps:
|
||||
- name: Setup Windows Git Configuration # This is under the assumption that git is already installed on the system
|
||||
run: |
|
||||
Set-ItemProperty 'HKLM:\System\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -value 1
|
||||
git config --system core.longpaths true
|
||||
Set-ItemProperty 'HKLM:\System\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -value 1
|
||||
git config --system core.longpaths true
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2.4.2
|
||||
- name: Activate Base & Create OpenBB Environment
|
||||
|
||||
- name: Set up Python & Create OpenBB Environment
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.9'
|
||||
|
||||
- name: Create and start virtual environment
|
||||
run: |
|
||||
conda activate base
|
||||
conda env create -n obb --file build/conda/conda-3-9-env-full.yaml
|
||||
conda init
|
||||
conda activate obb
|
||||
conda env list
|
||||
- name: Poetry Install
|
||||
# Conda activate needs to be run every time because of the way that the workflow steps work
|
||||
# on powershell where it creates a new shell every time for every step
|
||||
python -m venv venv
|
||||
source venv/Scripts/activate
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install poetry==1.1.13
|
||||
python -m pip install setuptools==64.0.2 wheel
|
||||
python -m pip install charset_normalizer==2.1.1
|
||||
python -m poetry install -E installer -E all
|
||||
python -m pip uninstall papermill -y
|
||||
python -m pip install git+https://github.com/nteract/papermill.git@main
|
||||
python -m PyInstaller build/pyinstaller/terminal.spec --clean
|
||||
|
||||
shell: bash
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: OpenBB-Windows10-ENV
|
||||
path: dist
|
||||
|
||||
|
||||
Build-Exe:
|
||||
name: Windows10 Build-Exe
|
||||
runs-on: [self-hosted, Windows, x64]
|
||||
needs: Windows-Build
|
||||
# Configuring -------------
|
||||
steps:
|
||||
- name: Setup Windows Git Configuration # This is under the assumption that git is already installed on the system
|
||||
run: |
|
||||
conda activate obb
|
||||
poetry install
|
||||
- name: Poetry Install Portfolio Optimization and Forecasting Toolkits
|
||||
run: |
|
||||
conda activate obb
|
||||
poetry install -E all
|
||||
- name: Poetry Install Installer
|
||||
run: |
|
||||
conda activate obb
|
||||
poetry install -E installer
|
||||
- name: Install Specific Papermill
|
||||
run: |
|
||||
conda activate obb
|
||||
pip uninstall papermill -y
|
||||
pip install git+https://github.com/nteract/papermill.git@main
|
||||
# Building ------------
|
||||
- name: Build Terminal.spec file
|
||||
run: |
|
||||
conda activate obb
|
||||
pyinstaller build/pyinstaller/terminal.spec --clean
|
||||
Set-ItemProperty 'HKLM:\System\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -value 1
|
||||
git config --system core.longpaths true
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2.4.2
|
||||
|
||||
- name: Download Artifact
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: OpenBB-Windows10-ENV
|
||||
path: dist
|
||||
|
||||
- name: Move Files into App Folder
|
||||
run: cp -r .\dist\OpenBBTerminal\ .\build\nsis\app\
|
||||
# don't need this because log collection is turned off
|
||||
@@ -57,16 +82,18 @@ jobs:
|
||||
# run: Remove-Item .\build\nsis\app\openbb_terminal\logs\ -Recurse
|
||||
- name: Build Exe File
|
||||
run: |
|
||||
conda activate obb
|
||||
C:\'.\Program Files (x86)\'\nsis\makensis.exe .\build\nsis\setup.nsi
|
||||
|
||||
- name: Save Build Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Windows EXE Artifact
|
||||
path: '.\build\nsis\OpenBB Terminal Setup.exe'
|
||||
|
||||
- name: Run Integration Tests
|
||||
run: |
|
||||
dist\OpenBBTerminal\OpenBBTerminal.exe C:\Users\Administrator\actions-runner\_work\OpenBBTerminal\OpenBBTerminal\openbb_terminal\miscellaneous\integration_tests_scripts -t
|
||||
dist\OpenBBTerminal\OpenBBTerminal.exe -t
|
||||
|
||||
# Cleaning ------------------------
|
||||
# Make sure to add Remove-Item C:\Users\Administrator\Desktop\OPENBB-exports -Recurse whenever integration tests get fixed
|
||||
- name: Remove Previous Build
|
||||
@@ -74,10 +101,3 @@ jobs:
|
||||
Remove-Item '.\build\nsis\OpenBB Terminal Setup.exe' -Recurse
|
||||
Remove-Item .\build\nsis\app\ -Recurse
|
||||
Remove-Item .\dist\ -Recurse
|
||||
Remove-Item .\build\terminal\ -Recurse
|
||||
- name: Deactivate & Remove Conda Environment
|
||||
run: |
|
||||
conda deactivate obb
|
||||
conda deactivate base
|
||||
conda env remove -n obb
|
||||
Remove-Item C:\Users\Administrator\miniconda3\envs\obb\ -Recurse
|
||||
|
||||
8
.pre-commit-config.yaml
vendored
8
.pre-commit-config.yaml
vendored
@@ -1,6 +1,6 @@
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.3.0
|
||||
rev: v4.4.0
|
||||
hooks:
|
||||
- id: check-yaml
|
||||
- id: end-of-file-fixer
|
||||
@@ -10,11 +10,11 @@ repos:
|
||||
- id: check-merge-conflict
|
||||
- id: detect-private-key
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.10.0
|
||||
rev: 22.12.0
|
||||
hooks:
|
||||
- id: black
|
||||
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
||||
rev: 'v0.0.212'
|
||||
rev: 'v0.0.236'
|
||||
hooks:
|
||||
- id: ruff
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
@@ -65,7 +65,7 @@ repos:
|
||||
]
|
||||
exclude: package.lock.json
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v3.2.2
|
||||
rev: v3.3.1
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args: [--py38-plus]
|
||||
|
||||
4
CONTRIBUTING.md
vendored
4
CONTRIBUTING.md
vendored
@@ -106,7 +106,7 @@ def get_most_shorted() -> pd.DataFrame:
|
||||
url = "https://finance.yahoo.com/screener/predefined/most_shorted_stocks"
|
||||
|
||||
data = pd.read_html(
|
||||
requests.get(url, headers={"User-Agent": get_user_agent()}).text
|
||||
request(url, headers={"User-Agent": get_user_agent()}).text
|
||||
)[0]
|
||||
data = data.iloc[:, :-1]
|
||||
return data
|
||||
@@ -137,7 +137,7 @@ def get_economy_calendar_events() -> pd.DataFrame:
|
||||
pd.DataFrame
|
||||
Get dataframe with economic calendar events
|
||||
"""
|
||||
response = requests.get(
|
||||
response = request(
|
||||
f"https://finnhub.io/api/v1/calendar/economic?token={cfg.API_FINNHUB_KEY}"
|
||||
)
|
||||
|
||||
|
||||
2
build/docker/compose.env
vendored
2
build/docker/compose.env
vendored
@@ -1,2 +1,2 @@
|
||||
OPENBBTERMINAL_DOCKER_REGISTRY="ghcr.io"
|
||||
OPENBBTERMINAL_DOCKER_RELEASE_VERSION="2.2.0"
|
||||
OPENBBTERMINAL_DOCKER_RELEASE_VERSION="2.3.0"
|
||||
|
||||
2
build/docker/docker-compose.yaml
vendored
2
build/docker/docker-compose.yaml
vendored
@@ -7,6 +7,6 @@ services:
|
||||
- ~/OpenBBUserData:/home/python/OpenBBUserData
|
||||
- ~/.openbb_terminal:/home/python/.openbb_terminal
|
||||
platform: linux/amd64
|
||||
image: ghcr.io/openbb-finance/openbbterminal/openbb:2.2.0
|
||||
image: ghcr.io/openbb-finance/openbbterminal/openbb:2.3.0
|
||||
stdin_open: true # docker run -i
|
||||
tty: true # docker run -t
|
||||
|
||||
2
build/nsis/setup.nsi
vendored
2
build/nsis/setup.nsi
vendored
@@ -10,7 +10,7 @@
|
||||
!define NAME "OpenBB Terminal"
|
||||
!define COMPANY "OpenBB"
|
||||
!define APPFILE "OpenBBTerminal.exe"
|
||||
!define VERSION "2.2.0"
|
||||
!define VERSION "2.3.0"
|
||||
!define SLUG "${NAME} v${VERSION}"
|
||||
|
||||
;--------------------------------
|
||||
|
||||
2
build/pyinstaller/.env
vendored
2
build/pyinstaller/.env
vendored
@@ -1,5 +1,5 @@
|
||||
OPENBB_LOGGING_APP_NAME=gst_packaged
|
||||
OPENBB_LOGGING_COMMIT_HASH=sha:4edfa4f
|
||||
OPENBB_LOGGING_COMMIT_HASH=sha:7939b37
|
||||
OPENBB_ENABLE_PREDICT=false
|
||||
OPENBB_ENABLE_CHECK_API=true
|
||||
OPENBB_ENABLE_THOUGHTS_DAY=false
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
from PyInstaller.utils.hooks import collect_all
|
||||
|
||||
datas, binaries, hiddenimports = collect_all("xgboost")
|
||||
datas, binaries, hiddenimports = collect_all("xgboost")
|
||||
|
||||
42
build/pyinstaller/terminal.spec
vendored
42
build/pyinstaller/terminal.spec
vendored
@@ -1,18 +1,15 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
import os
|
||||
import pathlib
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import scipy
|
||||
|
||||
from dotenv import set_key
|
||||
|
||||
from PyInstaller.compat import is_darwin, is_win
|
||||
from PyInstaller.building.api import PYZ, EXE, COLLECT
|
||||
from PyInstaller.building.splash import Splash
|
||||
from PyInstaller.building.api import COLLECT, EXE, PYZ
|
||||
from PyInstaller.building.build_main import Analysis
|
||||
|
||||
|
||||
# import subprocess
|
||||
from PyInstaller.building.splash import Splash
|
||||
from PyInstaller.compat import is_darwin, is_win
|
||||
|
||||
from openbb_terminal.loggers import get_commit_hash
|
||||
|
||||
@@ -23,21 +20,30 @@ build_type = (
|
||||
)
|
||||
|
||||
# Local python environment packages folder
|
||||
pathex = os.path.join(os.path.dirname(os.__file__), "site-packages")
|
||||
venv_path = Path(sys.executable).parent.parent.resolve()
|
||||
|
||||
# Check if we are running in a conda environment
|
||||
if is_darwin:
|
||||
pathex = os.path.join(os.path.dirname(os.__file__), "site-packages")
|
||||
else:
|
||||
if "site-packages" in list(venv_path.iterdir()):
|
||||
pathex = str(venv_path / "site-packages")
|
||||
else:
|
||||
pathex = str(venv_path / "lib" / "site-packages")
|
||||
|
||||
|
||||
# Removing unused ARM64 binary
|
||||
binary_to_remove = pathlib.Path(
|
||||
os.path.join(pathex, "_scs_direct.cpython-39-darwin.so")
|
||||
)
|
||||
binary_to_remove = Path(os.path.join(pathex, "_scs_direct.cpython-39-darwin.so"))
|
||||
print("Removing ARM64 Binary: _scs_direct.cpython-39-darwin.so")
|
||||
binary_to_remove.unlink(missing_ok=True)
|
||||
build_assets_folder = os.path.join(os.getcwd(), "build", "pyinstaller")
|
||||
|
||||
# Removing inspect hook
|
||||
destination = pathlib.Path(
|
||||
destination = Path(
|
||||
os.path.join(pathex, "pyinstaller/hooks/rthooks", "pyi_rth_inspect.py")
|
||||
)
|
||||
print("Replacing Pyinstaller Hook: pyi_rth_inspect.py")
|
||||
source = "build/pyinstaller/hooks/pyi_rth_inspect.py"
|
||||
source = os.path.join(build_assets_folder, "hooks", "pyi_rth_inspect.py")
|
||||
subprocess.run(["cp", source, str(destination)], check=True)
|
||||
|
||||
|
||||
@@ -77,8 +83,8 @@ added_files = [
|
||||
]
|
||||
if is_win:
|
||||
added_files.append(
|
||||
(os.path.join(f"{os.path.dirname(scipy.__file__)}.libs"), "scipy.libs/"),
|
||||
)
|
||||
(os.path.join(f"{os.path.dirname(scipy.__file__)}.libs"), "scipy.libs/"),
|
||||
)
|
||||
# Python libraries that are explicitly pulled into the bundle
|
||||
hidden_imports = [
|
||||
"sklearn.utils._cython_blas",
|
||||
@@ -103,7 +109,7 @@ hidden_imports = [
|
||||
"_sysconfigdata__darwin_darwin",
|
||||
"prophet",
|
||||
"debugpy",
|
||||
"scipy.sparse.linalg._isolve._iterative"
|
||||
"scipy.sparse.linalg._isolve._iterative",
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -80,4 +80,10 @@ class AlternativeDataController(BaseController):
|
||||
)
|
||||
|
||||
if ns_parser:
|
||||
hackernews_view.display_stories(limit=ns_parser.limit)
|
||||
hackernews_view.display_stories(
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@@ -125,6 +125,9 @@ class CovidController(BaseController):
|
||||
raw=ns_parser.raw,
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -150,6 +153,9 @@ class CovidController(BaseController):
|
||||
raw=ns_parser.raw,
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -175,6 +181,9 @@ class CovidController(BaseController):
|
||||
raw=ns_parser.raw,
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -200,6 +209,9 @@ class CovidController(BaseController):
|
||||
raw=ns_parser.raw,
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -251,4 +263,8 @@ class CovidController(BaseController):
|
||||
limit=ns_parser.limit,
|
||||
ascend=ns_parser.reverse,
|
||||
threshold=ns_parser.threshold,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@@ -133,6 +133,7 @@ def display_covid_ov(
|
||||
raw: bool = False,
|
||||
limit: int = 10,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
plot: bool = True,
|
||||
) -> None:
|
||||
"""Prints table showing historical cases and deaths by country.
|
||||
@@ -145,6 +146,8 @@ def display_covid_ov(
|
||||
Flag to display raw data
|
||||
limit: int
|
||||
Number of raw data to show
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export data
|
||||
plot: bool
|
||||
@@ -165,7 +168,14 @@ def display_covid_ov(
|
||||
)
|
||||
|
||||
if export:
|
||||
export_data(export, os.path.dirname(os.path.abspath(__file__)), "ov", data)
|
||||
data = covid_model.get_covid_ov(country, limit)
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"ov",
|
||||
data,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -175,6 +185,7 @@ def display_covid_stat(
|
||||
raw: bool = False,
|
||||
limit: int = 10,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
plot: bool = True,
|
||||
) -> None:
|
||||
"""Prints table showing historical cases and deaths by country.
|
||||
@@ -189,6 +200,8 @@ def display_covid_stat(
|
||||
Flag to display raw data
|
||||
limit: int
|
||||
Number of raw data to show
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export data
|
||||
plot : bool
|
||||
@@ -213,7 +226,13 @@ def display_covid_stat(
|
||||
cols = data.columns.tolist()
|
||||
cols = cols[-1:] + cols[:-1]
|
||||
data = data[cols]
|
||||
export_data(export, os.path.dirname(os.path.abspath(__file__)), stat, data)
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
stat,
|
||||
data,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -223,6 +242,7 @@ def display_case_slopes(
|
||||
threshold: int = 10000,
|
||||
ascend: bool = False,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing countries with the highest case slopes.
|
||||
|
||||
@@ -253,4 +273,5 @@ def display_case_slopes(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
f"slopes_{days_back}day",
|
||||
data,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -4,8 +4,7 @@ __docformat__ = "numpy"
|
||||
|
||||
import logging
|
||||
import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal.helper_funcs import request
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -24,12 +23,12 @@ def get_stories(limit: int = 10) -> pd.DataFrame:
|
||||
DataFrame with stories
|
||||
"""
|
||||
|
||||
res = requests.get("https://hacker-news.firebaseio.com/v0/topstories.json")
|
||||
res = request("https://hacker-news.firebaseio.com/v0/topstories.json")
|
||||
if res.status_code == 200:
|
||||
top_stories = res.json()
|
||||
stories = []
|
||||
for story_id in top_stories[:limit]:
|
||||
story = requests.get(
|
||||
story = request(
|
||||
f"https://hacker-news.firebaseio.com/v0/item/{story_id}.json"
|
||||
).json()
|
||||
stories.append(story)
|
||||
|
||||
@@ -15,12 +15,14 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_stories(limit: int = 10, export: str = "") -> None:
|
||||
def display_stories(limit: int = 10, export: str = "", sheet_name: str = None) -> None:
|
||||
"""View top stories from HackerNews.
|
||||
Parameters
|
||||
----------
|
||||
limit: int
|
||||
Number of stories to return
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Export dataframe data to csv,json,xlsx file
|
||||
"""
|
||||
@@ -28,4 +30,10 @@ def display_stories(limit: int = 10, export: str = "") -> None:
|
||||
if not df.empty:
|
||||
df.columns = [col.capitalize() for col in df.columns]
|
||||
print_rich_table(df, title="HackerNews Top Stories")
|
||||
export_data(export, os.path.dirname(os.path.abspath(__file__)), "hn", df)
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"hn",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -6,13 +6,12 @@ import logging
|
||||
from typing import Any, Dict, Optional
|
||||
import math
|
||||
from datetime import datetime
|
||||
import requests
|
||||
import pandas as pd
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal.helper_funcs import get_user_agent
|
||||
from openbb_terminal.helper_funcs import get_user_agent, request
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -33,7 +32,7 @@ def get_github_data(url: str, **kwargs) -> Optional[Dict[str, Any]]:
|
||||
Dict[str, Any]
|
||||
Dictionary with data
|
||||
"""
|
||||
res = requests.get(
|
||||
res = request(
|
||||
url,
|
||||
headers={
|
||||
"Authorization": f"token {cfg.API_GITHUB_KEY}",
|
||||
|
||||
@@ -26,7 +26,10 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_star_history(
|
||||
repo: str, export: str = "", external_axes: Optional[List[plt.Axes]] = None
|
||||
repo: str,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots repo summary [Source: https://api.github.com].
|
||||
|
||||
@@ -58,7 +61,13 @@ def display_star_history(
|
||||
if external_axes is None:
|
||||
theme.visualize_output()
|
||||
|
||||
export_data(export, os.path.dirname(os.path.abspath(__file__)), "sh", df)
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"sh",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -67,6 +76,7 @@ def display_top_repos(
|
||||
categories: str = "",
|
||||
limit: int = 10,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots repo summary [Source: https://api.github.com].
|
||||
@@ -116,11 +126,17 @@ def display_top_repos(
|
||||
if external_axes is None:
|
||||
theme.visualize_output()
|
||||
|
||||
export_data(export, os.path.dirname(os.path.abspath(__file__)), "tr", df)
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"tr",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_repo_summary(repo: str, export: str = "") -> None:
|
||||
def display_repo_summary(repo: str, export: str = "", sheet_name: str = None) -> None:
|
||||
"""Prints table showing repo summary [Source: https://api.github.com].
|
||||
|
||||
Parameters
|
||||
@@ -141,4 +157,5 @@ def display_repo_summary(repo: str, export: str = "") -> None:
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"rs",
|
||||
data,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -121,7 +121,11 @@ class OSSController(BaseController):
|
||||
if ns_parser:
|
||||
if valid_repo(ns_parser.repo):
|
||||
github_view.display_repo_summary(
|
||||
repo=ns_parser.repo, export=ns_parser.export
|
||||
repo=ns_parser.repo,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -200,6 +204,9 @@ class OSSController(BaseController):
|
||||
show_growth=ns_parser.show_growth,
|
||||
chart_type=ns_parser.chart_type,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -244,4 +251,7 @@ class OSSController(BaseController):
|
||||
categories=ns_parser.categories,
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@@ -9,7 +9,7 @@ from requests.adapters import HTTPAdapter, RetryError
|
||||
from urllib3.util.retry import Retry
|
||||
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.helper_funcs import get_user_agent
|
||||
from openbb_terminal.helper_funcs import get_user_agent, request
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -80,7 +80,7 @@ def _make_request(url: str) -> Union[BeautifulSoup, None]:
|
||||
headers = {"User-Agent": get_user_agent()}
|
||||
session = _retry_session("https://runacap.com/")
|
||||
try:
|
||||
req = session.get(url, headers=headers, timeout=5)
|
||||
req = session.get(url, headers=headers)
|
||||
except Exception as error:
|
||||
logger.exception(str(error))
|
||||
console.print(error)
|
||||
@@ -109,7 +109,7 @@ def get_startups() -> pd.DataFrame:
|
||||
pd.DataFrame
|
||||
list of startups
|
||||
"""
|
||||
response = requests.get("https://runacap.com/ross-index/", timeout=10)
|
||||
response = request("https://runacap.com/ross-index/")
|
||||
soup = BeautifulSoup(response.content, "html.parser")
|
||||
startups = []
|
||||
if soup:
|
||||
|
||||
@@ -20,6 +20,8 @@ from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_rossindex(
|
||||
@@ -30,6 +32,7 @@ def display_rossindex(
|
||||
show_growth: bool = True,
|
||||
chart_type: str = "stars",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots list of startups from ross index [Source: https://runacap.com/]
|
||||
@@ -128,4 +131,5 @@ def display_rossindex(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"runaidx",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ __docformat__ = "numpy"
|
||||
import logging
|
||||
|
||||
import pandas as pd
|
||||
import requests
|
||||
from openbb_terminal.helper_funcs import request
|
||||
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
|
||||
@@ -25,7 +25,7 @@ def get_sentiment(symbol: str) -> pd.DataFrame:
|
||||
pd.DataFrame
|
||||
Empty if there was an issue with data retrieval
|
||||
"""
|
||||
result = requests.get(f"https://api.finbrain.tech/v0/sentiments/{symbol}")
|
||||
result = request(f"https://api.finbrain.tech/v0/sentiments/{symbol}")
|
||||
sentiment = pd.DataFrame()
|
||||
if result.status_code == 200:
|
||||
result_json = result.json()
|
||||
|
||||
@@ -37,6 +37,7 @@ def display_sentiment_analysis(
|
||||
symbol: str,
|
||||
raw: bool = False,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots Sentiment analysis from FinBrain. Prints table if raw is True. [Source: FinBrain]
|
||||
@@ -47,6 +48,8 @@ def display_sentiment_analysis(
|
||||
Ticker symbol to get the sentiment analysis from
|
||||
raw: False
|
||||
Display raw table data
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export data
|
||||
external_axes: Optional[List[plt.Axes]], optional
|
||||
@@ -138,5 +141,9 @@ def display_sentiment_analysis(
|
||||
)
|
||||
|
||||
export_data(
|
||||
export, os.path.dirname(os.path.abspath(__file__)), "headlines", sentiment
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"headlines",
|
||||
sentiment,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -4,8 +4,8 @@ __docformat__ = "numpy"
|
||||
import logging
|
||||
|
||||
import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal.helper_funcs import request
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
@@ -28,7 +28,7 @@ def get_sentiment_stats(ticker: str) -> pd.DataFrame:
|
||||
pd.DataFrame
|
||||
Get sentiment stats
|
||||
"""
|
||||
response = requests.get(
|
||||
response = request(
|
||||
f"https://finnhub.io/api/v1/news-sentiment?symbol={ticker}&token={cfg.API_FINNHUB_KEY}"
|
||||
)
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_FINNHUB_KEY"])
|
||||
def display_sentiment_stats(ticker: str, export: str = ""):
|
||||
def display_sentiment_stats(ticker: str, export: str = "", sheet_name: str = None):
|
||||
"""
|
||||
Prints Sentiment stats which displays buzz, news score, articles last week, articles weekly average,
|
||||
bullish vs bearish percentages, sector average bullish percentage, and sector average news score
|
||||
@@ -55,6 +55,7 @@ Sector Average News Score: {round(100*d_stats['sectorAverageNewsScore'],2)} %"""
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"stats",
|
||||
pd.DataFrame(d_stats),
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
else:
|
||||
|
||||
@@ -27,6 +27,7 @@ def display_mentions(
|
||||
symbol: str,
|
||||
start_date: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots weekly bars of stock's interest over time. other users watchlist. [Source: Google].
|
||||
@@ -37,6 +38,8 @@ def display_mentions(
|
||||
Ticker symbol
|
||||
start_date : str
|
||||
Start date as YYYY-MM-DD string
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export data
|
||||
external_axes : Optional[List[plt.Axes]], optional
|
||||
@@ -80,7 +83,11 @@ def display_mentions(
|
||||
theme.visualize_output()
|
||||
|
||||
export_data(
|
||||
export, os.path.dirname(os.path.abspath(__file__)), "mentions", df_interest
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"mentions",
|
||||
df_interest,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -90,6 +97,7 @@ def display_correlation_interest(
|
||||
data: pd.DataFrame,
|
||||
words: List[str],
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots interest over time of words/sentences versus stock price. [Source: Google].
|
||||
@@ -102,6 +110,8 @@ def display_correlation_interest(
|
||||
Data dataframe
|
||||
words : List[str]
|
||||
Words to check for interest for
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export data
|
||||
external_axes : Optional[List[plt.Axes]], optional
|
||||
@@ -136,6 +146,8 @@ def display_correlation_interest(
|
||||
colors = theme.get_colors()[1:]
|
||||
for idx, word in enumerate(words):
|
||||
df_interest = google_model.get_mentions(word)
|
||||
if df_interest.empty:
|
||||
continue
|
||||
ax[1].plot(df_interest.index, df_interest[word], "-", color=colors[idx])
|
||||
|
||||
ax[1].set_ylabel("Interest [%]")
|
||||
@@ -148,7 +160,11 @@ def display_correlation_interest(
|
||||
theme.visualize_output()
|
||||
|
||||
export_data(
|
||||
export, os.path.dirname(os.path.abspath(__file__)), "interest", df_interest
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"interest",
|
||||
df_interest,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -157,6 +173,7 @@ def display_regions(
|
||||
symbol: str,
|
||||
limit: int = 5,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots bars of regions based on stock's interest. [Source: Google].
|
||||
@@ -167,6 +184,8 @@ def display_regions(
|
||||
Ticker symbol
|
||||
limit: int
|
||||
Number of regions to show
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export data
|
||||
external_axes : Optional[List[plt.Axes]], optional
|
||||
@@ -199,11 +218,19 @@ def display_regions(
|
||||
if external_axes is None:
|
||||
theme.visualize_output()
|
||||
|
||||
export_data(export, os.path.dirname(os.path.abspath(__file__)), "regions", df)
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"regions",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_queries(symbol: str, limit: int = 5, export: str = ""):
|
||||
def display_queries(
|
||||
symbol: str, limit: int = 5, export: str = "", sheet_name: str = None
|
||||
):
|
||||
"""Prints table showing top related queries with this stock's query. [Source: Google].
|
||||
|
||||
Parameters
|
||||
@@ -212,6 +239,8 @@ def display_queries(symbol: str, limit: int = 5, export: str = ""):
|
||||
Ticker symbol
|
||||
limit: int
|
||||
Number of regions to show
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export data
|
||||
{"csv","json","xlsx","png","jpg","pdf","svg"}
|
||||
@@ -233,11 +262,14 @@ def display_queries(symbol: str, limit: int = 5, export: str = ""):
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"queries",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_rise(symbol: str, limit: int = 10, export: str = ""):
|
||||
def display_rise(
|
||||
symbol: str, limit: int = 10, export: str = "", sheet_name: str = None
|
||||
):
|
||||
"""Prints top rising related queries with this stock's query. [Source: Google].
|
||||
|
||||
Parameters
|
||||
@@ -246,6 +278,8 @@ def display_rise(symbol: str, limit: int = 10, export: str = ""):
|
||||
Ticker symbol
|
||||
limit: int
|
||||
Number of queries to show
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export data
|
||||
"""
|
||||
@@ -261,5 +295,9 @@ def display_rise(symbol: str, limit: int = 10, export: str = ""):
|
||||
)
|
||||
|
||||
export_data(
|
||||
export, os.path.dirname(os.path.abspath(__file__)), "rise", df_related_queries
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"rise",
|
||||
df_related_queries,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -193,7 +193,11 @@ def display_watchlist(limit: int = 5):
|
||||
]
|
||||
)
|
||||
def display_popular_tickers(
|
||||
limit: int = 10, post_limit: int = 50, subreddits: str = "", export: str = ""
|
||||
limit: int = 10,
|
||||
post_limit: int = 50,
|
||||
subreddits: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
):
|
||||
"""Prints table showing latest popular tickers. [Source: Reddit].
|
||||
|
||||
@@ -224,6 +228,7 @@ def display_popular_tickers(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"popular",
|
||||
popular_tickers_df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -408,6 +413,7 @@ def display_redditsent(
|
||||
subreddits: str = "all",
|
||||
display: bool = False,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots Reddit sentiment about a search term. Prints table showing if display is True.
|
||||
@@ -430,6 +436,8 @@ def display_redditsent(
|
||||
Comma-separated list of subreddits
|
||||
display: bool
|
||||
Enable printing of raw sentiment values for each post
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export data
|
||||
external_axes: Optional[List[plt.Axes]]
|
||||
@@ -469,4 +477,5 @@ def display_redditsent(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"polarity_scores",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -1,195 +0,0 @@
|
||||
"""SentimentInvestor Model"""
|
||||
__docformat__ = "numpy"
|
||||
|
||||
from typing import Union, Dict, Optional
|
||||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
|
||||
import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end, check_api_key
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_SENTIMENTINVESTOR_TOKEN"])
|
||||
def get_historical(
|
||||
symbol: str,
|
||||
start_date: Optional[str] = None,
|
||||
end_date: Optional[str] = None,
|
||||
number: int = 100,
|
||||
) -> pd.DataFrame:
|
||||
"""Get hour-level sentiment data for the chosen symbol.
|
||||
|
||||
Source: [Sentiment Investor]
|
||||
|
||||
Parameters
|
||||
----------
|
||||
symbol: str
|
||||
Ticker to view sentiment data
|
||||
start_date: Optional[str]
|
||||
Initial date like string or unix timestamp (e.g. 12-21-2021)
|
||||
end_date: Optional[str]
|
||||
End date like string or unix timestamp (e.g. 12-21-2021)
|
||||
number : int
|
||||
Number of results returned by API call
|
||||
Maximum 250 per api call
|
||||
|
||||
Returns
|
||||
-------
|
||||
pd.DataFrame
|
||||
Dataframe of historical sentiment
|
||||
"""
|
||||
|
||||
if start_date is None:
|
||||
start_date = (datetime.utcnow() - timedelta(days=7)).strftime("%Y-%m-%d")
|
||||
|
||||
if end_date is None:
|
||||
end_date = datetime.utcnow().strftime("%Y-%m-%d")
|
||||
|
||||
payload: Dict[str, Union[int, str]] = {
|
||||
"token": cfg.API_SENTIMENTINVESTOR_TOKEN,
|
||||
"symbol": symbol,
|
||||
"start": str(start_date),
|
||||
"end": str(end_date),
|
||||
"limit": number,
|
||||
}
|
||||
|
||||
response = requests.get(
|
||||
"https://api.sentimentinvestor.com/v1/historical", params=payload
|
||||
)
|
||||
response_json = response.json()
|
||||
|
||||
df = pd.DataFrame()
|
||||
|
||||
if "results" in response_json:
|
||||
if response_json["results"]:
|
||||
df = pd.DataFrame(response_json["results"])
|
||||
df = df.set_index("timestamp_date")
|
||||
df.index = pd.to_datetime(df.index)
|
||||
else:
|
||||
console.print("No data found.\n")
|
||||
|
||||
elif "error" in response_json:
|
||||
if "Authorization error" in response_json["error"]:
|
||||
console.print("[red]Invalid API Key[/red]\n")
|
||||
else:
|
||||
console.print({response_json["error"]})
|
||||
|
||||
return df
|
||||
|
||||
|
||||
@check_api_key(["API_SENTIMENTINVESTOR_TOKEN"])
|
||||
def check_supported_ticker(symbol: str) -> bool:
|
||||
"""Check if the ticker is supported.
|
||||
|
||||
Source: [Sentiment Investor]
|
||||
|
||||
Parameters
|
||||
----------
|
||||
symbol: str
|
||||
Ticker symbol to view sentiment data
|
||||
|
||||
Returns
|
||||
-------
|
||||
bool
|
||||
True if ticker is supported
|
||||
"""
|
||||
|
||||
payload: Dict[str, str] = {
|
||||
"token": cfg.API_SENTIMENTINVESTOR_TOKEN,
|
||||
"symbol": symbol,
|
||||
}
|
||||
|
||||
response = requests.get(
|
||||
"https://api.sentimentinvestor.com/v1/supported", params=payload
|
||||
)
|
||||
if response.status_code >= 500:
|
||||
return False
|
||||
response_json = response.json()
|
||||
|
||||
result = False
|
||||
|
||||
if "result" in response_json:
|
||||
# if ticker is valid, payload has result key
|
||||
if response_json["result"]:
|
||||
result = response_json["result"]
|
||||
else:
|
||||
console.print(
|
||||
f"[red]Ticker {symbol} not supported. Please try another one![/red]\n"
|
||||
)
|
||||
|
||||
elif "error" in response_json:
|
||||
if "Authorization error" in response_json["error"]:
|
||||
console.print("[red]Invalid API Key[/red]\n")
|
||||
else:
|
||||
console.print({response_json["error"]})
|
||||
|
||||
return result
|
||||
|
||||
|
||||
@check_api_key(["API_SENTIMENTINVESTOR_TOKEN"])
|
||||
def get_trending(
|
||||
start_date: Optional[str] = None,
|
||||
hour: int = 0,
|
||||
number: int = 10,
|
||||
) -> pd.DataFrame:
|
||||
"""Get sentiment data on the most talked about tickers
|
||||
within the last hour Source: [Sentiment Investor].
|
||||
|
||||
Parameters
|
||||
----------
|
||||
start_date : Optional[str]
|
||||
Initial date, format YYYY-MM-DD
|
||||
hour: int
|
||||
Hour of the day in 24-hour notation (e.g. 14)
|
||||
number : int
|
||||
Number of results returned by API call
|
||||
Maximum 250 per api call
|
||||
|
||||
Returns
|
||||
-------
|
||||
pd.DataFrame
|
||||
Dataframe of trending data
|
||||
"""
|
||||
|
||||
if start_date is None:
|
||||
start_date = datetime.today().strftime("%Y-%m-%d")
|
||||
|
||||
# type is datetime
|
||||
start_timestamp = datetime.strptime(start_date, "%Y-%m-%d") + timedelta(hours=hour)
|
||||
|
||||
payload: Dict[str, Union[int, str]] = {
|
||||
"token": cfg.API_SENTIMENTINVESTOR_TOKEN,
|
||||
"start": str(start_timestamp),
|
||||
"end": str(start_timestamp),
|
||||
"limit": number,
|
||||
}
|
||||
|
||||
response = requests.get(
|
||||
"https://api.sentimentinvestor.com/v1/trending", params=payload
|
||||
)
|
||||
if response.status_code >= 500:
|
||||
return pd.DataFrame()
|
||||
|
||||
response_json = response.json()
|
||||
|
||||
df = pd.DataFrame()
|
||||
|
||||
if "results" in response_json:
|
||||
if response_json["results"]:
|
||||
df = pd.DataFrame(response_json["results"])
|
||||
else:
|
||||
console.print(f"No data found for start date of {str(start_timestamp)}.\n")
|
||||
|
||||
elif "error" in response_json:
|
||||
if "Authorization error" in response_json["error"]:
|
||||
console.print("[red]Invalid API Key[/red]\n")
|
||||
else:
|
||||
console.print({response_json["error"]})
|
||||
|
||||
return df
|
||||
@@ -1,217 +0,0 @@
|
||||
"""SentimentInvestor View"""
|
||||
__docformat__ = "numpy"
|
||||
|
||||
import logging
|
||||
import os
|
||||
from typing import Optional, List
|
||||
from datetime import datetime, timedelta
|
||||
from matplotlib import pyplot as plt
|
||||
from matplotlib.lines import Line2D
|
||||
import pandas as pd
|
||||
|
||||
from openbb_terminal.config_terminal import theme
|
||||
from openbb_terminal.config_plot import PLOT_DPI
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal.common.behavioural_analysis import sentimentinvestor_model
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key
|
||||
from openbb_terminal.helper_funcs import (
|
||||
export_data,
|
||||
print_rich_table,
|
||||
plot_autoscale,
|
||||
is_valid_axes_count,
|
||||
)
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_SENTIMENTINVESTOR_TOKEN"])
|
||||
def display_historical(
|
||||
symbol: str,
|
||||
start_date: Optional[str] = None,
|
||||
end_date: Optional[str] = None,
|
||||
number: int = 100,
|
||||
raw: bool = False,
|
||||
limit: int = 10,
|
||||
export: str = "",
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Display historical sentiment data of a ticker,
|
||||
and plot a chart with RHI and AHI.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
symbol: str
|
||||
Ticker symbol to view sentiment data
|
||||
start_date: Optional[str]
|
||||
Initial date like string or unix timestamp (e.g. 2021-12-21)
|
||||
end_date: Optional[str]
|
||||
End date like string or unix timestamp (e.g. 2022-01-15)
|
||||
number: int
|
||||
Number of results returned by API call
|
||||
Maximum 250 per api call
|
||||
raw: boolean
|
||||
Whether to display raw data, by default False
|
||||
limit: int
|
||||
Number of results display on the terminal
|
||||
Default: 10
|
||||
export: str
|
||||
Format to export data
|
||||
external_axes: Optional[List[plt.Axes]], optional
|
||||
External axes (2 axes are expected in the list), by default None
|
||||
"""
|
||||
|
||||
if start_date is None:
|
||||
start_date = (datetime.utcnow() - timedelta(days=7)).strftime("%Y-%m-%d")
|
||||
|
||||
if end_date is None:
|
||||
end_date = datetime.utcnow().strftime("%Y-%m-%d")
|
||||
|
||||
supported_ticker = sentimentinvestor_model.check_supported_ticker(symbol)
|
||||
|
||||
# Check to see if the ticker is supported
|
||||
if not supported_ticker:
|
||||
logger.error("Ticker not supported")
|
||||
console.print(
|
||||
f"[red]Ticker {symbol} not supported. Please try another one![/red]\n"
|
||||
)
|
||||
return
|
||||
|
||||
df = sentimentinvestor_model.get_historical(symbol, start_date, end_date, number)
|
||||
|
||||
if df.empty:
|
||||
return
|
||||
|
||||
# This plot has 2 axes
|
||||
if external_axes is None:
|
||||
_, ax1 = plt.subplots(figsize=plot_autoscale(), dpi=PLOT_DPI)
|
||||
ax2 = ax1.twinx()
|
||||
elif is_valid_axes_count(external_axes, 2):
|
||||
(ax1, ax2) = external_axes
|
||||
else:
|
||||
return
|
||||
|
||||
ax1.plot(df.index, df["RHI"], color=theme.get_colors()[0])
|
||||
|
||||
ax2.plot(df.index, df["AHI"], color=theme.get_colors(reverse=True)[0])
|
||||
|
||||
ax1.set_ylabel("RHI")
|
||||
ax1.set_title("Hourly-level data of RHI and AHI")
|
||||
ax1.set_xlim(df.index[0], df.index[-1])
|
||||
theme.style_primary_axis(ax1)
|
||||
ax1.yaxis.set_label_position("left")
|
||||
|
||||
ax2.set_ylabel("AHI")
|
||||
|
||||
theme.style_primary_axis(ax2)
|
||||
ax2.yaxis.set_label_position("right")
|
||||
ax2.grid(visible=False)
|
||||
|
||||
# Manually construct the chart legend
|
||||
colors = [theme.get_colors()[0], theme.get_colors(reverse=True)[0]]
|
||||
lines = [Line2D([0], [0], color=c) for c in colors]
|
||||
labels = ["RHI", "AHI"]
|
||||
ax2.legend(lines, labels)
|
||||
|
||||
if external_axes is None:
|
||||
theme.visualize_output()
|
||||
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"hist",
|
||||
df,
|
||||
)
|
||||
|
||||
RAW_COLS = ["twitter", "stocktwits", "yahoo", "likes", "RHI", "AHI"]
|
||||
|
||||
if raw:
|
||||
df.index = df.index.strftime("%Y-%m-%d %H:%M")
|
||||
df.index.name = "Time"
|
||||
|
||||
print_rich_table(
|
||||
df[RAW_COLS].head(limit),
|
||||
headers=[
|
||||
"Twitter",
|
||||
"Stocktwits",
|
||||
"Yahoo",
|
||||
"Likes",
|
||||
"RHI",
|
||||
"AHI",
|
||||
],
|
||||
show_index=True,
|
||||
index_name="Time",
|
||||
title="Historical Sentiment Data",
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_SENTIMENTINVESTOR_TOKEN"])
|
||||
def display_trending(
|
||||
start_date: Optional[str] = None,
|
||||
hour: int = 0,
|
||||
number: int = 10,
|
||||
limit: int = 10,
|
||||
export: str = "",
|
||||
):
|
||||
"""Display most talked about tickers within
|
||||
the last hour together with their sentiment data.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
start_date : Optional[str]
|
||||
Initial date, format YYYY-MM-DD
|
||||
hour: int
|
||||
Hour of the day in 24-hour notation (e.g. 14)
|
||||
number : int
|
||||
Number of results returned by API call
|
||||
Maximum 250 per api call
|
||||
limit: int
|
||||
Number of results display on the terminal
|
||||
Default: 10
|
||||
export: str
|
||||
Format to export data
|
||||
"""
|
||||
|
||||
if start_date is None:
|
||||
start_date = datetime.today().strftime("%Y-%m-%d")
|
||||
|
||||
df = sentimentinvestor_model.get_trending(start_date, hour, number)
|
||||
|
||||
if df.empty:
|
||||
return
|
||||
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"trend",
|
||||
df,
|
||||
)
|
||||
|
||||
RAW_COLS = [
|
||||
"total",
|
||||
"twitter",
|
||||
"stocktwits",
|
||||
"yahoo",
|
||||
"likes",
|
||||
"RHI",
|
||||
"AHI",
|
||||
]
|
||||
|
||||
RAW_COLS = [col for col in RAW_COLS if col in df.columns.tolist()]
|
||||
|
||||
df.ticker = df.ticker.str.upper()
|
||||
df = df.set_index("ticker")
|
||||
|
||||
df.timestamp_date = pd.to_datetime(df.timestamp_date)
|
||||
timestamp = df.timestamp_date[0].strftime("%Y-%m-%d %H:%M")
|
||||
|
||||
print_rich_table(
|
||||
df[RAW_COLS].head(limit),
|
||||
headers=[col.upper() for col in RAW_COLS],
|
||||
show_index=True,
|
||||
index_name="TICKER",
|
||||
title=f"Most trending stocks at {timestamp}",
|
||||
)
|
||||
@@ -5,9 +5,9 @@ import logging
|
||||
from typing import Any, Dict, List, Tuple
|
||||
|
||||
import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.helper_funcs import request
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -29,9 +29,7 @@ def get_bullbear(symbol: str) -> Tuple[int, int, int, int]:
|
||||
Number of bullish statements,
|
||||
Number of bearish statements,
|
||||
"""
|
||||
result = requests.get(
|
||||
f"https://api.stocktwits.com/api/2/streams/symbol/{symbol}.json"
|
||||
)
|
||||
result = request(f"https://api.stocktwits.com/api/2/streams/symbol/{symbol}.json")
|
||||
if result.status_code == 200:
|
||||
result_json = result.json()
|
||||
watchlist_count = result_json["symbol"]["watchlist_count"]
|
||||
@@ -64,9 +62,7 @@ def get_messages(symbol: str, limit: int = 30) -> pd.DataFrame:
|
||||
pd.DataFrame
|
||||
Dataframe of messages
|
||||
"""
|
||||
result = requests.get(
|
||||
f"https://api.stocktwits.com/api/2/streams/symbol/{symbol}.json"
|
||||
)
|
||||
result = request(f"https://api.stocktwits.com/api/2/streams/symbol/{symbol}.json")
|
||||
if result.status_code == 200:
|
||||
return pd.DataFrame(
|
||||
[message["body"] for message in result.json()["messages"][:limit]]
|
||||
@@ -84,7 +80,7 @@ def get_trending() -> pd.DataFrame:
|
||||
pd.DataFrame
|
||||
Dataframe of trending tickers and watchlist count
|
||||
"""
|
||||
result = requests.get("https://api.stocktwits.com/api/2/trending/symbols.json")
|
||||
result = request("https://api.stocktwits.com/api/2/trending/symbols.json")
|
||||
if result.status_code == 200:
|
||||
l_symbols = [
|
||||
[symbol["symbol"], symbol["watchlist_count"], symbol["title"]]
|
||||
@@ -115,7 +111,7 @@ def get_stalker(user: str, limit: int = 30) -> List[Dict[str, Any]]:
|
||||
List[Dict[str, Any]]
|
||||
List of posts
|
||||
"""
|
||||
result = requests.get(f"https://api.stocktwits.com/api/2/streams/user/{user}.json")
|
||||
result = request(f"https://api.stocktwits.com/api/2/streams/user/{user}.json")
|
||||
if result.status_code == 200:
|
||||
return list(result.json()["messages"][:limit])
|
||||
|
||||
|
||||
@@ -6,12 +6,11 @@ import logging
|
||||
from typing import Optional
|
||||
|
||||
import pandas as pd
|
||||
import requests
|
||||
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.helper_funcs import clean_tweet, get_data
|
||||
from openbb_terminal.helper_funcs import clean_tweet, get_data, request
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -58,7 +57,7 @@ def load_analyze_tweets(
|
||||
params["end_time"] = end_date
|
||||
|
||||
# Request Twitter API
|
||||
response = requests.get(
|
||||
response = request(
|
||||
"https://api.twitter.com/2/tweets/search/recent",
|
||||
params=params, # type: ignore
|
||||
headers={"authorization": "Bearer " + cfg.API_TWITTER_BEARER_TOKEN},
|
||||
|
||||
@@ -26,7 +26,9 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_inference(symbol: str, limit: int = 100, export: str = ""):
|
||||
def display_inference(
|
||||
symbol: str, limit: int = 100, export: str = "", sheet_name: str = None
|
||||
):
|
||||
"""Prints Inference sentiment from past n tweets.
|
||||
|
||||
Parameters
|
||||
@@ -35,6 +37,8 @@ def display_inference(symbol: str, limit: int = 100, export: str = ""):
|
||||
Stock ticker symbol
|
||||
limit: int
|
||||
Number of tweets to analyze
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export tweet dataframe
|
||||
"""
|
||||
@@ -72,7 +76,13 @@ def display_inference(symbol: str, limit: int = 100, export: str = ""):
|
||||
f"Of the last {len(df_tweets)} tweets, {100*percent_neg:.2f} % had a higher negative sentiment"
|
||||
)
|
||||
|
||||
export_data(export, os.path.dirname(os.path.abspath(__file__)), "infer", df_tweets)
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"infer",
|
||||
df_tweets,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -82,6 +92,7 @@ def display_sentiment(
|
||||
n_days_past: int = 2,
|
||||
compare: bool = False,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots sentiments from symbol
|
||||
@@ -96,6 +107,8 @@ def display_sentiment(
|
||||
Number of days to extract tweets for
|
||||
compare: bool
|
||||
Show corresponding change in stock price
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export tweet dataframe
|
||||
external_axes: Optional[List[plt.Axes]], optional
|
||||
@@ -185,5 +198,9 @@ def display_sentiment(
|
||||
theme.visualize_output()
|
||||
|
||||
export_data(
|
||||
export, os.path.dirname(os.path.abspath(__file__)), "sentiment", df_tweets
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"sentiment",
|
||||
df_tweets,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -18,6 +18,7 @@ def display_news(
|
||||
sources: str = "",
|
||||
limit: int = 5,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
sort: str = "published",
|
||||
):
|
||||
"""Plots news for a given term and source. [Source: Feedparser]
|
||||
@@ -48,4 +49,5 @@ def display_news(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
f"news_{'_'.join(term)}_{'_'.join(sources)}",
|
||||
articles,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -5,11 +5,11 @@ import logging
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Any, List, Optional, Tuple
|
||||
import requests
|
||||
import pandas as pd
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal.helper_funcs import request
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -58,7 +58,7 @@ def get_news(
|
||||
|
||||
link += f"&apiKey={cfg.API_NEWS_TOKEN}"
|
||||
|
||||
response = requests.get(link)
|
||||
response = request(link)
|
||||
|
||||
articles = {}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ def display_news(
|
||||
show_newest: bool = True,
|
||||
sources: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing news for a given term. [Source: NewsAPI]
|
||||
|
||||
@@ -53,4 +54,5 @@ def display_news(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
f"news_{query}_{'_'.join(sources)}",
|
||||
pd.DataFrame(tables),
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -50,7 +50,9 @@ def lambda_color_red(val: Any) -> str:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_summary(data: pd.DataFrame, export: str = "") -> None:
|
||||
def display_summary(
|
||||
data: pd.DataFrame, export: str = "", sheet_name: str = None
|
||||
) -> None:
|
||||
"""Prints table showing summary statistics
|
||||
|
||||
Parameters
|
||||
@@ -75,6 +77,7 @@ def display_summary(data: pd.DataFrame, export: str = "") -> None:
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"summary",
|
||||
summary,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -161,6 +164,7 @@ def display_cdf(
|
||||
target: str,
|
||||
symbol: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots Cumulative Distribution Function
|
||||
@@ -263,6 +267,7 @@ def display_cdf(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"cdf",
|
||||
pd.DataFrame(cdf),
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -660,6 +665,7 @@ def display_seasonal(
|
||||
target: str,
|
||||
multiplicative: bool = False,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots seasonal decomposition data
|
||||
@@ -798,11 +804,14 @@ def display_seasonal(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"summary",
|
||||
cycle.join(trend),
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_normality(data: pd.DataFrame, target: str, export: str = "") -> None:
|
||||
def display_normality(
|
||||
data: pd.DataFrame, target: str, export: str = "", sheet_name: str = None
|
||||
) -> None:
|
||||
"""Prints table showing normality statistics
|
||||
|
||||
Parameters
|
||||
@@ -832,6 +841,7 @@ def display_normality(data: pd.DataFrame, target: str, export: str = "") -> None
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"normality",
|
||||
normal,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -842,6 +852,7 @@ def display_unitroot(
|
||||
fuller_reg: str = "c",
|
||||
kpss_reg: str = "c",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
):
|
||||
"""Prints table showing unit root test calculations
|
||||
|
||||
@@ -873,6 +884,7 @@ def display_unitroot(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"unitroot",
|
||||
data,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -883,6 +895,7 @@ def display_raw(
|
||||
ascend: bool = False,
|
||||
limit: int = 20,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing raw stock data
|
||||
|
||||
@@ -931,6 +944,7 @@ def display_raw(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"raw",
|
||||
data,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -942,6 +956,7 @@ def display_line(
|
||||
markers_lines: Optional[List[datetime]] = None,
|
||||
markers_scatter: Optional[List[datetime]] = None,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Display line plot of data
|
||||
@@ -958,6 +973,8 @@ def display_line(
|
||||
List of dates to highlight using vertical lines
|
||||
markers_scatter: Optional[List[datetime]]
|
||||
List of dates to highlight using scatter
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export data
|
||||
external_axes : Optional[List[plt.Axes]], optional
|
||||
@@ -1042,6 +1059,7 @@ def display_line(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"line",
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ def display_mean_std(
|
||||
symbol: str = "",
|
||||
window: int = 14,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots mean std deviation
|
||||
@@ -43,6 +44,8 @@ def display_mean_std(
|
||||
Stock ticker
|
||||
window : int
|
||||
Length of window
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export data
|
||||
external_axes: Optional[List[plt.Axes]], optional
|
||||
@@ -128,6 +131,7 @@ def display_mean_std(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"rolling",
|
||||
rolling_mean.join(rolling_std, lsuffix="_mean", rsuffix="_std"),
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -138,6 +142,7 @@ def display_spread(
|
||||
symbol: str = "",
|
||||
window: int = 14,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots rolling spread
|
||||
@@ -154,6 +159,8 @@ def display_spread(
|
||||
Stock ticker
|
||||
window : int
|
||||
Length of window
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export data
|
||||
external_axes: Optional[List[plt.Axes]], optional
|
||||
@@ -238,6 +245,7 @@ def display_spread(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"spread",
|
||||
df_sd.join(df_var, lsuffix="_sd", rsuffix="_var"),
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -249,6 +257,7 @@ def display_quantile(
|
||||
window: int = 14,
|
||||
quantile: float = 0.5,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots rolling quantile
|
||||
@@ -265,6 +274,8 @@ def display_quantile(
|
||||
Length of window
|
||||
quantile: float
|
||||
Quantile to get
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export data
|
||||
external_axes: Optional[List[plt.Axes]], optional
|
||||
@@ -334,6 +345,7 @@ def display_quantile(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"quantile",
|
||||
df_med.join(df_quantile),
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -344,6 +356,7 @@ def display_skew(
|
||||
target: str,
|
||||
window: int = 14,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots rolling skew
|
||||
@@ -358,6 +371,8 @@ def display_skew(
|
||||
Column in data to look at
|
||||
window: int
|
||||
Length of window
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export data
|
||||
external_axes: Optional[List[plt.Axes]], optional
|
||||
@@ -417,6 +432,7 @@ def display_skew(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"skew",
|
||||
df_skew,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -427,6 +443,7 @@ def display_kurtosis(
|
||||
target: str,
|
||||
window: int = 14,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots rolling kurtosis
|
||||
@@ -441,6 +458,8 @@ def display_kurtosis(
|
||||
Column in data to look at
|
||||
window: int
|
||||
Length of window
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export data
|
||||
external_axes: Optional[List[plt.Axes]], optional
|
||||
@@ -503,4 +522,5 @@ def display_kurtosis(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"kurtosis",
|
||||
df_kurt,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -33,6 +33,7 @@ def fibonacci_retracement(
|
||||
end_date: Optional[Union[str, None]] = None,
|
||||
symbol: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots Calculated fibonacci retracement levels
|
||||
@@ -49,6 +50,8 @@ def fibonacci_retracement(
|
||||
User picked date for ending retracement
|
||||
symbol: str
|
||||
Ticker symbol
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export data
|
||||
external_axes : Optional[List[plt.Axes]], optional
|
||||
@@ -138,4 +141,5 @@ def fibonacci_retracement(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"fib",
|
||||
df_fib,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -37,6 +37,7 @@ def display_cci(
|
||||
scalar: float = 0.0015,
|
||||
symbol: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots CCI Indicator
|
||||
@@ -119,6 +120,7 @@ def display_cci(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"cci",
|
||||
df_ta,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -130,6 +132,7 @@ def display_macd(
|
||||
n_signal: int = 9,
|
||||
symbol: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots MACD signal
|
||||
@@ -212,6 +215,7 @@ def display_macd(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"macd",
|
||||
df_ta,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -223,6 +227,7 @@ def display_rsi(
|
||||
drift: int = 1,
|
||||
symbol: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots RSI Indicator
|
||||
@@ -300,6 +305,7 @@ def display_rsi(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"rsi",
|
||||
df_ta,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -311,6 +317,7 @@ def display_stoch(
|
||||
slowkperiod: int = 3,
|
||||
symbol: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots stochastic oscillator signal
|
||||
@@ -399,6 +406,7 @@ def display_stoch(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"stoch",
|
||||
df_ta,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -408,6 +416,7 @@ def display_fisher(
|
||||
window: int = 14,
|
||||
symbol: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots Fisher Indicator
|
||||
@@ -492,6 +501,7 @@ def display_fisher(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"fisher",
|
||||
df_ta,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -501,6 +511,7 @@ def display_cg(
|
||||
window: int = 14,
|
||||
symbol: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots center of gravity Indicator
|
||||
@@ -563,6 +574,7 @@ def display_cg(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"cg",
|
||||
df_ta,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -572,6 +584,7 @@ def display_clenow_momentum(
|
||||
symbol: str = "",
|
||||
window: int = 90,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Prints table and plots clenow momentum
|
||||
@@ -638,6 +651,7 @@ def display_clenow_momentum(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"clenow",
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -646,6 +660,7 @@ def display_demark(
|
||||
symbol: str = "",
|
||||
min_to_show: int = 5,
|
||||
export: str = "",
|
||||
sheet_name: Optional[str] = "",
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plot demark sequential indicator
|
||||
@@ -753,4 +768,5 @@ def display_demark(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"demark",
|
||||
stock_data,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -25,6 +25,8 @@ from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
|
||||
register_matplotlib_converters()
|
||||
|
||||
|
||||
@@ -36,6 +38,7 @@ def view_ma(
|
||||
ma_type: str = "EMA",
|
||||
symbol: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots MA technical indicator
|
||||
@@ -52,6 +55,8 @@ def view_ma(
|
||||
Type of moving average. Either "EMA" "ZLMA" or "SMA"
|
||||
symbol: str
|
||||
Ticker
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export data
|
||||
external_axes: Optional[List[plt.Axes]], optional
|
||||
@@ -126,6 +131,7 @@ def view_ma(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
f"{ma_type.lower()}{'_'.join([str(win) for win in window])}",
|
||||
price_df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -138,6 +144,7 @@ def view_vwap(
|
||||
offset: int = 0,
|
||||
interval: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots VWMA technical indicator
|
||||
@@ -233,4 +240,5 @@ def view_vwap(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"VWAP",
|
||||
df_vwap,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -34,6 +34,7 @@ def display_adx(
|
||||
drift: int = 1,
|
||||
symbol: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots ADX indicator
|
||||
@@ -114,6 +115,7 @@ def display_adx(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"adx",
|
||||
df_ta,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -124,6 +126,7 @@ def display_aroon(
|
||||
scalar: int = 100,
|
||||
symbol: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots Aroon indicator
|
||||
@@ -138,6 +141,8 @@ def display_aroon(
|
||||
Ticker
|
||||
scalar: int
|
||||
Scalar variable
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export data
|
||||
external_axes: Optional[List[plt.Axes]], optional
|
||||
@@ -204,4 +209,5 @@ def display_aroon(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"aroon",
|
||||
df_ta,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -22,6 +22,8 @@ from openbb_terminal.common.technical_analysis import ta_helpers
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_bbands(
|
||||
@@ -31,6 +33,7 @@ def display_bbands(
|
||||
n_std: float = 2,
|
||||
mamode: str = "sma",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots bollinger bands
|
||||
@@ -105,6 +108,7 @@ def display_bbands(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"bbands",
|
||||
df_ta,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -115,6 +119,7 @@ def display_donchian(
|
||||
upper_length: int = 20,
|
||||
lower_length: int = 20,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots donchian channels
|
||||
@@ -187,6 +192,7 @@ def display_donchian(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"donchian",
|
||||
df_ta,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -199,6 +205,7 @@ def view_kc(
|
||||
offset: int = 0,
|
||||
symbol: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots Keltner Channels Indicator
|
||||
@@ -218,6 +225,8 @@ def view_kc(
|
||||
Offset value
|
||||
symbol: str
|
||||
Ticker symbol
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export data
|
||||
external_axes: Optional[List[plt.Axes]], optional
|
||||
@@ -282,6 +291,7 @@ def view_kc(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"kc",
|
||||
df_ta,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -293,6 +303,7 @@ def display_atr(
|
||||
mamode: str = "sma",
|
||||
offset: int = 0,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots ATR
|
||||
@@ -354,4 +365,5 @@ def display_atr(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"atr",
|
||||
df_ta,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -30,6 +30,7 @@ def display_ad(
|
||||
use_open: bool = False,
|
||||
symbol: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots AD technical indicator
|
||||
@@ -42,6 +43,8 @@ def display_ad(
|
||||
Whether to use open prices in calculation
|
||||
symbol : str
|
||||
Ticker symbol
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export data as
|
||||
external_axes : Optional[List[plt.Axes]], optional
|
||||
@@ -134,6 +137,7 @@ def display_ad(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"ad",
|
||||
df_ta,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -145,6 +149,7 @@ def display_adosc(
|
||||
use_open: bool = False,
|
||||
symbol: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots AD Osc Indicator
|
||||
@@ -242,6 +247,7 @@ def display_adosc(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"adosc",
|
||||
df_ta,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -250,6 +256,7 @@ def display_obv(
|
||||
data: pd.DataFrame,
|
||||
symbol: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots OBV technical indicator
|
||||
@@ -260,6 +267,8 @@ def display_obv(
|
||||
Dataframe of ohlc prices
|
||||
symbol : str
|
||||
Ticker
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Format to export data as
|
||||
external_axes : Optional[List[plt.Axes]], optional
|
||||
@@ -345,4 +354,5 @@ def display_obv(
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
"obv",
|
||||
df_ta,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -19,6 +19,10 @@ dotenv.load_dotenv(USER_ENV_FILE)
|
||||
dotenv.load_dotenv(REPOSITORY_ENV_FILE, override=True)
|
||||
dotenv.load_dotenv(PACKAGE_ENV_FILE, override=True)
|
||||
|
||||
# Network requests
|
||||
# Set request timeout
|
||||
REQUEST_TIMEOUT = load_env_vars("OPENBB_REQUEST_TIMEOUT", int, 5)
|
||||
|
||||
# Terminal UX section
|
||||
MPL_STYLE = os.getenv("OPENBB_MPLSTYLE") or "dark"
|
||||
PMF_STYLE = os.getenv("OPENBB_PMFSTYLE") or "dark"
|
||||
|
||||
@@ -2,35 +2,32 @@
|
||||
"""Main Testing Module"""
|
||||
__docformat__ = "numpy"
|
||||
|
||||
from functools import partial
|
||||
from multiprocessing.pool import Pool
|
||||
from multiprocessing import cpu_count
|
||||
from pathlib import Path
|
||||
import re
|
||||
import time
|
||||
from typing import Any, List, Dict, Optional, Tuple
|
||||
from traceback import FrameSummary, format_list, extract_tb
|
||||
import argparse
|
||||
import logging
|
||||
import sys
|
||||
import os
|
||||
from openbb_terminal.helper_funcs import check_positive
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
from functools import partial
|
||||
from multiprocessing import cpu_count
|
||||
from multiprocessing.pool import Pool
|
||||
from pathlib import Path
|
||||
from traceback import FrameSummary, extract_tb, format_list
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal.core.config.paths import (
|
||||
MISCELLANEOUS_DIRECTORY,
|
||||
REPOSITORY_DIRECTORY,
|
||||
)
|
||||
from openbb_terminal.helper_funcs import check_positive
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal.terminal_controller import (
|
||||
insert_start_slash,
|
||||
terminal,
|
||||
replace_dynamic,
|
||||
obbff,
|
||||
replace_dynamic,
|
||||
terminal,
|
||||
)
|
||||
from openbb_terminal.terminal_helper import (
|
||||
is_reset,
|
||||
suppress_stdout,
|
||||
)
|
||||
from openbb_terminal.terminal_helper import is_reset, suppress_stdout
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
special_arguments_values = [
|
||||
@@ -697,6 +694,11 @@ def main():
|
||||
if "--test" in sys.argv:
|
||||
sys.argv.remove("--test")
|
||||
|
||||
os.environ["OPENBB_ENABLE_QUICK_EXIT"] = "True"
|
||||
os.environ["OPENBB_LOG_COLLECT"] = "False"
|
||||
os.environ["OPENBB_USE_ION"] = "False"
|
||||
os.environ["OPENBB_USE_PROMPT_TOOLKIT"] = "False"
|
||||
|
||||
parse_args_and_run()
|
||||
|
||||
|
||||
|
||||
@@ -2,17 +2,18 @@
|
||||
__docformat__ = "numpy"
|
||||
|
||||
import argparse
|
||||
import binascii
|
||||
import logging
|
||||
|
||||
from typing import Optional, Any, Union
|
||||
import hmac
|
||||
import hashlib
|
||||
import time
|
||||
import base64
|
||||
import requests
|
||||
import binascii
|
||||
import hashlib
|
||||
import hmac
|
||||
import logging
|
||||
import time
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
from requests.auth import AuthBase
|
||||
|
||||
import openbb_terminal.config_terminal as cfg
|
||||
from openbb_terminal.helper_funcs import request
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -26,9 +27,14 @@ class CoinbaseProAuth(AuthBase):
|
||||
self.secret_key = secret_key
|
||||
self.passphrase = passphrase
|
||||
|
||||
def __call__(self, request):
|
||||
def __call__(self, request_coinbase):
|
||||
timestamp = str(time.time())
|
||||
message = timestamp + request.method + request.path_url + (request.body or "")
|
||||
message = (
|
||||
timestamp
|
||||
+ request_coinbase.method
|
||||
+ request_coinbase.path_url
|
||||
+ (request_coinbase.body or "")
|
||||
)
|
||||
message = message.encode("ascii")
|
||||
|
||||
try:
|
||||
@@ -39,7 +45,7 @@ class CoinbaseProAuth(AuthBase):
|
||||
logger.exception(str(e))
|
||||
signature_b64 = ""
|
||||
|
||||
request.headers.update(
|
||||
request_coinbase.headers.update(
|
||||
{
|
||||
"CB-ACCESS-SIGN": signature_b64,
|
||||
"CB-ACCESS-TIMESTAMP": timestamp,
|
||||
@@ -48,7 +54,7 @@ class CoinbaseProAuth(AuthBase):
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
)
|
||||
return request
|
||||
return request_coinbase
|
||||
|
||||
|
||||
class CoinbaseRequestException(Exception):
|
||||
@@ -119,7 +125,7 @@ def make_coinbase_request(
|
||||
"""
|
||||
|
||||
url = "https://api.pro.coinbase.com"
|
||||
response = requests.get(url + endpoint, params=params, auth=auth)
|
||||
response = request(url + endpoint, params=params, auth=auth)
|
||||
|
||||
if not 200 <= response.status_code < 300:
|
||||
raise CoinbaseApiException(f"Invalid Authentication: {response.text}")
|
||||
|
||||
@@ -295,6 +295,7 @@ class CryptoController(CryptoBaseController):
|
||||
os.path.join(os.path.dirname(os.path.abspath(__file__))),
|
||||
f"{self.symbol}",
|
||||
self.current_df,
|
||||
" ".join(ns_parser.sheet_name) if ns_parser.sheet_name else None,
|
||||
)
|
||||
|
||||
plot_chart(
|
||||
@@ -520,6 +521,9 @@ class CryptoController(CryptoBaseController):
|
||||
skip=ns_parser.skip,
|
||||
show_all=True,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
else:
|
||||
find(
|
||||
@@ -528,6 +532,9 @@ class CryptoController(CryptoBaseController):
|
||||
key=ns_parser.key,
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
|
||||
@@ -10,6 +10,7 @@ def find(
|
||||
key: str = "symbol",
|
||||
limit: int = 10,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Find similar coin by coin name,symbol or id.
|
||||
|
||||
@@ -48,4 +49,5 @@ def find(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"find",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -639,7 +639,13 @@ def load_yf_data(symbol: str, currency: str, interval: str, days: int):
|
||||
|
||||
|
||||
def display_all_coins(
|
||||
source: str, symbol: str, limit: int, skip: int, show_all: bool, export: str
|
||||
source: str,
|
||||
symbol: str,
|
||||
limit: int,
|
||||
skip: int,
|
||||
show_all: bool,
|
||||
export: str,
|
||||
sheet_name: str,
|
||||
) -> None:
|
||||
"""Find similar coin by coin name,symbol or id.
|
||||
If you don't remember exact name or id of the Coin at CoinGecko, CoinPaprika, Coinbase, Binance
|
||||
@@ -745,6 +751,7 @@ def display_all_coins(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"coins",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -26,10 +26,10 @@ for category in categories:
|
||||
- Endpoint: [https://api.llama.fi/protocols](https://api.llama.fi/protocols)
|
||||
|
||||
```python
|
||||
import requests
|
||||
import request
|
||||
API_URL = "https://api.llama.fi"
|
||||
url = f"{API_URL}/protocols"
|
||||
r = requests.get(url)
|
||||
r = request(url)
|
||||
data = r.json()
|
||||
protocols = {}
|
||||
for protocol in data:
|
||||
|
||||
@@ -6,10 +6,12 @@ from typing import Optional
|
||||
|
||||
import urllib3
|
||||
import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.helper_funcs import get_user_agent, lambda_long_number_format
|
||||
from openbb_terminal.helper_funcs import (
|
||||
get_user_agent,
|
||||
lambda_long_number_format,
|
||||
request,
|
||||
)
|
||||
|
||||
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
@@ -140,7 +142,7 @@ def get_defi_vaults(
|
||||
|
||||
headers = {"User-Agent": get_user_agent()}
|
||||
params = _prepare_params(chain=chain, protocol=protocol, kind=kind)
|
||||
response = requests.get(
|
||||
response = request(
|
||||
"https://apiv2.coindix.com/search", headers=headers, params=params, verify=False
|
||||
)
|
||||
if not 200 <= response.status_code < 300:
|
||||
|
||||
@@ -14,6 +14,8 @@ from openbb_terminal.helper_funcs import (
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_defi_vaults(
|
||||
@@ -25,6 +27,7 @@ def display_defi_vaults(
|
||||
ascend: bool = True,
|
||||
link: bool = False,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing Top DeFi Vaults - pools of funds with an assigned strategy which main goal is to
|
||||
maximize returns of its crypto assets. [Source: https://coindix.com/]
|
||||
@@ -85,4 +88,5 @@ def display_defi_vaults(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"vaults",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -4,8 +4,7 @@ __docformat__ = "numpy"
|
||||
import logging
|
||||
from typing import Tuple
|
||||
import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal.helper_funcs import request
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -36,7 +35,7 @@ def get_anchor_data(address: str = "") -> Tuple[pd.DataFrame, pd.DataFrame, str]
|
||||
"Select a valid address. Valid terra addresses start with 'terra'"
|
||||
)
|
||||
|
||||
response = requests.get(f"{api_url}/get-anchor-protocol-data-v2/{address}")
|
||||
response = request(f"{api_url}/get-anchor-protocol-data-v2/{address}")
|
||||
if response.status_code != 200:
|
||||
raise Exception(f"Status code: {response.status_code}. Reason: {response.text}")
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ logger = logging.getLogger(__name__)
|
||||
def display_anchor_data(
|
||||
address: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
show_transactions: bool = False,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
@@ -78,4 +79,5 @@ def display_anchor_data(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"anchor",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -132,6 +132,9 @@ class DefiController(BaseController):
|
||||
cryptosaurio_view.display_anchor_data(
|
||||
show_transactions=ns_parser.transactions,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
address=ns_parser.address,
|
||||
)
|
||||
|
||||
@@ -172,9 +175,12 @@ class DefiController(BaseController):
|
||||
|
||||
if ns_parser:
|
||||
terramoney_fcd_view.display_account_staking_info(
|
||||
export=ns_parser.export,
|
||||
address=ns_parser.address,
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -222,10 +228,13 @@ class DefiController(BaseController):
|
||||
)
|
||||
if ns_parser:
|
||||
terramoney_fcd_view.display_validators(
|
||||
export=ns_parser.export,
|
||||
sortby=ns_parser.sortby,
|
||||
ascend=ns_parser.reverse,
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -272,6 +281,9 @@ class DefiController(BaseController):
|
||||
terramoney_fcd_view.display_account_growth(
|
||||
kind=ns_parser.kind,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
cumulative=ns_parser.cumulative,
|
||||
limit=ns_parser.limit,
|
||||
)
|
||||
@@ -302,7 +314,11 @@ class DefiController(BaseController):
|
||||
|
||||
if ns_parser:
|
||||
terramoney_fcd_view.display_staking_ratio_history(
|
||||
export=ns_parser.export, limit=ns_parser.limit
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
limit=ns_parser.limit,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -331,7 +347,11 @@ class DefiController(BaseController):
|
||||
|
||||
if ns_parser:
|
||||
terramoney_fcd_view.display_staking_returns_history(
|
||||
export=ns_parser.export, limit=ns_parser.limit
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
limit=ns_parser.limit,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -450,6 +470,9 @@ class DefiController(BaseController):
|
||||
ascend=ns_parser.reverse,
|
||||
description=ns_parser.description,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -479,7 +502,13 @@ class DefiController(BaseController):
|
||||
)
|
||||
|
||||
if ns_parser:
|
||||
llama_view.display_defi_tvl(limit=ns_parser.limit, export=ns_parser.export)
|
||||
llama_view.display_defi_tvl(
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_newsletter(self, other_args: List[str]):
|
||||
@@ -509,7 +538,11 @@ class DefiController(BaseController):
|
||||
|
||||
if ns_parser:
|
||||
substack_view.display_newsletters(
|
||||
limit=ns_parser.limit, export=ns_parser.export
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -572,6 +605,9 @@ class DefiController(BaseController):
|
||||
sortby=ns_parser.sortby,
|
||||
ascend=ns_parser.reverse,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -592,7 +628,12 @@ class DefiController(BaseController):
|
||||
)
|
||||
|
||||
if ns_parser:
|
||||
graph_view.display_uni_stats(export=ns_parser.export)
|
||||
graph_view.display_uni_stats(
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_pairs(self, other_args: List[str]):
|
||||
@@ -677,6 +718,9 @@ class DefiController(BaseController):
|
||||
sortby=ns_parser.sortby,
|
||||
ascend=ns_parser.reverse,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -730,6 +774,9 @@ class DefiController(BaseController):
|
||||
sortby=ns_parser.sortby,
|
||||
ascend=ns_parser.reverse,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -783,6 +830,9 @@ class DefiController(BaseController):
|
||||
sortby=ns_parser.sortby,
|
||||
ascend=ns_parser.reverse,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -880,6 +930,9 @@ class DefiController(BaseController):
|
||||
ascend=ns_parser.reverse,
|
||||
link=ns_parser.link,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
def call_lcsc(self, other_args: List[str]):
|
||||
@@ -923,4 +976,7 @@ class DefiController(BaseController):
|
||||
days=ns_parser.days,
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@@ -5,13 +5,13 @@ import datetime
|
||||
import logging
|
||||
|
||||
import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal.cryptocurrency.dataframe_helpers import (
|
||||
lambda_very_long_number_formatter,
|
||||
)
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal.helper_funcs import request
|
||||
|
||||
# pylint: disable=unsupported-assignment-operation
|
||||
|
||||
@@ -71,7 +71,7 @@ def query_graph(url: str, query: str) -> dict:
|
||||
Dictionary with response data
|
||||
"""
|
||||
|
||||
response = requests.post(url, json={"query": query})
|
||||
response = request(url, method="POST", json={"query": query})
|
||||
if response.status_code == 200:
|
||||
return response.json()["data"]
|
||||
return {}
|
||||
|
||||
@@ -13,6 +13,8 @@ from openbb_terminal.helper_funcs import export_data, print_rich_table
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_uni_tokens(
|
||||
@@ -21,6 +23,7 @@ def display_uni_tokens(
|
||||
sortby: str = "index",
|
||||
ascend: bool = False,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing tokens trade-able on Uniswap DEX.
|
||||
[Source: https://thegraph.com/en/]
|
||||
@@ -65,11 +68,12 @@ def display_uni_tokens(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"tokens",
|
||||
df_data,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_uni_stats(export: str = "") -> None:
|
||||
def display_uni_stats(export: str = "", sheet_name: str = None) -> None:
|
||||
"""Prints table showing base statistics about Uniswap DEX. [Source: https://thegraph.com/en/]
|
||||
[Source: https://thegraph.com/en/]
|
||||
|
||||
@@ -95,6 +99,7 @@ def display_uni_stats(export: str = "") -> None:
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"stats",
|
||||
df_data,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -108,6 +113,7 @@ def display_recently_added(
|
||||
sortby: str = "created",
|
||||
ascend: bool = False,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing Lastly added pairs on Uniswap DEX.
|
||||
[Source: https://thegraph.com/en/]
|
||||
@@ -163,12 +169,17 @@ def display_recently_added(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"pairs",
|
||||
df_data,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_uni_pools(
|
||||
limit: int = 20, sortby: str = "volumeUSD", ascend: bool = True, export: str = ""
|
||||
limit: int = 20,
|
||||
sortby: str = "volumeUSD",
|
||||
ascend: bool = True,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing uniswap pools by volume.
|
||||
[Source: https://thegraph.com/en/]
|
||||
@@ -211,12 +222,17 @@ def display_uni_pools(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"pools",
|
||||
df_data,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_last_uni_swaps(
|
||||
limit: int = 10, sortby: str = "timestamp", ascend: bool = False, export: str = ""
|
||||
limit: int = 10,
|
||||
sortby: str = "timestamp",
|
||||
ascend: bool = False,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing last swaps done on Uniswap
|
||||
[Source: https://thegraph.com/en/]
|
||||
@@ -245,4 +261,5 @@ def display_last_uni_swaps(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"swaps",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -7,8 +7,8 @@ from datetime import datetime
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal.helper_funcs import request
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.helper_funcs import lambda_long_number_format
|
||||
from openbb_terminal.cryptocurrency.dataframe_helpers import (
|
||||
@@ -61,7 +61,7 @@ def get_defi_protocols(
|
||||
Information about DeFi protocols
|
||||
"""
|
||||
|
||||
response = requests.get(API_URL + "/protocols")
|
||||
response = request(API_URL + "/protocols")
|
||||
columns = [
|
||||
"name",
|
||||
"symbol",
|
||||
@@ -136,7 +136,7 @@ def get_defi_protocol(protocol: str) -> pd.DataFrame:
|
||||
Historical tvl
|
||||
"""
|
||||
url = f"{API_URL}/protocol/{protocol}"
|
||||
r = requests.get(url)
|
||||
r = request(url)
|
||||
data = r.json()
|
||||
|
||||
df = pd.DataFrame(data["tvl"])
|
||||
@@ -176,7 +176,7 @@ def get_defi_tvl() -> pd.DataFrame:
|
||||
pd.DataFrame
|
||||
Historical values of total sum of Total Value Locked from all listed protocols.
|
||||
"""
|
||||
response = requests.get(API_URL + "/charts")
|
||||
response = request(API_URL + "/charts")
|
||||
if response.status_code != 200:
|
||||
raise Exception(f"Status code: {response.status_code}. Reason: {response.text}")
|
||||
try:
|
||||
|
||||
@@ -26,7 +26,10 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_grouped_defi_protocols(
|
||||
limit: int = 50, export: str = "", external_axes: Optional[List[plt.Axes]] = None
|
||||
limit: int = 50,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots top dApps (in terms of TVL) grouped by chain.
|
||||
[Source: https://docs.llama.fi/api]
|
||||
@@ -87,6 +90,7 @@ def display_grouped_defi_protocols(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"gdapps",
|
||||
chains,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -97,6 +101,7 @@ def display_defi_protocols(
|
||||
ascend: bool = False,
|
||||
description: bool = False,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing information about listed DeFi protocols, their current TVL and changes to it in
|
||||
the last hour/day/week. [Source: https://docs.llama.fi/api]
|
||||
@@ -124,6 +129,7 @@ def display_defi_protocols(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"ldapps",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -131,6 +137,7 @@ def display_defi_protocols(
|
||||
def display_historical_tvl(
|
||||
dapps: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots historical TVL of different dApps
|
||||
@@ -181,6 +188,7 @@ def display_historical_tvl(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"dtvl",
|
||||
None,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -188,6 +196,7 @@ def display_historical_tvl(
|
||||
def display_defi_tvl(
|
||||
limit: int = 5,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots historical values of the total sum of TVLs from all listed protocols.
|
||||
@@ -233,4 +242,5 @@ def display_defi_tvl(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"stvl",
|
||||
df_data,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
__docformat__ = "numpy"
|
||||
|
||||
from typing import Union, Dict
|
||||
import requests
|
||||
import pandas as pd
|
||||
|
||||
from openbb_terminal.decorators import check_api_key
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal.helper_funcs import request
|
||||
|
||||
|
||||
@check_api_key(["API_SMARTSTAKE_KEY", "API_SMARTSTAKE_TOKEN"])
|
||||
@@ -38,7 +38,7 @@ def get_luna_supply_stats(
|
||||
"token": cfg.API_SMARTSTAKE_TOKEN,
|
||||
}
|
||||
|
||||
response = requests.get(
|
||||
response = request(
|
||||
"https://prod.smartstakeapi.com/listData?app=TERRA",
|
||||
params=payload,
|
||||
)
|
||||
|
||||
@@ -30,6 +30,7 @@ logger = logging.getLogger(__name__)
|
||||
def display_luna_circ_supply_change(
|
||||
days: int = 30,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
supply_type: str = "lunaSupplyChallengeStats",
|
||||
limit: int = 5,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
@@ -42,6 +43,8 @@ def display_luna_circ_supply_change(
|
||||
Number of days
|
||||
supply_type: str
|
||||
Supply type to unpack json
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Export type
|
||||
limit: int
|
||||
@@ -110,6 +113,7 @@ def display_luna_circ_supply_change(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"lcsc",
|
||||
df[RAW_COLS],
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
df.index = df.index.strftime("%Y-%m-%d")
|
||||
|
||||
@@ -7,12 +7,12 @@ import textwrap
|
||||
from typing import List
|
||||
|
||||
import pandas as pd
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
from dateutil import parser
|
||||
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal.helper_funcs import request
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -36,7 +36,7 @@ def scrape_substack(url: str) -> List[List[str]]:
|
||||
- str datetime of newsletter [Format: "%Y-%m-%d %H:%M:%S"]
|
||||
"""
|
||||
|
||||
req = requests.get(url)
|
||||
req = request(url)
|
||||
soup = BeautifulSoup(req.text, features="lxml")
|
||||
results: List[List[str]] = []
|
||||
archive = soup.find("div", class_="portable-archive-list")
|
||||
|
||||
@@ -13,7 +13,9 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_newsletters(limit: int = 10, export: str = "") -> None:
|
||||
def display_newsletters(
|
||||
limit: int = 10, export: str = "", sheet_name: str = None
|
||||
) -> None:
|
||||
"""Prints table showing DeFi related substack newsletters.
|
||||
[Source: substack.com]
|
||||
|
||||
@@ -34,4 +36,10 @@ def display_newsletters(limit: int = 10, export: str = "") -> None:
|
||||
title="Substack Newsletters",
|
||||
)
|
||||
|
||||
export_data(export, os.path.dirname(os.path.abspath(__file__)), "newsletter", df)
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"newsletter",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -4,9 +4,9 @@ __docformat__ = "numpy"
|
||||
import logging
|
||||
|
||||
import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.helper_funcs import request
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -43,7 +43,7 @@ def get_history_asset_from_terra_address(
|
||||
"Select a valid address. Valid terra addresses start with 'terra'"
|
||||
)
|
||||
|
||||
response = requests.get(
|
||||
response = request(
|
||||
f"{api_url}/terra_addresses/{address}/show_snapshot_data.json?asset={asset.lower()}"
|
||||
)
|
||||
if response.status_code != 200:
|
||||
|
||||
@@ -30,6 +30,7 @@ def display_terra_asset_history(
|
||||
asset: str = "",
|
||||
address: str = "",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots the 30-day history of specified asset in terra address
|
||||
@@ -78,12 +79,15 @@ def display_terra_asset_history(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"aterra",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_anchor_yield_reserve(
|
||||
export: str = "", external_axes: Optional[List[plt.Axes]] = None
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots the 30-day history of the Anchor Yield Reserve.
|
||||
[Source: https://terra.engineer/]
|
||||
@@ -126,4 +130,5 @@ def display_anchor_yield_reserve(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"ayr",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -7,7 +7,6 @@ from datetime import datetime
|
||||
from typing import Any, Tuple, Dict
|
||||
|
||||
import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal.cryptocurrency.dataframe_helpers import (
|
||||
denominate_number,
|
||||
@@ -16,6 +15,7 @@ from openbb_terminal.cryptocurrency.dataframe_helpers import (
|
||||
)
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal.helper_funcs import request
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -56,9 +56,7 @@ def _make_request(endpoint: str) -> dict:
|
||||
"""
|
||||
|
||||
url = f"https://fcd.terra.dev/v1/{endpoint}"
|
||||
response = requests.get(
|
||||
url, headers={"Accept": "application/json", "User-Agent": "GST"}
|
||||
)
|
||||
response = request(url, headers={"Accept": "application/json", "User-Agent": "GST"})
|
||||
if not 200 <= response.status_code < 300:
|
||||
console.print(
|
||||
f"[red]fcd terra api exception: {response.json()['type']}[/red]\n"
|
||||
|
||||
@@ -30,7 +30,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_account_staking_info(
|
||||
address: str = "", limit: int = 10, export: str = ""
|
||||
address: str = "", limit: int = 10, export: str = "", sheet_name: str = None
|
||||
) -> None:
|
||||
"""Prints table showing staking info for provided terra account address [Source: https://fcd.terra.dev/swagger]
|
||||
|
||||
@@ -57,12 +57,17 @@ def display_account_staking_info(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"sinfo",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_validators(
|
||||
limit: int = 10, sortby: str = "votingPower", ascend: bool = True, export: str = ""
|
||||
limit: int = 10,
|
||||
sortby: str = "votingPower",
|
||||
ascend: bool = True,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing information about terra validators [Source: https://fcd.terra.dev/swagger]
|
||||
|
||||
@@ -101,6 +106,7 @@ def display_validators(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"validators",
|
||||
df_data,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -111,6 +117,7 @@ def display_gov_proposals(
|
||||
sortby: str = "id",
|
||||
ascend: bool = True,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing terra blockchain governance proposals list [Source: https://fcd.terra.dev/swagger]
|
||||
|
||||
@@ -132,7 +139,13 @@ def display_gov_proposals(
|
||||
|
||||
print_rich_table(df, headers=list(df.columns), floatfmt=".2f", show_index=False)
|
||||
|
||||
export_data(export, os.path.dirname(os.path.abspath(__file__)), "govp", df)
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"govp",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -141,6 +154,7 @@ def display_account_growth(
|
||||
cumulative: bool = False,
|
||||
limit: int = 90,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots terra blockchain account growth history [Source: https://fcd.terra.dev/swagger]
|
||||
@@ -200,6 +214,7 @@ def display_account_growth(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"gacc",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -207,6 +222,7 @@ def display_account_growth(
|
||||
def display_staking_ratio_history(
|
||||
limit: int = 90,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots terra blockchain staking ratio history [Source: https://fcd.terra.dev/v1]
|
||||
@@ -247,6 +263,7 @@ def display_staking_ratio_history(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"sratio",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -254,6 +271,7 @@ def display_staking_ratio_history(
|
||||
def display_staking_returns_history(
|
||||
limit: int = 90,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots terra blockchain staking returns history [Source: https://fcd.terra.dev/swagger]
|
||||
@@ -294,4 +312,5 @@ def display_staking_returns_history(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"sreturn",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -20,6 +20,7 @@ def display_cmc_top_coins(
|
||||
sortby: str = "CMC_Rank",
|
||||
ascend: bool = True,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing top n coins. [Source: CoinMarketCap]
|
||||
|
||||
@@ -56,4 +57,5 @@ def display_cmc_top_coins(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"cmctop",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -20,6 +20,7 @@ def display_search_results(
|
||||
sortby: str = "id",
|
||||
ascend: bool = True,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing Search over CoinPaprika. [Source: CoinPaprika]
|
||||
|
||||
@@ -65,4 +66,5 @@ def display_search_results(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"search",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -6,10 +6,9 @@ from typing import Optional
|
||||
import logging
|
||||
|
||||
import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.helper_funcs import get_user_agent
|
||||
from openbb_terminal.helper_funcs import get_user_agent, request
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -61,7 +60,7 @@ def _make_request(url: str, verbose: bool = True) -> Optional[dict]:
|
||||
"User-Agent": get_user_agent(),
|
||||
"referer": "https://dappradar.com/",
|
||||
}
|
||||
response = requests.get(url, headers=headers)
|
||||
response = request(url, headers=headers)
|
||||
if not 200 <= response.status_code < 300:
|
||||
if verbose:
|
||||
console.print(f"[red]dappradar api exception: {response.text}[/red]")
|
||||
|
||||
@@ -17,7 +17,9 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_top_nfts(limit: int = 10, sortby: str = "", export: str = "") -> None:
|
||||
def display_top_nfts(
|
||||
limit: int = 10, sortby: str = "", export: str = "", sheet_name: str = None
|
||||
) -> None:
|
||||
"""Prints table showing top nft collections [Source: https://dappradar.com/]
|
||||
|
||||
Parameters
|
||||
@@ -54,11 +56,14 @@ def display_top_nfts(limit: int = 10, sortby: str = "", export: str = "") -> Non
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"drnft",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_top_games(limit: int = 10, export: str = "", sortby: str = "") -> None:
|
||||
def display_top_games(
|
||||
limit: int = 10, export: str = "", sheet_name: str = None, sortby: str = ""
|
||||
) -> None:
|
||||
"""Prints table showing top blockchain games [Source: https://dappradar.com/]
|
||||
|
||||
Parameters
|
||||
@@ -90,11 +95,14 @@ def display_top_games(limit: int = 10, export: str = "", sortby: str = "") -> No
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"drgames",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_top_dexes(limit: int = 10, export: str = "", sortby: str = "") -> None:
|
||||
def display_top_dexes(
|
||||
limit: int = 10, export: str = "", sheet_name: str = None, sortby: str = ""
|
||||
) -> None:
|
||||
"""Prints table showing top decentralized exchanges [Source: https://dappradar.com/]
|
||||
|
||||
Parameters
|
||||
@@ -126,11 +134,14 @@ def display_top_dexes(limit: int = 10, export: str = "", sortby: str = "") -> No
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"drdex",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_top_dapps(limit: int = 10, export: str = "", sortby: str = "") -> None:
|
||||
def display_top_dapps(
|
||||
limit: int = 10, export: str = "", sheet_name: str = None, sortby: str = ""
|
||||
) -> None:
|
||||
"""Prints table showing top decentralized exchanges [Source: https://dappradar.com/]
|
||||
|
||||
Parameters
|
||||
@@ -162,4 +173,5 @@ def display_top_dapps(limit: int = 10, export: str = "", sortby: str = "") -> No
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"drdapps",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -154,6 +154,9 @@ class DiscoveryController(BaseController):
|
||||
category=ns_parser.category,
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
ascend=ns_parser.reverse,
|
||||
)
|
||||
elif ns_parser.source == "CoinMarketCap":
|
||||
@@ -162,6 +165,9 @@ class DiscoveryController(BaseController):
|
||||
sortby=ns_parser.sortby,
|
||||
ascend=ns_parser.reverse,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -204,6 +210,9 @@ class DiscoveryController(BaseController):
|
||||
sortby=" ".join(ns_parser.sortby),
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -246,6 +255,9 @@ class DiscoveryController(BaseController):
|
||||
sortby=" ".join(ns_parser.sortby),
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -288,6 +300,9 @@ class DiscoveryController(BaseController):
|
||||
sortby=" ".join(ns_parser.sortby),
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -331,6 +346,9 @@ class DiscoveryController(BaseController):
|
||||
sortby=" ".join(ns_parser.sortby),
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -386,6 +404,9 @@ class DiscoveryController(BaseController):
|
||||
interval=ns_parser.interval,
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
sortby=" ".join(ns_parser.sortby),
|
||||
)
|
||||
|
||||
@@ -443,6 +464,9 @@ class DiscoveryController(BaseController):
|
||||
interval=ns_parser.interval,
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
sortby=" ".join(ns_parser.sortby),
|
||||
)
|
||||
|
||||
@@ -465,6 +489,9 @@ class DiscoveryController(BaseController):
|
||||
if ns_parser:
|
||||
pycoingecko_view.display_trending(
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -542,6 +569,9 @@ class DiscoveryController(BaseController):
|
||||
sortby=ns_parser.sortby,
|
||||
ascend=ns_parser.reverse,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
query=" ".join(ns_parser.query),
|
||||
category=ns_parser.category,
|
||||
)
|
||||
|
||||
@@ -37,6 +37,7 @@ def display_coins(
|
||||
limit: int = 250,
|
||||
sortby: str = "Symbol",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
ascend: bool = False,
|
||||
) -> None:
|
||||
"""Prints table showing top coins [Source: CoinGecko]
|
||||
@@ -91,6 +92,7 @@ def display_coins(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"cgtop",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
else:
|
||||
console.print("\nUnable to retrieve data from CoinGecko.\n")
|
||||
@@ -102,6 +104,7 @@ def display_gainers(
|
||||
limit: int = 20,
|
||||
sortby: str = "market_cap_rank",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing Largest Gainers - coins which gain the most in given period. [Source: CoinGecko]
|
||||
|
||||
@@ -137,6 +140,7 @@ def display_gainers(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"gainers",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
else:
|
||||
console.print("\nUnable to retrieve data from CoinGecko.\n")
|
||||
@@ -147,6 +151,7 @@ def display_losers(
|
||||
interval: str = "1h",
|
||||
limit: int = 20,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
sortby: str = "Market Cap Rank",
|
||||
) -> None:
|
||||
"""Prints table showing Largest Losers - coins which lost the most in given period of time. [Source: CoinGecko]
|
||||
@@ -183,13 +188,14 @@ def display_losers(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"cglosers",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
else:
|
||||
console.print("\nUnable to retrieve data from CoinGecko.\n")
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_trending(export: str = "") -> None:
|
||||
def display_trending(export: str = "", sheet_name: str = None) -> None:
|
||||
"""Prints table showing trending coins [Source: CoinGecko]
|
||||
|
||||
Parameters
|
||||
@@ -213,6 +219,7 @@ def display_trending(export: str = "") -> None:
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"cgtrending",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
else:
|
||||
console.print("\nUnable to retrieve data from CoinGecko.\n")
|
||||
|
||||
@@ -26,6 +26,7 @@ def display_order_book(
|
||||
limit: int = 100,
|
||||
to_symbol: str = "USDT",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots order book for currency. [Source: Binance]
|
||||
@@ -39,6 +40,8 @@ def display_order_book(
|
||||
Limit parameter. Adjusts the weight
|
||||
to_symbol: str
|
||||
Quote currency (what to view coin vs)
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Export dataframe data to csv,json,xlsx
|
||||
external_axes : Optional[List[plt.Axes]]
|
||||
@@ -57,12 +60,13 @@ def display_order_book(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"book",
|
||||
market_book,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_balance(
|
||||
from_symbol: str, to_symbol: str = "USDT", export: str = ""
|
||||
from_symbol: str, to_symbol: str = "USDT", export: str = "", sheet_name: str = None
|
||||
) -> None:
|
||||
"""Prints table showing account holdings for asset. [Source: Binance]
|
||||
|
||||
@@ -72,6 +76,8 @@ def display_balance(
|
||||
Cryptocurrency
|
||||
to_symbol: str
|
||||
Cryptocurrency
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Export dataframe data to csv,json,xlsx
|
||||
"""
|
||||
@@ -94,4 +100,5 @@ def display_balance(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"book",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -21,6 +21,7 @@ def display_order_book(
|
||||
symbol: str,
|
||||
to_symbol: str,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots order book for a coin in a given exchange
|
||||
@@ -56,12 +57,18 @@ def display_order_book(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"ob",
|
||||
market_book,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_trades(
|
||||
exchange: str, symbol: str, to_symbol: str, limit: int = 10, export: str = ""
|
||||
exchange: str,
|
||||
symbol: str,
|
||||
to_symbol: str,
|
||||
limit: int = 10,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
):
|
||||
"""Prints table showing trades for a coin in a given exchange
|
||||
[Source: https://docs.ccxt.com/en/latest/manual.html]
|
||||
@@ -92,4 +99,5 @@ def display_trades(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"trades",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -23,6 +23,7 @@ register_matplotlib_converters()
|
||||
def display_order_book(
|
||||
symbol: str,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots a list of available currency pairs for trading. [Source: Coinbase]
|
||||
@@ -44,12 +45,17 @@ def display_order_book(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"book",
|
||||
pd.DataFrame(market_book),
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_trades(
|
||||
symbol: str, limit: int = 20, side: Optional[str] = None, export: str = ""
|
||||
symbol: str,
|
||||
limit: int = 20,
|
||||
side: Optional[str] = None,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing last N trades for chosen trading pair. [Source: Coinbase]
|
||||
|
||||
@@ -69,11 +75,19 @@ def display_trades(
|
||||
|
||||
print_rich_table(df, headers=list(df.columns), show_index=False)
|
||||
|
||||
export_data(export, os.path.dirname(os.path.abspath(__file__)), "trades", df)
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"trades",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_candles(symbol: str, interval: str = "24hour", export: str = "") -> None:
|
||||
def display_candles(
|
||||
symbol: str, interval: str = "24hour", export: str = "", sheet_name: str = None
|
||||
) -> None:
|
||||
"""Prints table showing candles for chosen trading pair and time interval. [Source: Coinbase]
|
||||
|
||||
Parameters
|
||||
@@ -92,11 +106,17 @@ def display_candles(symbol: str, interval: str = "24hour", export: str = "") ->
|
||||
df, headers=list(df.columns), show_index=True, title="Trading Pair Candles"
|
||||
)
|
||||
|
||||
export_data(export, os.path.dirname(os.path.abspath(__file__)), "candles", df)
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"candles",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_stats(symbol: str, export: str = "") -> None:
|
||||
def display_stats(symbol: str, export: str = "", sheet_name: str = None) -> None:
|
||||
"""Prints table showing 24 hr stats for the product. Volume is in base currency units.
|
||||
Open, high and low are in quote currency units. [Source: Coinbase]
|
||||
|
||||
@@ -117,4 +137,10 @@ def display_stats(symbol: str, export: str = "") -> None:
|
||||
title=f"Coinbase:{symbol.upper()} 24 hr Product Stats",
|
||||
)
|
||||
|
||||
export_data(export, os.path.dirname(os.path.abspath(__file__)), "stats", df)
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"stats",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -27,7 +27,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_COINGLASS_KEY"])
|
||||
def display_funding_rate(symbol: str, export: str = "") -> None:
|
||||
def display_funding_rate(symbol: str, export: str = "", sheet_name: str = None) -> None:
|
||||
"""Plots funding rate by exchange for a certain cryptocurrency
|
||||
[Source: https://coinglass.github.io/API-Reference/]
|
||||
|
||||
@@ -48,12 +48,15 @@ def display_funding_rate(symbol: str, export: str = "") -> None:
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"fundrate",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_COINGLASS_KEY"])
|
||||
def display_open_interest(symbol: str, interval: int = 0, export: str = "") -> None:
|
||||
def display_open_interest(
|
||||
symbol: str, interval: int = 0, export: str = "", sheet_name: str = None
|
||||
) -> None:
|
||||
"""Plots open interest by exchange for a certain cryptocurrency
|
||||
[Source: https://coinglass.github.io/API-Reference/]
|
||||
|
||||
@@ -81,12 +84,13 @@ def display_open_interest(symbol: str, interval: int = 0, export: str = "") -> N
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"oi",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_COINGLASS_KEY"])
|
||||
def display_liquidations(symbol: str, export: str = "") -> None:
|
||||
def display_liquidations(symbol: str, export: str = "", sheet_name: str = None) -> None:
|
||||
"""Plots liquidation per day data for a certain cryptocurrency
|
||||
[Source: https://coinglass.github.io/API-Reference/#liquidation-chart]
|
||||
|
||||
@@ -112,6 +116,7 @@ def display_liquidations(symbol: str, export: str = "") -> None:
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"liquidations",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -89,6 +89,7 @@ def display_twitter(
|
||||
sortby: str = "date",
|
||||
ascend: bool = True,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing twitter timeline for given coin id. Not more than last 50 tweets [Source: CoinPaprika]
|
||||
|
||||
@@ -125,6 +126,7 @@ def display_twitter(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"twitter",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -136,6 +138,7 @@ def display_events(
|
||||
ascend: bool = False,
|
||||
links: bool = False,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing all events for given coin id. [Source: CoinPaprika]
|
||||
|
||||
@@ -178,6 +181,7 @@ def display_events(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"events",
|
||||
df_data,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -188,6 +192,7 @@ def display_exchanges(
|
||||
sortby: str = "adjusted_volume_24h_share",
|
||||
ascend: bool = True,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing all exchanges for given coin id. [Source: CoinPaprika]
|
||||
|
||||
@@ -223,6 +228,7 @@ def display_exchanges(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"ex",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -235,6 +241,7 @@ def display_markets(
|
||||
ascend: bool = True,
|
||||
links: bool = False,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing all markets for given coin id. [Source: CoinPaprika]
|
||||
|
||||
@@ -280,6 +287,7 @@ def display_markets(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"mkt",
|
||||
df_data,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -288,6 +296,7 @@ def display_price_supply(
|
||||
from_symbol: str = "BTC",
|
||||
to_symbol: str = "USD",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing ticker information for single coin [Source: CoinPaprika]
|
||||
|
||||
@@ -297,6 +306,8 @@ def display_price_supply(
|
||||
Cryptocurrency symbol (e.g. BTC)
|
||||
to_symbol: str
|
||||
Quoted currency
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Export dataframe data to csv,json,xlsx
|
||||
|
||||
@@ -318,6 +329,7 @@ def display_price_supply(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"ps",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -325,6 +337,7 @@ def display_price_supply(
|
||||
def display_basic(
|
||||
symbol: str = "BTC",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing basic information for coin. Like:
|
||||
name, symbol, rank, type, description, platform, proof_type, contract, tags, parent.
|
||||
@@ -334,6 +347,8 @@ def display_basic(
|
||||
----------
|
||||
symbol: str
|
||||
Cryptocurrency symbol (e.g. BTC)
|
||||
sheet_name: str
|
||||
Optionally specify the name of the sheet the data is exported to.
|
||||
export: str
|
||||
Export dataframe data to csv,json,xlsx
|
||||
"""
|
||||
@@ -352,4 +367,5 @@ def display_basic(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"basic",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -13,6 +13,8 @@ from openbb_terminal.cryptocurrency.dataframe_helpers import prettify_column_nam
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_CRYPTO_PANIC_KEY"])
|
||||
@@ -25,6 +27,7 @@ def display_news(
|
||||
limit: int = 25,
|
||||
ascend: bool = True,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing recent posts from CryptoPanic news aggregator platform.
|
||||
[Source: https://cryptopanic.com/]
|
||||
@@ -73,4 +76,5 @@ def display_news(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"news",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -269,6 +269,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
start_date=ns_parser.since.strftime("%Y-%m-%d"),
|
||||
end_date=ns_parser.until.strftime("%Y-%m-%d"),
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
else:
|
||||
@@ -302,7 +305,7 @@ class DueDiligenceController(CryptoBaseController):
|
||||
|
||||
if ns_parser:
|
||||
pair = f"{coin}-{ns_parser.vs.upper()}"
|
||||
coinbase_view.display_stats(pair, ns_parser.export)
|
||||
coinbase_view.display_stats(pair, ns_parser.export, ns_parser.sheet_name)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_active(self, other_args: List[str]):
|
||||
@@ -357,6 +360,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
start_date=ns_parser.since.strftime("%Y-%m-%d"),
|
||||
end_date=ns_parser.until.strftime("%Y-%m-%d"),
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
else:
|
||||
console.print(f"[red]{self.symbol} not supported on Glassnode.[/red]")
|
||||
@@ -419,6 +425,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
start_date=ns_parser.since.strftime("%Y-%m-%d"),
|
||||
end_date=ns_parser.until.strftime("%Y-%m-%d"),
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
else:
|
||||
console.print(f"[red]{self.symbol} not supported on Glassnode.[/red]")
|
||||
@@ -491,6 +500,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
end_date=ns_parser.until.strftime("%Y-%m-%d"),
|
||||
percentage=ns_parser.percentage,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
else:
|
||||
console.print(f"[red]{self.symbol} not supported on Glassnode.[/red]")
|
||||
@@ -528,6 +540,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
symbol=self.symbol.upper(),
|
||||
interval=ns_parser.interval,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -552,6 +567,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
coinglass_view.display_liquidations(
|
||||
symbol=self.symbol.upper(),
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -576,6 +594,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
coinglass_view.display_funding_rate(
|
||||
symbol=self.symbol.upper(),
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -600,6 +621,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
pycoingecko_view.display_info(
|
||||
symbol=self.symbol,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -619,7 +643,13 @@ class DueDiligenceController(CryptoBaseController):
|
||||
if ns_parser:
|
||||
cg_id = check_cg_id(self.symbol)
|
||||
if cg_id:
|
||||
pycoingecko_view.display_market(cg_id, ns_parser.export)
|
||||
pycoingecko_view.display_market(
|
||||
cg_id,
|
||||
ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_web(self, other_args):
|
||||
@@ -641,6 +671,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
pycoingecko_view.display_web(
|
||||
self.symbol,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -660,7 +693,13 @@ class DueDiligenceController(CryptoBaseController):
|
||||
if ns_parser:
|
||||
cg_id = check_cg_id(self.symbol)
|
||||
if cg_id:
|
||||
pycoingecko_view.display_social(cg_id, export=ns_parser.export)
|
||||
pycoingecko_view.display_social(
|
||||
cg_id,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_dev(self, other_args):
|
||||
@@ -682,7 +721,13 @@ class DueDiligenceController(CryptoBaseController):
|
||||
if ns_parser:
|
||||
cg_id = check_cg_id(self.symbol)
|
||||
if cg_id:
|
||||
pycoingecko_view.display_dev(cg_id, ns_parser.export)
|
||||
pycoingecko_view.display_dev(
|
||||
cg_id,
|
||||
ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_ath(self, other_args):
|
||||
@@ -709,7 +754,14 @@ class DueDiligenceController(CryptoBaseController):
|
||||
if ns_parser:
|
||||
cg_id = check_cg_id(self.symbol)
|
||||
if cg_id:
|
||||
pycoingecko_view.display_ath(cg_id, ns_parser.vs, ns_parser.export)
|
||||
pycoingecko_view.display_ath(
|
||||
cg_id,
|
||||
ns_parser.vs,
|
||||
ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_atl(self, other_args):
|
||||
@@ -735,7 +787,14 @@ class DueDiligenceController(CryptoBaseController):
|
||||
if ns_parser:
|
||||
cg_id = check_cg_id(self.symbol)
|
||||
if cg_id:
|
||||
pycoingecko_view.display_atl(cg_id, ns_parser.vs, ns_parser.export)
|
||||
pycoingecko_view.display_atl(
|
||||
cg_id,
|
||||
ns_parser.vs,
|
||||
ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_score(self, other_args):
|
||||
@@ -758,7 +817,13 @@ class DueDiligenceController(CryptoBaseController):
|
||||
if ns_parser:
|
||||
cg_id = check_cg_id(self.symbol)
|
||||
if cg_id:
|
||||
pycoingecko_view.display_score(cg_id, ns_parser.export)
|
||||
pycoingecko_view.display_score(
|
||||
cg_id,
|
||||
ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_bc(self, other_args):
|
||||
@@ -779,7 +844,13 @@ class DueDiligenceController(CryptoBaseController):
|
||||
if ns_parser:
|
||||
cg_id = check_cg_id(self.symbol)
|
||||
if cg_id:
|
||||
pycoingecko_view.display_bc(cg_id, ns_parser.export)
|
||||
pycoingecko_view.display_bc(
|
||||
cg_id,
|
||||
ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_ob(self, other_args):
|
||||
@@ -824,6 +895,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
symbol=self.symbol,
|
||||
to_symbol=ns_parser.vs,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -869,6 +943,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
symbol=self.symbol,
|
||||
to_symbol=ns_parser.vs,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
limit=ns_parser.limit,
|
||||
)
|
||||
|
||||
@@ -904,7 +981,12 @@ class DueDiligenceController(CryptoBaseController):
|
||||
|
||||
if ns_parser:
|
||||
binance_view.display_balance(
|
||||
from_symbol=coin, to_symbol=ns_parser.vs, export=ns_parser.export
|
||||
from_symbol=coin,
|
||||
to_symbol=ns_parser.vs,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -1031,6 +1113,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
ascend=ns_parser.reverse,
|
||||
links=ns_parser.urls,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -1087,6 +1172,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
sortby=ns_parser.sortby,
|
||||
ascend=ns_parser.reverse,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -1154,6 +1242,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
ascend=ns_parser.reverse,
|
||||
links=ns_parser.urls,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -1211,6 +1302,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
sortby=ns_parser.sortby,
|
||||
ascend=ns_parser.reverse,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -1266,6 +1360,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
start_date=ns_parser.start,
|
||||
end_date=ns_parser.end,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -1289,6 +1386,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
messari_view.display_links(
|
||||
symbol=self.symbol.upper(),
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -1391,6 +1491,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
symbol=self.symbol.upper(),
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -1416,6 +1519,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
messari_view.display_tokenomics(
|
||||
symbol=self.symbol.upper(),
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -1440,6 +1546,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
messari_view.display_project_info(
|
||||
symbol=self.symbol.upper(),
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -1464,6 +1573,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
messari_view.display_team(
|
||||
symbol=self.symbol.upper(),
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -1488,6 +1600,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
messari_view.display_investors(
|
||||
symbol=self.symbol.upper(),
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -1512,6 +1627,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
messari_view.display_fundraising(
|
||||
symbol=self.symbol.upper(),
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -1536,6 +1654,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
messari_view.display_governance(
|
||||
symbol=self.symbol.upper(),
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -1644,6 +1765,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
start_date=ns_parser.start,
|
||||
end_date=ns_parser.end,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -1737,6 +1861,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
source=None,
|
||||
symbol=self.symbol,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
ascend=ns_parser.reverse,
|
||||
post_kind=ns_parser.kind,
|
||||
filter_=ns_parser.filter,
|
||||
@@ -1780,6 +1907,9 @@ class DueDiligenceController(CryptoBaseController):
|
||||
metric=ns_parser.metric,
|
||||
project=ns_parser.project,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -1811,4 +1941,7 @@ class DueDiligenceController(CryptoBaseController):
|
||||
tokenterminal_view.display_description(
|
||||
project=ns_parser.project,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@@ -40,6 +40,7 @@ def display_crypto_sentiment_analysis(
|
||||
symbol: str,
|
||||
raw: bool = False,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Sentiment analysis from FinBrain for Cryptocurrencies
|
||||
@@ -131,4 +132,5 @@ def display_crypto_sentiment_analysis(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"finbrain",
|
||||
sentiment,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -4,12 +4,10 @@ import json
|
||||
from typing import Optional
|
||||
|
||||
import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end, check_api_key
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal.helper_funcs import str_date_to_timestamp
|
||||
from openbb_terminal.helper_funcs import str_date_to_timestamp, request
|
||||
|
||||
# pylint: disable=unsupported-assignment-operation
|
||||
|
||||
@@ -221,7 +219,7 @@ def get_close_price(
|
||||
"u": str(ts_end_date),
|
||||
}
|
||||
|
||||
r = requests.get(url, params=parameters)
|
||||
r = request(url, params=parameters)
|
||||
|
||||
df = pd.DataFrame()
|
||||
|
||||
@@ -286,7 +284,7 @@ def get_non_zero_addresses(
|
||||
"u": str(ts_end_date),
|
||||
}
|
||||
|
||||
r = requests.get(url, params=parameters)
|
||||
r = request(url, params=parameters)
|
||||
|
||||
df = pd.DataFrame()
|
||||
|
||||
@@ -351,7 +349,7 @@ def get_active_addresses(
|
||||
"u": str(ts_end_date),
|
||||
}
|
||||
|
||||
r = requests.get(url, params=parameters)
|
||||
r = request(url, params=parameters)
|
||||
df = pd.DataFrame()
|
||||
|
||||
if r.status_code == 200:
|
||||
@@ -418,8 +416,8 @@ def get_hashrate(
|
||||
|
||||
df = pd.DataFrame()
|
||||
|
||||
r = requests.get(url, params=parameters)
|
||||
r2 = requests.get(url2, params=parameters)
|
||||
r = request(url, params=parameters)
|
||||
r2 = request(url2, params=parameters)
|
||||
|
||||
if r.status_code == 200 and r2.status_code == 200:
|
||||
df = pd.DataFrame(json.loads(r.text))
|
||||
@@ -507,9 +505,9 @@ def get_exchange_balances(
|
||||
}
|
||||
df = pd.DataFrame()
|
||||
|
||||
r1 = requests.get(url, params=parameters) # get balances
|
||||
r2 = requests.get(url2, params=parameters) # get relative (percentage) balances
|
||||
r3 = requests.get(
|
||||
r1 = request(url, params=parameters) # get balances
|
||||
r2 = request(url2, params=parameters) # get relative (percentage) balances
|
||||
r3 = request(
|
||||
url3, params=parameters
|
||||
) # get price TODO: grab data from loaded symbol
|
||||
|
||||
@@ -596,7 +594,7 @@ def get_exchange_net_position_change(
|
||||
"u": str(ts_end_date),
|
||||
}
|
||||
|
||||
r = requests.get(url, params=parameters)
|
||||
r = request(url, params=parameters)
|
||||
df = pd.DataFrame()
|
||||
|
||||
if r.status_code == 200:
|
||||
|
||||
@@ -36,6 +36,7 @@ def display_active_addresses(
|
||||
end_date: Optional[str] = None,
|
||||
interval: str = "24h",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots active addresses of a certain symbol over time
|
||||
@@ -89,6 +90,7 @@ def display_active_addresses(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"active",
|
||||
df_addresses,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -99,6 +101,7 @@ def display_non_zero_addresses(
|
||||
start_date: str = "2010-01-01",
|
||||
end_date: Optional[str] = None,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots addresses with non-zero balance of a certain symbol
|
||||
@@ -150,6 +153,7 @@ def display_non_zero_addresses(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"nonzero",
|
||||
df_addresses,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -161,6 +165,7 @@ def display_exchange_net_position_change(
|
||||
start_date: str = "2010-01-01",
|
||||
end_date: Optional[str] = None,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots 30d change of the supply held in exchange wallets.
|
||||
@@ -231,6 +236,7 @@ def display_exchange_net_position_change(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"change",
|
||||
df_addresses,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -243,6 +249,7 @@ def display_exchange_balances(
|
||||
end_date: Optional[str] = None,
|
||||
percentage: bool = False,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots total amount of coins held on exchange addresses in units and percentage.
|
||||
@@ -313,6 +320,7 @@ def display_exchange_balances(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"eb",
|
||||
df_balance,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -324,6 +332,7 @@ def display_hashrate(
|
||||
end_date: Optional[str] = None,
|
||||
interval: str = "24h",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots dataframe with mean hashrate of btc or eth blockchain and symbol price.
|
||||
@@ -392,4 +401,5 @@ def display_hashrate(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"hr",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -8,7 +8,6 @@ from typing import Any, Optional, Tuple
|
||||
from datetime import datetime, timedelta
|
||||
import re
|
||||
import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.cryptocurrency.dataframe_helpers import (
|
||||
@@ -19,7 +18,7 @@ from openbb_terminal.cryptocurrency.due_diligence.pycoingecko_model import (
|
||||
get_coin_tokenomics,
|
||||
)
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.helper_funcs import lambda_long_number_format
|
||||
from openbb_terminal.helper_funcs import lambda_long_number_format, request
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
# pylint: disable=unsupported-assignment-operation
|
||||
@@ -45,7 +44,7 @@ def get_available_timeseries(only_free: bool = True) -> pd.DataFrame:
|
||||
pd.DataFrame
|
||||
available timeseries
|
||||
"""
|
||||
r = requests.get("https://data.messari.io/api/v1/assets/metrics")
|
||||
r = request("https://data.messari.io/api/v1/assets/metrics")
|
||||
if r.status_code == 200:
|
||||
data = r.json()
|
||||
metrics = data["data"]["metrics"]
|
||||
@@ -174,7 +173,7 @@ def get_messari_timeseries(
|
||||
"interval": interval,
|
||||
}
|
||||
|
||||
r = requests.get(url, params=parameters, headers=headers)
|
||||
r = request(url, params=parameters, headers=headers)
|
||||
|
||||
df = pd.DataFrame()
|
||||
title = ""
|
||||
@@ -222,7 +221,7 @@ def get_links(symbol: str) -> pd.DataFrame:
|
||||
|
||||
params = {"fields": "profile/general/overview/official_links"}
|
||||
|
||||
r = requests.get(url, headers=headers, params=params)
|
||||
r = request(url, headers=headers, params=params)
|
||||
|
||||
df = pd.DataFrame()
|
||||
|
||||
@@ -263,7 +262,7 @@ def get_roadmap(symbol: str, ascend: bool = True) -> pd.DataFrame:
|
||||
|
||||
params = {"fields": "profile/general/roadmap"}
|
||||
|
||||
r = requests.get(url, headers=headers, params=params)
|
||||
r = request(url, headers=headers, params=params)
|
||||
|
||||
df = pd.DataFrame()
|
||||
|
||||
@@ -311,7 +310,7 @@ def get_tokenomics(symbol: str, coingecko_id: str) -> Tuple[pd.DataFrame, pd.Dat
|
||||
|
||||
params = {"fields": "profile/economics/consensus_and_emission"}
|
||||
|
||||
r = requests.get(url, headers=headers, params=params)
|
||||
r = request(url, headers=headers, params=params)
|
||||
|
||||
df = pd.DataFrame()
|
||||
circ_df = pd.DataFrame()
|
||||
@@ -383,7 +382,7 @@ def get_project_product_info(
|
||||
|
||||
params = {"fields": "profile/general/overview/project_details,profile/technology"}
|
||||
|
||||
r = requests.get(url, headers=headers, params=params)
|
||||
r = request(url, headers=headers, params=params)
|
||||
|
||||
df = pd.DataFrame()
|
||||
if r.status_code == 200:
|
||||
@@ -445,7 +444,7 @@ def get_team(symbol: str) -> Tuple[pd.DataFrame, pd.DataFrame]:
|
||||
|
||||
params = {"fields": "profile/contributors"}
|
||||
|
||||
r = requests.get(url, headers=headers, params=params)
|
||||
r = request(url, headers=headers, params=params)
|
||||
|
||||
df = pd.DataFrame()
|
||||
if r.status_code == 200:
|
||||
@@ -520,7 +519,7 @@ def get_investors(symbol: str) -> Tuple[pd.DataFrame, pd.DataFrame]:
|
||||
|
||||
params = {"fields": "profile/investors"}
|
||||
|
||||
r = requests.get(url, headers=headers, params=params)
|
||||
r = request(url, headers=headers, params=params)
|
||||
|
||||
df = pd.DataFrame()
|
||||
if r.status_code == 200:
|
||||
@@ -593,7 +592,7 @@ def get_governance(symbol: str) -> Tuple[str, pd.DataFrame]:
|
||||
|
||||
params = {"fields": "profile/governance"}
|
||||
|
||||
r = requests.get(url, headers=headers, params=params)
|
||||
r = request(url, headers=headers, params=params)
|
||||
|
||||
df = pd.DataFrame()
|
||||
if r.status_code == 200:
|
||||
@@ -672,7 +671,7 @@ def get_fundraising(
|
||||
|
||||
params = {"fields": "profile/economics/launch"}
|
||||
|
||||
r = requests.get(url, headers=headers, params=params)
|
||||
r = request(url, headers=headers, params=params)
|
||||
|
||||
df = pd.DataFrame()
|
||||
if r.status_code == 200:
|
||||
|
||||
@@ -52,6 +52,7 @@ def display_messari_timeseries_list(
|
||||
query: str = "",
|
||||
only_free: bool = True,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing messari timeseries list
|
||||
[Source: https://messari.io/]
|
||||
@@ -94,6 +95,7 @@ def display_messari_timeseries_list(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"mt",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
else:
|
||||
console.print("\nUnable to retrieve data from Messari.\n")
|
||||
@@ -108,6 +110,7 @@ def display_messari_timeseries(
|
||||
end_date: Optional[str] = None,
|
||||
interval: str = "1d",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots messari timeseries
|
||||
@@ -174,6 +177,7 @@ def display_messari_timeseries(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"mt",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -185,6 +189,7 @@ def display_marketcap_dominance(
|
||||
end_date: Optional[str] = None,
|
||||
interval: str = "1d",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots market dominance of a coin over time
|
||||
@@ -242,12 +247,13 @@ def display_marketcap_dominance(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"mcapdom",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_MESSARI_KEY"])
|
||||
def display_links(symbol: str, export: str = "") -> None:
|
||||
def display_links(symbol: str, export: str = "", sheet_name: str = None) -> None:
|
||||
"""Prints table showing coin links
|
||||
[Source: https://messari.io/]
|
||||
|
||||
@@ -275,6 +281,7 @@ def display_links(symbol: str, export: str = "") -> None:
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"links",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
else:
|
||||
console.print("\nUnable to retrieve data from Messari.\n")
|
||||
@@ -287,6 +294,7 @@ def display_roadmap(
|
||||
ascend: bool = True,
|
||||
limit: int = 5,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots coin roadmap
|
||||
@@ -377,6 +385,7 @@ def display_roadmap(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"rm",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
else:
|
||||
console.print("\nUnable to retrieve data from Messari.\n")
|
||||
@@ -387,6 +396,7 @@ def display_roadmap(
|
||||
def display_tokenomics(
|
||||
symbol: str,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Plots coin tokenomics
|
||||
@@ -461,6 +471,7 @@ def display_tokenomics(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"tk",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
else:
|
||||
console.print("\nUnable to retrieve data from Messari.\n")
|
||||
@@ -471,6 +482,7 @@ def display_tokenomics(
|
||||
def display_project_info(
|
||||
symbol: str,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing project info
|
||||
[Source: https://messari.io/]
|
||||
@@ -503,6 +515,7 @@ def display_project_info(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"pi",
|
||||
df_info,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@@ -511,6 +524,7 @@ def display_project_info(
|
||||
def display_investors(
|
||||
symbol: str,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing coin investors
|
||||
[Source: https://messari.io/]
|
||||
@@ -547,6 +561,7 @@ def display_investors(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"inv",
|
||||
df_individuals,
|
||||
sheet_name,
|
||||
)
|
||||
else:
|
||||
console.print("\nInvestors not found\n")
|
||||
@@ -557,6 +572,7 @@ def display_investors(
|
||||
def display_team(
|
||||
symbol: str,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing coin team
|
||||
[Source: https://messari.io/]
|
||||
@@ -593,6 +609,7 @@ def display_team(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"team",
|
||||
df_individuals,
|
||||
sheet_name,
|
||||
)
|
||||
else:
|
||||
console.print("\nTeam not found\n")
|
||||
@@ -603,6 +620,7 @@ def display_team(
|
||||
def display_governance(
|
||||
symbol: str,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing coin governance
|
||||
[Source: https://messari.io/]
|
||||
@@ -630,6 +648,7 @@ def display_governance(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"gov",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
else:
|
||||
console.print(f"\n{symbol} governance details not found\n")
|
||||
@@ -640,6 +659,7 @@ def display_governance(
|
||||
def display_fundraising(
|
||||
symbol: str,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Display coin fundraising
|
||||
@@ -738,4 +758,5 @@ def display_fundraising(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"fr",
|
||||
df_details,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -23,6 +23,7 @@ def display_coin_potential_returns(
|
||||
limit: Optional[int] = None,
|
||||
price: Optional[int] = None,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
) -> None:
|
||||
"""Prints table showing potential returns of a certain coin. [Source: CoinGecko]
|
||||
|
||||
@@ -50,11 +51,12 @@ def display_coin_potential_returns(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"prt",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_info(symbol: str, export: str = "") -> None:
|
||||
def display_info(symbol: str, export: str = "", sheet_name: str = None) -> None:
|
||||
"""Prints table showing basic information about loaded coin. [Source: CoinGecko]
|
||||
|
||||
Parameters
|
||||
@@ -83,11 +85,12 @@ def display_info(symbol: str, export: str = "") -> None:
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"info",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_web(symbol: str, export: str = "") -> None:
|
||||
def display_web(symbol: str, export: str = "", sheet_name: str = None) -> None:
|
||||
"""Prints table showing found websites corresponding to loaded coin. [Source: CoinGecko]
|
||||
|
||||
Parameters
|
||||
@@ -116,11 +119,12 @@ def display_web(symbol: str, export: str = "") -> None:
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"web",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_social(symbol: str, export: str = "") -> None:
|
||||
def display_social(symbol: str, export: str = "", sheet_name: str = None) -> None:
|
||||
"""Prints table showing social media corresponding to loaded coin. [Source: CoinGecko]
|
||||
|
||||
Parameters
|
||||
@@ -145,11 +149,12 @@ def display_social(symbol: str, export: str = "") -> None:
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"social",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_dev(symbol: str, export: str = "") -> None:
|
||||
def display_dev(symbol: str, export: str = "", sheet_name: str = None) -> None:
|
||||
"""Prints table showing developers data for loaded coin. [Source: CoinGecko]
|
||||
|
||||
Parameters
|
||||
@@ -175,11 +180,14 @@ def display_dev(symbol: str, export: str = "") -> None:
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"dev",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_ath(symbol: str, currency: str = "usd", export: str = "") -> None:
|
||||
def display_ath(
|
||||
symbol: str, currency: str = "usd", export: str = "", sheet_name: str = None
|
||||
) -> None:
|
||||
"""Prints table showing all time high data for loaded coin. [Source: CoinGecko]
|
||||
|
||||
Parameters
|
||||
@@ -202,11 +210,14 @@ def display_ath(symbol: str, currency: str = "usd", export: str = "") -> None:
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"ath",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_atl(symbol: str, currency: str = "usd", export: str = "") -> None:
|
||||
def display_atl(
|
||||
symbol: str, currency: str = "usd", export: str = "", sheet_name: str = None
|
||||
) -> None:
|
||||
"""Prints table showing all time low data for loaded coin. [Source: CoinGecko]
|
||||
|
||||
Parameters
|
||||
@@ -229,11 +240,12 @@ def display_atl(symbol: str, currency: str = "usd", export: str = "") -> None:
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"atl",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_score(symbol: str, export: str = "") -> None:
|
||||
def display_score(symbol: str, export: str = "", sheet_name: str = None) -> None:
|
||||
"""Prints table showing different kind of scores for loaded coin. [Source: CoinGecko]
|
||||
|
||||
Parameters
|
||||
@@ -259,11 +271,12 @@ def display_score(symbol: str, export: str = "") -> None:
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"score",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_bc(symbol: str, export: str = "") -> None:
|
||||
def display_bc(symbol: str, export: str = "", sheet_name: str = None) -> None:
|
||||
"""Prints table showing urls to blockchain explorers. [Source: CoinGecko]
|
||||
|
||||
Parameters
|
||||
@@ -286,11 +299,12 @@ def display_bc(symbol: str, export: str = "") -> None:
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"bc",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_market(symbol: str, export: str = "") -> None:
|
||||
def display_market(symbol: str, export: str = "", sheet_name: str = None) -> None:
|
||||
"""Prints table showing market data for loaded coin. [Source: CoinGecko]
|
||||
|
||||
Parameters
|
||||
@@ -313,4 +327,5 @@ def display_market(symbol: str, export: str = "") -> None:
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"market",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -2,14 +2,13 @@ import logging
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Optional
|
||||
|
||||
import requests
|
||||
|
||||
import pandas as pd
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal.cryptocurrency.discovery.pycoingecko_model import read_file_data
|
||||
from openbb_terminal.helper_funcs import request
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -79,8 +78,8 @@ def get_github_activity(
|
||||
f'from: "{start_date}" to: "{end_date}" interval: "{interval}"){{ datetime value }} }} }}'
|
||||
)
|
||||
|
||||
response = requests.post(
|
||||
"https://api.santiment.net/graphql", headers=headers, data=data
|
||||
response = request(
|
||||
"https://api.santiment.net/graphql", method="POST", headers=headers, data=data
|
||||
)
|
||||
|
||||
df = pd.DataFrame()
|
||||
|
||||
@@ -30,6 +30,7 @@ def display_github_activity(
|
||||
end_date: Optional[str] = None,
|
||||
interval: str = "1d",
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
) -> None:
|
||||
"""Returns a list of github activity for a given coin and time interval.
|
||||
@@ -89,4 +90,5 @@ def display_github_activity(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"gh",
|
||||
df,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -32,6 +32,7 @@ def display_fundamental_metric_from_project_over_time(
|
||||
metric: str,
|
||||
project: str,
|
||||
export: str = "",
|
||||
sheet_name: str = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
):
|
||||
"""Plots fundamental metric from a project over time [Source: Token Terminal]
|
||||
@@ -101,12 +102,13 @@ def display_fundamental_metric_from_project_over_time(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"funot",
|
||||
metric_over_time,
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_TOKEN_TERMINAL_KEY"])
|
||||
def display_description(project: str, export: str = ""):
|
||||
def display_description(project: str, export: str = "", sheet_name: str = None):
|
||||
"""Prints description from a project [Source: Token Terminal]
|
||||
|
||||
Parameters
|
||||
@@ -132,4 +134,5 @@ def display_description(project: str, export: str = ""):
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"desc",
|
||||
pd.DataFrame(description.values(), index=description.keys()),
|
||||
sheet_name,
|
||||
)
|
||||
|
||||
@@ -89,6 +89,9 @@ class NFTController(BaseController):
|
||||
nftpricefloor_view.display_floor_price(
|
||||
slug=ns_parser.slug,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
raw=ns_parser.raw,
|
||||
limit=ns_parser.limit,
|
||||
)
|
||||
@@ -125,6 +128,9 @@ class NFTController(BaseController):
|
||||
opensea_view.display_collection_stats(
|
||||
slug=ns_parser.slug,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@@ -159,4 +165,7 @@ class NFTController(BaseController):
|
||||
show_fp=ns_parser.fp,
|
||||
limit=ns_parser.limit,
|
||||
export=ns_parser.export,
|
||||
sheet_name=" ".join(ns_parser.sheet_name)
|
||||
if ns_parser.sheet_name
|
||||
else None,
|
||||
)
|
||||
|
||||
@@ -4,8 +4,8 @@ import logging
|
||||
from typing import List
|
||||
|
||||
import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal.helper_funcs import request
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -32,7 +32,7 @@ def get_collections() -> pd.DataFrame:
|
||||
pd.DataFrame
|
||||
nft collections
|
||||
"""
|
||||
res = requests.get(f"{API_URL}/projects")
|
||||
res = request(f"{API_URL}/projects")
|
||||
if res.status_code == 200:
|
||||
data = res.json()
|
||||
df = pd.DataFrame(data)
|
||||
@@ -56,7 +56,7 @@ def get_floor_price(slug: str) -> pd.DataFrame:
|
||||
pd.DataFrame
|
||||
nft collections
|
||||
"""
|
||||
res = requests.get(f"{API_URL}/projects/{slug}/charts/all")
|
||||
res = request(f"{API_URL}/projects/{slug}/charts/all")
|
||||
if res.status_code == 200:
|
||||
data = res.json()
|
||||
df = pd.DataFrame(
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user