Back to Community
recording integers displays floats (bug?)


This may be a stupid question, but I have found something peculiar with the record function. In trying to track how many "penny stocks" my algo is inadvertently trading, it seems that the record graph is showing floats. I am using the following code to track this value, which can only return an integer.

record(n_penny=(context.px.ix[-1,context.portfolio.positions.keys()] < 5).sum()) # px is from data.history  

At first I thought these floats were simply interpolated values on the graph in between recordings for speedier live plots. However, I switched to recording the value daily, and I still have graphs sections like this __/\__ where the peak is at 0.2, which I am having trouble understanding.

Although, when I zoom in very close on the record graph, the plot transforms to more step-like and only hits integer values, as expected. Has anyone else experienced this? I just wanted to check if this is intended or if I misunderstand how record works, or if this may even be a bug.

Thanks! (Apologies if this has been asked already; I couldn't find anything.)