Skip to content

Commit fffe4b5

Browse files
author
Siddharta Govindaraj
committed
Extract Class refactoring complete
1 parent c1bdf70 commit fffe4b5

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

stock_alerter/stock.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
import bisect
2-
import collections
31
from datetime import timedelta
42
from enum import Enum
53

64
from .timeseries import TimeSeries
75

8-
PriceEvent = collections.namedtuple("PriceEvent", ["timestamp", "price"])
9-
106

117
class StockSignal(Enum):
128
buy = 1
@@ -20,7 +16,6 @@ class Stock:
2016

2117
def __init__(self, symbol):
2218
self.symbol = symbol
23-
self.price_history = []
2419
self.history = TimeSeries()
2520

2621
@property
@@ -33,7 +28,6 @@ def price(self):
3328
def update(self, timestamp, price):
3429
if price < 0:
3530
raise ValueError("price should not be negative")
36-
bisect.insort_left(self.price_history, PriceEvent(timestamp, price))
3731
self.history.update(timestamp, price)
3832

3933
def is_increasing_trend(self):

0 commit comments

Comments
 (0)