Commit Graph

7 Commits

Author SHA1 Message Date
montezdesousa
570e579067 Portfolio docstring example fixes and some bugs (#3431)
* fix doctest

* fix some type hints

* reorganize portfolio folders

* fix rfr

* fix vol bug

* fix more docs

* fix failing test

* doc typo

* numpy fix

* pydocstyle

* regenerate website docs
2022-11-18 19:30:55 +00:00
montezdesousa
8e9e6bd57f Incorporate portfolio class into SDK (#3401)
* create functions to interact with portfolio

* fix some docstrings

* view docstrings

* make portfolio loading available in sdk

* reorder some methods

* fix bug

* update controller

* update website

* remove import

* change input name

* regenerate website

* change portfolio arg name

* fix metrics bugs

* fix report

* refactor assets alloc

* refactor assets sectors alloc

* remove unecessary attributes

* refactor allocaasset sector

* reorganize class

* first refactor alloc

* refactor portfolio alloc

* black

* fix alloc bug

* regenerate sdk website

* fix alloc bugs

* forgot this exception

* some refactor on portfolio alloc country region

* fix some allocation bugs

* add examples

* regenerate website

Co-authored-by: James Maslek <jmaslek11@gmail.com>
2022-11-14 11:27:34 -05:00
montezdesousa
f9086d6f38 Portfolio menu bug fixes (#3204)
* normalized way moving average is treated and prevent huge exception prompt

* changed descriptions on docs

* change to check_positive_float

* add integration tests

* fix linting

* add more integration tests

* add more integration tests

* fix linting

* add some po integration tests

* fix flag without prompt

* change orderbook to transactions

* limit warning to portfolio

* change print help

* format portfolio var

* reformat controller

* reformat es

* remove autocompletion

* change print help

* add percentage symbol to summary

* fix holp holv

* fix scripts

* update website doc

* add tqdm progress bars

* fix table spacing

* identify mret tables

* remove positive float from rfr

* flake8

* pylint

* fix reports

* revert to old menu help

* revert to old menu help

* Update test_portfolio.openbb

* quick change on empty lines

Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>
Co-authored-by: James Maslek <jmaslek11@gmail.com>
2022-11-09 10:46:42 +00:00
Uzair Aftab
35b21cee39 refactor: convert for loops into list and dict comprehensions (#2493) 2022-09-23 22:59:12 +03:00
montezdesousa
291e7d6991 Add ETF support for portfolio allocation command (#2143)
* fill etf and prevent different length errors

* auto fill etf sectors and allow 0 value portfolios

* allow 0 value portfolios

* remove unused folder

* allow 1 asset portfolios

* split allocation calls by category  in controller

* comment sector allocation model

* get country and region allocations for etf

* add comments and black

* improve comments

* improve comments

* allow for 1 category in sector, country and region

* add progress bars

* linting fix

* fix mypy

* set default date

* fix pylint

* add isin on paexport

* merge main

* auto pre load benchmark

* fix rich table for np.float64

* refactor portfolio allocs

* refactor alloc command

* add isins column

* format output alloc

* rename variable

* fix nan bug

* black

* add ticker conversion to yf format by isin

* warn and removed unsupported ISINs

* solve same day trades bug

* display bench loading progress

* portfolio show

* check if valid isins on preprocessing

* black

* fix bug when region empty

* warn when category is empty

* reformat preprocessing

* codespell

* check if ticker is valid

* flake8

* fix test

* fix bug with trades on holidays

Co-authored-by: Jeroen Bouma <jer.bouma@gmail.com>
2022-09-09 15:12:59 +01:00
montezdesousa
2c3e10a128 Overhaul Portfolio class (#2021)
* adds pythonic portfolio class

* start calculate trades refactoring

* adds comments to portfolio model - delete afterwards

* finish calculate trades refactoring

* restore original portfolio_model.py

* implement calculate_allocations

* adapt and test controller load, show, bench, alloc and perf

* add old code that was ok

* adapt controller

* adapt portfolio_view

* run black on pythonic_portfolio.py

* fix crypto bug

* change column name in example datasets

* substitute portfolio_model.py

* update show command

* push cumulative returns calculation to model

* fix last change in cumulative returns

* add comments on possibly unused code

* run black on changes

* bring metrics from helper to model

* push rolling metrics from view to model

* Details and linting

* Fix tests

* remove empty attribute and rename class

* fix view and controller rf

* change returns calculation method

* remove CASH from code

* remove cash from tickers_list

* run black on changes

* change function name

* adapt to PortfolioModel

* fix tests

* fix tests on help

* fix linting

* call metrics from PortfolioModel

* call drawdown from model

* fix some mypy issues

* fix remaining mypy issues

* fix test

* Fix linting

* Remove unused function

* Small fixes

* Remove old code and adjust summary to simply work

* Update the Excel since CASH is no longer a thing

* Fix tests

* Update the csvs

* Updates to usage of full_shares and more details

* Fix -t flag for perf

Co-authored-by: Jeroen Bouma <jer.bouma@gmail.com>
2022-07-08 17:59:09 +02:00
Jeroen Bouma
7e37ed0444 Add comparisons between the portfolio and benchmark including an orderbook sheet (#1773)
* Add in Portfolio Holdings for Attribution functionality

* Update a whole bunch

* Small bugfix and linting

* Remove print statements

* Update Excel to match Yahoo Finance categorization

* Make sure portfolio and benchmark are aligned

* Add in benchmarks, robustness and bugfixing

* Improve the spreadsheet

* Add in allocation model and improve portfolio features

* Bugfixing and more equities in the template

* Bugfix

* Bugfixing

* Add tests and website stuff

* WORK

* Clean up the code

* Add back in terminal changes

* Missing an enter imo

* Documentation fix

* Small fix

* Change code because tests cant handle formatting

Co-authored-by: James Maslek <jmaslek11@gmail.com>
2022-05-14 12:42:01 +01:00