Check out what classmates have to say!
Skills You’ll Learn
“Minimum profit is for passive investors who don't like to worry and put safety first,
The best profit is excellent intellectual ability and skill in analyzing stock marketsIt can be said that it is up to investors who have it.”
- Benjamin Graham
All of you in the stock market
Are you making good profits?
After analyzing the accounts of individual investors over the past 11 years, it is said that 4 out of 10 individual investors have lost money. 6 out of 10 have made a profit, which is higher than expected, right? Are you in the 6 group?
However, the “Jurinyi” who entered the new market in 2020 6 out of 10 people lost even in a bullish marketIt is said that they saw. What's the difference between private investors who make a profit and those who lose money?
All stock investors have an annual rate of 15.7% or more
There is an obligation to achieve a rate of return.
Whatever it is, all investors who invest in stocks The obligation to achieve an annual yield of 15.7% or moreThere is.
“Yes, what are you saying? Isn't it great to make only 10% yearly profit?”
Have you ever had this question?
“What is the average yield of all stocks in Korea? What percentage of profit did you make on average after a few days of holding it?”
Do you know the answer to this question? How can we find answers? Right away, it can be obtained through Python quant analysis using stock data. So let's take a look at the average yield of all stocks.
Analysis using mean and median values
Wait, there are two things you need to know beforehand before you see results. Are you afraid of skipping a mathematical concept after a long time? It's a very intuitive concept that anyone can understand if they look at it a little bit, so read on for a moment.
The first dictionary expression is Average valueet median It's the concept of
- Average value: The “average” of several numbers, is obtained by adding all the numbers and dividing by the number of numbers.
- median: The middle value of several numbers. Sort all the data in order of size, and select the number in the middle of the sequence. (If the data in the center is two, then the average of the two numbers)
Here is an example of the average value and median value in a graph.
The mean and median values are important hints for understanding the distribution of the data. By comparing the average value and the median value, you can estimate which part of the data is excessively large or small.
median < mean
: part of the data is a very large value, the rest is usually a small value
median > average
: part of the data is a very small value, the rest is usually a large value
average value">
Through the relationship between the average value and the median value, this numerical statistic In particular, some data has large valuesDo you have or not, on the contrary In particular, some data is a small valueYou can estimate if you have one.
Looking at this is useful when looking at the yield of various stocks in a simulation. When the average yield of 20 stocks is 20%, it is possible to determine whether the yield of most stocks is really that good, or whether this average yield is derived because some stocks have skyrocketed.
Fourth quartile figures and boxplot (boxplot)
What is the second prior knowledge Fourth quartile figures and boxplot (boxplot) This is it.
- Fourth quartile (quartile): The data is arranged in order of size, the order is divided into four parts, and the numbers corresponding to that order for each quartile are called the fourth quartile figures.
The fourth quartile number, [3, 12, 21, 40, 72], which divides the order into four parts, is the fourth quartile number
The fourth quartile is also not a difficult concept, right? The numbers are listed in order, and the standard numbers that are divided into 4 parts are quartile numbersThe number corresponding to 50% is the median value. Like the median value, the fourth quartile values are appropriately averaged to obtain the fourth quartile figure if the number of numbers is not exactly divided.
- Boxplot (boxplot): This is a graph showing good statistics on the fourth quartile numbers as shown below.
The fourth quartile values are displayed as boxes and lines.
In the box plot, you can see that the fourth quartile figures obtained from the previous match [3, 12, 21, 40, 72] appear as boxes and lines, right? (The green triangle means 'average value'. Since the average value is greater than the median value, it is inferred that some data is largeYou can do it.)
In this way, the box plot draws the fourth quartile of the data in an easy-to-read manner, To be able to estimate the distribution of where the data is located It does it. Here, I drew a graph horizontally to aid understanding and make good use of the ground, but in the simulation results, I'll draw a box plot vertically.
Yield analysis over the past 10 years
Well, now that we've learned all the prior knowledge, let's take a look at the yield analysis of all stocks in Korea over the past 10 years? The figure below shows the results obtained after Python quant analysis using actual stock data from the past 10 years.
Average value of return by holding period, median value
Assuming that all stocks are invested in the same share for 1 year (Holds about 240 business days), and the average yield for the past 10 years 15.73% It was.
Without any effort to analyze, buy and sell stocks! Now you know why you should increase returns of 15.73% or more, right?
Exploring through quant analysis
Principles of the stock market
Other than simply these amazing returns, there are consistent results for every retention day. It is a phenomenon where the “average value” of yield is higher than the “median value” for all periods of time. This is It means that the yield of our stock market is a combination of the high yield of some stocks and the yield of the rest of the stocksI will.
On average, everyone who held for a few days showed + positive returns, which is the result of some stocks increasing significantly, driving the overall average yield. Here's one important lesson we can draw. “Stop loss” is essentialThat's it.
The stock market recorded an overall rise due to a significant rise in only a few stocks, so if we choose the wrong stock, rather than unconditionally wait for this stock to rise, It may be wise to leave in search of new bullish stocksThat's it. Even more so if the stocks we've picked are losing money, right?
In addition to this, some conclusions that can be found from the verification results are as follows.
- The average yield of profit transactions is higher than the median value. This indicates that some stocks will rise significantly.
- The average return on loss-making trades is lower than the median. This indicates that some stocks are falling significantly.
- Generally, the longer the holding period, the higher the average yield. However, the win rate (probability of profit: probability of recording a profit of 0% or more) is rather reduced.
- The difference between average value and median value of profit transactions is much greater than the difference between average value and median value of loss transactions. This indicates that the trend of large gains in profit trading being directed towards some stocks is much stronger.
How's it going? It's a very basic analysis and result in the field of quant investing, but it doesn't mean a lot, right? If you learn quant investment analysis with Python, you can not only do basic analysis of these basics, but also your Backtest ideas and investment strategies and thoroughly analyze resultsYou'll be able to do it.:)
With your own weapon called quant investing in a stock market like a battlefield, Achieve the highest profit through excellent intellectual ability and technologyTry it.
User program guide
- Creator AiSchool's PC is a MAC operating system, and this class is conducted using Google Colab.
- If you only need a Chrome browser and a Google account, you can practice conveniently regardless of computer specifications.
Curriculum
Creator
AISchool X Daniel Park
AiSchool (AiSchool)
I majored in artificial intelligence and computer vision at Seoul National University. Over the past 6 years, I have taught Python, artificial intelligence, and data analysis techniques to over 1000 non-majors/majors. We give lectures on artificial intelligence, Python, image recognition, and stock data analysis at large companies such as Infrastructure, Wanted, Fast Campus, Samsung, and Hyundai, and are providing AI consulting services for enterprises. Combining my past experience, I prepared a textbook course on the introduction to quant investing with an incumbent AI quant.
Daniel Park
I majored in image processing and deep learning at Yonsei University. I served as the president of the University Student Union Investment Association. It also won 3rd place in yield at the Dongbu Securities Investment Competition, and is currently implementing steady research and profit investment by establishing data-based systematic investment techniques. Taling, a talent sharing platform, gave introductory lectures on stocks for about 5 years, and produced a large number of students. I published “Stock Investment Tutoring Course”, which is an introduction to stock investment, and I am currently working as a Quant investment researcher at a domestic financial company.
AISchool