Esempio n. 1
0
def GetAllStockTradingInfoFrom(YYYY, MM):
    Code = TWSENo().industry_code
    Comps= TWSENo().industry_comps
    for code in Code.keys():
        print "Industry Code: %s, %s" %(code, Code.get(code))
        try:
            if (len(Comps[str(code)]) > 0):
                for stock in Comps[str(code)]:
                    #print "Stock: " + stock
                    GetStockTradingInfoFrom(stock, YYYY, MM)
                print "Industry Code: %s is not empty" %(code)
        except:
            print "Industry Code: %s is empty" %(code)
Esempio n. 2
0
def printIndustryCodeAndTheirStocks():
    fo = open("IndustryCodesAndTheirStocks.txt", "wb")
    Code = TWSENo().industry_code
    Codes = Code.keys()
    Codes.sort()
    Comps= TWSENo().industry_comps
    for code in Codes:
        #print "Industry Code: %s, %s" %(code, Code.get(code))
        a="Industry Code: %s, %s\n" %(code, Code.get(code))
        #fo.write("Industry Code: " + str(code) + ": " + Code.get(code) )
        fo.write(a.encode("utf8"))
        try:
            if (len(Comps[str(code)]) > 0):
                for stock in Comps[str(code)]:
                    print stock
                    fo.write(str(stock) + " ")
                fo.write("\n\n");
                #print "Industry Code: %s is not empty" %(code)
        except:
            print "Industry Code: %s is empty" %(code)
            fo.write("Industry Code: " + str(code) + " is empty\n")
    fo.close()