<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0"><id>tag:blogger.com,1999:blog-7521167015179812715</id><updated>2012-02-25T07:56:43.607-08:00</updated><category term="visual" /><category term="yahoo" /><category term="plot" /><category term="numpy" /><category term="spreadsheet" /><category term="heatmap" /><category term="python" /><category term="Vanguard" /><category term="decisionMaking" /><category term="value-indicators" /><category term="timeserie" /><category term="vim" /><category term="bargain" /><category term="data" /><category term="crontab" /><category term="pe" /><category term="R" /><title type="text">Jr. Parrot on Command Line</title><subtitle type="html">...secret gems about Cli Finance (beta)</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://clifinance.mathharbour.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://clifinance.mathharbour.com/" /><author><name>10801</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_Qc1Z3hIcYO4/TB32c0hEEbI/AAAAAAAABk0/-dbum5I1cbk/S220/ball.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>14</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/CliFinance" /><feedburner:info uri="clifinance" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>CliFinance</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><entry><id>tag:blogger.com,1999:blog-7521167015179812715.post-8092438192187565835</id><published>2012-02-25T07:10:00.001-08:00</published><updated>2012-02-25T07:32:59.399-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="data" /><category scheme="http://www.blogger.com/atom/ns#" term="R" /><title type="text">Stock Valuations in R: Quantmod -package [part 1]</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-UCbHItzUoqg/T0j5pfqvf5I/AAAAAAAACXM/ZFcXbe42hn8/s1600/vt.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://4.bp.blogspot.com/-UCbHItzUoqg/T0j5pfqvf5I/AAAAAAAACXM/ZFcXbe42hn8/s400/vt.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;We earlier covered how to get information in Python&amp;nbsp;&lt;a href="http://clifinance.mathharbour.com/2011/07/retrieve-vanguard-historical-data-about.html"&gt;here&lt;/a&gt;&amp;nbsp;but it is a waste of time.&amp;nbsp;There is a wrapper in R that fetches data from different services, it is a bit limited for example in the amount of queries you can do but anyway a good tool when other tools stop working. We encourage our sailors to deepen their knowledge with&amp;nbsp;R -style questions&amp;nbsp;&lt;a href="http://quant.stackexchange.com/questions/tagged/r"&gt;here&lt;/a&gt;&amp;nbsp;and take this as a challenge. Technical knowledge is nothing without the social aspect. Hope to make your speculation a bit less painful, have fun!&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;b&gt;Code&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; color: #444444; font-family: Tahoma, Geneva, Arial, sans-serif; font-size: 14px; line-height: 18px;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; vertical-align: baseline; width: auto;"&gt;&lt;code style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;library(quantmod)&lt;br /&gt;getSymbols("VT")&lt;br /&gt;plot(VT)&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7521167015179812715-8092438192187565835?l=clifinance.mathharbour.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/CliFinance/~4/XGqXwRAFlzM" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/8092438192187565835" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/8092438192187565835" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CliFinance/~3/XGqXwRAFlzM/intra-day-prices-in-r-speculators-power.html" title="Stock Valuations in R: Quantmod -package [part 1]" /><author><name>10801</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_Qc1Z3hIcYO4/TB32c0hEEbI/AAAAAAAABk0/-dbum5I1cbk/S220/ball.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-UCbHItzUoqg/T0j5pfqvf5I/AAAAAAAACXM/ZFcXbe42hn8/s72-c/vt.png" height="72" width="72" /><feedburner:origLink>http://clifinance.mathharbour.com/2012/02/intra-day-prices-in-r-speculators-power.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-7521167015179812715.post-5444453038692657863</id><published>2012-01-21T07:07:00.000-08:00</published><updated>2012-01-21T07:07:00.524-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="plot" /><category scheme="http://www.blogger.com/atom/ns#" term="R" /><title type="text">EU crisis, R and Reinhart-Rogoff -rule</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-6W6ZY3hPwQ8/Twg35W94icI/AAAAAAAACOw/iuSU5B9SFwA/s1600/euGroshDebt07022012.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://4.bp.blogspot.com/-6W6ZY3hPwQ8/Twg35W94icI/AAAAAAAACOw/iuSU5B9SFwA/s400/euGroshDebt07022012.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;The ambiguous Reinhart-Rogoff rule is that the gvt gross ratio over 90% will slow down economy otherwise not a big issue in a way such as [1].&amp;nbsp;It is very hard to create here some sort of causality so always good to verify things on your own! Have fuN!&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;[1]&amp;nbsp;&lt;a href="http://www.economist.com/blogs/freeexchange/2010/07/debt"&gt;http://www.economist.com/blogs/freeexchange/2010/07/debt&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: python"&gt;# Description: vizualise the gvt gross debt in EU&lt;br /&gt;# License: GPL 3 or later&lt;br /&gt;# Author: MathHarbour.com&lt;br /&gt;&lt;br /&gt;png('./euGroshDebt07022012.png')&lt;br /&gt;par(mfrow=c(1,2), bg='white')&lt;br /&gt;&lt;br /&gt;system('wget -O tmp.gz http://epp.eurostat.ec.\&lt;br /&gt;europa.eu/NavTree_prod/everybody/\&lt;br /&gt;BulkDownloadListing?file=data/tsieb090.tsv.gz')&lt;br /&gt;tab &amp;lt;- read.table(gzfile('tmp.gz'), header=TRUE)&lt;br /&gt;tab&amp;lt;-tab[c(41,44,48,49,50,66,70),] # DE,SE,FR,FI,UK,EU27&lt;br /&gt;colors&amp;lt;-rainbow(length(tab[,1]))&lt;br /&gt;&lt;br /&gt;m &amp;lt;- t(tab[,-1])   #only years and vals&lt;br /&gt;mode(m) &amp;lt;- "numeric"&lt;br /&gt;matplot(m, type="l", &lt;br /&gt; pch = 1:nrow(m), &lt;br /&gt; xaxt="n", col=colors, &lt;br /&gt; ylab="% Gvt gross debt in EU")&lt;br /&gt;axis(1, at=1:nrow(m), labels=rownames(m))&lt;br /&gt;&lt;br /&gt;plot(1,1, axes=F, xlab='', ylab='')&lt;br /&gt;&lt;br /&gt;legend('center', legend=tab[,1], col=colors, pch="*", lty=1:7)&lt;br /&gt;title('Data source: Eurostat.')&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7521167015179812715-5444453038692657863?l=clifinance.mathharbour.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/CliFinance/~4/jSym1r6VHRc" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/5444453038692657863" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/5444453038692657863" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CliFinance/~3/jSym1r6VHRc/eu-crisis-r-and-reinhart-rogoff-rule.html" title="EU crisis, R and Reinhart-Rogoff -rule" /><author><name>10801</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_Qc1Z3hIcYO4/TB32c0hEEbI/AAAAAAAABk0/-dbum5I1cbk/S220/ball.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-6W6ZY3hPwQ8/Twg35W94icI/AAAAAAAACOw/iuSU5B9SFwA/s72-c/euGroshDebt07022012.png" height="72" width="72" /><feedburner:origLink>http://clifinance.mathharbour.com/2012/01/eu-crisis-r-and-reinhart-rogoff-rule.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-7521167015179812715.post-838208143676285293</id><published>2012-01-14T07:07:00.000-08:00</published><updated>2012-01-14T07:07:01.464-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="vim" /><category scheme="http://www.blogger.com/atom/ns#" term="spreadsheet" /><category scheme="http://www.blogger.com/atom/ns#" term="R" /><title type="text">Work with Large Spreadsheets in R</title><content type="html">It is essential that you can fast move between your editor and R. Here is how I do it, it is important to do it this way (not closing the R) because you won't lose the cache with precious vars etc. When you combine this tip with the earlier tip about Vim &lt;a href="http://clifinance.mathharbour.com/2011/03/edit-large-spreadsheets-in-vim.html"&gt;here&lt;/a&gt;, you get an excellent powerhouse!&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;pre class="brush: python"&gt;&amp;gt; source('test.r')&lt;br /&gt;&amp;gt; system('vim test.r')&lt;br /&gt;&amp;gt; readLines('myDataXYZ')  # vectorize, capital!&lt;br /&gt;&amp;gt; edit(someVar)           # very useful command!&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7521167015179812715-838208143676285293?l=clifinance.mathharbour.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/CliFinance/~4/pMNSHgiJmTc" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/838208143676285293" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/838208143676285293" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CliFinance/~3/pMNSHgiJmTc/work-with-large-spreadsheets-in-r.html" title="Work with Large Spreadsheets in R" /><author><name>10801</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_Qc1Z3hIcYO4/TB32c0hEEbI/AAAAAAAABk0/-dbum5I1cbk/S220/ball.jpg" /></author><feedburner:origLink>http://clifinance.mathharbour.com/2012/01/work-with-large-spreadsheets-in-r.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-7521167015179812715.post-227582269914774264</id><published>2012-01-07T07:07:00.000-08:00</published><updated>2012-01-08T23:43:23.255-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="timeserie" /><category scheme="http://www.blogger.com/atom/ns#" term="plot" /><category scheme="http://www.blogger.com/atom/ns#" term="R" /><title type="text">Financial Time-serie Modelling in R [part 0]</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-Kh_ERVqRUGk/Twa6iQLYCbI/AAAAAAAACNs/mJFIskYZLKc/s1600/logVals06012012.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://1.bp.blogspot.com/-Kh_ERVqRUGk/Twa6iQLYCbI/AAAAAAAACNs/mJFIskYZLKc/s400/logVals06012012.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;It is a rarity that a financial powerhouses provide clean data [1]. It is unfortunate, leaving room for speculation. The code below may look trivial but it is not hard from it to do more advanced things with small changes such as ARIMA -forecasting -- of course in R. Ironically, John Bogle once explained something that he likes fairer share for small guys. Luckily, there are certain firms (not Vanguard) offering historical valuations quite painlessly so you can have fun with this code. The below code requires that you have CSV -files to read. Have FuN!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Code&lt;/b&gt;&lt;br /&gt;&lt;pre class="brush: python"&gt;# Author: MathHarbour.com&lt;br /&gt;# License: GPL 3 or later&lt;br /&gt;#&lt;br /&gt;# Description: R in financial modelling&lt;br /&gt;#  &lt;br /&gt;&lt;br /&gt;path&amp;lt;-'./Trial/*.csv'&lt;br /&gt;&lt;br /&gt;colors&amp;lt;-rainbow(length(Sys.glob(path)))&lt;br /&gt;names(colors)&amp;lt;-Sys.glob(path)&lt;br /&gt;&lt;br /&gt;b&amp;lt;-lapply(Sys.glob(path), function(file) {&lt;br /&gt;    e &amp;lt;- read.table(file)&lt;br /&gt;    data.frame(as.Date(e$V1, "%d.%m.%Y"), e$V2)&lt;br /&gt;})&lt;br /&gt;names(b)&amp;lt;-Sys.glob(path)&lt;br /&gt;&lt;br /&gt;png('./Public/logVals06012012.png')&lt;br /&gt;&lt;br /&gt;vals&amp;lt;-do.call(rbind, b)[[2]]&lt;br /&gt;vals&amp;lt;-log(vals)&lt;br /&gt;&lt;br /&gt;plot( b[[1]][[1]], log(b[[1]][[2]]), &lt;br /&gt; type='l', ylim=range(vals),&lt;br /&gt; col=colors[[Sys.glob(path)[1]]],&lt;br /&gt; xlab="Time",&lt;br /&gt; ylab="Log Valuation[ln(EUR)]") #init&lt;br /&gt;&lt;br /&gt;Map(function(c, dat) &lt;br /&gt; lines( dat[[1]], log(dat[[2]]), col=c ), &lt;br /&gt; colors[-1], b[-1])&lt;br /&gt;&lt;br /&gt;title("Logarithmic valuations")&lt;br /&gt;#legend('top',&lt;br /&gt; #do.call(rbind, &lt;br /&gt; #as.list(Sys.glob("./Trial/*.csv"))),&lt;br /&gt; #col=colors, lty=1:7, pch="*", cex=0.8)&lt;br /&gt;&lt;br /&gt;dev.off()&lt;br /&gt;&lt;/pre&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;References&lt;/b&gt;&lt;br /&gt;1. &lt;a href="http://www.bogleheads.org/forum/viewtopic.php?p=1011852"&gt;http://www.bogleheads.org/forum/viewtopic.php?p=1011852&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7521167015179812715-227582269914774264?l=clifinance.mathharbour.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/CliFinance/~4/5N1IPggluGY" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/227582269914774264" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/227582269914774264" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CliFinance/~3/5N1IPggluGY/financial-time-serie-modelling-in-r.html" title="Financial Time-serie Modelling in R [part 0]" /><author><name>10801</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_Qc1Z3hIcYO4/TB32c0hEEbI/AAAAAAAABk0/-dbum5I1cbk/S220/ball.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-Kh_ERVqRUGk/Twa6iQLYCbI/AAAAAAAACNs/mJFIskYZLKc/s72-c/logVals06012012.png" height="72" width="72" /><feedburner:origLink>http://clifinance.mathharbour.com/2012/01/financial-time-serie-modelling-in-r.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-7521167015179812715.post-1449835516204811278</id><published>2012-01-01T19:07:00.000-08:00</published><updated>2012-01-01T19:07:00.542-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="visual" /><category scheme="http://www.blogger.com/atom/ns#" term="heatmap" /><category scheme="http://www.blogger.com/atom/ns#" term="Vanguard" /><category scheme="http://www.blogger.com/atom/ns#" term="R" /><title type="text">VT World Fund Calendar Heatmap with R</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-c8Tk94nlt8k/TwADLOLWZqI/AAAAAAAACNE/odG1cP5IY_s/s1600/daily_calendar_changes.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="286" src="http://4.bp.blogspot.com/-c8Tk94nlt8k/TwADLOLWZqI/AAAAAAAACNE/odG1cP5IY_s/s400/daily_calendar_changes.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;Install the necessary packages as specified by the code, eg. install.packages('chron') in R, and then just:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: python"&gt;$ wget&amp;nbsp;https://raw.github.com/tavisrudd/\&lt;br /&gt;r_users_group_1/master/calendarHeat.R&lt;br /&gt;$&amp;nbsp;sed -i 's@if(FALSE@if(TRUE@g' calendarHeat.R&lt;br /&gt;$&amp;nbsp;sed -i "s@MSFT@VT@g" calendarHeat.R&lt;br /&gt;$ Rscript calendarHeat.R&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;...don't ask where I need this kind of toys, perhaps to visualize hotel bookings like &lt;a href="http://stackoverflow.com/a/8164193/164148"&gt;here&lt;/a&gt;? What about researching the so-called January -effect on your own, more &lt;a href="http://www.ifa.com/articles/Professor_Fama_Answers_the_Critics.aspx"&gt;here&lt;/a&gt;. How is plot different with VIOV or VIOO?&lt;br /&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;P.s. ...do not believe that you could exploit the abnormality anymore, use this toy for your plays instead.&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7521167015179812715-1449835516204811278?l=clifinance.mathharbour.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/CliFinance/~4/fQAIWB1mus8" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/1449835516204811278" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/1449835516204811278" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CliFinance/~3/fQAIWB1mus8/vt-world-fund-calendar-heatmap-with-r.html" title="VT World Fund Calendar Heatmap with R" /><author><name>10801</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_Qc1Z3hIcYO4/TB32c0hEEbI/AAAAAAAABk0/-dbum5I1cbk/S220/ball.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-c8Tk94nlt8k/TwADLOLWZqI/AAAAAAAACNE/odG1cP5IY_s/s72-c/daily_calendar_changes.png" height="72" width="72" /><feedburner:origLink>http://clifinance.mathharbour.com/2012/01/vt-world-fund-calendar-heatmap-with-r.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-7521167015179812715.post-7073144573531216599</id><published>2011-12-07T07:07:00.000-08:00</published><updated>2011-12-07T07:07:01.133-08:00</updated><title type="text">Monte Carlo, Python and Efficient Frontier -analysis</title><content type="html">We used Monte Carlo simulation in latter post, here [1], to visualize risk-return -profiles with efficient frontiers.Although MC is very imprecise, the result of MC converging very slowly \frac{1}{\sqrt(N)}, it is used because of its convenience. Shortly, the MC is strikingly different to other methods, such as Trapetz and Simpson, where lower dimensional polynomials are used to calculate the area while MC uses statistical method with random numbers.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Matlab&lt;/b&gt;&lt;br /&gt;&lt;pre class="brush: python"&gt;density = 100000&lt;br /&gt;x = rand(density);&lt;br /&gt;y = rand(density);&lt;br /&gt;i = (x^2 .+ y^2)^0.5 &amp;lt; 1;&lt;br /&gt;Area3 = (sum(i) / density)*4;&lt;/pre&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Python&lt;/b&gt;&lt;br /&gt;&lt;pre class="brush: python"&gt;import numpy as np&lt;br /&gt;&lt;br /&gt;density=int(1e5)&lt;br /&gt;x = np.random.random(density)&lt;br /&gt;y = np.random.random(density)&lt;br /&gt;i = (x**2.0+y**2.0)**0.5 &amp;lt; 1&lt;br /&gt;Area3 = sum(i)/float(density)*4.0&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And as a comparison a method that uses polynomials to approximate the area, trapetz rule below.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Matlab&lt;/b&gt;&lt;br /&gt;&lt;pre class="brush: python"&gt;x=0:0.001:pi&lt;br /&gt;plot(x,sin(x))&lt;br /&gt;Area=trapz(x,sin(x))&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;Python&lt;/b&gt;&lt;br /&gt;&lt;pre class="brush: python"&gt;import numpy as np&lt;br /&gt;x=np.linspace(0,np.pi,99)&lt;br /&gt;Area=np.trapz(x, np.sin(x))&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;[1] http://finance.mathharbour.com/2011/09/crash-analysis-idiosyncratic-risk-and.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7521167015179812715-7073144573531216599?l=clifinance.mathharbour.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/CliFinance/~4/Z8FJ1qsoxBc" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/7073144573531216599" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/7073144573531216599" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CliFinance/~3/Z8FJ1qsoxBc/monte-carlo-python-and-efficient.html" title="Monte Carlo, Python and Efficient Frontier -analysis" /><author><name>10801</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_Qc1Z3hIcYO4/TB32c0hEEbI/AAAAAAAABk0/-dbum5I1cbk/S220/ball.jpg" /></author><feedburner:origLink>http://clifinance.mathharbour.com/2011/12/monte-carlo-python-and-efficient.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-7521167015179812715.post-3008149015373614992</id><published>2011-11-07T19:07:00.000-08:00</published><updated>2011-11-07T22:09:26.209-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="python" /><category scheme="http://www.blogger.com/atom/ns#" term="decisionMaking" /><category scheme="http://www.blogger.com/atom/ns#" term="numpy" /><title type="text">Scatter Plot, Python and Decision Making</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-62pO7D4a-NA/TrikNQXgJNI/AAAAAAAACL8/COMwIaE8weE/s1600/decision_prob_1st_order_dom.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="243" src="http://2.bp.blogspot.com/-62pO7D4a-NA/TrikNQXgJNI/AAAAAAAACL8/COMwIaE8weE/s320/decision_prob_1st_order_dom.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;Investing is the most lucrative when you think as a business. Well, let's consider what it actually infers. Here some payouts with different strategies outlined for a commodity business. There is a fascinating connection between risk-management of a portfolio and corporate investing, more on page 213 [2]. There is always a cost for capital (p.211 [2]) so you should always allocate it as efficiently as possible, sometimes the cost is as a form of economic cost so harder to realize. Indexers are not meeting their benchmarks (p.207 [2]), a bit like private investors' under-performance. Good time to go back to basics.&lt;br /&gt;&lt;br /&gt;The model is similar to the traditional efficient frontiers. Now the risk is not to do losses but create less profit than with other strategies. If you think it in terms of economic profit, they are intrinsically the same, now just with the difference to some case such as the worst or the average.&amp;nbsp;I used VaR here as a risk measure, the VaR is the profit under which you get with the probability $p$. I think it is actually quite good indicator, it is often usual to make sure your strategies cover the fixed costs (so you do not run of out the business if a cycle lasts longer than expected).&lt;br /&gt;&lt;br /&gt;The red points are first-order stochastic dominant. Interesting thing is that second-order stochastic dominance points are not the same as the first order. Now the pareto-optimal points are the same as the second order dominant points (15,12,8), try it with different cones -- but they are not always so! It is actually quite amazing.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;P.s. if you want to dig more into this topic, please, review the convex analysis material covered by Standord University [1]. They are excellent, they formulate the whole concept of pareto optimality to new level, yes it scales to larger surfaces as well!&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Data&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: python"&gt;$ cat Input_1&lt;br /&gt;1  0 0&lt;br /&gt;2  0.3 46 &lt;br /&gt;3  0.73 67.45 &lt;br /&gt;4  0.73 113.45&lt;br /&gt;...&lt;/pre&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;b&gt;The Code&amp;nbsp;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: python"&gt;import numpy as np&lt;br /&gt;import matplotlib.pyplot as plt&lt;br /&gt;&lt;br /&gt;colors = {&lt;br /&gt;    "great": "red",&lt;br /&gt;    "poor": "green"&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;class Point(object):&lt;br /&gt;    "class for point objects"&lt;br /&gt;    def __init__(self, id, x, y):&lt;br /&gt;        self.id = id&lt;br /&gt;        self.x = x&lt;br /&gt;        self.y = y&lt;br /&gt;        self.c = colors["poor"]&lt;br /&gt;&lt;br /&gt;def read_files():&lt;br /&gt;    "reads the files and return a list of points"&lt;br /&gt;    the_points = []&lt;br /&gt;    for line in open("Input_1"):&lt;br /&gt;        try:&lt;br /&gt;            L = line.strip().split()&lt;br /&gt;            if len(L) != 3:&lt;br /&gt;                continue&lt;br /&gt;            id, x, y = int(L[0]), float(L[1]), float(L[2])&lt;br /&gt;            point = Point(id, x, y)&lt;br /&gt;            the_points.append(point)&lt;br /&gt;        except:&lt;br /&gt;            pass&lt;br /&gt;    return the_points&lt;br /&gt;&lt;br /&gt;the_points = read_files()&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;for point in the_points:&lt;br /&gt;&lt;br /&gt; #special poinst with different marker&lt;br /&gt; if (point.id == 8 or point.id == 12 or point.id == 14 or point.id == 15):&lt;br /&gt;  plt.scatter(point.x,point.y, marker="^", c=colors['great'])&lt;br /&gt; else:&lt;br /&gt;  plt.scatter(point.x,point.y, marker="o", c=point.c)&lt;br /&gt;&lt;br /&gt;        plt.annotate( point.id, xy=(point.x,point.y))&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;plt.axis([0,1, 0, 300])&lt;br /&gt;plt.show()&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;References&lt;/b&gt;&lt;br /&gt;[1] http://www.stanford.edu/~boyd/cvxbook/bv_cvxslides.pdf&lt;br /&gt;[2] Triumph of the Optimists: 101 Years of Global Investment Returns&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7521167015179812715-3008149015373614992?l=clifinance.mathharbour.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/CliFinance/~4/TmJZ90ojN0Y" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/3008149015373614992" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/3008149015373614992" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CliFinance/~3/TmJZ90ojN0Y/scatter-plot-with-decision-making.html" title="Scatter Plot, Python and Decision Making" /><author><name>10801</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_Qc1Z3hIcYO4/TB32c0hEEbI/AAAAAAAABk0/-dbum5I1cbk/S220/ball.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-62pO7D4a-NA/TrikNQXgJNI/AAAAAAAACL8/COMwIaE8weE/s72-c/decision_prob_1st_order_dom.png" height="72" width="72" /><feedburner:origLink>http://clifinance.mathharbour.com/2011/11/scatter-plot-with-decision-making.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-7521167015179812715.post-7559760074112170487</id><published>2011-09-26T09:28:00.000-07:00</published><updated>2011-11-07T20:00:42.572-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="value-indicators" /><category scheme="http://www.blogger.com/atom/ns#" term="pe" /><category scheme="http://www.blogger.com/atom/ns#" term="python" /><title type="text">PE10 and Python to Avoid Euphoria</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-ULjONBv_p9w/ToCYc_SMNrI/AAAAAAAACCQ/aY4floxcOao/s1600/pe10_return_time_2plots.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="398" src="http://2.bp.blogspot.com/-ULjONBv_p9w/ToCYc_SMNrI/AAAAAAAACCQ/aY4floxcOao/s400/pe10_return_time_2plots.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;I want to continue discussions and help other people to investigate this issue, more here [2] and now categorized under Skeptic -index [1]. You can find the code below!&lt;br /&gt;&lt;br /&gt;&lt;b&gt;References&lt;/b&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Boglehead -skeptic index &lt;a href="http://www.bogleheads.org/forum/viewtopic.php?t=81556&amp;amp;highlight="&gt;here&lt;/a&gt;&lt;/li&gt;&lt;li&gt;investigations about PE10 &lt;a href="http://www.bogleheads.org/forum/viewtopic.php?t=83072"&gt;here&lt;/a&gt; and &lt;a href="http://www.bogleheads.org/forum/viewtopic.php?t=80604"&gt;here&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: python"&gt;# Description: plots historical PE10 graphs to avoid euphoria&lt;br /&gt;# License: OpenBSD license&lt;br /&gt;# Author: 10801&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;import urllib&lt;br /&gt;import xlrd&lt;br /&gt;from pylab import *&lt;br /&gt;&lt;br /&gt;plot([1,2,3])&lt;br /&gt;# Uncomment the below for the first time&lt;br /&gt;# be kind and do not populate the Rob's server&lt;br /&gt;# &lt;br /&gt;# url = "http://www.econ.yale.edu/~shiller/data/ie_data.xls"&lt;br /&gt;# fXls = 'ie_data.xls'&lt;br /&gt;# urllib.urlretrieve(url, fXls)&lt;br /&gt;&lt;br /&gt;wb = xlrd.open_workbook(fXls)&lt;br /&gt;sh = wb.sheet_by_name(u'Data')&lt;br /&gt;&lt;br /&gt;x=sh.col_values(0)&lt;br /&gt;y=sh.col_values(10)&lt;br /&gt;&lt;br /&gt;subplot(211)&lt;br /&gt;plot(x[128:-1], y[128:-1])&lt;br /&gt;title('Graphs are based on R. Shiller data \n\n Historical PE10 versus Time')&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#2nd plot &lt;br /&gt;p=sh.col_values(7)[8:-10]&lt;br /&gt;d=sh.col_values(8)[8:-10]&lt;br /&gt;e=sh.col_values(9)[8:-10]&lt;br /&gt;&lt;br /&gt;y = [(ee+dd)/pp for ee,dd,pp in zip(e,d,p)]&lt;br /&gt;x=sh.col_values(10)[8:-10]&lt;br /&gt;&lt;br /&gt;subplot(212)&lt;br /&gt;plot(x[128:-1], y[128:-1])&lt;br /&gt;title('Real Return versus PE10')&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;show()&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7521167015179812715-7559760074112170487?l=clifinance.mathharbour.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/CliFinance/~4/2Ogz_0PwnBI" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/7559760074112170487" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/7559760074112170487" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CliFinance/~3/2Ogz_0PwnBI/pe10-and-python-to-avoid-euphoria.html" title="PE10 and Python to Avoid Euphoria" /><author><name>10801</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_Qc1Z3hIcYO4/TB32c0hEEbI/AAAAAAAABk0/-dbum5I1cbk/S220/ball.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-ULjONBv_p9w/ToCYc_SMNrI/AAAAAAAACCQ/aY4floxcOao/s72-c/pe10_return_time_2plots.png" height="72" width="72" /><feedburner:origLink>http://clifinance.mathharbour.com/2011/09/pe10-and-python-to-avoid-euphoria.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-7521167015179812715.post-2056999901589330374</id><published>2011-07-29T04:58:00.000-07:00</published><updated>2012-02-25T07:32:49.254-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="data" /><category scheme="http://www.blogger.com/atom/ns#" term="Vanguard" /><category scheme="http://www.blogger.com/atom/ns#" term="python" /><title type="text">Vanguard Historical Fund Data With Python</title><content type="html">Vanguard does not offer data over the whole history of their funds, only annual data &lt;a href="https://personal.vanguard.com/us/funds/tools/pricehistorysearch"&gt;here&lt;/a&gt;&amp;nbsp;and look how other companies provide the data&amp;nbsp;&lt;a href="http://www.bogleheads.org/forum/viewtopic.php?p=1011995#1011995"&gt;here&lt;/a&gt;&amp;nbsp;(much better!). Related discussion in Bogleheads.org &lt;a href="http://www.bogleheads.org/forum/viewtopic.php?t=78400&amp;amp;highlight="&gt;here&lt;/a&gt;&amp;nbsp;where people are unable to analyze the products due to the lack of data.&amp;nbsp;I have contacted Vanguard about the issue but they provided no excuse. It is very short-sighted to let private investors not to know where they are investing in!&amp;nbsp;I hope they will provide better service so private investors can concentrate on investing rather than awkward parsing.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;If the parsing feels annoying, send Vanguard feedback &lt;a href="https://personal.vanguard.com/us/ContactUsSecureEmail?isContact=p"&gt;here&lt;/a&gt;.&amp;nbsp;Please, inform them with something like that you want historical data (not just annual data). The data is important to provide easy historical analysis about their funds. Ask for quality -- data over the whole history and in clean text -files (not in the obscure HTML -form currently) -- like their competitors such as iShares, Seligson and many other companies do.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Happy sailing on frontiers!&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: python"&gt;import urllib&lt;br /&gt;import re&lt;br /&gt;&lt;br /&gt;# Description: retrieves the annual data about a Vanguard fund&lt;br /&gt;# so that you can more easily see historical data.&lt;br /&gt;# Very bad parsing because Vanguard does not provide the &lt;br /&gt;# historical data over the whole history.&lt;br /&gt;#&lt;br /&gt;# Tested with Windows XP, Python 2.x and Urllib.&lt;br /&gt;#&lt;br /&gt;# License: OpenBSD License&lt;br /&gt;# Author: 10801&lt;br /&gt;#&lt;br /&gt;# It saves the data to HTML -files where you still need to get it.&lt;br /&gt;# TODO:&lt;br /&gt;# - get the data from files to CSV -file&lt;br /&gt;# - let user to control the years&lt;br /&gt;# - fix the year -ending overgoing&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;startYear = "1993"&lt;br /&gt;WorkingUrl = "https://personal.vanguard.com/us/funds/tools/pricehistorysearch?radio=1&amp;amp;results=get&amp;amp;FundType=VanguardFunds&amp;amp;FundIntExt=INT&amp;amp;FundId=0085&amp;amp;Sc=0&amp;amp;fundName=0085&amp;amp;fundValue=0085&amp;amp;radiobutton2=1&amp;amp;beginDate=07%2F28%2F2010&amp;amp;endDate=07%2F28%2F2011&amp;amp;year=#res"&lt;br /&gt;&lt;br /&gt;test = WorkingUrl.split("&amp;amp;")&lt;br /&gt;years= [x+int(startYear) for x in range(19)]&lt;br /&gt;end = "&amp;amp;end=#res"&lt;br /&gt;&lt;br /&gt;print "Data about Vanguard VTSMX over the years coming..." &lt;br /&gt;print years&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;print "URls are "&lt;br /&gt;&lt;br /&gt;for year in years:&lt;br /&gt;   res2 = re.sub("[0-9]{4}", str(year+1), test[-2])&lt;br /&gt;   res = re.sub("[0-9]{4}", str(year), test[-3]) &lt;br /&gt; &lt;br /&gt;   myUrl =  "&amp;amp;".join(test[0:-3]) + "&amp;amp;" + res + "&amp;amp;" + res2 + end&lt;br /&gt;   nameFile = str(str(year)+ "_" + str(year+1) + "_" + "VTSMX" + ".html")&lt;br /&gt; &lt;br /&gt;   print ("File name is %s." % nameFile)&lt;br /&gt;   urllib.urlretrieve(myUrl, nameFile)&lt;/pre&gt;&lt;i&gt;P.s. you can manually use third-party services such as Google Finance to retrieve the historical data to files over the whole history but it is far from perfect.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7521167015179812715-2056999901589330374?l=clifinance.mathharbour.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/CliFinance/~4/LM0bmmVlHqQ" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/2056999901589330374" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/2056999901589330374" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CliFinance/~3/LM0bmmVlHqQ/retrieve-vanguard-historical-data-about.html" title="Vanguard Historical Fund Data With Python" /><author><name>10801</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_Qc1Z3hIcYO4/TB32c0hEEbI/AAAAAAAABk0/-dbum5I1cbk/S220/ball.jpg" /></author><feedburner:origLink>http://clifinance.mathharbour.com/2011/07/retrieve-vanguard-historical-data-about.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-7521167015179812715.post-6207230508928783262</id><published>2011-03-17T01:28:00.000-07:00</published><updated>2011-03-17T02:12:52.829-07:00</updated><title type="text">AWK to find Benjamin Graham Valuation Metrics</title><content type="html">Benjamin Graham is famous for starting to quantify investment decisions. One of his metric is to find stocks with the lowest PE and PB multiplication -- so-called 22 rule. And, kosh, if you want to sort out the awful valuations like today with iShares S&amp;P Small Cap 600 (DE), CS ETF (IE) on MSCI USA Small Cap, Vanguard Small Cap Growth ETF and Vanguard Mid-Cap Growth ETF (all above 30 with PE*PB) then use the command to find the popular 22 rule!&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: python"&gt;% awk -F"\t" '{if ($5*$6 &lt; 22) print $5*$6 "\t", $1}' file | sort -n&lt;br /&gt;12.155   CS ETF (IE) on MSCI Japan Small Cap &lt;br /&gt;13.3947  Dimensional Emerging Mkts Val B EUR&lt;br /&gt;14.586   CS ETF (IE) on MSCI EMU Small Cap&lt;br /&gt;14.949   iShares EURO STOXX Small (DE)&lt;br /&gt;15.2724  Vanguard FTSE All-Wld ex-US SmCp Idx ETF&lt;br /&gt;18.4146  iShares STOXX Europe Small 200 (DE)&lt;br /&gt;19.206   CS ETF (IE) on MSCI UK Small Cap&lt;br /&gt;20.559   Seligson Suomi indeksirahasto A&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7521167015179812715-6207230508928783262?l=clifinance.mathharbour.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/CliFinance/~4/sJ3u2k1kELM" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/6207230508928783262" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/6207230508928783262" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CliFinance/~3/sJ3u2k1kELM/awk-to-find-benjamin-graham-valuation.html" title="AWK to find Benjamin Graham Valuation Metrics" /><author><name>10801</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_Qc1Z3hIcYO4/TB32c0hEEbI/AAAAAAAABk0/-dbum5I1cbk/S220/ball.jpg" /></author><feedburner:origLink>http://clifinance.mathharbour.com/2011/03/awk-to-find-benjamin-graham-valuation.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-7521167015179812715.post-6953992976261489235</id><published>2011-03-09T20:00:00.000-08:00</published><updated>2011-03-17T01:57:30.334-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="spreadsheet" /><title type="text">Edit Large Spreadsheets in VIM</title><content type="html">Large files returned nice segmentation errs with Excel, fed up to report bubble-wrap problems so turned to old good VIM. No more stupid time lag and wasted working hours. Some useful configurations to have your own "&lt;i&gt;Spreadsheet program&lt;/i&gt;":&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: python"&gt;:set ts=20&lt;br /&gt;:set list (:set nolist to off)&lt;br /&gt;:set nowrap (:set wrap to off)&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7521167015179812715-6953992976261489235?l=clifinance.mathharbour.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/CliFinance/~4/OHIxnI4l0Jc" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/6953992976261489235" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/6953992976261489235" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CliFinance/~3/OHIxnI4l0Jc/edit-large-spreadsheets-in-vim.html" title="Edit Large Spreadsheets in VIM" /><author><name>10801</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_Qc1Z3hIcYO4/TB32c0hEEbI/AAAAAAAABk0/-dbum5I1cbk/S220/ball.jpg" /></author><feedburner:origLink>http://clifinance.mathharbour.com/2011/03/edit-large-spreadsheets-in-vim.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-7521167015179812715.post-1732405493435017638</id><published>2010-03-24T04:24:00.000-07:00</published><updated>2012-02-25T07:34:45.128-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="data" /><category scheme="http://www.blogger.com/atom/ns#" term="python" /><title type="text">Stock Dump with Yahoo API</title><content type="html">&lt;b&gt;Efficient.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://clifinance.blogspot.com/2010/03/get-stock-prices.html"&gt;Related.&lt;/a&gt; &lt;a href="http://www.goldb.org/ystockquote.html"&gt;yahoo.py&lt;/a&gt;&lt;br /&gt;&lt;pre class="brush: python"&gt;&amp;gt;&amp;gt;&amp;gt; include yahoo&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt;print yahoo.get_all('BRCM')&lt;br /&gt;{'stock_exchange': '"NasdaqNM"', 'market_cap': '16.948B', '200day_moving_avg': '30.1363', '52_week_high': '34.30', 'price_earnings_growth_ratio': '0.92', 'price_sales_ratio': '3.92', 'price': '34.20', 'earnings_per_share': '0.127', '50day_moving_avg': '31.2944', 'avg_daily_volume': '8453730', 'volume': '0', '52_week_low': '19.11', 'short_ratio': '1.00', 'price_earnings_ratio': '269.29', 'dividend_yield': '0.23', 'dividend_per_share': '0.08', 'price_book_ratio': '4.36', 'ebitda': '94.2M', 'change': '0.00', 'book_value': '7.853'}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7521167015179812715-1732405493435017638?l=clifinance.mathharbour.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/CliFinance/~4/Qf-MWIKumN0" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/1732405493435017638" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/1732405493435017638" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CliFinance/~3/Qf-MWIKumN0/stock-dump-with-yahoo-api.html" title="Stock Dump with Yahoo API" /><author><name>10801</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_Qc1Z3hIcYO4/TB32c0hEEbI/AAAAAAAABk0/-dbum5I1cbk/S220/ball.jpg" /></author><feedburner:origLink>http://clifinance.mathharbour.com/2010/03/stock-dump-with-yahoo-api.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-7521167015179812715.post-7813342091212699244</id><published>2010-03-20T14:48:00.000-07:00</published><updated>2012-02-25T07:35:58.554-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="data" /><category scheme="http://www.blogger.com/atom/ns#" term="yahoo" /><title type="text">Get Stock Prices</title><content type="html">&lt;b&gt;Excellent, we may now begin our business. Abbut!&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: python"&gt;$ curl -s 'http://download.finance.yahoo.com/d/quotes.csv?s=goog&amp;amp;f=l1'&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7521167015179812715-7813342091212699244?l=clifinance.mathharbour.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/CliFinance/~4/ShXxQEIzAro" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/7813342091212699244" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/7813342091212699244" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CliFinance/~3/ShXxQEIzAro/get-stock-prices.html" title="Get Stock Prices" /><author><name>10801</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_Qc1Z3hIcYO4/TB32c0hEEbI/AAAAAAAABk0/-dbum5I1cbk/S220/ball.jpg" /></author><feedburner:origLink>http://clifinance.mathharbour.com/2010/03/get-stock-prices.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-7521167015179812715.post-3684931283383569269</id><published>2010-03-20T12:20:00.000-07:00</published><updated>2011-09-25T07:53:38.289-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="bargain" /><category scheme="http://www.blogger.com/atom/ns#" term="crontab" /><title type="text">Bargain-hunting with Crontab</title><content type="html">&lt;b&gt;I wish to engage your services.&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;pre class="brush: python"&gt;$ crontab -l&lt;br /&gt;   @daily source findBargains.sh&lt;br /&gt;&lt;br /&gt;$ cat findBargains.sh&lt;br /&gt;   export Url="www.JuniorParrotBargaining.com"&lt;br /&gt;   mkdir -p ~/logs/Bargain-`date '+%F'` &amp;&amp; \\&lt;br /&gt;   cd ~/logs/Bargain-`date '+%F'` &amp;&amp; wget --mirror -l 1 $Url&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7521167015179812715-3684931283383569269?l=clifinance.mathharbour.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/CliFinance/~4/bL41nFSSNKk" height="1" width="1"/&gt;</content><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/3684931283383569269" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7521167015179812715/posts/default/3684931283383569269" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/CliFinance/~3/bL41nFSSNKk/crontab-to-automate-bargain-hunting.html" title="Bargain-hunting with Crontab" /><author><name>10801</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://3.bp.blogspot.com/_Qc1Z3hIcYO4/TB32c0hEEbI/AAAAAAAABk0/-dbum5I1cbk/S220/ball.jpg" /></author><feedburner:origLink>http://clifinance.mathharbour.com/2010/03/crontab-to-automate-bargain-hunting.html</feedburner:origLink></entry></feed>

