My Journey to Peaceful Tradevesting with Python
These are the excerpts from the session on ‘My Journey to Peaceful Tradevesting with Python’.
Please note: The content (including my journey, approach, illustrations and examples) I shared here is for education and learning purpose only. There is no suggestion or recommendation of any kind, please do your own research before investing/trading.
In this session, you will learn:
- What is Tradevesting?
- How can you remain Peaceful in stock market?
- How can you leverage Python (or any other programming language) for peaceful tradevesting?
Please feel free to check my other articles on this topic here: https://ankit-rathi.github.io/tradevesting/
During a difficult period in my life, I read ‘Man’s Search for Meaning’ by Viktor Frankl, a Holocaust survivor. In his book, Frankl explains that many inmates lost their will to live due to the horrific conditions imposed by the Nazis. He believes that he survived because he could visualize himself overcoming the Holocaust and later helping others to face life’s challenges with courage and grace. He concludes that we need a strong enough ‘why’ to endure any ‘how’ in life.
Before diving into the stock market, it’s important to note that investing/trading isn’t for everyone. Your success depends on your mindset about money, spending habits, risk tolerance, financial knowledge, and emotional control.
Now let’s explore the features of the tradevesting methodology. You can analyse your portfolio, configure buy and sell recommendations, identify valuation gaps, perform back-testing and analyse the fundamentals and technicals of stock market opportunities.
While nobody can predict the market movements, based on historical patterns, you can expect around 25% CAGR on an average in 3 years with Tradevesting methodology.
However, the tradevesting methodology has some limitations. You might miss out on multi-bagger returns and opportunities in growth and momentum stocks.
Now, let me share how I ended up building the tradevesting methodology.
From 2017 to 2019, I was experiencing a high point in my career — winning Kaggle competitions, writing books, traveling for business, and giving guest lectures at universities and colleges.
However, everything changed when I lost my father in April 2021 during the second wave of COVID. His sudden death deeply affected me. Although my career was going well, this loss took a toll on me emotionally, mentally, and physically. I ended up in the emergency room three times that year due to sudden spikes in my heart rate and blood pressure.
I didn’t know if my health issues were temporary or permanent; and due to brain fog, it started taking more time to do the same work which I used to do very quickly earlier. While there was no threat to my job, I was worried about whether I could keep my current job or any future job. So, I began exploring ways to generate passive income to ensure a steady cash flow in case I couldn’t work.
Thankfully, all my health issues were temporary and got sorted with time.
I had decent savings, and I knew that fixed-return assets like FDs, NSCs, and KVPs were safe, but I also understood that these wouldn’t beat inflation. So, I started exploring market-linked assets like stocks (both delivery and F&O), commodities, real estate, and cryptocurrencies. My goal was to manage risk while achieving returns that outpace inflation and generate steady passive income.
The key difference between investing and tradevesting is the (nearly) regular passive income. Investing creates wealth over long time but not a regular cashflow.
I was wary of investing in real estate because I inherited some ancestral property that was difficult to manage. Somehow, I was not comfortable about trying my hand in commodities as well. So, I allocated some of my savings to F&O, crypto, mutual funds (MFs), index funds (IFs), and my equity portfolio. After a couple of months, I realized that F&O and crypto were not for me.
After a few months, I stopped investing in mutual funds because I realized that 70–80% of them couldn’t beat the returns of index funds. Finding the few that could was difficult, and I found it easier to pick good stocks for my portfolio. I also decided to focus on my portfolio instead of index funds, believing I could become a better investor over time and tailor my investments to my needs.
For my portfolio, I began as a value investor, searching for strong businesses available below fair prices. However, during a sideways market, I noticed some stocks showing patterns of range movement. I decided to split my allocation: half for long-term investments and half for trying my hand at trading in the same stocks.
My theory was that if I succeeded in trading patterns, I could make money. And even if I failed, I’d still be invested in solid businesses for the long term. So, this approach evolved into Tradevesting, where I would initially select businesses with an investor’s mindset and then engage in trading them like a trader.
I believe that, to make tradevesting — or anything in life — peaceful, focus on the process rather than the outcome. Develop a method with the desired outcome in mind, then once the method is finalized, shift your attention solely to following the method. This methodical approach can help maintain peace of mind even in stressful situations.
During this period of 3 years, I read more than 30 books on stock market, human psychology and philosophy.
Python (or any programming language you are comfortable with) can contribute to peaceful tradevesting by providing a methodical approach from macroeconomic analysis to technical analysis. It helps quantify metrics and automate tasks, making the process more efficient. While not every metric can be quantified or every step automated, Python allows us to streamline as much as possible, making tradevesting smoother and less stressful.
Current market price of a stock is influenced by both its fundamentals and speculation, with speculation having a greater impact in the short term. Over longer periods, however, the price tends to align more closely with fundamentals.
Soft skills such as discipline in following your trading strategy, conviction in your investment opportunities, and patience to wait for favorable outcomes are often more important than the hard skills we’ve discussed so far.
Its important to control behaviors like greed, fear, and regret. Avoiding leverage and stop-loss can also help manage risk and keep your investments stable.
Price is what you pay, but value is what you get.
It’s important to understand two key concepts: intrinsic (fair) value and margin of safety. Intrinsic value is based on a stock’s fundamentals and future potential, without the influence of speculation. Margin of safety further helps you to take care of any uncertainty in your trades. If you buy a stock when it’s undervalued and sell when it’s overvalued, you’re most likely to make a profit.
Tradevesting methodology consists of these analysis: macroeconomics, industry analysis, business analysis, fundamental analysis, valuation analysis, technical analysis.
Macroeconomics looks at the big picture of an entire economy. It examines things like the overall production of goods and services, the total amount of money in circulation, the levels of employment and unemployment, and the factors that influence the economy as a whole, such as government policies and international trade.
Industry analysis involves examining factors such as market demand, competition, regulatory environment, technological advancements, and other macroeconomic trends that can impact the businesses operating within that industry.
Industry analysis helps in anticipating sector rotation, which enables you to make money in stocks, even in bear or sideways market.
Business analysis involves includes examining various aspects of the company’s operations, such as its business model, market share, competitive position, management team, and overall business strategy.
Neither every metric can be quantified, nor every step can be automated in Tradevesting methodology, i.e. business moat (brand value) can’t be quantified, and business analysis can’t be automated.
Fundamental analysis means examining things like the company’s financial health such as revenue, profitability, earnings and growth potential.
Valuation analysis is to determine if the stock is overvalued (priced too high) or undervalued (priced too low) compared to its intrinsic (fair) value.
If you buy a stock when it’s undervalued and sell when it’s overvalued, you’re most likely to make a profit.
Technical analysis is a method of evaluating buying and selling levels of a stock by looking at its price movements and trading patterns on charts and examining things like past prices, trading volume, and other statistical trends.
I have shared my GitHub repository at the end of this article, which contains more than a dozen of python notebooks covering most of the tasks mentioned here.
The case study we discuss here is of 5PAISA, which is a midcap firm listed in NSE/BSE. I analysed that stock market started recovering in Apr ’23 and based on previous patterns, AMCs are among the first to recover with market.
Sales and Profits of this business were at all time high and the valuation of the stock was below fair value. I have a hypothesis that if a business has strong fundamentals and it is posting all time high sales and profits, its stock price is bound to touch its all time high (ATH) sooner or later.
I could also see recovery in its share price in terms of technical reversal, I bought this stock in Jun ’23 @ 373 to sell it once it touches its ATH. And I sold it once it crossed its ATH in Jan ’24 @ 644, making around 73% profits.
I keep doing similar analysis and trades with other listed businesses. There are businesses where I am currently in loss, but I have conviction based on the above methodology that those will bounce back.
Even if you are invested in decent and robust businesses, stock market has two kinds of uncertainties: volatility and holding period.
Volatility means how much a stock price can fluctuate, holding period means how long you may need to hold the stock.
To get started, you need to open a Dmat account with any decent brokerage firm. Then you can start finding robust businesses, study their fundamentals, assess their valuations, study their technicals and buy if all above looks good. You should be knowing your exit levels during your entry, and you need to execute it based on your strategy.
You can control your risk by diversifying your funds across stocks and industries, not going beyond 5% in any single opportunity.
Before concluding the session, I would like to emphasize on few basic things that you need to keep in mind as a tradevestor:
- Don’t tradevest on tips, build your own conviction.
- Don’t tradevest on the leveraged funds.
- Don’t tradevest the funds you are going to need in next 3 years.
- Don’t go beyond more than 4–5% of your total portfolio in a single opportunity.
- There is no need to put a stop-loss in tradevesting, rather put a stop-loss in your stock selection.
- Always follow the process: study industry, analyse business, get the fundamentals, assess valuations and then study technicals before getting into any opportunity.
- Always have an exit level planned while entering a trade.
Lets revisit what you have learnt in this session:
- What is Tradevesting?
- How can you remain Peaceful in stock market?
- How can you leverage Python (or any other programming language) for peaceful tradevesting?
Please note again: The content (including my journey, approach, illustrations and examples) I shared here is for education and learning purpose only. There is no suggestion or recommendation of any kind, please do your own research before investing/trading.
You can access my GitHub repository on Tradevesting here, which consists of more than a dozen python notebooks.
GitHub Repo: https://github.com/ankit-rathi/Tradevesting
Twitter Bio: https://twitter.com/rathiankit
If you loved this story, please feel free to check my other articles on this topic here: https://ankit-rathi.github.io/tradevesting/
Ankit Rathi is a data techie and weekend tradevestor. His interest lies primarily in building end-to-end data applications/products and making money in stock market using Tradevesting methodology.
If you have any questions or comments, click the "Go To Discussion" button below!