notadamking / RLTrader

A cryptocurrency trading environment using deep reinforcement learning and OpenAI's gym
https://discord.gg/ZZ7BGWh
GNU General Public License v3.0
1.73k stars 539 forks source link

'BaseRLModel' is not callable? #143

Open reasondk opened 4 years ago

reasondk commented 4 years ago

Hi, guys, 'RLTrade.py' this model display "'BaseRLModel' is not callable?" , why?

def initialize_optuna(self):
    try:
        train_env = DummyVecEnv([lambda: TradingEnv(self.data_provider)])
        model = self.Model(self.Policy, train_env, nminibatches=1)                   ###  'BaseRLModel' is not callable???
        strategy = self.Reward_Strategy()                                                            ###  'BaseRewardStrategy' is not callable???
        self.study_name = f'{model.__class__.__name__}__{model.act_model.__class__.__name__}__{strategy.__class__.__name__}'
    except:
        self.study_name = f'UnknownModel__UnknownPolicy__UnknownStrategy'
MichaelQuaMan commented 2 years ago

@reasondk Are you seeing that message as part of PyCharms inspections; b/c that's where I'm seeing it.

It's not "Callable" because the argument BaseRLModel is passed in as a "Class" and not an instance of a class, and the class doesn't implement an __call__ method. I've tried to implement a __class__ method, but it wasn't worth the effort.

I haven't had any problems because of this "warning".

I've concluded it's just a false positive, intended for a different context.

The code works fine as written.