People think that computer science is the art of geniuses but the actual reality is the opposite, just many people doing things that build on each other, like a wall of mini stones.
Donald KnuthMathematica Codes for Finance
If you want to start the study of macro-econophysics, economics, finance, physics, statistics, and mathematics, through analysis of real data, Mathematica is a useful tool. Mathematica provides data and tools. We list a few useful commands for finance here.
In[1]:= SetDirectory[NotebookDirectory[]]
In[2]:= FinancialData[“Classes”]
In[3]:= FinancialData[“Exchanges”]
In[4]:= FinancialData[“NYSE*”]
In[5]:= Take[FinancialData[“NYSE*”], 20]
In[6]:= Take[FinancialData[“NASDAQ*”], 20]
In[7]:= Take[FinancialData[“∧*”], 20]
In[8]:= FinancialData[“NASDAQ:AAPL”, “Properties”]
In[9]:= FinancialData[“NASDAQ:AAPL”, “Name”]
In[10]:= FinancialData[“AAPL”, “Exchange”]
In[11]:= FinancialData[“∧DJI”, “Name”]
In[12]:= FinancialData[“SP500”, “Name”]
In[13]:= FinancialData[“∧GSPC”, “Name”]
In[14]:= FinancialData[“NASDAQ:AAPL”, “OHLCV”]
In[15]:= Take[FinancialData[“NASDAQ:AAPL”, “OHLCV”,All],20]
In[16]:= DateListPlot[FinancialData[“NASDAQ:AAPL”, All], PlotRange -> All]
In[17]:= Export[“Apple.csv”, FinancialData[“NASDAQ:AAPL”, “OHLCV”, All]]
In[18]:= DateListPlot[FinancialData[“NASDAQ:AAPL”, “Return”, All], PlotRange -> All]
In[19]:= data = FinancialData[“NASDAQ:AAPL”, “OHLCV”, All]; logret = Table[fdata[[i, 1]], Log[data[[i, 2, 4]]/data[[i, 2, 1]]]g, fi, Length[data]g]; Take[logret, 20] DateListPlot[logret, PlotRange -> All]
In[20]:= data = FinancialData[“NYSE:*“]; Take[data, 10] n = Length[data]
In[21]:= For[i = 1, i < 4, i++, Export[StringReplace[data[[i]], “NYSE:” -> ““] <> ”.csv”, FinancialData[data[[i]], “OHLCV”, All]]]
In[22]:= For[i = 1, i < n + 1, i++, Export[StringReplace[data[[i]], “NYSE:” -> ““] <> ”.csv”, FinancialData[data[[i]], “OHLCV”, All]]]
Tools for Network Analysis
Many tools for network analysis and visualization are available today. Readers are able to find them using a web search. Here we list a limited number of them based on a somewhat biased selection.
Pajek (http://mrvar.fdv.uni-lj.si/pajek)
Netminer (http://www.netminer.com)
UCINET (https://sites.google.com/site/ucinetsoftware)
These three are originally developed in sociology for social network analysis, while recent development enables faster computation for larger networks.
NetworkX (https://networkx.github.io)
Python library; network analysis and visualization, exible as a script language; also applicable to small-scale visualization. anaconda, all scientific libraries in a single package, includes this and the required libraries, and is better for easy installation.
igraph (http://igraph.org)
R library; network analysis and visualization, exible as a script language with abundant tools of R, statistical computing and graphics; easy to install. Python and C versions are also available.
Gephi (https://gephi.org)
Network visualization with basic tools of network analyses included; applicable to relatively large-scale networks.
To save this book to your Kindle, first ensure no-reply@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.
Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.
Find out more about the Kindle Personal Document Service.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.