(self,time)
| 71 | def add_data(self,record): |
| 72 | self.history.append(record) |
| 73 | def reset(self,time): |
| 74 | self.time = time |
| 75 | # Sort the history by time |
| 76 | self.history.sort(key=lambda t:t[3]) |
| 77 | # Find the first entry who's time is behind the given time |
| 78 | self.index = 0 |
| 79 | while self.index < len(self.history): |
| 80 | if self.history[self.index][3] > time: |
| 81 | break |
| 82 | self.index += 1 |
| 83 | self.open = self.history[0][5] |
| 84 | self.initial = self.history[0][1] - self.history[0][4] |
| 85 | self.date = self.history[0][2] |
| 86 | self.update() |
| 87 | self.low = self.price |
| 88 | self.high = self.price |
| 89 | |
| 90 | # Calculate interpolated value of a given field based on |
| 91 | # current time |
no test coverage detected