ranaroussi

Activity

Stars and mentions · Last 30 days, Oct 8 – Nov 6

GitHub stars294
Mentions8
013263952Oct 8Oct 22Nov 6
UTC days · repositories ranaroussi owns2 repositories

Top repositories

ranaroussi’s repositories ranked by new forks, as on trending.

Loading

Contributes to

Repositories outside ranaroussi’s account where ranaroussi opened or reviewed pull requests in the past 365 days.

Who noticed ranaroussi

Everyone who starred or forked ranaroussi’s repositories since the archive began in 2011.

Notable accounts

Ordered by the stars their own repositories have received.

Biggest fans

Accounts that starred the most of these repositories.

Breakout weeks

Each repository’s best week of new stars, with the release published around it.

Mentions

10posts
Nov 72 posts
  1. yfinanceのget_newsが空・CURRENTLY DOWNになる原因と対処【2026年11月】 3 行まとめ 2026年10月中旬から、yfinance の Ticker.news / get_news() は全銘柄で空リストを返すようになった(yfinance の Issue による)。11月3日ごろからは YFDataException: * YAHOO! FINANCE IS CURRENTLY DOWN! * を投げる。Yahoo Finance が落ちているわけではなく、ニュース取得に使っていた /xhr/ncp エンドポイントが廃止されたのが原因 11月3日リリースの yfinance 1.8.0 で、取得先が株価ページと同じ GraphQL に切り替わった。日本株(7203.T など)でも手元で5件ずつ取れた。ただし取れるのは英語ニュースだけで、ロケールを日本に変えると0件になる 自作の投資分析ツールでは、残っているログの1か月分すべてで Claude にニュースが1件も渡っていなかった。例外を握りつぶして 0/5 銘柄 を INFO ログに流すだけの作りだったため、気づけなかった 何が起きたか:ログに「0/5 銘柄」が並んでいた 自作の投資分析ツール(RakuScan)は、平日の16時にスクリーニングを回し、上位5銘柄のニュース見出しを yfinance で取ってから Claude に統合分析させている。ニュース取得の部分はこうなっている。 scripts/daily_run.py(抜粋) top_symbols = [r["symbol"] for r in top_results] try: from src.data.news_fetcher import fetch_news news_by_symbol = fetch_news(top_symbols) enriched = [] for r in top_results: entry = dict(r) news = news_by_symbol.get(r["symbol"], []) if news: entry["recent_news"] = [n["title"] for n in news] enriched.append(entry) logger.info( "ニュース取得完了: %d/%d 銘柄", sum(1 for s in top_symbols if s in news_by_symbol), len(top_symbols), ) except Exception as e: logger.warning("ニュース取得失敗(ニュースなしで続行): %s", e) enriched = top_results ニュースが取れなくても分析は止めない設計にしている。ニュースは補助情報なので、この判断自体は間違っていないと思う。 ところが記事のネタ探しでログを見直したら、こうなっていた。 2026-10-05 16:14:21 [INFO] main: ニュース取得完了: 0/5 銘柄 2026-10-06 16:15:55 [INFO] main: ニュース取得完了: 0/5 銘柄 ... 2026-10-30 16:15:06 [INFO] main: ニュース取得完了: 0/5 銘柄 2026-11-02 16:13:42 [INFO] main: ニュース取得完了: 0/5 銘柄 2026-11-03 16:14:56 [WARNING] src.data.news_fetcher: ニュース取得エラー (symbol=xxxx): * YAHOO! FINANCE IS CURRENTLY DOWN! * 2026-11-03 16:14:56 [INFO] main: ニュース取得完了: 0/5 銘柄 残っているログは10月5日以降の分だけだが、その範囲では 23回の実行すべてが 0/5 だった(11月5日はスクリーニング自体がスキップされて 0/0)。しかも10月と11月で壊れ方が違う。 期間 挙動 ログ 10月(残存ログの範囲) 例外なし・空リスト INFO の 0/5 銘柄 だけ 11月3日〜 YFDataException 銘柄ごとに WARNING+0/5 銘柄 10月は例外もエラーログも出ていない。INFO レベルに 0/5 と出るだけなので、ログを眺めても異常に見えなかった。 原因:/xhr/ncp が404を返すようになった RakuScan が使っている yfinance 1.2.0 の get_news() はこうなっている。 yfinance 1.2.0 base.py(抜粋) url = f"{_ROOT_URL_}/xhr/ncp?queryRef={query_ref}&serviceKey=ncp_fin" payload = { "serviceConfig": { "snippetCount": count, "s": [self.ticker] } } data = self._data.post(url, body=payload) if data is None or "Will be right back" in data.text: raise YFDataException("* YAHOO! FINANCE IS CURRENTLY DOWN! *") try: data = data.json() except _json.JSONDecodeError: ... news = data.get("data", {}).get("tickerStream", {}).get("stream", []) Yahoo Finance 内部の /xhr/ncp に POST し、返ってきた JSON の data.tickerStream.stream をニュースとして返す。このエンドポイントを直接叩いてみた。 import yfinance as yf from yfinance.const import _ROOT_URL_ t = yf.Ticker("7203.T") for tk in ["7203.T", "AAPL"]: r = t._data.post( f"{_ROOT_URL_}/xhr/ncp?queryRef=latestNews&serviceKey=ncp_fin", body={"serviceConfig": {"snippetCount": 10, "s": [tk]}}, ) print(tk, r.status_code, r.headers.get("content-type")) print(len(t.history(period="5d"))) 7203.T 404 text/html AAPL 404 text/html 5 日本株も米国株も404になる。一方で history() は普通に5行返るので、Yahoo Finance 全体が落ちているわけではない。例外メッセージの「CURRENTLY DOWN」は実態と違う。 yfinance 本体にも、10月19日付けで同じ報告が上がっていた。 yfinance#3004 Issue によると、経緯はこうだ。 報告者の環境では10月16日まで動いていて、遅くとも10月19日から壊れた 最初は404の本文が {"message":"Not Found"} という 正しい JSON だった。そのため data.tickerStream.stream が見つからず、例外もログも出さずに [] を返していた 11月3日の追記によると、404の本文が HTML(<title>Yahoo</title>、本文に "Will be right back" を含む)に変わった。これで "Will be right back" in data.text の分岐に入り、CURRENTLY DOWN 例外が投げられるようになった 株価ページのニュース一覧は、別のエンドポイントからクライアント側で読み込む方式に変わったようだ、と報告されていた RakuScan のログでも、11月3日から例外に変わっている。この切り替わりは Issue の追記と日付まで一致する。 一方で、RakuScan は Issue が「まだ動いていた」とする10月5日〜16日の時点で、すでに0件だった。それより前のログは残っていないので、日本株で /xhr/ncp からニュースが取れていた時期があったのかは確認できない。少なくとも言えるのは「残っているログの範囲では一度も取れておらず、10月19日以降は確実に今回の廃止で取れない状態だった」ということだ。 対処1:yfinance 1.8.0 に上げる Issue は、11月3日(UTC)の yfinance 1.8.0 リリースと同時に close された。 github.com/ranaroussi/yfinance/releases/tag/1.8.0 1.8.0 の get_news() は中身が丸ごと書き換わっている。 yfinance 1.8.0 base.py(抜粋) lang, region = YfConfig.locale.lang, YfConfig.locale.region Cache per request: a different count, tab or locale is a different result cache_key = (count, list_name, lang, region) if cache_key in self._news: return self._news[cache_key] Same GraphQL request the quote news page makes since Yahoo retired /xhr/ncp slug = f"list=finance-{region}-{lang}-ticker-{list_name}" コメントにあるとおり、Yahoo が /xhr/ncp を廃止したことを受けて、株価ページ自身が使っている GraphQL リクエストに乗り換えている。キャッシュのキーにロケールが入っていることからも分かるとおり、ニュースはロケール単位で取得する 方式になった。 RakuScan の環境を汚さないよう、使い捨ての venv に 1.8.0 を入れて試した。 uv venv /tmp/yf18/.venv uv pip install --python /tmp/yf18/.venv/bin/python 'yfinance==1.8.0' import yfinance as yf for s in ["7203.T", "9984.T", "AAPL"]: news = yf.Ticker(s).get_news(count=5) print(s, len(news)) for a in news[:2]: c = a.get("content", {}) print(" ", c.get("pubDate"), "|", (c.get("title") or "")[:70]) 7203.T 5 2026-11-02T21:28:56Z | Earnings live updates: Airbnb stock jumps as Wall Street cheers 'growt... 2026-11-05T19:19:27Z | Toyota Motor (TM) Q2 2027 Earnings Call Transcript 9984.T 5 2026-11-05T19:34:20Z | SoftBank's $5.4 billion AI bet hits a stunning roadblock 2026-11-05T14:55:02Z | Stocks to Watch: Qualcomm, Zillow, Toyota, Airbnb AAPL 5 2026-11-06T00:19:40Z | Dow Jones Futures Fall; Nasdaq Dives 5.5%, Nvidia, Sandisk, CoreWeave, ... 2026-11-05T23:00:00Z | Apple, Alphabet, and Meta: 3 Big Takeaways from Recent Earnings 日本株でも取れるようになった。ただし、使う前に知っておきたい点が3つあった。 取れるのは英語ニュースだけ 1.8.0 の docstring には「Yahoo only has news for some locales; for others an empty list is returned.」とある。日本語ニュースが欲しくてロケールを日本に変えてみた。 yf.config.locale.lang = "ja-JP" yf.config.locale.region = "JP" print(len(yf.Ticker("7203.T").get_news(count=5))) # 0 少なくとも ja-JP / JP の組み合わせでは0件で、しかもエラーにならず黙って空リストが返った。日本語ニュースが存在しないのか、slug の形式が合っていないだけなのかまでは切り分けていない。日本株でも、実用上は US ロケールの英語ニュースを使うことになる。 銘柄と関係の薄い記事が混ざる トヨタ(7203.T)の先頭は「Airbnb の決算ライブ」だった。ソフトバンクグループ(9984.T)の2件目は、タイトルにソフトバンクが出てこない「Stocks to Watch: Qualcomm, Zillow, Toyota, Airbnb」だった。本文のどこかで触れてはいるのだろうが、その銘柄を主題にした記事ではない。見出しを LLM に渡すなら、関連の薄いノイズが混ざる前提で考えたほうがいい。 並び順は厳密な新着順ではなかった docstring には「newest first」とあり、リクエスト側にも # aboutnessWeight 0 ranks purely by recency というコメントがある。関連度は見ずに新しさだけで並べる設定で、関係の薄い記事が混ざるのもこのためだろう。ところが 7203.T では、11月2日の記事が11月5日の記事より前に来ていた。日付で使うなら、pubDate で並べ直したほうが安全だ。 レスポンス形式は「新形式」 1.8.0 が返すのは {"id": ..., "content": {...}} の形で、content の中に title / pubDate / canonicalUrl が入る。RakuScan の news_fetcher.py は、最初から新旧どちらの形式も読めるようにしてあったので、パーサは書き換えずに済む。 src/data/news_fetcher.py(抜粋) def _extract_news_item(item: dict) -> dict | None: 新形式: {"content": {"title": ..., "pubDate": ..., "canonicalUrl": ...}} content = item.get("content", {}) if content: title = content.get("title", "") pub_date = content.get("pubDate", "") url = ( content.get("canonicalUrl", {}).get("url", "") or content.get("clickThroughUrl", {}).get("url", "") ) else: 旧形式: {"title": ..., "link": ..., "providerPublishTime": ...} title = item.get("title", "") ... 対処2:1.8.0 に上げられないなら yf.Search Issue のコメントでは、ニュース自体は yf.Search(...).news で取れると報告されていた。1.2.0 のまま試してみた。 for q in ["7203.T", "9984.T", "Toyota"]: news = yf.Search(q, news_count=5).news print(q, len(news)) 7203.T 0 9984.T 0 Toyota 5 ティッカー(7203.T)で検索すると0件だった。英語の社名(Toyota)なら5件返る。しかもこちらは 旧形式(title / link / providerPublishTime がトップレベル)で返ってくる。旧形式も _extract_news_item で読めるのでパーサはそのまま使えるが、日本株で使うなら銘柄コードから英語社名への対応表が必要になる。暫定策としては使えるが、素直に 1.8.0 に上げるほうが楽だ。 なお RakuScan は、この記事を書いている時点ではまだ 1.2.0 のままだ。1.2.0 から 1.8.0 まではマイナーバージョンが6つ離れていて、ニュース以外の取得系にも変更が入っている。上げる前に、以前書いた yfinance の落とし穴で挙げた株価・財務データの取得を一通り確認するつもりでいる。 1か月気づかなかった理由 不具合そのものは yfinance と Yahoo の都合だが、1か月気づかなかったのは設計側の問題だ。 例外を銘柄単位で握りつぶしている。fetch_news() は銘柄ごとに except Exception で WARNING を出して次へ進む。10月は例外すら出ていなかったので、WARNING も出ていない 「0件」を INFO で流している。ニュース取得完了: 0/5 銘柄 は、たまたまその日の上位銘柄にニュースがなかった場合とまったく同じ見た目になる 下流が空でも普通に動く。Claude は recent_news フィールドがなくても、テクニカルや財務の結果だけでもっともらしいレポートを書く。出力を見ても、ニュースが欠けていることは分からない 「補助データなので失敗しても止めない」と「失敗に気づける」は両立できる。止めずに、連続して失敗していることだけを通知すればいい。たとえば、こんなガードを足すのが現実的だと考えている。 案:N営業日連続で全銘柄0件なら通知する hit = sum(1 for s in top_symbols if s in news_by_symbol) if not top_symbols: pass # 対象0銘柄の日(0/0)は判定しない elif hit == 0: streak = news_zero_streak.increment() # DB等に連続回数を保存 if streak >= 3: _notify_error( "daily_run: ニュースが3回連続で0件", "yfinance のニュース取得系が壊れている可能性あり", ) else: news_zero_streak.reset() 1日だけの0件は普通にありうるので、連続回数で判定する。スクリーニングがスキップされて対象が0銘柄の日は、カウントを進めもリセットもしない。非公式 API に頼る補助データは、こうした「黙って0件」がいちばん見つけにくい。前述の yfinance の落とし穴の記事でも、ブロック時に例外ではなく空の DataFrame が返る問題を書いた。今回のニュースも同じ種類の壊れ方だった。 まとめ get_news() が空、または YAHOO! FINANCE IS CURRENTLY DOWN! になるのは、Yahoo が落ちているからではない。/xhr/ncp が廃止されたのが原因で、history() などほかの取得系は動いている yfinance 1.8.0(2026-11-03)に上げれば直る。ただし取れるのは英語ニュースだけで、無関係な記事も混ざり、並び順も厳密な新着順ではない 上げられない場合は yf.Search で取れる。ただし日本株はティッカーではヒットせず、英語社名での検索が必要になる 1.8.0 も、"Will be right back" が本文に含まれるかどうかで障害を判定する作りは変わっていない。次に Yahoo 側が変わったときも、同じ誤報が出る可能性がある 非公式 API の補助データは「黙って0件」で壊れる。止めない設計にするなら、連続0件を検知して通知する仕組みをセットで入れておきたい

  2. yfinanceのget_newsが空・CURRENTLY DOWNになる原因と対処【2026年11月】 3 行まとめ - 2026年10月中旬から、yfinance の Ticker.news / get_news() は全銘柄で空リストを返すようになった(yfinance の Issue による)。11月3日ごろからは YFDataException: *** YAHOO! FINANCE IS CURRENTLY DOWN! *** を投げる。Yahoo Finance が落ちているわけではなく、ニュース取得に使っていた /xhr/ncp エンドポイントが廃止されたのが原因 - 11月3日リリースの yfinance 1.8.0 で、取得先が株価ページと同じ GraphQL に切り替わった。日本株(7203.T など)でも手元で5件ずつ取れた。ただし取れるのは英語ニュースだけで、ロケールを日本に変えると0件になる - 自作の投資分析ツールでは、残っているログの1か月分すべてで Claude にニュースが1件も渡っていなかった。例外を握りつぶして 0/5 銘柄 を INFO ログに流すだけの作りだったため、気づけなかった --- 何が起きたか:ログに「0/5 銘柄」が並んでいた 自作の投資分析ツール(RakuScan)は、平日の16時にスクリーニングを回し、上位5銘柄のニュース見出しを yfinance で取ってから Claude に統合分析させている。ニュース取得の部分はこうなっている。 # scripts/daily_run.py(抜粋) top_symbols = [r["symbol"] for r in top_results] try: from src.data.news_fetcher import fetch_news news_by_symbol = fetch_news(top_symbols) enriched = [] for r in top_results: entry = dict(r) news = news_by_symbol.get(r["symbol"], []) if news: entry["recent_news"] = [n["title"] for n in news] enriched.append(entry) logger.info( "ニュース取得完了: %d/%d 銘柄", sum(1 for s in top_symbols if s in news_by_symbol), len(top_symbols), ) except Exception as e: logger.warning("ニュース取得失敗(ニュースなしで続行): %s", e) enriched = top_results ニュースが取れなくても分析は止めない設計にしている。ニュースは補助情報なので、この判断自体は間違っていないと思う。 ところが記事のネタ探しでログを見直したら、こうなっていた。 2026-10-05 16:14:21 [INFO] __main__: ニュース取得完了: 0/5 銘柄 2026-10-06 16:15:55 [INFO] __main__: ニュース取得完了: 0/5 銘柄 ... 2026-10-30 16:15:06 [INFO] __main__: ニュース取得完了: 0/5 銘柄 2026-11-02 16:13:42 [INFO] __main__: ニュース取得完了: 0/5 銘柄 2026-11-03 16:14:56 [WARNING] src.data.news_fetcher: ニュース取得エラー (symbol=xxxx): *** YAHOO! FINANCE IS CURRENTLY DOWN! *** 2026-11-03 16:14:56 [INFO] __main__: ニュース取得完了: 0/5 銘柄 残っているログは10月5日以降の分だけだが、その範囲では 23回の実行すべてが 0/5 だった(11月5日はスクリーニング自体がスキップされて 0/0)。しかも10月と11月で壊れ方が違う。 | 期間 | 挙動 | ログ | |---|---|---| | 10月(残存ログの範囲) | 例外なし・空リスト | INFO の 0/5 銘柄 だけ | | 11月3日〜 | YFDataException | 銘柄ごとに WARNING+0/5 銘柄 | 10月は例外もエラーログも出ていない。INFO レベルに 0/5 と出るだけなので、ログを眺めても異常に見えなかった。 原因:/xhr/ncp が404を返すようになった RakuScan が使っている yfinance 1.2.0 の get_news() はこうなっている。 # yfinance 1.2.0 base.py(抜粋) url = f"{_ROOT_URL_}/xhr/ncp?queryRef={query_ref}&serviceKey=ncp_fin" payload = { "serviceConfig": { "snippetCount": count, "s": [self.ticker] } } data = self._data.post(url, body=payload) if data is None or "Will be right back" in data.text: raise YFDataException("*** YAHOO! FINANCE IS CURRENTLY DOWN! ***") try: data = data.json() except _json.JSONDecodeError: ... news = data.get("data", {}).get("tickerStream", {}).get("stream", []) Yahoo Finance 内部の /xhr/ncp に POST し、返ってきた JSON の data.tickerStream.stream をニュースとして返す。このエンドポイントを直接叩いてみた。 import yfinance as yf from yfinance.const import _ROOT_URL_ t = yf.Ticker("7203.T") for tk in ["7203.T", "AAPL"]: r = t._data.post( f"{_ROOT_URL_}/xhr/ncp?queryRef=latestNews&serviceKey=ncp_fin", body={"serviceConfig": {"snippetCount": 10, "s": [tk]}}, ) print(tk, r.status_code, r.headers.get("content-type")) print(len(t.history(period="5d"))) 7203.T 404 text/html AAPL 404 text/html 5 日本株も米国株も404になる。一方で history() は普通に5行返るので、Yahoo Finance 全体が落ちているわけではない。例外メッセージの「CURRENTLY DOWN」は実態と違う。 yfinance 本体にも、10月19日付けで同じ報告が上がっていた。 yfinance#3004 Issue によると、経緯はこうだ。 - 報告者の環境では10月16日まで動いていて、遅くとも10月19日から壊れた - 最初は404の本文が {"message":"Not Found"} という 正しい JSON だった。そのため data.tickerStream.stream が見つからず、例外もログも出さずに [] を返していた - 11月3日の追記によると、404の本文が HTML(<title>Yahoo</title>、本文に "Will be right back" を含む)に変わった。これで "Will be right back" in data.text の分岐に入り、CURRENTLY DOWN 例外が投げられるようになった - 株価ページのニュース一覧は、別のエンドポイントからクライアント側で読み込む方式に変わったようだ、と報告されていた RakuScan のログでも、11月3日から例外に変わっている。この切り替わりは Issue の追記と日付まで一致する。 一方で、RakuScan は Issue が「まだ動いていた」とする10月5日〜16日の時点で、すでに0件だった。それより前のログは残っていないので、日本株で /xhr/ncp からニュースが取れていた時期があったのかは確認できない。少なくとも言えるのは「残っているログの範囲では一度も取れておらず、10月19日以降は確実に今回の廃止で取れない状態だった」ということだ。 対処1:yfinance 1.8.0 に上げる Issue は、11月3日(UTC)の yfinance 1.8.0 リリースと同時に close された。 github.com/ranaroussi/yfinance/releases/tag/1.8.0 1.8.0 の get_news() は中身が丸ごと書き換わっている。 # yfinance 1.8.0 base.py(抜粋) lang, region = YfConfig.locale.lang, YfConfig.locale.region # Cache per request: a different count, tab or locale is a different result cache_key = (count, list_name, lang, region) if cache_key in self._news: return self._news[cache_key] # Same GraphQL request the quote news page makes since Yahoo retired /xhr/ncp slug = f"list=finance-{region}-{lang}-ticker-{list_name}" コメントにあるとおり、Yahoo が /xhr/ncp を廃止したことを受けて、株価ページ自身が使っている GraphQL リクエストに乗り換えている。キャッシュのキーにロケールが入っていることからも分かるとおり、ニュースはロケール単位で取得する 方式になった。 RakuScan の環境を汚さないよう、使い捨ての venv に 1.8.0 を入れて試した。 uv venv /tmp/yf18/.venv uv pip install --python /tmp/yf18/.venv/bin/python 'yfinance==1.8.0' import yfinance as yf for s in ["7203.T", "9984.T", "AAPL"]: news = yf.Ticker(s).get_news(count=5) print(s, len(news)) for a in news[:2]: c = a.get("content", {}) print(" ", c.get("pubDate"), "|", (c.get("title") or "")[:70]) 7203.T 5 2026-11-02T21:28:56Z | Earnings live updates: Airbnb stock jumps as Wall Street cheers 'growt... 2026-11-05T19:19:27Z | Toyota Motor (TM) Q2 2027 Earnings Call Transcript 9984.T 5 2026-11-05T19:34:20Z | SoftBank's $5.4 billion AI bet hits a stunning roadblock 2026-11-05T14:55:02Z | Stocks to Watch: Qualcomm, Zillow, Toyota, Airbnb AAPL 5 2026-11-06T00:19:40Z | Dow Jones Futures Fall; Nasdaq Dives 5.5%, Nvidia, Sandisk, CoreWeave, ... 2026-11-05T23:00:00Z | Apple, Alphabet, and Meta: 3 Big Takeaways from Recent Earnings 日本株でも取れるようになった。ただし、使う前に知っておきたい点が3つあった。 取れるのは英語ニュースだけ 1.8.0 の docstring には「Yahoo only has news for some locales; for others an empty list is returned.」とある。日本語ニュースが欲しくてロケールを日本に変えてみた。 yf.config.locale.lang = "ja-JP" yf.config.locale.region = "JP" print(len(yf.Ticker("7203.T").get_news(count=5))) # 0 少なくとも ja-JP / JP の組み合わせでは0件で、しかもエラーにならず黙って空リストが返った。日本語ニュースが存在しないのか、slug の形式が合っていないだけなのかまでは切り分けていない。日本株でも、実用上は US ロケールの英語ニュースを使うことになる。 銘柄と関係の薄い記事が混ざる トヨタ(7203.T)の先頭は「Airbnb の決算ライブ」だった。ソフトバンクグループ(9984.T)の2件目は、タイトルにソフトバンクが出てこない「Stocks to Watch: Qualcomm, Zillow, Toyota, Airbnb」だった。本文のどこかで触れてはいるのだろうが、その銘柄を主題にした記事ではない。見出しを LLM に渡すなら、関連の薄いノイズが混ざる前提で考えたほうがいい。 並び順は厳密な新着順ではなかった docstring には「newest first」とあり、リクエスト側にも # aboutnessWeight 0 ranks purely by recency というコメントがある。関連度は見ずに新しさだけで並べる設定で、関係の薄い記事が混ざるのもこのためだろう。ところが 7203.T では、11月2日の記事が11月5日の記事より前に来ていた。日付で使うなら、pubDate で並べ直したほうが安全だ。 レスポンス形式は「新形式」 1.8.0 が返すのは {"id": ..., "content": {...}} の形で、content の中に title / pubDate / canonicalUrl が入る。RakuScan の news_fetcher.py は、最初から新旧どちらの形式も読めるようにしてあったので、パーサは書き換えずに済む。 # src/data/news_fetcher.py(抜粋) def _extract_news_item(item: dict) -> dict | None: # 新形式: {"content": {"title": ..., "pubDate": ..., "canonicalUrl": ...}} content = item.get("content", {}) if content: title = content.get("title", "") pub_date = content.get("pubDate", "") url = ( content.get("canonicalUrl", {}).get("url", "") or content.get("clickThroughUrl", {}).get("url", "") ) else: # 旧形式: {"title": ..., "link": ..., "providerPublishTime": ...} title = item.get("title", "") ... 対処2:1.8.0 に上げられないなら yf.Search Issue のコメントでは、ニュース自体は yf.Search(...).news で取れると報告されていた。1.2.0 のまま試してみた。 for q in ["7203.T", "9984.T", "Toyota"]: news = yf.Search(q, news_count=5).news print(q, len(news)) 7203.T 0 9984.T 0 Toyota 5 ティッカー(7203.T)で検索すると0件だった。英語の社名(Toyota)なら5件返る。しかもこちらは 旧形式(title / link / providerPublishTime がトップレベル)で返ってくる。旧形式も _extract_news_item で読めるのでパーサはそのまま使えるが、日本株で使うなら銘柄コードから英語社名への対応表が必要になる。暫定策としては使えるが、素直に 1.8.0 に上げるほうが楽だ。 なお RakuScan は、この記事を書いている時点ではまだ 1.2.0 のままだ。1.2.0 から 1.8.0 まではマイナーバージョンが6つ離れていて、ニュース以外の取得系にも変更が入っている。上げる前に、以前書いた yfinance の落とし穴で挙げた株価・財務データの取得を一通り確認するつもりでいる。 1か月気づかなかった理由 不具合そのものは yfinance と Yahoo の都合だが、1か月気づかなかったのは設計側の問題だ。 1. 例外を銘柄単位で握りつぶしている。fetch_news() は銘柄ごとに except Exception で WARNING を出して次へ進む。10月は例外すら出ていなかったので、WARNING も出ていない 2. 「0件」を INFO で流している。ニュース取得完了: 0/5 銘柄 は、たまたまその日の上位銘柄にニュースがなかった場合とまったく同じ見た目になる 3. 下流が空でも普通に動く。Claude は recent_news フィールドがなくても、テクニカルや財務の結果だけでもっともらしいレポートを書く。出力を見ても、ニュースが欠けていることは分からない 「補助データなので失敗しても止めない」と「失敗に気づける」は両立できる。止めずに、連続して失敗していることだけを通知すればいい。たとえば、こんなガードを足すのが現実的だと考えている。 # 案:N営業日連続で全銘柄0件なら通知する hit = sum(1 for s in top_symbols if s in news_by_symbol) if not top_symbols: pass # 対象0銘柄の日(0/0)は判定しない elif hit == 0: streak = news_zero_streak.increment() # DB等に連続回数を保存 if streak >= 3: _notify_error( "daily_run: ニュースが3回連続で0件", "yfinance のニュース取得系が壊れている可能性あり", ) else: news_zero_streak.reset() 1日だけの0件は普通にありうるので、連続回数で判定する。スクリーニングがスキップされて対象が0銘柄の日は、カウントを進めもリセットもしない。非公式 API に頼る補助データは、こうした「黙って0件」がいちばん見つけにくい。前述の yfinance の落とし穴の記事でも、ブロック時に例外ではなく空の DataFrame が返る問題を書いた。今回のニュースも同じ種類の壊れ方だった。 まとめ - get_news() が空、または YAHOO! FINANCE IS CURRENTLY DOWN! になるのは、Yahoo が落ちているからではない。/xhr/ncp が廃止されたのが原因で、history() などほかの取得系は動いている - yfinance 1.8.0(2026-11-03)に上げれば直る。ただし取れるのは英語ニュースだけで、無関係な記事も混ざり、並び順も厳密な新着順ではない - 上げられない場合は yf.Search で取れる。ただし日本株はティッカーではヒットせず、英語社名での検索が必要になる - 1.8.0 も、"Will be right back" が本文に含まれるかどうかで障害を判定する作りは変わっていない。次に Yahoo 側が変わったときも、同じ誤報が出る可能性がある - 非公式 API の補助データは「黙って0件」で壊れる。止めない設計にするなら、連続0件を検知して通知する仕組みをセットで入れておきたい --- > この記事は Zenn にも同じ内容を投稿しています。

  3. Sources: Yahoo Terms of Service (legal.yahoo.com) · Yahoo Finance data providers (help.yahoo.com) · yfinance legal disclaimer (ranaroussi/yfinance) · hiQ v LinkedIn consent judgment, Dec 2022 · Craigslist v RadPad judgment, Apr 2017 · Copyright and Rights in Databases Regulations 1997 (legislation.gov.uk)

    1 like · 10 views
  4. QuantStats performs portfolio profiling. This helps quants and portfolio managers understand their performance better. Grab it here on GitHub: ranaroussi/quantstats

    1 like · 393 views
  5. the free option chains come from yfinance (quotes can be delayed, which is why step 4 exists): ranaroussi/yfinance

    1 view
  6. yfinance Data for stocks (historic, intraday, fundamental), FX, crypto, and options. Uses Yahoo Finance so any data available through Yahoo is available through yfinance. ranaroussi/yfinance

    221 views
  7. Free Financial Data APIs for Backtesting: An Honest Comparison Free financial data can support serious backtesting—but only if the source matches the question. A price-momentum test needs historical prices and corporate-action handling. A macro strategy needs revision-aware economic series. A fundamental strategy needs values as investors actually knew them on each historical date. Those are different data problems. This guide compares SEC EDGAR, yfinance, Stooq, FRED, Alpha Vantage’s free tier, and Tradevo Data’s public proof pack. The goal is not to declare one winner. It is to show where each source may be useful, where it can fail, and whether it is point-in-time safe for the intended test. The short answer - SEC EDGAR: a free primary source for US filings, but substantial engineering is required to produce clean point-in-time panels. - yfinance: convenient for exploration and price-data prototypes, but do not assume every historical or fundamental field is point-in-time safe. - Stooq: potentially useful for accessible market-history research; validate adjustments, symbols, and coverage before relying on it. - FRED: useful for macroeconomic research, with ALFRED often the better choice when historical revisions matter. - Alpha Vantage free tier: convenient packaged APIs for prototypes; check current limits, history, adjustment rules, and PIT behavior in its documentation. - Tradevo Data: an honest budget-tier option for research-grade point-in-time US equity fundamentals, with a free public proof pack and a paid API. It is not a broad market-data terminal and does not cover prices, non-US companies, or delisted companies. Comparison table | Source | Best for | Free access | Point-in-time-safe? | Main caveat | |---|---|---:|---|---| | SEC EDGAR | Primary US filing data | Yes | Potentially, if modeled by public filing date | Raw filings, amendments, tags, units, fiscal periods, and issuer history require careful processing | | yfinance | Fast price-data exploration and notebooks | Yes | Not automatically | A convenient interface does not itself prove that historical fundamentals were available on the simulated date | | Stooq | Downloadable market history and prototyping | Yes | Depends on field and methodology | Verify corporate-action adjustments, survivorship, identifiers, and coverage | | FRED / ALFRED | Macroeconomic and rate series | Yes | FRED latest values: not necessarily; ALFRED vintages: potentially suitable | Release lags and revisions must be modeled explicitly | | Alpha Vantage | Packaged market and fundamental APIs | Free tier available | Do not assume | Check current limits, output history, adjustment methods, and filing-time semantics | | Tradevo Data proof pack | Inspecting PIT US fundamentals and methodology | Yes | Designed for PIT research | Small proof pack: 5 companies, latest 3 fiscal years, and 225 rows | | Tradevo Data API | Budget-tier PIT US equity fundamentals | Card-backed 7-day trial; renews at $29/mo unless canceled | Uses first_filed <= as_of | No prices, TTM, non-US, delisted, or Parquet coverage | “Point-in-time-safe” is not a permanent badge attached to a vendor. It depends on the field, timestamp, revision policy, universe construction, and how your backtest queries the data. 1. SEC EDGAR: a free primary source SEC EDGAR is a primary source when you need US company disclosures. The underlying filing data is public domain, and publication information can be used to determine when facts became public. That does not make an EDGAR download immediately backtest-ready. You still need to handle: - original filings and amendments; - company and ticker identity changes; - XBRL concepts that vary across issuers; - duplicate facts, units, dimensions, and contexts; - annual, quarterly, year-to-date, and instant-period distinctions; - fiscal calendars and restatements; - publication-time cutoffs; - QA and reproducible snapshots. EDGAR can support point-in-time research because publication events are available. Your resulting database is PIT-safe only if your transformation preserves and models them correctly. When EDGAR wins Build directly from EDGAR when you need custom tags, filing text, footnotes, dimensions, forms outside a standardized dataset, or complete control over methodology. It may also win when cash cost matters more than engineering time. For background, see point-in-time fundamentals data. 2. yfinance: convenient, with limited guarantees yfinance is popular because it makes exploratory work easy. It can be useful for pulling historical prices, testing notebook logic, checking symbols, or building a first-pass prototype. The risk is treating interface convenience as evidence of point-in-time correctness. For price backtests, inspect whether you use adjusted or unadjusted prices and how dividends and splits are represented. For fundamental backtests, ask whether a field is today’s reconstructed history or the value actually available on the simulated date. If the source does not expose publication timestamps and revision vintages, do not infer PIT behavior. When yfinance wins It may win when speed and accessibility matter more than contractual or PIT guarantees: teaching, exploratory analysis, rough price-based prototypes, and sanity checks. If your strategy does not depend on historical accounting vintages, a specialized PIT fundamentals product may be unnecessary. 3. Stooq: practical market history with validation required Stooq offers accessible historical market data and may be useful for research prototypes. Its downloads can be attractive when you want to get a price-based test running without building an ingestion system. As with any market-history source, validate the exact dataset you consume. Questions include: - Are prices adjusted, and for which corporate actions? - Are delisted securities represented? - How stable are symbols and identifiers? - What are the timezone and session conventions? - Does your universe introduce survivorship bias? Historical prices avoid some accounting-publication issues, but they do not automatically solve corporate-action, delisting, or universe bias. When Stooq wins It may win for low-cost price research, cross-checking, and prototypes where its available markets and conventions fit your design. Review its documentation and test known events before committing to a production pipeline. 4. FRED and ALFRED: consider vintages for macro backtests FRED is a widely used free source for economic and financial series. It can support research involving rates, inflation, labor, production, and other macro variables. The central backtesting trap is revision history. Today’s value for a historical month may not equal the value investors saw at the time. Economic releases can be revised repeatedly. ALFRED preserves vintages for many series, making it potentially more appropriate when a strategy responds to what was known on a historical date. You must still model release timing. A value labeled for one month may have been published later. When FRED or ALFRED wins They may win for macro signals rather than equity-fundamentals research. Consider ALFRED vintages where revisions could affect the result; standard FRED data may be sufficient when latest-revised history is explicitly what you want. 5. Alpha Vantage: packaged APIs for quick prototypes Alpha Vantage packages multiple categories of financial data behind documented endpoints and offers a free tier. That may reduce setup work compared with normalizing multiple sources. Before using it in a backtest, see its pricing page and documentation. Confirm current request limits, historical depth, corporate-action treatment, field definitions, and whether fundamental values are tied to filing-availability dates. A reported fiscal-period end is not an availability date. Joining a December year-end value to December prices can leak information from a filing published later. When Alpha Vantage wins It may win when you want one packaged interface, modest prototype volume, or data categories outside a narrow PIT fundamentals product. Evaluate each endpoint separately rather than assuming one methodology applies across the service. 6. Tradevo Data: inspect the free PIT proof pack first Tradevo Data provides point-in-time US equity fundamentals from SEC EDGAR public-domain data. The public GitHub proof pack contains 5 companies, their latest 3 fiscal years, 225 rows, and the full methodology, with no signup. Each row includes: - first_filed: the date the value became public; - original_value: the first-reported PIT-safe value; - latest_value: the current revision; - a restatement flag for changes greater than 0.5% on the same tag, including amendments; - qa_status. The annual dataset contains 632,466 point-in-time rows across 5,168 US companies, 16 annual concepts, up to 12 fiscal years, and 37,804 labeled restatements. The concepts are Revenue, NetIncome, Assets, StockholdersEquity, OperatingCashFlow, EPSDiluted, DilutedShares, GrossProfit, OperatingIncome, PretaxIncome, IncomeTaxExpense, CapitalExpenditures, CashAndCashEquivalents, CurrentAssets, CurrentLiabilities, and NetPPE. Quarterly coverage includes 1,089,635 rows across 5,382 companies and 7 quarterly concepts. Q4 is reported where tagged or derived and labeled where supported. Derived Q4 EPS and shares are not provided. The JSON endpoint is: /v1/fundamentals?ticker&as_of[&concept][&period=annual|quarterly] Annual is the default period. The server applies first_filed <= as_of, inclusive on the date. This addresses one common form of lookahead bias in fundamental backtests, but users must still handle matters such as trading-session timing and universe construction. The card-backed 7-day free trial covers 10 companies, a rolling 3-year history, and 100 requests per day, with no bulk. It renews at $29/mo unless canceled. Pro provides complete available history, 5,000 requests per day, and bulk access through /v1/download and /v1/snapshot?as_of, each with period=annual|quarterly. Parquet is not included. This is intentionally narrower than many alternatives: no price data, TTM, non-US companies, or delisted-company coverage. Review the free proof pack before considering the API: christianpichichero-max/pit-fundamentals tradevodata.com Documentation: tradevodata.com When Tradevo Data wins It may win when you want standardized point-in-time US equity fundamentals, server-side historical-date filtering, restatement fields, and JSON bulk access without building an EDGAR normalization pipeline. It does not win when you need prices, filing text, custom XBRL tags, TTM metrics, non-US or delisted coverage, Parquet, or a broader multi-asset platform. Point-in-time safety checklist Whatever source you choose, ask: 1. What was known? Is the value original, latest-restated, or unspecified? 2. When was it known? Use a publication or filing date, not merely a fiscal-period end. 3. Was the date available intraday? Daily backtests may need a next-session rule. 4. Was the security in the universe then? A current constituent list creates survivorship bias. 5. How were prices adjusted? Splits, dividends, and symbol changes can alter results. 6. Are revisions preserved? This matters for both company fundamentals and macro data. 7. Can you reproduce a snapshot? Save raw responses, query dates, documentation versions, and code. When to build it yourself Build your own pipeline when your research requires data no standardized product exposes, when you need auditable transformation control, or when ongoing engineering is part of your process. For EDGAR fundamentals, expect work involving taxonomy mapping, amendment handling, fiscal-period inference, duplicate resolution, QA, identity history, and refresh monitoring. “Free data” means no license fee; it does not mean zero cost. Do not assume that easy ingestion makes a dataset PIT-safe. The difficult work is establishing that every historical row was available when your simulation says it was. A practical selection rule Choose the narrowest source that answers your research question honestly: - price prototype: yfinance or Stooq may be enough; - macro strategy: consider FRED, or ALFRED when revisions matter; - custom US filing research: build from SEC EDGAR; - packaged multi-category prototype: evaluate Alpha Vantage endpoint by endpoint; - standardized PIT US fundamentals: inspect Tradevo Data’s free proof pack, then compare its API with credible alternatives such as Sharadar, Tiingo, and QuantConnect. See each provider’s pricing page and documentation. No vendor removes the need for validation. A defensible backtest starts with explicit assumptions about availability, revisions, adjustments, and universe membership—not with the prettiest API response. Not investment advice. Verify current competitor features, documentation, and pricing on each provider’s website.

  8. 2. Pull clean price data Use a real data source (even free to start). If your data is messy, your results are fiction. Do it with this (free): yfinance ranaroussi/yfinance

    3 likes · 225 views
  9. YouTube · · YouTube description · The AI Index · ranaroussi/yfinance

    Top 10 Trading Repositories on GitHub (October 2026 Update) Every trading platform you can buy is competing with something free on GitHub. These are the ten open-source repositories actually worth your weekend — ranked by maintenance, documentation, honesty about performance and live-trading support, not by stars alone. Star counts, licences, release dates and last-commit dates are all live as of October 2026. ⏱️ CHAPTERS 00:00 The best trading software is free 00:47 How we ranked 17 repositories (the five-point test) 01:30 #10 FinRL — deep reinforcement learning for trading 02:17 #09 Hummingbot — market making and execution 03:01 #08 LEAN Engine — QuantConnect's institutional engine 03:43 #07 yfinance — the market data layer 04:25 #06 NautilusTrader — Rust core, Python API 05:07 #05 CCXT — one API for 100+ exchanges 05:53 #04 VeighNa (vnpy) — full platform with an ML module 06:40 #03 Qlib — Microsoft's AI quant research platform 07:25 #02 freqtrade — the retail crypto bot standard 08:15 #01 OpenBB — the biggest finance repo on GitHub 09:03 The 2026 open-source stack (how they fit together) 09:49 Rules before you clone anything 🔗 ALL TEN REPOSITORIES 1. OpenBB — 74.0k stars · Apache-2.0 — OpenBB-finance/OpenBB 2. freqtrade — 55.2k stars · GPL-3.0 — freqtrade/freqtrade 3. Qlib — 49.2k stars · MIT — microsoft/qlib 4. VeighNa (vnpy) — 45.8k stars · MIT — vnpy/vnpy 5. CCXT — 44.3k stars · MIT — ccxt/ccxt 6. NautilusTrader — 29.8k stars · LGPL-3.0 — nautechsystems/nautilus_trader 7. yfinance — 25.5k stars · Apache-2.0 — ranaroussi/yfinance 8. LEAN Engine — 21.9k stars · Apache-2.0 — QuantConnect/Lean 9. Hummingbot — 20.4k stars · Apache-2.0 — hummingbot/hummingbot 10. FinRL — 16.6k stars · MIT — AI4Finance-Foundation/FinRL ❌ WHAT DID NOT MAKE IT backtrader (23.4k stars) still has not been touched since April 2023, so it is out despite the star count. Indicator and backtesting libraries — TA-Lib, vectorbt, jesse, StockSharp — are honourable mentions rather than full systems. 🧪 HOW WE RANKED THEM 1. Is it maintained? (last commit + release cadence — this alone removed a famous library) 2. Can you run it this weekend? (install docs, Docker, a tutorial that ends in a working strategy) 3. Is it honest about performance? (fees and slippage modelled, overfitting warnings in the docs) 4. Does it trade live, or is it a research toy? 5. Is there a community behind it? (contributors, merged PRs, answered issues) ⚠️ THREE RULES BEFORE YOU CLONE 1. Backtests lie by default — fees, slippage, look-ahead bias and overfitting. Test on data your model has never seen. 2. Paper trade first. Freqtrade's own docs say dry-run for a month; that applies to every repo here. 3. Check the licence before you build a business on it. These range from MIT and Apache to GPL and LGPL. Nothing in this video is financial advice. These are educational, open-source tools and most of them can lose money quickly. Which repository are you cloning first? Tell me in the comments. #Trading #OpenSource #GitHub

    56 likes · 1 comment · 2,559 views

Achievements

Awards earned by the repositories ranaroussi owns. Select an award to embed its badge.

No awards yet

Repositories earn awards by reaching the top three in a completed trending day or week.

A repository earns an award for finishing first, second or third in a completed trending day or week, ranked by new stars, new forks or pull request authors. Awards follow a repository through renames and transfers and count toward its current owner. Weeks run Monday to Sunday, UTC.