Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
0
Tracking Error
0
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
from AlgorithmImports import *

import pickle
import base64

class SleepyVioletAlbatross(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2021, 5, 17)
        self.SetEndDate(2021, 5, 17)
        self.UniverseSettings.Resolution = Resolution.Hour

        #read in the model per these instructions: https://www.quantconnect.com/docs/v2/writing-algorithms/importing-data/bulk-downloads#04-Transport-Binary-Data
        base64_str = self.Download("https://www.dropbox.com/s/9wn4rgb3w50ge3h/xgboost_13features_grpcd-5_mar-oct20222_apr2021_2.base64?dl=1") #this is my actual model
        base64_bytes = base64_str.encode('ascii')
        model = base64.b64decode(base64_bytes)
        self.calibrated = pickle.loads(model)

        #load arbitrary data
        #running this code works on my model locally
        df = pd.DataFrame()
        df['RR.10'] = [1.2]
        df['GRP_CD_scaled'] = [1.0]
        df['RVOL_CD_scaled'] = [.5]
        df['CD_RVOL_x_GRP'] = [.50]
        df['GRP_day'] = [.50]
        df['PercChangeEMA5'] = [10]
        df['PercChangeEMA20'] = [20]
        df['PercChangeEMA50'] = [20]
        df['PercChangeEMA200'] = [20]
        df['PercFromPriceEMA5'] = [15]
        df['PercFromPriceEMA20'] = [5]
        df['PercFromPriceEMA50'] = [5]
        df['PercFromPriceEMA200'] = [5]

        self.Debug(df) #just seeing the df looks correct
            
        ###############################################
        # Errors start from the commented lines below #
        ###############################################

        #calibrated_proba = self.calibrated.predict_proba(df) 
            #the above line gives an error: "object of type 'NoneType' has no len()"
            #it should return "array([[0.46464646, 0.53535354]])"

        #self.Debug(self.calibrated)
            #just seeing if the model can be printed out -- this doesn't work either, giving an error: "'CalibratedClassifierCV' object has no attribute 'ensemble'"
            #but it's correctly calling it a CalibratedClassifierCV

    def OnData(self, data: Slice):
        return