質問編集履歴

2

df_ja_resultの中身

2020/09/30 06:57

投稿

Yudohu
Yudohu

スコア25

test CHANGED
File without changes
test CHANGED
@@ -59,3 +59,23 @@
59
59
  df_ja_result[df_ja_result.差分 == df_ja_result.差分.max()].保有数量 += 1
60
60
 
61
61
  ```
62
+
63
+
64
+
65
+ ```df_ja_resultの中身
66
+
67
+ 保有数量 取得単価 現在値 外貨建評価損益 商品 Totalamount % 差分
68
+
69
+ 0 2 119.16 118.23 -1.86 AGG 236.46 5.133794331 -0.133794331
70
+
71
+ 1 2 187.2 176.7 -21 GLD 353.4 7.672684245 -0.172684245
72
+
73
+ 2 3 81.92 80.18 -5.22 IYR 240.54 5.222375406 -0.222375406
74
+
75
+ 3 35 34.54 41.06 228.2 VEA 1437.1 31.2009466 1.699053398
76
+
77
+ 4 10 148.65 169.99 213.4 VTI 1699.9 36.90660993 -1.906609928
78
+
79
+ 5 15 36.46 42.57 91.65 VWO 638.55 13.86358949 0.736410512
80
+
81
+ ```

1

ソースを公開しました。

2020/09/30 06:57

投稿

Yudohu
Yudohu

スコア25

test CHANGED
File without changes
test CHANGED
@@ -19,3 +19,43 @@
19
19
 
20
20
 
21
21
  保有数量の中身としては整数になっております。
22
+
23
+
24
+
25
+
26
+
27
+ 下記追記となります。
28
+
29
+
30
+
31
+ ```html
32
+
33
+ # 購入すべきものの算出
34
+
35
+ mostbuy = df_ja_result[df_ja_result.差分 == df_ja_result.差分.max()].商品
36
+
37
+ mostbuy2 = mostbuy.iloc[0]
38
+
39
+ realcost = df_ja_result[df_ja_result.差分 == df_ja_result.差分.max()].現在値
40
+
41
+ print(realcost)
42
+
43
+ realcost2 = float(realcost.iloc[0])
44
+
45
+ realcost3 = realcost3 + realcost2
46
+
47
+ print(mostbuy2)
48
+
49
+ print(realcost2)
50
+
51
+ # もし予算を超えていたら購入中止、ループを抜ける
52
+
53
+ if realcost3 > budget:
54
+
55
+ print('!!BREAK!!')
56
+
57
+ break
58
+
59
+ df_ja_result[df_ja_result.差分 == df_ja_result.差分.max()].保有数量 += 1
60
+
61
+ ```