【问题标题】:Yahoo Finance API .get_historical() not working python雅虎财经 API .get_historical() 不工作 python
【发布时间】:2017-06-04 22:41:18
【问题描述】:

所以我最近下载了 yahoo_finance API 及其 1.4.0 版。几天前我得到了它, .get_historical() 工作正常。然而现在,它没有。这是它的作用:

import yahoo_finance as yf

apple=yf.Share('AAPL')
apple_price=apple.get_price()

print apple.get_historical('2016-02-15', '2016-04-29')

我得到的错误是:YQLResponseMalformedError: Response malformed。 API 中有错误还是我忘记了什么?

【问题讨论】:

标签: python-2.7 yahoo-finance


【解决方案1】:

很遗憾,很多模块都基于 Yahoo Stock Price API 不再工作。

或者,您可以使用 Google 的 API https://www.google.com/finance/getprices?q=1101&x=TPE&i=86400&p=3d&f=d,c,h,l,o,v

q=1101 is the stock quote
x=TPE is the exchange (List of Exchanges here: https://www.google.com/googlefinance/disclaimer/ )
i=86400 interval in seconds (86400 sec = 1 day)
p=3d data since how long ago
f= fields of data (d=date, c=close, h=high, l=low, o=open, v=volume)

数据如下所示:

EXCHANGE%3DTPE
MARKET_OPEN_MINUTE=540
MARKET_CLOSE_MINUTE=810
INTERVAL=86400
COLUMNS=DATE,CLOSE,HIGH,LOW,OPEN,VOLUME
DATA=
TIMEZONE_OFFSET=480
a1496295000,24.4,24.75,24.35,24.75,11782000
1,24.5,24.5,24.3,24.4,10747000

a1496295000 是第一行数据的 Unix 时间戳

第二行1是从第一行偏移的间隔(偏移1天)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多