从AlphaVantage获取实时股票价格

huangapple go评论137阅读模式
英文:

Get RealTime stock price from AlphaVantage

问题

我正在开发一个交易应用项目,使用Alpha Vantage API来获取股票价格。

我尝试了TIME_SERIES_INTRADAY函数以获取5分钟间隔的实时股票价格,但我只得到了前一个市场日的数据,而不是当天的数据。

例如,如果我在今天(2020-01-03,12:30)启动API,则最后刷新的时间是在“2020-01-02 12:50:00”:

请求

https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&apikey=********&symbol=DAX&interval=5min

响应

{
"Meta Data": {
"1. Information": "Intraday (5min) open, high, low, close prices and volume",
"2. Symbol": "DAX",
"3. Last Refreshed": "2020-01-02 12:50:00",
"4. Interval": "5min",
"5. Output Size": "Compact",
"6. Time Zone": "US/Eastern"
},
"Time Series (5min)": {
"2020-01-02 12:50:00": {
"1. open": "28.4635",
"2. high": "28.5001",
"3. low": "28.4635",
"4. close": "28.5001",
"5. volume": "359"
},
"2020-01-02 11:15:00": {
"1. open": "28.6631",
"2. high": "28.6631",
"3. low": "28.6631",
"4. close": "28.6631",
"5. volume": "105"
},
...
}

我不明白我漏掉了什么。

如果有人能帮忙,将不胜感激。

谢谢!

英文:

I am working on a trading app project, and i am using Alpha Vantage API to get stock prices.

I tried the TIME_SERIES_INTRADAY function to get real time stock prices in a 5 minute interval, but i get only the data from the previous market day instead of the current day.

For example if launch the API today (2020-01-03 at 12:30) the last refresh is at "2020-01-02 12:50:00":

Request

https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&apikey=********&symbol=DAX&interval=5min

Response

{
"Meta Data": {
    "1. Information": "Intraday (5min) open, high, low, close prices and volume",
    "2. Symbol": "DAX",
    "3. Last Refreshed": "2020-01-02 12:50:00",
    "4. Interval": "5min",
    "5. Output Size": "Compact",
    "6. Time Zone": "US/Eastern"
},
"Time Series (5min)": {
    "2020-01-02 12:50:00": {
        "1. open": "28.4635",
        "2. high": "28.5001",
        "3. low": "28.4635",
        "4. close": "28.5001",
        "5. volume": "359"
    },
    "2020-01-02 11:15:00": {
        "1. open": "28.6631",
        "2. high": "28.6631",
        "3. low": "28.6631",
        "4. close": "28.6631",
        "5. volume": "105"
    },
   ...

I do not see what i am missing.

Really glad if anyone could help.

Thanks!

答案1

得分: 6

看起来Alpha Vantage最近已经改变了他们从API输出的方式。我以前可以从他们的“行情终端”获取“实时”价格数据。现在他们报告的是前一天的收盘数据。他们把想要实时数据的人引导到另一家公司,该公司收费,没有提供限制或演示账户。我发现Alpha Vantage仍然有一个“行业表现”数据集,似乎仍然具有实时组件。我向Alpha Vantage发送了一个询问,看看是否会继续提供这个数据,然后再修改我的应用程序(一个颜色变化的球)来使用这个数据。

顺便说一下,到目前为止,Alpha Vantage还没有向我确认API发生了任何变化,但他们的文档似乎已经改变,提供了一个链接,指引人们去这家其他公司获取实时数据。此外,在一封电子邮件中,他们添加了以下说明:

“关于法律方面的信息:纳斯达克已经制定了其实时市场数据的许可政策和费用 - 纽交所也是如此。根据最新的框架,Polygon是最便宜的纳斯达克批准的实时市场数据提供商之一。如果您发现其他更便宜(或免费)的实时数据来源,那么它们很可能正在非法重新分发纳斯达克的实时数据,并很可能会在不久的将来被交易所关闭。我们强烈建议选择像Polygon这样经交易所批准的数据提供商,以避免自身的法律责任。”

也许他们遇到了一些困难,不得不做出改变以符合法规。

史蒂夫

英文:

It looks like Alpha Vantage has changed their output from the API recently. I use to be able to get "real time" price data from their "Quotes Endpoint". Now they are reporting data from the prior day's close. They are sending people that want real time data to a different company that is charging the access - no limited, demo type account is offered there. I did find that Alpha Vantage has a "Sector Performance" data set that still seems to have a real time component. I sent an inquiry to Alpha Vantage to see if that will continue to be available before modifying my application (a color changing orb) to use this data.

By the way, so far, Alpha Vantage has not confirmed to me that anything has changed in the API, but their documentation appears to have changed, with a link that points people to this other company for real time data. In addition, in an e-mail, they added the following blurb:

"FYI on the legal side: NASDAQ has set its licensing policy and fees for realtime market data - likewise for NYSE. Under the latest framework, Polygon is one of the cheapest NASDAQ-approved providers of realtime market data. If you find other realtime data sources that are cheaper (or free), chances are that they are illegally redistributing realtime NASDAQ data and will likely get shut down by the exchanges in the near future. We strongly recommend choosing exchange-approved data providers such as Polygon to avoid any legal liability to yourself."

Maybe they were having a bit of trouble, and had to make a change to comply.

Steve

答案2

得分: 2

DAX 是一个指数。Alpha Vantage 目前不支持指数。

他们支持股票、外汇、加密货币、技术指标和行业表现。如果有的话,它们被视为额外的内容。

英文:

DAX is an index. Alpha Vantage does not currently support indexes.

They support stock, FX, crypto, technical indicators, and sector performance. If they have some, they are considered bonus.

答案3

得分: 1

不确定是否仍然需要,但只是为了澄清:

它支持指数! 但你必须使用另一个符号。只使用 DAX 是不正确的。

你必须寻找正确的符号,这在 Alpha Vantage API 中有点困难。我发现在 finance.yahoo.com 的搜索框中输入 "DAX",你会看到符号是 ^GDAXI。

总结一下:你必须在指数前加上 ^,然后通过 finance.yahoo.com 找到正确的符号

因此使用:

https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=^GDAXI&interval=5min&outputsize=full&apikey=***********


道琼斯:^DJI

标准普尔 500 指数:^GSPC

日经指数:^N225

纳斯达克综合指数:^IXIC

英文:

Dont know if this is still needed but just for clarification:

It does support indexes! But you have to use another symbol. Just DAX is not right.

You have to look for the right symbol and this is a bit difficult to do with the Alpha Vantage API. I found that using the search input at finance.yahoo.com entering "DAX" you see that the symbol is ^GDAXI.

To sum it up: You have to prefix indexes with ^ and find the right symbol via finance.yahoo.com

So use:

https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=^GDAXI&interval=5min&outputsize=full&apikey=***********


DowJones: ^DJI

S&P 500: ^GSPC

Nikkei: ^N225

Nasdaq Composite: ^IXIC

huangapple
  • 本文由 发表于 2020年1月3日 19:43:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/59578028.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定