Skip to content

Instantly share code, notes, and snippets.

@BrandonLMorris
Created July 5, 2015 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BrandonLMorris/ce834067b20d87e81000 to your computer and use it in GitHub Desktop.
Save BrandonLMorris/ce834067b20d87e81000 to your computer and use it in GitHub Desktop.
Pull stock quote from markitondemand.com API
import urllib.request
import json
base_url = "http://dev.markitondemand.com/Api/v2/Quote/json?symbol="
def get_quote(symbol):
html = urllib.request.urlopen(base_url + symbol).read().decode("utf-8")
parsed_json = json.loads(html)
return parsed_json["Name"] + ": " + str(parsed_json["LastPrice"])
# Example with Apple
if __name__ = "__main__":
print(get_quote("AAPL"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment