Sorry for the noob question. I\'m just starting to code and I need to keep track of the 1hr price history.
I wanted pull values every second into a list of size 3600 un
You could append each new entry, then check the length of the list and conditionally priceHistory.pop(0)
.
Looks like you're initializing the priceHistory
list in the loop though. You want to do that before the loop, so you don't end up assigning empty lists to priceHistory
every time.
Alternatively, and this depends on the use case, is that you can create an initial list with 3600 None
entries, then just append and pop every time without the conditional length check.