Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env wolframscript
- (* ::Package:: *)
- (* ::Input:: *)
- (*tbl1 = Import[FileNameJoin[{$HomeDirectory , "tmp", "port.tsv"}]];*)
- (* ::Input:: *)
- (*(* Some of the types of prices you can ask for *)*)
- (**)
- (*(* First, some helper functions *)*)
- (*Fina[sym_, what_] := EntityValue[Entity["Financial", sym], what];*)
- (*Fina2[sym_, what_] := Part[Fina[sym, what], 2];*)
- (**)
- (*(* And now the real deal ... *)*)
- (*OpenPrice[sym_] := Fina[sym, "Open"];*)
- (**)
- (*(* These can seem a little unreliable: *)*)
- (*ClosePrice[sym_] := Fina[sym, "Close"];*)
- (*AskPrice[sym_] := Fina2[sym, "Ask", 2];*)
- (*LastPrice[sym_] := Fina2[sym, "Last"];*)
- (* ::Input:: *)
- (**)
- (*f[row_] := (r1 =row[[1]]; r2 = row[[2]]; sp = OpenPrice[r1]; {r1,r2, sp, r2*sp});*)
- (*tover[fn_] := Table[fn[tbl1[[r]]], {r, Length[tbl1]}];*)
- (*tbl2 = tover[f];*)
- (*tbl3 = Grid[tbl2, Alignment -> Right]*)
- (**)
- (* ::Input:: *)
- (*port = Total[tbl2[[All, 4]]] *)
- (*Print[port]*)
- (* ::Input:: *)
- (*Now*)
- (* ::Input:: *)
- (*EntityProperties["Financial"]*)
Add Comment
Please, Sign In to add comment