【问题标题】:How can I get historical prices of Yahoo! Finance from Java?如何获取 Yahoo! 的历史价格?来自 Java 的金融?
【发布时间】:2016-02-07 12:02:24
【问题描述】:

我需要获得 Yahoo!以 csv 格式财务历史价格,如链接中的:Click here for IBM historical prices in Yahoo! Finance 通过指定股票的公司名称,例如 IBM 或 Apple 的 AAPL,我如何获得 CSV 格式的电子表格,显示为名为“下载到电子表格”的按钮在上面的链接中?

【问题讨论】:

  • 这不是一个编码平台。请告诉我们你有什么和你有什么问题。
  • 我在此处的编码部分找不到从哪里开始的问题。我的意思是,我找不到任何API,所以我问是否有其他方法可以获得它?任何关于它的教程都会有所帮助,我会自己编码,而不是寻找编码平台,如果我知道我想要哪些公司数据,只是帮助开始编码如何下载电子表格数据。例如,IBM
  • 对不起,如果这听起来很粗鲁,但我在 10 秒内找到了一个 api 谷歌。请注意,这不是转储谷歌搜索查询的页面。这也是为什么您的问题被大量否决的原因。
  • 能否提供api的链接?也许是我搜索的关键字是我自己投票的问题。无论如何,api链接将不胜感激。

标签: java


【解决方案1】:
url = new java.net.URL(historicURL + "?s=" + symbol.getCode()
                               + "&d=" + d + "&e=" + e + "&f=" + f + "&g="
                               + g +"&a=" + a + "&b=" + b + "&c=" + c
                               + "&ignore=.csv");

使用此链接提供下载它的答案。

 String a = Integer.toString(Integer.parseInt(
            new java.text.SimpleDateFormat("MM").format(start)) - 1);
    /* b - Day number, eg, 1 for the first of the month. */
    String b = Integer.toString(Integer.parseInt(
            new java.text.SimpleDateFormat("dd").format(start)));
    /* c - Year. */
    String c = Integer.toString(Integer.parseInt(
            new java.text.SimpleDateFormat("yyyy").format(start)));
    /* d - Month number, starting with 0 for January. */
    String d = Integer.toString(Integer.parseInt(
            new java.text.SimpleDateFormat("MM").format(end)) - 1);
    /* e - Day number, eg, 1 for the first of the month. */
    String e = Integer.toString(Integer.parseInt(
            new java.text.SimpleDateFormat("dd").format(end)));
    /* f - Year. */
    String f = Integer.toString(Integer.parseInt(
            new java.text.SimpleDateFormat("yyyy").format(end)));

注意,月份编号以 0 开头。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-03
    • 2011-03-23
    • 1970-01-01
    • 2017-10-28
    • 2016-06-30
    • 1970-01-01
    相关资源
    最近更新 更多