Overall Statistics
Total Trades
8
Average Win
0%
Average Loss
-0.60%
Compounding Annual Return
-99.985%
Drawdown
4.300%
Expectancy
-1
Net Profit
-2.376%
Sharpe Ratio
-11.225
Probabilistic Sharpe Ratio
0%
Loss Rate
100%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-5.987
Beta
-2.041
Annual Standard Deviation
0.267
Annual Variance
0.071
Information Ratio
-3.843
Tracking Error
0.397
Treynor Ratio
1.466
Total Fees
$13.77
class BuySellDailyAlpha(AlphaModel):
    

    def Update(self, algo, data):

        try:
            insights = []
            if algo.Time.hour == 9 and algo.Time.minute == 31:
                for symbol in algo.Securities.Keys:
                    if symbol.Value == 'UGAZ':
                        insight = Insight.Price(symbol, timedelta(minutes=385), InsightDirection.Up)
                        insights.append(insight)
                        
            # Send insight later in the day.  If UGAZ was liquidated by risk management
            # this will cause the framework to enter a new position on UGAZ based
            # on the original insight
            if algo.Time.hour == 12 and algo.Time.minute == 0:
                for symbol in algo.Securities.Keys:
                    if symbol.Value == 'DGAZ':
                        insight = Insight.Price(symbol, timedelta(minutes=235), InsightDirection.Up)
                        insights.append(insight)
                    
            return insights
        except Exception as e:
            self.algo.Debug("Unexpected error:" + str(e))
            raise
from BuySellDailyAlpha import *
from Execution.ImmediateExecutionModel import ImmediateExecutionModel
from Portfolio.EqualWeightingPortfolioConstructionModel import EqualWeightingPortfolioConstructionModel
from Risk.MaximumDrawdownPercentPerSecurity import MaximumDrawdownPercentPerSecurity

class CalibratedQuantumProcessor(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2015,5,5)
        self.SetEndDate(2015,5,5)
        self.SetBrokerageModel(BrokerageName.AlphaStreams)
        self.UniverseSettings.Resolution = Resolution.Minute
        self.SetBenchmark('SPY')
        self.SetCash(1000000)
        symbols = ['UGAZ','DGAZ']
        universe = [Symbol.Create(symbol, SecurityType.Equity, "usa") for symbol in symbols]
        self.SetUniverseSelection(ManualUniverseSelectionModel(universe))
        self.AddAlpha(BuySellDailyAlpha(self))

        self.SetExecution(ImmediateExecutionModel())

        self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel())

        self.SetRiskManagement(MaximumDrawdownPercentPerSecurity(0.01))


    def OnData(self, data):
        '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
            Arguments:
                data: Slice object keyed by symbol containing the stock data
        '''

        # if not self.Portfolio.Invested:
        #    self.SetHoldings("SPY", 1)