Skip to content

Commit f7ff299

Browse files
author
Siddharta Govindaraj
committed
Applied Rename Variable refactoring
1 parent 1eaebe7 commit f7ff299

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

stock_alerter/stock.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,35 +25,35 @@ def is_increasing_trend(self):
2525
self.price_history[-2].price < self.price_history[-1].price
2626

2727
def get_crossover_signal(self, on_date):
28-
cpl = []
28+
closing_price_list = []
2929
for i in range(11):
3030
chk = on_date.date() - timedelta(i)
3131
for price_event in reversed(self.price_history):
3232
if price_event.timestamp.date() > chk:
3333
pass
3434
if price_event.timestamp.date() == chk:
35-
cpl.insert(0, price_event)
35+
closing_price_list.insert(0, price_event)
3636
break
3737
if price_event.timestamp.date() < chk:
38-
cpl.insert(0, price_event)
38+
closing_price_list.insert(0, price_event)
3939
break
4040

4141
# Return NEUTRAL signal
42-
if len(cpl) < 11:
42+
if len(closing_price_list) < 11:
4343
return 0
4444

4545
# BUY signal
46-
if sum([update.price for update in cpl[-11:-1]])/10 \
47-
> sum([update.price for update in cpl[-6:-1]])/5 \
48-
and sum([update.price for update in cpl[-10:]])/10 \
49-
< sum([update.price for update in cpl[-5:]])/5:
46+
if sum([update.price for update in closing_price_list[-11:-1]])/10 \
47+
> sum([update.price for update in closing_price_list[-6:-1]])/5 \
48+
and sum([update.price for update in closing_price_list[-10:]])/10 \
49+
< sum([update.price for update in closing_price_list[-5:]])/5:
5050
return 1
5151

5252
# BUY signal
53-
if sum([update.price for update in cpl[-11:-1]])/10 \
54-
< sum([update.price for update in cpl[-6:-1]])/5 \
55-
and sum([update.price for update in cpl[-10:]])/10 \
56-
> sum([update.price for update in cpl[-5:]])/5:
53+
if sum([update.price for update in closing_price_list[-11:-1]])/10 \
54+
< sum([update.price for update in closing_price_list[-6:-1]])/5 \
55+
and sum([update.price for update in closing_price_list[-10:]])/10 \
56+
> sum([update.price for update in closing_price_list[-5:]])/5:
5757
return -1
5858

5959
# NEUTRAL signal

0 commit comments

Comments
 (0)