【Application(12)】Money Management

The kelly formula analyzes the relationship between winning rate, odds, and betting ratio.

TEJ 台灣經濟新報
TEJ-API Financial Data Analysis
5 min readFeb 22, 2022

--

Photo by AbsolutVision on Unsplash

Highlights

  • Difficulty:★★☆☆☆
  • Reminder: We use PYTHON to implement the Kelly formula. If you are interested in the derivation of the Kelly formula, you can further watch the video introduced by Mr. Li Yongle.

Preface

We are strange and familiar with the winning rates, odds, and betting ratios. We often depend on our sentiment to multiply the winning percentage and odds in our hearts and determine the betting ratio of the investment. Therefore, it’s difficult to explain our subjective betting ratio to someone.

It is inevitable in investment that the winning rate and the odds have extremely high subjective judgments. Still, we can use the Kelly formula to determine the betting ratio after determining the winning rate and the odds. Under the condition that the principal will never return to zero and maximize long-term gains.

Next, we use the Kelly formula to determine the betting ratio and reinvest the 0050 ETF at the beginning of each month. Meanwhile, we compare investment groups with the same buy & hold principal.

Editing Environment and Modules Required

Windows OS and Jupyter Notebook

Database

Data Processing

We gather the 0050 ETF monthly return from the TEJ database.

Kelly’s formula

We base on the previous 12-month monthly rate of return. If the monthly rate of return is greater than 0, it is considered a success; otherwise, it fails. This way, we can obtain the winning rate and odds when investing in the 0050 ETF at the beginning of each month.

  • P: Winning rate is the fraction of games or matches a team or individual has won.
  • b: Odds ratio measures the association between an exposure and an outcome.
  • f: The ratio of invested capital to principal

We then use the Kelly formula to get the betting ratio and multiply the principal by the betting ratio, the current bet amount. If the numerator in Kelly’s formula is negative. It means the investment is not worth betting on, and we set the betting ratio for this period to 0.

Kelly formula

We systematically adjust betting ratios based on win rates and odds.

Conclusion

We observe the accumulation trend chart of principal from 2011 to 2015 compared the investment groups under Buy & Hold and Kelly’s formula. We find that the accumulated principal amount of the latter doesn’t win the former. The possible reason is the Kelly formula applies to all known possibilities or investments where possibilities can be estimated. The uncertain odds in the stock market make it difficult for Kelly’s formula to work. However, the thinking of Kelly’s formula is still worth learning. The betting ratio controls risk. Even with a high winning rate and high odds, do not All in to avoid permanent losses.

In the future, readers can try to study how to improve the winning rate and odds of the strategy to make the betting ratio more accurate. When we enlarge our position with the thinking of risk control, which will help us survive in the market a long time. Finally, readers are welcome to visit our official website, which provides more financial, trading, and other financial information to help readers make better stock selection strategies!

The content of this webpage is not an investment device. It does not constitute an offer or solicitation to offer or recommendation of any investment product. It is for learning purposes only and does not consider your individual needs, investment objectives, and specific financial circumstances. Investment involves risk. Past performance is not indicative of future performance. Readers are requested to use their independent thinking skills to make investment decisions independently. The author will not be involved if losses are incurred due to relevant suggestions.

Source Code

Extended Reading

Related Link

You could give us encouragement by …
We will share financial database applications every week.
If you think today’s article is good, you can click on the
applause icon once.
If you think it is awesome, you can hold the
applause icon until 50 times.
If you have any feedback, please feel free to leave a comment below.

--

--

TEJ 台灣經濟新報
TEJ-API Financial Data Analysis

TEJ 為台灣本土第一大財經資訊公司,成立於 1990 年,提供金融市場基本分析所需資訊,以及信用風險、法遵科技、資產評價、量化分析及 ESG 等解決方案及顧問服務。鑒於財務金融領域日趨多元與複雜,TEJ 結合實務與學術界的精英人才,致力於開發機器學習、人工智慧 AI 及自然語言處理 NLP 等新技術,持續提供創新服務