Translating code from Quantiacs Legacy
-
Hi, I have a question that needs to be answered
For example, if I have a strategy from Quantiac Legacy as follows
So how do I transform the above strategy into a new strategy using a single backtest?
What I mean is, will I have to convert this strategy manually or will I have a tool to convert the code? (like converting a doc file into pdf,...). We hope to have your questions answered. Thank you. -
@illustrious-felice You will have to do this manually. But if I were you, I would take this example of transformation for a conversation with ChatGPT, then I would ask ChatGPT to convert the code of the old strategy into the new one by analogy.
-
@vyacheslav_b Ohhh I see. Thank you so much. I will use ChatGPT to convert faster.
-
@vyacheslav_b I would like to ask, is there any way for me to remove the correlation check in the backtest? Because this takes a long time (for backtest_ml). Thank you very much
-
@illustrious-felice Hello. There are several ways to do this.
The simplest one is to specify the parameter
analyze = False
and add the code in the following cell:
import qnt.data as qndata import qnt.stats as qns import qnt.graph as qngraph data = qndata.stocks.load_ndx_data(min_date="2006-01-01") stats = qns.calc_stat(data, weights.sel(time=slice("2006-01-01", None))) display(stats.to_pandas().tail()) performance = stats.to_pandas()["equity"] qngraph.make_plot_filled(performance.index, performance, name="PnL (Equity)", type="log")
Another way is to modify the source code of the library /qnt/backtester.py by commenting out the line with the correlation check, then save the changes, and then restart the kernel.
-
@vyacheslav_b Thank you so much