Overall Statistics |
Total Trades 2 Average Win 0% Average Loss 0% Compounding Annual Return 15.913% Drawdown 4.300% Expectancy 0 Net Profit 0% Sharpe Ratio 1.658 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha -0.061 Beta 1.202 Annual Standard Deviation 0.09 Annual Variance 0.008 Information Ratio -0.67 Tracking Error 0.039 Treynor Ratio 0.125 Total Fees $2.98 |
import math import numpy as np import pandas as pd import statistics from datetime import datetime, timedelta class BasicTemplateAlgorithm(QCAlgorithm): def Initialize(self): self.SetCash(100000) self.SetStartDate(2017, 1, 1) self.SetEndDate(2017, 9, 30) # Add securities and get the data self.equity = ["SPY","IWM"] for s in self.equity: self.AddEquity(s, Resolution.Minute) # Schedule trades self.Schedule.On(self.DateRules.On(2017, 1, 10), self.TimeRules.At(9, 31), Action(self.Rebalance)) self.Schedule.On(self.DateRules.On(2017, 2, 10), self.TimeRules.At(9, 31), Action(self.Rebalance)) def OnData(self, slice): pass def Rebalance(self): for s in self.equity: self.SetHoldings(s, 0.5)