質問編集履歴
5
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -234,6 +234,102 @@
|
|
234
234
|
|
235
235
|
|
236
236
|
|
237
|
+
### 追記のソースコード
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
```ここに言語名を入力
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
from datetime import datetime
|
246
|
+
|
247
|
+
from pandas_datareader import data
|
248
|
+
|
249
|
+
import pandas as pd
|
250
|
+
|
251
|
+
import numpy as np
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
start = '2019-01-01'
|
256
|
+
|
257
|
+
end ='2020-01-01'
|
258
|
+
|
259
|
+
df = data.DataReader('GOOG', 'yahoo', start, end)
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
lst = df['Adj Close'].values.tolist()
|
264
|
+
|
265
|
+
print(lst)
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
momi_days = 30
|
270
|
+
|
271
|
+
renzoku_days = 0
|
272
|
+
|
273
|
+
win = 0
|
274
|
+
|
275
|
+
lose = 0
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
# 5%,25%を出す
|
280
|
+
|
281
|
+
row = 5
|
282
|
+
|
283
|
+
high = 25
|
284
|
+
|
285
|
+
sup_line,resi_line=np.percentile(lst,[row,high])
|
286
|
+
|
287
|
+
print(sup_line)
|
288
|
+
|
289
|
+
print(resi_line)
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
len(lst)
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
for p_today in lst:
|
298
|
+
|
299
|
+
if (sup_line <= p_today <= resi_line):
|
300
|
+
|
301
|
+
renzoku_days += 1
|
302
|
+
|
303
|
+
if (renzoku_days > momi_days): #何日連続しているか
|
304
|
+
|
305
|
+
if (resi_line < p_today): #勝ち!!
|
306
|
+
|
307
|
+
win += 1
|
308
|
+
|
309
|
+
print(renzoku_days,'日間揉み合った結果上振れ')
|
310
|
+
|
311
|
+
renzoku_days = 0
|
312
|
+
|
313
|
+
elif (p_today < sup_line): #負けた,,,
|
314
|
+
|
315
|
+
lose += 1
|
316
|
+
|
317
|
+
print(renzoku_days,'日間揉み合った結果下振れ')
|
318
|
+
|
319
|
+
renzoku_days = 0
|
320
|
+
|
321
|
+
else: #揉み合ってない!
|
322
|
+
|
323
|
+
renzoku_days = 0
|
324
|
+
|
325
|
+
renzoku_days = 0
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
```
|
330
|
+
|
331
|
+
|
332
|
+
|
237
333
|
|
238
334
|
|
239
335
|
### 試したこと
|
4
エラー箇所
test
CHANGED
File without changes
|
test
CHANGED
@@ -88,6 +88,14 @@
|
|
88
88
|
|
89
89
|
|
90
90
|
|
91
|
+
df
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
len(df)
|
96
|
+
|
97
|
+
|
98
|
+
|
91
99
|
df['Adj Close']
|
92
100
|
|
93
101
|
|
@@ -96,6 +104,24 @@
|
|
96
104
|
|
97
105
|
|
98
106
|
|
107
|
+
df.index
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
k_ris = df.values
|
112
|
+
|
113
|
+
d_ris = df.index
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
k_ris
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
print(type(k_ris))
|
122
|
+
|
123
|
+
|
124
|
+
|
99
125
|
df = df['Adj Close']
|
100
126
|
|
101
127
|
|
@@ -120,6 +146,10 @@
|
|
120
146
|
|
121
147
|
|
122
148
|
|
149
|
+
len(kabu)
|
150
|
+
|
151
|
+
|
152
|
+
|
123
153
|
momidays = 30 #揉み合う期間を決める
|
124
154
|
|
125
155
|
|
@@ -130,7 +160,7 @@
|
|
130
160
|
|
131
161
|
win = 0
|
132
162
|
|
133
|
-
lose =
|
163
|
+
lose = 0
|
134
164
|
|
135
165
|
|
136
166
|
|
3
インデント
test
CHANGED
File without changes
|
test
CHANGED
@@ -164,7 +164,7 @@
|
|
164
164
|
|
165
165
|
renzoku_days = 0
|
166
166
|
|
167
|
-
renzoku_days = 0
|
167
|
+
renzoku_days = 0
|
168
168
|
|
169
169
|
|
170
170
|
|
2
インデント追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -38,7 +38,25 @@
|
|
38
38
|
|
39
39
|
```
|
40
40
|
|
41
|
+
ValueError Traceback (most recent call last)
|
42
|
+
|
43
|
+
<ipython-input-34-da09756d28d2> in <module>()
|
44
|
+
|
45
|
+
1 for p_today in kabu:
|
46
|
+
|
47
|
+
----> 2 if (sup_line <= p_today <= resi_line):
|
48
|
+
|
49
|
+
3 renzoku_days += 1
|
50
|
+
|
51
|
+
4 if (renzoku_days > momidays): #何日連続しているか
|
52
|
+
|
53
|
+
5 if (resi_line < p_today): #勝ち!!
|
54
|
+
|
55
|
+
|
56
|
+
|
41
|
-
The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
|
57
|
+
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
|
58
|
+
|
59
|
+
```
|
42
60
|
|
43
61
|
|
44
62
|
|
@@ -50,7 +68,7 @@
|
|
50
68
|
|
51
69
|
|
52
70
|
|
53
|
-
|
71
|
+
|
54
72
|
|
55
73
|
from datetime import datetime
|
56
74
|
|
@@ -120,7 +138,7 @@
|
|
120
138
|
|
121
139
|
for p_today in kabu:
|
122
140
|
|
123
|
-
if (sup_line <= p_today <= resi_line):
|
141
|
+
if (sup_line <= p_today <= resi_line):
|
124
142
|
|
125
143
|
renzoku_days += 1
|
126
144
|
|
@@ -188,10 +206,6 @@
|
|
188
206
|
|
189
207
|
|
190
208
|
|
191
|
-
```
|
192
|
-
|
193
|
-
|
194
|
-
|
195
209
|
### 試したこと
|
196
210
|
|
197
211
|
|
@@ -204,8 +218,6 @@
|
|
204
218
|
|
205
219
|
プログラミングは実践だというので自分なりに初めて作ってみました.
|
206
220
|
|
207
|
-
なんかプレビューだと改行やインデント入れているところまでごちゃごちゃになってしまいました.
|
208
|
-
|
209
221
|
すごくごちゃごちゃしていてすいません...
|
210
222
|
|
211
223
|
よろしくお願いします.
|
1
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -50,6 +50,8 @@
|
|
50
50
|
|
51
51
|
|
52
52
|
|
53
|
+
```ここに言語を入力
|
54
|
+
|
53
55
|
from datetime import datetime
|
54
56
|
|
55
57
|
from pandas_datareader import data
|
@@ -72,22 +74,14 @@
|
|
72
74
|
|
73
75
|
|
74
76
|
|
77
|
+
df.values
|
78
|
+
|
79
|
+
|
80
|
+
|
75
81
|
df = df['Adj Close']
|
76
82
|
|
77
83
|
|
78
84
|
|
79
|
-
df.values
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
x = df.values
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
df = df['Adj Close']
|
88
|
-
|
89
|
-
|
90
|
-
|
91
85
|
# 5%,25%を出す
|
92
86
|
|
93
87
|
row = 5
|
@@ -108,7 +102,7 @@
|
|
108
102
|
|
109
103
|
|
110
104
|
|
111
|
-
momidays = 30
|
105
|
+
momidays = 30 #揉み合う期間を決める
|
112
106
|
|
113
107
|
|
114
108
|
|
@@ -118,7 +112,7 @@
|
|
118
112
|
|
119
113
|
win = 0
|
120
114
|
|
121
|
-
lose =
|
115
|
+
lose = 1
|
122
116
|
|
123
117
|
|
124
118
|
|
@@ -126,7 +120,7 @@
|
|
126
120
|
|
127
121
|
for p_today in kabu:
|
128
122
|
|
129
|
-
|
123
|
+
if (sup_line <= p_today <= resi_line):
|
130
124
|
|
131
125
|
renzoku_days += 1
|
132
126
|
|
@@ -188,12 +182,16 @@
|
|
188
182
|
|
189
183
|
|
190
184
|
|
191
|
-
|
192
|
-
|
193
185
|
```
|
194
186
|
|
195
187
|
|
196
188
|
|
189
|
+
|
190
|
+
|
191
|
+
```
|
192
|
+
|
193
|
+
|
194
|
+
|
197
195
|
### 試したこと
|
198
196
|
|
199
197
|
|