LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-06-2011, 09:45 AM   #1
calix333
LQ Newbie
 
Registered: Dec 2011
Posts: 1

Rep: Reputation: Disabled
Bash stock quotes with curl


Hi,

I am trying to write a script that I will allow to run continually monitoring stock quotes sourced from yahoo finance.

My problem is how to compare prices each time they are retrieved so I can format them appropriately, e.g. red text for decrease in price green text for increase/no-change.

My code so far:

Code:
#/bin/bash

while x=0; do  
val=`curl -s http://download.finance.yahoo.com/d/quotes.csv?\s\=BARC.L\&\f\=l1`
echo -e "\033[32m$val\033[0m";
val2=`curl -s http://download.finance.yahoo.com/d/quotes.csv?\s\=BARC.L\&\f\=l1`
if [ $val2 -lt $val ]; then
  #prints in red indicating price fall
  echo -e "\033[33m$val2\033[0m";
fi
sleep 5;
done
I would appreciate some input.

Thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Yet Another Bash Quotes Within Quotes Issue tboyer Linux - Software 17 11-03-2012 11:17 AM
GnuCash Stock Quotes wont find OTC BB LazerPhreak Linux - Software 1 03-06-2011 03:21 PM
Streaming stock quotes? kalleanka Programming 3 08-30-2010 05:01 AM
Quotes in bash Mr. Alex Linux - Newbie 4 08-19-2010 02:12 AM
[SOLVED] Using a long Bash command including single quotes and pipes in a Bash script antcore Linux - General 9 07-22-2009 11:10 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration