Skip to content

Instantly share code, notes, and snippets.

@jtrobman
Created July 19, 2013 19:06
Show Gist options
  • Save jtrobman/6041581 to your computer and use it in GitHub Desktop.
Save jtrobman/6041581 to your computer and use it in GitHub Desktop.
Bash script that uses the Yahoo Finance API to get stock quotes.
#!/bin/bash
# http://www.jarloo.com/yahoo_finance/
if [ "$1" == "all" ]
then
echo $(date +'%Y%m%d %H:%M') $(curl -s 'http://download.finance.yahoo.com/d/quotes.csv?s=aapl&f=l1,c');
echo $(date +'%Y%m%d %H:%M') $(curl -s 'http://download.finance.yahoo.com/d/quotes.csv?s=msft&f=l1,c');
echo $(date +'%Y%m%d %H:%M') $(curl -s 'http://download.finance.yahoo.com/d/quotes.csv?s=yhoo&f=l1,c');
else
echo $(date +'%Y%m%d %H:%M') $(curl -s 'http://download.finance.yahoo.com/d/quotes.csv?s='+$1+'&f=l1,c');
fi
@jtrobman
Copy link
Author

I do realize that with this script I will never be able to get an Allstate quote...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment