Last active
March 6, 2016 21:07
-
-
Save stevensona/0c7ddfbb37bdb6d4cafe to your computer and use it in GitHub Desktop.
Use IBM Watson AlchemyAPI to display the sentiment of us stock market news
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'httparty' | |
key = @apikey | |
target = 'http://feeds.reuters.com/news/usmarkets?format=html' | |
url = "http://gateway-a.watsonplatform.net/calls/url/URLGetTextSentiment?apikey=#{key}&url=#{target}&outputMode=json" | |
response = HTTParty.post(url, headers: {'Content-Type' => 'application/x-www-form-urlencoded'}) | |
puts response.body |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
{ "status": "OK", "usage": "By accessing AlchemyAPI or using information generated by AlchemyAPI, you are agreeing to be bound by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html", "url": "http://feeds.reuters.com/news/usmarkets?format=html", "totalTransactions": "1", "language": "english", "docSentiment": { "mixed": "1", "score": "-0.198827", "type": "negative" } }