kkuette/TradzQAI

Possible bug in dataloader.py

oscarberonius opened this issue · 5 comments

Hi,

I ran into a problem when I tried running the new core. I successfully built the PPO agent, but when I executed an eval session I received the following exception.

#PRINT# lines.split(sep) = ['20180701000108', '5467.87', '0.062', '56.86932808248668', '1.828228906843833', '0.12368473729161092', '5468.798899294792', '5457.467818250765', '5444.815160592744']
Traceback (most recent call last):
  File "run.py", line 42, in <module>
    session.loadSession()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/TradzQAI/core/session/local.py", line 71, in loadSession
    self.initEnv()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/TradzQAI/core/session/local.py", line 102, in initEnv
    logger=self.logger, saver=self.saver, dataloader=self.dl)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/TradzQAI/core/environnement/local_env.py", line 84, in __init__
    self.dl.loadFile()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/TradzQAI/core/environnement/base/dataloader.py", line 177, in loadFile
    tmp_data, tmp_raw, tmp_time = self.getStockDataVec(self.files[self.files_index])
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/TradzQAI/core/environnement/base/dataloader.py", line 150, in getStockDataVec
    df.columns = names
UnboundLocalError: local variable 'names' referenced before assignment

I'm not sure if the code is supposed to be able to handle a row length of 10 or not, but there shouldn't be any problem with the data as I tested it before and made sure the path is correct.

the dataloader is supposed to handle 3,4,6 and 6 row. here is the getter function, i should add a setting in config/environnement.json to handle this kind of things.

Thanks for your support.

Before you reworked the core I could use the same data to train the model. Did you remove that functionality?

I haven't removed that feature, i've just commented the last 3 names here. You can uncomment it if you want, but take care about names if you are using complex network !

Okay. Can't try it out because I am getting all sorts of errors when trying to run the different modes. When I run the live session I now get

  File "run.py", line 40, in <module>
    product_id=product_id)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/TradzQAI/core/session/live.py", line 119, in initApi
    self.initEnv()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/TradzQAI/core/session/live.py", line 124, in initEnv
    logger=self.logger, saver=self.saver, dataloader=self.dl, api=self.api)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/TradzQAI/core/environnement/live_env.py", line 99, in __init__
    self.dl.loadHistorical()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/TradzQAI/core/environnement/base/dataloader.py", line 232, in loadHistorical
    ticks = self.formatTo15M(pd.DataFrame(ticks, columns=self.columns))
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/TradzQAI/core/environnement/base/dataloader.py", line 308, in formatTo15M
    for i in tqdm(range(len(data['Time'])), desc = "Formating : "):
NameError: name 'tqdm' is not defined

I'm working on live session actually, there is alot of fix to do