Skip to content

Instantly share code, notes, and snippets.

@giodamelio
Created September 4, 2011 22:47
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 giodamelio/1193660 to your computer and use it in GitHub Desktop.
Save giodamelio/1193660 to your computer and use it in GitHub Desktop.
Simple Stock Lister
#! /usr/bin/env python
"""
Simple python stock market day trader
"""
__version__ = "0.1"
__author__ = "Gio d'Amelio(giodamelio@gmail.com)"
__license__ = "Public Domain"
import pystock
def main():
#read stocks from file
stocks = open("stocks.lst", "r").readlines()
#get function from pystock
marketprice = pystock.get_price
#loop through lines from the stock file
for stocks in stocks:
#split the line into the name and ticker
name = stocks.split(", ")[0]
ticker = stocks.split(", ")[1]
#print the name and price of the stock
print(name + ": $" + marketprice(ticker))
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment