<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>mamorums</author_name>
  <author_url>https://blog.hatena.ne.jp/mamorums/</author_url>
  <blog_title>C#, Python, Web開発</blog_title>
  <blog_url>https://web-dev.hatenablog.com/</blog_url>
  <categories>
    <anon>Python</anon>
  </categories>
  <description>Python の yfinance を使って、日次の収益率を計算する方法を書いていきます。 注意事項 配当は考慮していません。 終値で収益率を計算しています。 浮動小数点演算の誤差があります。 コード例 以下のコードは、S&amp;P500（^SPX）の収益率を計算して、CSVに出力する例です。 import pandas as pd import yfinance as yf # 取得データ ticker = '^SPX' start = 2023 end = 2024 # 日次データを少し余分に取得（昇順） yft = yf.Ticker(ticker) df = yft.history( sta…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fweb-dev.hatenablog.com%2Fentry%2Fpython%2Fyfinance%2Freturn%2Fdtd&quot; title=&quot;Python yfinance 日次の収益率を計算する方法（株式, インデックス） - C#, Python, Web開発&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://cdn-ak.f.st-hatena.com/images/fotolife/m/mamorums/20250428/20250428094115.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2025-04-28 09:40:00</published>
  <title>Python yfinance 日次の収益率を計算する方法（株式, インデックス）</title>
  <type>rich</type>
  <url>https://web-dev.hatenablog.com/entry/python/yfinance/return/dtd</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
