| Overall Statistics |
|
Total Trades 16 Average Win 0.06% Average Loss -0.02% Compounding Annual Return 0.221% Drawdown 0.100% Expectancy 1.180 Net Profit 0.221% Sharpe Ratio 1.008 Probabilistic Sharpe Ratio 50.513% Loss Rate 38% Win Rate 62% Profit-Loss Ratio 2.49 Alpha 0.001 Beta 0.005 Annual Standard Deviation 0.002 Annual Variance 0 Information Ratio -2.61 Tracking Error 0.056 Treynor Ratio 0.33 Total Fees $34.40 Estimated Strategy Capacity $300000000.00 Lowest Capacity Asset ES WSVU0MELFS3L |
from AlgorithmImports import *
import datetime
class ThisIsATest(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2017, 1, 1)
self.SetEndDate(2018, 1, 1)
self.SetCash(500000)
self._continuousContract = self.AddFuture(Futures.Indices.SP500EMini,
resolution=Resolution.Minute)
# self._continuousContract.SetFilter(0, 182)
self._continuousContract.SetFilter(lambda future_filter_universe: future_filter_universe.FrontMonth())
def OnData(self, data):
time_long = datetime.time(23, 30) <= self.Time.time() or self.Time.time() < datetime.time(0, 30)
if not self.Portfolio.Invested and time_long:
self.Debug(f"Buy now: {self.Time.time()}")
self.MarketOrder(self._continuousContract.Mapped, 1)
elif self.Portfolio.Invested and not time_long:
self.Debug(f"Liquidate now: {self.Time.time()}")
self.Liquidate()