From ed0dd49dd8a8f1cf00835591c4dfde3b4474c2cb Mon Sep 17 00:00:00 2001 From: Nikolas Garofil Date: Thu, 22 Apr 2010 16:52:15 +0200 Subject: [PATCH] Add some more stock data that yahoo is providing --- doc/variables.xml | 2 +- src/core.cc | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/doc/variables.xml b/doc/variables.xml index 96b8b4e6..528904de 100644 --- a/doc/variables.xml +++ b/doc/variables.xml @@ -3281,7 +3281,7 @@ Displays the data of a stock symbol. The following data - is supported: adv(Average Daily Volume),ask,asksize,bid + is supported: adv(Average Daily Volume),ask,asksize,bid,askrt(ask realtime),bidrt(bid realtime),bookvalue,bidsize,change,commission,changert(change realtime),ahcrt(After Hours Change realtime),ds(dividend/share),ltd(Last Trade Date),tradedate,es(earnings/share),ei(error indication),epsecy(EPS Estimate Current Year),epseny(EPS Estimate Next Year),epsenq(EPS Estimate Next Quarter),floatshares,dayslow,dayshigh,52weeklow,52weekhigh,hgp(Holdings Gain Percent),ag(Annualized Gain),hg(Holdings Gain),hgprt(Holdings Gain Percent realtime),hgrt(Holdings Gain realtime),moreinfo,obrt(Order Book realtime) diff --git a/src/core.cc b/src/core.cc index 34d7f77b..1779cab4 100644 --- a/src/core.cc +++ b/src/core.cc @@ -153,6 +153,34 @@ void stock_parse_arg(struct text_object *obj, const char *arg) else if(!strcasecmp("adv", data)) strcpy(data, "a2"); else if(!strcasecmp("asksize", data)) strcpy(data, "a5"); else if(!strcasecmp("bid", data)) strcpy(data, "b"); + else if(!strcasecmp("askrt", data)) strcpy(data, "b2"); + else if(!strcasecmp("bidrt", data)) strcpy(data, "b3"); + else if(!strcasecmp("bookvalue", data)) strcpy(data, "b4"); + else if(!strcasecmp("bidsize", data)) strcpy(data, "b6"); + else if(!strcasecmp("change", data)) strcpy(data, "c1"); + else if(!strcasecmp("commission", data)) strcpy(data, "c3"); + else if(!strcasecmp("changert", data)) strcpy(data, "c6"); + else if(!strcasecmp("ahcrt", data)) strcpy(data, "c8"); + else if(!strcasecmp("ds", data)) strcpy(data, "d"); + else if(!strcasecmp("ltd", data)) strcpy(data, "d1"); + else if(!strcasecmp("tradedate", data)) strcpy(data, "d2"); + else if(!strcasecmp("es", data)) strcpy(data, "e"); + else if(!strcasecmp("ei", data)) strcpy(data, "e1"); + else if(!strcasecmp("epsecy", data)) strcpy(data, "e7"); + else if(!strcasecmp("epseny", data)) strcpy(data, "e8"); + else if(!strcasecmp("epsenq", data)) strcpy(data, "e9"); + else if(!strcasecmp("floatshares", data)) strcpy(data, "f6"); + else if(!strcasecmp("dayslow", data)) strcpy(data, "g"); + else if(!strcasecmp("dayshigh", data)) strcpy(data, "h"); + else if(!strcasecmp("52weeklow", data)) strcpy(data, "j"); + else if(!strcasecmp("52weekhigh", data)) strcpy(data, "k"); + else if(!strcasecmp("hgp", data)) strcpy(data, "g1"); + else if(!strcasecmp("ag", data)) strcpy(data, "g3"); + else if(!strcasecmp("hg", data)) strcpy(data, "g4"); + else if(!strcasecmp("hgprt", data)) strcpy(data, "g5"); + else if(!strcasecmp("hgrt", data)) strcpy(data, "g6"); + else if(!strcasecmp("moreinfo", data)) strcpy(data, "i"); + else if(!strcasecmp("obrt", data)) strcpy(data, "i5"); else { NORM_ERR("\"%s\" is not supported by $stock. Supported: adv,ask,asksize,bid", data); return;