8 ms·
Show HN: Eiten – open-source tool for portfolio optimization
- edoceo 6y agoI'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.
- hydershykh 6y agothat wasn't the intention to be honest which is why the link of the company is at the very bottom.
- nik_0_0 6y agoGithub also pops the link up to the top, above the license, at least on mobile.
- Mizza 6y agoNice! I tried building a way dumber version of this for myself, but based on ~realtime data. This looks better.
- hydershykh 6y agoGlad to know that. How did it go? As for realtime data, this can easily work with real time data as well with some small adjustments.
- elephant_7 6y agoCan you load other datasets like these used by Elastic in Generating and visualizing alpha...? https://www.elastic.co/blog/generating-and-visualizing-alpha-with-vectorspace-ai-datasets-and-canvas https://www.elastic.co/blog/generating-and-visualizing-alpha...
- hydershykh 6y agoyes, 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. Happy to talk more on this.
- deleted 6y ago[deleted]
- elephant_7 6y agoGreat, 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
- hydershykh 6y agoThat's pretty awesome. Please keep in touch, let's see if we can apply the tool on the new data sets.
- hydershykh 6y agoHi, 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.
- justinzollars 6y agoCan you please give us a TLDR of MIT's 18.S096 and the strategies from the course you tried to adapt into this package?
- hydershykh 6y agoOh sure. 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 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.
- omarhaneef 6y agoI’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.
- daddypro 6y agoHi, 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?
- hydershykh 6y agoSo 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.
- westurner 6y agoIs it possible to factor (e.g. GRI) sustainability criteria into the portfolio fitness function? https://news.ycombinator.com/item?id=21922558 https://news.ycombinator.com/item?id=21922558 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 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 https://github.com/wilsonfreitas/awesome-quant
- hydershykh 6y agoThis is perfect. Thank you for sharing this. 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.
- westurner 6y ago(Sustainable) Index ETFs in the stocks.txt universe would likely be less sensitive to single performers' effects in unbalanced portfolios. > pyfolio.tears.create_interesting_times_tear_sheet measures algorithmic trading algorithm performance during "stress events" https://github.com/quantopian/pyfolio/blob/03568e0f328783a6a065cdfd44416390e024e23d/pyfolio/tears.py#L870 https://github.com/quantopian/pyfolio/blob/03568e0f328783a6a...
- iav 6y agoDoes 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. [1] https://github.com/quantopian/alphalens https://github.com/quantopian/alphalens
- 6y ago
- konfuzio 6y agoDoes the optimization include rebalancing + trading costs?
- hydershykh 6y agoTrading 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.
- schemescape 6y agoIn addition to trading fees, it would be good to track taxable events, (dividends and capital gains) and let the user specify tax rates on these.
- codebolt 6y agoVery 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.
- hydershykh 6y agoGlad to hear that.
- scribu 6y agoI'm curious how it differs from PyPortfolioOpt. https://github.com/robertmartin8/PyPortfolioOpt https://github.com/robertmartin8/PyPortfolioOpt
- hydershykh 6y agoI 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. Hope this answers the question.
- omarhaneef 6y agoOne of my favorite things about HN is that it quickly surfaces the alternatives.
- xupybd 6y agoI 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.
- Cthulhu_ 6y agoThat'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.
- xupybd 6y agoI 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.
- xwdv 6y agoDefinitely 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.
- curiousgal 6y agoIf he had invested $100 back then he would have sold his holdings when they reached some crazy high level in comparison.
- elliottback 6y agoDoes this include reinvested dividends?
- hydershykh 6y agoIt does not.
- schemescape 6y agoAre dividends at least included in the calculated return (even if not reinvested)? If not, how does that impact the example portfolios’ outperformance?
- BOOSTERHIDROGEN 6y agoIs this also work for etf ?
- hydershykh 6y agoIt does, all you need is to change your stock list to etfs.
- zeroonetwothree 6y agoHow easy is it to customize? For example can I change the time frame of the backtest or have it backtest non consecutive days?
- hydershykh 6y agoThat should be doable pretty easily. The code is easy to read and modify.