@@ -25,35 +25,35 @@ def is_increasing_trend(self):
25
25
self .price_history [- 2 ].price < self .price_history [- 1 ].price
26
26
27
27
def get_crossover_signal (self , on_date ):
28
- cpl = []
28
+ closing_price_list = []
29
29
for i in range (11 ):
30
30
chk = on_date .date () - timedelta (i )
31
31
for price_event in reversed (self .price_history ):
32
32
if price_event .timestamp .date () > chk :
33
33
pass
34
34
if price_event .timestamp .date () == chk :
35
- cpl .insert (0 , price_event )
35
+ closing_price_list .insert (0 , price_event )
36
36
break
37
37
if price_event .timestamp .date () < chk :
38
- cpl .insert (0 , price_event )
38
+ closing_price_list .insert (0 , price_event )
39
39
break
40
40
41
41
# Return NEUTRAL signal
42
- if len (cpl ) < 11 :
42
+ if len (closing_price_list ) < 11 :
43
43
return 0
44
44
45
45
# 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 :
50
50
return 1
51
51
52
52
# 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 :
57
57
return - 1
58
58
59
59
# NEUTRAL signal
0 commit comments