Clearing memory?

I'm running a multiday test and am running into an issue where certain symbol orders are not being executed. I have it so that on_start I define a self.status to every symbol called. For an order to be placed the self.status is compared weather it is a 0 or a 1 and the order is executed upon the comparison. What I'm running into is that I'm getting an error every once in awhile which says
AttributeError: 'CQ6f76254a9fdb4c22941afb8239da929a' object has no attribute 'status'. This does not make sense because all symbols that I am using are directly assigned an status at on_start. Is this a memory issue as I am doing multiday testing? I'm doing a full year and the only way I am able to get around this is by deleting the symbol from my user data which caused this error to occur. When this is done I re-run and the program goes a bit further and the same error happens the next time I rebalance. This is quite annoying and difficult in that my multiday strategy takes hours to run and I must restart after each error. I know I'm venting but any help regarding this error would be much appreciated!

Comments

  • ptunneyptunney Posts: 246

    What line number is it on? Is it saying no attribute 'status' or no attribute 'self.status'? Is it possible that you have typed status instead of self.status?
    During market hours you can always hit the help button in the bottom right corner and get chat help.

  • tf591404tf591404 Posts: 10
    edited May 2019

    It was saying no attribute 'status'. I just checked and all times is used with self.status. It was on line 173 regarding the if statement which checks if self.status == 1. And thanks I didn't know that! Definitely will use that in the future.

  • tf591404tf591404 Posts: 10

    Also is there a way to clear out the old closed out symbols still in account which have 0 positions in?

  • ptunneyptunney Posts: 246

    You can service.terminate() a symbol and that will end its callbacks for the day (it will complete the current callback, it will then be available to your is_symbol_qualified again the next trading day.

Sign In or Register to comment.