Guest User

Untitled

a guest
Mar 25th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. #!/usr/bin/env wolframscript
  2. (* ::Package:: *)
  3.  
  4. (* ::Input:: *)
  5. (*tbl1 = Import[FileNameJoin[{$HomeDirectory , "tmp", "port.tsv"}]];*)
  6.  
  7.  
  8. (* ::Input:: *)
  9. (*(* Some of the types of prices you can ask for *)*)
  10. (**)
  11. (*(* First, some helper functions *)*)
  12. (*Fina[sym_, what_] := EntityValue[Entity["Financial", sym], what];*)
  13. (*Fina2[sym_, what_] := Part[Fina[sym, what], 2];*)
  14. (**)
  15. (*(* And now the real deal ... *)*)
  16. (*OpenPrice[sym_] := Fina[sym, "Open"];*)
  17. (**)
  18. (*(* These can seem a little unreliable: *)*)
  19. (*ClosePrice[sym_] := Fina[sym, "Close"];*)
  20. (*AskPrice[sym_] := Fina2[sym, "Ask", 2];*)
  21. (*LastPrice[sym_] := Fina2[sym, "Last"];*)
  22.  
  23.  
  24. (* ::Input:: *)
  25. (**)
  26. (*f[row_] := (r1 =row[[1]]; r2 = row[[2]]; sp = OpenPrice[r1]; {r1,r2, sp, r2*sp});*)
  27. (*tover[fn_] := Table[fn[tbl1[[r]]], {r, Length[tbl1]}];*)
  28. (*tbl2 = tover[f];*)
  29. (*tbl3 = Grid[tbl2, Alignment -> Right]*)
  30. (**)
  31.  
  32.  
  33. (* ::Input:: *)
  34. (*port = Total[tbl2[[All, 4]]] *)
  35. (*Print[port]*)
  36.  
  37.  
  38. (* ::Input:: *)
  39. (*Now*)
  40.  
  41.  
  42. (* ::Input:: *)
  43. (*EntityProperties["Financial"]*)
Add Comment
Please, Sign In to add comment