Skip to content

Commit

Permalink
NDX at the end of the trading day
Browse files Browse the repository at this point in the history
  • Loading branch information
milktrader committed Aug 22, 2012
1 parent bde6894 commit 6339aa3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
10 changes: 0 additions & 10 deletions milktrader/Rhistory

This file was deleted.

24 changes: 24 additions & 0 deletions milktrader/intraday.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
suppressMessages(require(milk))
intradayplot <- function(x=val, xlab=trunc(Sys.time() - (60*15), "min"), up.col='yellow', dn.col='yellow4', main='Nasdaq 100 components') {

ups = length(val[val >0])
downs = length(val[val <0])

dens = density(na.omit(val))
x1 = min(which(dens$x >= 0))
x2 = max(which(dens$x < 1))
x3 = min(which(dens$x >= -1))
x4 = max(which(dens$x < 0))

png("intradayNDX.png")
plot(dens, xlab=xlab, ylab="", main=main, yaxt="n")
with(dens, polygon(x=c(x[c(x1,x1:x2,x2)]), y= c(0, y[x1:x2], 0), col=up.col))
with(dens, polygon(x=c(x[c(x3,x3:x4,x4)]), y= c(0, y[x3:x4], 0), col=dn.col))
legend("topleft", inset=.01, legend=c(ups,downs), fill=c(up.col, dn.col), cex=.8, bty='n')
}

ndx = readLines('ndx')
a = getQuote(ndx)
foo = a[,4]
val = as.numeric(gsub("%","",foo,fixed=TRUE))/100
intradayplot()
Binary file added milktrader/intradayNDX.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions milktrader/ndx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ATVI;ADBE;AKAM;ALXN;ALTR;AMZN;AMGN;APOL;AAPL;AMAT;ADSK;ADP;AVGO;BIDU;BBBY;BIIB;BMC;BRCM;CHRW;CA;CELG;CERN;CHKP;CSCO;CTXS;CTSH;CMCSA;COST;DELL;XRAY;DTV;DLTR;EBAY;ERTS;EXPE;EXPD;ESRX;FFIV;FAST;FISV;FLEX;FOSL;GRMN;GILD;GOOG;GMCR;HSIC;INFY;INTC;INTU;ISRG;KLAC;KFT;LRCX;LINTA;LIFE;LLTC;MRVL;MAT;MXIM;MCHP;MU;MSFT;MNST;MYL;NTAP;NFLX;NUAN;NVDA;NWSA;ORLY;ORCL;PCAR;PAYX;PCLN;PRGO;QCOM;RIMM;ROST;SNDK;STX;SHLD;SIAL;SIRI;SPLS;SBUX;SRCL;SYMC;TXN;VRSN;VRTX;VIAB;VMED;VOD;WCRX;WFM;WYNN;XLNX;YHOO
Binary file removed milktrader/rut12.png
Binary file not shown.

0 comments on commit 6339aa3

Please sign in to comment.