<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>銘柄分析 &#8211; 芋の上にも3年</title>
	<atom:link href="https://imo3nen.com/category/stock-analysis/feed" rel="self" type="application/rss+xml" />
	<link>https://imo3nen.com</link>
	<description></description>
	<lastBuildDate>Wed, 16 Aug 2023 07:39:55 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.3</generator>

<image>
	<url>https://imo3nen.com/wp-content/uploads/cropped-favicon-32x32.jpg</url>
	<title>銘柄分析 &#8211; 芋の上にも3年</title>
	<link>https://imo3nen.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Google ColabでJ-Quants APIから日本株の財務情報や株価データを入手する方法</title>
		<link>https://imo3nen.com/python-jqants</link>
		
		<dc:creator><![CDATA[芋トレ]]></dc:creator>
		<pubDate>Tue, 14 Feb 2023 23:13:19 +0000</pubDate>
				<category><![CDATA[銘柄分析]]></category>
		<guid isPermaLink="false">https://imo3nen.com/?p=1294</guid>

					<description><![CDATA[株式のデータが欲しいのにExcel関数では日本株が対象外。何かいい方法はないかと探すと①Excel VBA、②フリーツール、③プログラムを書く、という3種類がありそうでした。銘柄スクリーニングは外出時にタブレットでやるこ [&#8230;]]]></description>
			<br />
<b>Warning</b>:  Undefined array key "className" in <b>/home/c0582313/public_html/imo3nen.com/wp-content/plugins/kojika-balloon-creator/library/gutenberg.php</b> on line <b>91</b><br />
<br />
<b>Warning</b>:  Undefined variable $return in <b>/home/c0582313/public_html/imo3nen.com/wp-content/plugins/kojika-balloon-creator/library/kjk_balloon_sc.php</b> on line <b>84</b><br />
<br />
<b>Warning</b>:  Undefined array key "className" in <b>/home/c0582313/public_html/imo3nen.com/wp-content/plugins/kojika-balloon-creator/library/gutenberg.php</b> on line <b>91</b><br />
<br />
<b>Warning</b>:  Undefined variable $return in <b>/home/c0582313/public_html/imo3nen.com/wp-content/plugins/kojika-balloon-creator/library/kjk_balloon_sc.php</b> on line <b>84</b><br />
							<content:encoded><![CDATA[
<style>
div.kjk_balloon.ri9cab3e09 .kb_text {background-color: #feebbe!important;}
div.kjk_balloon.ri9cab3e09 .kb_text:after {border-left: 10px solid #feebbe!important;}
</style>
<div class="kjk_balloon kb_normal kb_border ri9cab3e09">

	<figure class="kb_image kb_right">
		<img decoding="async" src="https://imo3nen.com/wp-content/uploads/fukidashi_tanuki_ga-nn.jpg" scale="0">
		<figcaption class="kb_icon_name">たぬぽん</figcaption>
	</figure>

	<div class="kb_text kb_right">

<p>株式情報を調べたいけど、Excelでは日本株データが見つからない？</p>

</div>
</div>



<style>
div.kjk_balloon.da88bc4cdd .kb_text {background-color: #e8fff6!important;}
div.kjk_balloon.da88bc4cdd .kb_text:after {border-right: 10px solid #e8fff6!important;}
</style>
<div class="kjk_balloon kb_normal kb_border da88bc4cdd">

	<figure class="kb_image kb_left">
		<img decoding="async" src="https://imo3nen.com/wp-content/uploads/fukidashi_imo_nmmm.jpg" scale="0">
		<figcaption class="kb_icon_name">芋トレ</figcaption>
	</figure>

	<div class="kb_text kb_left">

<p>Excelでは世界50か国近くの市場データが取得できるけど日本株はなさそうだね…</p>

</div>
</div>



<p>株式のデータが欲しいのにExcel関数では日本株が対象外。何かいい方法はないかと探すと<span class="sbd-text-bold">①Excel VBA、②フリーツール、③プログラムを書く、という3種類</span>がありそうでした。銘柄スクリーニングは外出時にタブレットでやることが多いため、特別なソフトが必要ない③プログラムを準備することにしました。</p>



<h2 class="wp-block-heading">Google ColabとJ-Quants APIを使うための準備</h2>



<p>プログラム初心者が先人の知恵をググらせてもらい、複数銘柄のデータ取得ができるようになりましたので共有します。</p>



<p>今回使ったのは<span class="sbd-text-bg-yellow">GoogleのColab（WEBでPythonが使用可能）とスプレッドシート、それに日本取引所グループ(JPX)のJ-Quants APIの3つ。</span>インストール不要でスマホ、タブレット、PCと機器を選ばずにアクセスできるため使いやすいです。またPythonのバージョン違いを気にせず、誰が使っても同じ環境で実行できることも情報共有しやすいと思います。</p>



<h3 class="wp-block-heading">事前準備：Googleアカウント取得(登録済みの方はスキップ)</h3>



<p>まずはGoogleアカウントを下記の手順で作成してください。</p>



<div class="wp-block-group is-layout-constrained wp-block-group-is-layout-constrained"><div class="wp-block-group__inner-container">
<div class="wp-block-sbd-list is-style-sbd-list-blue"><ol class="sbd-list sbd-list-border"><li>webブラウザで<a rel="noreferrer noopener" href="https://www.google.co.jp/" target="_blank">Google</a>にアクセスし画面右上のログインをクリック。</li><li>続いて画面下側のアカウントを作成をクリックし個人で使用を選択。</li><li>名前と使用するユーザー名、パスワードを設定して次へをクリック。</li><li>電話番号を入力し次へをクリック。プライバシーポリシーなどを確認したらアカウント作成完了。</li></ol></div>
</div></div>



<h3 class="wp-block-heading">事前準備：J-Quants APIのアカウント取得（登録済の方はスキップ）</h3>



<p>続いてJ-Quants APIへの会員登録を下記の手順で行ってください。</p>



<div class="wp-block-sbd-list is-style-sbd-list-blue"><ol class="sbd-list sbd-list-border"><li>webブラウザで<a rel="noreferrer noopener" href="https://jpx-jquants.com/" target="_blank">J-Quants API</a>にアクセスする。</li><li>ページ中の「J-Quants APIに登録する」ボタンをクリックしユーザー登録ページへ進む。</li><li>メールアドレス、パスワードを入力し「利用規約に同意して登録する」ボタンをクリック。</li><li>送られてきた仮登録メールのリンクから登録用URLをクリックして登録完了<strong><span class="sbd-text-bg-yellow">（1時間以内に登録しないとURLが無効になります）</span></strong></li><li>登録したメールアドレスとパスワードでログインする。</li><li>ログインしたら使いたいプランを選択して支払方法、名前、住所など必要情報を入力し「申し込む」ボタンをクリック。</li></ol></div>



<p>下にある引用画像1枚目がJ-Quantsのトップページです。<strong>「J-Quants APIに登録する」ボタン</strong>から進み、2枚目のメールアドレス、パスワードを入力するとメールが送られてきますので登録を完了してください。ログインすると3枚目の状態になりますので<strong>必要なプランを選択</strong>して、4枚目の<strong>決済情報を入力</strong>すれば準備完了です。</p>



<blockquote class="wp-block-quote has-text-align-center is-style-default">
<figure class="wp-block-image size-full is-style-default"><img fetchpriority="high" decoding="async" width="900" height="562" src="https://imo3nen.com/wp-content/uploads/Python-Jquants12.png" alt="J-Quants APIトップページ" class="wp-image-1439"/></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="628" src="https://imo3nen.com/wp-content/uploads/Python-Jquants13.png" alt="J-Quants APIユーザー登録ページ" class="wp-image-1440"/></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="875" src="https://imo3nen.com/wp-content/uploads/Python-Jquants14.jpg" alt="J-Quants APIプラン選択" class="wp-image-1441"/></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="607" src="https://imo3nen.com/wp-content/uploads/Python-Jquants15.png" alt="J-Quants API申込みページ" class="wp-image-1442"/></figure>
<cite><em>引用元：</em><a rel="noreferrer noopener" href="https://jpx-jquants.com/" target="_blank">J-Quants</a></cite></blockquote>



<h2 class="wp-block-heading">個別銘柄の株価情報、財務情報を入手する手順</h2>



<h3 class="wp-block-heading">Colabへプログラムコードを貼り付ける</h3>



<p>準備ができたら下記の手順でGoogle Colabにコードを貼り付けてください。その後コードを実行するとデータがGoogleスプレッドシートに保存されますので、内容を確認ください。</p>



<div class="wp-block-sbd-list is-style-sbd-list-blue"><ol class="sbd-list sbd-list-border"><li><a rel="noreferrer noopener" href="https://colab.research.google.com/" target="_blank">Google Colab</a>にアクセスする。</li><li>画面右上の「ログイン」ボタンをクリックし、先ほど登録したGoogleアカウント情報でログイン。</li><li>ログイン後に出てくるウィンドウの右下にある<strong>「ノートブックを新規作成」</strong>をクリック。</li><li>新しく開いたウィンドウの<span class="sbd-text-bg-yellow">入力スペースに、この記事の下に貼ってあるプログラムコード1種類をコピぺする。</span></li><li><span class="sbd-text-red">貼り付けたらメールアドレスとパスワードをJ-Quants APIに登録した情報に変更する。</span></li><li><strong>枠の左側にある「<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/25b6.png" alt="▶" class="wp-smiley" style="height: 1em; max-height: 1em;" />：再生」ボタン</strong>をクリックしてプログラムを実行する。</li><li>実行中に<span class="sbd-text-bg-yellow">Googleの認証と、Googleドライブの認証を聞かれる</span>のでログインしているアカウントを選択して「OK」をクリック。</li><li>終了するとGoogleの<a rel="noreferrer noopener" href="https://www.google.com/intl/ja_jp/sheets/about/" target="_blank">スプレッドシート</a>にデータが保存される。</li></ol></div>



<p>下にある引用画像の1枚目がColabのトップページです、<span class="sbd-text-bold">右上の「ログイン」ボタン</span>から進んでください。ログイン後に2枚目の状態になりますので、<span class="sbd-text-bold">右下にある「ノートブックを新規作成」をクリック</span>。3枚目の状態になればプログラムを貼り付ける準備完了です。</p>



<blockquote class="wp-block-quote has-text-align-center">
<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="781" src="https://imo3nen.com/wp-content/uploads/Python-Jquants03.png" alt="Google Colabトップページ" class="wp-image-1393" srcset="https://imo3nen.com/wp-content/uploads/Python-Jquants03.png 1000w, https://imo3nen.com/wp-content/uploads/Python-Jquants03-600x469.png 600w, https://imo3nen.com/wp-content/uploads/Python-Jquants03-768x600.png 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="779" src="https://imo3nen.com/wp-content/uploads/Python-Jquants04.png" alt="Colabログイン後のページ" class="wp-image-1394" title="Img-border" srcset="https://imo3nen.com/wp-content/uploads/Python-Jquants04.png 1000w, https://imo3nen.com/wp-content/uploads/Python-Jquants04-600x467.png 600w, https://imo3nen.com/wp-content/uploads/Python-Jquants04-768x598.png 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="778" src="https://imo3nen.com/wp-content/uploads/Python-Jquants05.png" alt="Colab 新規ノートブックの作成" class="wp-image-1395" srcset="https://imo3nen.com/wp-content/uploads/Python-Jquants05.png 1000w, https://imo3nen.com/wp-content/uploads/Python-Jquants05-600x467.png 600w, https://imo3nen.com/wp-content/uploads/Python-Jquants05-768x598.png 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>
<cite>引用元:<a href="https://colab.research.google.com/" target="_blank" rel="noreferrer noopener">CoLaboratory<img src="https://s.w.org/images/core/emoji/14.0.0/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" /></a>はGoogle LLCの商標です。</cite></blockquote>



<p>Google Colabにコピーするコードは下記の2種類で、<span class="sbd-text-bg-yellow">対象銘柄の財務情報と<span class="sbd-text-bg-yellow">株価データ</span>を取得するコードになります。</span>なお<span class="sbd-text-red">コードの28行目にある「登録したメールアドレス」、「登録したパスワード」と記載されている部分を、Colabに貼り付けた後にご自分の情報に書き換えて実行</span>ください（J-Quants APIに登録した時のメールアドレス、パスワードを入力）</p>



<h3 class="wp-block-heading">財務情報データ取得コード</h3>



<script src="https://gist.github.com/imo3nen/9978f4427064f8295ee70dfaf7e51d0e.js"></script>



<h3 class="wp-block-heading">株価データ取得コード</h3>



<script src="https://gist.github.com/imo3nen/4e7b4e994af2dad7b9b910eb6c0388cb.js"></script>



<p>株価データ取得コードを実行すると画像のようなデータが保存されます。</p>



<figure class="wp-block-image size-full"><img decoding="async" width="900" height="498" src="https://imo3nen.com/wp-content/uploads/Python-Jquants17.png" alt="株価データ構成" class="wp-image-1451"/></figure>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
