One of the most important parts of Factor Investing is to know what factors could work and one of the most used ways is Factor Backtesting. In this session let’s use the API we created in the Last Session to see how we can do the single period factor backtesting.
We need to set up the expectations of the output to verify the test. So, what is the core idea here?
If a Factor (any data can be related to the stock) works, it will have predicting power, meaning the good portion of stocks based on the factor will perform…
Having raw data is NOT enough to work on Factor Investing efficiently and we need a utility tool (API), which understands the financial languages.
Financial Analytics Data API is essential before we start working on the actual analysis.
Some people call it API and some people call it SDK, no matter what, at the end of the day, it is just a set of functions that we can use to request the data using financial language.
Thinking in a financial way! NOT in a database way!
To catch up on the previous session:
In the last session (Factor Investing with…
If you are struggling to master Python or if you are wondering how to jump out of the beginner’s world, a single mindset change could help.
If you just started learning to program, especially outside the engineering world, it’s likely you started with Python these days.
It is an easy-to-learn language, but it may NOT be the best language to start with.
Type is one of the most important concepts in programming and probably the first thing you would need to understand.
But types are not obvious in Python, so that beginners are not trained to think with types.
Data comes first when we are talking about Finance and Python. However, I am not only talking about capturing the raw data but also the way to structure it and ideally creating a financial analytics API around the data.
Financial Analytics Data API (not raw data) should help us do research quicker and manage the process more consistantly.
This is such an important and fundamental piece of the modern asset management stack. This is the reason why big asset managers are spending millions on such Data APIs.
First of all, we need raw data and it should be point-in-time data…
If learning Python is one of your new year resolutions, please read.
Python definitely has been expanding in the Financial Industry in recent years. I am getting to know more and more people, who are not computer engineers, started learning Python, either to advance the career or being asked to do by the companies. One of the most common questions I have got is:
How can I really learn Python?
What they mean is that after finishing the Python tutorials, videos or books, they still find it difficult to apply Python to their day-to-day works.
One of the reasons why…
A new series of Python in Finance with a practical example. Let’s learn something about how professional money managers are handling the portfolios and where Python can be used.
With the limited amount of good quality data available for less cost, the most common articles on Medium are talking about using ML/AI to predict the returns with only the pricing data, which are less likely to generate long term stable returns, because we are missing the other important information.
In real life, professional money managers won’t do so. They have a very comprehensive method to make decisions on what asset…
Coding is the simplest part of the trading and the backtesting is only a start. Behind all the successes it is how we use it makes the difference. In this session, I would like to show how possibly we could use the backtesting.
In the last four sessions, we have built the trading backtesting tools (functions), which gives the top trading strategies for a given period. If you haven’t read the previous sessions, here is the link.
There will never be a single strategy working all the time. Market condition changes and human behaviour changes. …
There are many technical indicators we can trade with. The question is what is the best one for a given asset? We are going to answer this question by improving our backtesting from the last session.
In the last session, we have seen how to find the best combination of stop loss level and parameter with the strategy Keltner Channel. In this session, we will explore and adding other strategies into our backtesting.
If you haven’t read the previous sessions, here are the links.
Let’s have a quick review of our logic so far.
Find the best combination of stop loss level and parameter of Keltner Channel by turning the previous Python scripts into re-usable functions.
In our last session, we added stop loss into our trading simulation and we have done one more risk measure, Maximum Drawdown. We found the 2% stop loss lowered our performance but the maximum drawdown is not reduced dramatically.
If you haven’t read the previous two sessions, here are the links.
Will there be a good stop…
Python: Backtesting of Trading Strategy with Technical Indicator #2
In our last session, we used simple code and done the backtesting for a simple strategy using the Keltner Channel. We found that if we do the long-short trading with this signal, we could have earned more than 40% return in the year 2019 by trading ISF.L (UK FTSE 100 Index ETF), which only gained 14% in the year. If you haven’t read it yet, here’s the link.
In short, for managing the risk. It’s all…