Connect with us

Trading Advertisement

FinTech Geek Ivan Fok Founded PyInvesting To Help Investors Adopt A Date Driven Approach Towards Investing & Trading #MyFirstLoss

First, he helped a hedge fund build a trading system that uses (the right) data to invest and trade. Now, he is doing it for retail investors and traders.

This article was written in collaboration with IG, the world’s No.1 CFD provider (by revenue excluding FX, June 2020). All views expressed in this article are the independent opinion of based on our research. is not liable for any financial losses that may arise from any transactions and readers are encouraged to do their own due diligence. You can view our full editorial policy here.

In the internet age we live in today, we no longer suffer from a lack of information. In fact, our main problem is having to process tons of information to make better decisions.

This can range from choosing which restaurants to have dinner at, which countries we wish to travel to for our next holiday or whether we should upgrade to the newest smartphone model. It also applies to the investment and trading decisions that we make in the financial markets.

One individual who understands how important (the right) data is to make better investment and trading decisions is Ivan Fok. Previously a software developer at a hedge fund where he was responsible for building the fund’s trading system, Ivan started PyInvesting, a website that allows investors and traders to backtest their investment strategies using historical data.

Backtesting refers to investors or traders simulating their strategies using historical data to observe its performance. If an investor or trader is satisfied, they can run their strategies in real-time.

To be clear, PyInvesting doesn’t tell you what strategies to use. The idea here is that every investor or trader may have their preferred strategies to generate returns from the financial markets. What does is to help backtest the strategies and to analyse their performance. While most funds will need to hire a team of quants (folks like Ivan) to do this for them, does this for you at a low monthly subscription fee.

In this edition of #MyFirstLoss, we chat with Ivan about how he got started using quantitative analysis for his investments and why he decided to start to help other investors and traders leverage on financial data.

Timothy: We always like to start this column with the same question. Do you remember the first time you make a loss in your trades?

Ivan: One of my first trades where I lost money was trading the S&P 500 ETF (SPY). I was using a simple 200-day moving average strategy where I would buy the ETF when its price is above its moving average and sell the ETF when its price fell below its moving average.

A few days after I bought the ETF, the price crossed below the moving average and I had to sell the ETF for a loss. To make matters worse, the price rebounded shortly after and I had to buy the ETF at a higher price as it crossed above the moving average. Even though the loss I made on this trade was a result of following my trading rules, it was painful to see my account taking a 5% hit as a new trader.

However, looking back today, I understand that losses are unavoidable when it comes to trading. The key is to have a strategy that has an edge that can be discovered with back-testing based on simulated results. Even though losses might be incurred in the short term, by being disciplined and following a trading strategy, we can allow our edge in the market to play out over many trades and improve our odds of success in the long run.

Timothy: Today, you are a quant who uses data to guide your investment decisions. Was this always the case?

Ivan: I have always used a data-driven approach to trade right from the start of my trading journey.

This was largely shaped by my work experiences in the asset management industry. The quant funds I worked at created backtests on thousands of different investment strategies based off learnings from the data to find the most profitable strategy to deploy in the market.

I like this approach because it is logical and evidence-based. There is no room for psychological implications when it comes to buying or selling a stock from my portfolio. The model has its own opinions and I simply follow them because the model has seen profits when simulated over the past 15 years.

Another benefit of this approach is the convenience of the use of technology. My computer can analyse hundreds of stocks in a couple of seconds and tell me which are the best stocks that I should include in my portfolio. Unlike a typical analyst who needs to spend hours a day doing research, I spend at most 5 minutes a week looking at my model results and keying in the orders on my account.

Timothy: If you don’t mind sharing, what is your investment approach today?

Ivan: I only invest in plain vanilla stocks. From a universe of a few hundred stocks, my website will screen for stocks that are in an uptrend. These stocks have recently made a new high and tend to have strong momentum going forward.

Next, the website will rank the stocks based on fundamental data. The fundamental factors I use are price to earnings ratio (PE Ratio), return on equity (ROE) and profit growth. These factors are combined to form my overall signal used to rank the stocks.

The top 30 stocks with the strongest signals are selected to form an equally weighted portfolio. I hold 30 stocks, each with a 3.3% weight in my portfolio to reduce my portfolio’s concentration risk. This prevents my portfolio from taking a hit even if one of my stocks crashes due to a poor earnings report.

The key here is that I am not betting on any single stock to carry my entire portfolio. Rather, I am betting on a concept that, on average, a group of stocks with high momentum, low price to earnings ratio, high return on equity and high profit growth, can outperform the market.

Finally, the website uses an active risk management system to adjust my portfolio’s cash allocation based on market sentiment using the PyInvesting fear and greed index. This risk management system will sell stocks and raise cash when markets become fearful and buy stocks when markets start to get greedy. This has the effect of protecting my portfolio from large drawdowns during a crisis such as the recent COVID-19 sell-off in March. While the S&P 500 was down over 30%, my portfolio lost around 15% as the model raised cash aggressively to protect the portfolio. Subsequently, as markets rebounded, the model started buying stocks and reducing cash to participate in the recovery.

This entire process is fully automated by my website, which runs every day on its own after pulling in fresh prices and fundamental data from my data provider. At the end of the calculations, the website sends me an email to tell me the model’s recommended trades.

Here is a detailed version of how I invest my money.

Timothy: Having worked in a hedge fund before. What are some similarities or differences between how a fund approaches investing, and how retail investors approach it? 

Ivan: There are similarities in the type of data that retail investors and funds look at. We have retail investors who do technical analysis, trying to figure out patterns from looking at charts. There are also retail investors who look at financial statements and read company reports to decide whether they are going to trade a stock. Quant funds are also interested in this data. The key difference is how the data is being analysed and used to construct a portfolio.

Quant funds leverage on technology to pull the data and to analyse thousands of stocks and financial instruments. They use models to construct signals from the data and determine the position size of each instrument. This allows the funds to identify a lot more investment opportunities as compared to retail investors. As a result, their portfolios tend to have a much larger number of positions (each with a statistical edge and positive expected return) as compared to retail investors. By having many uncorrelated bets, these funds tend to have much higher risk-adjusted returns than retail investors.

Timothy: What were the reasons you decided to start How can investors use it to help them become better investors?

Ivan: I created PyInvesting to manage my portfolio using a data-driven approach to investing.

Firstly, I wanted my investment strategy to have high expected returns of 30% a year. This is because as a young working adult, I can afford to take on risk in exchange for high returns. To achieve this objective, I needed a way to identify winning stocks with strong momentum and great fundamentals.

I also wanted my investment strategy to be easy to implement and fully automated. I value my time and did not want to spend hours reading financial reports and researching companies. Instead, I wanted to leverage the use of technology to help me analyse hundreds of stocks and find the winning stocks which I can include in my portfolio.

As a solution, I developed PyInvesting – A backtesting software for me to simulate and go live with my investment strategies.

This app allowed me to backtest my investment/trading strategies using historical data without having to risk any money in the market. I was able to test hundreds of different strategies relying on both technical and fundamental analysis where I could choose the best strategy that I was most satisfied with.

Once I was happy with the backtest results, I would go live with the investment strategy where the website will run the backtest daily with fresh data and send me an email with the simulated orders. This has saved me a lot of time as I only spend 5 minutes a week keying in the orders.

Most importantly, investors can benefit from using a data-driven approach to investing because it is highly profitable. As of today, on 27th of December 2020, my portfolio is up 61.8% for the year while the S&P 500 is up 14.6%. In terms of risk, my portfolio had a drawdown of 15.2% while the S&P 500 lost over 30% during the sell-off in March due to Covid-19.

The data-driven approach to investing has been successful for me, allowing me to achieve 4X the returns of the benchmark with half the amount of risk. While I do not think I will continue making 60% every year, I expect to make 30% returns per year on average in the long run based on my simulation results.

I hope will also help investors or traders around adopt a data-driven approach to investing or trading and support them in their journey towards financial freedom.

Timothy: Even though investors can use their own preferred investment strategies on, I understand that you also share some quantitative investment strategies as well. What are the main differences between the asset allocation strategies and the trend following strategies?

Ivan: Asset allocation strategies involve allocating a fixed percentage of your portfolio to different asset classes such as stocks, bonds, REITs and commodities. You can gain exposure to these asset classes by investing in ETFs. The idea here is that when the weights of each asset class drift from the target allocation, the investor will rebalance the portfolio back to the target weights. These strategies tend to appeal to passive investors because they require low maintenance and are easy to implement.

Trend following strategies usually involve selecting stocks or instruments that have strong momentum. Unlike an asset allocation strategy that allocates a fixed percentage to each asset class, trend following strategies will increase allocation to stocks that have strong momentum and reduce allocation to stocks that are no longer trending upwards. These strategies appeal to more active and technical investors who are passionate about investing and stock picking.

Timothy: How much does it cost for individuals to subscribe to your products? What do they get in return?

Ivan: It costs $15 USD per month to subscribe to PyInvesting. We offer a 1-month free trial where users can cancel anytime. As a subscriber, you will be able to go live with your investment strategy where the website will run your strategy daily and send you live email updates so you can profit from your strategy.

Use A Data-Driven Approach To Help You With Your Trading Decisions

From our interview with Ivan, it’s easy to see how data can be used to backtest and make trading-related decisions. Whether it’s to help us with technical or fundamental analysis, leveraging on data can help us make better trades, and to potentially earn a higher return than what the market can typically deliver to us.

These days, getting access to information is the easy part. Being able to analyse the vast volume of data that we have is what’s difficult. This is where platforms like can help us make sense of the information we have and let us know the stocks that we can trade based on the criteria we set. This way, we are less likely to be swayed by market noise and won’t make decisions based on our emotions.

If you want to find out more about how to control your emotions while trading, the IG Academy has an online trading psychology course that you can participate in.

Similarly, if we want to trade in other instruments such as Forex, indices, commodities or even cryptocurrency, we can adopt a data-driven approach towards making our trades. A trading platform such as IG allows us to use algorithmic trading that utilises financial information to automatically execute trades that meet the parameters that we have set. This way, we remove any possible emotions from the trades we make that can cause us to make mistakes or deviate from our original strategy.AdvertisementAdvertisementAdvertisementAdvertisementAdvertisementAdvertisement

Like Ivan, we can (and should) backtest and refine our algorithms against historical data. If you want to find out more about how you can trade using trend trading strategies that are based on historical data, you can an IG e-book that is written in partnership with Bloomberg – Getting technical: a guide to trend trading.Advertisement

If you are looking for a trading platform that can help you execute the trades you wish to make, you can do so through IG. It may be worthwhile to open a demo account that lets you try with S$200,000 virtual credit first with IG to try out our trading strategy first, before putting in actual money. Advertisement

Read Also: Algorithmic Trading: What You Need To Know Before Starting



IG provides an execution-only service. The information in this article is for informational and educational purposes only and does not constitute (and should not be construed as containing) any form of financial or investment advice or an investment recommendation or an offer of or solicitation to invest or transact in any financial instrument. Nor does the information take into account the investment objective, financial situation, or particular need of any person.  Where in doubt, you should seek advice from an independent financial adviser regarding the suitability of your investment, under a separate arrangement, as you deem fit.

No responsibility is accepted by IG for any loss or damage arising in any way (including due to negligence) from anyone acting or refraining from acting as a result of the information. All forms of investment carry risks. Trading in leveraged products, such as CFDs, carries risks and may not be suitable for everyone. Losses can exceed deposits.

This advertisement has not been reviewed by the Monetary Authority of Singapore.