Register
It is currently Sun Dec 21, 2014 9:27 am

Stock Quotes with bash.


All times are UTC - 6 hours


Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Mon Oct 03, 2005 10:01 am   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 673
Location: Des Moines, Iowa
Code:
#!/bin/bash
#   

findstock ()
{
clear
echo "   _____   __                   __            ____                   __               
  / ___/  / /_  ____   _____   / /__         / __ \  __  __  ____   / /_  ___    _____
  \__ \  / __/ / __ \ / ___/  / //_/        / / / / / / / / / __ \ / __/ / _ \  / ___/
___/ / / /_  / /_/ // /__   / ,<          / /_/ / / /_/ / / /_/ // /_  /  __/ (__  )
/____/  \__/  \____/ \___/  /_/|_|         \___\_\ \__,_/  \____/ \__/  \___/ /____/  ";
echo "";
echo "";
read -p "Please enter the stock symbol : " stock
lynx -dump http://finance.yahoo.com/q?s=$stock > online.txt
response="---Be advised, this is a delayed quote."
echo -e "$response \r"
echo "";
grep -i ":$stock)" online.txt > temp.dat
sed -e 's/Delayed.*$//' temp.dat > tempname.dat
response=`cat tempname.dat`
echo -e "$response \r"
grep "Last Trade:" online.txt > temp2.dat
sed -e "s/    /$/" temp2.dat > temp3.dat
response=`cat temp3.dat`
echo -e "$response \r"
grep "Change:" online.txt > temp4.dat
response=`cat temp4.dat`
echo -e "$response \r"
grep "52wk Range:" online.txt > temp5.dat
response=`cat temp5.dat`
echo -e "$response \r"
rm online.txt; rm temp.dat; rm tempname.dat; rm temp2.dat;rm temp3.dat; rm temp4.dat; rm temp5.dat
echo "";
read -p "Hit RETURN to continue or q to quit: " temp
if [[ "$temp" = "q" ]]
then exit; fi
}

# Program starts here
while true; do
findstock
done
exit


Image


Top
 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP