Overall Statistics
Total Trades
1
Average Win
0%
Average Loss
0%
Compounding Annual Return
73.028%
Drawdown
43.600%
Expectancy
0
Net Profit
31.598%
Sharpe Ratio
1.428
Probabilistic Sharpe Ratio
49.355%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
1.19
Beta
-0.499
Annual Standard Deviation
0.73
Annual Variance
0.533
Information Ratio
0.995
Tracking Error
0.751
Treynor Ratio
-2.089
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
CLXPF.CLXPF 2S
import decimal 

class ImportStock(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2021, 1, 1)
        # self.SetEndDate(2020, 1, 1)
        self.SetCash(1000000)
        self.SetWarmup(200)
        self.SetBenchmark("SPY")

        self.stock = self.AddData(CLXPF, "CLXPF", Resolution.Minute).Symbol
        self.SetSecurityInitializer(lambda x: x.SetMarketPrice(self.GetLastKnownPrice(x)))
        
        # schedule trade execution 30 minutes after the first trading day of each month
        self.Schedule.On(self.DateRules.MonthStart(self.stock), \
                        self.TimeRules.AfterMarketOpen(self.stock, 30), \
                        self.Rebalance)
                        
        
    def OnData(self, data):
        if self.IsWarmingUp:
            return
                

    def Rebalance(self):
        self.Log("Rebalance fired at : {0}".format(self.Time))
        self.SetHoldings(self.stock, (1))
        
        
class CLXPF(PythonData):
    # get data
    def GetSource(self, config, date, isLive):
        source = "https://www.dropbox.com/s/1u82fjrctjual8y/CLXPF_price_volume_daily.csv?dl=1"
        return SubscriptionDataSource(source, SubscriptionTransportMedium.RemoteFile)
    
    #input data into reader method line-by-line    
    def Reader(self, config, line, date, isLive):
        # If line is empty or first character is not digit, pass
        if not (line.strip() and line[0].isdigit()):
            return None
        
        #split line at commas    
        data = line.split(',')
        clxpf = CLXPF()
        clxpf.Symbol = config.Symbol
        clxpf.Time = datetime.strptime(data[0], '%m/%d/%y') + timedelta(hours=20) # Make sure we only get this data AFTER trading day - don't want forward bias.
        clxpf.Value = decimal.Decimal(data[5])
        clxpf.Volume = float(data[6])
        

        return clxpf