Demystifying "Smart Fixed Investment"

 

Quantitative technology house team launched a series of quantitative investment courses in CSDN College

Students who are interested in systematically learning quantitative investment are welcome, click the link below to register:

Quantitative Investment Crash Camp (Introductory Course)

Python stock quantitative investment

Python Futures Quantitative Investment

Python digital currency quantitative investment

C++ Language CTP Futures Trading System Development

Digital currency JavaScript language quantitative trading system development


What is smart fixed investment

If you open the fund management interface of XXbao and choose a fixed investment of a certain fund target, there will often be two options when choosing a fixed investment method, one is ordinary fixed investment, and the other is smart fixed investment. Moreover, the rate of return of smart fixed investment is often higher than that of ordinary fixed investment. So, what is smart fixed investment, and how is it a smart method that makes the rate of return higher than ordinary fixed investment? We will use this article to unveil the veil of smart fixed investment.

Before introducing smart fixed investment, let's briefly review ordinary fixed investment. Ordinary fixed investment can be explained in one sentence, that is, to invest in funds or other desired investment targets on a regular basis with a fixed amount and at fixed intervals. Ordinary fixed investment has the following advantages: first, regular investment, which accumulates little to much; second, it does not need to choose the timing, avoiding buying low and selling high; third, average investment, diversifying risks; fourth, the effect of compound interest, long-term considerable.

Smart fixed investment is actually an improved method of ordinary fixed investment. Its core logic is to invest as much as possible in areas with low prices and undervalued bids, and invest less or less in areas with high prices and overestimated bids. Investment, so that its average cost is lower than ordinary fixed investment, and the rate of return is higher than ordinary fixed investment.

Therefore, the key point of intelligent fixed investment focuses on how to judge the price level. For this problem, Mobao also gave its own judgment method, which set a multi-day moving average of the reference index. When the price is lower than the moving average, And the farther away from the location, the larger the fixed investment amount, that is, buy more at low positions.

Conversely, when the price is higher than the moving average and the farther away from the position, the fixed investment amount is smaller, that is, buy less at high positions. This kind of logic of buying more at low positions and buying less at high positions makes the rate of return of smart fixed investment more than 3% higher than that of ordinary fixed investment.

 

Python implements intelligent fixed investment strategy

We refer to the smart fixed investment logic of a certain treasure and improve it. What we also realize is the big logic of buying more at low positions and buying less at high positions. And according to the historical fluctuation of the investment target, divide the target into 4 areas, namely: low price area, medium to low price area, medium to high price area, and high price area, and reduce the fixed investment amount of these 4 areas in turn , that is, the fixed investment amount in the low price area is the largest, and the fixed investment amount in the high price area is the smallest.

data preparation

In order to realize such a fixed investment strategy, we first need to prepare the historical data of the fixed bidding. Taking BTC as an example, we have prepared the daily K data of BTC from 2017 to the latest.

 

What needs to be explained here is that our fixed investment program supports historical backtesting of all financial targets . You only need to prepare the data format in the same field as the above BTC data sample, and then run the program to get the corresponding test results.

logic implementation

After reading the data, we judge day by day whether the latest price of the current date is located in the low price area, the medium-to-low price area, the medium-to-high price area, or the high price area, and according to the area where the price is located, set The size of the investment amount.

Firstly, adjust the proportion of fixed investment amount through two parameters adj_1 and adj_2, and the parameters can be modified as needed.

adj_1 = 0.4
adj_2 = 0.8

 Then, determine the size of the fixed investment amount by determining the position of the price fixed investment area. If the price is in the low price area, the fixed investment amount will be (1+adj_2) times the normal amount; if the price is in the middle-to-low price area, the fixed investment amount will be (1+adj_1) times the normal amount, and so on.

condition1 = XXX
df.loc[condition1, 'invest_val'] = base_invest_fun * (1 - adj_1)

condition2 = XXX
df.loc[condition2, 'invest_val'] = base_invest_fun * (1 - adj_2)

condition3 = XXX
df.loc[condition3, 'invest_val'] = base_invest_fun * (1 + adj_1)

condition4 = XXX
df.loc[condition4, 'invest_val'] = base_invest_fun * (1 + adj_2)

Results visualization

Through the fixed investment amount of each period, we can calculate the total investment amount, total investment market value, profit situation, profit ratio and other results, and present the key results in a visualized form. The backtest results are presented in the next section.

fig, ax1 = plt.subplots()
ax1.plot(df['date'], df['net_value'], 'r-', label='Market Value')
ax1.plot(df['date'], df['total_invest_val'], 'y-', label='My Total Cost')
ax1.set_xlabel("year")
ax1.set_title("BTC 定投")
plt.legend(loc='best')
plt.show()

full code

We will exclusively publish the complete code of the Python implementation of the smart fixed investment, including the supporting historical data used in the article, on Knowledge Planet.

Typical target intelligent fixed investment effect

After completing the logical construction of smart fixed investment and the implementation of the corresponding Python code, we selected some typical targets, including BTC, CSI 300 Index, S&P 500 Index, and gold, for testing.

These targets can be said to be typical representatives of fixed investment, because many investors will choose one of the above four targets to make fixed investment in a certain market. Let's take a look at the test results of these targets.

BTC

CSI 300 Index

 

S&P 500 Index

 

gold

 

In the above results, the My Total Cost label indicates the fixed investment cost, and the Market Value label indicates the latest market value held, and the difference between the two lines is the profit part. From the perspective of the stability of fixed investment results, the S&P 500 Index is undoubtedly the best, indicating that smart fixed investment strategies are most suitable for long-term moderate rises and occasional plunges.

However, whether it is BTC, stock index or gold, as long as the target is rising for a long time and the fixed investment time is long enough, it can generate good profits. Compared with ordinary fixed investment, smart fixed investment can generate more profits because of its logic of buying more at low positions and buying less at high positions.

     Past dry goods sharing recommended reading

Digital currency short-term strategy (data + backtest + real offer)

Guess you like

Origin blog.csdn.net/sljsz/article/details/126997483
Recommended