| Overall Statistics |
|
Total Trades 1 Average Win 0% Average Loss 0% Compounding Annual Return -92.394% Drawdown 1.700% Expectancy 0 Net Profit -1.169% Sharpe Ratio -11.174 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0.007 Beta -214.535 Annual Standard Deviation 0.132 Annual Variance 0.017 Information Ratio -11.174 Tracking Error 0.132 Treynor Ratio 0.007 Total Fees $3.27 |
from System import *
from QuantConnect import *
from QuantConnect.Indicators import *
from QuantConnect.Algorithm import *
from collections import deque
from datetime import datetime, timedelta
from numpy import sum
class CustomIndicatorAlgorithm(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2013, 10, 7)
self.SetEndDate(2013, 10, 8)
self.AddEquity("SPY", Resolution.Minute)
self.sum_volume = DailyVolumeIndicator("DailyVolume")
self.RegisterIndicator("SPY", self.sum_volume, Resolution.Minute)
def OnData(self, data):
self.Debug(str(self.sum_volume.Value))
if not self.Portfolio.Invested:
self.SetHoldings("SPY", 1)
class DailyVolumeIndicator:
def __init__(self, name):
self.Name = name
self.date = datetime.min
self.Value = 0
self.IsReady = False
# Update method is mandatory
def Update(self, input):
if input.EndTime.date() != self.date:
self.volume = 0
self.date = input.EndTime.date()
else:
self.volume += input.Volume
self.Value = self.volume