※: ポートフォリオ登録結果が 口座管理>保有証券・資産 とだいたい一致するので、多分合ってますが、自己責任で使ってください。間違ってても責任は取れません。
目的
まとめ
手順
まずポートフォリオをリセット
保有証券情報をゲット
- Google Chrome で SBI証券 外貨建商品取引サイトの「口座管理>保有証券・資産」画面を出す
- F12キーを押す
- 下側のConsole に↓をコピペしてエンター押下
- 11銘柄以上持ってる人は最後のslice の中身を 0,30 とか 30,60 とか ... に適宜変えます
- 結局、ポートフォリオ画面で10件ずつしか入力できないので10銘柄ごとにsliceします
$$('.wfit75,.alR').map((x, ind) => { if (ind % 10 == 1 || ind % 10 == 3) { return x.textContent.replace(/(\s+|NASDAQ|NYSEArca|NYSE|\(\d+\))/g, ""); } if (ind % 10 == 4) { y = x.textContent.replace(/(\s+)/g, ""); usd = y.replace(/USD.+円/g, ""); yen = y.replace(/.+USD/g, "").replace(/(円|,)/g, ""); unitPrice = Math.round((yen / usd) * 100) / 100; return usd + "," + unitPrice; } }).filter(v => v).slice(0,30)
- console で 出てきた結果を右クリックして Copy Object
ポートフォリオに登録
a=(Ctrl+Vで貼り付け後エンター押下)
a.map((x, ind) => { row = Math.floor(ind / 3); inputName = "customerPortfolioList[" + row + "]"; if (ind % 3 == 0) { $('[name="' + inputName +'.productCode"]').value=x } if (ind % 3 == 1) { $('[name="' + inputName +'.amount"]').value=x } if (ind % 3 == 2) { $('[name="' + inputName +'.unitPrice"]').value=x.replace(/(,.+)/g, "") $('[name="' + inputName +'.exchangeRate"]').value=x.replace(/(.+,)/g, "") } })
- いい感じに入力されてると思うので「登録」クリック
- 10銘柄ずつしか入力できない仕様なので、全銘柄分繰り返します
ちなみに
- ポートフォリオ全体の前日比騰落率みたいなのは出ないので、毎日スクショを取っておくと良いと思います
ポートフォリオの前日比
- ポートフォリオ画面で
total = 0; kabusuu = 0; $$('.alR:nth-child(3),.alR:nth-child(5)').map((x, ind) => { if (ind % 2 == 0) { kabusuu = parseInt(x.textContent); } if (ind % 2 == 1) { total += (kabusuu * parseFloat((x.textContent.replace(/(USD)/, "")))); } }) total