Preface
Before participating in the neutral group to obtain a very outstanding return factor, and then used in the real market (before the real market also asked gpt the factor does not use the future function, also asked for guidance). But the actual disk for more than a month after the discovery of the back test picturesque real disk loss into a dog, and began to re-suspect accidentally introduced the future function, and then the actual disk data and back test data every calculation step are printed out a full 4 days to find out that the data will be typed out real disk data will be added because of the back of the new data every hour, so that the actual disk calculated results continue to change (obviously use the future of the data), and then after the Tireless efforts to research a quick way to determine whether the factor contains a future function.
- Quick judgment method
- still use our real trading framework code, config.py inside fill in the need to check the factor and 6 offset are open. 2. then put my following program into the same layer.
- and then put my following program into the same layer of the real market code, run - fast check the factor future function program.py
- analyze the program, this program is in order to run a different real program in order, different real program is only set up in order to set the time in order.
- Then there will be a txt log result that you name after the program has finished running, and the log will be set up inside the live program.
- Next to explain how to determine whether the future function, open the txt log will find that there are different time periods of the real market elected pairs of coins, the following picture is the use of the future function, as shown in the figure 07:00 elected offset5 pairs of coins and the next cycle of offset5 elected pairs of coins are different, because of the introduction of the next cycle of the data and thus the results of the calculations in the constant change. (Keep looking to find that basically every cycle and the previous cycle of the same offset pairs will change)
- After n-factor checking confirms that this method is absolutely valid judgment, the following picture is an example graph without future function, check down how many cycles can match the coin pair calculated by the same offset.
总结:
I’ve been struggling for a long time over factor future functions, so I hope this quick way to determine if a factor has a future function will help you bosses.
代码:
main.py:
1 | import time |
test_code_01.py
1 | import pandas as pd |