Created
September 4, 2011 22:47
-
-
Save giodamelio/1193660 to your computer and use it in GitHub Desktop.
Simple Stock Lister
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
#! /usr/bin/env python | |
""" | |
Simple python stock market day trader | |
""" | |
__version__ = "0.1" | |
__author__ = "Gio d'Amelio([email protected])" | |
__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