I'm using PyCharm to execute a PowerShell command that send the project to the cloud for backtesting:
import subprocess
subprocess.call('C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe \
lean cloud backtest derp --push --open\
', shell=True)
The goal is to get custom information from the backtest to be captured in PyCharm for automated further analysis. The only data that seems to be outputted from the test seems to be the runtime statistics, so I tried to set up a custom runtime statistic. However, this never shows up in the output of Pycharm, only the standard built-in statistics:
[1/1] Pushing 'derp'
Started compiling project 'Derp'
Detected parameters: none
Build Request Successful for Project ID: 8003394, with CompileID:
a62383a26c203448dc4857e7bc01e3ed-35555061efab1e70b4a599ff8e70d8a2, Lean
Version: 2.5.0.0.11461
Successfully compiled project 'Derp'
Started backtest named 'Formal Fluorescent Pink Dogfish' for project 'Derp'
Backtest url: https://www.quantconnect.com/terminal/#open/8003394/dc9a7c42a2fbb
f14b9cc3506942cd741
┌────────────────────────┬──────────────┬────────────────────────┬────────────┐
│ Statistic │ Value │ Statistic │ Value │
├────────────────────────┼──────────────┼────────────────────────┼────────────┤
│ Probabilistic Sharpe │ 88.788% │ Unrealized │ $2,230.71 │
│ Ratio │ │ │ │
│ Fees │ -$1.00 │ Net Profit │ $0.00 │
│ Return │ 22.32 % │ Equity │ $12,231.58 │
│ Holdings │ $12,085.46 │ Volume │ $9,852.88 │
│ Capacity │ $58M │ │ │
├────────────────────────┼──────────────┼────────────────────────┼────────────┤
│ Total Trades │ 1 │ Average Win │ 0% │
│ Average Loss │ 0% │ Compounding Annual │ 50.224% │
│ │ │ Return │ │
│ Drawdown │ 5.400% │ Expectancy │ 0 │
│ Net Profit │ 22.316% │ Sharpe Ratio │ 3.501 │
│ Probabilistic Sharpe │ 88.788% │ Loss Rate │ 0% │
│ Ratio │ │ │ │
│ Win Rate │ 0% │ Profit-Loss Ratio │ 0 │
│ Alpha │ 0.037 │ Beta │ 0.969 │
│ Annual Standard │ 0.149 │ Annual Variance │ 0.022 │
│ Deviation │ │ │ │
│ Information Ratio │ 1.487 │ Tracking Error │ 0.014 │
│ Treynor Ratio │ 0.539 │ Total Fees │ $1.00 │
│ Estimated Strategy │ $58000000.00 │ │ │
│ Capacity │ │ │ │
└────────────────────────┴──────────────┴────────────────────────┴────────────┘
Backtest id: dc9a7c42a2fbbf14b9cc3506942cd741
Backtest name: Formal Fluorescent Pink Dogfish
Backtest url: https://www.quantconnect.com/terminal/#open/8003394/dc9a7c42a2fbb
f14b9cc3506942cd741
Process finished with exit code 0
Interestingly, the custom runtime statistics show during the first backtest. However, if I close the backtest result and re-open it again, the custom runtime statistic disappears.
Does anyone have any suggestions? I just need a way for a desktop python script to be able to get a custom value from a backtest performed on the cloud.
Derek Melchin
Hi Zetulaj,
This is not currently possible. Custom runtime statistics are only available when live trading. Refer to our documentation here.
Best,
Derek Melchin
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Zetulaj
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!