Overall Statistics
Total Trades
4
Average Win
0%
Average Loss
-9.75%
Compounding Annual Return
-9.895%
Drawdown
22.600%
Expectancy
-1
Net Profit
-18.780%
Sharpe Ratio
-0.8
Loss Rate
100%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
-0.018
Beta
-3.942
Annual Standard Deviation
0.121
Annual Variance
0.015
Information Ratio
-0.964
Tracking Error
0.121
Treynor Ratio
0.025
Total Fees
$105.97
import numpy as np

### <summary>
### Basic template algorithm simply initializes the date range and cash. This is a skeleton
### framework you can use for designing an algorithm.
### </summary>
class BasicTemplateAlgorithm(QCAlgorithm):
    '''Basic template algorithm simply initializes the date range and cash'''

    def Initialize(self):
  # Code Automatically Generated  
  
        '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''

        self.SetStartDate(2016, 1, 1)   #Set Start Date
        self.SetEndDate(2017, 12, 31)    #Set End Date
        self.SetCash(100000)           #Set Strategy Cash
        
        # Set Benchmark SPY
        # self.SetBenchmark("SPY")
        self.SetBenchmark("BAC")
        # Find more symbols here: http://quantconnect.com/data
        
        self.AddEquity("BAC")

        self.Schedule.On(self.DateRules.On(2016, 4, 20), self.TimeRules.AfterMarketOpen("BAC", 10), Action(self.buy))
        self.Schedule.On(self.DateRules.On(2016, 6, 28), self.TimeRules.AfterMarketOpen("BAC", 10), Action(self.sell))
        
        self.Schedule.On(self.DateRules.On(2017, 6, 30), self.TimeRules.AfterMarketOpen("BAC", 10), Action(self.buy))
        self.Schedule.On(self.DateRules.On(2017, 9, 8), self.TimeRules.AfterMarketOpen("BAC", 10), Action(self.sell))
        
    def OnData(self, data):
        
        pass
         
    def buy(self):
        # place buy order
        # "1" bedeutet mit vollem Vermögen
        # "100" bedeutet, gehebelt reingehen (kann Margin Call auslösen)
        self.SetHoldings("BAC", 1)
    def sell(self):
        # place sell order
        # "0" bedeutet, die Investition zurücknehmen. "-1" bedeutet short gehen.
        self.SetHoldings("BAC", 0)