mjuchli / ctc-executioner

Master Thesis: Limit order placement with Reinforcement Learning
176 stars 83 forks source link

len() not defined for object type None #24

Open elnazsn1988 opened 4 years ago

elnazsn1988 commented 4 years ago

Hi - very cool repo, I have an issue in that inside the orderbook.py I am trying to pull my info from a orderbook csv file with pre-existing historical data, and it will not allow the generateDict to actually generate a dict due to the clause stating that if the len(self.dictbook< index, and self.dictbook is defined as 'None' in the beginning of the code. Same issue happens later on in different part of ipynb file remake with external orderbook, is there anyway to fix this? I tried replacing with self.dictbook={} and self.dictbook=[], neither fixes the issue.

The issue is always in this part of the code : ~/ctc-executioner/ctc_executioner/orderbook.py in getDictState(self, index) 195 if len(self.dictBook) <= index: 196 raise Exception('Index out of orderbook state.') --> 197 return self.dictBook[list(self.dictBook.keys())[index]] 198 199 def summary(self):

mjuchli commented 4 years ago

Hi @elnazsn1988 Sorry for the late reply. Would it be possible to share your order book (or parts of it if its too large) so that I can test it myself?

Are you using the loadFromFile method?, or did you write your own parser?