Created
October 15, 2022 22:30
-
-
Save natyrix/d2e732c3cabd5d1e8ee3d6de2c83e15b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def return_backtest_result(self): | |
if self.is_experiment: | |
mlflow.log_param("stock", self.stock) | |
mlflow.log_param("init_cash", self.init_cash) | |
for k,v in self.pf.stats().to_dict().items(): | |
mlflow.log_param(str(k).replace('%','').replace('[','').replace(']',''),str(v)) | |
with open('./backtest_result/vectorbt/fast_and_slow_plot.txt','w') as f: | |
for key, value in self.pf.stats().to_dict().items(): | |
f.write('%s: %s\n' % (key, value)) | |
# f.write(self.pf.stats().to_dict()) | |
return self.pf.stats().to_dict() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment