SoFunction
Updated on 2024-10-29

Python implementation of the download of stock market information

This article is an example of Python implementation of the stock market information download. Shared for your reference. Specific as follows:

The program downloads stock market information from yahoo finance.

import urllib
def getURL(url):
  socket = (url)
  readSocket = ()
  ()
  return readSocket
def printInfo(listInfo):
  print "Stock Symbol: " , listInfo[0]
  print "Last Trade Price: " , listInfo[1]
  print "Last Trade Date: " , listInfo[2]
  print "Last Trade Time: " , listInfo[3]
  print "Change: " , listInfo[4]
  print "Open: " , listInfo[5]
  print "Day's High: " , listInfo[6]
  print "Day's Low: " , listInfo[7]
  print "Volume: " , listInfo[8]
stockSymbol = raw_input("Enter the stock symbol: ")
stockURL = "/d/?s=%s&f=sl1d1t1c1ohgv&e=.csv" % stockSymbol
stockInfoStr = getURL(stockURL)
stockInfoStr = ()
stockInfoStr = (",")
printInfo(stockInfoStr)

I hope that what I have described in this article will help you in your Python programming.