My concern is that - like any other portfolio optimization algorithm - blindly optimizing on fundamentals and short term returns will lead to investing in firms who just dump external costs onto people in the present and future; so, screening with sustainability criteria is important to me.
I might start implementing some of these but would love for someone else to add a few PRs as well. The code is pretty modular especially if we want to add new strategies.
Does the code have any factor investing features at all right now? I was just reading about alpha lens, another project focused on performance attribution of factors. To avoid reinventing the wheel, are there any other libraries that can be leveraged to add factors - so portfolios are constructed to go long and/or short a certain factor like sustainability or etc.
Hi, developer of the tool here. Have been dabbling in trading for about two years and have plenty of data science experience. Trying to merge the two by working on a lot of tools right now. This one was inspired from a few lectures at the MIT's 18.S096 (Topics in Mathematics with Applications in Finance) course that I am taking right now on the OCW.
If you have any questions or comments, happy to discuss.
I’ll give it my second biggest big compliment: I’ve wanted to do something like this for years. (My biggest compliment is: why didn’t I think of that?)
Anyway, do you have a robust methodology for testing this? I’ve seen people make simple mistakes like summing volatilities or using the European options model for US options and dozens of other small issues. It would almost be as large a contribution to come up with a testing suite.
I am at lecture 11 right now (volatility modeling). I guess the best thing I learned was value at risk models and how companies like Morgan Stanley use historical returns, covariance matrices, and monte carlo to estimate their maximum risk. That was fascinating.
Other than that, I dived here and there and found the portfolio optimization lectures to be good. To be honest, all lecture taught by people from the industry are damn good.
As for the strategies, eigen portfolio would be one. I started reading about it and digressed to another blog (https://srome.github.io) that had some excellent resources. From there, I had to read a few more papers to get to MSR. That makes three strategies -> Eigen portfolios, Minimum Variance, and Maximum Sharpe.
The last strategy is using a genetic algo to maximize sharpe ratio. That is a custom implementation as I've quite some experience with GAs.
Happy to talk more about the course and the strategies.
I understand none of these concepts. If you're like me, make sure you take the time to learn these things before you trust any tool to help you invest.
This is not to say I disagree with this or think it's bad, it's probably great. Just please don't invest with until you understand. Then go for it.
That's my line of thinking. I don't have the interest to be micro managing my investments. I put some of my money into the stock market some years ago (with good results, probably doubled my money if I sell now) but a big part is in a managed fund (a product sold by my bank) and another part is in just hobby / meme things, amateur "I think this company will do good".
I try not to think too hard about things like "I should've held onto those TSLA stocks" because I can't predict the future and the company could easily have crashed instead.
I had one left in TSLA (now 5 because split), I've bought Take Two because I'm confident GTA VI will be ridiculous (again), and I think most right now is in S&P 500 indices because it's a solid long term investment.
I almost worked on Bitcoin mining hardware as an honours project back when Bitcoin had no value, less than a cent per coin. I would have made so much money just by mining back then. But I don't regret it. I worked on automated tests instead but I think it was the wiser choice just not the lucky choice.
Definitely not the wise choice. You will eventually realize there’s plenty of time to learn about automated tests, but only few opportunities to make truly massive amounts of money. If you had mined $100 of bitcoin back then, you’d be a 9-figure developer today.
How were they to know this at the time, that’s the point they are making. Obviously knowing how things shook out if OP went back in time, yeah no shit they are going to mine that bitcoin.
True believers always knew this. I remember going to a presentation about Bitcoin where a speaker had boasted about how he had invested all his life savings into bitcoin, back when it was still worth less than $100. He gave his justifications, about how it was the future of money and the end of fiat.
I laughed, and couldn’t wait to hear the sob story about how he lost it all years later when the price went to 0. But the day never came, and I never forgot.
The guy must have cashed out sometime shortly after Bitcoin hit his peak, and now posts about his “riches and bitches”, I’m talking fast cars, big houses with long hallways, vacations around the world with exotic women under his arm and watches as big as your fist. Scroll through his feed long enough and your bound to catch a selfie with a middle finger aimed straight at the camera. He still gives seminars about investing in cryptocurrencies and did a few angel investments in some startups that went who knows where.
Was it wisdom, or pure luck? There’s some element of luck probably, but substantial gains don’t tend to last that long if you only have luck without wisdom.
That was pure luck. Investing 100 percent of your life savings in one high risk thing is dumb. That is not to say some people won't win that way but the vast majority will loose. That guy lacks wisdom and got very lucky.
Is it though? At that point in his life, perhaps late twenties, how much accumulated life savings could he possibly have? If he lost it all, he would probably put himself maybe 10 years back, sucks, but not unrecoverable. How often does a moonshot come around? What other point in his life could he have taken such a risk? Maybe there’s some wisdom here, it’s not all luck.
Luck. There were a million other more promising moonshots at the time. He rolled the dice and lucked out. He also could have taken his life saving and taken it to Vegas and made even more money.
I would say this is a subset of the above repo but with one major difference.
All you need is a single command to use Eiten while for most of the other repos, they require a user to code just a little bit. The goal of Eiten was to make it as easy as possible for newbies to develop portfolios, test them, and invest in them.
I'm not sure if this tool is any good, I'll be playing w/it tomorrow - but the company behind it just got $50 from me so I can check their whole thing out- seems neat.
Hi, very interesting tool. Thanks for sharing.
While playing with it, I see some weights that are confusing. In some portfolios I see weights that are > 1 as well as some that are -ve (and I have long only portfolios) - so not sure how to interpret this (does >1 mean use leverage?
I haven't read the blogs in detail yet, but are these portfolio weights static (ie equivalent to buy and hold in these ratios)? Is there anything like recomputing weights periodically and rebalancing the portfolio?
So the negative weights are just ignored during the forward and back tests. They are there just to show you the raw portfolios without any filtering.
As for the other question, the weights are just proportions of your money that you should put in each stock. If a weight is negative, that means just short with that proportion. You can simply normalize the weights to sum up to one if it's harder to read them without them being normalized.
Let me know if you have any other questions. Happy to answer.
yes, since the code is pretty modular. All the changes that one needs to make are in the data_manager.py file. There is a single function that loads the stocks data which can easily be changed.
Great, I'll be touch. The datasets are NLP and NLU derived correlation matrices used to cluster stocks in different ways outside of standard time-series
Very cool, thanks for sharing. Currently sitting in the early drawing board stage of a potential portfolio tool for a small pool of asset managers in my north-European country, so this was very interesting to look at.
Trading costs are not included during the back test. Since the portfolios are buy and hold, there won't be a lot of trades. Therefore, it seemed like a reasonable assumption to ignore the trading costs especially with all the 0-commission brokerage firms out there.
Are dividends at least included in the calculated return (even if not reinvested)? If not, how does that impact the example portfolios’ outperformance?
My concern is that - like any other portfolio optimization algorithm - blindly optimizing on fundamentals and short term returns will lead to investing in firms who just dump external costs onto people in the present and future; so, screening with sustainability criteria is important to me.
From https://news.ycombinator.com/item?id=19111911 :
> awesome-quant lists a bunch of other tools for algos and superalgos: https://github.com/wilsonfreitas/awesome-quant