ctc-executioner icon indicating copy to clipboard operation
ctc-executioner copied to clipboard

len() not defined for object type None

Open elnazsn1988 opened this issue 4 years ago • 1 comments

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):

elnazsn1988 avatar Jun 04 '20 02:06 elnazsn1988

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?

mjuchli avatar Jun 14 '20 11:06 mjuchli