回答編集履歴

1

バグの修正

2021/12/20 07:26

投稿

退会済みユーザー
test CHANGED
@@ -36,7 +36,7 @@
36
36
 
37
37
 
38
38
 
39
- rates = [3, 6, 5, 5, 1, 3, 8, 4, 2, 8]
39
+ rates = [3, 6, 5, 5, 1, 3, 8, 4, 2, 8, 5, 0.5]
40
40
 
41
41
 
42
42
 
@@ -62,39 +62,43 @@
62
62
 
63
63
  else:
64
64
 
65
- buy = df['bottom'].idxmin()
65
+ sell = df['profit'].idxmax()
66
66
 
67
- sell = df['profit'].idxmax()
67
+ buy = df['bottom'].iloc[:sell].idxmin()
68
68
 
69
69
  print(f'最大利益は{profit}(index:{buy}で買い、{sell}で売る)')
70
70
 
71
71
 
72
72
 
73
- # rate bottom profit
73
+ rate bottom profit
74
74
 
75
- # 0 3 3 0
75
+ 0 3.0 3.0 0.0
76
76
 
77
- # 1 6 3 3
77
+ 1 6.0 3.0 3.0
78
78
 
79
- # 2 5 3 2
79
+ 2 5.0 3.0 2.0
80
80
 
81
- # 3 5 3 2
81
+ 3 5.0 3.0 2.0
82
82
 
83
- # 4 1 1 0
83
+ 4 1.0 1.0 0.0
84
84
 
85
- # 5 3 1 2
85
+ 5 3.0 1.0 2.0
86
86
 
87
- # 6 8 1 7
87
+ 6 8.0 1.0 7.0
88
88
 
89
- # 7 4 1 3
89
+ 7 4.0 1.0 3.0
90
90
 
91
- # 8 2 1 1
91
+ 8 2.0 1.0 1.0
92
92
 
93
- # 9 8 1 7
93
+ 9 8.0 1.0 7.0
94
94
 
95
- #
95
+ 10 5.0 1.0 4.0
96
96
 
97
+ 11 0.5 0.5 0.0
98
+
99
+
100
+
97
- # 最大利益は7(index:4で買い、6で売る)
101
+ 最大利益は7.0(index:4で買い、6で売る)
98
102
 
99
103
 
100
104