Capstone Model Solution.ipynb TypeError: object of type 'pickle.PickleBuffer'

While running Capstone Model Solution.ipynb on my local computer for 7-hours I then get the following error:



Trade 001 | pos -1 | len 1 | approx cum ret 0.00% | trade ret -0.00% | eps 1.0010 | 2008-01-23 08:50:00 | 5002

Trade 002 | pos 1 | len 6 | approx cum ret 0.23% | trade ret 0.23% | eps 0.0635 | 2008-01-23 09:25:00 | 5009

Trade 003 | pos -1 | len 1313 | approx cum ret -2.07% | trade ret -2.30% | eps 0.0133 | 2008-01-28 23:15:00 | 6327

Trade 004 | pos 1 | len 637 | approx cum ret -2.18% | trade ret -0.11% | eps 0.0049 | 2008-01-31 04:30:00 | 6966

Trade 005 | pos -1 | len 277 | approx cum ret -3.19% | trade ret -1.01% | eps 0.0026 | 2008-02-01 12:30:00 | 7350

Trade 006 | pos 1 | len 721 | approx cum ret -2.53% | trade ret 0.67% | eps 0.0018 | 2008-02-05 04:05:00 | 8113

Trade 007 | pos 1 | len 8482 | approx cum ret 1.95% | trade ret 4.48% | eps 0.0014 | 2008-03-12 18:15:00 | 17211

Trade 008 | pos 1 | len 1476 | approx cum ret -1.78% | trade ret -3.74% | eps 0.0012 | 2008-03-21 05:30:00 | 19362

Trade 009 | pos -1 | len 152 | approx cum ret -1.67% | trade ret 0.11% | eps 0.0012 | 2008-03-27 08:45:00 | 20841

Trade 010 | pos 1 | len 2353 | approx cum ret -0.36% | trade ret 1.32% | eps 0.0011 | 2008-04-14 07:15:00 | 25143

----saving weights, trade logs and replay buffer-----



TypeError                                 Traceback (most recent call last)

<ipython-input-11-3b57ee0af746> in <module>

      4 False in rl_config

      5 """

----> 6 run(bars5m, rl_config)



<ipython-input-9-df6c2e077416> in run(bars5m, rl_config)

    104             print('----saving weights, trade logs and replay buffer-----')

    105             r_network.save_weights(rl_config['WEIGHTS_FILE'], overwrite=True)

–> 106             trade_logs.to_pickle(rl_config['TRADE_FILE'])

    107             pickle.dump(exp_replay.memory, open(rl_config['REPLAY_FILE'], 'wb'))

    108



~/.local/lib/python3.8/site-packages/pandas/core/generic.py in to_pickle(self, path, compression, protocol, storage_options)

   2859         from pandas.io.pickle import to_pickle

   2860

-> 2861         to_pickle(

   2862             self,

   2863             path,



~/.local/lib/python3.8/site-packages/pandas/io/pickle.py in to_pickle(obj, filepath_or_buffer, compression, protocol, storage_options)

     95         storage_options=storage_options,

     96     ) as handles:

—> 97         pickle.dump(obj, handles.handle, protocol=protocol)  # type: ignore[arg-type]           ß no match found

     98

     99



/usr/lib/python3.8/bz2.py in write(self, data)

    245             compressed = self._compressor.compress(data)

    246             self._fp.write(compressed)

–> 247             self._pos += len(data)                                         ß no match found

    248             return len(data)

    249



TypeError: object of type 'pickle.PickleBuffer' has no len()          ß no match found





My computer has the following configuration:



DDR4: CORSAIR Vengeance RGB Pro 128GB (4 x 32GB)

Processor: Intel Core i9-9900K Coffee Lake 8-Core, 16-Thread, 3.6 GHz

Video card: EVGA GeForce RTX 2080 Ti FTW3 ULTRA GAMING



In rl_config = {. . . 'MAX_MEM': 600. . . }. What does 600 means? And is it related to the above error?



Which FX currency pair data represent?



William

Hi William,



I am looking into this error message and will get back to you.



Thanks and regards,

Gaurav

Hi William,



This notebook seems to be working on my end and I could not reproduce the error.



However, while searching for your error message as given above, the problem seems to be with a package version. 



Could you please check if the Python and the package versions are matching the ones in the ReadMe.pdf (located in the zip file here)



Please let me know if correcting the package/Python version works out for you.



Thanks,

Gaurav