Hi,
I have everyday 2 csv files that I need to figure a simple composite score locally on my OSX machine (Script could be python, perl, ruby applescript) that outputs new re-sorted 3rd csv by new composite score.)
Every stock symbol has known score in the 1st csv:
(Following are already scored 1-12)
“No.”,”Ticker”,”Company”,”Sector”,”Industry”,”Country”,”Market Cap”,”P/E”,”Price”,”Change”,”Volume”
1,”BPT”,”BP Prudhoe Bay Royalty Trust”,”Basic Materials”,”Oil & Gas Refining & Marketing”,”USA”,2339.66,12.26,109.33,0.95%,75598
2,”PBT”,”Permian Basin Royalty Trust”,”Financial”,”Diversified Investments”,”USA”,1026.35,15.96,22.02,1.80%,190976
3,”SBR”,”Sabine Royalty Trust”,”Financial”,”Diversified Investments”,”USA”,885.01,15.93,60.70,1.08%,9630
4,”MSB”,”Mesabi Trust”,”Financial”,”Diversified Investments”,”USA”,328.79,10.71,25.06,3.13%,67290
5,”NRT”,”North European Oil Royalty Trust”,”Financial”,”Diversified Investments”,”USA”,301.16,14.19,32.77,0.77%,14990
6,”SJT”,”San Juan Basin Royalty Trust”,”Financial”,”Diversified Investments”,”USA”,1130.29,17.20,24.25,1.63%,81551
7,”MARPS”,”Marine Petroleum Trust”,”Financial”,”Diversified Investments”,”USA”,44.00,14.86,22.00,2.37%,3514
8,”PCO”,”Pendrell Corporation”,”Technology”,”Wireless Communications”,”USA”,615.61,1.99,2.37,3.49%,283468
9,”TNH”,”Terra Nitrogen Company, L.P.”,”Basic Materials”,”Agricultural Chemicals”,”USA”,3297.44,15.42,178.24,2.18%,61131
10,”GNI”,”Great Northern Iron Ore Properties”,”Basic Materials”,”Steel & Iron”,”USA”,158.46,7.60,105.64,-0.61%,2850
11,”ISIG”,”Insignia Systems Inc.”,”Services”,”Marketing Services”,”USA”,49.48,0.88,3.23,3.53%,46293
12,”ZIXI”,”Zix Corp.”,”Technology”,”Application Software”,”USA”,203.17,4.95,3.17,2.92%,307800
2nd csv has the stock symbols ranked possibly like this on a random day:
“No.”,”Ticker”,”Company”,”Sector”,”Industry”,”Country”,”Market Cap”,”P/E”,”Price”,”Change”,”Volume”
1,”ZIXI”,”Zix Corp.”,”Technology”,”Application Software”,”USA”,203.17,4.95,3.17,2.92%,307800
2,”SBR”,”Sabine Royalty Trust”,”Financial”,”Diversified Investments”,”USA”,885.01,15.93,60.70,1.08%,9630
3,”PBT”,”Permian Basin Royalty Trust”,”Financial”,”Diversified Investments”,”USA”,1026.35,15.96,22.02,1.80%,190976
4,”MSB”,”Mesabi Trust”,”Financial”,”Diversified Investments”,”USA”,328.79,10.71,25.06,3.13%,67290
5,”BPT”,”BP Prudhoe Bay Royalty Trust”,”Basic Materials”,”Oil & Gas Refining & Marketing”,”USA”,2339.66,12.26,109.33,0.95%,75598
6,”MARPS”,”Marine Petroleum Trust”,”Financial”,”Diversified Investments”,”USA”,44.00,14.86,22.00,2.37%,3514
7,”SJT”,”San Juan Basin Royalty Trust”,”Financial”,”Diversified Investments”,”USA”,1130.29,17.20,24.25,1.63%,81551
8,”PCO”,”Pendrell Corporation”,”Technology”,”Wireless Communications”,”USA”,615.61,1.99,2.37,3.49%,283468
9,”NRT”,”North European Oil Royalty Trust”,”Financial”,”Diversified Investments”,”USA”,301.16,14.19,32.77,0.77%,14990
10,”GNI”,”Great Northern Iron Ore Properties”,”Basic Materials”,”Steel & Iron”,”USA”,158.46,7.60,105.64,-0.61%,2850
11,”ISIG”,”Insignia Systems Inc.”,”Services”,”Marketing Services”,”USA”,49.48,0.88,3.23,3.53%,46293
12,”TNH”,”Terra Nitrogen Company, L.P.”,”Basic Materials”,”Agricultural Chemicals”,”USA”,3297.44,15.42,178.24,2.18%,61131
What I need is:
1)Stock Symbols each get a new composite score:
So BPT for example would get a score of 6 (1+5)
ISIG would get a score of 22 (11+11) and so on.
TNH would get a score of 21 (9+12)
2) All rows with “Financial” or “Utilities” are stripped out.
3) Composite scores are re-sorted ASCENDING
4) Outputted into a 3rd csv with Composite Ranks in the 1st column.
I need to know how to run it via terminal or simple interface.