Skip to content

Instantly share code, notes, and snippets.

@zmughal
Created January 8, 2011 06:14
Show Gist options
  • Save zmughal/770604 to your computer and use it in GitHub Desktop.
Save zmughal/770604 to your computer and use it in GitHub Desktop.
Shell stocks plot
#!/bin/sh
YEAR0="2008"; YEAR1="2010"; STOCK="IBM"; wget -qO- "http://ichart.finance.yahoo.com/table.csv?s=$STOCK&a=00&b=1&c=$YEAR0&d=11&e=31&f=$YEAR1&g=d" \
| cut -d, -f1,7 \
| sort -n \
| grep -v Date \
| gnuplot -p -e \
"set datafile separator ',';
set xdata time; set timefmt '%Y-%m-%d';
set format x \"%b %d\\n%Y\";
plot '-' using 1:2 with lines title '$STOCK'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment