sarvjeets / lakshmi Goto Github PK
View Code? Open in Web Editor NEWInvesting library and command-line interface inspired by the Bogleheads philosophy
License: MIT License
Investing library and command-line interface inspired by the Bogleheads philosophy
License: MIT License
macOS - M1 Max
installed with pip
Python 3.9.12
lak --help
returns help correctly.
lak init
fails after a couple of seconds... printing Aborted!
and attempting to open a editor to editor-{RANDOM}.txt
I'm not a python developer but I have to run a few other python CLI tools from time to time.
Hi,
I setup my yaml file and everything is working. I was wondering if you could add an option in rebalance to also show suggestions for re-balancing within accounts to obtain the desired % for the portfolio as a whole. The account rebalance could use this strategy. https://www.bogleheads.org/wiki/Tax-efficient_fund_placement#Assigning_asset_classes_to_different_accounts.
A caveat would you the dollar limits of what is in each account when using the assignment strategy
command:
lak analyze rebalance -strategy
display:
Class | Actual% | Desired% | Account | Value | Difference
When looking up the BTC-USD asset, I get the following traceback:
Traceback (most recent call last): File "/home/josh/.local/bin/lak", line 8, in <module> sys.exit(lak()) File "/home/josh/.local/lib/python3.8/site-packages/click/core.py", line 1128, in __call__ return self.main(*args, **kwargs) File "/home/josh/.local/lib/python3.8/site-packages/click/core.py", line 1053, in main rv = self.invoke(ctx) File "/home/josh/.local/lib/python3.8/site-packages/click/core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/josh/.local/lib/python3.8/site-packages/click/core.py", line 1690, in invoke rv.append(sub_ctx.command.invoke(sub_ctx)) File "/home/josh/.local/lib/python3.8/site-packages/click/core.py", line 1395, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/josh/.local/lib/python3.8/site-packages/click/core.py", line 754, in invoke return __callback(*args, **kwargs) File "/home/josh/.local/lib/python3.8/site-packages/lakshmi/lak.py", line 272, in assets output = portfolio.assets( File "/home/josh/.local/lib/python3.8/site-packages/lakshmi/lakshmi.py", line 636, in assets + [asset.name(), asset.adjusted_value()]) File "/home/josh/.local/lib/python3.8/site-packages/lakshmi/cache.py", line 174, in new_func value = call_func(class_obj, func) File "/home/josh/.local/lib/python3.8/site-packages/lakshmi/cache.py", line 138, in call_func return func(class_obj) File "/home/josh/.local/lib/python3.8/site-packages/lakshmi/assets.py", line 489, in name raise NotFoundError( lakshmi.assets.NotFoundError: Cannot retrieve ticker ("BTC-USD") from Yahoo Finance
I found that this asset does not actually have a longName field in the ticker object provided by YT API. There are a few other name fields so I've got a PR coming shortly to try to fall back to some other naming fields if the longName field does not exist.
It can be convenient to set an asset class allocation ratio to 0, for example to exit a position of a certain fund or market segment.
It seems like most lak
commands handle this just fine, however lak analyze allocate --rebalance
does not allow this.
$ lak analyze allocate --account MyBrokerage --rebalance
<...>
AssertionError: Desired ratio of asset class MyZeroAsset cannot be zero.
I think this should work. The MyZeroAsset
asset should be rebalanced to 0 and the funds moved to other assets.
A hacky work around is to set the ratio to to almost zero e.g. 0.00000000000001
.
yfinance has updated its API that requires lakshmi to use Ticket.fast_info instead of Ticker.info to continue fetching prices.
Hi,
I haven't used lak for awhile. I tried today and received this error: lakshmi.assets.NotFoundError: Cannot retrieve ticker ("VTI") from Yahoo Finance. I used the already setup portfolio for testing.
Below is the command I ran and the output.
mhenke@mhenke-Inspiron-15-3567:~$ lak --debug -r list assets total aa al performance
Traceback (most recent call last):
File "/home/mhenke/.local/bin/lak", line 8, in
sys.exit(lak())
File "/home/mhenke/.local/lib/python3.8/site-packages/click/core.py", line 1128, in call
return self.main(*args, **kwargs)
File "/home/mhenke/.local/lib/python3.8/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/home/mhenke/.local/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/mhenke/.local/lib/python3.8/site-packages/click/core.py", line 1690, in invoke
rv.append(sub_ctx.command.invoke(sub_ctx))
File "/home/mhenke/.local/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/mhenke/.local/lib/python3.8/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/home/mhenke/.local/lib/python3.8/site-packages/lakshmi/lak.py", line 328, in assets
output = portfolio.assets(
File "/home/mhenke/.local/lib/python3.8/site-packages/lakshmi/lakshmi.py", line 712, in assets
+ [asset.name(), asset.adjusted_value()])
File "/home/mhenke/.local/lib/python3.8/site-packages/lakshmi/assets.py", line 176, in adjusted_value
return max(0, self.value() + self.get_what_if())
File "/home/mhenke/.local/lib/python3.8/site-packages/lakshmi/assets.py", line 428, in value
return self.shares() * self.price()
File "/home/mhenke/.local/lib/python3.8/site-packages/lakshmi/cache.py", line 211, in new_func
value = _call_func(class_obj, func)
File "/home/mhenke/.local/lib/python3.8/site-packages/lakshmi/cache.py", line 178, in _call_func
return func(class_obj)
File "/home/mhenke/.local/lib/python3.8/site-packages/lakshmi/assets.py", line 539, in price
raise NotFoundError(
lakshmi.assets.NotFoundError: Cannot retrieve ticker ("VTI") from Yahoo Finance
As a user, I would like to easily switch between different portfolio.yaml. For example, I have portfolio_mh.yaml which has my portfolio and portfolio_sh.yaml which has my wife's.
command might be:
I added a class called US_Ext for extended market since my 401k plan doesn't have a total market fund but has a s&p 500 and extended market. When I run rebalance, it seems to miss the US_Ext class.
lak analyze rebalance
Class Actual% Desired% Value Difference
US 83% 59% $189,381.65 -$53,901.82
Bonds 2% 10% $4,820.86 +$18,126.26
Intl 3% 18% $7,061.55 +$34,243.28
lak list aa shows the US_Ext class
mhenke@mhenke-Inspiron-15-3567:$ python --version
Python 3.8.10
mhenke@mhenke-Inspiron-15-3567:$ pip install lakshmi
ERROR: Could not find a version that satisfies the requirement lakshmi (from versions: none)
ERROR: No matching distribution found for lakshmi
pip -V
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
Add some simple tests for lak module. The module doesn't have complicated logic, but tests will make refactoring of library easier.
lak seems to be stuck fetching updated I/EE bond values from the TreasuryDirect website.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.