雅虎财经网址无效 [英] Yahoo Finance URL not working

查看:133
本文介绍了雅虎财经网址无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用以下 URL 从 yahoo Finance 获取历史数据已经有一段时间了,但它从昨天开始就停止工作了.

https://ichart.finance.yahoo.com/table.csv?s=间谍

浏览此网站时,它说:

<块引用>

马上回来...

感谢您的耐心等待.

我们的工程师正在迅速解决问题.

但是,从昨天开始这个问题仍然存在,我开始认为他们停止了这项服务?

我的 SO 搜索仅将我指向 这个话题,虽然与https有关...

还有其他人遇到过这个问题吗?我该如何解决这个问题?他们是否提供对历史数据的不同访问?

解决方案

Yahoo 已经采用 Reactjs 前端,这意味着如果您分析从客户端到后端的请求标头,您可以获得他们用于填充的实际 JSON客户端商店.

主持人:

如果您打算使用代理或持久连接,请使用 query2.finance.yahoo.com.但就本文而言,用于示例 URL 的主机并不意味着暗示它所使用的路径的任何信息.


基本数据

(用你的符号代替:AAPL)

  • /v10/finance/quoteSummary/AAPL?modules=

?modules= 查询的输入:

 ['资产配置文件','摘要简介','摘要详细信息','esgScores','价钱','收入报表历史','收入报表历史季度','资产负债表历史','资产负债表历史季度','现金流量表历史','现金流量报表历史季度','默认密钥统计','财务数据','日历事件','secFilings','推荐趋势','升级降级历史','机构所有权','资金所有权','主要直接持有人','主要股东明细','内幕交易','内幕持有人','netSharePurchaseActivity','收益','收益历史','收益趋势','行业趋势','指数趋势','行业趋势']

示例网址:查询上述所有模块

  • https://query2.finance.yahoo.com/v10/finance/quoteSummary/AAPL?modules=assetProfile%2CsummaryProfile%2CsummaryDetail%2CesgScores%2Cprice%2CincomeStatementHistory%2CincomeStatementHistoryQuarterly%2CbalanceCashionSheetlycstory%2CsummaryProfile%2CsummaryDetail2CdefaultKeyStatistics%2CfinancialData%2CcalendarEvents%2CsecFilings%2CrecommendationTrend%2CupgradeDowngradeHistory%2CinstitutionOwnership%2CfundOwnership%2CmajorDirectHolders%2CmajorHoldersBreakdown%2CinsiderTransactions%2CinsiderHolders%2CnetSharePurchaseActivity%2Cearnings%2CearningsHistory%2CearningsTrend%2CindustryTrend%2CindexTrend%2CsectorTrend

%2C, 的十六进制表示,需要插入到你请求的每个模块之间.有关十六进制编码位的详细信息(如果您关心)


期权合约

  • /v7/finance/options/AAPL(当前到期)
  • /v7/finance/options/AAPL?date=1679011200(2023 年 3 月 17 日到期)

示例网址:

  • https://query2.finance.yahoo.com/v7/finance/options/AAPL(当前到期)
  • https://query2.finance.yahoo.com/v7/finance/options/AAPL?date=1679011200(2023 年第 17 场比赛到期)

可以在 ?date= 查询中使用任何以 UNIX 时间戳表示的有效未来到期时间.如果您查询当前到期时间,JSON 响应将包含可在 ?date= 查询中使用的所有有效到期时间的列表.(这是一篇解释转换人类可读日期的帖子到 Python 中的 UNIX 时间戳)


价格

  • /v8/finance/chart/AAPL?symbol=AAPL&period1=0&period2=9999999999&interval=3mo

&interval= 的可能输入: 1m、5m、15m、30m、90m、1h、1d、5d、1wk、1mo、3mo

<块引用>

m (minute) 间隔限制为 30 天,period1period2 最多跨越 7 天每/请求.超过这些限制中的任何一个都会导致错误并且不会舍入

<块引用>

h (hour) 间隔限制为 730 天,跨度没有限制.超过此值将导致错误并且不会舍入

period1=:您希望开始的日期的 UNIX 时间戳表示.

<块引用>

d (day), wk (week), mo <值小于初始交易日的 em>(month) 区间将向上取整至初始交易日.

period2=:您希望结束的日期的 UNIX 时间戳表示.

<块引用>

对于所有时间间隔:大于最后交易日期的值将向下舍入到可用的最近时间戳.

添加前置 &上市后数据

&includePrePost=true

加分红分裂

&events=div%7Csplit

%7C| 的十六进制., 会工作,但内部雅虎使用管道

示例网址:

  • https://query1.finance.yahoo.com/v8/finance/chart/AAPL?symbol=AAPL&period1=0&period2=9999999999&interval=1d&includePrePost=true&events=div%7Csplit

上述请求将返回股票代码 AAPL 以 1 天为间隔的所有价格数据,包括上市前和上市后数据以及股息和拆分.

注意:period1= 的价格示例 URL 中使用的值 &period2= 用于演示每个输入的相应舍入行为.`

I have been using the following URL to fetch historical data from yahoo finance for quite some time now but it stopped working as of yesterday.

https://ichart.finance.yahoo.com/table.csv?s=SPY

When browsing to this site it says:

Will be right back...

Thank you for your patience.

Our engineers are working quickly to resolve the issue.

However, since this issue is still existing since yesterday I am starting to think that they discontinued this service?

My SO search only pointed me to this topic, which was related to https though...

Is anyone else experiencing this issue? How can I resolve this problem? Do they offer a different access to their historical data?

解决方案

Yahoo has gone to a Reactjs front end which means if you analyze the request headers from the client to the backend you can get the actual JSON they use to populate the client side stores.

Hosts:

If you plan to use a proxy or persistent connections use query2.finance.yahoo.com. But for the purposes of this post, the host used for the example URLs is not meant to imply anything about the path it's being used with.


Fundamental Data

(substitute your symbol for: AAPL)

  • /v10/finance/quoteSummary/AAPL?modules=

Inputs for the ?modules= query:

    [
       'assetProfile',
       'summaryProfile',
       'summaryDetail',
       'esgScores',
       'price',
       'incomeStatementHistory',
       'incomeStatementHistoryQuarterly',
       'balanceSheetHistory',
       'balanceSheetHistoryQuarterly',
       'cashflowStatementHistory',
       'cashflowStatementHistoryQuarterly',
       'defaultKeyStatistics',
       'financialData',
       'calendarEvents',
       'secFilings',
       'recommendationTrend',
       'upgradeDowngradeHistory',
       'institutionOwnership',
       'fundOwnership',
       'majorDirectHolders',
       'majorHoldersBreakdown',
       'insiderTransactions',
       'insiderHolders',
       'netSharePurchaseActivity',
       'earnings',
       'earningsHistory',
       'earningsTrend',
       'industryTrend',
       'indexTrend',
       'sectorTrend']

Example URL: querying for all of the above modules

  • https://query2.finance.yahoo.com/v10/finance/quoteSummary/AAPL?modules=assetProfile%2CsummaryProfile%2CsummaryDetail%2CesgScores%2Cprice%2CincomeStatementHistory%2CincomeStatementHistoryQuarterly%2CbalanceSheetHistory%2CbalanceSheetHistoryQuarterly%2CcashflowStatementHistory%2CcashflowStatementHistoryQuarterly%2CdefaultKeyStatistics%2CfinancialData%2CcalendarEvents%2CsecFilings%2CrecommendationTrend%2CupgradeDowngradeHistory%2CinstitutionOwnership%2CfundOwnership%2CmajorDirectHolders%2CmajorHoldersBreakdown%2CinsiderTransactions%2CinsiderHolders%2CnetSharePurchaseActivity%2Cearnings%2CearningsHistory%2CearningsTrend%2CindustryTrend%2CindexTrend%2CsectorTrend

The %2C is the Hex representation of , and needs to be inserted between each module you request. details about the hex encoding bit(if you care)


Options contracts

  • /v7/finance/options/AAPL (current expiration)
  • /v7/finance/options/AAPL?date=1679011200 (March 17, 2023 expiration)

Example URL:

  • https://query2.finance.yahoo.com/v7/finance/options/AAPL (current expiration)
  • https://query2.finance.yahoo.com/v7/finance/options/AAPL?date=1679011200 (Match 17, 2023 expiration)

Any valid future expiration represented as a UNIX timestamp can be used in the ?date= query. If you query for the current expiration the JSON response will contain a list of all the valid expirations that can be used in the ?date= query. (here is a post explaining converting human-readable dates to UNIX timestamp in Python)


Price

  • /v8/finance/chart/AAPL?symbol=AAPL&period1=0&period2=9999999999&interval=3mo

Possible inputs for &interval=: 1m, 5m, 15m, 30m, 90m, 1h, 1d, 5d, 1wk, 1mo, 3mo

m (minute) intervals are limited to 30days with period1 and period2 spaning a maximum of 7 days per/request. Exceeding either of these limits will result in an error and will not round

h (hour) interval is limited to 730days with no limit to span. Exceeding this will result in an error and will not round

period1=: UNIX timestamp representation of the date you wish to start at.

d (day), wk (week), mo (month) intervals with values less than the initial trading date will be rounded up to the initial trading date.

period2=: UNIX timestamp representation of the date you wish to end at.

For all intervals: values greater than the last trading date will be rounded down to the most recent timestamp available.

Add pre & post market data

&includePrePost=true

Add dividends & splits

&events=div%7Csplit

%7C is hex for |. , will work but internally yahoo uses pipe

Example URL:

  • https://query1.finance.yahoo.com/v8/finance/chart/AAPL?symbol=AAPL&period1=0&period2=9999999999&interval=1d&includePrePost=true&events=div%7Csplit

The above request will return all price data for ticker AAPL on a 1-day interval including pre and post-market data as well as dividends and splits.

Note: the values used in the price example URL for period1= & period2= are to demonstrate the respective rounding behavior of each input.`

这篇关于雅虎财经网址无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆