- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想使用雅虎从 Emacs Lisp 程序中获取股票价格。我有两个问题。
最佳答案
这里有一些代码可以帮助您入门;我展示了如何将 url 抓取到缓冲区,解析每一行,然后显示每个项目的股票代码和价格。您可以从那里修改它以执行您需要的操作。
这会将每一行股票数据解析为一个列表,并且可以使用第一个、第二个、第三个函数或使用第 n 个函数直接获取值。您可以编写函数来获取您想要的每个元素,例如 get-ticker(quote) 它只会返回(第一个行情)
我不会过度考虑使用什么样的数据结构;任何最简单的都很好。如果您需要高性能,那么无论如何您都不应该为此使用 emacs lisp。
(defun test()
(interactive)
(let ((quotes (get-quotes '("AAPL" "GOOG" "MSFT" "ORCL" "ERTS" "THQI") "sb")))
(show-quotes quotes)))
(defun show-quotes(quotes)
(dolist (quote quotes)
(message (format "%s $%.2f" (first quote) (string-to-number (second quote))))))
(defun get-quotes(tickers field-string)
"Given a list of ticker names and a string of fields to return as above, this grabs them
from Yahoo, and parses them"
(let ((results-buffer (get-yahoo-quotes-to-buffer (get-price-url tickers field-string))))
(switch-to-buffer results-buffer)
(parse-quote-buffer results-buffer)))
(defun get-price-url (tickers field-string)
"Set up the get url"
(concat "http://download.finance.yahoo.com/d/quotes.csv?s="
(mapconcat 'identity tickers "+")
"&f=" field-string))
(defun get-yahoo-quotes-to-buffer(url)
"Retrieve the quotes to a buffer and return it"
(url-retrieve-synchronously url))
(defun parse-quote-buffer(b)
"Parse the buffer for quotes"
(goto-line 1)
(re-search-forward "^\n")
(beginning-of-line)
(let ((res nil))
(while (> (point-max) (point))
(setf res (cons (split-string (thing-at-point 'line) ",") res))
(forward-line 1))
(reverse res)))
关于elisp - 使用 Elisp 从雅虎获取股票价格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2032503/
所有, 我一直在一组文档上运行Y!LDA(https://github.com/shravanmn/Yahoo_LDA),结果看起来不错(或至少达到我的期望)。现在,我想使用产生的主题对语料库执行反向
我正在尝试订阅 onTimeIndexChanged 媒体播放器事件。只要我订阅的 View 保持专注,它就可以正常工作。当我按下后退按钮或小部件按钮时,我的 View 变得模糊并且不再接收事件。 这
我必须将 yahoo api 集成到我的应用程序中。谁能给我提供步骤吗? 由于我们已经集成了雅虎,所以我们从雅虎获得了一个 token key ,输入 key 后我们进入应用程序。在雅虎登录后是否有任
我直接从 Yahoo! 下载股票数据财务。 我比较两个日期的“Adj Closed”以获得增长率。例如,1987 年 7 月 20 日,KO(可口可乐)调整后的收盘值为 1.71,2013 年 7 月
我正在尝试遵循 Yahoo hadoop 教程: http://developer.yahoo.com/hadoop/tutorial/module3.html#vm 一切正常,直到我尝试根据“Ecl
我有现有的网络应用程序和专用的 Yahoo App在职的。它使用 OAuth2 Implicit Grant Flow 现在我想设置另一个按相同原理工作的域。我创建了新的 Yahoo App使用新的回
我正在使用 Dope-openid我网站上的图书馆,但在使用雅虎帐户登录时,用户会收到上面的消息 单击“同意”以使用您的 Yahoo! 登录 www.mywebsitename.com身份证。 警告:
我在以下网址找到了有关如何从Yahoo下载历史日内数据的在线文章:http://www.quantshare.com/sa-426-6-ways-to-download-free-intraday-a
这是我在雅虎上的问题的一种重新发布!论坛。只是我更频繁地提到 StackOverflow ...... 我的问题如下:而 Yahoo! OAuth http://developer.yahoo.com
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 8 年前。 Improve this ques
我如何从 yahoo api 接收到接收到的日期时间的特定时区? 默认时区是什么? http://hk.finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&
我如何从 yahoo api 接收到接收到的日期时间的特定时区? 默认时区是什么? http://hk.finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&
为了使用 jQuery 发出跨域 AJAX 请求,我尝试使用 YQL RSS。 select * from rss where url='https://www.top1000funds.com/fe
我知道我可以使用 jquery、.ajax 和 jsonp 进行跨域 ajax 调用。我正在调用雅虎股票报价 API。一切正常,结果正在返回(我可以使用 Fiddler 看到。)问题是我收到一个 js
我一直在开发一个使用雅虎财经的 json 获取股票数据的应用程序,但我在错误代码中遇到了问题。它在 else 语句中显示未解析的标识符 jsonDict 和预期的表达式错误。 这是代码。 import
这是 Yahoo Aviate Launcher 的屏幕截图之一: 我想做的就是这样。当用户滑动到启动器的最右侧页面(按字母顺序排列的应用程序列表)时,此屏幕截图的左侧仍然可以保留为左侧页面的一部分。
我正在尝试与基于 Django 的 Web 应用程序中现有商家帐户的 Yahoo! 的 Checkout API 集成。我已经成功地集成了他们的 Catalog API,但由于某种原因,我根本无法让
我每天都在处理 HTML 电子邮件营销事件,在过去的 24 小时内,我发现我所有的电子邮件都是左对齐的。这包括我之前构建的电子邮件事件(已在 Yahoo! Mail 中测试并用于对齐中心)。 有没有人
已关闭。这个问题是 off-topic 。目前不接受答案。 想要改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 已关闭10 年前。 Improve th
我正在尝试从 Yahoo! 检索市场数据财务和脚本多年来一直运行良好,但最近,它停止显示道琼斯数据。这是网址: http://download.finance.yahoo.com/d/quotes.c
我是一名优秀的程序员,十分优秀!