Overall Statistics
Total Trades
120
Average Win
2.94%
Average Loss
-2.80%
Compounding Annual Return
1.323%
Drawdown
28.000%
Expectancy
0.016
Net Profit
0.321%
Sharpe Ratio
0.442
Loss Rate
50%
Win Rate
50%
Profit-Loss Ratio
1.05
Alpha
5.332
Beta
-250.507
Annual Standard Deviation
0.837
Annual Variance
0.701
Information Ratio
0.418
Tracking Error
0.838
Treynor Ratio
-0.001
Total Fees
$730.26
from QuantConnect.Data.UniverseSelection import *
import math
import numpy as np
import pandas as pd
import scipy as sp
import decimal as d
# import statsmodels.api as sm

class abc(QCAlgorithm):

    def Initialize(self):

        self.SetStartDate(2007, 12, 31)
        self.SetEndDate(2008, 3, 30)
        
        self.SetCash(50000)
    
        
        self.equity = self.AddEquity("MOS", Resolution.Daily).Symbol 
        self.Schedule.On(self.DateRules.EveryDay("MOS"), self.TimeRules.At(9, 35), Action(self.buy))
        self.Schedule.On(self.DateRules.EveryDay("MOS"), self.TimeRules.At(16, 15), Action(self.sell))

    def buy(self):
            self.SetHoldings(self.equity, 1)
    
    def sell(self):
            self.SetHoldings(self.equity, -1)